app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054
  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. require: true
  2161. },
  2162. modalId: {
  2163. type: String,
  2164. require: true
  2165. },
  2166. noteType: {
  2167. type: Number
  2168. },
  2169. noteUser: {
  2170. type: String
  2171. },
  2172. woid: {
  2173. type: Number
  2174. }
  2175. },
  2176. data: function data() {
  2177. return {
  2178. note: JSON.parse(JSON.stringify(this.populateWith))
  2179. };
  2180. },
  2181. methods: {
  2182. updateNote: function updateNote(note) {
  2183. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2184. hideModal();
  2185. });
  2186. },
  2187. hideModal: function hideModal() {
  2188. $('#' + this.modalId).modal('hide');
  2189. }
  2190. }
  2191. });
  2192. /***/ }),
  2193. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2194. /*!****************************************************************************************************************************************************************!*\
  2195. !*** ./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& ***!
  2196. \****************************************************************************************************************************************************************/
  2197. /*! exports provided: default */
  2198. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2199. "use strict";
  2200. __webpack_require__.r(__webpack_exports__);
  2201. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. /* harmony default export */ __webpack_exports__["default"] = ({
  2241. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2242. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2243. data: function data() {
  2244. return {
  2245. notes: Object.values(this.initialnotes),
  2246. currentOrder: 'order-first',
  2247. newNote: {
  2248. notetype: this.noteType,
  2249. thenote: '',
  2250. noteuser: this.authusername,
  2251. woid: this.woid
  2252. }
  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. createNote: function createNote() {
  2269. var _this = this;
  2270. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2271. $('#note' + _this.noteType + 'add').collapse('hide');
  2272. _this.newNote.thenote = '';
  2273. });
  2274. }
  2275. }
  2276. });
  2277. /***/ }),
  2278. /***/ "./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&":
  2279. /*!****************************************************************************************************************************************************************************!*\
  2280. !*** ./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& ***!
  2281. \****************************************************************************************************************************************************************************/
  2282. /*! exports provided: default */
  2283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2284. "use strict";
  2285. __webpack_require__.r(__webpack_exports__);
  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. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. /* harmony default export */ __webpack_exports__["default"] = ({
  2320. props: ['populateWith', 'storeList', 'modalId'],
  2321. data: function data() {
  2322. return {
  2323. // Copies object from prop, so it doesn't mutate the object
  2324. // from the parent component. Parent component will be updated via
  2325. // Websocket if updateWorkOrder is successful.
  2326. data: JSON.parse(JSON.stringify(this.populateWith)),
  2327. id: this.modalId,
  2328. store: {},
  2329. errors: []
  2330. };
  2331. },
  2332. mounted: function mounted() {
  2333. this.store = {
  2334. 'id': this.data.storeid,
  2335. 'name': this.storeList[this.data.storeid]
  2336. };
  2337. },
  2338. methods: {
  2339. updateWorkOrder: function updateWorkOrder() {
  2340. var _this = this;
  2341. this.data.storeid = this.store.id;
  2342. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2343. $('#workordereditModal').modal('hide');
  2344. })["catch"](function (error) {
  2345. _this.errors = JSON.parse(error.response.request.response).errors;
  2346. });
  2347. }
  2348. }
  2349. });
  2350. /***/ }),
  2351. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2352. /*!*****************************************************************************************************************************************************************!*\
  2353. !*** ./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& ***!
  2354. \*****************************************************************************************************************************************************************/
  2355. /*! exports provided: default */
  2356. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2357. "use strict";
  2358. __webpack_require__.r(__webpack_exports__);
  2359. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. //
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. /* harmony default export */ __webpack_exports__["default"] = ({
  2381. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2382. props: ['workOrder', 'stores'],
  2383. data: function data() {
  2384. return {
  2385. data: JSON.parse(this.workOrder)
  2386. };
  2387. },
  2388. computed: {
  2389. storeList: function storeList() {
  2390. var list = {};
  2391. JSON.parse(this.stores).map(function (val) {
  2392. list[val.storeid] = val.storesname;
  2393. });
  2394. return list;
  2395. }
  2396. },
  2397. mounted: function mounted() {
  2398. var _this = this;
  2399. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2400. _this.data = e.data;
  2401. });
  2402. }
  2403. });
  2404. /***/ }),
  2405. /***/ "./node_modules/base64-js/index.js":
  2406. /*!*****************************************!*\
  2407. !*** ./node_modules/base64-js/index.js ***!
  2408. \*****************************************/
  2409. /*! no static exports found */
  2410. /***/ (function(module, exports, __webpack_require__) {
  2411. "use strict";
  2412. exports.byteLength = byteLength
  2413. exports.toByteArray = toByteArray
  2414. exports.fromByteArray = fromByteArray
  2415. var lookup = []
  2416. var revLookup = []
  2417. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2418. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2419. for (var i = 0, len = code.length; i < len; ++i) {
  2420. lookup[i] = code[i]
  2421. revLookup[code.charCodeAt(i)] = i
  2422. }
  2423. // Support decoding URL-safe base64 strings, as Node.js does.
  2424. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2425. revLookup['-'.charCodeAt(0)] = 62
  2426. revLookup['_'.charCodeAt(0)] = 63
  2427. function getLens (b64) {
  2428. var len = b64.length
  2429. if (len % 4 > 0) {
  2430. throw new Error('Invalid string. Length must be a multiple of 4')
  2431. }
  2432. // Trim off extra bytes after placeholder bytes are found
  2433. // See: https://github.com/beatgammit/base64-js/issues/42
  2434. var validLen = b64.indexOf('=')
  2435. if (validLen === -1) validLen = len
  2436. var placeHoldersLen = validLen === len
  2437. ? 0
  2438. : 4 - (validLen % 4)
  2439. return [validLen, placeHoldersLen]
  2440. }
  2441. // base64 is 4/3 + up to two characters of the original data
  2442. function byteLength (b64) {
  2443. var lens = getLens(b64)
  2444. var validLen = lens[0]
  2445. var placeHoldersLen = lens[1]
  2446. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2447. }
  2448. function _byteLength (b64, validLen, placeHoldersLen) {
  2449. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2450. }
  2451. function toByteArray (b64) {
  2452. var tmp
  2453. var lens = getLens(b64)
  2454. var validLen = lens[0]
  2455. var placeHoldersLen = lens[1]
  2456. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2457. var curByte = 0
  2458. // if there are placeholders, only get up to the last complete 4 chars
  2459. var len = placeHoldersLen > 0
  2460. ? validLen - 4
  2461. : validLen
  2462. var i
  2463. for (i = 0; i < len; i += 4) {
  2464. tmp =
  2465. (revLookup[b64.charCodeAt(i)] << 18) |
  2466. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2467. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2468. revLookup[b64.charCodeAt(i + 3)]
  2469. arr[curByte++] = (tmp >> 16) & 0xFF
  2470. arr[curByte++] = (tmp >> 8) & 0xFF
  2471. arr[curByte++] = tmp & 0xFF
  2472. }
  2473. if (placeHoldersLen === 2) {
  2474. tmp =
  2475. (revLookup[b64.charCodeAt(i)] << 2) |
  2476. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2477. arr[curByte++] = tmp & 0xFF
  2478. }
  2479. if (placeHoldersLen === 1) {
  2480. tmp =
  2481. (revLookup[b64.charCodeAt(i)] << 10) |
  2482. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2483. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2484. arr[curByte++] = (tmp >> 8) & 0xFF
  2485. arr[curByte++] = tmp & 0xFF
  2486. }
  2487. return arr
  2488. }
  2489. function tripletToBase64 (num) {
  2490. return lookup[num >> 18 & 0x3F] +
  2491. lookup[num >> 12 & 0x3F] +
  2492. lookup[num >> 6 & 0x3F] +
  2493. lookup[num & 0x3F]
  2494. }
  2495. function encodeChunk (uint8, start, end) {
  2496. var tmp
  2497. var output = []
  2498. for (var i = start; i < end; i += 3) {
  2499. tmp =
  2500. ((uint8[i] << 16) & 0xFF0000) +
  2501. ((uint8[i + 1] << 8) & 0xFF00) +
  2502. (uint8[i + 2] & 0xFF)
  2503. output.push(tripletToBase64(tmp))
  2504. }
  2505. return output.join('')
  2506. }
  2507. function fromByteArray (uint8) {
  2508. var tmp
  2509. var len = uint8.length
  2510. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2511. var parts = []
  2512. var maxChunkLength = 16383 // must be multiple of 3
  2513. // go through the array every three bytes, we'll deal with trailing stuff later
  2514. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2515. parts.push(encodeChunk(
  2516. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2517. ))
  2518. }
  2519. // pad the end with zeros, but make sure to not forget the extra bytes
  2520. if (extraBytes === 1) {
  2521. tmp = uint8[len - 1]
  2522. parts.push(
  2523. lookup[tmp >> 2] +
  2524. lookup[(tmp << 4) & 0x3F] +
  2525. '=='
  2526. )
  2527. } else if (extraBytes === 2) {
  2528. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2529. parts.push(
  2530. lookup[tmp >> 10] +
  2531. lookup[(tmp >> 4) & 0x3F] +
  2532. lookup[(tmp << 2) & 0x3F] +
  2533. '='
  2534. )
  2535. }
  2536. return parts.join('')
  2537. }
  2538. /***/ }),
  2539. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2540. /*!*****************************************************!*\
  2541. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2542. \*****************************************************/
  2543. /*! no static exports found */
  2544. /***/ (function(module, exports, __webpack_require__) {
  2545. /*!
  2546. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2547. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2548. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2549. */
  2550. (function (global, factory) {
  2551. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2552. undefined;
  2553. }(this, (function (exports, $, Popper) { 'use strict';
  2554. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2555. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2556. function _defineProperties(target, props) {
  2557. for (var i = 0; i < props.length; i++) {
  2558. var descriptor = props[i];
  2559. descriptor.enumerable = descriptor.enumerable || false;
  2560. descriptor.configurable = true;
  2561. if ("value" in descriptor) descriptor.writable = true;
  2562. Object.defineProperty(target, descriptor.key, descriptor);
  2563. }
  2564. }
  2565. function _createClass(Constructor, protoProps, staticProps) {
  2566. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2567. if (staticProps) _defineProperties(Constructor, staticProps);
  2568. return Constructor;
  2569. }
  2570. function _defineProperty(obj, key, value) {
  2571. if (key in obj) {
  2572. Object.defineProperty(obj, key, {
  2573. value: value,
  2574. enumerable: true,
  2575. configurable: true,
  2576. writable: true
  2577. });
  2578. } else {
  2579. obj[key] = value;
  2580. }
  2581. return obj;
  2582. }
  2583. function ownKeys(object, enumerableOnly) {
  2584. var keys = Object.keys(object);
  2585. if (Object.getOwnPropertySymbols) {
  2586. var symbols = Object.getOwnPropertySymbols(object);
  2587. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2588. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2589. });
  2590. keys.push.apply(keys, symbols);
  2591. }
  2592. return keys;
  2593. }
  2594. function _objectSpread2(target) {
  2595. for (var i = 1; i < arguments.length; i++) {
  2596. var source = arguments[i] != null ? arguments[i] : {};
  2597. if (i % 2) {
  2598. ownKeys(Object(source), true).forEach(function (key) {
  2599. _defineProperty(target, key, source[key]);
  2600. });
  2601. } else if (Object.getOwnPropertyDescriptors) {
  2602. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2603. } else {
  2604. ownKeys(Object(source)).forEach(function (key) {
  2605. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2606. });
  2607. }
  2608. }
  2609. return target;
  2610. }
  2611. function _inheritsLoose(subClass, superClass) {
  2612. subClass.prototype = Object.create(superClass.prototype);
  2613. subClass.prototype.constructor = subClass;
  2614. subClass.__proto__ = superClass;
  2615. }
  2616. /**
  2617. * --------------------------------------------------------------------------
  2618. * Bootstrap (v4.4.1): util.js
  2619. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2620. * --------------------------------------------------------------------------
  2621. */
  2622. /**
  2623. * ------------------------------------------------------------------------
  2624. * Private TransitionEnd Helpers
  2625. * ------------------------------------------------------------------------
  2626. */
  2627. var TRANSITION_END = 'transitionend';
  2628. var MAX_UID = 1000000;
  2629. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2630. function toType(obj) {
  2631. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2632. }
  2633. function getSpecialTransitionEndEvent() {
  2634. return {
  2635. bindType: TRANSITION_END,
  2636. delegateType: TRANSITION_END,
  2637. handle: function handle(event) {
  2638. if ($(event.target).is(this)) {
  2639. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2640. }
  2641. return undefined; // eslint-disable-line no-undefined
  2642. }
  2643. };
  2644. }
  2645. function transitionEndEmulator(duration) {
  2646. var _this = this;
  2647. var called = false;
  2648. $(this).one(Util.TRANSITION_END, function () {
  2649. called = true;
  2650. });
  2651. setTimeout(function () {
  2652. if (!called) {
  2653. Util.triggerTransitionEnd(_this);
  2654. }
  2655. }, duration);
  2656. return this;
  2657. }
  2658. function setTransitionEndSupport() {
  2659. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2660. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2661. }
  2662. /**
  2663. * --------------------------------------------------------------------------
  2664. * Public Util Api
  2665. * --------------------------------------------------------------------------
  2666. */
  2667. var Util = {
  2668. TRANSITION_END: 'bsTransitionEnd',
  2669. getUID: function getUID(prefix) {
  2670. do {
  2671. // eslint-disable-next-line no-bitwise
  2672. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2673. } while (document.getElementById(prefix));
  2674. return prefix;
  2675. },
  2676. getSelectorFromElement: function getSelectorFromElement(element) {
  2677. var selector = element.getAttribute('data-target');
  2678. if (!selector || selector === '#') {
  2679. var hrefAttr = element.getAttribute('href');
  2680. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2681. }
  2682. try {
  2683. return document.querySelector(selector) ? selector : null;
  2684. } catch (err) {
  2685. return null;
  2686. }
  2687. },
  2688. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2689. if (!element) {
  2690. return 0;
  2691. } // Get transition-duration of the element
  2692. var transitionDuration = $(element).css('transition-duration');
  2693. var transitionDelay = $(element).css('transition-delay');
  2694. var floatTransitionDuration = parseFloat(transitionDuration);
  2695. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2696. if (!floatTransitionDuration && !floatTransitionDelay) {
  2697. return 0;
  2698. } // If multiple durations are defined, take the first
  2699. transitionDuration = transitionDuration.split(',')[0];
  2700. transitionDelay = transitionDelay.split(',')[0];
  2701. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2702. },
  2703. reflow: function reflow(element) {
  2704. return element.offsetHeight;
  2705. },
  2706. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2707. $(element).trigger(TRANSITION_END);
  2708. },
  2709. // TODO: Remove in v5
  2710. supportsTransitionEnd: function supportsTransitionEnd() {
  2711. return Boolean(TRANSITION_END);
  2712. },
  2713. isElement: function isElement(obj) {
  2714. return (obj[0] || obj).nodeType;
  2715. },
  2716. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2717. for (var property in configTypes) {
  2718. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2719. var expectedTypes = configTypes[property];
  2720. var value = config[property];
  2721. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2722. if (!new RegExp(expectedTypes).test(valueType)) {
  2723. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2724. }
  2725. }
  2726. }
  2727. },
  2728. findShadowRoot: function findShadowRoot(element) {
  2729. if (!document.documentElement.attachShadow) {
  2730. return null;
  2731. } // Can find the shadow root otherwise it'll return the document
  2732. if (typeof element.getRootNode === 'function') {
  2733. var root = element.getRootNode();
  2734. return root instanceof ShadowRoot ? root : null;
  2735. }
  2736. if (element instanceof ShadowRoot) {
  2737. return element;
  2738. } // when we don't find a shadow root
  2739. if (!element.parentNode) {
  2740. return null;
  2741. }
  2742. return Util.findShadowRoot(element.parentNode);
  2743. },
  2744. jQueryDetection: function jQueryDetection() {
  2745. if (typeof $ === 'undefined') {
  2746. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2747. }
  2748. var version = $.fn.jquery.split(' ')[0].split('.');
  2749. var minMajor = 1;
  2750. var ltMajor = 2;
  2751. var minMinor = 9;
  2752. var minPatch = 1;
  2753. var maxMajor = 4;
  2754. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2755. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2756. }
  2757. }
  2758. };
  2759. Util.jQueryDetection();
  2760. setTransitionEndSupport();
  2761. /**
  2762. * ------------------------------------------------------------------------
  2763. * Constants
  2764. * ------------------------------------------------------------------------
  2765. */
  2766. var NAME = 'alert';
  2767. var VERSION = '4.4.1';
  2768. var DATA_KEY = 'bs.alert';
  2769. var EVENT_KEY = "." + DATA_KEY;
  2770. var DATA_API_KEY = '.data-api';
  2771. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2772. var Selector = {
  2773. DISMISS: '[data-dismiss="alert"]'
  2774. };
  2775. var Event = {
  2776. CLOSE: "close" + EVENT_KEY,
  2777. CLOSED: "closed" + EVENT_KEY,
  2778. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2779. };
  2780. var ClassName = {
  2781. ALERT: 'alert',
  2782. FADE: 'fade',
  2783. SHOW: 'show'
  2784. };
  2785. /**
  2786. * ------------------------------------------------------------------------
  2787. * Class Definition
  2788. * ------------------------------------------------------------------------
  2789. */
  2790. var Alert =
  2791. /*#__PURE__*/
  2792. function () {
  2793. function Alert(element) {
  2794. this._element = element;
  2795. } // Getters
  2796. var _proto = Alert.prototype;
  2797. // Public
  2798. _proto.close = function close(element) {
  2799. var rootElement = this._element;
  2800. if (element) {
  2801. rootElement = this._getRootElement(element);
  2802. }
  2803. var customEvent = this._triggerCloseEvent(rootElement);
  2804. if (customEvent.isDefaultPrevented()) {
  2805. return;
  2806. }
  2807. this._removeElement(rootElement);
  2808. };
  2809. _proto.dispose = function dispose() {
  2810. $.removeData(this._element, DATA_KEY);
  2811. this._element = null;
  2812. } // Private
  2813. ;
  2814. _proto._getRootElement = function _getRootElement(element) {
  2815. var selector = Util.getSelectorFromElement(element);
  2816. var parent = false;
  2817. if (selector) {
  2818. parent = document.querySelector(selector);
  2819. }
  2820. if (!parent) {
  2821. parent = $(element).closest("." + ClassName.ALERT)[0];
  2822. }
  2823. return parent;
  2824. };
  2825. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2826. var closeEvent = $.Event(Event.CLOSE);
  2827. $(element).trigger(closeEvent);
  2828. return closeEvent;
  2829. };
  2830. _proto._removeElement = function _removeElement(element) {
  2831. var _this = this;
  2832. $(element).removeClass(ClassName.SHOW);
  2833. if (!$(element).hasClass(ClassName.FADE)) {
  2834. this._destroyElement(element);
  2835. return;
  2836. }
  2837. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2838. $(element).one(Util.TRANSITION_END, function (event) {
  2839. return _this._destroyElement(element, event);
  2840. }).emulateTransitionEnd(transitionDuration);
  2841. };
  2842. _proto._destroyElement = function _destroyElement(element) {
  2843. $(element).detach().trigger(Event.CLOSED).remove();
  2844. } // Static
  2845. ;
  2846. Alert._jQueryInterface = function _jQueryInterface(config) {
  2847. return this.each(function () {
  2848. var $element = $(this);
  2849. var data = $element.data(DATA_KEY);
  2850. if (!data) {
  2851. data = new Alert(this);
  2852. $element.data(DATA_KEY, data);
  2853. }
  2854. if (config === 'close') {
  2855. data[config](this);
  2856. }
  2857. });
  2858. };
  2859. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2860. return function (event) {
  2861. if (event) {
  2862. event.preventDefault();
  2863. }
  2864. alertInstance.close(this);
  2865. };
  2866. };
  2867. _createClass(Alert, null, [{
  2868. key: "VERSION",
  2869. get: function get() {
  2870. return VERSION;
  2871. }
  2872. }]);
  2873. return Alert;
  2874. }();
  2875. /**
  2876. * ------------------------------------------------------------------------
  2877. * Data Api implementation
  2878. * ------------------------------------------------------------------------
  2879. */
  2880. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2881. /**
  2882. * ------------------------------------------------------------------------
  2883. * jQuery
  2884. * ------------------------------------------------------------------------
  2885. */
  2886. $.fn[NAME] = Alert._jQueryInterface;
  2887. $.fn[NAME].Constructor = Alert;
  2888. $.fn[NAME].noConflict = function () {
  2889. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2890. return Alert._jQueryInterface;
  2891. };
  2892. /**
  2893. * ------------------------------------------------------------------------
  2894. * Constants
  2895. * ------------------------------------------------------------------------
  2896. */
  2897. var NAME$1 = 'button';
  2898. var VERSION$1 = '4.4.1';
  2899. var DATA_KEY$1 = 'bs.button';
  2900. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2901. var DATA_API_KEY$1 = '.data-api';
  2902. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2903. var ClassName$1 = {
  2904. ACTIVE: 'active',
  2905. BUTTON: 'btn',
  2906. FOCUS: 'focus'
  2907. };
  2908. var Selector$1 = {
  2909. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2910. DATA_TOGGLES: '[data-toggle="buttons"]',
  2911. DATA_TOGGLE: '[data-toggle="button"]',
  2912. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2913. INPUT: 'input:not([type="hidden"])',
  2914. ACTIVE: '.active',
  2915. BUTTON: '.btn'
  2916. };
  2917. var Event$1 = {
  2918. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2919. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2920. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2921. };
  2922. /**
  2923. * ------------------------------------------------------------------------
  2924. * Class Definition
  2925. * ------------------------------------------------------------------------
  2926. */
  2927. var Button =
  2928. /*#__PURE__*/
  2929. function () {
  2930. function Button(element) {
  2931. this._element = element;
  2932. } // Getters
  2933. var _proto = Button.prototype;
  2934. // Public
  2935. _proto.toggle = function toggle() {
  2936. var triggerChangeEvent = true;
  2937. var addAriaPressed = true;
  2938. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2939. if (rootElement) {
  2940. var input = this._element.querySelector(Selector$1.INPUT);
  2941. if (input) {
  2942. if (input.type === 'radio') {
  2943. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2944. triggerChangeEvent = false;
  2945. } else {
  2946. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2947. if (activeElement) {
  2948. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2949. }
  2950. }
  2951. } else if (input.type === 'checkbox') {
  2952. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2953. triggerChangeEvent = false;
  2954. }
  2955. } else {
  2956. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2957. triggerChangeEvent = false;
  2958. }
  2959. if (triggerChangeEvent) {
  2960. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2961. $(input).trigger('change');
  2962. }
  2963. input.focus();
  2964. addAriaPressed = false;
  2965. }
  2966. }
  2967. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2968. if (addAriaPressed) {
  2969. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2970. }
  2971. if (triggerChangeEvent) {
  2972. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2973. }
  2974. }
  2975. };
  2976. _proto.dispose = function dispose() {
  2977. $.removeData(this._element, DATA_KEY$1);
  2978. this._element = null;
  2979. } // Static
  2980. ;
  2981. Button._jQueryInterface = function _jQueryInterface(config) {
  2982. return this.each(function () {
  2983. var data = $(this).data(DATA_KEY$1);
  2984. if (!data) {
  2985. data = new Button(this);
  2986. $(this).data(DATA_KEY$1, data);
  2987. }
  2988. if (config === 'toggle') {
  2989. data[config]();
  2990. }
  2991. });
  2992. };
  2993. _createClass(Button, null, [{
  2994. key: "VERSION",
  2995. get: function get() {
  2996. return VERSION$1;
  2997. }
  2998. }]);
  2999. return Button;
  3000. }();
  3001. /**
  3002. * ------------------------------------------------------------------------
  3003. * Data Api implementation
  3004. * ------------------------------------------------------------------------
  3005. */
  3006. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3007. var button = event.target;
  3008. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3009. button = $(button).closest(Selector$1.BUTTON)[0];
  3010. }
  3011. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3012. event.preventDefault(); // work around Firefox bug #1540995
  3013. } else {
  3014. var inputBtn = button.querySelector(Selector$1.INPUT);
  3015. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3016. event.preventDefault(); // work around Firefox bug #1540995
  3017. return;
  3018. }
  3019. Button._jQueryInterface.call($(button), 'toggle');
  3020. }
  3021. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3022. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3023. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3024. });
  3025. $(window).on(Event$1.LOAD_DATA_API, function () {
  3026. // ensure correct active class is set to match the controls' actual values/states
  3027. // find all checkboxes/readio buttons inside data-toggle groups
  3028. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3029. for (var i = 0, len = buttons.length; i < len; i++) {
  3030. var button = buttons[i];
  3031. var input = button.querySelector(Selector$1.INPUT);
  3032. if (input.checked || input.hasAttribute('checked')) {
  3033. button.classList.add(ClassName$1.ACTIVE);
  3034. } else {
  3035. button.classList.remove(ClassName$1.ACTIVE);
  3036. }
  3037. } // find all button toggles
  3038. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3039. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3040. var _button = buttons[_i];
  3041. if (_button.getAttribute('aria-pressed') === 'true') {
  3042. _button.classList.add(ClassName$1.ACTIVE);
  3043. } else {
  3044. _button.classList.remove(ClassName$1.ACTIVE);
  3045. }
  3046. }
  3047. });
  3048. /**
  3049. * ------------------------------------------------------------------------
  3050. * jQuery
  3051. * ------------------------------------------------------------------------
  3052. */
  3053. $.fn[NAME$1] = Button._jQueryInterface;
  3054. $.fn[NAME$1].Constructor = Button;
  3055. $.fn[NAME$1].noConflict = function () {
  3056. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3057. return Button._jQueryInterface;
  3058. };
  3059. /**
  3060. * ------------------------------------------------------------------------
  3061. * Constants
  3062. * ------------------------------------------------------------------------
  3063. */
  3064. var NAME$2 = 'carousel';
  3065. var VERSION$2 = '4.4.1';
  3066. var DATA_KEY$2 = 'bs.carousel';
  3067. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3068. var DATA_API_KEY$2 = '.data-api';
  3069. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3070. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3071. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3072. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3073. var SWIPE_THRESHOLD = 40;
  3074. var Default = {
  3075. interval: 5000,
  3076. keyboard: true,
  3077. slide: false,
  3078. pause: 'hover',
  3079. wrap: true,
  3080. touch: true
  3081. };
  3082. var DefaultType = {
  3083. interval: '(number|boolean)',
  3084. keyboard: 'boolean',
  3085. slide: '(boolean|string)',
  3086. pause: '(string|boolean)',
  3087. wrap: 'boolean',
  3088. touch: 'boolean'
  3089. };
  3090. var Direction = {
  3091. NEXT: 'next',
  3092. PREV: 'prev',
  3093. LEFT: 'left',
  3094. RIGHT: 'right'
  3095. };
  3096. var Event$2 = {
  3097. SLIDE: "slide" + EVENT_KEY$2,
  3098. SLID: "slid" + EVENT_KEY$2,
  3099. KEYDOWN: "keydown" + EVENT_KEY$2,
  3100. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3101. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3102. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3103. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3104. TOUCHEND: "touchend" + EVENT_KEY$2,
  3105. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3106. POINTERUP: "pointerup" + EVENT_KEY$2,
  3107. DRAG_START: "dragstart" + EVENT_KEY$2,
  3108. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3109. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3110. };
  3111. var ClassName$2 = {
  3112. CAROUSEL: 'carousel',
  3113. ACTIVE: 'active',
  3114. SLIDE: 'slide',
  3115. RIGHT: 'carousel-item-right',
  3116. LEFT: 'carousel-item-left',
  3117. NEXT: 'carousel-item-next',
  3118. PREV: 'carousel-item-prev',
  3119. ITEM: 'carousel-item',
  3120. POINTER_EVENT: 'pointer-event'
  3121. };
  3122. var Selector$2 = {
  3123. ACTIVE: '.active',
  3124. ACTIVE_ITEM: '.active.carousel-item',
  3125. ITEM: '.carousel-item',
  3126. ITEM_IMG: '.carousel-item img',
  3127. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3128. INDICATORS: '.carousel-indicators',
  3129. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3130. DATA_RIDE: '[data-ride="carousel"]'
  3131. };
  3132. var PointerType = {
  3133. TOUCH: 'touch',
  3134. PEN: 'pen'
  3135. };
  3136. /**
  3137. * ------------------------------------------------------------------------
  3138. * Class Definition
  3139. * ------------------------------------------------------------------------
  3140. */
  3141. var Carousel =
  3142. /*#__PURE__*/
  3143. function () {
  3144. function Carousel(element, config) {
  3145. this._items = null;
  3146. this._interval = null;
  3147. this._activeElement = null;
  3148. this._isPaused = false;
  3149. this._isSliding = false;
  3150. this.touchTimeout = null;
  3151. this.touchStartX = 0;
  3152. this.touchDeltaX = 0;
  3153. this._config = this._getConfig(config);
  3154. this._element = element;
  3155. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3156. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3157. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3158. this._addEventListeners();
  3159. } // Getters
  3160. var _proto = Carousel.prototype;
  3161. // Public
  3162. _proto.next = function next() {
  3163. if (!this._isSliding) {
  3164. this._slide(Direction.NEXT);
  3165. }
  3166. };
  3167. _proto.nextWhenVisible = function nextWhenVisible() {
  3168. // Don't call next when the page isn't visible
  3169. // or the carousel or its parent isn't visible
  3170. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3171. this.next();
  3172. }
  3173. };
  3174. _proto.prev = function prev() {
  3175. if (!this._isSliding) {
  3176. this._slide(Direction.PREV);
  3177. }
  3178. };
  3179. _proto.pause = function pause(event) {
  3180. if (!event) {
  3181. this._isPaused = true;
  3182. }
  3183. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3184. Util.triggerTransitionEnd(this._element);
  3185. this.cycle(true);
  3186. }
  3187. clearInterval(this._interval);
  3188. this._interval = null;
  3189. };
  3190. _proto.cycle = function cycle(event) {
  3191. if (!event) {
  3192. this._isPaused = false;
  3193. }
  3194. if (this._interval) {
  3195. clearInterval(this._interval);
  3196. this._interval = null;
  3197. }
  3198. if (this._config.interval && !this._isPaused) {
  3199. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3200. }
  3201. };
  3202. _proto.to = function to(index) {
  3203. var _this = this;
  3204. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3205. var activeIndex = this._getItemIndex(this._activeElement);
  3206. if (index > this._items.length - 1 || index < 0) {
  3207. return;
  3208. }
  3209. if (this._isSliding) {
  3210. $(this._element).one(Event$2.SLID, function () {
  3211. return _this.to(index);
  3212. });
  3213. return;
  3214. }
  3215. if (activeIndex === index) {
  3216. this.pause();
  3217. this.cycle();
  3218. return;
  3219. }
  3220. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3221. this._slide(direction, this._items[index]);
  3222. };
  3223. _proto.dispose = function dispose() {
  3224. $(this._element).off(EVENT_KEY$2);
  3225. $.removeData(this._element, DATA_KEY$2);
  3226. this._items = null;
  3227. this._config = null;
  3228. this._element = null;
  3229. this._interval = null;
  3230. this._isPaused = null;
  3231. this._isSliding = null;
  3232. this._activeElement = null;
  3233. this._indicatorsElement = null;
  3234. } // Private
  3235. ;
  3236. _proto._getConfig = function _getConfig(config) {
  3237. config = _objectSpread2({}, Default, {}, config);
  3238. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3239. return config;
  3240. };
  3241. _proto._handleSwipe = function _handleSwipe() {
  3242. var absDeltax = Math.abs(this.touchDeltaX);
  3243. if (absDeltax <= SWIPE_THRESHOLD) {
  3244. return;
  3245. }
  3246. var direction = absDeltax / this.touchDeltaX;
  3247. this.touchDeltaX = 0; // swipe left
  3248. if (direction > 0) {
  3249. this.prev();
  3250. } // swipe right
  3251. if (direction < 0) {
  3252. this.next();
  3253. }
  3254. };
  3255. _proto._addEventListeners = function _addEventListeners() {
  3256. var _this2 = this;
  3257. if (this._config.keyboard) {
  3258. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3259. return _this2._keydown(event);
  3260. });
  3261. }
  3262. if (this._config.pause === 'hover') {
  3263. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3264. return _this2.pause(event);
  3265. }).on(Event$2.MOUSELEAVE, function (event) {
  3266. return _this2.cycle(event);
  3267. });
  3268. }
  3269. if (this._config.touch) {
  3270. this._addTouchEventListeners();
  3271. }
  3272. };
  3273. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3274. var _this3 = this;
  3275. if (!this._touchSupported) {
  3276. return;
  3277. }
  3278. var start = function start(event) {
  3279. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3280. _this3.touchStartX = event.originalEvent.clientX;
  3281. } else if (!_this3._pointerEvent) {
  3282. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3283. }
  3284. };
  3285. var move = function move(event) {
  3286. // ensure swiping with one touch and not pinching
  3287. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3288. _this3.touchDeltaX = 0;
  3289. } else {
  3290. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3291. }
  3292. };
  3293. var end = function end(event) {
  3294. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3295. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3296. }
  3297. _this3._handleSwipe();
  3298. if (_this3._config.pause === 'hover') {
  3299. // If it's a touch-enabled device, mouseenter/leave are fired as
  3300. // part of the mouse compatibility events on first tap - the carousel
  3301. // would stop cycling until user tapped out of it;
  3302. // here, we listen for touchend, explicitly pause the carousel
  3303. // (as if it's the second time we tap on it, mouseenter compat event
  3304. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3305. // events to fire) we explicitly restart cycling
  3306. _this3.pause();
  3307. if (_this3.touchTimeout) {
  3308. clearTimeout(_this3.touchTimeout);
  3309. }
  3310. _this3.touchTimeout = setTimeout(function (event) {
  3311. return _this3.cycle(event);
  3312. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3313. }
  3314. };
  3315. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3316. return e.preventDefault();
  3317. });
  3318. if (this._pointerEvent) {
  3319. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3320. return start(event);
  3321. });
  3322. $(this._element).on(Event$2.POINTERUP, function (event) {
  3323. return end(event);
  3324. });
  3325. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3326. } else {
  3327. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3328. return start(event);
  3329. });
  3330. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3331. return move(event);
  3332. });
  3333. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3334. return end(event);
  3335. });
  3336. }
  3337. };
  3338. _proto._keydown = function _keydown(event) {
  3339. if (/input|textarea/i.test(event.target.tagName)) {
  3340. return;
  3341. }
  3342. switch (event.which) {
  3343. case ARROW_LEFT_KEYCODE:
  3344. event.preventDefault();
  3345. this.prev();
  3346. break;
  3347. case ARROW_RIGHT_KEYCODE:
  3348. event.preventDefault();
  3349. this.next();
  3350. break;
  3351. }
  3352. };
  3353. _proto._getItemIndex = function _getItemIndex(element) {
  3354. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3355. return this._items.indexOf(element);
  3356. };
  3357. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3358. var isNextDirection = direction === Direction.NEXT;
  3359. var isPrevDirection = direction === Direction.PREV;
  3360. var activeIndex = this._getItemIndex(activeElement);
  3361. var lastItemIndex = this._items.length - 1;
  3362. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3363. if (isGoingToWrap && !this._config.wrap) {
  3364. return activeElement;
  3365. }
  3366. var delta = direction === Direction.PREV ? -1 : 1;
  3367. var itemIndex = (activeIndex + delta) % this._items.length;
  3368. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3369. };
  3370. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3371. var targetIndex = this._getItemIndex(relatedTarget);
  3372. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3373. var slideEvent = $.Event(Event$2.SLIDE, {
  3374. relatedTarget: relatedTarget,
  3375. direction: eventDirectionName,
  3376. from: fromIndex,
  3377. to: targetIndex
  3378. });
  3379. $(this._element).trigger(slideEvent);
  3380. return slideEvent;
  3381. };
  3382. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3383. if (this._indicatorsElement) {
  3384. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3385. $(indicators).removeClass(ClassName$2.ACTIVE);
  3386. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3387. if (nextIndicator) {
  3388. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3389. }
  3390. }
  3391. };
  3392. _proto._slide = function _slide(direction, element) {
  3393. var _this4 = this;
  3394. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3395. var activeElementIndex = this._getItemIndex(activeElement);
  3396. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3397. var nextElementIndex = this._getItemIndex(nextElement);
  3398. var isCycling = Boolean(this._interval);
  3399. var directionalClassName;
  3400. var orderClassName;
  3401. var eventDirectionName;
  3402. if (direction === Direction.NEXT) {
  3403. directionalClassName = ClassName$2.LEFT;
  3404. orderClassName = ClassName$2.NEXT;
  3405. eventDirectionName = Direction.LEFT;
  3406. } else {
  3407. directionalClassName = ClassName$2.RIGHT;
  3408. orderClassName = ClassName$2.PREV;
  3409. eventDirectionName = Direction.RIGHT;
  3410. }
  3411. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3412. this._isSliding = false;
  3413. return;
  3414. }
  3415. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3416. if (slideEvent.isDefaultPrevented()) {
  3417. return;
  3418. }
  3419. if (!activeElement || !nextElement) {
  3420. // Some weirdness is happening, so we bail
  3421. return;
  3422. }
  3423. this._isSliding = true;
  3424. if (isCycling) {
  3425. this.pause();
  3426. }
  3427. this._setActiveIndicatorElement(nextElement);
  3428. var slidEvent = $.Event(Event$2.SLID, {
  3429. relatedTarget: nextElement,
  3430. direction: eventDirectionName,
  3431. from: activeElementIndex,
  3432. to: nextElementIndex
  3433. });
  3434. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3435. $(nextElement).addClass(orderClassName);
  3436. Util.reflow(nextElement);
  3437. $(activeElement).addClass(directionalClassName);
  3438. $(nextElement).addClass(directionalClassName);
  3439. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3440. if (nextElementInterval) {
  3441. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3442. this._config.interval = nextElementInterval;
  3443. } else {
  3444. this._config.interval = this._config.defaultInterval || this._config.interval;
  3445. }
  3446. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3447. $(activeElement).one(Util.TRANSITION_END, function () {
  3448. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3449. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3450. _this4._isSliding = false;
  3451. setTimeout(function () {
  3452. return $(_this4._element).trigger(slidEvent);
  3453. }, 0);
  3454. }).emulateTransitionEnd(transitionDuration);
  3455. } else {
  3456. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3457. $(nextElement).addClass(ClassName$2.ACTIVE);
  3458. this._isSliding = false;
  3459. $(this._element).trigger(slidEvent);
  3460. }
  3461. if (isCycling) {
  3462. this.cycle();
  3463. }
  3464. } // Static
  3465. ;
  3466. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3467. return this.each(function () {
  3468. var data = $(this).data(DATA_KEY$2);
  3469. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3470. if (typeof config === 'object') {
  3471. _config = _objectSpread2({}, _config, {}, config);
  3472. }
  3473. var action = typeof config === 'string' ? config : _config.slide;
  3474. if (!data) {
  3475. data = new Carousel(this, _config);
  3476. $(this).data(DATA_KEY$2, data);
  3477. }
  3478. if (typeof config === 'number') {
  3479. data.to(config);
  3480. } else if (typeof action === 'string') {
  3481. if (typeof data[action] === 'undefined') {
  3482. throw new TypeError("No method named \"" + action + "\"");
  3483. }
  3484. data[action]();
  3485. } else if (_config.interval && _config.ride) {
  3486. data.pause();
  3487. data.cycle();
  3488. }
  3489. });
  3490. };
  3491. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3492. var selector = Util.getSelectorFromElement(this);
  3493. if (!selector) {
  3494. return;
  3495. }
  3496. var target = $(selector)[0];
  3497. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3498. return;
  3499. }
  3500. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3501. var slideIndex = this.getAttribute('data-slide-to');
  3502. if (slideIndex) {
  3503. config.interval = false;
  3504. }
  3505. Carousel._jQueryInterface.call($(target), config);
  3506. if (slideIndex) {
  3507. $(target).data(DATA_KEY$2).to(slideIndex);
  3508. }
  3509. event.preventDefault();
  3510. };
  3511. _createClass(Carousel, null, [{
  3512. key: "VERSION",
  3513. get: function get() {
  3514. return VERSION$2;
  3515. }
  3516. }, {
  3517. key: "Default",
  3518. get: function get() {
  3519. return Default;
  3520. }
  3521. }]);
  3522. return Carousel;
  3523. }();
  3524. /**
  3525. * ------------------------------------------------------------------------
  3526. * Data Api implementation
  3527. * ------------------------------------------------------------------------
  3528. */
  3529. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3530. $(window).on(Event$2.LOAD_DATA_API, function () {
  3531. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3532. for (var i = 0, len = carousels.length; i < len; i++) {
  3533. var $carousel = $(carousels[i]);
  3534. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3535. }
  3536. });
  3537. /**
  3538. * ------------------------------------------------------------------------
  3539. * jQuery
  3540. * ------------------------------------------------------------------------
  3541. */
  3542. $.fn[NAME$2] = Carousel._jQueryInterface;
  3543. $.fn[NAME$2].Constructor = Carousel;
  3544. $.fn[NAME$2].noConflict = function () {
  3545. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3546. return Carousel._jQueryInterface;
  3547. };
  3548. /**
  3549. * ------------------------------------------------------------------------
  3550. * Constants
  3551. * ------------------------------------------------------------------------
  3552. */
  3553. var NAME$3 = 'collapse';
  3554. var VERSION$3 = '4.4.1';
  3555. var DATA_KEY$3 = 'bs.collapse';
  3556. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3557. var DATA_API_KEY$3 = '.data-api';
  3558. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3559. var Default$1 = {
  3560. toggle: true,
  3561. parent: ''
  3562. };
  3563. var DefaultType$1 = {
  3564. toggle: 'boolean',
  3565. parent: '(string|element)'
  3566. };
  3567. var Event$3 = {
  3568. SHOW: "show" + EVENT_KEY$3,
  3569. SHOWN: "shown" + EVENT_KEY$3,
  3570. HIDE: "hide" + EVENT_KEY$3,
  3571. HIDDEN: "hidden" + EVENT_KEY$3,
  3572. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3573. };
  3574. var ClassName$3 = {
  3575. SHOW: 'show',
  3576. COLLAPSE: 'collapse',
  3577. COLLAPSING: 'collapsing',
  3578. COLLAPSED: 'collapsed'
  3579. };
  3580. var Dimension = {
  3581. WIDTH: 'width',
  3582. HEIGHT: 'height'
  3583. };
  3584. var Selector$3 = {
  3585. ACTIVES: '.show, .collapsing',
  3586. DATA_TOGGLE: '[data-toggle="collapse"]'
  3587. };
  3588. /**
  3589. * ------------------------------------------------------------------------
  3590. * Class Definition
  3591. * ------------------------------------------------------------------------
  3592. */
  3593. var Collapse =
  3594. /*#__PURE__*/
  3595. function () {
  3596. function Collapse(element, config) {
  3597. this._isTransitioning = false;
  3598. this._element = element;
  3599. this._config = this._getConfig(config);
  3600. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3601. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3602. for (var i = 0, len = toggleList.length; i < len; i++) {
  3603. var elem = toggleList[i];
  3604. var selector = Util.getSelectorFromElement(elem);
  3605. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3606. return foundElem === element;
  3607. });
  3608. if (selector !== null && filterElement.length > 0) {
  3609. this._selector = selector;
  3610. this._triggerArray.push(elem);
  3611. }
  3612. }
  3613. this._parent = this._config.parent ? this._getParent() : null;
  3614. if (!this._config.parent) {
  3615. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3616. }
  3617. if (this._config.toggle) {
  3618. this.toggle();
  3619. }
  3620. } // Getters
  3621. var _proto = Collapse.prototype;
  3622. // Public
  3623. _proto.toggle = function toggle() {
  3624. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3625. this.hide();
  3626. } else {
  3627. this.show();
  3628. }
  3629. };
  3630. _proto.show = function show() {
  3631. var _this = this;
  3632. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3633. return;
  3634. }
  3635. var actives;
  3636. var activesData;
  3637. if (this._parent) {
  3638. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3639. if (typeof _this._config.parent === 'string') {
  3640. return elem.getAttribute('data-parent') === _this._config.parent;
  3641. }
  3642. return elem.classList.contains(ClassName$3.COLLAPSE);
  3643. });
  3644. if (actives.length === 0) {
  3645. actives = null;
  3646. }
  3647. }
  3648. if (actives) {
  3649. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3650. if (activesData && activesData._isTransitioning) {
  3651. return;
  3652. }
  3653. }
  3654. var startEvent = $.Event(Event$3.SHOW);
  3655. $(this._element).trigger(startEvent);
  3656. if (startEvent.isDefaultPrevented()) {
  3657. return;
  3658. }
  3659. if (actives) {
  3660. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3661. if (!activesData) {
  3662. $(actives).data(DATA_KEY$3, null);
  3663. }
  3664. }
  3665. var dimension = this._getDimension();
  3666. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3667. this._element.style[dimension] = 0;
  3668. if (this._triggerArray.length) {
  3669. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3670. }
  3671. this.setTransitioning(true);
  3672. var complete = function complete() {
  3673. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3674. _this._element.style[dimension] = '';
  3675. _this.setTransitioning(false);
  3676. $(_this._element).trigger(Event$3.SHOWN);
  3677. };
  3678. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3679. var scrollSize = "scroll" + capitalizedDimension;
  3680. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3681. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3682. this._element.style[dimension] = this._element[scrollSize] + "px";
  3683. };
  3684. _proto.hide = function hide() {
  3685. var _this2 = this;
  3686. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3687. return;
  3688. }
  3689. var startEvent = $.Event(Event$3.HIDE);
  3690. $(this._element).trigger(startEvent);
  3691. if (startEvent.isDefaultPrevented()) {
  3692. return;
  3693. }
  3694. var dimension = this._getDimension();
  3695. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3696. Util.reflow(this._element);
  3697. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3698. var triggerArrayLength = this._triggerArray.length;
  3699. if (triggerArrayLength > 0) {
  3700. for (var i = 0; i < triggerArrayLength; i++) {
  3701. var trigger = this._triggerArray[i];
  3702. var selector = Util.getSelectorFromElement(trigger);
  3703. if (selector !== null) {
  3704. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3705. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3706. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3707. }
  3708. }
  3709. }
  3710. }
  3711. this.setTransitioning(true);
  3712. var complete = function complete() {
  3713. _this2.setTransitioning(false);
  3714. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3715. };
  3716. this._element.style[dimension] = '';
  3717. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3718. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3719. };
  3720. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3721. this._isTransitioning = isTransitioning;
  3722. };
  3723. _proto.dispose = function dispose() {
  3724. $.removeData(this._element, DATA_KEY$3);
  3725. this._config = null;
  3726. this._parent = null;
  3727. this._element = null;
  3728. this._triggerArray = null;
  3729. this._isTransitioning = null;
  3730. } // Private
  3731. ;
  3732. _proto._getConfig = function _getConfig(config) {
  3733. config = _objectSpread2({}, Default$1, {}, config);
  3734. config.toggle = Boolean(config.toggle); // Coerce string values
  3735. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3736. return config;
  3737. };
  3738. _proto._getDimension = function _getDimension() {
  3739. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3740. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3741. };
  3742. _proto._getParent = function _getParent() {
  3743. var _this3 = this;
  3744. var parent;
  3745. if (Util.isElement(this._config.parent)) {
  3746. parent = this._config.parent; // It's a jQuery object
  3747. if (typeof this._config.parent.jquery !== 'undefined') {
  3748. parent = this._config.parent[0];
  3749. }
  3750. } else {
  3751. parent = document.querySelector(this._config.parent);
  3752. }
  3753. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3754. var children = [].slice.call(parent.querySelectorAll(selector));
  3755. $(children).each(function (i, element) {
  3756. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3757. });
  3758. return parent;
  3759. };
  3760. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3761. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3762. if (triggerArray.length) {
  3763. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3764. }
  3765. } // Static
  3766. ;
  3767. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3768. var selector = Util.getSelectorFromElement(element);
  3769. return selector ? document.querySelector(selector) : null;
  3770. };
  3771. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3772. return this.each(function () {
  3773. var $this = $(this);
  3774. var data = $this.data(DATA_KEY$3);
  3775. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3776. if (!data && _config.toggle && /show|hide/.test(config)) {
  3777. _config.toggle = false;
  3778. }
  3779. if (!data) {
  3780. data = new Collapse(this, _config);
  3781. $this.data(DATA_KEY$3, data);
  3782. }
  3783. if (typeof config === 'string') {
  3784. if (typeof data[config] === 'undefined') {
  3785. throw new TypeError("No method named \"" + config + "\"");
  3786. }
  3787. data[config]();
  3788. }
  3789. });
  3790. };
  3791. _createClass(Collapse, null, [{
  3792. key: "VERSION",
  3793. get: function get() {
  3794. return VERSION$3;
  3795. }
  3796. }, {
  3797. key: "Default",
  3798. get: function get() {
  3799. return Default$1;
  3800. }
  3801. }]);
  3802. return Collapse;
  3803. }();
  3804. /**
  3805. * ------------------------------------------------------------------------
  3806. * Data Api implementation
  3807. * ------------------------------------------------------------------------
  3808. */
  3809. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3810. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3811. if (event.currentTarget.tagName === 'A') {
  3812. event.preventDefault();
  3813. }
  3814. var $trigger = $(this);
  3815. var selector = Util.getSelectorFromElement(this);
  3816. var selectors = [].slice.call(document.querySelectorAll(selector));
  3817. $(selectors).each(function () {
  3818. var $target = $(this);
  3819. var data = $target.data(DATA_KEY$3);
  3820. var config = data ? 'toggle' : $trigger.data();
  3821. Collapse._jQueryInterface.call($target, config);
  3822. });
  3823. });
  3824. /**
  3825. * ------------------------------------------------------------------------
  3826. * jQuery
  3827. * ------------------------------------------------------------------------
  3828. */
  3829. $.fn[NAME$3] = Collapse._jQueryInterface;
  3830. $.fn[NAME$3].Constructor = Collapse;
  3831. $.fn[NAME$3].noConflict = function () {
  3832. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3833. return Collapse._jQueryInterface;
  3834. };
  3835. /**
  3836. * ------------------------------------------------------------------------
  3837. * Constants
  3838. * ------------------------------------------------------------------------
  3839. */
  3840. var NAME$4 = 'dropdown';
  3841. var VERSION$4 = '4.4.1';
  3842. var DATA_KEY$4 = 'bs.dropdown';
  3843. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3844. var DATA_API_KEY$4 = '.data-api';
  3845. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3846. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3847. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3848. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3849. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3850. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3851. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3852. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3853. var Event$4 = {
  3854. HIDE: "hide" + EVENT_KEY$4,
  3855. HIDDEN: "hidden" + EVENT_KEY$4,
  3856. SHOW: "show" + EVENT_KEY$4,
  3857. SHOWN: "shown" + EVENT_KEY$4,
  3858. CLICK: "click" + EVENT_KEY$4,
  3859. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3860. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3861. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3862. };
  3863. var ClassName$4 = {
  3864. DISABLED: 'disabled',
  3865. SHOW: 'show',
  3866. DROPUP: 'dropup',
  3867. DROPRIGHT: 'dropright',
  3868. DROPLEFT: 'dropleft',
  3869. MENURIGHT: 'dropdown-menu-right',
  3870. MENULEFT: 'dropdown-menu-left',
  3871. POSITION_STATIC: 'position-static'
  3872. };
  3873. var Selector$4 = {
  3874. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3875. FORM_CHILD: '.dropdown form',
  3876. MENU: '.dropdown-menu',
  3877. NAVBAR_NAV: '.navbar-nav',
  3878. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3879. };
  3880. var AttachmentMap = {
  3881. TOP: 'top-start',
  3882. TOPEND: 'top-end',
  3883. BOTTOM: 'bottom-start',
  3884. BOTTOMEND: 'bottom-end',
  3885. RIGHT: 'right-start',
  3886. RIGHTEND: 'right-end',
  3887. LEFT: 'left-start',
  3888. LEFTEND: 'left-end'
  3889. };
  3890. var Default$2 = {
  3891. offset: 0,
  3892. flip: true,
  3893. boundary: 'scrollParent',
  3894. reference: 'toggle',
  3895. display: 'dynamic',
  3896. popperConfig: null
  3897. };
  3898. var DefaultType$2 = {
  3899. offset: '(number|string|function)',
  3900. flip: 'boolean',
  3901. boundary: '(string|element)',
  3902. reference: '(string|element)',
  3903. display: 'string',
  3904. popperConfig: '(null|object)'
  3905. };
  3906. /**
  3907. * ------------------------------------------------------------------------
  3908. * Class Definition
  3909. * ------------------------------------------------------------------------
  3910. */
  3911. var Dropdown =
  3912. /*#__PURE__*/
  3913. function () {
  3914. function Dropdown(element, config) {
  3915. this._element = element;
  3916. this._popper = null;
  3917. this._config = this._getConfig(config);
  3918. this._menu = this._getMenuElement();
  3919. this._inNavbar = this._detectNavbar();
  3920. this._addEventListeners();
  3921. } // Getters
  3922. var _proto = Dropdown.prototype;
  3923. // Public
  3924. _proto.toggle = function toggle() {
  3925. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3926. return;
  3927. }
  3928. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3929. Dropdown._clearMenus();
  3930. if (isActive) {
  3931. return;
  3932. }
  3933. this.show(true);
  3934. };
  3935. _proto.show = function show(usePopper) {
  3936. if (usePopper === void 0) {
  3937. usePopper = false;
  3938. }
  3939. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3940. return;
  3941. }
  3942. var relatedTarget = {
  3943. relatedTarget: this._element
  3944. };
  3945. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3946. var parent = Dropdown._getParentFromElement(this._element);
  3947. $(parent).trigger(showEvent);
  3948. if (showEvent.isDefaultPrevented()) {
  3949. return;
  3950. } // Disable totally Popper.js for Dropdown in Navbar
  3951. if (!this._inNavbar && usePopper) {
  3952. /**
  3953. * Check for Popper dependency
  3954. * Popper - https://popper.js.org
  3955. */
  3956. if (typeof Popper === 'undefined') {
  3957. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3958. }
  3959. var referenceElement = this._element;
  3960. if (this._config.reference === 'parent') {
  3961. referenceElement = parent;
  3962. } else if (Util.isElement(this._config.reference)) {
  3963. referenceElement = this._config.reference; // Check if it's jQuery element
  3964. if (typeof this._config.reference.jquery !== 'undefined') {
  3965. referenceElement = this._config.reference[0];
  3966. }
  3967. } // If boundary is not `scrollParent`, then set position to `static`
  3968. // to allow the menu to "escape" the scroll parent's boundaries
  3969. // https://github.com/twbs/bootstrap/issues/24251
  3970. if (this._config.boundary !== 'scrollParent') {
  3971. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3972. }
  3973. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3974. } // If this is a touch-enabled device we add extra
  3975. // empty mouseover listeners to the body's immediate children;
  3976. // only needed because of broken event delegation on iOS
  3977. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3978. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3979. $(document.body).children().on('mouseover', null, $.noop);
  3980. }
  3981. this._element.focus();
  3982. this._element.setAttribute('aria-expanded', true);
  3983. $(this._menu).toggleClass(ClassName$4.SHOW);
  3984. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3985. };
  3986. _proto.hide = function hide() {
  3987. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3988. return;
  3989. }
  3990. var relatedTarget = {
  3991. relatedTarget: this._element
  3992. };
  3993. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3994. var parent = Dropdown._getParentFromElement(this._element);
  3995. $(parent).trigger(hideEvent);
  3996. if (hideEvent.isDefaultPrevented()) {
  3997. return;
  3998. }
  3999. if (this._popper) {
  4000. this._popper.destroy();
  4001. }
  4002. $(this._menu).toggleClass(ClassName$4.SHOW);
  4003. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4004. };
  4005. _proto.dispose = function dispose() {
  4006. $.removeData(this._element, DATA_KEY$4);
  4007. $(this._element).off(EVENT_KEY$4);
  4008. this._element = null;
  4009. this._menu = null;
  4010. if (this._popper !== null) {
  4011. this._popper.destroy();
  4012. this._popper = null;
  4013. }
  4014. };
  4015. _proto.update = function update() {
  4016. this._inNavbar = this._detectNavbar();
  4017. if (this._popper !== null) {
  4018. this._popper.scheduleUpdate();
  4019. }
  4020. } // Private
  4021. ;
  4022. _proto._addEventListeners = function _addEventListeners() {
  4023. var _this = this;
  4024. $(this._element).on(Event$4.CLICK, function (event) {
  4025. event.preventDefault();
  4026. event.stopPropagation();
  4027. _this.toggle();
  4028. });
  4029. };
  4030. _proto._getConfig = function _getConfig(config) {
  4031. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4032. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4033. return config;
  4034. };
  4035. _proto._getMenuElement = function _getMenuElement() {
  4036. if (!this._menu) {
  4037. var parent = Dropdown._getParentFromElement(this._element);
  4038. if (parent) {
  4039. this._menu = parent.querySelector(Selector$4.MENU);
  4040. }
  4041. }
  4042. return this._menu;
  4043. };
  4044. _proto._getPlacement = function _getPlacement() {
  4045. var $parentDropdown = $(this._element.parentNode);
  4046. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4047. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4048. placement = AttachmentMap.TOP;
  4049. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4050. placement = AttachmentMap.TOPEND;
  4051. }
  4052. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4053. placement = AttachmentMap.RIGHT;
  4054. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4055. placement = AttachmentMap.LEFT;
  4056. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4057. placement = AttachmentMap.BOTTOMEND;
  4058. }
  4059. return placement;
  4060. };
  4061. _proto._detectNavbar = function _detectNavbar() {
  4062. return $(this._element).closest('.navbar').length > 0;
  4063. };
  4064. _proto._getOffset = function _getOffset() {
  4065. var _this2 = this;
  4066. var offset = {};
  4067. if (typeof this._config.offset === 'function') {
  4068. offset.fn = function (data) {
  4069. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4070. return data;
  4071. };
  4072. } else {
  4073. offset.offset = this._config.offset;
  4074. }
  4075. return offset;
  4076. };
  4077. _proto._getPopperConfig = function _getPopperConfig() {
  4078. var popperConfig = {
  4079. placement: this._getPlacement(),
  4080. modifiers: {
  4081. offset: this._getOffset(),
  4082. flip: {
  4083. enabled: this._config.flip
  4084. },
  4085. preventOverflow: {
  4086. boundariesElement: this._config.boundary
  4087. }
  4088. }
  4089. }; // Disable Popper.js if we have a static display
  4090. if (this._config.display === 'static') {
  4091. popperConfig.modifiers.applyStyle = {
  4092. enabled: false
  4093. };
  4094. }
  4095. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4096. } // Static
  4097. ;
  4098. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4099. return this.each(function () {
  4100. var data = $(this).data(DATA_KEY$4);
  4101. var _config = typeof config === 'object' ? config : null;
  4102. if (!data) {
  4103. data = new Dropdown(this, _config);
  4104. $(this).data(DATA_KEY$4, data);
  4105. }
  4106. if (typeof config === 'string') {
  4107. if (typeof data[config] === 'undefined') {
  4108. throw new TypeError("No method named \"" + config + "\"");
  4109. }
  4110. data[config]();
  4111. }
  4112. });
  4113. };
  4114. Dropdown._clearMenus = function _clearMenus(event) {
  4115. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4116. return;
  4117. }
  4118. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4119. for (var i = 0, len = toggles.length; i < len; i++) {
  4120. var parent = Dropdown._getParentFromElement(toggles[i]);
  4121. var context = $(toggles[i]).data(DATA_KEY$4);
  4122. var relatedTarget = {
  4123. relatedTarget: toggles[i]
  4124. };
  4125. if (event && event.type === 'click') {
  4126. relatedTarget.clickEvent = event;
  4127. }
  4128. if (!context) {
  4129. continue;
  4130. }
  4131. var dropdownMenu = context._menu;
  4132. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4133. continue;
  4134. }
  4135. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4136. continue;
  4137. }
  4138. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4139. $(parent).trigger(hideEvent);
  4140. if (hideEvent.isDefaultPrevented()) {
  4141. continue;
  4142. } // If this is a touch-enabled device we remove the extra
  4143. // empty mouseover listeners we added for iOS support
  4144. if ('ontouchstart' in document.documentElement) {
  4145. $(document.body).children().off('mouseover', null, $.noop);
  4146. }
  4147. toggles[i].setAttribute('aria-expanded', 'false');
  4148. if (context._popper) {
  4149. context._popper.destroy();
  4150. }
  4151. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4152. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4153. }
  4154. };
  4155. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4156. var parent;
  4157. var selector = Util.getSelectorFromElement(element);
  4158. if (selector) {
  4159. parent = document.querySelector(selector);
  4160. }
  4161. return parent || element.parentNode;
  4162. } // eslint-disable-next-line complexity
  4163. ;
  4164. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4165. // If not input/textarea:
  4166. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4167. // If input/textarea:
  4168. // - If space key => not a dropdown command
  4169. // - If key is other than escape
  4170. // - If key is not up or down => not a dropdown command
  4171. // - If trigger inside the menu => not a dropdown command
  4172. 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)) {
  4173. return;
  4174. }
  4175. event.preventDefault();
  4176. event.stopPropagation();
  4177. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4178. return;
  4179. }
  4180. var parent = Dropdown._getParentFromElement(this);
  4181. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4182. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4183. return;
  4184. }
  4185. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4186. if (event.which === ESCAPE_KEYCODE) {
  4187. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4188. $(toggle).trigger('focus');
  4189. }
  4190. $(this).trigger('click');
  4191. return;
  4192. }
  4193. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4194. return $(item).is(':visible');
  4195. });
  4196. if (items.length === 0) {
  4197. return;
  4198. }
  4199. var index = items.indexOf(event.target);
  4200. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4201. // Up
  4202. index--;
  4203. }
  4204. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4205. // Down
  4206. index++;
  4207. }
  4208. if (index < 0) {
  4209. index = 0;
  4210. }
  4211. items[index].focus();
  4212. };
  4213. _createClass(Dropdown, null, [{
  4214. key: "VERSION",
  4215. get: function get() {
  4216. return VERSION$4;
  4217. }
  4218. }, {
  4219. key: "Default",
  4220. get: function get() {
  4221. return Default$2;
  4222. }
  4223. }, {
  4224. key: "DefaultType",
  4225. get: function get() {
  4226. return DefaultType$2;
  4227. }
  4228. }]);
  4229. return Dropdown;
  4230. }();
  4231. /**
  4232. * ------------------------------------------------------------------------
  4233. * Data Api implementation
  4234. * ------------------------------------------------------------------------
  4235. */
  4236. $(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) {
  4237. event.preventDefault();
  4238. event.stopPropagation();
  4239. Dropdown._jQueryInterface.call($(this), 'toggle');
  4240. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4241. e.stopPropagation();
  4242. });
  4243. /**
  4244. * ------------------------------------------------------------------------
  4245. * jQuery
  4246. * ------------------------------------------------------------------------
  4247. */
  4248. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4249. $.fn[NAME$4].Constructor = Dropdown;
  4250. $.fn[NAME$4].noConflict = function () {
  4251. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4252. return Dropdown._jQueryInterface;
  4253. };
  4254. /**
  4255. * ------------------------------------------------------------------------
  4256. * Constants
  4257. * ------------------------------------------------------------------------
  4258. */
  4259. var NAME$5 = 'modal';
  4260. var VERSION$5 = '4.4.1';
  4261. var DATA_KEY$5 = 'bs.modal';
  4262. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4263. var DATA_API_KEY$5 = '.data-api';
  4264. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4265. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4266. var Default$3 = {
  4267. backdrop: true,
  4268. keyboard: true,
  4269. focus: true,
  4270. show: true
  4271. };
  4272. var DefaultType$3 = {
  4273. backdrop: '(boolean|string)',
  4274. keyboard: 'boolean',
  4275. focus: 'boolean',
  4276. show: 'boolean'
  4277. };
  4278. var Event$5 = {
  4279. HIDE: "hide" + EVENT_KEY$5,
  4280. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4281. HIDDEN: "hidden" + EVENT_KEY$5,
  4282. SHOW: "show" + EVENT_KEY$5,
  4283. SHOWN: "shown" + EVENT_KEY$5,
  4284. FOCUSIN: "focusin" + EVENT_KEY$5,
  4285. RESIZE: "resize" + EVENT_KEY$5,
  4286. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4287. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4288. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4289. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4290. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4291. };
  4292. var ClassName$5 = {
  4293. SCROLLABLE: 'modal-dialog-scrollable',
  4294. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4295. BACKDROP: 'modal-backdrop',
  4296. OPEN: 'modal-open',
  4297. FADE: 'fade',
  4298. SHOW: 'show',
  4299. STATIC: 'modal-static'
  4300. };
  4301. var Selector$5 = {
  4302. DIALOG: '.modal-dialog',
  4303. MODAL_BODY: '.modal-body',
  4304. DATA_TOGGLE: '[data-toggle="modal"]',
  4305. DATA_DISMISS: '[data-dismiss="modal"]',
  4306. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4307. STICKY_CONTENT: '.sticky-top'
  4308. };
  4309. /**
  4310. * ------------------------------------------------------------------------
  4311. * Class Definition
  4312. * ------------------------------------------------------------------------
  4313. */
  4314. var Modal =
  4315. /*#__PURE__*/
  4316. function () {
  4317. function Modal(element, config) {
  4318. this._config = this._getConfig(config);
  4319. this._element = element;
  4320. this._dialog = element.querySelector(Selector$5.DIALOG);
  4321. this._backdrop = null;
  4322. this._isShown = false;
  4323. this._isBodyOverflowing = false;
  4324. this._ignoreBackdropClick = false;
  4325. this._isTransitioning = false;
  4326. this._scrollbarWidth = 0;
  4327. } // Getters
  4328. var _proto = Modal.prototype;
  4329. // Public
  4330. _proto.toggle = function toggle(relatedTarget) {
  4331. return this._isShown ? this.hide() : this.show(relatedTarget);
  4332. };
  4333. _proto.show = function show(relatedTarget) {
  4334. var _this = this;
  4335. if (this._isShown || this._isTransitioning) {
  4336. return;
  4337. }
  4338. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4339. this._isTransitioning = true;
  4340. }
  4341. var showEvent = $.Event(Event$5.SHOW, {
  4342. relatedTarget: relatedTarget
  4343. });
  4344. $(this._element).trigger(showEvent);
  4345. if (this._isShown || showEvent.isDefaultPrevented()) {
  4346. return;
  4347. }
  4348. this._isShown = true;
  4349. this._checkScrollbar();
  4350. this._setScrollbar();
  4351. this._adjustDialog();
  4352. this._setEscapeEvent();
  4353. this._setResizeEvent();
  4354. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4355. return _this.hide(event);
  4356. });
  4357. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4358. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4359. if ($(event.target).is(_this._element)) {
  4360. _this._ignoreBackdropClick = true;
  4361. }
  4362. });
  4363. });
  4364. this._showBackdrop(function () {
  4365. return _this._showElement(relatedTarget);
  4366. });
  4367. };
  4368. _proto.hide = function hide(event) {
  4369. var _this2 = this;
  4370. if (event) {
  4371. event.preventDefault();
  4372. }
  4373. if (!this._isShown || this._isTransitioning) {
  4374. return;
  4375. }
  4376. var hideEvent = $.Event(Event$5.HIDE);
  4377. $(this._element).trigger(hideEvent);
  4378. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4379. return;
  4380. }
  4381. this._isShown = false;
  4382. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4383. if (transition) {
  4384. this._isTransitioning = true;
  4385. }
  4386. this._setEscapeEvent();
  4387. this._setResizeEvent();
  4388. $(document).off(Event$5.FOCUSIN);
  4389. $(this._element).removeClass(ClassName$5.SHOW);
  4390. $(this._element).off(Event$5.CLICK_DISMISS);
  4391. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4392. if (transition) {
  4393. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4394. $(this._element).one(Util.TRANSITION_END, function (event) {
  4395. return _this2._hideModal(event);
  4396. }).emulateTransitionEnd(transitionDuration);
  4397. } else {
  4398. this._hideModal();
  4399. }
  4400. };
  4401. _proto.dispose = function dispose() {
  4402. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4403. return $(htmlElement).off(EVENT_KEY$5);
  4404. });
  4405. /**
  4406. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4407. * Do not move `document` in `htmlElements` array
  4408. * It will remove `Event.CLICK_DATA_API` event that should remain
  4409. */
  4410. $(document).off(Event$5.FOCUSIN);
  4411. $.removeData(this._element, DATA_KEY$5);
  4412. this._config = null;
  4413. this._element = null;
  4414. this._dialog = null;
  4415. this._backdrop = null;
  4416. this._isShown = null;
  4417. this._isBodyOverflowing = null;
  4418. this._ignoreBackdropClick = null;
  4419. this._isTransitioning = null;
  4420. this._scrollbarWidth = null;
  4421. };
  4422. _proto.handleUpdate = function handleUpdate() {
  4423. this._adjustDialog();
  4424. } // Private
  4425. ;
  4426. _proto._getConfig = function _getConfig(config) {
  4427. config = _objectSpread2({}, Default$3, {}, config);
  4428. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4429. return config;
  4430. };
  4431. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4432. var _this3 = this;
  4433. if (this._config.backdrop === 'static') {
  4434. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4435. $(this._element).trigger(hideEventPrevented);
  4436. if (hideEventPrevented.defaultPrevented) {
  4437. return;
  4438. }
  4439. this._element.classList.add(ClassName$5.STATIC);
  4440. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4441. $(this._element).one(Util.TRANSITION_END, function () {
  4442. _this3._element.classList.remove(ClassName$5.STATIC);
  4443. }).emulateTransitionEnd(modalTransitionDuration);
  4444. this._element.focus();
  4445. } else {
  4446. this.hide();
  4447. }
  4448. };
  4449. _proto._showElement = function _showElement(relatedTarget) {
  4450. var _this4 = this;
  4451. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4452. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4453. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4454. // Don't move modal's DOM position
  4455. document.body.appendChild(this._element);
  4456. }
  4457. this._element.style.display = 'block';
  4458. this._element.removeAttribute('aria-hidden');
  4459. this._element.setAttribute('aria-modal', true);
  4460. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4461. modalBody.scrollTop = 0;
  4462. } else {
  4463. this._element.scrollTop = 0;
  4464. }
  4465. if (transition) {
  4466. Util.reflow(this._element);
  4467. }
  4468. $(this._element).addClass(ClassName$5.SHOW);
  4469. if (this._config.focus) {
  4470. this._enforceFocus();
  4471. }
  4472. var shownEvent = $.Event(Event$5.SHOWN, {
  4473. relatedTarget: relatedTarget
  4474. });
  4475. var transitionComplete = function transitionComplete() {
  4476. if (_this4._config.focus) {
  4477. _this4._element.focus();
  4478. }
  4479. _this4._isTransitioning = false;
  4480. $(_this4._element).trigger(shownEvent);
  4481. };
  4482. if (transition) {
  4483. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4484. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4485. } else {
  4486. transitionComplete();
  4487. }
  4488. };
  4489. _proto._enforceFocus = function _enforceFocus() {
  4490. var _this5 = this;
  4491. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4492. .on(Event$5.FOCUSIN, function (event) {
  4493. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4494. _this5._element.focus();
  4495. }
  4496. });
  4497. };
  4498. _proto._setEscapeEvent = function _setEscapeEvent() {
  4499. var _this6 = this;
  4500. if (this._isShown && this._config.keyboard) {
  4501. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4502. if (event.which === ESCAPE_KEYCODE$1) {
  4503. _this6._triggerBackdropTransition();
  4504. }
  4505. });
  4506. } else if (!this._isShown) {
  4507. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4508. }
  4509. };
  4510. _proto._setResizeEvent = function _setResizeEvent() {
  4511. var _this7 = this;
  4512. if (this._isShown) {
  4513. $(window).on(Event$5.RESIZE, function (event) {
  4514. return _this7.handleUpdate(event);
  4515. });
  4516. } else {
  4517. $(window).off(Event$5.RESIZE);
  4518. }
  4519. };
  4520. _proto._hideModal = function _hideModal() {
  4521. var _this8 = this;
  4522. this._element.style.display = 'none';
  4523. this._element.setAttribute('aria-hidden', true);
  4524. this._element.removeAttribute('aria-modal');
  4525. this._isTransitioning = false;
  4526. this._showBackdrop(function () {
  4527. $(document.body).removeClass(ClassName$5.OPEN);
  4528. _this8._resetAdjustments();
  4529. _this8._resetScrollbar();
  4530. $(_this8._element).trigger(Event$5.HIDDEN);
  4531. });
  4532. };
  4533. _proto._removeBackdrop = function _removeBackdrop() {
  4534. if (this._backdrop) {
  4535. $(this._backdrop).remove();
  4536. this._backdrop = null;
  4537. }
  4538. };
  4539. _proto._showBackdrop = function _showBackdrop(callback) {
  4540. var _this9 = this;
  4541. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4542. if (this._isShown && this._config.backdrop) {
  4543. this._backdrop = document.createElement('div');
  4544. this._backdrop.className = ClassName$5.BACKDROP;
  4545. if (animate) {
  4546. this._backdrop.classList.add(animate);
  4547. }
  4548. $(this._backdrop).appendTo(document.body);
  4549. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4550. if (_this9._ignoreBackdropClick) {
  4551. _this9._ignoreBackdropClick = false;
  4552. return;
  4553. }
  4554. if (event.target !== event.currentTarget) {
  4555. return;
  4556. }
  4557. _this9._triggerBackdropTransition();
  4558. });
  4559. if (animate) {
  4560. Util.reflow(this._backdrop);
  4561. }
  4562. $(this._backdrop).addClass(ClassName$5.SHOW);
  4563. if (!callback) {
  4564. return;
  4565. }
  4566. if (!animate) {
  4567. callback();
  4568. return;
  4569. }
  4570. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4571. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4572. } else if (!this._isShown && this._backdrop) {
  4573. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4574. var callbackRemove = function callbackRemove() {
  4575. _this9._removeBackdrop();
  4576. if (callback) {
  4577. callback();
  4578. }
  4579. };
  4580. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4581. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4582. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4583. } else {
  4584. callbackRemove();
  4585. }
  4586. } else if (callback) {
  4587. callback();
  4588. }
  4589. } // ----------------------------------------------------------------------
  4590. // the following methods are used to handle overflowing modals
  4591. // todo (fat): these should probably be refactored out of modal.js
  4592. // ----------------------------------------------------------------------
  4593. ;
  4594. _proto._adjustDialog = function _adjustDialog() {
  4595. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4596. if (!this._isBodyOverflowing && isModalOverflowing) {
  4597. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4598. }
  4599. if (this._isBodyOverflowing && !isModalOverflowing) {
  4600. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4601. }
  4602. };
  4603. _proto._resetAdjustments = function _resetAdjustments() {
  4604. this._element.style.paddingLeft = '';
  4605. this._element.style.paddingRight = '';
  4606. };
  4607. _proto._checkScrollbar = function _checkScrollbar() {
  4608. var rect = document.body.getBoundingClientRect();
  4609. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4610. this._scrollbarWidth = this._getScrollbarWidth();
  4611. };
  4612. _proto._setScrollbar = function _setScrollbar() {
  4613. var _this10 = this;
  4614. if (this._isBodyOverflowing) {
  4615. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4616. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4617. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4618. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4619. $(fixedContent).each(function (index, element) {
  4620. var actualPadding = element.style.paddingRight;
  4621. var calculatedPadding = $(element).css('padding-right');
  4622. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4623. }); // Adjust sticky content margin
  4624. $(stickyContent).each(function (index, element) {
  4625. var actualMargin = element.style.marginRight;
  4626. var calculatedMargin = $(element).css('margin-right');
  4627. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4628. }); // Adjust body padding
  4629. var actualPadding = document.body.style.paddingRight;
  4630. var calculatedPadding = $(document.body).css('padding-right');
  4631. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4632. }
  4633. $(document.body).addClass(ClassName$5.OPEN);
  4634. };
  4635. _proto._resetScrollbar = function _resetScrollbar() {
  4636. // Restore fixed content padding
  4637. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4638. $(fixedContent).each(function (index, element) {
  4639. var padding = $(element).data('padding-right');
  4640. $(element).removeData('padding-right');
  4641. element.style.paddingRight = padding ? padding : '';
  4642. }); // Restore sticky content
  4643. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4644. $(elements).each(function (index, element) {
  4645. var margin = $(element).data('margin-right');
  4646. if (typeof margin !== 'undefined') {
  4647. $(element).css('margin-right', margin).removeData('margin-right');
  4648. }
  4649. }); // Restore body padding
  4650. var padding = $(document.body).data('padding-right');
  4651. $(document.body).removeData('padding-right');
  4652. document.body.style.paddingRight = padding ? padding : '';
  4653. };
  4654. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4655. // thx d.walsh
  4656. var scrollDiv = document.createElement('div');
  4657. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4658. document.body.appendChild(scrollDiv);
  4659. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4660. document.body.removeChild(scrollDiv);
  4661. return scrollbarWidth;
  4662. } // Static
  4663. ;
  4664. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4665. return this.each(function () {
  4666. var data = $(this).data(DATA_KEY$5);
  4667. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4668. if (!data) {
  4669. data = new Modal(this, _config);
  4670. $(this).data(DATA_KEY$5, data);
  4671. }
  4672. if (typeof config === 'string') {
  4673. if (typeof data[config] === 'undefined') {
  4674. throw new TypeError("No method named \"" + config + "\"");
  4675. }
  4676. data[config](relatedTarget);
  4677. } else if (_config.show) {
  4678. data.show(relatedTarget);
  4679. }
  4680. });
  4681. };
  4682. _createClass(Modal, null, [{
  4683. key: "VERSION",
  4684. get: function get() {
  4685. return VERSION$5;
  4686. }
  4687. }, {
  4688. key: "Default",
  4689. get: function get() {
  4690. return Default$3;
  4691. }
  4692. }]);
  4693. return Modal;
  4694. }();
  4695. /**
  4696. * ------------------------------------------------------------------------
  4697. * Data Api implementation
  4698. * ------------------------------------------------------------------------
  4699. */
  4700. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4701. var _this11 = this;
  4702. var target;
  4703. var selector = Util.getSelectorFromElement(this);
  4704. if (selector) {
  4705. target = document.querySelector(selector);
  4706. }
  4707. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4708. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4709. event.preventDefault();
  4710. }
  4711. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4712. if (showEvent.isDefaultPrevented()) {
  4713. // Only register focus restorer if modal will actually get shown
  4714. return;
  4715. }
  4716. $target.one(Event$5.HIDDEN, function () {
  4717. if ($(_this11).is(':visible')) {
  4718. _this11.focus();
  4719. }
  4720. });
  4721. });
  4722. Modal._jQueryInterface.call($(target), config, this);
  4723. });
  4724. /**
  4725. * ------------------------------------------------------------------------
  4726. * jQuery
  4727. * ------------------------------------------------------------------------
  4728. */
  4729. $.fn[NAME$5] = Modal._jQueryInterface;
  4730. $.fn[NAME$5].Constructor = Modal;
  4731. $.fn[NAME$5].noConflict = function () {
  4732. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4733. return Modal._jQueryInterface;
  4734. };
  4735. /**
  4736. * --------------------------------------------------------------------------
  4737. * Bootstrap (v4.4.1): tools/sanitizer.js
  4738. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4739. * --------------------------------------------------------------------------
  4740. */
  4741. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4742. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4743. var DefaultWhitelist = {
  4744. // Global attributes allowed on any supplied element below.
  4745. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4746. a: ['target', 'href', 'title', 'rel'],
  4747. area: [],
  4748. b: [],
  4749. br: [],
  4750. col: [],
  4751. code: [],
  4752. div: [],
  4753. em: [],
  4754. hr: [],
  4755. h1: [],
  4756. h2: [],
  4757. h3: [],
  4758. h4: [],
  4759. h5: [],
  4760. h6: [],
  4761. i: [],
  4762. img: ['src', 'alt', 'title', 'width', 'height'],
  4763. li: [],
  4764. ol: [],
  4765. p: [],
  4766. pre: [],
  4767. s: [],
  4768. small: [],
  4769. span: [],
  4770. sub: [],
  4771. sup: [],
  4772. strong: [],
  4773. u: [],
  4774. ul: []
  4775. };
  4776. /**
  4777. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4778. *
  4779. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4780. */
  4781. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4782. /**
  4783. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4784. *
  4785. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4786. */
  4787. 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;
  4788. function allowedAttribute(attr, allowedAttributeList) {
  4789. var attrName = attr.nodeName.toLowerCase();
  4790. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4791. if (uriAttrs.indexOf(attrName) !== -1) {
  4792. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4793. }
  4794. return true;
  4795. }
  4796. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4797. return attrRegex instanceof RegExp;
  4798. }); // Check if a regular expression validates the attribute.
  4799. for (var i = 0, l = regExp.length; i < l; i++) {
  4800. if (attrName.match(regExp[i])) {
  4801. return true;
  4802. }
  4803. }
  4804. return false;
  4805. }
  4806. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4807. if (unsafeHtml.length === 0) {
  4808. return unsafeHtml;
  4809. }
  4810. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4811. return sanitizeFn(unsafeHtml);
  4812. }
  4813. var domParser = new window.DOMParser();
  4814. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4815. var whitelistKeys = Object.keys(whiteList);
  4816. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4817. var _loop = function _loop(i, len) {
  4818. var el = elements[i];
  4819. var elName = el.nodeName.toLowerCase();
  4820. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4821. el.parentNode.removeChild(el);
  4822. return "continue";
  4823. }
  4824. var attributeList = [].slice.call(el.attributes);
  4825. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4826. attributeList.forEach(function (attr) {
  4827. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4828. el.removeAttribute(attr.nodeName);
  4829. }
  4830. });
  4831. };
  4832. for (var i = 0, len = elements.length; i < len; i++) {
  4833. var _ret = _loop(i);
  4834. if (_ret === "continue") continue;
  4835. }
  4836. return createdDocument.body.innerHTML;
  4837. }
  4838. /**
  4839. * ------------------------------------------------------------------------
  4840. * Constants
  4841. * ------------------------------------------------------------------------
  4842. */
  4843. var NAME$6 = 'tooltip';
  4844. var VERSION$6 = '4.4.1';
  4845. var DATA_KEY$6 = 'bs.tooltip';
  4846. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4847. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4848. var CLASS_PREFIX = 'bs-tooltip';
  4849. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4850. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4851. var DefaultType$4 = {
  4852. animation: 'boolean',
  4853. template: 'string',
  4854. title: '(string|element|function)',
  4855. trigger: 'string',
  4856. delay: '(number|object)',
  4857. html: 'boolean',
  4858. selector: '(string|boolean)',
  4859. placement: '(string|function)',
  4860. offset: '(number|string|function)',
  4861. container: '(string|element|boolean)',
  4862. fallbackPlacement: '(string|array)',
  4863. boundary: '(string|element)',
  4864. sanitize: 'boolean',
  4865. sanitizeFn: '(null|function)',
  4866. whiteList: 'object',
  4867. popperConfig: '(null|object)'
  4868. };
  4869. var AttachmentMap$1 = {
  4870. AUTO: 'auto',
  4871. TOP: 'top',
  4872. RIGHT: 'right',
  4873. BOTTOM: 'bottom',
  4874. LEFT: 'left'
  4875. };
  4876. var Default$4 = {
  4877. animation: true,
  4878. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4879. trigger: 'hover focus',
  4880. title: '',
  4881. delay: 0,
  4882. html: false,
  4883. selector: false,
  4884. placement: 'top',
  4885. offset: 0,
  4886. container: false,
  4887. fallbackPlacement: 'flip',
  4888. boundary: 'scrollParent',
  4889. sanitize: true,
  4890. sanitizeFn: null,
  4891. whiteList: DefaultWhitelist,
  4892. popperConfig: null
  4893. };
  4894. var HoverState = {
  4895. SHOW: 'show',
  4896. OUT: 'out'
  4897. };
  4898. var Event$6 = {
  4899. HIDE: "hide" + EVENT_KEY$6,
  4900. HIDDEN: "hidden" + EVENT_KEY$6,
  4901. SHOW: "show" + EVENT_KEY$6,
  4902. SHOWN: "shown" + EVENT_KEY$6,
  4903. INSERTED: "inserted" + EVENT_KEY$6,
  4904. CLICK: "click" + EVENT_KEY$6,
  4905. FOCUSIN: "focusin" + EVENT_KEY$6,
  4906. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4907. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4908. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4909. };
  4910. var ClassName$6 = {
  4911. FADE: 'fade',
  4912. SHOW: 'show'
  4913. };
  4914. var Selector$6 = {
  4915. TOOLTIP: '.tooltip',
  4916. TOOLTIP_INNER: '.tooltip-inner',
  4917. ARROW: '.arrow'
  4918. };
  4919. var Trigger = {
  4920. HOVER: 'hover',
  4921. FOCUS: 'focus',
  4922. CLICK: 'click',
  4923. MANUAL: 'manual'
  4924. };
  4925. /**
  4926. * ------------------------------------------------------------------------
  4927. * Class Definition
  4928. * ------------------------------------------------------------------------
  4929. */
  4930. var Tooltip =
  4931. /*#__PURE__*/
  4932. function () {
  4933. function Tooltip(element, config) {
  4934. if (typeof Popper === 'undefined') {
  4935. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4936. } // private
  4937. this._isEnabled = true;
  4938. this._timeout = 0;
  4939. this._hoverState = '';
  4940. this._activeTrigger = {};
  4941. this._popper = null; // Protected
  4942. this.element = element;
  4943. this.config = this._getConfig(config);
  4944. this.tip = null;
  4945. this._setListeners();
  4946. } // Getters
  4947. var _proto = Tooltip.prototype;
  4948. // Public
  4949. _proto.enable = function enable() {
  4950. this._isEnabled = true;
  4951. };
  4952. _proto.disable = function disable() {
  4953. this._isEnabled = false;
  4954. };
  4955. _proto.toggleEnabled = function toggleEnabled() {
  4956. this._isEnabled = !this._isEnabled;
  4957. };
  4958. _proto.toggle = function toggle(event) {
  4959. if (!this._isEnabled) {
  4960. return;
  4961. }
  4962. if (event) {
  4963. var dataKey = this.constructor.DATA_KEY;
  4964. var context = $(event.currentTarget).data(dataKey);
  4965. if (!context) {
  4966. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4967. $(event.currentTarget).data(dataKey, context);
  4968. }
  4969. context._activeTrigger.click = !context._activeTrigger.click;
  4970. if (context._isWithActiveTrigger()) {
  4971. context._enter(null, context);
  4972. } else {
  4973. context._leave(null, context);
  4974. }
  4975. } else {
  4976. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4977. this._leave(null, this);
  4978. return;
  4979. }
  4980. this._enter(null, this);
  4981. }
  4982. };
  4983. _proto.dispose = function dispose() {
  4984. clearTimeout(this._timeout);
  4985. $.removeData(this.element, this.constructor.DATA_KEY);
  4986. $(this.element).off(this.constructor.EVENT_KEY);
  4987. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4988. if (this.tip) {
  4989. $(this.tip).remove();
  4990. }
  4991. this._isEnabled = null;
  4992. this._timeout = null;
  4993. this._hoverState = null;
  4994. this._activeTrigger = null;
  4995. if (this._popper) {
  4996. this._popper.destroy();
  4997. }
  4998. this._popper = null;
  4999. this.element = null;
  5000. this.config = null;
  5001. this.tip = null;
  5002. };
  5003. _proto.show = function show() {
  5004. var _this = this;
  5005. if ($(this.element).css('display') === 'none') {
  5006. throw new Error('Please use show on visible elements');
  5007. }
  5008. var showEvent = $.Event(this.constructor.Event.SHOW);
  5009. if (this.isWithContent() && this._isEnabled) {
  5010. $(this.element).trigger(showEvent);
  5011. var shadowRoot = Util.findShadowRoot(this.element);
  5012. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5013. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5014. return;
  5015. }
  5016. var tip = this.getTipElement();
  5017. var tipId = Util.getUID(this.constructor.NAME);
  5018. tip.setAttribute('id', tipId);
  5019. this.element.setAttribute('aria-describedby', tipId);
  5020. this.setContent();
  5021. if (this.config.animation) {
  5022. $(tip).addClass(ClassName$6.FADE);
  5023. }
  5024. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5025. var attachment = this._getAttachment(placement);
  5026. this.addAttachmentClass(attachment);
  5027. var container = this._getContainer();
  5028. $(tip).data(this.constructor.DATA_KEY, this);
  5029. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5030. $(tip).appendTo(container);
  5031. }
  5032. $(this.element).trigger(this.constructor.Event.INSERTED);
  5033. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5034. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5035. // empty mouseover listeners to the body's immediate children;
  5036. // only needed because of broken event delegation on iOS
  5037. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5038. if ('ontouchstart' in document.documentElement) {
  5039. $(document.body).children().on('mouseover', null, $.noop);
  5040. }
  5041. var complete = function complete() {
  5042. if (_this.config.animation) {
  5043. _this._fixTransition();
  5044. }
  5045. var prevHoverState = _this._hoverState;
  5046. _this._hoverState = null;
  5047. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5048. if (prevHoverState === HoverState.OUT) {
  5049. _this._leave(null, _this);
  5050. }
  5051. };
  5052. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5053. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5054. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5055. } else {
  5056. complete();
  5057. }
  5058. }
  5059. };
  5060. _proto.hide = function hide(callback) {
  5061. var _this2 = this;
  5062. var tip = this.getTipElement();
  5063. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5064. var complete = function complete() {
  5065. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5066. tip.parentNode.removeChild(tip);
  5067. }
  5068. _this2._cleanTipClass();
  5069. _this2.element.removeAttribute('aria-describedby');
  5070. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5071. if (_this2._popper !== null) {
  5072. _this2._popper.destroy();
  5073. }
  5074. if (callback) {
  5075. callback();
  5076. }
  5077. };
  5078. $(this.element).trigger(hideEvent);
  5079. if (hideEvent.isDefaultPrevented()) {
  5080. return;
  5081. }
  5082. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5083. // empty mouseover listeners we added for iOS support
  5084. if ('ontouchstart' in document.documentElement) {
  5085. $(document.body).children().off('mouseover', null, $.noop);
  5086. }
  5087. this._activeTrigger[Trigger.CLICK] = false;
  5088. this._activeTrigger[Trigger.FOCUS] = false;
  5089. this._activeTrigger[Trigger.HOVER] = false;
  5090. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5091. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5092. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5093. } else {
  5094. complete();
  5095. }
  5096. this._hoverState = '';
  5097. };
  5098. _proto.update = function update() {
  5099. if (this._popper !== null) {
  5100. this._popper.scheduleUpdate();
  5101. }
  5102. } // Protected
  5103. ;
  5104. _proto.isWithContent = function isWithContent() {
  5105. return Boolean(this.getTitle());
  5106. };
  5107. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5108. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5109. };
  5110. _proto.getTipElement = function getTipElement() {
  5111. this.tip = this.tip || $(this.config.template)[0];
  5112. return this.tip;
  5113. };
  5114. _proto.setContent = function setContent() {
  5115. var tip = this.getTipElement();
  5116. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5117. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5118. };
  5119. _proto.setElementContent = function setElementContent($element, content) {
  5120. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5121. // Content is a DOM node or a jQuery
  5122. if (this.config.html) {
  5123. if (!$(content).parent().is($element)) {
  5124. $element.empty().append(content);
  5125. }
  5126. } else {
  5127. $element.text($(content).text());
  5128. }
  5129. return;
  5130. }
  5131. if (this.config.html) {
  5132. if (this.config.sanitize) {
  5133. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5134. }
  5135. $element.html(content);
  5136. } else {
  5137. $element.text(content);
  5138. }
  5139. };
  5140. _proto.getTitle = function getTitle() {
  5141. var title = this.element.getAttribute('data-original-title');
  5142. if (!title) {
  5143. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5144. }
  5145. return title;
  5146. } // Private
  5147. ;
  5148. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5149. var _this3 = this;
  5150. var defaultBsConfig = {
  5151. placement: attachment,
  5152. modifiers: {
  5153. offset: this._getOffset(),
  5154. flip: {
  5155. behavior: this.config.fallbackPlacement
  5156. },
  5157. arrow: {
  5158. element: Selector$6.ARROW
  5159. },
  5160. preventOverflow: {
  5161. boundariesElement: this.config.boundary
  5162. }
  5163. },
  5164. onCreate: function onCreate(data) {
  5165. if (data.originalPlacement !== data.placement) {
  5166. _this3._handlePopperPlacementChange(data);
  5167. }
  5168. },
  5169. onUpdate: function onUpdate(data) {
  5170. return _this3._handlePopperPlacementChange(data);
  5171. }
  5172. };
  5173. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5174. };
  5175. _proto._getOffset = function _getOffset() {
  5176. var _this4 = this;
  5177. var offset = {};
  5178. if (typeof this.config.offset === 'function') {
  5179. offset.fn = function (data) {
  5180. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5181. return data;
  5182. };
  5183. } else {
  5184. offset.offset = this.config.offset;
  5185. }
  5186. return offset;
  5187. };
  5188. _proto._getContainer = function _getContainer() {
  5189. if (this.config.container === false) {
  5190. return document.body;
  5191. }
  5192. if (Util.isElement(this.config.container)) {
  5193. return $(this.config.container);
  5194. }
  5195. return $(document).find(this.config.container);
  5196. };
  5197. _proto._getAttachment = function _getAttachment(placement) {
  5198. return AttachmentMap$1[placement.toUpperCase()];
  5199. };
  5200. _proto._setListeners = function _setListeners() {
  5201. var _this5 = this;
  5202. var triggers = this.config.trigger.split(' ');
  5203. triggers.forEach(function (trigger) {
  5204. if (trigger === 'click') {
  5205. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5206. return _this5.toggle(event);
  5207. });
  5208. } else if (trigger !== Trigger.MANUAL) {
  5209. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5210. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5211. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5212. return _this5._enter(event);
  5213. }).on(eventOut, _this5.config.selector, function (event) {
  5214. return _this5._leave(event);
  5215. });
  5216. }
  5217. });
  5218. this._hideModalHandler = function () {
  5219. if (_this5.element) {
  5220. _this5.hide();
  5221. }
  5222. };
  5223. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5224. if (this.config.selector) {
  5225. this.config = _objectSpread2({}, this.config, {
  5226. trigger: 'manual',
  5227. selector: ''
  5228. });
  5229. } else {
  5230. this._fixTitle();
  5231. }
  5232. };
  5233. _proto._fixTitle = function _fixTitle() {
  5234. var titleType = typeof this.element.getAttribute('data-original-title');
  5235. if (this.element.getAttribute('title') || titleType !== 'string') {
  5236. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5237. this.element.setAttribute('title', '');
  5238. }
  5239. };
  5240. _proto._enter = function _enter(event, context) {
  5241. var dataKey = this.constructor.DATA_KEY;
  5242. context = context || $(event.currentTarget).data(dataKey);
  5243. if (!context) {
  5244. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5245. $(event.currentTarget).data(dataKey, context);
  5246. }
  5247. if (event) {
  5248. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5249. }
  5250. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5251. context._hoverState = HoverState.SHOW;
  5252. return;
  5253. }
  5254. clearTimeout(context._timeout);
  5255. context._hoverState = HoverState.SHOW;
  5256. if (!context.config.delay || !context.config.delay.show) {
  5257. context.show();
  5258. return;
  5259. }
  5260. context._timeout = setTimeout(function () {
  5261. if (context._hoverState === HoverState.SHOW) {
  5262. context.show();
  5263. }
  5264. }, context.config.delay.show);
  5265. };
  5266. _proto._leave = function _leave(event, context) {
  5267. var dataKey = this.constructor.DATA_KEY;
  5268. context = context || $(event.currentTarget).data(dataKey);
  5269. if (!context) {
  5270. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5271. $(event.currentTarget).data(dataKey, context);
  5272. }
  5273. if (event) {
  5274. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5275. }
  5276. if (context._isWithActiveTrigger()) {
  5277. return;
  5278. }
  5279. clearTimeout(context._timeout);
  5280. context._hoverState = HoverState.OUT;
  5281. if (!context.config.delay || !context.config.delay.hide) {
  5282. context.hide();
  5283. return;
  5284. }
  5285. context._timeout = setTimeout(function () {
  5286. if (context._hoverState === HoverState.OUT) {
  5287. context.hide();
  5288. }
  5289. }, context.config.delay.hide);
  5290. };
  5291. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5292. for (var trigger in this._activeTrigger) {
  5293. if (this._activeTrigger[trigger]) {
  5294. return true;
  5295. }
  5296. }
  5297. return false;
  5298. };
  5299. _proto._getConfig = function _getConfig(config) {
  5300. var dataAttributes = $(this.element).data();
  5301. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5302. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5303. delete dataAttributes[dataAttr];
  5304. }
  5305. });
  5306. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5307. if (typeof config.delay === 'number') {
  5308. config.delay = {
  5309. show: config.delay,
  5310. hide: config.delay
  5311. };
  5312. }
  5313. if (typeof config.title === 'number') {
  5314. config.title = config.title.toString();
  5315. }
  5316. if (typeof config.content === 'number') {
  5317. config.content = config.content.toString();
  5318. }
  5319. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5320. if (config.sanitize) {
  5321. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5322. }
  5323. return config;
  5324. };
  5325. _proto._getDelegateConfig = function _getDelegateConfig() {
  5326. var config = {};
  5327. if (this.config) {
  5328. for (var key in this.config) {
  5329. if (this.constructor.Default[key] !== this.config[key]) {
  5330. config[key] = this.config[key];
  5331. }
  5332. }
  5333. }
  5334. return config;
  5335. };
  5336. _proto._cleanTipClass = function _cleanTipClass() {
  5337. var $tip = $(this.getTipElement());
  5338. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5339. if (tabClass !== null && tabClass.length) {
  5340. $tip.removeClass(tabClass.join(''));
  5341. }
  5342. };
  5343. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5344. var popperInstance = popperData.instance;
  5345. this.tip = popperInstance.popper;
  5346. this._cleanTipClass();
  5347. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5348. };
  5349. _proto._fixTransition = function _fixTransition() {
  5350. var tip = this.getTipElement();
  5351. var initConfigAnimation = this.config.animation;
  5352. if (tip.getAttribute('x-placement') !== null) {
  5353. return;
  5354. }
  5355. $(tip).removeClass(ClassName$6.FADE);
  5356. this.config.animation = false;
  5357. this.hide();
  5358. this.show();
  5359. this.config.animation = initConfigAnimation;
  5360. } // Static
  5361. ;
  5362. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5363. return this.each(function () {
  5364. var data = $(this).data(DATA_KEY$6);
  5365. var _config = typeof config === 'object' && config;
  5366. if (!data && /dispose|hide/.test(config)) {
  5367. return;
  5368. }
  5369. if (!data) {
  5370. data = new Tooltip(this, _config);
  5371. $(this).data(DATA_KEY$6, data);
  5372. }
  5373. if (typeof config === 'string') {
  5374. if (typeof data[config] === 'undefined') {
  5375. throw new TypeError("No method named \"" + config + "\"");
  5376. }
  5377. data[config]();
  5378. }
  5379. });
  5380. };
  5381. _createClass(Tooltip, null, [{
  5382. key: "VERSION",
  5383. get: function get() {
  5384. return VERSION$6;
  5385. }
  5386. }, {
  5387. key: "Default",
  5388. get: function get() {
  5389. return Default$4;
  5390. }
  5391. }, {
  5392. key: "NAME",
  5393. get: function get() {
  5394. return NAME$6;
  5395. }
  5396. }, {
  5397. key: "DATA_KEY",
  5398. get: function get() {
  5399. return DATA_KEY$6;
  5400. }
  5401. }, {
  5402. key: "Event",
  5403. get: function get() {
  5404. return Event$6;
  5405. }
  5406. }, {
  5407. key: "EVENT_KEY",
  5408. get: function get() {
  5409. return EVENT_KEY$6;
  5410. }
  5411. }, {
  5412. key: "DefaultType",
  5413. get: function get() {
  5414. return DefaultType$4;
  5415. }
  5416. }]);
  5417. return Tooltip;
  5418. }();
  5419. /**
  5420. * ------------------------------------------------------------------------
  5421. * jQuery
  5422. * ------------------------------------------------------------------------
  5423. */
  5424. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5425. $.fn[NAME$6].Constructor = Tooltip;
  5426. $.fn[NAME$6].noConflict = function () {
  5427. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5428. return Tooltip._jQueryInterface;
  5429. };
  5430. /**
  5431. * ------------------------------------------------------------------------
  5432. * Constants
  5433. * ------------------------------------------------------------------------
  5434. */
  5435. var NAME$7 = 'popover';
  5436. var VERSION$7 = '4.4.1';
  5437. var DATA_KEY$7 = 'bs.popover';
  5438. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5439. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5440. var CLASS_PREFIX$1 = 'bs-popover';
  5441. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5442. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5443. placement: 'right',
  5444. trigger: 'click',
  5445. content: '',
  5446. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5447. });
  5448. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5449. content: '(string|element|function)'
  5450. });
  5451. var ClassName$7 = {
  5452. FADE: 'fade',
  5453. SHOW: 'show'
  5454. };
  5455. var Selector$7 = {
  5456. TITLE: '.popover-header',
  5457. CONTENT: '.popover-body'
  5458. };
  5459. var Event$7 = {
  5460. HIDE: "hide" + EVENT_KEY$7,
  5461. HIDDEN: "hidden" + EVENT_KEY$7,
  5462. SHOW: "show" + EVENT_KEY$7,
  5463. SHOWN: "shown" + EVENT_KEY$7,
  5464. INSERTED: "inserted" + EVENT_KEY$7,
  5465. CLICK: "click" + EVENT_KEY$7,
  5466. FOCUSIN: "focusin" + EVENT_KEY$7,
  5467. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5468. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5469. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5470. };
  5471. /**
  5472. * ------------------------------------------------------------------------
  5473. * Class Definition
  5474. * ------------------------------------------------------------------------
  5475. */
  5476. var Popover =
  5477. /*#__PURE__*/
  5478. function (_Tooltip) {
  5479. _inheritsLoose(Popover, _Tooltip);
  5480. function Popover() {
  5481. return _Tooltip.apply(this, arguments) || this;
  5482. }
  5483. var _proto = Popover.prototype;
  5484. // Overrides
  5485. _proto.isWithContent = function isWithContent() {
  5486. return this.getTitle() || this._getContent();
  5487. };
  5488. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5489. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5490. };
  5491. _proto.getTipElement = function getTipElement() {
  5492. this.tip = this.tip || $(this.config.template)[0];
  5493. return this.tip;
  5494. };
  5495. _proto.setContent = function setContent() {
  5496. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5497. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5498. var content = this._getContent();
  5499. if (typeof content === 'function') {
  5500. content = content.call(this.element);
  5501. }
  5502. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5503. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5504. } // Private
  5505. ;
  5506. _proto._getContent = function _getContent() {
  5507. return this.element.getAttribute('data-content') || this.config.content;
  5508. };
  5509. _proto._cleanTipClass = function _cleanTipClass() {
  5510. var $tip = $(this.getTipElement());
  5511. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5512. if (tabClass !== null && tabClass.length > 0) {
  5513. $tip.removeClass(tabClass.join(''));
  5514. }
  5515. } // Static
  5516. ;
  5517. Popover._jQueryInterface = function _jQueryInterface(config) {
  5518. return this.each(function () {
  5519. var data = $(this).data(DATA_KEY$7);
  5520. var _config = typeof config === 'object' ? config : null;
  5521. if (!data && /dispose|hide/.test(config)) {
  5522. return;
  5523. }
  5524. if (!data) {
  5525. data = new Popover(this, _config);
  5526. $(this).data(DATA_KEY$7, data);
  5527. }
  5528. if (typeof config === 'string') {
  5529. if (typeof data[config] === 'undefined') {
  5530. throw new TypeError("No method named \"" + config + "\"");
  5531. }
  5532. data[config]();
  5533. }
  5534. });
  5535. };
  5536. _createClass(Popover, null, [{
  5537. key: "VERSION",
  5538. // Getters
  5539. get: function get() {
  5540. return VERSION$7;
  5541. }
  5542. }, {
  5543. key: "Default",
  5544. get: function get() {
  5545. return Default$5;
  5546. }
  5547. }, {
  5548. key: "NAME",
  5549. get: function get() {
  5550. return NAME$7;
  5551. }
  5552. }, {
  5553. key: "DATA_KEY",
  5554. get: function get() {
  5555. return DATA_KEY$7;
  5556. }
  5557. }, {
  5558. key: "Event",
  5559. get: function get() {
  5560. return Event$7;
  5561. }
  5562. }, {
  5563. key: "EVENT_KEY",
  5564. get: function get() {
  5565. return EVENT_KEY$7;
  5566. }
  5567. }, {
  5568. key: "DefaultType",
  5569. get: function get() {
  5570. return DefaultType$5;
  5571. }
  5572. }]);
  5573. return Popover;
  5574. }(Tooltip);
  5575. /**
  5576. * ------------------------------------------------------------------------
  5577. * jQuery
  5578. * ------------------------------------------------------------------------
  5579. */
  5580. $.fn[NAME$7] = Popover._jQueryInterface;
  5581. $.fn[NAME$7].Constructor = Popover;
  5582. $.fn[NAME$7].noConflict = function () {
  5583. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5584. return Popover._jQueryInterface;
  5585. };
  5586. /**
  5587. * ------------------------------------------------------------------------
  5588. * Constants
  5589. * ------------------------------------------------------------------------
  5590. */
  5591. var NAME$8 = 'scrollspy';
  5592. var VERSION$8 = '4.4.1';
  5593. var DATA_KEY$8 = 'bs.scrollspy';
  5594. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5595. var DATA_API_KEY$6 = '.data-api';
  5596. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5597. var Default$6 = {
  5598. offset: 10,
  5599. method: 'auto',
  5600. target: ''
  5601. };
  5602. var DefaultType$6 = {
  5603. offset: 'number',
  5604. method: 'string',
  5605. target: '(string|element)'
  5606. };
  5607. var Event$8 = {
  5608. ACTIVATE: "activate" + EVENT_KEY$8,
  5609. SCROLL: "scroll" + EVENT_KEY$8,
  5610. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5611. };
  5612. var ClassName$8 = {
  5613. DROPDOWN_ITEM: 'dropdown-item',
  5614. DROPDOWN_MENU: 'dropdown-menu',
  5615. ACTIVE: 'active'
  5616. };
  5617. var Selector$8 = {
  5618. DATA_SPY: '[data-spy="scroll"]',
  5619. ACTIVE: '.active',
  5620. NAV_LIST_GROUP: '.nav, .list-group',
  5621. NAV_LINKS: '.nav-link',
  5622. NAV_ITEMS: '.nav-item',
  5623. LIST_ITEMS: '.list-group-item',
  5624. DROPDOWN: '.dropdown',
  5625. DROPDOWN_ITEMS: '.dropdown-item',
  5626. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5627. };
  5628. var OffsetMethod = {
  5629. OFFSET: 'offset',
  5630. POSITION: 'position'
  5631. };
  5632. /**
  5633. * ------------------------------------------------------------------------
  5634. * Class Definition
  5635. * ------------------------------------------------------------------------
  5636. */
  5637. var ScrollSpy =
  5638. /*#__PURE__*/
  5639. function () {
  5640. function ScrollSpy(element, config) {
  5641. var _this = this;
  5642. this._element = element;
  5643. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5644. this._config = this._getConfig(config);
  5645. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5646. this._offsets = [];
  5647. this._targets = [];
  5648. this._activeTarget = null;
  5649. this._scrollHeight = 0;
  5650. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5651. return _this._process(event);
  5652. });
  5653. this.refresh();
  5654. this._process();
  5655. } // Getters
  5656. var _proto = ScrollSpy.prototype;
  5657. // Public
  5658. _proto.refresh = function refresh() {
  5659. var _this2 = this;
  5660. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5661. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5662. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5663. this._offsets = [];
  5664. this._targets = [];
  5665. this._scrollHeight = this._getScrollHeight();
  5666. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5667. targets.map(function (element) {
  5668. var target;
  5669. var targetSelector = Util.getSelectorFromElement(element);
  5670. if (targetSelector) {
  5671. target = document.querySelector(targetSelector);
  5672. }
  5673. if (target) {
  5674. var targetBCR = target.getBoundingClientRect();
  5675. if (targetBCR.width || targetBCR.height) {
  5676. // TODO (fat): remove sketch reliance on jQuery position/offset
  5677. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5678. }
  5679. }
  5680. return null;
  5681. }).filter(function (item) {
  5682. return item;
  5683. }).sort(function (a, b) {
  5684. return a[0] - b[0];
  5685. }).forEach(function (item) {
  5686. _this2._offsets.push(item[0]);
  5687. _this2._targets.push(item[1]);
  5688. });
  5689. };
  5690. _proto.dispose = function dispose() {
  5691. $.removeData(this._element, DATA_KEY$8);
  5692. $(this._scrollElement).off(EVENT_KEY$8);
  5693. this._element = null;
  5694. this._scrollElement = null;
  5695. this._config = null;
  5696. this._selector = null;
  5697. this._offsets = null;
  5698. this._targets = null;
  5699. this._activeTarget = null;
  5700. this._scrollHeight = null;
  5701. } // Private
  5702. ;
  5703. _proto._getConfig = function _getConfig(config) {
  5704. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5705. if (typeof config.target !== 'string') {
  5706. var id = $(config.target).attr('id');
  5707. if (!id) {
  5708. id = Util.getUID(NAME$8);
  5709. $(config.target).attr('id', id);
  5710. }
  5711. config.target = "#" + id;
  5712. }
  5713. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5714. return config;
  5715. };
  5716. _proto._getScrollTop = function _getScrollTop() {
  5717. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5718. };
  5719. _proto._getScrollHeight = function _getScrollHeight() {
  5720. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5721. };
  5722. _proto._getOffsetHeight = function _getOffsetHeight() {
  5723. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5724. };
  5725. _proto._process = function _process() {
  5726. var scrollTop = this._getScrollTop() + this._config.offset;
  5727. var scrollHeight = this._getScrollHeight();
  5728. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5729. if (this._scrollHeight !== scrollHeight) {
  5730. this.refresh();
  5731. }
  5732. if (scrollTop >= maxScroll) {
  5733. var target = this._targets[this._targets.length - 1];
  5734. if (this._activeTarget !== target) {
  5735. this._activate(target);
  5736. }
  5737. return;
  5738. }
  5739. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5740. this._activeTarget = null;
  5741. this._clear();
  5742. return;
  5743. }
  5744. var offsetLength = this._offsets.length;
  5745. for (var i = offsetLength; i--;) {
  5746. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5747. if (isActiveTarget) {
  5748. this._activate(this._targets[i]);
  5749. }
  5750. }
  5751. };
  5752. _proto._activate = function _activate(target) {
  5753. this._activeTarget = target;
  5754. this._clear();
  5755. var queries = this._selector.split(',').map(function (selector) {
  5756. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5757. });
  5758. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5759. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5760. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5761. $link.addClass(ClassName$8.ACTIVE);
  5762. } else {
  5763. // Set triggered link as active
  5764. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5765. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5766. $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
  5767. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5768. }
  5769. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5770. relatedTarget: target
  5771. });
  5772. };
  5773. _proto._clear = function _clear() {
  5774. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5775. return node.classList.contains(ClassName$8.ACTIVE);
  5776. }).forEach(function (node) {
  5777. return node.classList.remove(ClassName$8.ACTIVE);
  5778. });
  5779. } // Static
  5780. ;
  5781. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5782. return this.each(function () {
  5783. var data = $(this).data(DATA_KEY$8);
  5784. var _config = typeof config === 'object' && config;
  5785. if (!data) {
  5786. data = new ScrollSpy(this, _config);
  5787. $(this).data(DATA_KEY$8, data);
  5788. }
  5789. if (typeof config === 'string') {
  5790. if (typeof data[config] === 'undefined') {
  5791. throw new TypeError("No method named \"" + config + "\"");
  5792. }
  5793. data[config]();
  5794. }
  5795. });
  5796. };
  5797. _createClass(ScrollSpy, null, [{
  5798. key: "VERSION",
  5799. get: function get() {
  5800. return VERSION$8;
  5801. }
  5802. }, {
  5803. key: "Default",
  5804. get: function get() {
  5805. return Default$6;
  5806. }
  5807. }]);
  5808. return ScrollSpy;
  5809. }();
  5810. /**
  5811. * ------------------------------------------------------------------------
  5812. * Data Api implementation
  5813. * ------------------------------------------------------------------------
  5814. */
  5815. $(window).on(Event$8.LOAD_DATA_API, function () {
  5816. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5817. var scrollSpysLength = scrollSpys.length;
  5818. for (var i = scrollSpysLength; i--;) {
  5819. var $spy = $(scrollSpys[i]);
  5820. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5821. }
  5822. });
  5823. /**
  5824. * ------------------------------------------------------------------------
  5825. * jQuery
  5826. * ------------------------------------------------------------------------
  5827. */
  5828. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5829. $.fn[NAME$8].Constructor = ScrollSpy;
  5830. $.fn[NAME$8].noConflict = function () {
  5831. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5832. return ScrollSpy._jQueryInterface;
  5833. };
  5834. /**
  5835. * ------------------------------------------------------------------------
  5836. * Constants
  5837. * ------------------------------------------------------------------------
  5838. */
  5839. var NAME$9 = 'tab';
  5840. var VERSION$9 = '4.4.1';
  5841. var DATA_KEY$9 = 'bs.tab';
  5842. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5843. var DATA_API_KEY$7 = '.data-api';
  5844. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5845. var Event$9 = {
  5846. HIDE: "hide" + EVENT_KEY$9,
  5847. HIDDEN: "hidden" + EVENT_KEY$9,
  5848. SHOW: "show" + EVENT_KEY$9,
  5849. SHOWN: "shown" + EVENT_KEY$9,
  5850. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5851. };
  5852. var ClassName$9 = {
  5853. DROPDOWN_MENU: 'dropdown-menu',
  5854. ACTIVE: 'active',
  5855. DISABLED: 'disabled',
  5856. FADE: 'fade',
  5857. SHOW: 'show'
  5858. };
  5859. var Selector$9 = {
  5860. DROPDOWN: '.dropdown',
  5861. NAV_LIST_GROUP: '.nav, .list-group',
  5862. ACTIVE: '.active',
  5863. ACTIVE_UL: '> li > .active',
  5864. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5865. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5866. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5867. };
  5868. /**
  5869. * ------------------------------------------------------------------------
  5870. * Class Definition
  5871. * ------------------------------------------------------------------------
  5872. */
  5873. var Tab =
  5874. /*#__PURE__*/
  5875. function () {
  5876. function Tab(element) {
  5877. this._element = element;
  5878. } // Getters
  5879. var _proto = Tab.prototype;
  5880. // Public
  5881. _proto.show = function show() {
  5882. var _this = this;
  5883. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5884. return;
  5885. }
  5886. var target;
  5887. var previous;
  5888. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5889. var selector = Util.getSelectorFromElement(this._element);
  5890. if (listElement) {
  5891. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5892. previous = $.makeArray($(listElement).find(itemSelector));
  5893. previous = previous[previous.length - 1];
  5894. }
  5895. var hideEvent = $.Event(Event$9.HIDE, {
  5896. relatedTarget: this._element
  5897. });
  5898. var showEvent = $.Event(Event$9.SHOW, {
  5899. relatedTarget: previous
  5900. });
  5901. if (previous) {
  5902. $(previous).trigger(hideEvent);
  5903. }
  5904. $(this._element).trigger(showEvent);
  5905. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5906. return;
  5907. }
  5908. if (selector) {
  5909. target = document.querySelector(selector);
  5910. }
  5911. this._activate(this._element, listElement);
  5912. var complete = function complete() {
  5913. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5914. relatedTarget: _this._element
  5915. });
  5916. var shownEvent = $.Event(Event$9.SHOWN, {
  5917. relatedTarget: previous
  5918. });
  5919. $(previous).trigger(hiddenEvent);
  5920. $(_this._element).trigger(shownEvent);
  5921. };
  5922. if (target) {
  5923. this._activate(target, target.parentNode, complete);
  5924. } else {
  5925. complete();
  5926. }
  5927. };
  5928. _proto.dispose = function dispose() {
  5929. $.removeData(this._element, DATA_KEY$9);
  5930. this._element = null;
  5931. } // Private
  5932. ;
  5933. _proto._activate = function _activate(element, container, callback) {
  5934. var _this2 = this;
  5935. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5936. var active = activeElements[0];
  5937. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5938. var complete = function complete() {
  5939. return _this2._transitionComplete(element, active, callback);
  5940. };
  5941. if (active && isTransitioning) {
  5942. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5943. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5944. } else {
  5945. complete();
  5946. }
  5947. };
  5948. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5949. if (active) {
  5950. $(active).removeClass(ClassName$9.ACTIVE);
  5951. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5952. if (dropdownChild) {
  5953. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5954. }
  5955. if (active.getAttribute('role') === 'tab') {
  5956. active.setAttribute('aria-selected', false);
  5957. }
  5958. }
  5959. $(element).addClass(ClassName$9.ACTIVE);
  5960. if (element.getAttribute('role') === 'tab') {
  5961. element.setAttribute('aria-selected', true);
  5962. }
  5963. Util.reflow(element);
  5964. if (element.classList.contains(ClassName$9.FADE)) {
  5965. element.classList.add(ClassName$9.SHOW);
  5966. }
  5967. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5968. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5969. if (dropdownElement) {
  5970. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5971. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5972. }
  5973. element.setAttribute('aria-expanded', true);
  5974. }
  5975. if (callback) {
  5976. callback();
  5977. }
  5978. } // Static
  5979. ;
  5980. Tab._jQueryInterface = function _jQueryInterface(config) {
  5981. return this.each(function () {
  5982. var $this = $(this);
  5983. var data = $this.data(DATA_KEY$9);
  5984. if (!data) {
  5985. data = new Tab(this);
  5986. $this.data(DATA_KEY$9, data);
  5987. }
  5988. if (typeof config === 'string') {
  5989. if (typeof data[config] === 'undefined') {
  5990. throw new TypeError("No method named \"" + config + "\"");
  5991. }
  5992. data[config]();
  5993. }
  5994. });
  5995. };
  5996. _createClass(Tab, null, [{
  5997. key: "VERSION",
  5998. get: function get() {
  5999. return VERSION$9;
  6000. }
  6001. }]);
  6002. return Tab;
  6003. }();
  6004. /**
  6005. * ------------------------------------------------------------------------
  6006. * Data Api implementation
  6007. * ------------------------------------------------------------------------
  6008. */
  6009. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6010. event.preventDefault();
  6011. Tab._jQueryInterface.call($(this), 'show');
  6012. });
  6013. /**
  6014. * ------------------------------------------------------------------------
  6015. * jQuery
  6016. * ------------------------------------------------------------------------
  6017. */
  6018. $.fn[NAME$9] = Tab._jQueryInterface;
  6019. $.fn[NAME$9].Constructor = Tab;
  6020. $.fn[NAME$9].noConflict = function () {
  6021. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6022. return Tab._jQueryInterface;
  6023. };
  6024. /**
  6025. * ------------------------------------------------------------------------
  6026. * Constants
  6027. * ------------------------------------------------------------------------
  6028. */
  6029. var NAME$a = 'toast';
  6030. var VERSION$a = '4.4.1';
  6031. var DATA_KEY$a = 'bs.toast';
  6032. var EVENT_KEY$a = "." + DATA_KEY$a;
  6033. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6034. var Event$a = {
  6035. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6036. HIDE: "hide" + EVENT_KEY$a,
  6037. HIDDEN: "hidden" + EVENT_KEY$a,
  6038. SHOW: "show" + EVENT_KEY$a,
  6039. SHOWN: "shown" + EVENT_KEY$a
  6040. };
  6041. var ClassName$a = {
  6042. FADE: 'fade',
  6043. HIDE: 'hide',
  6044. SHOW: 'show',
  6045. SHOWING: 'showing'
  6046. };
  6047. var DefaultType$7 = {
  6048. animation: 'boolean',
  6049. autohide: 'boolean',
  6050. delay: 'number'
  6051. };
  6052. var Default$7 = {
  6053. animation: true,
  6054. autohide: true,
  6055. delay: 500
  6056. };
  6057. var Selector$a = {
  6058. DATA_DISMISS: '[data-dismiss="toast"]'
  6059. };
  6060. /**
  6061. * ------------------------------------------------------------------------
  6062. * Class Definition
  6063. * ------------------------------------------------------------------------
  6064. */
  6065. var Toast =
  6066. /*#__PURE__*/
  6067. function () {
  6068. function Toast(element, config) {
  6069. this._element = element;
  6070. this._config = this._getConfig(config);
  6071. this._timeout = null;
  6072. this._setListeners();
  6073. } // Getters
  6074. var _proto = Toast.prototype;
  6075. // Public
  6076. _proto.show = function show() {
  6077. var _this = this;
  6078. var showEvent = $.Event(Event$a.SHOW);
  6079. $(this._element).trigger(showEvent);
  6080. if (showEvent.isDefaultPrevented()) {
  6081. return;
  6082. }
  6083. if (this._config.animation) {
  6084. this._element.classList.add(ClassName$a.FADE);
  6085. }
  6086. var complete = function complete() {
  6087. _this._element.classList.remove(ClassName$a.SHOWING);
  6088. _this._element.classList.add(ClassName$a.SHOW);
  6089. $(_this._element).trigger(Event$a.SHOWN);
  6090. if (_this._config.autohide) {
  6091. _this._timeout = setTimeout(function () {
  6092. _this.hide();
  6093. }, _this._config.delay);
  6094. }
  6095. };
  6096. this._element.classList.remove(ClassName$a.HIDE);
  6097. Util.reflow(this._element);
  6098. this._element.classList.add(ClassName$a.SHOWING);
  6099. if (this._config.animation) {
  6100. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6101. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6102. } else {
  6103. complete();
  6104. }
  6105. };
  6106. _proto.hide = function hide() {
  6107. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6108. return;
  6109. }
  6110. var hideEvent = $.Event(Event$a.HIDE);
  6111. $(this._element).trigger(hideEvent);
  6112. if (hideEvent.isDefaultPrevented()) {
  6113. return;
  6114. }
  6115. this._close();
  6116. };
  6117. _proto.dispose = function dispose() {
  6118. clearTimeout(this._timeout);
  6119. this._timeout = null;
  6120. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6121. this._element.classList.remove(ClassName$a.SHOW);
  6122. }
  6123. $(this._element).off(Event$a.CLICK_DISMISS);
  6124. $.removeData(this._element, DATA_KEY$a);
  6125. this._element = null;
  6126. this._config = null;
  6127. } // Private
  6128. ;
  6129. _proto._getConfig = function _getConfig(config) {
  6130. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6131. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6132. return config;
  6133. };
  6134. _proto._setListeners = function _setListeners() {
  6135. var _this2 = this;
  6136. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6137. return _this2.hide();
  6138. });
  6139. };
  6140. _proto._close = function _close() {
  6141. var _this3 = this;
  6142. var complete = function complete() {
  6143. _this3._element.classList.add(ClassName$a.HIDE);
  6144. $(_this3._element).trigger(Event$a.HIDDEN);
  6145. };
  6146. this._element.classList.remove(ClassName$a.SHOW);
  6147. if (this._config.animation) {
  6148. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6149. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6150. } else {
  6151. complete();
  6152. }
  6153. } // Static
  6154. ;
  6155. Toast._jQueryInterface = function _jQueryInterface(config) {
  6156. return this.each(function () {
  6157. var $element = $(this);
  6158. var data = $element.data(DATA_KEY$a);
  6159. var _config = typeof config === 'object' && config;
  6160. if (!data) {
  6161. data = new Toast(this, _config);
  6162. $element.data(DATA_KEY$a, data);
  6163. }
  6164. if (typeof config === 'string') {
  6165. if (typeof data[config] === 'undefined') {
  6166. throw new TypeError("No method named \"" + config + "\"");
  6167. }
  6168. data[config](this);
  6169. }
  6170. });
  6171. };
  6172. _createClass(Toast, null, [{
  6173. key: "VERSION",
  6174. get: function get() {
  6175. return VERSION$a;
  6176. }
  6177. }, {
  6178. key: "DefaultType",
  6179. get: function get() {
  6180. return DefaultType$7;
  6181. }
  6182. }, {
  6183. key: "Default",
  6184. get: function get() {
  6185. return Default$7;
  6186. }
  6187. }]);
  6188. return Toast;
  6189. }();
  6190. /**
  6191. * ------------------------------------------------------------------------
  6192. * jQuery
  6193. * ------------------------------------------------------------------------
  6194. */
  6195. $.fn[NAME$a] = Toast._jQueryInterface;
  6196. $.fn[NAME$a].Constructor = Toast;
  6197. $.fn[NAME$a].noConflict = function () {
  6198. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6199. return Toast._jQueryInterface;
  6200. };
  6201. exports.Alert = Alert;
  6202. exports.Button = Button;
  6203. exports.Carousel = Carousel;
  6204. exports.Collapse = Collapse;
  6205. exports.Dropdown = Dropdown;
  6206. exports.Modal = Modal;
  6207. exports.Popover = Popover;
  6208. exports.Scrollspy = ScrollSpy;
  6209. exports.Tab = Tab;
  6210. exports.Toast = Toast;
  6211. exports.Tooltip = Tooltip;
  6212. exports.Util = Util;
  6213. Object.defineProperty(exports, '__esModule', { value: true });
  6214. })));
  6215. //# sourceMappingURL=bootstrap.js.map
  6216. /***/ }),
  6217. /***/ "./node_modules/buffer/index.js":
  6218. /*!**************************************!*\
  6219. !*** ./node_modules/buffer/index.js ***!
  6220. \**************************************/
  6221. /*! no static exports found */
  6222. /***/ (function(module, exports, __webpack_require__) {
  6223. "use strict";
  6224. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6225. * The buffer module from node.js, for the browser.
  6226. *
  6227. * @author Feross Aboukhadijeh <http://feross.org>
  6228. * @license MIT
  6229. */
  6230. /* eslint-disable no-proto */
  6231. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6232. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6233. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6234. exports.Buffer = Buffer
  6235. exports.SlowBuffer = SlowBuffer
  6236. exports.INSPECT_MAX_BYTES = 50
  6237. /**
  6238. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6239. * === true Use Uint8Array implementation (fastest)
  6240. * === false Use Object implementation (most compatible, even IE6)
  6241. *
  6242. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6243. * Opera 11.6+, iOS 4.2+.
  6244. *
  6245. * Due to various browser bugs, sometimes the Object implementation will be used even
  6246. * when the browser supports typed arrays.
  6247. *
  6248. * Note:
  6249. *
  6250. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6251. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6252. *
  6253. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6254. *
  6255. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6256. * incorrect length in some situations.
  6257. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6258. * get the Object implementation, which is slower but behaves correctly.
  6259. */
  6260. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6261. ? global.TYPED_ARRAY_SUPPORT
  6262. : typedArraySupport()
  6263. /*
  6264. * Export kMaxLength after typed array support is determined.
  6265. */
  6266. exports.kMaxLength = kMaxLength()
  6267. function typedArraySupport () {
  6268. try {
  6269. var arr = new Uint8Array(1)
  6270. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6271. return arr.foo() === 42 && // typed array instances can be augmented
  6272. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6273. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6274. } catch (e) {
  6275. return false
  6276. }
  6277. }
  6278. function kMaxLength () {
  6279. return Buffer.TYPED_ARRAY_SUPPORT
  6280. ? 0x7fffffff
  6281. : 0x3fffffff
  6282. }
  6283. function createBuffer (that, length) {
  6284. if (kMaxLength() < length) {
  6285. throw new RangeError('Invalid typed array length')
  6286. }
  6287. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6288. // Return an augmented `Uint8Array` instance, for best performance
  6289. that = new Uint8Array(length)
  6290. that.__proto__ = Buffer.prototype
  6291. } else {
  6292. // Fallback: Return an object instance of the Buffer class
  6293. if (that === null) {
  6294. that = new Buffer(length)
  6295. }
  6296. that.length = length
  6297. }
  6298. return that
  6299. }
  6300. /**
  6301. * The Buffer constructor returns instances of `Uint8Array` that have their
  6302. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6303. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6304. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6305. * returns a single octet.
  6306. *
  6307. * The `Uint8Array` prototype remains unmodified.
  6308. */
  6309. function Buffer (arg, encodingOrOffset, length) {
  6310. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6311. return new Buffer(arg, encodingOrOffset, length)
  6312. }
  6313. // Common case.
  6314. if (typeof arg === 'number') {
  6315. if (typeof encodingOrOffset === 'string') {
  6316. throw new Error(
  6317. 'If encoding is specified then the first argument must be a string'
  6318. )
  6319. }
  6320. return allocUnsafe(this, arg)
  6321. }
  6322. return from(this, arg, encodingOrOffset, length)
  6323. }
  6324. Buffer.poolSize = 8192 // not used by this implementation
  6325. // TODO: Legacy, not needed anymore. Remove in next major version.
  6326. Buffer._augment = function (arr) {
  6327. arr.__proto__ = Buffer.prototype
  6328. return arr
  6329. }
  6330. function from (that, value, encodingOrOffset, length) {
  6331. if (typeof value === 'number') {
  6332. throw new TypeError('"value" argument must not be a number')
  6333. }
  6334. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6335. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6336. }
  6337. if (typeof value === 'string') {
  6338. return fromString(that, value, encodingOrOffset)
  6339. }
  6340. return fromObject(that, value)
  6341. }
  6342. /**
  6343. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6344. * if value is a number.
  6345. * Buffer.from(str[, encoding])
  6346. * Buffer.from(array)
  6347. * Buffer.from(buffer)
  6348. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6349. **/
  6350. Buffer.from = function (value, encodingOrOffset, length) {
  6351. return from(null, value, encodingOrOffset, length)
  6352. }
  6353. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6354. Buffer.prototype.__proto__ = Uint8Array.prototype
  6355. Buffer.__proto__ = Uint8Array
  6356. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6357. Buffer[Symbol.species] === Buffer) {
  6358. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6359. Object.defineProperty(Buffer, Symbol.species, {
  6360. value: null,
  6361. configurable: true
  6362. })
  6363. }
  6364. }
  6365. function assertSize (size) {
  6366. if (typeof size !== 'number') {
  6367. throw new TypeError('"size" argument must be a number')
  6368. } else if (size < 0) {
  6369. throw new RangeError('"size" argument must not be negative')
  6370. }
  6371. }
  6372. function alloc (that, size, fill, encoding) {
  6373. assertSize(size)
  6374. if (size <= 0) {
  6375. return createBuffer(that, size)
  6376. }
  6377. if (fill !== undefined) {
  6378. // Only pay attention to encoding if it's a string. This
  6379. // prevents accidentally sending in a number that would
  6380. // be interpretted as a start offset.
  6381. return typeof encoding === 'string'
  6382. ? createBuffer(that, size).fill(fill, encoding)
  6383. : createBuffer(that, size).fill(fill)
  6384. }
  6385. return createBuffer(that, size)
  6386. }
  6387. /**
  6388. * Creates a new filled Buffer instance.
  6389. * alloc(size[, fill[, encoding]])
  6390. **/
  6391. Buffer.alloc = function (size, fill, encoding) {
  6392. return alloc(null, size, fill, encoding)
  6393. }
  6394. function allocUnsafe (that, size) {
  6395. assertSize(size)
  6396. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6397. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6398. for (var i = 0; i < size; ++i) {
  6399. that[i] = 0
  6400. }
  6401. }
  6402. return that
  6403. }
  6404. /**
  6405. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6406. * */
  6407. Buffer.allocUnsafe = function (size) {
  6408. return allocUnsafe(null, size)
  6409. }
  6410. /**
  6411. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6412. */
  6413. Buffer.allocUnsafeSlow = function (size) {
  6414. return allocUnsafe(null, size)
  6415. }
  6416. function fromString (that, string, encoding) {
  6417. if (typeof encoding !== 'string' || encoding === '') {
  6418. encoding = 'utf8'
  6419. }
  6420. if (!Buffer.isEncoding(encoding)) {
  6421. throw new TypeError('"encoding" must be a valid string encoding')
  6422. }
  6423. var length = byteLength(string, encoding) | 0
  6424. that = createBuffer(that, length)
  6425. var actual = that.write(string, encoding)
  6426. if (actual !== length) {
  6427. // Writing a hex string, for example, that contains invalid characters will
  6428. // cause everything after the first invalid character to be ignored. (e.g.
  6429. // 'abxxcd' will be treated as 'ab')
  6430. that = that.slice(0, actual)
  6431. }
  6432. return that
  6433. }
  6434. function fromArrayLike (that, array) {
  6435. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6436. that = createBuffer(that, length)
  6437. for (var i = 0; i < length; i += 1) {
  6438. that[i] = array[i] & 255
  6439. }
  6440. return that
  6441. }
  6442. function fromArrayBuffer (that, array, byteOffset, length) {
  6443. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6444. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6445. throw new RangeError('\'offset\' is out of bounds')
  6446. }
  6447. if (array.byteLength < byteOffset + (length || 0)) {
  6448. throw new RangeError('\'length\' is out of bounds')
  6449. }
  6450. if (byteOffset === undefined && length === undefined) {
  6451. array = new Uint8Array(array)
  6452. } else if (length === undefined) {
  6453. array = new Uint8Array(array, byteOffset)
  6454. } else {
  6455. array = new Uint8Array(array, byteOffset, length)
  6456. }
  6457. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6458. // Return an augmented `Uint8Array` instance, for best performance
  6459. that = array
  6460. that.__proto__ = Buffer.prototype
  6461. } else {
  6462. // Fallback: Return an object instance of the Buffer class
  6463. that = fromArrayLike(that, array)
  6464. }
  6465. return that
  6466. }
  6467. function fromObject (that, obj) {
  6468. if (Buffer.isBuffer(obj)) {
  6469. var len = checked(obj.length) | 0
  6470. that = createBuffer(that, len)
  6471. if (that.length === 0) {
  6472. return that
  6473. }
  6474. obj.copy(that, 0, 0, len)
  6475. return that
  6476. }
  6477. if (obj) {
  6478. if ((typeof ArrayBuffer !== 'undefined' &&
  6479. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6480. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6481. return createBuffer(that, 0)
  6482. }
  6483. return fromArrayLike(that, obj)
  6484. }
  6485. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6486. return fromArrayLike(that, obj.data)
  6487. }
  6488. }
  6489. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6490. }
  6491. function checked (length) {
  6492. // Note: cannot use `length < kMaxLength()` here because that fails when
  6493. // length is NaN (which is otherwise coerced to zero.)
  6494. if (length >= kMaxLength()) {
  6495. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6496. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6497. }
  6498. return length | 0
  6499. }
  6500. function SlowBuffer (length) {
  6501. if (+length != length) { // eslint-disable-line eqeqeq
  6502. length = 0
  6503. }
  6504. return Buffer.alloc(+length)
  6505. }
  6506. Buffer.isBuffer = function isBuffer (b) {
  6507. return !!(b != null && b._isBuffer)
  6508. }
  6509. Buffer.compare = function compare (a, b) {
  6510. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6511. throw new TypeError('Arguments must be Buffers')
  6512. }
  6513. if (a === b) return 0
  6514. var x = a.length
  6515. var y = b.length
  6516. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6517. if (a[i] !== b[i]) {
  6518. x = a[i]
  6519. y = b[i]
  6520. break
  6521. }
  6522. }
  6523. if (x < y) return -1
  6524. if (y < x) return 1
  6525. return 0
  6526. }
  6527. Buffer.isEncoding = function isEncoding (encoding) {
  6528. switch (String(encoding).toLowerCase()) {
  6529. case 'hex':
  6530. case 'utf8':
  6531. case 'utf-8':
  6532. case 'ascii':
  6533. case 'latin1':
  6534. case 'binary':
  6535. case 'base64':
  6536. case 'ucs2':
  6537. case 'ucs-2':
  6538. case 'utf16le':
  6539. case 'utf-16le':
  6540. return true
  6541. default:
  6542. return false
  6543. }
  6544. }
  6545. Buffer.concat = function concat (list, length) {
  6546. if (!isArray(list)) {
  6547. throw new TypeError('"list" argument must be an Array of Buffers')
  6548. }
  6549. if (list.length === 0) {
  6550. return Buffer.alloc(0)
  6551. }
  6552. var i
  6553. if (length === undefined) {
  6554. length = 0
  6555. for (i = 0; i < list.length; ++i) {
  6556. length += list[i].length
  6557. }
  6558. }
  6559. var buffer = Buffer.allocUnsafe(length)
  6560. var pos = 0
  6561. for (i = 0; i < list.length; ++i) {
  6562. var buf = list[i]
  6563. if (!Buffer.isBuffer(buf)) {
  6564. throw new TypeError('"list" argument must be an Array of Buffers')
  6565. }
  6566. buf.copy(buffer, pos)
  6567. pos += buf.length
  6568. }
  6569. return buffer
  6570. }
  6571. function byteLength (string, encoding) {
  6572. if (Buffer.isBuffer(string)) {
  6573. return string.length
  6574. }
  6575. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6576. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6577. return string.byteLength
  6578. }
  6579. if (typeof string !== 'string') {
  6580. string = '' + string
  6581. }
  6582. var len = string.length
  6583. if (len === 0) return 0
  6584. // Use a for loop to avoid recursion
  6585. var loweredCase = false
  6586. for (;;) {
  6587. switch (encoding) {
  6588. case 'ascii':
  6589. case 'latin1':
  6590. case 'binary':
  6591. return len
  6592. case 'utf8':
  6593. case 'utf-8':
  6594. case undefined:
  6595. return utf8ToBytes(string).length
  6596. case 'ucs2':
  6597. case 'ucs-2':
  6598. case 'utf16le':
  6599. case 'utf-16le':
  6600. return len * 2
  6601. case 'hex':
  6602. return len >>> 1
  6603. case 'base64':
  6604. return base64ToBytes(string).length
  6605. default:
  6606. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6607. encoding = ('' + encoding).toLowerCase()
  6608. loweredCase = true
  6609. }
  6610. }
  6611. }
  6612. Buffer.byteLength = byteLength
  6613. function slowToString (encoding, start, end) {
  6614. var loweredCase = false
  6615. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6616. // property of a typed array.
  6617. // This behaves neither like String nor Uint8Array in that we set start/end
  6618. // to their upper/lower bounds if the value passed is out of range.
  6619. // undefined is handled specially as per ECMA-262 6th Edition,
  6620. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6621. if (start === undefined || start < 0) {
  6622. start = 0
  6623. }
  6624. // Return early if start > this.length. Done here to prevent potential uint32
  6625. // coercion fail below.
  6626. if (start > this.length) {
  6627. return ''
  6628. }
  6629. if (end === undefined || end > this.length) {
  6630. end = this.length
  6631. }
  6632. if (end <= 0) {
  6633. return ''
  6634. }
  6635. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6636. end >>>= 0
  6637. start >>>= 0
  6638. if (end <= start) {
  6639. return ''
  6640. }
  6641. if (!encoding) encoding = 'utf8'
  6642. while (true) {
  6643. switch (encoding) {
  6644. case 'hex':
  6645. return hexSlice(this, start, end)
  6646. case 'utf8':
  6647. case 'utf-8':
  6648. return utf8Slice(this, start, end)
  6649. case 'ascii':
  6650. return asciiSlice(this, start, end)
  6651. case 'latin1':
  6652. case 'binary':
  6653. return latin1Slice(this, start, end)
  6654. case 'base64':
  6655. return base64Slice(this, start, end)
  6656. case 'ucs2':
  6657. case 'ucs-2':
  6658. case 'utf16le':
  6659. case 'utf-16le':
  6660. return utf16leSlice(this, start, end)
  6661. default:
  6662. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6663. encoding = (encoding + '').toLowerCase()
  6664. loweredCase = true
  6665. }
  6666. }
  6667. }
  6668. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6669. // Buffer instances.
  6670. Buffer.prototype._isBuffer = true
  6671. function swap (b, n, m) {
  6672. var i = b[n]
  6673. b[n] = b[m]
  6674. b[m] = i
  6675. }
  6676. Buffer.prototype.swap16 = function swap16 () {
  6677. var len = this.length
  6678. if (len % 2 !== 0) {
  6679. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6680. }
  6681. for (var i = 0; i < len; i += 2) {
  6682. swap(this, i, i + 1)
  6683. }
  6684. return this
  6685. }
  6686. Buffer.prototype.swap32 = function swap32 () {
  6687. var len = this.length
  6688. if (len % 4 !== 0) {
  6689. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6690. }
  6691. for (var i = 0; i < len; i += 4) {
  6692. swap(this, i, i + 3)
  6693. swap(this, i + 1, i + 2)
  6694. }
  6695. return this
  6696. }
  6697. Buffer.prototype.swap64 = function swap64 () {
  6698. var len = this.length
  6699. if (len % 8 !== 0) {
  6700. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6701. }
  6702. for (var i = 0; i < len; i += 8) {
  6703. swap(this, i, i + 7)
  6704. swap(this, i + 1, i + 6)
  6705. swap(this, i + 2, i + 5)
  6706. swap(this, i + 3, i + 4)
  6707. }
  6708. return this
  6709. }
  6710. Buffer.prototype.toString = function toString () {
  6711. var length = this.length | 0
  6712. if (length === 0) return ''
  6713. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6714. return slowToString.apply(this, arguments)
  6715. }
  6716. Buffer.prototype.equals = function equals (b) {
  6717. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6718. if (this === b) return true
  6719. return Buffer.compare(this, b) === 0
  6720. }
  6721. Buffer.prototype.inspect = function inspect () {
  6722. var str = ''
  6723. var max = exports.INSPECT_MAX_BYTES
  6724. if (this.length > 0) {
  6725. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6726. if (this.length > max) str += ' ... '
  6727. }
  6728. return '<Buffer ' + str + '>'
  6729. }
  6730. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6731. if (!Buffer.isBuffer(target)) {
  6732. throw new TypeError('Argument must be a Buffer')
  6733. }
  6734. if (start === undefined) {
  6735. start = 0
  6736. }
  6737. if (end === undefined) {
  6738. end = target ? target.length : 0
  6739. }
  6740. if (thisStart === undefined) {
  6741. thisStart = 0
  6742. }
  6743. if (thisEnd === undefined) {
  6744. thisEnd = this.length
  6745. }
  6746. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6747. throw new RangeError('out of range index')
  6748. }
  6749. if (thisStart >= thisEnd && start >= end) {
  6750. return 0
  6751. }
  6752. if (thisStart >= thisEnd) {
  6753. return -1
  6754. }
  6755. if (start >= end) {
  6756. return 1
  6757. }
  6758. start >>>= 0
  6759. end >>>= 0
  6760. thisStart >>>= 0
  6761. thisEnd >>>= 0
  6762. if (this === target) return 0
  6763. var x = thisEnd - thisStart
  6764. var y = end - start
  6765. var len = Math.min(x, y)
  6766. var thisCopy = this.slice(thisStart, thisEnd)
  6767. var targetCopy = target.slice(start, end)
  6768. for (var i = 0; i < len; ++i) {
  6769. if (thisCopy[i] !== targetCopy[i]) {
  6770. x = thisCopy[i]
  6771. y = targetCopy[i]
  6772. break
  6773. }
  6774. }
  6775. if (x < y) return -1
  6776. if (y < x) return 1
  6777. return 0
  6778. }
  6779. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6780. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6781. //
  6782. // Arguments:
  6783. // - buffer - a Buffer to search
  6784. // - val - a string, Buffer, or number
  6785. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6786. // - encoding - an optional encoding, relevant is val is a string
  6787. // - dir - true for indexOf, false for lastIndexOf
  6788. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6789. // Empty buffer means no match
  6790. if (buffer.length === 0) return -1
  6791. // Normalize byteOffset
  6792. if (typeof byteOffset === 'string') {
  6793. encoding = byteOffset
  6794. byteOffset = 0
  6795. } else if (byteOffset > 0x7fffffff) {
  6796. byteOffset = 0x7fffffff
  6797. } else if (byteOffset < -0x80000000) {
  6798. byteOffset = -0x80000000
  6799. }
  6800. byteOffset = +byteOffset // Coerce to Number.
  6801. if (isNaN(byteOffset)) {
  6802. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6803. byteOffset = dir ? 0 : (buffer.length - 1)
  6804. }
  6805. // Normalize byteOffset: negative offsets start from the end of the buffer
  6806. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6807. if (byteOffset >= buffer.length) {
  6808. if (dir) return -1
  6809. else byteOffset = buffer.length - 1
  6810. } else if (byteOffset < 0) {
  6811. if (dir) byteOffset = 0
  6812. else return -1
  6813. }
  6814. // Normalize val
  6815. if (typeof val === 'string') {
  6816. val = Buffer.from(val, encoding)
  6817. }
  6818. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6819. if (Buffer.isBuffer(val)) {
  6820. // Special case: looking for empty string/buffer always fails
  6821. if (val.length === 0) {
  6822. return -1
  6823. }
  6824. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6825. } else if (typeof val === 'number') {
  6826. val = val & 0xFF // Search for a byte value [0-255]
  6827. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6828. typeof Uint8Array.prototype.indexOf === 'function') {
  6829. if (dir) {
  6830. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6831. } else {
  6832. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6833. }
  6834. }
  6835. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6836. }
  6837. throw new TypeError('val must be string, number or Buffer')
  6838. }
  6839. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6840. var indexSize = 1
  6841. var arrLength = arr.length
  6842. var valLength = val.length
  6843. if (encoding !== undefined) {
  6844. encoding = String(encoding).toLowerCase()
  6845. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6846. encoding === 'utf16le' || encoding === 'utf-16le') {
  6847. if (arr.length < 2 || val.length < 2) {
  6848. return -1
  6849. }
  6850. indexSize = 2
  6851. arrLength /= 2
  6852. valLength /= 2
  6853. byteOffset /= 2
  6854. }
  6855. }
  6856. function read (buf, i) {
  6857. if (indexSize === 1) {
  6858. return buf[i]
  6859. } else {
  6860. return buf.readUInt16BE(i * indexSize)
  6861. }
  6862. }
  6863. var i
  6864. if (dir) {
  6865. var foundIndex = -1
  6866. for (i = byteOffset; i < arrLength; i++) {
  6867. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6868. if (foundIndex === -1) foundIndex = i
  6869. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6870. } else {
  6871. if (foundIndex !== -1) i -= i - foundIndex
  6872. foundIndex = -1
  6873. }
  6874. }
  6875. } else {
  6876. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6877. for (i = byteOffset; i >= 0; i--) {
  6878. var found = true
  6879. for (var j = 0; j < valLength; j++) {
  6880. if (read(arr, i + j) !== read(val, j)) {
  6881. found = false
  6882. break
  6883. }
  6884. }
  6885. if (found) return i
  6886. }
  6887. }
  6888. return -1
  6889. }
  6890. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6891. return this.indexOf(val, byteOffset, encoding) !== -1
  6892. }
  6893. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6894. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6895. }
  6896. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6897. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6898. }
  6899. function hexWrite (buf, string, offset, length) {
  6900. offset = Number(offset) || 0
  6901. var remaining = buf.length - offset
  6902. if (!length) {
  6903. length = remaining
  6904. } else {
  6905. length = Number(length)
  6906. if (length > remaining) {
  6907. length = remaining
  6908. }
  6909. }
  6910. // must be an even number of digits
  6911. var strLen = string.length
  6912. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6913. if (length > strLen / 2) {
  6914. length = strLen / 2
  6915. }
  6916. for (var i = 0; i < length; ++i) {
  6917. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6918. if (isNaN(parsed)) return i
  6919. buf[offset + i] = parsed
  6920. }
  6921. return i
  6922. }
  6923. function utf8Write (buf, string, offset, length) {
  6924. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6925. }
  6926. function asciiWrite (buf, string, offset, length) {
  6927. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6928. }
  6929. function latin1Write (buf, string, offset, length) {
  6930. return asciiWrite(buf, string, offset, length)
  6931. }
  6932. function base64Write (buf, string, offset, length) {
  6933. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6934. }
  6935. function ucs2Write (buf, string, offset, length) {
  6936. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6937. }
  6938. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6939. // Buffer#write(string)
  6940. if (offset === undefined) {
  6941. encoding = 'utf8'
  6942. length = this.length
  6943. offset = 0
  6944. // Buffer#write(string, encoding)
  6945. } else if (length === undefined && typeof offset === 'string') {
  6946. encoding = offset
  6947. length = this.length
  6948. offset = 0
  6949. // Buffer#write(string, offset[, length][, encoding])
  6950. } else if (isFinite(offset)) {
  6951. offset = offset | 0
  6952. if (isFinite(length)) {
  6953. length = length | 0
  6954. if (encoding === undefined) encoding = 'utf8'
  6955. } else {
  6956. encoding = length
  6957. length = undefined
  6958. }
  6959. // legacy write(string, encoding, offset, length) - remove in v0.13
  6960. } else {
  6961. throw new Error(
  6962. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6963. )
  6964. }
  6965. var remaining = this.length - offset
  6966. if (length === undefined || length > remaining) length = remaining
  6967. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6968. throw new RangeError('Attempt to write outside buffer bounds')
  6969. }
  6970. if (!encoding) encoding = 'utf8'
  6971. var loweredCase = false
  6972. for (;;) {
  6973. switch (encoding) {
  6974. case 'hex':
  6975. return hexWrite(this, string, offset, length)
  6976. case 'utf8':
  6977. case 'utf-8':
  6978. return utf8Write(this, string, offset, length)
  6979. case 'ascii':
  6980. return asciiWrite(this, string, offset, length)
  6981. case 'latin1':
  6982. case 'binary':
  6983. return latin1Write(this, string, offset, length)
  6984. case 'base64':
  6985. // Warning: maxLength not taken into account in base64Write
  6986. return base64Write(this, string, offset, length)
  6987. case 'ucs2':
  6988. case 'ucs-2':
  6989. case 'utf16le':
  6990. case 'utf-16le':
  6991. return ucs2Write(this, string, offset, length)
  6992. default:
  6993. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6994. encoding = ('' + encoding).toLowerCase()
  6995. loweredCase = true
  6996. }
  6997. }
  6998. }
  6999. Buffer.prototype.toJSON = function toJSON () {
  7000. return {
  7001. type: 'Buffer',
  7002. data: Array.prototype.slice.call(this._arr || this, 0)
  7003. }
  7004. }
  7005. function base64Slice (buf, start, end) {
  7006. if (start === 0 && end === buf.length) {
  7007. return base64.fromByteArray(buf)
  7008. } else {
  7009. return base64.fromByteArray(buf.slice(start, end))
  7010. }
  7011. }
  7012. function utf8Slice (buf, start, end) {
  7013. end = Math.min(buf.length, end)
  7014. var res = []
  7015. var i = start
  7016. while (i < end) {
  7017. var firstByte = buf[i]
  7018. var codePoint = null
  7019. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7020. : (firstByte > 0xDF) ? 3
  7021. : (firstByte > 0xBF) ? 2
  7022. : 1
  7023. if (i + bytesPerSequence <= end) {
  7024. var secondByte, thirdByte, fourthByte, tempCodePoint
  7025. switch (bytesPerSequence) {
  7026. case 1:
  7027. if (firstByte < 0x80) {
  7028. codePoint = firstByte
  7029. }
  7030. break
  7031. case 2:
  7032. secondByte = buf[i + 1]
  7033. if ((secondByte & 0xC0) === 0x80) {
  7034. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7035. if (tempCodePoint > 0x7F) {
  7036. codePoint = tempCodePoint
  7037. }
  7038. }
  7039. break
  7040. case 3:
  7041. secondByte = buf[i + 1]
  7042. thirdByte = buf[i + 2]
  7043. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7044. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7045. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7046. codePoint = tempCodePoint
  7047. }
  7048. }
  7049. break
  7050. case 4:
  7051. secondByte = buf[i + 1]
  7052. thirdByte = buf[i + 2]
  7053. fourthByte = buf[i + 3]
  7054. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7055. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7056. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7057. codePoint = tempCodePoint
  7058. }
  7059. }
  7060. }
  7061. }
  7062. if (codePoint === null) {
  7063. // we did not generate a valid codePoint so insert a
  7064. // replacement char (U+FFFD) and advance only 1 byte
  7065. codePoint = 0xFFFD
  7066. bytesPerSequence = 1
  7067. } else if (codePoint > 0xFFFF) {
  7068. // encode to utf16 (surrogate pair dance)
  7069. codePoint -= 0x10000
  7070. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7071. codePoint = 0xDC00 | codePoint & 0x3FF
  7072. }
  7073. res.push(codePoint)
  7074. i += bytesPerSequence
  7075. }
  7076. return decodeCodePointsArray(res)
  7077. }
  7078. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7079. // the lowest limit is Chrome, with 0x10000 args.
  7080. // We go 1 magnitude less, for safety
  7081. var MAX_ARGUMENTS_LENGTH = 0x1000
  7082. function decodeCodePointsArray (codePoints) {
  7083. var len = codePoints.length
  7084. if (len <= MAX_ARGUMENTS_LENGTH) {
  7085. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7086. }
  7087. // Decode in chunks to avoid "call stack size exceeded".
  7088. var res = ''
  7089. var i = 0
  7090. while (i < len) {
  7091. res += String.fromCharCode.apply(
  7092. String,
  7093. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7094. )
  7095. }
  7096. return res
  7097. }
  7098. function asciiSlice (buf, start, end) {
  7099. var ret = ''
  7100. end = Math.min(buf.length, end)
  7101. for (var i = start; i < end; ++i) {
  7102. ret += String.fromCharCode(buf[i] & 0x7F)
  7103. }
  7104. return ret
  7105. }
  7106. function latin1Slice (buf, start, end) {
  7107. var ret = ''
  7108. end = Math.min(buf.length, end)
  7109. for (var i = start; i < end; ++i) {
  7110. ret += String.fromCharCode(buf[i])
  7111. }
  7112. return ret
  7113. }
  7114. function hexSlice (buf, start, end) {
  7115. var len = buf.length
  7116. if (!start || start < 0) start = 0
  7117. if (!end || end < 0 || end > len) end = len
  7118. var out = ''
  7119. for (var i = start; i < end; ++i) {
  7120. out += toHex(buf[i])
  7121. }
  7122. return out
  7123. }
  7124. function utf16leSlice (buf, start, end) {
  7125. var bytes = buf.slice(start, end)
  7126. var res = ''
  7127. for (var i = 0; i < bytes.length; i += 2) {
  7128. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7129. }
  7130. return res
  7131. }
  7132. Buffer.prototype.slice = function slice (start, end) {
  7133. var len = this.length
  7134. start = ~~start
  7135. end = end === undefined ? len : ~~end
  7136. if (start < 0) {
  7137. start += len
  7138. if (start < 0) start = 0
  7139. } else if (start > len) {
  7140. start = len
  7141. }
  7142. if (end < 0) {
  7143. end += len
  7144. if (end < 0) end = 0
  7145. } else if (end > len) {
  7146. end = len
  7147. }
  7148. if (end < start) end = start
  7149. var newBuf
  7150. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7151. newBuf = this.subarray(start, end)
  7152. newBuf.__proto__ = Buffer.prototype
  7153. } else {
  7154. var sliceLen = end - start
  7155. newBuf = new Buffer(sliceLen, undefined)
  7156. for (var i = 0; i < sliceLen; ++i) {
  7157. newBuf[i] = this[i + start]
  7158. }
  7159. }
  7160. return newBuf
  7161. }
  7162. /*
  7163. * Need to make sure that buffer isn't trying to write out of bounds.
  7164. */
  7165. function checkOffset (offset, ext, length) {
  7166. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7167. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7168. }
  7169. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7170. offset = offset | 0
  7171. byteLength = byteLength | 0
  7172. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7173. var val = this[offset]
  7174. var mul = 1
  7175. var i = 0
  7176. while (++i < byteLength && (mul *= 0x100)) {
  7177. val += this[offset + i] * mul
  7178. }
  7179. return val
  7180. }
  7181. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7182. offset = offset | 0
  7183. byteLength = byteLength | 0
  7184. if (!noAssert) {
  7185. checkOffset(offset, byteLength, this.length)
  7186. }
  7187. var val = this[offset + --byteLength]
  7188. var mul = 1
  7189. while (byteLength > 0 && (mul *= 0x100)) {
  7190. val += this[offset + --byteLength] * mul
  7191. }
  7192. return val
  7193. }
  7194. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7195. if (!noAssert) checkOffset(offset, 1, this.length)
  7196. return this[offset]
  7197. }
  7198. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7199. if (!noAssert) checkOffset(offset, 2, this.length)
  7200. return this[offset] | (this[offset + 1] << 8)
  7201. }
  7202. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7203. if (!noAssert) checkOffset(offset, 2, this.length)
  7204. return (this[offset] << 8) | this[offset + 1]
  7205. }
  7206. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7207. if (!noAssert) checkOffset(offset, 4, this.length)
  7208. return ((this[offset]) |
  7209. (this[offset + 1] << 8) |
  7210. (this[offset + 2] << 16)) +
  7211. (this[offset + 3] * 0x1000000)
  7212. }
  7213. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7214. if (!noAssert) checkOffset(offset, 4, this.length)
  7215. return (this[offset] * 0x1000000) +
  7216. ((this[offset + 1] << 16) |
  7217. (this[offset + 2] << 8) |
  7218. this[offset + 3])
  7219. }
  7220. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7221. offset = offset | 0
  7222. byteLength = byteLength | 0
  7223. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7224. var val = this[offset]
  7225. var mul = 1
  7226. var i = 0
  7227. while (++i < byteLength && (mul *= 0x100)) {
  7228. val += this[offset + i] * mul
  7229. }
  7230. mul *= 0x80
  7231. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7232. return val
  7233. }
  7234. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7235. offset = offset | 0
  7236. byteLength = byteLength | 0
  7237. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7238. var i = byteLength
  7239. var mul = 1
  7240. var val = this[offset + --i]
  7241. while (i > 0 && (mul *= 0x100)) {
  7242. val += this[offset + --i] * mul
  7243. }
  7244. mul *= 0x80
  7245. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7246. return val
  7247. }
  7248. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7249. if (!noAssert) checkOffset(offset, 1, this.length)
  7250. if (!(this[offset] & 0x80)) return (this[offset])
  7251. return ((0xff - this[offset] + 1) * -1)
  7252. }
  7253. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7254. if (!noAssert) checkOffset(offset, 2, this.length)
  7255. var val = this[offset] | (this[offset + 1] << 8)
  7256. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7257. }
  7258. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7259. if (!noAssert) checkOffset(offset, 2, this.length)
  7260. var val = this[offset + 1] | (this[offset] << 8)
  7261. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7262. }
  7263. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7264. if (!noAssert) checkOffset(offset, 4, this.length)
  7265. return (this[offset]) |
  7266. (this[offset + 1] << 8) |
  7267. (this[offset + 2] << 16) |
  7268. (this[offset + 3] << 24)
  7269. }
  7270. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7271. if (!noAssert) checkOffset(offset, 4, this.length)
  7272. return (this[offset] << 24) |
  7273. (this[offset + 1] << 16) |
  7274. (this[offset + 2] << 8) |
  7275. (this[offset + 3])
  7276. }
  7277. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7278. if (!noAssert) checkOffset(offset, 4, this.length)
  7279. return ieee754.read(this, offset, true, 23, 4)
  7280. }
  7281. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7282. if (!noAssert) checkOffset(offset, 4, this.length)
  7283. return ieee754.read(this, offset, false, 23, 4)
  7284. }
  7285. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7286. if (!noAssert) checkOffset(offset, 8, this.length)
  7287. return ieee754.read(this, offset, true, 52, 8)
  7288. }
  7289. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7290. if (!noAssert) checkOffset(offset, 8, this.length)
  7291. return ieee754.read(this, offset, false, 52, 8)
  7292. }
  7293. function checkInt (buf, value, offset, ext, max, min) {
  7294. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7295. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7296. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7297. }
  7298. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7299. value = +value
  7300. offset = offset | 0
  7301. byteLength = byteLength | 0
  7302. if (!noAssert) {
  7303. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7304. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7305. }
  7306. var mul = 1
  7307. var i = 0
  7308. this[offset] = value & 0xFF
  7309. while (++i < byteLength && (mul *= 0x100)) {
  7310. this[offset + i] = (value / mul) & 0xFF
  7311. }
  7312. return offset + byteLength
  7313. }
  7314. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7315. value = +value
  7316. offset = offset | 0
  7317. byteLength = byteLength | 0
  7318. if (!noAssert) {
  7319. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7320. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7321. }
  7322. var i = byteLength - 1
  7323. var mul = 1
  7324. this[offset + i] = value & 0xFF
  7325. while (--i >= 0 && (mul *= 0x100)) {
  7326. this[offset + i] = (value / mul) & 0xFF
  7327. }
  7328. return offset + byteLength
  7329. }
  7330. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7331. value = +value
  7332. offset = offset | 0
  7333. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7334. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7335. this[offset] = (value & 0xff)
  7336. return offset + 1
  7337. }
  7338. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7339. if (value < 0) value = 0xffff + value + 1
  7340. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7341. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7342. (littleEndian ? i : 1 - i) * 8
  7343. }
  7344. }
  7345. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7346. value = +value
  7347. offset = offset | 0
  7348. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7349. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7350. this[offset] = (value & 0xff)
  7351. this[offset + 1] = (value >>> 8)
  7352. } else {
  7353. objectWriteUInt16(this, value, offset, true)
  7354. }
  7355. return offset + 2
  7356. }
  7357. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7358. value = +value
  7359. offset = offset | 0
  7360. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7361. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7362. this[offset] = (value >>> 8)
  7363. this[offset + 1] = (value & 0xff)
  7364. } else {
  7365. objectWriteUInt16(this, value, offset, false)
  7366. }
  7367. return offset + 2
  7368. }
  7369. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7370. if (value < 0) value = 0xffffffff + value + 1
  7371. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7372. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7373. }
  7374. }
  7375. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7376. value = +value
  7377. offset = offset | 0
  7378. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7379. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7380. this[offset + 3] = (value >>> 24)
  7381. this[offset + 2] = (value >>> 16)
  7382. this[offset + 1] = (value >>> 8)
  7383. this[offset] = (value & 0xff)
  7384. } else {
  7385. objectWriteUInt32(this, value, offset, true)
  7386. }
  7387. return offset + 4
  7388. }
  7389. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7390. value = +value
  7391. offset = offset | 0
  7392. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7393. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7394. this[offset] = (value >>> 24)
  7395. this[offset + 1] = (value >>> 16)
  7396. this[offset + 2] = (value >>> 8)
  7397. this[offset + 3] = (value & 0xff)
  7398. } else {
  7399. objectWriteUInt32(this, value, offset, false)
  7400. }
  7401. return offset + 4
  7402. }
  7403. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7404. value = +value
  7405. offset = offset | 0
  7406. if (!noAssert) {
  7407. var limit = Math.pow(2, 8 * byteLength - 1)
  7408. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7409. }
  7410. var i = 0
  7411. var mul = 1
  7412. var sub = 0
  7413. this[offset] = value & 0xFF
  7414. while (++i < byteLength && (mul *= 0x100)) {
  7415. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7416. sub = 1
  7417. }
  7418. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7419. }
  7420. return offset + byteLength
  7421. }
  7422. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7423. value = +value
  7424. offset = offset | 0
  7425. if (!noAssert) {
  7426. var limit = Math.pow(2, 8 * byteLength - 1)
  7427. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7428. }
  7429. var i = byteLength - 1
  7430. var mul = 1
  7431. var sub = 0
  7432. this[offset + i] = value & 0xFF
  7433. while (--i >= 0 && (mul *= 0x100)) {
  7434. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7435. sub = 1
  7436. }
  7437. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7438. }
  7439. return offset + byteLength
  7440. }
  7441. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7442. value = +value
  7443. offset = offset | 0
  7444. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7445. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7446. if (value < 0) value = 0xff + value + 1
  7447. this[offset] = (value & 0xff)
  7448. return offset + 1
  7449. }
  7450. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7451. value = +value
  7452. offset = offset | 0
  7453. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7454. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7455. this[offset] = (value & 0xff)
  7456. this[offset + 1] = (value >>> 8)
  7457. } else {
  7458. objectWriteUInt16(this, value, offset, true)
  7459. }
  7460. return offset + 2
  7461. }
  7462. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7463. value = +value
  7464. offset = offset | 0
  7465. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7466. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7467. this[offset] = (value >>> 8)
  7468. this[offset + 1] = (value & 0xff)
  7469. } else {
  7470. objectWriteUInt16(this, value, offset, false)
  7471. }
  7472. return offset + 2
  7473. }
  7474. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7475. value = +value
  7476. offset = offset | 0
  7477. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7478. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7479. this[offset] = (value & 0xff)
  7480. this[offset + 1] = (value >>> 8)
  7481. this[offset + 2] = (value >>> 16)
  7482. this[offset + 3] = (value >>> 24)
  7483. } else {
  7484. objectWriteUInt32(this, value, offset, true)
  7485. }
  7486. return offset + 4
  7487. }
  7488. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7489. value = +value
  7490. offset = offset | 0
  7491. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7492. if (value < 0) value = 0xffffffff + value + 1
  7493. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7494. this[offset] = (value >>> 24)
  7495. this[offset + 1] = (value >>> 16)
  7496. this[offset + 2] = (value >>> 8)
  7497. this[offset + 3] = (value & 0xff)
  7498. } else {
  7499. objectWriteUInt32(this, value, offset, false)
  7500. }
  7501. return offset + 4
  7502. }
  7503. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7504. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7505. if (offset < 0) throw new RangeError('Index out of range')
  7506. }
  7507. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7508. if (!noAssert) {
  7509. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7510. }
  7511. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7512. return offset + 4
  7513. }
  7514. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7515. return writeFloat(this, value, offset, true, noAssert)
  7516. }
  7517. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7518. return writeFloat(this, value, offset, false, noAssert)
  7519. }
  7520. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7521. if (!noAssert) {
  7522. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7523. }
  7524. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7525. return offset + 8
  7526. }
  7527. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7528. return writeDouble(this, value, offset, true, noAssert)
  7529. }
  7530. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7531. return writeDouble(this, value, offset, false, noAssert)
  7532. }
  7533. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7534. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7535. if (!start) start = 0
  7536. if (!end && end !== 0) end = this.length
  7537. if (targetStart >= target.length) targetStart = target.length
  7538. if (!targetStart) targetStart = 0
  7539. if (end > 0 && end < start) end = start
  7540. // Copy 0 bytes; we're done
  7541. if (end === start) return 0
  7542. if (target.length === 0 || this.length === 0) return 0
  7543. // Fatal error conditions
  7544. if (targetStart < 0) {
  7545. throw new RangeError('targetStart out of bounds')
  7546. }
  7547. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7548. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7549. // Are we oob?
  7550. if (end > this.length) end = this.length
  7551. if (target.length - targetStart < end - start) {
  7552. end = target.length - targetStart + start
  7553. }
  7554. var len = end - start
  7555. var i
  7556. if (this === target && start < targetStart && targetStart < end) {
  7557. // descending copy from end
  7558. for (i = len - 1; i >= 0; --i) {
  7559. target[i + targetStart] = this[i + start]
  7560. }
  7561. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7562. // ascending copy from start
  7563. for (i = 0; i < len; ++i) {
  7564. target[i + targetStart] = this[i + start]
  7565. }
  7566. } else {
  7567. Uint8Array.prototype.set.call(
  7568. target,
  7569. this.subarray(start, start + len),
  7570. targetStart
  7571. )
  7572. }
  7573. return len
  7574. }
  7575. // Usage:
  7576. // buffer.fill(number[, offset[, end]])
  7577. // buffer.fill(buffer[, offset[, end]])
  7578. // buffer.fill(string[, offset[, end]][, encoding])
  7579. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7580. // Handle string cases:
  7581. if (typeof val === 'string') {
  7582. if (typeof start === 'string') {
  7583. encoding = start
  7584. start = 0
  7585. end = this.length
  7586. } else if (typeof end === 'string') {
  7587. encoding = end
  7588. end = this.length
  7589. }
  7590. if (val.length === 1) {
  7591. var code = val.charCodeAt(0)
  7592. if (code < 256) {
  7593. val = code
  7594. }
  7595. }
  7596. if (encoding !== undefined && typeof encoding !== 'string') {
  7597. throw new TypeError('encoding must be a string')
  7598. }
  7599. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7600. throw new TypeError('Unknown encoding: ' + encoding)
  7601. }
  7602. } else if (typeof val === 'number') {
  7603. val = val & 255
  7604. }
  7605. // Invalid ranges are not set to a default, so can range check early.
  7606. if (start < 0 || this.length < start || this.length < end) {
  7607. throw new RangeError('Out of range index')
  7608. }
  7609. if (end <= start) {
  7610. return this
  7611. }
  7612. start = start >>> 0
  7613. end = end === undefined ? this.length : end >>> 0
  7614. if (!val) val = 0
  7615. var i
  7616. if (typeof val === 'number') {
  7617. for (i = start; i < end; ++i) {
  7618. this[i] = val
  7619. }
  7620. } else {
  7621. var bytes = Buffer.isBuffer(val)
  7622. ? val
  7623. : utf8ToBytes(new Buffer(val, encoding).toString())
  7624. var len = bytes.length
  7625. for (i = 0; i < end - start; ++i) {
  7626. this[i + start] = bytes[i % len]
  7627. }
  7628. }
  7629. return this
  7630. }
  7631. // HELPER FUNCTIONS
  7632. // ================
  7633. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7634. function base64clean (str) {
  7635. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7636. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7637. // Node converts strings with length < 2 to ''
  7638. if (str.length < 2) return ''
  7639. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7640. while (str.length % 4 !== 0) {
  7641. str = str + '='
  7642. }
  7643. return str
  7644. }
  7645. function stringtrim (str) {
  7646. if (str.trim) return str.trim()
  7647. return str.replace(/^\s+|\s+$/g, '')
  7648. }
  7649. function toHex (n) {
  7650. if (n < 16) return '0' + n.toString(16)
  7651. return n.toString(16)
  7652. }
  7653. function utf8ToBytes (string, units) {
  7654. units = units || Infinity
  7655. var codePoint
  7656. var length = string.length
  7657. var leadSurrogate = null
  7658. var bytes = []
  7659. for (var i = 0; i < length; ++i) {
  7660. codePoint = string.charCodeAt(i)
  7661. // is surrogate component
  7662. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7663. // last char was a lead
  7664. if (!leadSurrogate) {
  7665. // no lead yet
  7666. if (codePoint > 0xDBFF) {
  7667. // unexpected trail
  7668. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7669. continue
  7670. } else if (i + 1 === length) {
  7671. // unpaired lead
  7672. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7673. continue
  7674. }
  7675. // valid lead
  7676. leadSurrogate = codePoint
  7677. continue
  7678. }
  7679. // 2 leads in a row
  7680. if (codePoint < 0xDC00) {
  7681. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7682. leadSurrogate = codePoint
  7683. continue
  7684. }
  7685. // valid surrogate pair
  7686. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7687. } else if (leadSurrogate) {
  7688. // valid bmp char, but last char was a lead
  7689. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7690. }
  7691. leadSurrogate = null
  7692. // encode utf8
  7693. if (codePoint < 0x80) {
  7694. if ((units -= 1) < 0) break
  7695. bytes.push(codePoint)
  7696. } else if (codePoint < 0x800) {
  7697. if ((units -= 2) < 0) break
  7698. bytes.push(
  7699. codePoint >> 0x6 | 0xC0,
  7700. codePoint & 0x3F | 0x80
  7701. )
  7702. } else if (codePoint < 0x10000) {
  7703. if ((units -= 3) < 0) break
  7704. bytes.push(
  7705. codePoint >> 0xC | 0xE0,
  7706. codePoint >> 0x6 & 0x3F | 0x80,
  7707. codePoint & 0x3F | 0x80
  7708. )
  7709. } else if (codePoint < 0x110000) {
  7710. if ((units -= 4) < 0) break
  7711. bytes.push(
  7712. codePoint >> 0x12 | 0xF0,
  7713. codePoint >> 0xC & 0x3F | 0x80,
  7714. codePoint >> 0x6 & 0x3F | 0x80,
  7715. codePoint & 0x3F | 0x80
  7716. )
  7717. } else {
  7718. throw new Error('Invalid code point')
  7719. }
  7720. }
  7721. return bytes
  7722. }
  7723. function asciiToBytes (str) {
  7724. var byteArray = []
  7725. for (var i = 0; i < str.length; ++i) {
  7726. // Node's code seems to be doing this and not & 0x7F..
  7727. byteArray.push(str.charCodeAt(i) & 0xFF)
  7728. }
  7729. return byteArray
  7730. }
  7731. function utf16leToBytes (str, units) {
  7732. var c, hi, lo
  7733. var byteArray = []
  7734. for (var i = 0; i < str.length; ++i) {
  7735. if ((units -= 2) < 0) break
  7736. c = str.charCodeAt(i)
  7737. hi = c >> 8
  7738. lo = c % 256
  7739. byteArray.push(lo)
  7740. byteArray.push(hi)
  7741. }
  7742. return byteArray
  7743. }
  7744. function base64ToBytes (str) {
  7745. return base64.toByteArray(base64clean(str))
  7746. }
  7747. function blitBuffer (src, dst, offset, length) {
  7748. for (var i = 0; i < length; ++i) {
  7749. if ((i + offset >= dst.length) || (i >= src.length)) break
  7750. dst[i + offset] = src[i]
  7751. }
  7752. return i
  7753. }
  7754. function isnan (val) {
  7755. return val !== val // eslint-disable-line no-self-compare
  7756. }
  7757. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7758. /***/ }),
  7759. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7760. /*!**************************************************!*\
  7761. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7762. \**************************************************/
  7763. /*! no static exports found */
  7764. /***/ (function(module, exports, __webpack_require__) {
  7765. /*!
  7766. * clipboard.js v2.0.4
  7767. * https://zenorocha.github.io/clipboard.js
  7768. *
  7769. * Licensed MIT © Zeno Rocha
  7770. */
  7771. (function webpackUniversalModuleDefinition(root, factory) {
  7772. if(true)
  7773. module.exports = factory();
  7774. else {}
  7775. })(this, function() {
  7776. return /******/ (function(modules) { // webpackBootstrap
  7777. /******/ // The module cache
  7778. /******/ var installedModules = {};
  7779. /******/
  7780. /******/ // The require function
  7781. /******/ function __webpack_require__(moduleId) {
  7782. /******/
  7783. /******/ // Check if module is in cache
  7784. /******/ if(installedModules[moduleId]) {
  7785. /******/ return installedModules[moduleId].exports;
  7786. /******/ }
  7787. /******/ // Create a new module (and put it into the cache)
  7788. /******/ var module = installedModules[moduleId] = {
  7789. /******/ i: moduleId,
  7790. /******/ l: false,
  7791. /******/ exports: {}
  7792. /******/ };
  7793. /******/
  7794. /******/ // Execute the module function
  7795. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7796. /******/
  7797. /******/ // Flag the module as loaded
  7798. /******/ module.l = true;
  7799. /******/
  7800. /******/ // Return the exports of the module
  7801. /******/ return module.exports;
  7802. /******/ }
  7803. /******/
  7804. /******/
  7805. /******/ // expose the modules object (__webpack_modules__)
  7806. /******/ __webpack_require__.m = modules;
  7807. /******/
  7808. /******/ // expose the module cache
  7809. /******/ __webpack_require__.c = installedModules;
  7810. /******/
  7811. /******/ // define getter function for harmony exports
  7812. /******/ __webpack_require__.d = function(exports, name, getter) {
  7813. /******/ if(!__webpack_require__.o(exports, name)) {
  7814. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7815. /******/ }
  7816. /******/ };
  7817. /******/
  7818. /******/ // define __esModule on exports
  7819. /******/ __webpack_require__.r = function(exports) {
  7820. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7821. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7822. /******/ }
  7823. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7824. /******/ };
  7825. /******/
  7826. /******/ // create a fake namespace object
  7827. /******/ // mode & 1: value is a module id, require it
  7828. /******/ // mode & 2: merge all properties of value into the ns
  7829. /******/ // mode & 4: return value when already ns object
  7830. /******/ // mode & 8|1: behave like require
  7831. /******/ __webpack_require__.t = function(value, mode) {
  7832. /******/ if(mode & 1) value = __webpack_require__(value);
  7833. /******/ if(mode & 8) return value;
  7834. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7835. /******/ var ns = Object.create(null);
  7836. /******/ __webpack_require__.r(ns);
  7837. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7838. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7839. /******/ return ns;
  7840. /******/ };
  7841. /******/
  7842. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7843. /******/ __webpack_require__.n = function(module) {
  7844. /******/ var getter = module && module.__esModule ?
  7845. /******/ function getDefault() { return module['default']; } :
  7846. /******/ function getModuleExports() { return module; };
  7847. /******/ __webpack_require__.d(getter, 'a', getter);
  7848. /******/ return getter;
  7849. /******/ };
  7850. /******/
  7851. /******/ // Object.prototype.hasOwnProperty.call
  7852. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7853. /******/
  7854. /******/ // __webpack_public_path__
  7855. /******/ __webpack_require__.p = "";
  7856. /******/
  7857. /******/
  7858. /******/ // Load entry module and return exports
  7859. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7860. /******/ })
  7861. /************************************************************************/
  7862. /******/ ([
  7863. /* 0 */
  7864. /***/ (function(module, exports, __webpack_require__) {
  7865. "use strict";
  7866. 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; };
  7867. 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; }; }();
  7868. var _clipboardAction = __webpack_require__(1);
  7869. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7870. var _tinyEmitter = __webpack_require__(3);
  7871. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7872. var _goodListener = __webpack_require__(4);
  7873. var _goodListener2 = _interopRequireDefault(_goodListener);
  7874. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7875. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7876. 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; }
  7877. 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; }
  7878. /**
  7879. * Base class which takes one or more elements, adds event listeners to them,
  7880. * and instantiates a new `ClipboardAction` on each click.
  7881. */
  7882. var Clipboard = function (_Emitter) {
  7883. _inherits(Clipboard, _Emitter);
  7884. /**
  7885. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7886. * @param {Object} options
  7887. */
  7888. function Clipboard(trigger, options) {
  7889. _classCallCheck(this, Clipboard);
  7890. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7891. _this.resolveOptions(options);
  7892. _this.listenClick(trigger);
  7893. return _this;
  7894. }
  7895. /**
  7896. * Defines if attributes would be resolved using internal setter functions
  7897. * or custom functions that were passed in the constructor.
  7898. * @param {Object} options
  7899. */
  7900. _createClass(Clipboard, [{
  7901. key: 'resolveOptions',
  7902. value: function resolveOptions() {
  7903. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7904. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7905. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7906. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7907. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7908. }
  7909. /**
  7910. * Adds a click event listener to the passed trigger.
  7911. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7912. */
  7913. }, {
  7914. key: 'listenClick',
  7915. value: function listenClick(trigger) {
  7916. var _this2 = this;
  7917. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7918. return _this2.onClick(e);
  7919. });
  7920. }
  7921. /**
  7922. * Defines a new `ClipboardAction` on each click event.
  7923. * @param {Event} e
  7924. */
  7925. }, {
  7926. key: 'onClick',
  7927. value: function onClick(e) {
  7928. var trigger = e.delegateTarget || e.currentTarget;
  7929. if (this.clipboardAction) {
  7930. this.clipboardAction = null;
  7931. }
  7932. this.clipboardAction = new _clipboardAction2.default({
  7933. action: this.action(trigger),
  7934. target: this.target(trigger),
  7935. text: this.text(trigger),
  7936. container: this.container,
  7937. trigger: trigger,
  7938. emitter: this
  7939. });
  7940. }
  7941. /**
  7942. * Default `action` lookup function.
  7943. * @param {Element} trigger
  7944. */
  7945. }, {
  7946. key: 'defaultAction',
  7947. value: function defaultAction(trigger) {
  7948. return getAttributeValue('action', trigger);
  7949. }
  7950. /**
  7951. * Default `target` lookup function.
  7952. * @param {Element} trigger
  7953. */
  7954. }, {
  7955. key: 'defaultTarget',
  7956. value: function defaultTarget(trigger) {
  7957. var selector = getAttributeValue('target', trigger);
  7958. if (selector) {
  7959. return document.querySelector(selector);
  7960. }
  7961. }
  7962. /**
  7963. * Returns the support of the given action, or all actions if no action is
  7964. * given.
  7965. * @param {String} [action]
  7966. */
  7967. }, {
  7968. key: 'defaultText',
  7969. /**
  7970. * Default `text` lookup function.
  7971. * @param {Element} trigger
  7972. */
  7973. value: function defaultText(trigger) {
  7974. return getAttributeValue('text', trigger);
  7975. }
  7976. /**
  7977. * Destroy lifecycle.
  7978. */
  7979. }, {
  7980. key: 'destroy',
  7981. value: function destroy() {
  7982. this.listener.destroy();
  7983. if (this.clipboardAction) {
  7984. this.clipboardAction.destroy();
  7985. this.clipboardAction = null;
  7986. }
  7987. }
  7988. }], [{
  7989. key: 'isSupported',
  7990. value: function isSupported() {
  7991. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7992. var actions = typeof action === 'string' ? [action] : action;
  7993. var support = !!document.queryCommandSupported;
  7994. actions.forEach(function (action) {
  7995. support = support && !!document.queryCommandSupported(action);
  7996. });
  7997. return support;
  7998. }
  7999. }]);
  8000. return Clipboard;
  8001. }(_tinyEmitter2.default);
  8002. /**
  8003. * Helper function to retrieve attribute value.
  8004. * @param {String} suffix
  8005. * @param {Element} element
  8006. */
  8007. function getAttributeValue(suffix, element) {
  8008. var attribute = 'data-clipboard-' + suffix;
  8009. if (!element.hasAttribute(attribute)) {
  8010. return;
  8011. }
  8012. return element.getAttribute(attribute);
  8013. }
  8014. module.exports = Clipboard;
  8015. /***/ }),
  8016. /* 1 */
  8017. /***/ (function(module, exports, __webpack_require__) {
  8018. "use strict";
  8019. 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; };
  8020. 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; }; }();
  8021. var _select = __webpack_require__(2);
  8022. var _select2 = _interopRequireDefault(_select);
  8023. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8024. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8025. /**
  8026. * Inner class which performs selection from either `text` or `target`
  8027. * properties and then executes copy or cut operations.
  8028. */
  8029. var ClipboardAction = function () {
  8030. /**
  8031. * @param {Object} options
  8032. */
  8033. function ClipboardAction(options) {
  8034. _classCallCheck(this, ClipboardAction);
  8035. this.resolveOptions(options);
  8036. this.initSelection();
  8037. }
  8038. /**
  8039. * Defines base properties passed from constructor.
  8040. * @param {Object} options
  8041. */
  8042. _createClass(ClipboardAction, [{
  8043. key: 'resolveOptions',
  8044. value: function resolveOptions() {
  8045. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8046. this.action = options.action;
  8047. this.container = options.container;
  8048. this.emitter = options.emitter;
  8049. this.target = options.target;
  8050. this.text = options.text;
  8051. this.trigger = options.trigger;
  8052. this.selectedText = '';
  8053. }
  8054. /**
  8055. * Decides which selection strategy is going to be applied based
  8056. * on the existence of `text` and `target` properties.
  8057. */
  8058. }, {
  8059. key: 'initSelection',
  8060. value: function initSelection() {
  8061. if (this.text) {
  8062. this.selectFake();
  8063. } else if (this.target) {
  8064. this.selectTarget();
  8065. }
  8066. }
  8067. /**
  8068. * Creates a fake textarea element, sets its value from `text` property,
  8069. * and makes a selection on it.
  8070. */
  8071. }, {
  8072. key: 'selectFake',
  8073. value: function selectFake() {
  8074. var _this = this;
  8075. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8076. this.removeFake();
  8077. this.fakeHandlerCallback = function () {
  8078. return _this.removeFake();
  8079. };
  8080. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8081. this.fakeElem = document.createElement('textarea');
  8082. // Prevent zooming on iOS
  8083. this.fakeElem.style.fontSize = '12pt';
  8084. // Reset box model
  8085. this.fakeElem.style.border = '0';
  8086. this.fakeElem.style.padding = '0';
  8087. this.fakeElem.style.margin = '0';
  8088. // Move element out of screen horizontally
  8089. this.fakeElem.style.position = 'absolute';
  8090. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8091. // Move element to the same position vertically
  8092. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8093. this.fakeElem.style.top = yPosition + 'px';
  8094. this.fakeElem.setAttribute('readonly', '');
  8095. this.fakeElem.value = this.text;
  8096. this.container.appendChild(this.fakeElem);
  8097. this.selectedText = (0, _select2.default)(this.fakeElem);
  8098. this.copyText();
  8099. }
  8100. /**
  8101. * Only removes the fake element after another click event, that way
  8102. * a user can hit `Ctrl+C` to copy because selection still exists.
  8103. */
  8104. }, {
  8105. key: 'removeFake',
  8106. value: function removeFake() {
  8107. if (this.fakeHandler) {
  8108. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8109. this.fakeHandler = null;
  8110. this.fakeHandlerCallback = null;
  8111. }
  8112. if (this.fakeElem) {
  8113. this.container.removeChild(this.fakeElem);
  8114. this.fakeElem = null;
  8115. }
  8116. }
  8117. /**
  8118. * Selects the content from element passed on `target` property.
  8119. */
  8120. }, {
  8121. key: 'selectTarget',
  8122. value: function selectTarget() {
  8123. this.selectedText = (0, _select2.default)(this.target);
  8124. this.copyText();
  8125. }
  8126. /**
  8127. * Executes the copy operation based on the current selection.
  8128. */
  8129. }, {
  8130. key: 'copyText',
  8131. value: function copyText() {
  8132. var succeeded = void 0;
  8133. try {
  8134. succeeded = document.execCommand(this.action);
  8135. } catch (err) {
  8136. succeeded = false;
  8137. }
  8138. this.handleResult(succeeded);
  8139. }
  8140. /**
  8141. * Fires an event based on the copy operation result.
  8142. * @param {Boolean} succeeded
  8143. */
  8144. }, {
  8145. key: 'handleResult',
  8146. value: function handleResult(succeeded) {
  8147. this.emitter.emit(succeeded ? 'success' : 'error', {
  8148. action: this.action,
  8149. text: this.selectedText,
  8150. trigger: this.trigger,
  8151. clearSelection: this.clearSelection.bind(this)
  8152. });
  8153. }
  8154. /**
  8155. * Moves focus away from `target` and back to the trigger, removes current selection.
  8156. */
  8157. }, {
  8158. key: 'clearSelection',
  8159. value: function clearSelection() {
  8160. if (this.trigger) {
  8161. this.trigger.focus();
  8162. }
  8163. window.getSelection().removeAllRanges();
  8164. }
  8165. /**
  8166. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8167. * @param {String} action
  8168. */
  8169. }, {
  8170. key: 'destroy',
  8171. /**
  8172. * Destroy lifecycle.
  8173. */
  8174. value: function destroy() {
  8175. this.removeFake();
  8176. }
  8177. }, {
  8178. key: 'action',
  8179. set: function set() {
  8180. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8181. this._action = action;
  8182. if (this._action !== 'copy' && this._action !== 'cut') {
  8183. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8184. }
  8185. }
  8186. /**
  8187. * Gets the `action` property.
  8188. * @return {String}
  8189. */
  8190. ,
  8191. get: function get() {
  8192. return this._action;
  8193. }
  8194. /**
  8195. * Sets the `target` property using an element
  8196. * that will be have its content copied.
  8197. * @param {Element} target
  8198. */
  8199. }, {
  8200. key: 'target',
  8201. set: function set(target) {
  8202. if (target !== undefined) {
  8203. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8204. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8205. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8206. }
  8207. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8208. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8209. }
  8210. this._target = target;
  8211. } else {
  8212. throw new Error('Invalid "target" value, use a valid Element');
  8213. }
  8214. }
  8215. }
  8216. /**
  8217. * Gets the `target` property.
  8218. * @return {String|HTMLElement}
  8219. */
  8220. ,
  8221. get: function get() {
  8222. return this._target;
  8223. }
  8224. }]);
  8225. return ClipboardAction;
  8226. }();
  8227. module.exports = ClipboardAction;
  8228. /***/ }),
  8229. /* 2 */
  8230. /***/ (function(module, exports) {
  8231. function select(element) {
  8232. var selectedText;
  8233. if (element.nodeName === 'SELECT') {
  8234. element.focus();
  8235. selectedText = element.value;
  8236. }
  8237. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8238. var isReadOnly = element.hasAttribute('readonly');
  8239. if (!isReadOnly) {
  8240. element.setAttribute('readonly', '');
  8241. }
  8242. element.select();
  8243. element.setSelectionRange(0, element.value.length);
  8244. if (!isReadOnly) {
  8245. element.removeAttribute('readonly');
  8246. }
  8247. selectedText = element.value;
  8248. }
  8249. else {
  8250. if (element.hasAttribute('contenteditable')) {
  8251. element.focus();
  8252. }
  8253. var selection = window.getSelection();
  8254. var range = document.createRange();
  8255. range.selectNodeContents(element);
  8256. selection.removeAllRanges();
  8257. selection.addRange(range);
  8258. selectedText = selection.toString();
  8259. }
  8260. return selectedText;
  8261. }
  8262. module.exports = select;
  8263. /***/ }),
  8264. /* 3 */
  8265. /***/ (function(module, exports) {
  8266. function E () {
  8267. // Keep this empty so it's easier to inherit from
  8268. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8269. }
  8270. E.prototype = {
  8271. on: function (name, callback, ctx) {
  8272. var e = this.e || (this.e = {});
  8273. (e[name] || (e[name] = [])).push({
  8274. fn: callback,
  8275. ctx: ctx
  8276. });
  8277. return this;
  8278. },
  8279. once: function (name, callback, ctx) {
  8280. var self = this;
  8281. function listener () {
  8282. self.off(name, listener);
  8283. callback.apply(ctx, arguments);
  8284. };
  8285. listener._ = callback
  8286. return this.on(name, listener, ctx);
  8287. },
  8288. emit: function (name) {
  8289. var data = [].slice.call(arguments, 1);
  8290. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8291. var i = 0;
  8292. var len = evtArr.length;
  8293. for (i; i < len; i++) {
  8294. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8295. }
  8296. return this;
  8297. },
  8298. off: function (name, callback) {
  8299. var e = this.e || (this.e = {});
  8300. var evts = e[name];
  8301. var liveEvents = [];
  8302. if (evts && callback) {
  8303. for (var i = 0, len = evts.length; i < len; i++) {
  8304. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8305. liveEvents.push(evts[i]);
  8306. }
  8307. }
  8308. // Remove event from queue to prevent memory leak
  8309. // Suggested by https://github.com/lazd
  8310. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8311. (liveEvents.length)
  8312. ? e[name] = liveEvents
  8313. : delete e[name];
  8314. return this;
  8315. }
  8316. };
  8317. module.exports = E;
  8318. /***/ }),
  8319. /* 4 */
  8320. /***/ (function(module, exports, __webpack_require__) {
  8321. var is = __webpack_require__(5);
  8322. var delegate = __webpack_require__(6);
  8323. /**
  8324. * Validates all params and calls the right
  8325. * listener function based on its target type.
  8326. *
  8327. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8328. * @param {String} type
  8329. * @param {Function} callback
  8330. * @return {Object}
  8331. */
  8332. function listen(target, type, callback) {
  8333. if (!target && !type && !callback) {
  8334. throw new Error('Missing required arguments');
  8335. }
  8336. if (!is.string(type)) {
  8337. throw new TypeError('Second argument must be a String');
  8338. }
  8339. if (!is.fn(callback)) {
  8340. throw new TypeError('Third argument must be a Function');
  8341. }
  8342. if (is.node(target)) {
  8343. return listenNode(target, type, callback);
  8344. }
  8345. else if (is.nodeList(target)) {
  8346. return listenNodeList(target, type, callback);
  8347. }
  8348. else if (is.string(target)) {
  8349. return listenSelector(target, type, callback);
  8350. }
  8351. else {
  8352. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8353. }
  8354. }
  8355. /**
  8356. * Adds an event listener to a HTML element
  8357. * and returns a remove listener function.
  8358. *
  8359. * @param {HTMLElement} node
  8360. * @param {String} type
  8361. * @param {Function} callback
  8362. * @return {Object}
  8363. */
  8364. function listenNode(node, type, callback) {
  8365. node.addEventListener(type, callback);
  8366. return {
  8367. destroy: function() {
  8368. node.removeEventListener(type, callback);
  8369. }
  8370. }
  8371. }
  8372. /**
  8373. * Add an event listener to a list of HTML elements
  8374. * and returns a remove listener function.
  8375. *
  8376. * @param {NodeList|HTMLCollection} nodeList
  8377. * @param {String} type
  8378. * @param {Function} callback
  8379. * @return {Object}
  8380. */
  8381. function listenNodeList(nodeList, type, callback) {
  8382. Array.prototype.forEach.call(nodeList, function(node) {
  8383. node.addEventListener(type, callback);
  8384. });
  8385. return {
  8386. destroy: function() {
  8387. Array.prototype.forEach.call(nodeList, function(node) {
  8388. node.removeEventListener(type, callback);
  8389. });
  8390. }
  8391. }
  8392. }
  8393. /**
  8394. * Add an event listener to a selector
  8395. * and returns a remove listener function.
  8396. *
  8397. * @param {String} selector
  8398. * @param {String} type
  8399. * @param {Function} callback
  8400. * @return {Object}
  8401. */
  8402. function listenSelector(selector, type, callback) {
  8403. return delegate(document.body, selector, type, callback);
  8404. }
  8405. module.exports = listen;
  8406. /***/ }),
  8407. /* 5 */
  8408. /***/ (function(module, exports) {
  8409. /**
  8410. * Check if argument is a HTML element.
  8411. *
  8412. * @param {Object} value
  8413. * @return {Boolean}
  8414. */
  8415. exports.node = function(value) {
  8416. return value !== undefined
  8417. && value instanceof HTMLElement
  8418. && value.nodeType === 1;
  8419. };
  8420. /**
  8421. * Check if argument is a list of HTML elements.
  8422. *
  8423. * @param {Object} value
  8424. * @return {Boolean}
  8425. */
  8426. exports.nodeList = function(value) {
  8427. var type = Object.prototype.toString.call(value);
  8428. return value !== undefined
  8429. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8430. && ('length' in value)
  8431. && (value.length === 0 || exports.node(value[0]));
  8432. };
  8433. /**
  8434. * Check if argument is a string.
  8435. *
  8436. * @param {Object} value
  8437. * @return {Boolean}
  8438. */
  8439. exports.string = function(value) {
  8440. return typeof value === 'string'
  8441. || value instanceof String;
  8442. };
  8443. /**
  8444. * Check if argument is a function.
  8445. *
  8446. * @param {Object} value
  8447. * @return {Boolean}
  8448. */
  8449. exports.fn = function(value) {
  8450. var type = Object.prototype.toString.call(value);
  8451. return type === '[object Function]';
  8452. };
  8453. /***/ }),
  8454. /* 6 */
  8455. /***/ (function(module, exports, __webpack_require__) {
  8456. var closest = __webpack_require__(7);
  8457. /**
  8458. * Delegates event to a selector.
  8459. *
  8460. * @param {Element} element
  8461. * @param {String} selector
  8462. * @param {String} type
  8463. * @param {Function} callback
  8464. * @param {Boolean} useCapture
  8465. * @return {Object}
  8466. */
  8467. function _delegate(element, selector, type, callback, useCapture) {
  8468. var listenerFn = listener.apply(this, arguments);
  8469. element.addEventListener(type, listenerFn, useCapture);
  8470. return {
  8471. destroy: function() {
  8472. element.removeEventListener(type, listenerFn, useCapture);
  8473. }
  8474. }
  8475. }
  8476. /**
  8477. * Delegates event to a selector.
  8478. *
  8479. * @param {Element|String|Array} [elements]
  8480. * @param {String} selector
  8481. * @param {String} type
  8482. * @param {Function} callback
  8483. * @param {Boolean} useCapture
  8484. * @return {Object}
  8485. */
  8486. function delegate(elements, selector, type, callback, useCapture) {
  8487. // Handle the regular Element usage
  8488. if (typeof elements.addEventListener === 'function') {
  8489. return _delegate.apply(null, arguments);
  8490. }
  8491. // Handle Element-less usage, it defaults to global delegation
  8492. if (typeof type === 'function') {
  8493. // Use `document` as the first parameter, then apply arguments
  8494. // This is a short way to .unshift `arguments` without running into deoptimizations
  8495. return _delegate.bind(null, document).apply(null, arguments);
  8496. }
  8497. // Handle Selector-based usage
  8498. if (typeof elements === 'string') {
  8499. elements = document.querySelectorAll(elements);
  8500. }
  8501. // Handle Array-like based usage
  8502. return Array.prototype.map.call(elements, function (element) {
  8503. return _delegate(element, selector, type, callback, useCapture);
  8504. });
  8505. }
  8506. /**
  8507. * Finds closest match and invokes callback.
  8508. *
  8509. * @param {Element} element
  8510. * @param {String} selector
  8511. * @param {String} type
  8512. * @param {Function} callback
  8513. * @return {Function}
  8514. */
  8515. function listener(element, selector, type, callback) {
  8516. return function(e) {
  8517. e.delegateTarget = closest(e.target, selector);
  8518. if (e.delegateTarget) {
  8519. callback.call(element, e);
  8520. }
  8521. }
  8522. }
  8523. module.exports = delegate;
  8524. /***/ }),
  8525. /* 7 */
  8526. /***/ (function(module, exports) {
  8527. var DOCUMENT_NODE_TYPE = 9;
  8528. /**
  8529. * A polyfill for Element.matches()
  8530. */
  8531. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8532. var proto = Element.prototype;
  8533. proto.matches = proto.matchesSelector ||
  8534. proto.mozMatchesSelector ||
  8535. proto.msMatchesSelector ||
  8536. proto.oMatchesSelector ||
  8537. proto.webkitMatchesSelector;
  8538. }
  8539. /**
  8540. * Finds the closest parent that matches a selector.
  8541. *
  8542. * @param {Element} element
  8543. * @param {String} selector
  8544. * @return {Function}
  8545. */
  8546. function closest (element, selector) {
  8547. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8548. if (typeof element.matches === 'function' &&
  8549. element.matches(selector)) {
  8550. return element;
  8551. }
  8552. element = element.parentNode;
  8553. }
  8554. }
  8555. module.exports = closest;
  8556. /***/ })
  8557. /******/ ]);
  8558. });
  8559. /***/ }),
  8560. /***/ "./node_modules/ieee754/index.js":
  8561. /*!***************************************!*\
  8562. !*** ./node_modules/ieee754/index.js ***!
  8563. \***************************************/
  8564. /*! no static exports found */
  8565. /***/ (function(module, exports) {
  8566. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8567. var e, m
  8568. var eLen = (nBytes * 8) - mLen - 1
  8569. var eMax = (1 << eLen) - 1
  8570. var eBias = eMax >> 1
  8571. var nBits = -7
  8572. var i = isLE ? (nBytes - 1) : 0
  8573. var d = isLE ? -1 : 1
  8574. var s = buffer[offset + i]
  8575. i += d
  8576. e = s & ((1 << (-nBits)) - 1)
  8577. s >>= (-nBits)
  8578. nBits += eLen
  8579. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8580. m = e & ((1 << (-nBits)) - 1)
  8581. e >>= (-nBits)
  8582. nBits += mLen
  8583. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8584. if (e === 0) {
  8585. e = 1 - eBias
  8586. } else if (e === eMax) {
  8587. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8588. } else {
  8589. m = m + Math.pow(2, mLen)
  8590. e = e - eBias
  8591. }
  8592. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8593. }
  8594. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8595. var e, m, c
  8596. var eLen = (nBytes * 8) - mLen - 1
  8597. var eMax = (1 << eLen) - 1
  8598. var eBias = eMax >> 1
  8599. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8600. var i = isLE ? 0 : (nBytes - 1)
  8601. var d = isLE ? 1 : -1
  8602. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8603. value = Math.abs(value)
  8604. if (isNaN(value) || value === Infinity) {
  8605. m = isNaN(value) ? 1 : 0
  8606. e = eMax
  8607. } else {
  8608. e = Math.floor(Math.log(value) / Math.LN2)
  8609. if (value * (c = Math.pow(2, -e)) < 1) {
  8610. e--
  8611. c *= 2
  8612. }
  8613. if (e + eBias >= 1) {
  8614. value += rt / c
  8615. } else {
  8616. value += rt * Math.pow(2, 1 - eBias)
  8617. }
  8618. if (value * c >= 2) {
  8619. e++
  8620. c /= 2
  8621. }
  8622. if (e + eBias >= eMax) {
  8623. m = 0
  8624. e = eMax
  8625. } else if (e + eBias >= 1) {
  8626. m = ((value * c) - 1) * Math.pow(2, mLen)
  8627. e = e + eBias
  8628. } else {
  8629. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8630. e = 0
  8631. }
  8632. }
  8633. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8634. e = (e << mLen) | m
  8635. eLen += mLen
  8636. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8637. buffer[offset + i - d] |= s * 128
  8638. }
  8639. /***/ }),
  8640. /***/ "./node_modules/isarray/index.js":
  8641. /*!***************************************!*\
  8642. !*** ./node_modules/isarray/index.js ***!
  8643. \***************************************/
  8644. /*! no static exports found */
  8645. /***/ (function(module, exports) {
  8646. var toString = {}.toString;
  8647. module.exports = Array.isArray || function (arr) {
  8648. return toString.call(arr) == '[object Array]';
  8649. };
  8650. /***/ }),
  8651. /***/ "./node_modules/jquery/dist/jquery.js":
  8652. /*!********************************************!*\
  8653. !*** ./node_modules/jquery/dist/jquery.js ***!
  8654. \********************************************/
  8655. /*! no static exports found */
  8656. /***/ (function(module, exports, __webpack_require__) {
  8657. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8658. * jQuery JavaScript Library v3.4.1
  8659. * https://jquery.com/
  8660. *
  8661. * Includes Sizzle.js
  8662. * https://sizzlejs.com/
  8663. *
  8664. * Copyright JS Foundation and other contributors
  8665. * Released under the MIT license
  8666. * https://jquery.org/license
  8667. *
  8668. * Date: 2019-05-01T21:04Z
  8669. */
  8670. ( function( global, factory ) {
  8671. "use strict";
  8672. if ( true && typeof module.exports === "object" ) {
  8673. // For CommonJS and CommonJS-like environments where a proper `window`
  8674. // is present, execute the factory and get jQuery.
  8675. // For environments that do not have a `window` with a `document`
  8676. // (such as Node.js), expose a factory as module.exports.
  8677. // This accentuates the need for the creation of a real `window`.
  8678. // e.g. var jQuery = require("jquery")(window);
  8679. // See ticket #14549 for more info.
  8680. module.exports = global.document ?
  8681. factory( global, true ) :
  8682. function( w ) {
  8683. if ( !w.document ) {
  8684. throw new Error( "jQuery requires a window with a document" );
  8685. }
  8686. return factory( w );
  8687. };
  8688. } else {
  8689. factory( global );
  8690. }
  8691. // Pass this if window is not defined yet
  8692. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8693. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8694. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8695. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8696. // enough that all such attempts are guarded in a try block.
  8697. "use strict";
  8698. var arr = [];
  8699. var document = window.document;
  8700. var getProto = Object.getPrototypeOf;
  8701. var slice = arr.slice;
  8702. var concat = arr.concat;
  8703. var push = arr.push;
  8704. var indexOf = arr.indexOf;
  8705. var class2type = {};
  8706. var toString = class2type.toString;
  8707. var hasOwn = class2type.hasOwnProperty;
  8708. var fnToString = hasOwn.toString;
  8709. var ObjectFunctionString = fnToString.call( Object );
  8710. var support = {};
  8711. var isFunction = function isFunction( obj ) {
  8712. // Support: Chrome <=57, Firefox <=52
  8713. // In some browsers, typeof returns "function" for HTML <object> elements
  8714. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8715. // We don't want to classify *any* DOM node as a function.
  8716. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8717. };
  8718. var isWindow = function isWindow( obj ) {
  8719. return obj != null && obj === obj.window;
  8720. };
  8721. var preservedScriptAttributes = {
  8722. type: true,
  8723. src: true,
  8724. nonce: true,
  8725. noModule: true
  8726. };
  8727. function DOMEval( code, node, doc ) {
  8728. doc = doc || document;
  8729. var i, val,
  8730. script = doc.createElement( "script" );
  8731. script.text = code;
  8732. if ( node ) {
  8733. for ( i in preservedScriptAttributes ) {
  8734. // Support: Firefox 64+, Edge 18+
  8735. // Some browsers don't support the "nonce" property on scripts.
  8736. // On the other hand, just using `getAttribute` is not enough as
  8737. // the `nonce` attribute is reset to an empty string whenever it
  8738. // becomes browsing-context connected.
  8739. // See https://github.com/whatwg/html/issues/2369
  8740. // See https://html.spec.whatwg.org/#nonce-attributes
  8741. // The `node.getAttribute` check was added for the sake of
  8742. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8743. // via an object.
  8744. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8745. if ( val ) {
  8746. script.setAttribute( i, val );
  8747. }
  8748. }
  8749. }
  8750. doc.head.appendChild( script ).parentNode.removeChild( script );
  8751. }
  8752. function toType( obj ) {
  8753. if ( obj == null ) {
  8754. return obj + "";
  8755. }
  8756. // Support: Android <=2.3 only (functionish RegExp)
  8757. return typeof obj === "object" || typeof obj === "function" ?
  8758. class2type[ toString.call( obj ) ] || "object" :
  8759. typeof obj;
  8760. }
  8761. /* global Symbol */
  8762. // Defining this global in .eslintrc.json would create a danger of using the global
  8763. // unguarded in another place, it seems safer to define global only for this module
  8764. var
  8765. version = "3.4.1",
  8766. // Define a local copy of jQuery
  8767. jQuery = function( selector, context ) {
  8768. // The jQuery object is actually just the init constructor 'enhanced'
  8769. // Need init if jQuery is called (just allow error to be thrown if not included)
  8770. return new jQuery.fn.init( selector, context );
  8771. },
  8772. // Support: Android <=4.0 only
  8773. // Make sure we trim BOM and NBSP
  8774. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8775. jQuery.fn = jQuery.prototype = {
  8776. // The current version of jQuery being used
  8777. jquery: version,
  8778. constructor: jQuery,
  8779. // The default length of a jQuery object is 0
  8780. length: 0,
  8781. toArray: function() {
  8782. return slice.call( this );
  8783. },
  8784. // Get the Nth element in the matched element set OR
  8785. // Get the whole matched element set as a clean array
  8786. get: function( num ) {
  8787. // Return all the elements in a clean array
  8788. if ( num == null ) {
  8789. return slice.call( this );
  8790. }
  8791. // Return just the one element from the set
  8792. return num < 0 ? this[ num + this.length ] : this[ num ];
  8793. },
  8794. // Take an array of elements and push it onto the stack
  8795. // (returning the new matched element set)
  8796. pushStack: function( elems ) {
  8797. // Build a new jQuery matched element set
  8798. var ret = jQuery.merge( this.constructor(), elems );
  8799. // Add the old object onto the stack (as a reference)
  8800. ret.prevObject = this;
  8801. // Return the newly-formed element set
  8802. return ret;
  8803. },
  8804. // Execute a callback for every element in the matched set.
  8805. each: function( callback ) {
  8806. return jQuery.each( this, callback );
  8807. },
  8808. map: function( callback ) {
  8809. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8810. return callback.call( elem, i, elem );
  8811. } ) );
  8812. },
  8813. slice: function() {
  8814. return this.pushStack( slice.apply( this, arguments ) );
  8815. },
  8816. first: function() {
  8817. return this.eq( 0 );
  8818. },
  8819. last: function() {
  8820. return this.eq( -1 );
  8821. },
  8822. eq: function( i ) {
  8823. var len = this.length,
  8824. j = +i + ( i < 0 ? len : 0 );
  8825. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8826. },
  8827. end: function() {
  8828. return this.prevObject || this.constructor();
  8829. },
  8830. // For internal use only.
  8831. // Behaves like an Array's method, not like a jQuery method.
  8832. push: push,
  8833. sort: arr.sort,
  8834. splice: arr.splice
  8835. };
  8836. jQuery.extend = jQuery.fn.extend = function() {
  8837. var options, name, src, copy, copyIsArray, clone,
  8838. target = arguments[ 0 ] || {},
  8839. i = 1,
  8840. length = arguments.length,
  8841. deep = false;
  8842. // Handle a deep copy situation
  8843. if ( typeof target === "boolean" ) {
  8844. deep = target;
  8845. // Skip the boolean and the target
  8846. target = arguments[ i ] || {};
  8847. i++;
  8848. }
  8849. // Handle case when target is a string or something (possible in deep copy)
  8850. if ( typeof target !== "object" && !isFunction( target ) ) {
  8851. target = {};
  8852. }
  8853. // Extend jQuery itself if only one argument is passed
  8854. if ( i === length ) {
  8855. target = this;
  8856. i--;
  8857. }
  8858. for ( ; i < length; i++ ) {
  8859. // Only deal with non-null/undefined values
  8860. if ( ( options = arguments[ i ] ) != null ) {
  8861. // Extend the base object
  8862. for ( name in options ) {
  8863. copy = options[ name ];
  8864. // Prevent Object.prototype pollution
  8865. // Prevent never-ending loop
  8866. if ( name === "__proto__" || target === copy ) {
  8867. continue;
  8868. }
  8869. // Recurse if we're merging plain objects or arrays
  8870. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8871. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8872. src = target[ name ];
  8873. // Ensure proper type for the source value
  8874. if ( copyIsArray && !Array.isArray( src ) ) {
  8875. clone = [];
  8876. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8877. clone = {};
  8878. } else {
  8879. clone = src;
  8880. }
  8881. copyIsArray = false;
  8882. // Never move original objects, clone them
  8883. target[ name ] = jQuery.extend( deep, clone, copy );
  8884. // Don't bring in undefined values
  8885. } else if ( copy !== undefined ) {
  8886. target[ name ] = copy;
  8887. }
  8888. }
  8889. }
  8890. }
  8891. // Return the modified object
  8892. return target;
  8893. };
  8894. jQuery.extend( {
  8895. // Unique for each copy of jQuery on the page
  8896. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8897. // Assume jQuery is ready without the ready module
  8898. isReady: true,
  8899. error: function( msg ) {
  8900. throw new Error( msg );
  8901. },
  8902. noop: function() {},
  8903. isPlainObject: function( obj ) {
  8904. var proto, Ctor;
  8905. // Detect obvious negatives
  8906. // Use toString instead of jQuery.type to catch host objects
  8907. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8908. return false;
  8909. }
  8910. proto = getProto( obj );
  8911. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8912. if ( !proto ) {
  8913. return true;
  8914. }
  8915. // Objects with prototype are plain iff they were constructed by a global Object function
  8916. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8917. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8918. },
  8919. isEmptyObject: function( obj ) {
  8920. var name;
  8921. for ( name in obj ) {
  8922. return false;
  8923. }
  8924. return true;
  8925. },
  8926. // Evaluates a script in a global context
  8927. globalEval: function( code, options ) {
  8928. DOMEval( code, { nonce: options && options.nonce } );
  8929. },
  8930. each: function( obj, callback ) {
  8931. var length, i = 0;
  8932. if ( isArrayLike( obj ) ) {
  8933. length = obj.length;
  8934. for ( ; i < length; i++ ) {
  8935. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8936. break;
  8937. }
  8938. }
  8939. } else {
  8940. for ( i in obj ) {
  8941. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8942. break;
  8943. }
  8944. }
  8945. }
  8946. return obj;
  8947. },
  8948. // Support: Android <=4.0 only
  8949. trim: function( text ) {
  8950. return text == null ?
  8951. "" :
  8952. ( text + "" ).replace( rtrim, "" );
  8953. },
  8954. // results is for internal usage only
  8955. makeArray: function( arr, results ) {
  8956. var ret = results || [];
  8957. if ( arr != null ) {
  8958. if ( isArrayLike( Object( arr ) ) ) {
  8959. jQuery.merge( ret,
  8960. typeof arr === "string" ?
  8961. [ arr ] : arr
  8962. );
  8963. } else {
  8964. push.call( ret, arr );
  8965. }
  8966. }
  8967. return ret;
  8968. },
  8969. inArray: function( elem, arr, i ) {
  8970. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8971. },
  8972. // Support: Android <=4.0 only, PhantomJS 1 only
  8973. // push.apply(_, arraylike) throws on ancient WebKit
  8974. merge: function( first, second ) {
  8975. var len = +second.length,
  8976. j = 0,
  8977. i = first.length;
  8978. for ( ; j < len; j++ ) {
  8979. first[ i++ ] = second[ j ];
  8980. }
  8981. first.length = i;
  8982. return first;
  8983. },
  8984. grep: function( elems, callback, invert ) {
  8985. var callbackInverse,
  8986. matches = [],
  8987. i = 0,
  8988. length = elems.length,
  8989. callbackExpect = !invert;
  8990. // Go through the array, only saving the items
  8991. // that pass the validator function
  8992. for ( ; i < length; i++ ) {
  8993. callbackInverse = !callback( elems[ i ], i );
  8994. if ( callbackInverse !== callbackExpect ) {
  8995. matches.push( elems[ i ] );
  8996. }
  8997. }
  8998. return matches;
  8999. },
  9000. // arg is for internal usage only
  9001. map: function( elems, callback, arg ) {
  9002. var length, value,
  9003. i = 0,
  9004. ret = [];
  9005. // Go through the array, translating each of the items to their new values
  9006. if ( isArrayLike( elems ) ) {
  9007. length = elems.length;
  9008. for ( ; i < length; i++ ) {
  9009. value = callback( elems[ i ], i, arg );
  9010. if ( value != null ) {
  9011. ret.push( value );
  9012. }
  9013. }
  9014. // Go through every key on the object,
  9015. } else {
  9016. for ( i in elems ) {
  9017. value = callback( elems[ i ], i, arg );
  9018. if ( value != null ) {
  9019. ret.push( value );
  9020. }
  9021. }
  9022. }
  9023. // Flatten any nested arrays
  9024. return concat.apply( [], ret );
  9025. },
  9026. // A global GUID counter for objects
  9027. guid: 1,
  9028. // jQuery.support is not used in Core but other projects attach their
  9029. // properties to it so it needs to exist.
  9030. support: support
  9031. } );
  9032. if ( typeof Symbol === "function" ) {
  9033. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9034. }
  9035. // Populate the class2type map
  9036. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9037. function( i, name ) {
  9038. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9039. } );
  9040. function isArrayLike( obj ) {
  9041. // Support: real iOS 8.2 only (not reproducible in simulator)
  9042. // `in` check used to prevent JIT error (gh-2145)
  9043. // hasOwn isn't used here due to false negatives
  9044. // regarding Nodelist length in IE
  9045. var length = !!obj && "length" in obj && obj.length,
  9046. type = toType( obj );
  9047. if ( isFunction( obj ) || isWindow( obj ) ) {
  9048. return false;
  9049. }
  9050. return type === "array" || length === 0 ||
  9051. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9052. }
  9053. var Sizzle =
  9054. /*!
  9055. * Sizzle CSS Selector Engine v2.3.4
  9056. * https://sizzlejs.com/
  9057. *
  9058. * Copyright JS Foundation and other contributors
  9059. * Released under the MIT license
  9060. * https://js.foundation/
  9061. *
  9062. * Date: 2019-04-08
  9063. */
  9064. (function( window ) {
  9065. var i,
  9066. support,
  9067. Expr,
  9068. getText,
  9069. isXML,
  9070. tokenize,
  9071. compile,
  9072. select,
  9073. outermostContext,
  9074. sortInput,
  9075. hasDuplicate,
  9076. // Local document vars
  9077. setDocument,
  9078. document,
  9079. docElem,
  9080. documentIsHTML,
  9081. rbuggyQSA,
  9082. rbuggyMatches,
  9083. matches,
  9084. contains,
  9085. // Instance-specific data
  9086. expando = "sizzle" + 1 * new Date(),
  9087. preferredDoc = window.document,
  9088. dirruns = 0,
  9089. done = 0,
  9090. classCache = createCache(),
  9091. tokenCache = createCache(),
  9092. compilerCache = createCache(),
  9093. nonnativeSelectorCache = createCache(),
  9094. sortOrder = function( a, b ) {
  9095. if ( a === b ) {
  9096. hasDuplicate = true;
  9097. }
  9098. return 0;
  9099. },
  9100. // Instance methods
  9101. hasOwn = ({}).hasOwnProperty,
  9102. arr = [],
  9103. pop = arr.pop,
  9104. push_native = arr.push,
  9105. push = arr.push,
  9106. slice = arr.slice,
  9107. // Use a stripped-down indexOf as it's faster than native
  9108. // https://jsperf.com/thor-indexof-vs-for/5
  9109. indexOf = function( list, elem ) {
  9110. var i = 0,
  9111. len = list.length;
  9112. for ( ; i < len; i++ ) {
  9113. if ( list[i] === elem ) {
  9114. return i;
  9115. }
  9116. }
  9117. return -1;
  9118. },
  9119. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9120. // Regular expressions
  9121. // http://www.w3.org/TR/css3-selectors/#whitespace
  9122. whitespace = "[\\x20\\t\\r\\n\\f]",
  9123. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9124. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9125. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9126. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9127. // Operator (capture 2)
  9128. "*([*^$|!~]?=)" + whitespace +
  9129. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9130. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9131. "*\\]",
  9132. pseudos = ":(" + identifier + ")(?:\\((" +
  9133. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9134. // 1. quoted (capture 3; capture 4 or capture 5)
  9135. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9136. // 2. simple (capture 6)
  9137. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9138. // 3. anything else (capture 2)
  9139. ".*" +
  9140. ")\\)|)",
  9141. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9142. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9143. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9144. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9145. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9146. rdescend = new RegExp( whitespace + "|>" ),
  9147. rpseudo = new RegExp( pseudos ),
  9148. ridentifier = new RegExp( "^" + identifier + "$" ),
  9149. matchExpr = {
  9150. "ID": new RegExp( "^#(" + identifier + ")" ),
  9151. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9152. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9153. "ATTR": new RegExp( "^" + attributes ),
  9154. "PSEUDO": new RegExp( "^" + pseudos ),
  9155. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9156. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9157. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9158. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9159. // For use in libraries implementing .is()
  9160. // We use this for POS matching in `select`
  9161. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9162. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9163. },
  9164. rhtml = /HTML$/i,
  9165. rinputs = /^(?:input|select|textarea|button)$/i,
  9166. rheader = /^h\d$/i,
  9167. rnative = /^[^{]+\{\s*\[native \w/,
  9168. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9169. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9170. rsibling = /[+~]/,
  9171. // CSS escapes
  9172. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9173. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9174. funescape = function( _, escaped, escapedWhitespace ) {
  9175. var high = "0x" + escaped - 0x10000;
  9176. // NaN means non-codepoint
  9177. // Support: Firefox<24
  9178. // Workaround erroneous numeric interpretation of +"0x"
  9179. return high !== high || escapedWhitespace ?
  9180. escaped :
  9181. high < 0 ?
  9182. // BMP codepoint
  9183. String.fromCharCode( high + 0x10000 ) :
  9184. // Supplemental Plane codepoint (surrogate pair)
  9185. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9186. },
  9187. // CSS string/identifier serialization
  9188. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9189. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9190. fcssescape = function( ch, asCodePoint ) {
  9191. if ( asCodePoint ) {
  9192. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9193. if ( ch === "\0" ) {
  9194. return "\uFFFD";
  9195. }
  9196. // Control characters and (dependent upon position) numbers get escaped as code points
  9197. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9198. }
  9199. // Other potentially-special ASCII characters get backslash-escaped
  9200. return "\\" + ch;
  9201. },
  9202. // Used for iframes
  9203. // See setDocument()
  9204. // Removing the function wrapper causes a "Permission Denied"
  9205. // error in IE
  9206. unloadHandler = function() {
  9207. setDocument();
  9208. },
  9209. inDisabledFieldset = addCombinator(
  9210. function( elem ) {
  9211. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9212. },
  9213. { dir: "parentNode", next: "legend" }
  9214. );
  9215. // Optimize for push.apply( _, NodeList )
  9216. try {
  9217. push.apply(
  9218. (arr = slice.call( preferredDoc.childNodes )),
  9219. preferredDoc.childNodes
  9220. );
  9221. // Support: Android<4.0
  9222. // Detect silently failing push.apply
  9223. arr[ preferredDoc.childNodes.length ].nodeType;
  9224. } catch ( e ) {
  9225. push = { apply: arr.length ?
  9226. // Leverage slice if possible
  9227. function( target, els ) {
  9228. push_native.apply( target, slice.call(els) );
  9229. } :
  9230. // Support: IE<9
  9231. // Otherwise append directly
  9232. function( target, els ) {
  9233. var j = target.length,
  9234. i = 0;
  9235. // Can't trust NodeList.length
  9236. while ( (target[j++] = els[i++]) ) {}
  9237. target.length = j - 1;
  9238. }
  9239. };
  9240. }
  9241. function Sizzle( selector, context, results, seed ) {
  9242. var m, i, elem, nid, match, groups, newSelector,
  9243. newContext = context && context.ownerDocument,
  9244. // nodeType defaults to 9, since context defaults to document
  9245. nodeType = context ? context.nodeType : 9;
  9246. results = results || [];
  9247. // Return early from calls with invalid selector or context
  9248. if ( typeof selector !== "string" || !selector ||
  9249. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9250. return results;
  9251. }
  9252. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9253. if ( !seed ) {
  9254. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9255. setDocument( context );
  9256. }
  9257. context = context || document;
  9258. if ( documentIsHTML ) {
  9259. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9260. // (excepting DocumentFragment context, where the methods don't exist)
  9261. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9262. // ID selector
  9263. if ( (m = match[1]) ) {
  9264. // Document context
  9265. if ( nodeType === 9 ) {
  9266. if ( (elem = context.getElementById( m )) ) {
  9267. // Support: IE, Opera, Webkit
  9268. // TODO: identify versions
  9269. // getElementById can match elements by name instead of ID
  9270. if ( elem.id === m ) {
  9271. results.push( elem );
  9272. return results;
  9273. }
  9274. } else {
  9275. return results;
  9276. }
  9277. // Element context
  9278. } else {
  9279. // Support: IE, Opera, Webkit
  9280. // TODO: identify versions
  9281. // getElementById can match elements by name instead of ID
  9282. if ( newContext && (elem = newContext.getElementById( m )) &&
  9283. contains( context, elem ) &&
  9284. elem.id === m ) {
  9285. results.push( elem );
  9286. return results;
  9287. }
  9288. }
  9289. // Type selector
  9290. } else if ( match[2] ) {
  9291. push.apply( results, context.getElementsByTagName( selector ) );
  9292. return results;
  9293. // Class selector
  9294. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9295. context.getElementsByClassName ) {
  9296. push.apply( results, context.getElementsByClassName( m ) );
  9297. return results;
  9298. }
  9299. }
  9300. // Take advantage of querySelectorAll
  9301. if ( support.qsa &&
  9302. !nonnativeSelectorCache[ selector + " " ] &&
  9303. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9304. // Support: IE 8 only
  9305. // Exclude object elements
  9306. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9307. newSelector = selector;
  9308. newContext = context;
  9309. // qSA considers elements outside a scoping root when evaluating child or
  9310. // descendant combinators, which is not what we want.
  9311. // In such cases, we work around the behavior by prefixing every selector in the
  9312. // list with an ID selector referencing the scope context.
  9313. // Thanks to Andrew Dupont for this technique.
  9314. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9315. // Capture the context ID, setting it first if necessary
  9316. if ( (nid = context.getAttribute( "id" )) ) {
  9317. nid = nid.replace( rcssescape, fcssescape );
  9318. } else {
  9319. context.setAttribute( "id", (nid = expando) );
  9320. }
  9321. // Prefix every selector in the list
  9322. groups = tokenize( selector );
  9323. i = groups.length;
  9324. while ( i-- ) {
  9325. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9326. }
  9327. newSelector = groups.join( "," );
  9328. // Expand context for sibling selectors
  9329. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9330. context;
  9331. }
  9332. try {
  9333. push.apply( results,
  9334. newContext.querySelectorAll( newSelector )
  9335. );
  9336. return results;
  9337. } catch ( qsaError ) {
  9338. nonnativeSelectorCache( selector, true );
  9339. } finally {
  9340. if ( nid === expando ) {
  9341. context.removeAttribute( "id" );
  9342. }
  9343. }
  9344. }
  9345. }
  9346. }
  9347. // All others
  9348. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9349. }
  9350. /**
  9351. * Create key-value caches of limited size
  9352. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9353. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9354. * deleting the oldest entry
  9355. */
  9356. function createCache() {
  9357. var keys = [];
  9358. function cache( key, value ) {
  9359. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9360. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9361. // Only keep the most recent entries
  9362. delete cache[ keys.shift() ];
  9363. }
  9364. return (cache[ key + " " ] = value);
  9365. }
  9366. return cache;
  9367. }
  9368. /**
  9369. * Mark a function for special use by Sizzle
  9370. * @param {Function} fn The function to mark
  9371. */
  9372. function markFunction( fn ) {
  9373. fn[ expando ] = true;
  9374. return fn;
  9375. }
  9376. /**
  9377. * Support testing using an element
  9378. * @param {Function} fn Passed the created element and returns a boolean result
  9379. */
  9380. function assert( fn ) {
  9381. var el = document.createElement("fieldset");
  9382. try {
  9383. return !!fn( el );
  9384. } catch (e) {
  9385. return false;
  9386. } finally {
  9387. // Remove from its parent by default
  9388. if ( el.parentNode ) {
  9389. el.parentNode.removeChild( el );
  9390. }
  9391. // release memory in IE
  9392. el = null;
  9393. }
  9394. }
  9395. /**
  9396. * Adds the same handler for all of the specified attrs
  9397. * @param {String} attrs Pipe-separated list of attributes
  9398. * @param {Function} handler The method that will be applied
  9399. */
  9400. function addHandle( attrs, handler ) {
  9401. var arr = attrs.split("|"),
  9402. i = arr.length;
  9403. while ( i-- ) {
  9404. Expr.attrHandle[ arr[i] ] = handler;
  9405. }
  9406. }
  9407. /**
  9408. * Checks document order of two siblings
  9409. * @param {Element} a
  9410. * @param {Element} b
  9411. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9412. */
  9413. function siblingCheck( a, b ) {
  9414. var cur = b && a,
  9415. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9416. a.sourceIndex - b.sourceIndex;
  9417. // Use IE sourceIndex if available on both nodes
  9418. if ( diff ) {
  9419. return diff;
  9420. }
  9421. // Check if b follows a
  9422. if ( cur ) {
  9423. while ( (cur = cur.nextSibling) ) {
  9424. if ( cur === b ) {
  9425. return -1;
  9426. }
  9427. }
  9428. }
  9429. return a ? 1 : -1;
  9430. }
  9431. /**
  9432. * Returns a function to use in pseudos for input types
  9433. * @param {String} type
  9434. */
  9435. function createInputPseudo( type ) {
  9436. return function( elem ) {
  9437. var name = elem.nodeName.toLowerCase();
  9438. return name === "input" && elem.type === type;
  9439. };
  9440. }
  9441. /**
  9442. * Returns a function to use in pseudos for buttons
  9443. * @param {String} type
  9444. */
  9445. function createButtonPseudo( type ) {
  9446. return function( elem ) {
  9447. var name = elem.nodeName.toLowerCase();
  9448. return (name === "input" || name === "button") && elem.type === type;
  9449. };
  9450. }
  9451. /**
  9452. * Returns a function to use in pseudos for :enabled/:disabled
  9453. * @param {Boolean} disabled true for :disabled; false for :enabled
  9454. */
  9455. function createDisabledPseudo( disabled ) {
  9456. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9457. return function( elem ) {
  9458. // Only certain elements can match :enabled or :disabled
  9459. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9460. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9461. if ( "form" in elem ) {
  9462. // Check for inherited disabledness on relevant non-disabled elements:
  9463. // * listed form-associated elements in a disabled fieldset
  9464. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9465. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9466. // * option elements in a disabled optgroup
  9467. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9468. // All such elements have a "form" property.
  9469. if ( elem.parentNode && elem.disabled === false ) {
  9470. // Option elements defer to a parent optgroup if present
  9471. if ( "label" in elem ) {
  9472. if ( "label" in elem.parentNode ) {
  9473. return elem.parentNode.disabled === disabled;
  9474. } else {
  9475. return elem.disabled === disabled;
  9476. }
  9477. }
  9478. // Support: IE 6 - 11
  9479. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9480. return elem.isDisabled === disabled ||
  9481. // Where there is no isDisabled, check manually
  9482. /* jshint -W018 */
  9483. elem.isDisabled !== !disabled &&
  9484. inDisabledFieldset( elem ) === disabled;
  9485. }
  9486. return elem.disabled === disabled;
  9487. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9488. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9489. // even exist on them, let alone have a boolean value.
  9490. } else if ( "label" in elem ) {
  9491. return elem.disabled === disabled;
  9492. }
  9493. // Remaining elements are neither :enabled nor :disabled
  9494. return false;
  9495. };
  9496. }
  9497. /**
  9498. * Returns a function to use in pseudos for positionals
  9499. * @param {Function} fn
  9500. */
  9501. function createPositionalPseudo( fn ) {
  9502. return markFunction(function( argument ) {
  9503. argument = +argument;
  9504. return markFunction(function( seed, matches ) {
  9505. var j,
  9506. matchIndexes = fn( [], seed.length, argument ),
  9507. i = matchIndexes.length;
  9508. // Match elements found at the specified indexes
  9509. while ( i-- ) {
  9510. if ( seed[ (j = matchIndexes[i]) ] ) {
  9511. seed[j] = !(matches[j] = seed[j]);
  9512. }
  9513. }
  9514. });
  9515. });
  9516. }
  9517. /**
  9518. * Checks a node for validity as a Sizzle context
  9519. * @param {Element|Object=} context
  9520. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9521. */
  9522. function testContext( context ) {
  9523. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9524. }
  9525. // Expose support vars for convenience
  9526. support = Sizzle.support = {};
  9527. /**
  9528. * Detects XML nodes
  9529. * @param {Element|Object} elem An element or a document
  9530. * @returns {Boolean} True iff elem is a non-HTML XML node
  9531. */
  9532. isXML = Sizzle.isXML = function( elem ) {
  9533. var namespace = elem.namespaceURI,
  9534. docElem = (elem.ownerDocument || elem).documentElement;
  9535. // Support: IE <=8
  9536. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9537. // https://bugs.jquery.com/ticket/4833
  9538. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9539. };
  9540. /**
  9541. * Sets document-related variables once based on the current document
  9542. * @param {Element|Object} [doc] An element or document object to use to set the document
  9543. * @returns {Object} Returns the current document
  9544. */
  9545. setDocument = Sizzle.setDocument = function( node ) {
  9546. var hasCompare, subWindow,
  9547. doc = node ? node.ownerDocument || node : preferredDoc;
  9548. // Return early if doc is invalid or already selected
  9549. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9550. return document;
  9551. }
  9552. // Update global variables
  9553. document = doc;
  9554. docElem = document.documentElement;
  9555. documentIsHTML = !isXML( document );
  9556. // Support: IE 9-11, Edge
  9557. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9558. if ( preferredDoc !== document &&
  9559. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9560. // Support: IE 11, Edge
  9561. if ( subWindow.addEventListener ) {
  9562. subWindow.addEventListener( "unload", unloadHandler, false );
  9563. // Support: IE 9 - 10 only
  9564. } else if ( subWindow.attachEvent ) {
  9565. subWindow.attachEvent( "onunload", unloadHandler );
  9566. }
  9567. }
  9568. /* Attributes
  9569. ---------------------------------------------------------------------- */
  9570. // Support: IE<8
  9571. // Verify that getAttribute really returns attributes and not properties
  9572. // (excepting IE8 booleans)
  9573. support.attributes = assert(function( el ) {
  9574. el.className = "i";
  9575. return !el.getAttribute("className");
  9576. });
  9577. /* getElement(s)By*
  9578. ---------------------------------------------------------------------- */
  9579. // Check if getElementsByTagName("*") returns only elements
  9580. support.getElementsByTagName = assert(function( el ) {
  9581. el.appendChild( document.createComment("") );
  9582. return !el.getElementsByTagName("*").length;
  9583. });
  9584. // Support: IE<9
  9585. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9586. // Support: IE<10
  9587. // Check if getElementById returns elements by name
  9588. // The broken getElementById methods don't pick up programmatically-set names,
  9589. // so use a roundabout getElementsByName test
  9590. support.getById = assert(function( el ) {
  9591. docElem.appendChild( el ).id = expando;
  9592. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9593. });
  9594. // ID filter and find
  9595. if ( support.getById ) {
  9596. Expr.filter["ID"] = function( id ) {
  9597. var attrId = id.replace( runescape, funescape );
  9598. return function( elem ) {
  9599. return elem.getAttribute("id") === attrId;
  9600. };
  9601. };
  9602. Expr.find["ID"] = function( id, context ) {
  9603. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9604. var elem = context.getElementById( id );
  9605. return elem ? [ elem ] : [];
  9606. }
  9607. };
  9608. } else {
  9609. Expr.filter["ID"] = function( id ) {
  9610. var attrId = id.replace( runescape, funescape );
  9611. return function( elem ) {
  9612. var node = typeof elem.getAttributeNode !== "undefined" &&
  9613. elem.getAttributeNode("id");
  9614. return node && node.value === attrId;
  9615. };
  9616. };
  9617. // Support: IE 6 - 7 only
  9618. // getElementById is not reliable as a find shortcut
  9619. Expr.find["ID"] = function( id, context ) {
  9620. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9621. var node, i, elems,
  9622. elem = context.getElementById( id );
  9623. if ( elem ) {
  9624. // Verify the id attribute
  9625. node = elem.getAttributeNode("id");
  9626. if ( node && node.value === id ) {
  9627. return [ elem ];
  9628. }
  9629. // Fall back on getElementsByName
  9630. elems = context.getElementsByName( id );
  9631. i = 0;
  9632. while ( (elem = elems[i++]) ) {
  9633. node = elem.getAttributeNode("id");
  9634. if ( node && node.value === id ) {
  9635. return [ elem ];
  9636. }
  9637. }
  9638. }
  9639. return [];
  9640. }
  9641. };
  9642. }
  9643. // Tag
  9644. Expr.find["TAG"] = support.getElementsByTagName ?
  9645. function( tag, context ) {
  9646. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9647. return context.getElementsByTagName( tag );
  9648. // DocumentFragment nodes don't have gEBTN
  9649. } else if ( support.qsa ) {
  9650. return context.querySelectorAll( tag );
  9651. }
  9652. } :
  9653. function( tag, context ) {
  9654. var elem,
  9655. tmp = [],
  9656. i = 0,
  9657. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9658. results = context.getElementsByTagName( tag );
  9659. // Filter out possible comments
  9660. if ( tag === "*" ) {
  9661. while ( (elem = results[i++]) ) {
  9662. if ( elem.nodeType === 1 ) {
  9663. tmp.push( elem );
  9664. }
  9665. }
  9666. return tmp;
  9667. }
  9668. return results;
  9669. };
  9670. // Class
  9671. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9672. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9673. return context.getElementsByClassName( className );
  9674. }
  9675. };
  9676. /* QSA/matchesSelector
  9677. ---------------------------------------------------------------------- */
  9678. // QSA and matchesSelector support
  9679. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9680. rbuggyMatches = [];
  9681. // qSa(:focus) reports false when true (Chrome 21)
  9682. // We allow this because of a bug in IE8/9 that throws an error
  9683. // whenever `document.activeElement` is accessed on an iframe
  9684. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9685. // See https://bugs.jquery.com/ticket/13378
  9686. rbuggyQSA = [];
  9687. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9688. // Build QSA regex
  9689. // Regex strategy adopted from Diego Perini
  9690. assert(function( el ) {
  9691. // Select is set to empty string on purpose
  9692. // This is to test IE's treatment of not explicitly
  9693. // setting a boolean content attribute,
  9694. // since its presence should be enough
  9695. // https://bugs.jquery.com/ticket/12359
  9696. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9697. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9698. "<option selected=''></option></select>";
  9699. // Support: IE8, Opera 11-12.16
  9700. // Nothing should be selected when empty strings follow ^= or $= or *=
  9701. // The test attribute must be unknown in Opera but "safe" for WinRT
  9702. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9703. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9704. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9705. }
  9706. // Support: IE8
  9707. // Boolean attributes and "value" are not treated correctly
  9708. if ( !el.querySelectorAll("[selected]").length ) {
  9709. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9710. }
  9711. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9712. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9713. rbuggyQSA.push("~=");
  9714. }
  9715. // Webkit/Opera - :checked should return selected option elements
  9716. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9717. // IE8 throws error here and will not see later tests
  9718. if ( !el.querySelectorAll(":checked").length ) {
  9719. rbuggyQSA.push(":checked");
  9720. }
  9721. // Support: Safari 8+, iOS 8+
  9722. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9723. // In-page `selector#id sibling-combinator selector` fails
  9724. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9725. rbuggyQSA.push(".#.+[+~]");
  9726. }
  9727. });
  9728. assert(function( el ) {
  9729. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9730. "<select disabled='disabled'><option/></select>";
  9731. // Support: Windows 8 Native Apps
  9732. // The type and name attributes are restricted during .innerHTML assignment
  9733. var input = document.createElement("input");
  9734. input.setAttribute( "type", "hidden" );
  9735. el.appendChild( input ).setAttribute( "name", "D" );
  9736. // Support: IE8
  9737. // Enforce case-sensitivity of name attribute
  9738. if ( el.querySelectorAll("[name=d]").length ) {
  9739. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9740. }
  9741. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9742. // IE8 throws error here and will not see later tests
  9743. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9744. rbuggyQSA.push( ":enabled", ":disabled" );
  9745. }
  9746. // Support: IE9-11+
  9747. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9748. docElem.appendChild( el ).disabled = true;
  9749. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9750. rbuggyQSA.push( ":enabled", ":disabled" );
  9751. }
  9752. // Opera 10-11 does not throw on post-comma invalid pseudos
  9753. el.querySelectorAll("*,:x");
  9754. rbuggyQSA.push(",.*:");
  9755. });
  9756. }
  9757. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9758. docElem.webkitMatchesSelector ||
  9759. docElem.mozMatchesSelector ||
  9760. docElem.oMatchesSelector ||
  9761. docElem.msMatchesSelector) )) ) {
  9762. assert(function( el ) {
  9763. // Check to see if it's possible to do matchesSelector
  9764. // on a disconnected node (IE 9)
  9765. support.disconnectedMatch = matches.call( el, "*" );
  9766. // This should fail with an exception
  9767. // Gecko does not error, returns false instead
  9768. matches.call( el, "[s!='']:x" );
  9769. rbuggyMatches.push( "!=", pseudos );
  9770. });
  9771. }
  9772. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9773. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9774. /* Contains
  9775. ---------------------------------------------------------------------- */
  9776. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9777. // Element contains another
  9778. // Purposefully self-exclusive
  9779. // As in, an element does not contain itself
  9780. contains = hasCompare || rnative.test( docElem.contains ) ?
  9781. function( a, b ) {
  9782. var adown = a.nodeType === 9 ? a.documentElement : a,
  9783. bup = b && b.parentNode;
  9784. return a === bup || !!( bup && bup.nodeType === 1 && (
  9785. adown.contains ?
  9786. adown.contains( bup ) :
  9787. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9788. ));
  9789. } :
  9790. function( a, b ) {
  9791. if ( b ) {
  9792. while ( (b = b.parentNode) ) {
  9793. if ( b === a ) {
  9794. return true;
  9795. }
  9796. }
  9797. }
  9798. return false;
  9799. };
  9800. /* Sorting
  9801. ---------------------------------------------------------------------- */
  9802. // Document order sorting
  9803. sortOrder = hasCompare ?
  9804. function( a, b ) {
  9805. // Flag for duplicate removal
  9806. if ( a === b ) {
  9807. hasDuplicate = true;
  9808. return 0;
  9809. }
  9810. // Sort on method existence if only one input has compareDocumentPosition
  9811. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9812. if ( compare ) {
  9813. return compare;
  9814. }
  9815. // Calculate position if both inputs belong to the same document
  9816. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9817. a.compareDocumentPosition( b ) :
  9818. // Otherwise we know they are disconnected
  9819. 1;
  9820. // Disconnected nodes
  9821. if ( compare & 1 ||
  9822. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9823. // Choose the first element that is related to our preferred document
  9824. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9825. return -1;
  9826. }
  9827. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9828. return 1;
  9829. }
  9830. // Maintain original order
  9831. return sortInput ?
  9832. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9833. 0;
  9834. }
  9835. return compare & 4 ? -1 : 1;
  9836. } :
  9837. function( a, b ) {
  9838. // Exit early if the nodes are identical
  9839. if ( a === b ) {
  9840. hasDuplicate = true;
  9841. return 0;
  9842. }
  9843. var cur,
  9844. i = 0,
  9845. aup = a.parentNode,
  9846. bup = b.parentNode,
  9847. ap = [ a ],
  9848. bp = [ b ];
  9849. // Parentless nodes are either documents or disconnected
  9850. if ( !aup || !bup ) {
  9851. return a === document ? -1 :
  9852. b === document ? 1 :
  9853. aup ? -1 :
  9854. bup ? 1 :
  9855. sortInput ?
  9856. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9857. 0;
  9858. // If the nodes are siblings, we can do a quick check
  9859. } else if ( aup === bup ) {
  9860. return siblingCheck( a, b );
  9861. }
  9862. // Otherwise we need full lists of their ancestors for comparison
  9863. cur = a;
  9864. while ( (cur = cur.parentNode) ) {
  9865. ap.unshift( cur );
  9866. }
  9867. cur = b;
  9868. while ( (cur = cur.parentNode) ) {
  9869. bp.unshift( cur );
  9870. }
  9871. // Walk down the tree looking for a discrepancy
  9872. while ( ap[i] === bp[i] ) {
  9873. i++;
  9874. }
  9875. return i ?
  9876. // Do a sibling check if the nodes have a common ancestor
  9877. siblingCheck( ap[i], bp[i] ) :
  9878. // Otherwise nodes in our document sort first
  9879. ap[i] === preferredDoc ? -1 :
  9880. bp[i] === preferredDoc ? 1 :
  9881. 0;
  9882. };
  9883. return document;
  9884. };
  9885. Sizzle.matches = function( expr, elements ) {
  9886. return Sizzle( expr, null, null, elements );
  9887. };
  9888. Sizzle.matchesSelector = function( elem, expr ) {
  9889. // Set document vars if needed
  9890. if ( ( elem.ownerDocument || elem ) !== document ) {
  9891. setDocument( elem );
  9892. }
  9893. if ( support.matchesSelector && documentIsHTML &&
  9894. !nonnativeSelectorCache[ expr + " " ] &&
  9895. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9896. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9897. try {
  9898. var ret = matches.call( elem, expr );
  9899. // IE 9's matchesSelector returns false on disconnected nodes
  9900. if ( ret || support.disconnectedMatch ||
  9901. // As well, disconnected nodes are said to be in a document
  9902. // fragment in IE 9
  9903. elem.document && elem.document.nodeType !== 11 ) {
  9904. return ret;
  9905. }
  9906. } catch (e) {
  9907. nonnativeSelectorCache( expr, true );
  9908. }
  9909. }
  9910. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9911. };
  9912. Sizzle.contains = function( context, elem ) {
  9913. // Set document vars if needed
  9914. if ( ( context.ownerDocument || context ) !== document ) {
  9915. setDocument( context );
  9916. }
  9917. return contains( context, elem );
  9918. };
  9919. Sizzle.attr = function( elem, name ) {
  9920. // Set document vars if needed
  9921. if ( ( elem.ownerDocument || elem ) !== document ) {
  9922. setDocument( elem );
  9923. }
  9924. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9925. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9926. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9927. fn( elem, name, !documentIsHTML ) :
  9928. undefined;
  9929. return val !== undefined ?
  9930. val :
  9931. support.attributes || !documentIsHTML ?
  9932. elem.getAttribute( name ) :
  9933. (val = elem.getAttributeNode(name)) && val.specified ?
  9934. val.value :
  9935. null;
  9936. };
  9937. Sizzle.escape = function( sel ) {
  9938. return (sel + "").replace( rcssescape, fcssescape );
  9939. };
  9940. Sizzle.error = function( msg ) {
  9941. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9942. };
  9943. /**
  9944. * Document sorting and removing duplicates
  9945. * @param {ArrayLike} results
  9946. */
  9947. Sizzle.uniqueSort = function( results ) {
  9948. var elem,
  9949. duplicates = [],
  9950. j = 0,
  9951. i = 0;
  9952. // Unless we *know* we can detect duplicates, assume their presence
  9953. hasDuplicate = !support.detectDuplicates;
  9954. sortInput = !support.sortStable && results.slice( 0 );
  9955. results.sort( sortOrder );
  9956. if ( hasDuplicate ) {
  9957. while ( (elem = results[i++]) ) {
  9958. if ( elem === results[ i ] ) {
  9959. j = duplicates.push( i );
  9960. }
  9961. }
  9962. while ( j-- ) {
  9963. results.splice( duplicates[ j ], 1 );
  9964. }
  9965. }
  9966. // Clear input after sorting to release objects
  9967. // See https://github.com/jquery/sizzle/pull/225
  9968. sortInput = null;
  9969. return results;
  9970. };
  9971. /**
  9972. * Utility function for retrieving the text value of an array of DOM nodes
  9973. * @param {Array|Element} elem
  9974. */
  9975. getText = Sizzle.getText = function( elem ) {
  9976. var node,
  9977. ret = "",
  9978. i = 0,
  9979. nodeType = elem.nodeType;
  9980. if ( !nodeType ) {
  9981. // If no nodeType, this is expected to be an array
  9982. while ( (node = elem[i++]) ) {
  9983. // Do not traverse comment nodes
  9984. ret += getText( node );
  9985. }
  9986. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9987. // Use textContent for elements
  9988. // innerText usage removed for consistency of new lines (jQuery #11153)
  9989. if ( typeof elem.textContent === "string" ) {
  9990. return elem.textContent;
  9991. } else {
  9992. // Traverse its children
  9993. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9994. ret += getText( elem );
  9995. }
  9996. }
  9997. } else if ( nodeType === 3 || nodeType === 4 ) {
  9998. return elem.nodeValue;
  9999. }
  10000. // Do not include comment or processing instruction nodes
  10001. return ret;
  10002. };
  10003. Expr = Sizzle.selectors = {
  10004. // Can be adjusted by the user
  10005. cacheLength: 50,
  10006. createPseudo: markFunction,
  10007. match: matchExpr,
  10008. attrHandle: {},
  10009. find: {},
  10010. relative: {
  10011. ">": { dir: "parentNode", first: true },
  10012. " ": { dir: "parentNode" },
  10013. "+": { dir: "previousSibling", first: true },
  10014. "~": { dir: "previousSibling" }
  10015. },
  10016. preFilter: {
  10017. "ATTR": function( match ) {
  10018. match[1] = match[1].replace( runescape, funescape );
  10019. // Move the given value to match[3] whether quoted or unquoted
  10020. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10021. if ( match[2] === "~=" ) {
  10022. match[3] = " " + match[3] + " ";
  10023. }
  10024. return match.slice( 0, 4 );
  10025. },
  10026. "CHILD": function( match ) {
  10027. /* matches from matchExpr["CHILD"]
  10028. 1 type (only|nth|...)
  10029. 2 what (child|of-type)
  10030. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10031. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10032. 5 sign of xn-component
  10033. 6 x of xn-component
  10034. 7 sign of y-component
  10035. 8 y of y-component
  10036. */
  10037. match[1] = match[1].toLowerCase();
  10038. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10039. // nth-* requires argument
  10040. if ( !match[3] ) {
  10041. Sizzle.error( match[0] );
  10042. }
  10043. // numeric x and y parameters for Expr.filter.CHILD
  10044. // remember that false/true cast respectively to 0/1
  10045. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10046. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10047. // other types prohibit arguments
  10048. } else if ( match[3] ) {
  10049. Sizzle.error( match[0] );
  10050. }
  10051. return match;
  10052. },
  10053. "PSEUDO": function( match ) {
  10054. var excess,
  10055. unquoted = !match[6] && match[2];
  10056. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10057. return null;
  10058. }
  10059. // Accept quoted arguments as-is
  10060. if ( match[3] ) {
  10061. match[2] = match[4] || match[5] || "";
  10062. // Strip excess characters from unquoted arguments
  10063. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10064. // Get excess from tokenize (recursively)
  10065. (excess = tokenize( unquoted, true )) &&
  10066. // advance to the next closing parenthesis
  10067. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10068. // excess is a negative index
  10069. match[0] = match[0].slice( 0, excess );
  10070. match[2] = unquoted.slice( 0, excess );
  10071. }
  10072. // Return only captures needed by the pseudo filter method (type and argument)
  10073. return match.slice( 0, 3 );
  10074. }
  10075. },
  10076. filter: {
  10077. "TAG": function( nodeNameSelector ) {
  10078. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10079. return nodeNameSelector === "*" ?
  10080. function() { return true; } :
  10081. function( elem ) {
  10082. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10083. };
  10084. },
  10085. "CLASS": function( className ) {
  10086. var pattern = classCache[ className + " " ];
  10087. return pattern ||
  10088. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10089. classCache( className, function( elem ) {
  10090. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10091. });
  10092. },
  10093. "ATTR": function( name, operator, check ) {
  10094. return function( elem ) {
  10095. var result = Sizzle.attr( elem, name );
  10096. if ( result == null ) {
  10097. return operator === "!=";
  10098. }
  10099. if ( !operator ) {
  10100. return true;
  10101. }
  10102. result += "";
  10103. return operator === "=" ? result === check :
  10104. operator === "!=" ? result !== check :
  10105. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10106. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10107. operator === "$=" ? check && result.slice( -check.length ) === check :
  10108. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10109. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10110. false;
  10111. };
  10112. },
  10113. "CHILD": function( type, what, argument, first, last ) {
  10114. var simple = type.slice( 0, 3 ) !== "nth",
  10115. forward = type.slice( -4 ) !== "last",
  10116. ofType = what === "of-type";
  10117. return first === 1 && last === 0 ?
  10118. // Shortcut for :nth-*(n)
  10119. function( elem ) {
  10120. return !!elem.parentNode;
  10121. } :
  10122. function( elem, context, xml ) {
  10123. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10124. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10125. parent = elem.parentNode,
  10126. name = ofType && elem.nodeName.toLowerCase(),
  10127. useCache = !xml && !ofType,
  10128. diff = false;
  10129. if ( parent ) {
  10130. // :(first|last|only)-(child|of-type)
  10131. if ( simple ) {
  10132. while ( dir ) {
  10133. node = elem;
  10134. while ( (node = node[ dir ]) ) {
  10135. if ( ofType ?
  10136. node.nodeName.toLowerCase() === name :
  10137. node.nodeType === 1 ) {
  10138. return false;
  10139. }
  10140. }
  10141. // Reverse direction for :only-* (if we haven't yet done so)
  10142. start = dir = type === "only" && !start && "nextSibling";
  10143. }
  10144. return true;
  10145. }
  10146. start = [ forward ? parent.firstChild : parent.lastChild ];
  10147. // non-xml :nth-child(...) stores cache data on `parent`
  10148. if ( forward && useCache ) {
  10149. // Seek `elem` from a previously-cached index
  10150. // ...in a gzip-friendly way
  10151. node = parent;
  10152. outerCache = node[ expando ] || (node[ expando ] = {});
  10153. // Support: IE <9 only
  10154. // Defend against cloned attroperties (jQuery gh-1709)
  10155. uniqueCache = outerCache[ node.uniqueID ] ||
  10156. (outerCache[ node.uniqueID ] = {});
  10157. cache = uniqueCache[ type ] || [];
  10158. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10159. diff = nodeIndex && cache[ 2 ];
  10160. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10161. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10162. // Fallback to seeking `elem` from the start
  10163. (diff = nodeIndex = 0) || start.pop()) ) {
  10164. // When found, cache indexes on `parent` and break
  10165. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10166. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10167. break;
  10168. }
  10169. }
  10170. } else {
  10171. // Use previously-cached element index if available
  10172. if ( useCache ) {
  10173. // ...in a gzip-friendly way
  10174. node = elem;
  10175. outerCache = node[ expando ] || (node[ expando ] = {});
  10176. // Support: IE <9 only
  10177. // Defend against cloned attroperties (jQuery gh-1709)
  10178. uniqueCache = outerCache[ node.uniqueID ] ||
  10179. (outerCache[ node.uniqueID ] = {});
  10180. cache = uniqueCache[ type ] || [];
  10181. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10182. diff = nodeIndex;
  10183. }
  10184. // xml :nth-child(...)
  10185. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10186. if ( diff === false ) {
  10187. // Use the same loop as above to seek `elem` from the start
  10188. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10189. (diff = nodeIndex = 0) || start.pop()) ) {
  10190. if ( ( ofType ?
  10191. node.nodeName.toLowerCase() === name :
  10192. node.nodeType === 1 ) &&
  10193. ++diff ) {
  10194. // Cache the index of each encountered element
  10195. if ( useCache ) {
  10196. outerCache = node[ expando ] || (node[ expando ] = {});
  10197. // Support: IE <9 only
  10198. // Defend against cloned attroperties (jQuery gh-1709)
  10199. uniqueCache = outerCache[ node.uniqueID ] ||
  10200. (outerCache[ node.uniqueID ] = {});
  10201. uniqueCache[ type ] = [ dirruns, diff ];
  10202. }
  10203. if ( node === elem ) {
  10204. break;
  10205. }
  10206. }
  10207. }
  10208. }
  10209. }
  10210. // Incorporate the offset, then check against cycle size
  10211. diff -= last;
  10212. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10213. }
  10214. };
  10215. },
  10216. "PSEUDO": function( pseudo, argument ) {
  10217. // pseudo-class names are case-insensitive
  10218. // http://www.w3.org/TR/selectors/#pseudo-classes
  10219. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10220. // Remember that setFilters inherits from pseudos
  10221. var args,
  10222. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10223. Sizzle.error( "unsupported pseudo: " + pseudo );
  10224. // The user may use createPseudo to indicate that
  10225. // arguments are needed to create the filter function
  10226. // just as Sizzle does
  10227. if ( fn[ expando ] ) {
  10228. return fn( argument );
  10229. }
  10230. // But maintain support for old signatures
  10231. if ( fn.length > 1 ) {
  10232. args = [ pseudo, pseudo, "", argument ];
  10233. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10234. markFunction(function( seed, matches ) {
  10235. var idx,
  10236. matched = fn( seed, argument ),
  10237. i = matched.length;
  10238. while ( i-- ) {
  10239. idx = indexOf( seed, matched[i] );
  10240. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10241. }
  10242. }) :
  10243. function( elem ) {
  10244. return fn( elem, 0, args );
  10245. };
  10246. }
  10247. return fn;
  10248. }
  10249. },
  10250. pseudos: {
  10251. // Potentially complex pseudos
  10252. "not": markFunction(function( selector ) {
  10253. // Trim the selector passed to compile
  10254. // to avoid treating leading and trailing
  10255. // spaces as combinators
  10256. var input = [],
  10257. results = [],
  10258. matcher = compile( selector.replace( rtrim, "$1" ) );
  10259. return matcher[ expando ] ?
  10260. markFunction(function( seed, matches, context, xml ) {
  10261. var elem,
  10262. unmatched = matcher( seed, null, xml, [] ),
  10263. i = seed.length;
  10264. // Match elements unmatched by `matcher`
  10265. while ( i-- ) {
  10266. if ( (elem = unmatched[i]) ) {
  10267. seed[i] = !(matches[i] = elem);
  10268. }
  10269. }
  10270. }) :
  10271. function( elem, context, xml ) {
  10272. input[0] = elem;
  10273. matcher( input, null, xml, results );
  10274. // Don't keep the element (issue #299)
  10275. input[0] = null;
  10276. return !results.pop();
  10277. };
  10278. }),
  10279. "has": markFunction(function( selector ) {
  10280. return function( elem ) {
  10281. return Sizzle( selector, elem ).length > 0;
  10282. };
  10283. }),
  10284. "contains": markFunction(function( text ) {
  10285. text = text.replace( runescape, funescape );
  10286. return function( elem ) {
  10287. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10288. };
  10289. }),
  10290. // "Whether an element is represented by a :lang() selector
  10291. // is based solely on the element's language value
  10292. // being equal to the identifier C,
  10293. // or beginning with the identifier C immediately followed by "-".
  10294. // The matching of C against the element's language value is performed case-insensitively.
  10295. // The identifier C does not have to be a valid language name."
  10296. // http://www.w3.org/TR/selectors/#lang-pseudo
  10297. "lang": markFunction( function( lang ) {
  10298. // lang value must be a valid identifier
  10299. if ( !ridentifier.test(lang || "") ) {
  10300. Sizzle.error( "unsupported lang: " + lang );
  10301. }
  10302. lang = lang.replace( runescape, funescape ).toLowerCase();
  10303. return function( elem ) {
  10304. var elemLang;
  10305. do {
  10306. if ( (elemLang = documentIsHTML ?
  10307. elem.lang :
  10308. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10309. elemLang = elemLang.toLowerCase();
  10310. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10311. }
  10312. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10313. return false;
  10314. };
  10315. }),
  10316. // Miscellaneous
  10317. "target": function( elem ) {
  10318. var hash = window.location && window.location.hash;
  10319. return hash && hash.slice( 1 ) === elem.id;
  10320. },
  10321. "root": function( elem ) {
  10322. return elem === docElem;
  10323. },
  10324. "focus": function( elem ) {
  10325. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10326. },
  10327. // Boolean properties
  10328. "enabled": createDisabledPseudo( false ),
  10329. "disabled": createDisabledPseudo( true ),
  10330. "checked": function( elem ) {
  10331. // In CSS3, :checked should return both checked and selected elements
  10332. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10333. var nodeName = elem.nodeName.toLowerCase();
  10334. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10335. },
  10336. "selected": function( elem ) {
  10337. // Accessing this property makes selected-by-default
  10338. // options in Safari work properly
  10339. if ( elem.parentNode ) {
  10340. elem.parentNode.selectedIndex;
  10341. }
  10342. return elem.selected === true;
  10343. },
  10344. // Contents
  10345. "empty": function( elem ) {
  10346. // http://www.w3.org/TR/selectors/#empty-pseudo
  10347. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10348. // but not by others (comment: 8; processing instruction: 7; etc.)
  10349. // nodeType < 6 works because attributes (2) do not appear as children
  10350. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10351. if ( elem.nodeType < 6 ) {
  10352. return false;
  10353. }
  10354. }
  10355. return true;
  10356. },
  10357. "parent": function( elem ) {
  10358. return !Expr.pseudos["empty"]( elem );
  10359. },
  10360. // Element/input types
  10361. "header": function( elem ) {
  10362. return rheader.test( elem.nodeName );
  10363. },
  10364. "input": function( elem ) {
  10365. return rinputs.test( elem.nodeName );
  10366. },
  10367. "button": function( elem ) {
  10368. var name = elem.nodeName.toLowerCase();
  10369. return name === "input" && elem.type === "button" || name === "button";
  10370. },
  10371. "text": function( elem ) {
  10372. var attr;
  10373. return elem.nodeName.toLowerCase() === "input" &&
  10374. elem.type === "text" &&
  10375. // Support: IE<8
  10376. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10377. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10378. },
  10379. // Position-in-collection
  10380. "first": createPositionalPseudo(function() {
  10381. return [ 0 ];
  10382. }),
  10383. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10384. return [ length - 1 ];
  10385. }),
  10386. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10387. return [ argument < 0 ? argument + length : argument ];
  10388. }),
  10389. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10390. var i = 0;
  10391. for ( ; i < length; i += 2 ) {
  10392. matchIndexes.push( i );
  10393. }
  10394. return matchIndexes;
  10395. }),
  10396. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10397. var i = 1;
  10398. for ( ; i < length; i += 2 ) {
  10399. matchIndexes.push( i );
  10400. }
  10401. return matchIndexes;
  10402. }),
  10403. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10404. var i = argument < 0 ?
  10405. argument + length :
  10406. argument > length ?
  10407. length :
  10408. argument;
  10409. for ( ; --i >= 0; ) {
  10410. matchIndexes.push( i );
  10411. }
  10412. return matchIndexes;
  10413. }),
  10414. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10415. var i = argument < 0 ? argument + length : argument;
  10416. for ( ; ++i < length; ) {
  10417. matchIndexes.push( i );
  10418. }
  10419. return matchIndexes;
  10420. })
  10421. }
  10422. };
  10423. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10424. // Add button/input type pseudos
  10425. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10426. Expr.pseudos[ i ] = createInputPseudo( i );
  10427. }
  10428. for ( i in { submit: true, reset: true } ) {
  10429. Expr.pseudos[ i ] = createButtonPseudo( i );
  10430. }
  10431. // Easy API for creating new setFilters
  10432. function setFilters() {}
  10433. setFilters.prototype = Expr.filters = Expr.pseudos;
  10434. Expr.setFilters = new setFilters();
  10435. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10436. var matched, match, tokens, type,
  10437. soFar, groups, preFilters,
  10438. cached = tokenCache[ selector + " " ];
  10439. if ( cached ) {
  10440. return parseOnly ? 0 : cached.slice( 0 );
  10441. }
  10442. soFar = selector;
  10443. groups = [];
  10444. preFilters = Expr.preFilter;
  10445. while ( soFar ) {
  10446. // Comma and first run
  10447. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10448. if ( match ) {
  10449. // Don't consume trailing commas as valid
  10450. soFar = soFar.slice( match[0].length ) || soFar;
  10451. }
  10452. groups.push( (tokens = []) );
  10453. }
  10454. matched = false;
  10455. // Combinators
  10456. if ( (match = rcombinators.exec( soFar )) ) {
  10457. matched = match.shift();
  10458. tokens.push({
  10459. value: matched,
  10460. // Cast descendant combinators to space
  10461. type: match[0].replace( rtrim, " " )
  10462. });
  10463. soFar = soFar.slice( matched.length );
  10464. }
  10465. // Filters
  10466. for ( type in Expr.filter ) {
  10467. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10468. (match = preFilters[ type ]( match ))) ) {
  10469. matched = match.shift();
  10470. tokens.push({
  10471. value: matched,
  10472. type: type,
  10473. matches: match
  10474. });
  10475. soFar = soFar.slice( matched.length );
  10476. }
  10477. }
  10478. if ( !matched ) {
  10479. break;
  10480. }
  10481. }
  10482. // Return the length of the invalid excess
  10483. // if we're just parsing
  10484. // Otherwise, throw an error or return tokens
  10485. return parseOnly ?
  10486. soFar.length :
  10487. soFar ?
  10488. Sizzle.error( selector ) :
  10489. // Cache the tokens
  10490. tokenCache( selector, groups ).slice( 0 );
  10491. };
  10492. function toSelector( tokens ) {
  10493. var i = 0,
  10494. len = tokens.length,
  10495. selector = "";
  10496. for ( ; i < len; i++ ) {
  10497. selector += tokens[i].value;
  10498. }
  10499. return selector;
  10500. }
  10501. function addCombinator( matcher, combinator, base ) {
  10502. var dir = combinator.dir,
  10503. skip = combinator.next,
  10504. key = skip || dir,
  10505. checkNonElements = base && key === "parentNode",
  10506. doneName = done++;
  10507. return combinator.first ?
  10508. // Check against closest ancestor/preceding element
  10509. function( elem, context, xml ) {
  10510. while ( (elem = elem[ dir ]) ) {
  10511. if ( elem.nodeType === 1 || checkNonElements ) {
  10512. return matcher( elem, context, xml );
  10513. }
  10514. }
  10515. return false;
  10516. } :
  10517. // Check against all ancestor/preceding elements
  10518. function( elem, context, xml ) {
  10519. var oldCache, uniqueCache, outerCache,
  10520. newCache = [ dirruns, doneName ];
  10521. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10522. if ( xml ) {
  10523. while ( (elem = elem[ dir ]) ) {
  10524. if ( elem.nodeType === 1 || checkNonElements ) {
  10525. if ( matcher( elem, context, xml ) ) {
  10526. return true;
  10527. }
  10528. }
  10529. }
  10530. } else {
  10531. while ( (elem = elem[ dir ]) ) {
  10532. if ( elem.nodeType === 1 || checkNonElements ) {
  10533. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10534. // Support: IE <9 only
  10535. // Defend against cloned attroperties (jQuery gh-1709)
  10536. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10537. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10538. elem = elem[ dir ] || elem;
  10539. } else if ( (oldCache = uniqueCache[ key ]) &&
  10540. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10541. // Assign to newCache so results back-propagate to previous elements
  10542. return (newCache[ 2 ] = oldCache[ 2 ]);
  10543. } else {
  10544. // Reuse newcache so results back-propagate to previous elements
  10545. uniqueCache[ key ] = newCache;
  10546. // A match means we're done; a fail means we have to keep checking
  10547. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10548. return true;
  10549. }
  10550. }
  10551. }
  10552. }
  10553. }
  10554. return false;
  10555. };
  10556. }
  10557. function elementMatcher( matchers ) {
  10558. return matchers.length > 1 ?
  10559. function( elem, context, xml ) {
  10560. var i = matchers.length;
  10561. while ( i-- ) {
  10562. if ( !matchers[i]( elem, context, xml ) ) {
  10563. return false;
  10564. }
  10565. }
  10566. return true;
  10567. } :
  10568. matchers[0];
  10569. }
  10570. function multipleContexts( selector, contexts, results ) {
  10571. var i = 0,
  10572. len = contexts.length;
  10573. for ( ; i < len; i++ ) {
  10574. Sizzle( selector, contexts[i], results );
  10575. }
  10576. return results;
  10577. }
  10578. function condense( unmatched, map, filter, context, xml ) {
  10579. var elem,
  10580. newUnmatched = [],
  10581. i = 0,
  10582. len = unmatched.length,
  10583. mapped = map != null;
  10584. for ( ; i < len; i++ ) {
  10585. if ( (elem = unmatched[i]) ) {
  10586. if ( !filter || filter( elem, context, xml ) ) {
  10587. newUnmatched.push( elem );
  10588. if ( mapped ) {
  10589. map.push( i );
  10590. }
  10591. }
  10592. }
  10593. }
  10594. return newUnmatched;
  10595. }
  10596. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10597. if ( postFilter && !postFilter[ expando ] ) {
  10598. postFilter = setMatcher( postFilter );
  10599. }
  10600. if ( postFinder && !postFinder[ expando ] ) {
  10601. postFinder = setMatcher( postFinder, postSelector );
  10602. }
  10603. return markFunction(function( seed, results, context, xml ) {
  10604. var temp, i, elem,
  10605. preMap = [],
  10606. postMap = [],
  10607. preexisting = results.length,
  10608. // Get initial elements from seed or context
  10609. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10610. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10611. matcherIn = preFilter && ( seed || !selector ) ?
  10612. condense( elems, preMap, preFilter, context, xml ) :
  10613. elems,
  10614. matcherOut = matcher ?
  10615. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10616. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10617. // ...intermediate processing is necessary
  10618. [] :
  10619. // ...otherwise use results directly
  10620. results :
  10621. matcherIn;
  10622. // Find primary matches
  10623. if ( matcher ) {
  10624. matcher( matcherIn, matcherOut, context, xml );
  10625. }
  10626. // Apply postFilter
  10627. if ( postFilter ) {
  10628. temp = condense( matcherOut, postMap );
  10629. postFilter( temp, [], context, xml );
  10630. // Un-match failing elements by moving them back to matcherIn
  10631. i = temp.length;
  10632. while ( i-- ) {
  10633. if ( (elem = temp[i]) ) {
  10634. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10635. }
  10636. }
  10637. }
  10638. if ( seed ) {
  10639. if ( postFinder || preFilter ) {
  10640. if ( postFinder ) {
  10641. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10642. temp = [];
  10643. i = matcherOut.length;
  10644. while ( i-- ) {
  10645. if ( (elem = matcherOut[i]) ) {
  10646. // Restore matcherIn since elem is not yet a final match
  10647. temp.push( (matcherIn[i] = elem) );
  10648. }
  10649. }
  10650. postFinder( null, (matcherOut = []), temp, xml );
  10651. }
  10652. // Move matched elements from seed to results to keep them synchronized
  10653. i = matcherOut.length;
  10654. while ( i-- ) {
  10655. if ( (elem = matcherOut[i]) &&
  10656. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10657. seed[temp] = !(results[temp] = elem);
  10658. }
  10659. }
  10660. }
  10661. // Add elements to results, through postFinder if defined
  10662. } else {
  10663. matcherOut = condense(
  10664. matcherOut === results ?
  10665. matcherOut.splice( preexisting, matcherOut.length ) :
  10666. matcherOut
  10667. );
  10668. if ( postFinder ) {
  10669. postFinder( null, results, matcherOut, xml );
  10670. } else {
  10671. push.apply( results, matcherOut );
  10672. }
  10673. }
  10674. });
  10675. }
  10676. function matcherFromTokens( tokens ) {
  10677. var checkContext, matcher, j,
  10678. len = tokens.length,
  10679. leadingRelative = Expr.relative[ tokens[0].type ],
  10680. implicitRelative = leadingRelative || Expr.relative[" "],
  10681. i = leadingRelative ? 1 : 0,
  10682. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10683. matchContext = addCombinator( function( elem ) {
  10684. return elem === checkContext;
  10685. }, implicitRelative, true ),
  10686. matchAnyContext = addCombinator( function( elem ) {
  10687. return indexOf( checkContext, elem ) > -1;
  10688. }, implicitRelative, true ),
  10689. matchers = [ function( elem, context, xml ) {
  10690. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10691. (checkContext = context).nodeType ?
  10692. matchContext( elem, context, xml ) :
  10693. matchAnyContext( elem, context, xml ) );
  10694. // Avoid hanging onto element (issue #299)
  10695. checkContext = null;
  10696. return ret;
  10697. } ];
  10698. for ( ; i < len; i++ ) {
  10699. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10700. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10701. } else {
  10702. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10703. // Return special upon seeing a positional matcher
  10704. if ( matcher[ expando ] ) {
  10705. // Find the next relative operator (if any) for proper handling
  10706. j = ++i;
  10707. for ( ; j < len; j++ ) {
  10708. if ( Expr.relative[ tokens[j].type ] ) {
  10709. break;
  10710. }
  10711. }
  10712. return setMatcher(
  10713. i > 1 && elementMatcher( matchers ),
  10714. i > 1 && toSelector(
  10715. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10716. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10717. ).replace( rtrim, "$1" ),
  10718. matcher,
  10719. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10720. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10721. j < len && toSelector( tokens )
  10722. );
  10723. }
  10724. matchers.push( matcher );
  10725. }
  10726. }
  10727. return elementMatcher( matchers );
  10728. }
  10729. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10730. var bySet = setMatchers.length > 0,
  10731. byElement = elementMatchers.length > 0,
  10732. superMatcher = function( seed, context, xml, results, outermost ) {
  10733. var elem, j, matcher,
  10734. matchedCount = 0,
  10735. i = "0",
  10736. unmatched = seed && [],
  10737. setMatched = [],
  10738. contextBackup = outermostContext,
  10739. // We must always have either seed elements or outermost context
  10740. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10741. // Use integer dirruns iff this is the outermost matcher
  10742. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10743. len = elems.length;
  10744. if ( outermost ) {
  10745. outermostContext = context === document || context || outermost;
  10746. }
  10747. // Add elements passing elementMatchers directly to results
  10748. // Support: IE<9, Safari
  10749. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10750. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10751. if ( byElement && elem ) {
  10752. j = 0;
  10753. if ( !context && elem.ownerDocument !== document ) {
  10754. setDocument( elem );
  10755. xml = !documentIsHTML;
  10756. }
  10757. while ( (matcher = elementMatchers[j++]) ) {
  10758. if ( matcher( elem, context || document, xml) ) {
  10759. results.push( elem );
  10760. break;
  10761. }
  10762. }
  10763. if ( outermost ) {
  10764. dirruns = dirrunsUnique;
  10765. }
  10766. }
  10767. // Track unmatched elements for set filters
  10768. if ( bySet ) {
  10769. // They will have gone through all possible matchers
  10770. if ( (elem = !matcher && elem) ) {
  10771. matchedCount--;
  10772. }
  10773. // Lengthen the array for every element, matched or not
  10774. if ( seed ) {
  10775. unmatched.push( elem );
  10776. }
  10777. }
  10778. }
  10779. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10780. // makes the latter nonnegative.
  10781. matchedCount += i;
  10782. // Apply set filters to unmatched elements
  10783. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10784. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10785. // no element matchers and no seed.
  10786. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10787. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10788. // numerically zero.
  10789. if ( bySet && i !== matchedCount ) {
  10790. j = 0;
  10791. while ( (matcher = setMatchers[j++]) ) {
  10792. matcher( unmatched, setMatched, context, xml );
  10793. }
  10794. if ( seed ) {
  10795. // Reintegrate element matches to eliminate the need for sorting
  10796. if ( matchedCount > 0 ) {
  10797. while ( i-- ) {
  10798. if ( !(unmatched[i] || setMatched[i]) ) {
  10799. setMatched[i] = pop.call( results );
  10800. }
  10801. }
  10802. }
  10803. // Discard index placeholder values to get only actual matches
  10804. setMatched = condense( setMatched );
  10805. }
  10806. // Add matches to results
  10807. push.apply( results, setMatched );
  10808. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10809. if ( outermost && !seed && setMatched.length > 0 &&
  10810. ( matchedCount + setMatchers.length ) > 1 ) {
  10811. Sizzle.uniqueSort( results );
  10812. }
  10813. }
  10814. // Override manipulation of globals by nested matchers
  10815. if ( outermost ) {
  10816. dirruns = dirrunsUnique;
  10817. outermostContext = contextBackup;
  10818. }
  10819. return unmatched;
  10820. };
  10821. return bySet ?
  10822. markFunction( superMatcher ) :
  10823. superMatcher;
  10824. }
  10825. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10826. var i,
  10827. setMatchers = [],
  10828. elementMatchers = [],
  10829. cached = compilerCache[ selector + " " ];
  10830. if ( !cached ) {
  10831. // Generate a function of recursive functions that can be used to check each element
  10832. if ( !match ) {
  10833. match = tokenize( selector );
  10834. }
  10835. i = match.length;
  10836. while ( i-- ) {
  10837. cached = matcherFromTokens( match[i] );
  10838. if ( cached[ expando ] ) {
  10839. setMatchers.push( cached );
  10840. } else {
  10841. elementMatchers.push( cached );
  10842. }
  10843. }
  10844. // Cache the compiled function
  10845. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10846. // Save selector and tokenization
  10847. cached.selector = selector;
  10848. }
  10849. return cached;
  10850. };
  10851. /**
  10852. * A low-level selection function that works with Sizzle's compiled
  10853. * selector functions
  10854. * @param {String|Function} selector A selector or a pre-compiled
  10855. * selector function built with Sizzle.compile
  10856. * @param {Element} context
  10857. * @param {Array} [results]
  10858. * @param {Array} [seed] A set of elements to match against
  10859. */
  10860. select = Sizzle.select = function( selector, context, results, seed ) {
  10861. var i, tokens, token, type, find,
  10862. compiled = typeof selector === "function" && selector,
  10863. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10864. results = results || [];
  10865. // Try to minimize operations if there is only one selector in the list and no seed
  10866. // (the latter of which guarantees us context)
  10867. if ( match.length === 1 ) {
  10868. // Reduce context if the leading compound selector is an ID
  10869. tokens = match[0] = match[0].slice( 0 );
  10870. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10871. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10872. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10873. if ( !context ) {
  10874. return results;
  10875. // Precompiled matchers will still verify ancestry, so step up a level
  10876. } else if ( compiled ) {
  10877. context = context.parentNode;
  10878. }
  10879. selector = selector.slice( tokens.shift().value.length );
  10880. }
  10881. // Fetch a seed set for right-to-left matching
  10882. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10883. while ( i-- ) {
  10884. token = tokens[i];
  10885. // Abort if we hit a combinator
  10886. if ( Expr.relative[ (type = token.type) ] ) {
  10887. break;
  10888. }
  10889. if ( (find = Expr.find[ type ]) ) {
  10890. // Search, expanding context for leading sibling combinators
  10891. if ( (seed = find(
  10892. token.matches[0].replace( runescape, funescape ),
  10893. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10894. )) ) {
  10895. // If seed is empty or no tokens remain, we can return early
  10896. tokens.splice( i, 1 );
  10897. selector = seed.length && toSelector( tokens );
  10898. if ( !selector ) {
  10899. push.apply( results, seed );
  10900. return results;
  10901. }
  10902. break;
  10903. }
  10904. }
  10905. }
  10906. }
  10907. // Compile and execute a filtering function if one is not provided
  10908. // Provide `match` to avoid retokenization if we modified the selector above
  10909. ( compiled || compile( selector, match ) )(
  10910. seed,
  10911. context,
  10912. !documentIsHTML,
  10913. results,
  10914. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10915. );
  10916. return results;
  10917. };
  10918. // One-time assignments
  10919. // Sort stability
  10920. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10921. // Support: Chrome 14-35+
  10922. // Always assume duplicates if they aren't passed to the comparison function
  10923. support.detectDuplicates = !!hasDuplicate;
  10924. // Initialize against the default document
  10925. setDocument();
  10926. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10927. // Detached nodes confoundingly follow *each other*
  10928. support.sortDetached = assert(function( el ) {
  10929. // Should return 1, but returns 4 (following)
  10930. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10931. });
  10932. // Support: IE<8
  10933. // Prevent attribute/property "interpolation"
  10934. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10935. if ( !assert(function( el ) {
  10936. el.innerHTML = "<a href='#'></a>";
  10937. return el.firstChild.getAttribute("href") === "#" ;
  10938. }) ) {
  10939. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10940. if ( !isXML ) {
  10941. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10942. }
  10943. });
  10944. }
  10945. // Support: IE<9
  10946. // Use defaultValue in place of getAttribute("value")
  10947. if ( !support.attributes || !assert(function( el ) {
  10948. el.innerHTML = "<input/>";
  10949. el.firstChild.setAttribute( "value", "" );
  10950. return el.firstChild.getAttribute( "value" ) === "";
  10951. }) ) {
  10952. addHandle( "value", function( elem, name, isXML ) {
  10953. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10954. return elem.defaultValue;
  10955. }
  10956. });
  10957. }
  10958. // Support: IE<9
  10959. // Use getAttributeNode to fetch booleans when getAttribute lies
  10960. if ( !assert(function( el ) {
  10961. return el.getAttribute("disabled") == null;
  10962. }) ) {
  10963. addHandle( booleans, function( elem, name, isXML ) {
  10964. var val;
  10965. if ( !isXML ) {
  10966. return elem[ name ] === true ? name.toLowerCase() :
  10967. (val = elem.getAttributeNode( name )) && val.specified ?
  10968. val.value :
  10969. null;
  10970. }
  10971. });
  10972. }
  10973. return Sizzle;
  10974. })( window );
  10975. jQuery.find = Sizzle;
  10976. jQuery.expr = Sizzle.selectors;
  10977. // Deprecated
  10978. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10979. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10980. jQuery.text = Sizzle.getText;
  10981. jQuery.isXMLDoc = Sizzle.isXML;
  10982. jQuery.contains = Sizzle.contains;
  10983. jQuery.escapeSelector = Sizzle.escape;
  10984. var dir = function( elem, dir, until ) {
  10985. var matched = [],
  10986. truncate = until !== undefined;
  10987. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10988. if ( elem.nodeType === 1 ) {
  10989. if ( truncate && jQuery( elem ).is( until ) ) {
  10990. break;
  10991. }
  10992. matched.push( elem );
  10993. }
  10994. }
  10995. return matched;
  10996. };
  10997. var siblings = function( n, elem ) {
  10998. var matched = [];
  10999. for ( ; n; n = n.nextSibling ) {
  11000. if ( n.nodeType === 1 && n !== elem ) {
  11001. matched.push( n );
  11002. }
  11003. }
  11004. return matched;
  11005. };
  11006. var rneedsContext = jQuery.expr.match.needsContext;
  11007. function nodeName( elem, name ) {
  11008. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11009. };
  11010. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11011. // Implement the identical functionality for filter and not
  11012. function winnow( elements, qualifier, not ) {
  11013. if ( isFunction( qualifier ) ) {
  11014. return jQuery.grep( elements, function( elem, i ) {
  11015. return !!qualifier.call( elem, i, elem ) !== not;
  11016. } );
  11017. }
  11018. // Single element
  11019. if ( qualifier.nodeType ) {
  11020. return jQuery.grep( elements, function( elem ) {
  11021. return ( elem === qualifier ) !== not;
  11022. } );
  11023. }
  11024. // Arraylike of elements (jQuery, arguments, Array)
  11025. if ( typeof qualifier !== "string" ) {
  11026. return jQuery.grep( elements, function( elem ) {
  11027. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11028. } );
  11029. }
  11030. // Filtered directly for both simple and complex selectors
  11031. return jQuery.filter( qualifier, elements, not );
  11032. }
  11033. jQuery.filter = function( expr, elems, not ) {
  11034. var elem = elems[ 0 ];
  11035. if ( not ) {
  11036. expr = ":not(" + expr + ")";
  11037. }
  11038. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11039. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11040. }
  11041. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11042. return elem.nodeType === 1;
  11043. } ) );
  11044. };
  11045. jQuery.fn.extend( {
  11046. find: function( selector ) {
  11047. var i, ret,
  11048. len = this.length,
  11049. self = this;
  11050. if ( typeof selector !== "string" ) {
  11051. return this.pushStack( jQuery( selector ).filter( function() {
  11052. for ( i = 0; i < len; i++ ) {
  11053. if ( jQuery.contains( self[ i ], this ) ) {
  11054. return true;
  11055. }
  11056. }
  11057. } ) );
  11058. }
  11059. ret = this.pushStack( [] );
  11060. for ( i = 0; i < len; i++ ) {
  11061. jQuery.find( selector, self[ i ], ret );
  11062. }
  11063. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11064. },
  11065. filter: function( selector ) {
  11066. return this.pushStack( winnow( this, selector || [], false ) );
  11067. },
  11068. not: function( selector ) {
  11069. return this.pushStack( winnow( this, selector || [], true ) );
  11070. },
  11071. is: function( selector ) {
  11072. return !!winnow(
  11073. this,
  11074. // If this is a positional/relative selector, check membership in the returned set
  11075. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11076. typeof selector === "string" && rneedsContext.test( selector ) ?
  11077. jQuery( selector ) :
  11078. selector || [],
  11079. false
  11080. ).length;
  11081. }
  11082. } );
  11083. // Initialize a jQuery object
  11084. // A central reference to the root jQuery(document)
  11085. var rootjQuery,
  11086. // A simple way to check for HTML strings
  11087. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11088. // Strict HTML recognition (#11290: must start with <)
  11089. // Shortcut simple #id case for speed
  11090. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11091. init = jQuery.fn.init = function( selector, context, root ) {
  11092. var match, elem;
  11093. // HANDLE: $(""), $(null), $(undefined), $(false)
  11094. if ( !selector ) {
  11095. return this;
  11096. }
  11097. // Method init() accepts an alternate rootjQuery
  11098. // so migrate can support jQuery.sub (gh-2101)
  11099. root = root || rootjQuery;
  11100. // Handle HTML strings
  11101. if ( typeof selector === "string" ) {
  11102. if ( selector[ 0 ] === "<" &&
  11103. selector[ selector.length - 1 ] === ">" &&
  11104. selector.length >= 3 ) {
  11105. // Assume that strings that start and end with <> are HTML and skip the regex check
  11106. match = [ null, selector, null ];
  11107. } else {
  11108. match = rquickExpr.exec( selector );
  11109. }
  11110. // Match html or make sure no context is specified for #id
  11111. if ( match && ( match[ 1 ] || !context ) ) {
  11112. // HANDLE: $(html) -> $(array)
  11113. if ( match[ 1 ] ) {
  11114. context = context instanceof jQuery ? context[ 0 ] : context;
  11115. // Option to run scripts is true for back-compat
  11116. // Intentionally let the error be thrown if parseHTML is not present
  11117. jQuery.merge( this, jQuery.parseHTML(
  11118. match[ 1 ],
  11119. context && context.nodeType ? context.ownerDocument || context : document,
  11120. true
  11121. ) );
  11122. // HANDLE: $(html, props)
  11123. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11124. for ( match in context ) {
  11125. // Properties of context are called as methods if possible
  11126. if ( isFunction( this[ match ] ) ) {
  11127. this[ match ]( context[ match ] );
  11128. // ...and otherwise set as attributes
  11129. } else {
  11130. this.attr( match, context[ match ] );
  11131. }
  11132. }
  11133. }
  11134. return this;
  11135. // HANDLE: $(#id)
  11136. } else {
  11137. elem = document.getElementById( match[ 2 ] );
  11138. if ( elem ) {
  11139. // Inject the element directly into the jQuery object
  11140. this[ 0 ] = elem;
  11141. this.length = 1;
  11142. }
  11143. return this;
  11144. }
  11145. // HANDLE: $(expr, $(...))
  11146. } else if ( !context || context.jquery ) {
  11147. return ( context || root ).find( selector );
  11148. // HANDLE: $(expr, context)
  11149. // (which is just equivalent to: $(context).find(expr)
  11150. } else {
  11151. return this.constructor( context ).find( selector );
  11152. }
  11153. // HANDLE: $(DOMElement)
  11154. } else if ( selector.nodeType ) {
  11155. this[ 0 ] = selector;
  11156. this.length = 1;
  11157. return this;
  11158. // HANDLE: $(function)
  11159. // Shortcut for document ready
  11160. } else if ( isFunction( selector ) ) {
  11161. return root.ready !== undefined ?
  11162. root.ready( selector ) :
  11163. // Execute immediately if ready is not present
  11164. selector( jQuery );
  11165. }
  11166. return jQuery.makeArray( selector, this );
  11167. };
  11168. // Give the init function the jQuery prototype for later instantiation
  11169. init.prototype = jQuery.fn;
  11170. // Initialize central reference
  11171. rootjQuery = jQuery( document );
  11172. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11173. // Methods guaranteed to produce a unique set when starting from a unique set
  11174. guaranteedUnique = {
  11175. children: true,
  11176. contents: true,
  11177. next: true,
  11178. prev: true
  11179. };
  11180. jQuery.fn.extend( {
  11181. has: function( target ) {
  11182. var targets = jQuery( target, this ),
  11183. l = targets.length;
  11184. return this.filter( function() {
  11185. var i = 0;
  11186. for ( ; i < l; i++ ) {
  11187. if ( jQuery.contains( this, targets[ i ] ) ) {
  11188. return true;
  11189. }
  11190. }
  11191. } );
  11192. },
  11193. closest: function( selectors, context ) {
  11194. var cur,
  11195. i = 0,
  11196. l = this.length,
  11197. matched = [],
  11198. targets = typeof selectors !== "string" && jQuery( selectors );
  11199. // Positional selectors never match, since there's no _selection_ context
  11200. if ( !rneedsContext.test( selectors ) ) {
  11201. for ( ; i < l; i++ ) {
  11202. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11203. // Always skip document fragments
  11204. if ( cur.nodeType < 11 && ( targets ?
  11205. targets.index( cur ) > -1 :
  11206. // Don't pass non-elements to Sizzle
  11207. cur.nodeType === 1 &&
  11208. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11209. matched.push( cur );
  11210. break;
  11211. }
  11212. }
  11213. }
  11214. }
  11215. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11216. },
  11217. // Determine the position of an element within the set
  11218. index: function( elem ) {
  11219. // No argument, return index in parent
  11220. if ( !elem ) {
  11221. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11222. }
  11223. // Index in selector
  11224. if ( typeof elem === "string" ) {
  11225. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11226. }
  11227. // Locate the position of the desired element
  11228. return indexOf.call( this,
  11229. // If it receives a jQuery object, the first element is used
  11230. elem.jquery ? elem[ 0 ] : elem
  11231. );
  11232. },
  11233. add: function( selector, context ) {
  11234. return this.pushStack(
  11235. jQuery.uniqueSort(
  11236. jQuery.merge( this.get(), jQuery( selector, context ) )
  11237. )
  11238. );
  11239. },
  11240. addBack: function( selector ) {
  11241. return this.add( selector == null ?
  11242. this.prevObject : this.prevObject.filter( selector )
  11243. );
  11244. }
  11245. } );
  11246. function sibling( cur, dir ) {
  11247. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11248. return cur;
  11249. }
  11250. jQuery.each( {
  11251. parent: function( elem ) {
  11252. var parent = elem.parentNode;
  11253. return parent && parent.nodeType !== 11 ? parent : null;
  11254. },
  11255. parents: function( elem ) {
  11256. return dir( elem, "parentNode" );
  11257. },
  11258. parentsUntil: function( elem, i, until ) {
  11259. return dir( elem, "parentNode", until );
  11260. },
  11261. next: function( elem ) {
  11262. return sibling( elem, "nextSibling" );
  11263. },
  11264. prev: function( elem ) {
  11265. return sibling( elem, "previousSibling" );
  11266. },
  11267. nextAll: function( elem ) {
  11268. return dir( elem, "nextSibling" );
  11269. },
  11270. prevAll: function( elem ) {
  11271. return dir( elem, "previousSibling" );
  11272. },
  11273. nextUntil: function( elem, i, until ) {
  11274. return dir( elem, "nextSibling", until );
  11275. },
  11276. prevUntil: function( elem, i, until ) {
  11277. return dir( elem, "previousSibling", until );
  11278. },
  11279. siblings: function( elem ) {
  11280. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11281. },
  11282. children: function( elem ) {
  11283. return siblings( elem.firstChild );
  11284. },
  11285. contents: function( elem ) {
  11286. if ( typeof elem.contentDocument !== "undefined" ) {
  11287. return elem.contentDocument;
  11288. }
  11289. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11290. // Treat the template element as a regular one in browsers that
  11291. // don't support it.
  11292. if ( nodeName( elem, "template" ) ) {
  11293. elem = elem.content || elem;
  11294. }
  11295. return jQuery.merge( [], elem.childNodes );
  11296. }
  11297. }, function( name, fn ) {
  11298. jQuery.fn[ name ] = function( until, selector ) {
  11299. var matched = jQuery.map( this, fn, until );
  11300. if ( name.slice( -5 ) !== "Until" ) {
  11301. selector = until;
  11302. }
  11303. if ( selector && typeof selector === "string" ) {
  11304. matched = jQuery.filter( selector, matched );
  11305. }
  11306. if ( this.length > 1 ) {
  11307. // Remove duplicates
  11308. if ( !guaranteedUnique[ name ] ) {
  11309. jQuery.uniqueSort( matched );
  11310. }
  11311. // Reverse order for parents* and prev-derivatives
  11312. if ( rparentsprev.test( name ) ) {
  11313. matched.reverse();
  11314. }
  11315. }
  11316. return this.pushStack( matched );
  11317. };
  11318. } );
  11319. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11320. // Convert String-formatted options into Object-formatted ones
  11321. function createOptions( options ) {
  11322. var object = {};
  11323. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11324. object[ flag ] = true;
  11325. } );
  11326. return object;
  11327. }
  11328. /*
  11329. * Create a callback list using the following parameters:
  11330. *
  11331. * options: an optional list of space-separated options that will change how
  11332. * the callback list behaves or a more traditional option object
  11333. *
  11334. * By default a callback list will act like an event callback list and can be
  11335. * "fired" multiple times.
  11336. *
  11337. * Possible options:
  11338. *
  11339. * once: will ensure the callback list can only be fired once (like a Deferred)
  11340. *
  11341. * memory: will keep track of previous values and will call any callback added
  11342. * after the list has been fired right away with the latest "memorized"
  11343. * values (like a Deferred)
  11344. *
  11345. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11346. *
  11347. * stopOnFalse: interrupt callings when a callback returns false
  11348. *
  11349. */
  11350. jQuery.Callbacks = function( options ) {
  11351. // Convert options from String-formatted to Object-formatted if needed
  11352. // (we check in cache first)
  11353. options = typeof options === "string" ?
  11354. createOptions( options ) :
  11355. jQuery.extend( {}, options );
  11356. var // Flag to know if list is currently firing
  11357. firing,
  11358. // Last fire value for non-forgettable lists
  11359. memory,
  11360. // Flag to know if list was already fired
  11361. fired,
  11362. // Flag to prevent firing
  11363. locked,
  11364. // Actual callback list
  11365. list = [],
  11366. // Queue of execution data for repeatable lists
  11367. queue = [],
  11368. // Index of currently firing callback (modified by add/remove as needed)
  11369. firingIndex = -1,
  11370. // Fire callbacks
  11371. fire = function() {
  11372. // Enforce single-firing
  11373. locked = locked || options.once;
  11374. // Execute callbacks for all pending executions,
  11375. // respecting firingIndex overrides and runtime changes
  11376. fired = firing = true;
  11377. for ( ; queue.length; firingIndex = -1 ) {
  11378. memory = queue.shift();
  11379. while ( ++firingIndex < list.length ) {
  11380. // Run callback and check for early termination
  11381. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11382. options.stopOnFalse ) {
  11383. // Jump to end and forget the data so .add doesn't re-fire
  11384. firingIndex = list.length;
  11385. memory = false;
  11386. }
  11387. }
  11388. }
  11389. // Forget the data if we're done with it
  11390. if ( !options.memory ) {
  11391. memory = false;
  11392. }
  11393. firing = false;
  11394. // Clean up if we're done firing for good
  11395. if ( locked ) {
  11396. // Keep an empty list if we have data for future add calls
  11397. if ( memory ) {
  11398. list = [];
  11399. // Otherwise, this object is spent
  11400. } else {
  11401. list = "";
  11402. }
  11403. }
  11404. },
  11405. // Actual Callbacks object
  11406. self = {
  11407. // Add a callback or a collection of callbacks to the list
  11408. add: function() {
  11409. if ( list ) {
  11410. // If we have memory from a past run, we should fire after adding
  11411. if ( memory && !firing ) {
  11412. firingIndex = list.length - 1;
  11413. queue.push( memory );
  11414. }
  11415. ( function add( args ) {
  11416. jQuery.each( args, function( _, arg ) {
  11417. if ( isFunction( arg ) ) {
  11418. if ( !options.unique || !self.has( arg ) ) {
  11419. list.push( arg );
  11420. }
  11421. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11422. // Inspect recursively
  11423. add( arg );
  11424. }
  11425. } );
  11426. } )( arguments );
  11427. if ( memory && !firing ) {
  11428. fire();
  11429. }
  11430. }
  11431. return this;
  11432. },
  11433. // Remove a callback from the list
  11434. remove: function() {
  11435. jQuery.each( arguments, function( _, arg ) {
  11436. var index;
  11437. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11438. list.splice( index, 1 );
  11439. // Handle firing indexes
  11440. if ( index <= firingIndex ) {
  11441. firingIndex--;
  11442. }
  11443. }
  11444. } );
  11445. return this;
  11446. },
  11447. // Check if a given callback is in the list.
  11448. // If no argument is given, return whether or not list has callbacks attached.
  11449. has: function( fn ) {
  11450. return fn ?
  11451. jQuery.inArray( fn, list ) > -1 :
  11452. list.length > 0;
  11453. },
  11454. // Remove all callbacks from the list
  11455. empty: function() {
  11456. if ( list ) {
  11457. list = [];
  11458. }
  11459. return this;
  11460. },
  11461. // Disable .fire and .add
  11462. // Abort any current/pending executions
  11463. // Clear all callbacks and values
  11464. disable: function() {
  11465. locked = queue = [];
  11466. list = memory = "";
  11467. return this;
  11468. },
  11469. disabled: function() {
  11470. return !list;
  11471. },
  11472. // Disable .fire
  11473. // Also disable .add unless we have memory (since it would have no effect)
  11474. // Abort any pending executions
  11475. lock: function() {
  11476. locked = queue = [];
  11477. if ( !memory && !firing ) {
  11478. list = memory = "";
  11479. }
  11480. return this;
  11481. },
  11482. locked: function() {
  11483. return !!locked;
  11484. },
  11485. // Call all callbacks with the given context and arguments
  11486. fireWith: function( context, args ) {
  11487. if ( !locked ) {
  11488. args = args || [];
  11489. args = [ context, args.slice ? args.slice() : args ];
  11490. queue.push( args );
  11491. if ( !firing ) {
  11492. fire();
  11493. }
  11494. }
  11495. return this;
  11496. },
  11497. // Call all the callbacks with the given arguments
  11498. fire: function() {
  11499. self.fireWith( this, arguments );
  11500. return this;
  11501. },
  11502. // To know if the callbacks have already been called at least once
  11503. fired: function() {
  11504. return !!fired;
  11505. }
  11506. };
  11507. return self;
  11508. };
  11509. function Identity( v ) {
  11510. return v;
  11511. }
  11512. function Thrower( ex ) {
  11513. throw ex;
  11514. }
  11515. function adoptValue( value, resolve, reject, noValue ) {
  11516. var method;
  11517. try {
  11518. // Check for promise aspect first to privilege synchronous behavior
  11519. if ( value && isFunction( ( method = value.promise ) ) ) {
  11520. method.call( value ).done( resolve ).fail( reject );
  11521. // Other thenables
  11522. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11523. method.call( value, resolve, reject );
  11524. // Other non-thenables
  11525. } else {
  11526. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11527. // * false: [ value ].slice( 0 ) => resolve( value )
  11528. // * true: [ value ].slice( 1 ) => resolve()
  11529. resolve.apply( undefined, [ value ].slice( noValue ) );
  11530. }
  11531. // For Promises/A+, convert exceptions into rejections
  11532. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11533. // Deferred#then to conditionally suppress rejection.
  11534. } catch ( value ) {
  11535. // Support: Android 4.0 only
  11536. // Strict mode functions invoked without .call/.apply get global-object context
  11537. reject.apply( undefined, [ value ] );
  11538. }
  11539. }
  11540. jQuery.extend( {
  11541. Deferred: function( func ) {
  11542. var tuples = [
  11543. // action, add listener, callbacks,
  11544. // ... .then handlers, argument index, [final state]
  11545. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11546. jQuery.Callbacks( "memory" ), 2 ],
  11547. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11548. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11549. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11550. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11551. ],
  11552. state = "pending",
  11553. promise = {
  11554. state: function() {
  11555. return state;
  11556. },
  11557. always: function() {
  11558. deferred.done( arguments ).fail( arguments );
  11559. return this;
  11560. },
  11561. "catch": function( fn ) {
  11562. return promise.then( null, fn );
  11563. },
  11564. // Keep pipe for back-compat
  11565. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11566. var fns = arguments;
  11567. return jQuery.Deferred( function( newDefer ) {
  11568. jQuery.each( tuples, function( i, tuple ) {
  11569. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11570. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11571. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11572. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11573. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11574. deferred[ tuple[ 1 ] ]( function() {
  11575. var returned = fn && fn.apply( this, arguments );
  11576. if ( returned && isFunction( returned.promise ) ) {
  11577. returned.promise()
  11578. .progress( newDefer.notify )
  11579. .done( newDefer.resolve )
  11580. .fail( newDefer.reject );
  11581. } else {
  11582. newDefer[ tuple[ 0 ] + "With" ](
  11583. this,
  11584. fn ? [ returned ] : arguments
  11585. );
  11586. }
  11587. } );
  11588. } );
  11589. fns = null;
  11590. } ).promise();
  11591. },
  11592. then: function( onFulfilled, onRejected, onProgress ) {
  11593. var maxDepth = 0;
  11594. function resolve( depth, deferred, handler, special ) {
  11595. return function() {
  11596. var that = this,
  11597. args = arguments,
  11598. mightThrow = function() {
  11599. var returned, then;
  11600. // Support: Promises/A+ section 2.3.3.3.3
  11601. // https://promisesaplus.com/#point-59
  11602. // Ignore double-resolution attempts
  11603. if ( depth < maxDepth ) {
  11604. return;
  11605. }
  11606. returned = handler.apply( that, args );
  11607. // Support: Promises/A+ section 2.3.1
  11608. // https://promisesaplus.com/#point-48
  11609. if ( returned === deferred.promise() ) {
  11610. throw new TypeError( "Thenable self-resolution" );
  11611. }
  11612. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11613. // https://promisesaplus.com/#point-54
  11614. // https://promisesaplus.com/#point-75
  11615. // Retrieve `then` only once
  11616. then = returned &&
  11617. // Support: Promises/A+ section 2.3.4
  11618. // https://promisesaplus.com/#point-64
  11619. // Only check objects and functions for thenability
  11620. ( typeof returned === "object" ||
  11621. typeof returned === "function" ) &&
  11622. returned.then;
  11623. // Handle a returned thenable
  11624. if ( isFunction( then ) ) {
  11625. // Special processors (notify) just wait for resolution
  11626. if ( special ) {
  11627. then.call(
  11628. returned,
  11629. resolve( maxDepth, deferred, Identity, special ),
  11630. resolve( maxDepth, deferred, Thrower, special )
  11631. );
  11632. // Normal processors (resolve) also hook into progress
  11633. } else {
  11634. // ...and disregard older resolution values
  11635. maxDepth++;
  11636. then.call(
  11637. returned,
  11638. resolve( maxDepth, deferred, Identity, special ),
  11639. resolve( maxDepth, deferred, Thrower, special ),
  11640. resolve( maxDepth, deferred, Identity,
  11641. deferred.notifyWith )
  11642. );
  11643. }
  11644. // Handle all other returned values
  11645. } else {
  11646. // Only substitute handlers pass on context
  11647. // and multiple values (non-spec behavior)
  11648. if ( handler !== Identity ) {
  11649. that = undefined;
  11650. args = [ returned ];
  11651. }
  11652. // Process the value(s)
  11653. // Default process is resolve
  11654. ( special || deferred.resolveWith )( that, args );
  11655. }
  11656. },
  11657. // Only normal processors (resolve) catch and reject exceptions
  11658. process = special ?
  11659. mightThrow :
  11660. function() {
  11661. try {
  11662. mightThrow();
  11663. } catch ( e ) {
  11664. if ( jQuery.Deferred.exceptionHook ) {
  11665. jQuery.Deferred.exceptionHook( e,
  11666. process.stackTrace );
  11667. }
  11668. // Support: Promises/A+ section 2.3.3.3.4.1
  11669. // https://promisesaplus.com/#point-61
  11670. // Ignore post-resolution exceptions
  11671. if ( depth + 1 >= maxDepth ) {
  11672. // Only substitute handlers pass on context
  11673. // and multiple values (non-spec behavior)
  11674. if ( handler !== Thrower ) {
  11675. that = undefined;
  11676. args = [ e ];
  11677. }
  11678. deferred.rejectWith( that, args );
  11679. }
  11680. }
  11681. };
  11682. // Support: Promises/A+ section 2.3.3.3.1
  11683. // https://promisesaplus.com/#point-57
  11684. // Re-resolve promises immediately to dodge false rejection from
  11685. // subsequent errors
  11686. if ( depth ) {
  11687. process();
  11688. } else {
  11689. // Call an optional hook to record the stack, in case of exception
  11690. // since it's otherwise lost when execution goes async
  11691. if ( jQuery.Deferred.getStackHook ) {
  11692. process.stackTrace = jQuery.Deferred.getStackHook();
  11693. }
  11694. window.setTimeout( process );
  11695. }
  11696. };
  11697. }
  11698. return jQuery.Deferred( function( newDefer ) {
  11699. // progress_handlers.add( ... )
  11700. tuples[ 0 ][ 3 ].add(
  11701. resolve(
  11702. 0,
  11703. newDefer,
  11704. isFunction( onProgress ) ?
  11705. onProgress :
  11706. Identity,
  11707. newDefer.notifyWith
  11708. )
  11709. );
  11710. // fulfilled_handlers.add( ... )
  11711. tuples[ 1 ][ 3 ].add(
  11712. resolve(
  11713. 0,
  11714. newDefer,
  11715. isFunction( onFulfilled ) ?
  11716. onFulfilled :
  11717. Identity
  11718. )
  11719. );
  11720. // rejected_handlers.add( ... )
  11721. tuples[ 2 ][ 3 ].add(
  11722. resolve(
  11723. 0,
  11724. newDefer,
  11725. isFunction( onRejected ) ?
  11726. onRejected :
  11727. Thrower
  11728. )
  11729. );
  11730. } ).promise();
  11731. },
  11732. // Get a promise for this deferred
  11733. // If obj is provided, the promise aspect is added to the object
  11734. promise: function( obj ) {
  11735. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11736. }
  11737. },
  11738. deferred = {};
  11739. // Add list-specific methods
  11740. jQuery.each( tuples, function( i, tuple ) {
  11741. var list = tuple[ 2 ],
  11742. stateString = tuple[ 5 ];
  11743. // promise.progress = list.add
  11744. // promise.done = list.add
  11745. // promise.fail = list.add
  11746. promise[ tuple[ 1 ] ] = list.add;
  11747. // Handle state
  11748. if ( stateString ) {
  11749. list.add(
  11750. function() {
  11751. // state = "resolved" (i.e., fulfilled)
  11752. // state = "rejected"
  11753. state = stateString;
  11754. },
  11755. // rejected_callbacks.disable
  11756. // fulfilled_callbacks.disable
  11757. tuples[ 3 - i ][ 2 ].disable,
  11758. // rejected_handlers.disable
  11759. // fulfilled_handlers.disable
  11760. tuples[ 3 - i ][ 3 ].disable,
  11761. // progress_callbacks.lock
  11762. tuples[ 0 ][ 2 ].lock,
  11763. // progress_handlers.lock
  11764. tuples[ 0 ][ 3 ].lock
  11765. );
  11766. }
  11767. // progress_handlers.fire
  11768. // fulfilled_handlers.fire
  11769. // rejected_handlers.fire
  11770. list.add( tuple[ 3 ].fire );
  11771. // deferred.notify = function() { deferred.notifyWith(...) }
  11772. // deferred.resolve = function() { deferred.resolveWith(...) }
  11773. // deferred.reject = function() { deferred.rejectWith(...) }
  11774. deferred[ tuple[ 0 ] ] = function() {
  11775. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11776. return this;
  11777. };
  11778. // deferred.notifyWith = list.fireWith
  11779. // deferred.resolveWith = list.fireWith
  11780. // deferred.rejectWith = list.fireWith
  11781. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11782. } );
  11783. // Make the deferred a promise
  11784. promise.promise( deferred );
  11785. // Call given func if any
  11786. if ( func ) {
  11787. func.call( deferred, deferred );
  11788. }
  11789. // All done!
  11790. return deferred;
  11791. },
  11792. // Deferred helper
  11793. when: function( singleValue ) {
  11794. var
  11795. // count of uncompleted subordinates
  11796. remaining = arguments.length,
  11797. // count of unprocessed arguments
  11798. i = remaining,
  11799. // subordinate fulfillment data
  11800. resolveContexts = Array( i ),
  11801. resolveValues = slice.call( arguments ),
  11802. // the master Deferred
  11803. master = jQuery.Deferred(),
  11804. // subordinate callback factory
  11805. updateFunc = function( i ) {
  11806. return function( value ) {
  11807. resolveContexts[ i ] = this;
  11808. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11809. if ( !( --remaining ) ) {
  11810. master.resolveWith( resolveContexts, resolveValues );
  11811. }
  11812. };
  11813. };
  11814. // Single- and empty arguments are adopted like Promise.resolve
  11815. if ( remaining <= 1 ) {
  11816. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11817. !remaining );
  11818. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11819. if ( master.state() === "pending" ||
  11820. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11821. return master.then();
  11822. }
  11823. }
  11824. // Multiple arguments are aggregated like Promise.all array elements
  11825. while ( i-- ) {
  11826. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11827. }
  11828. return master.promise();
  11829. }
  11830. } );
  11831. // These usually indicate a programmer mistake during development,
  11832. // warn about them ASAP rather than swallowing them by default.
  11833. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11834. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11835. // Support: IE 8 - 9 only
  11836. // Console exists when dev tools are open, which can happen at any time
  11837. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11838. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11839. }
  11840. };
  11841. jQuery.readyException = function( error ) {
  11842. window.setTimeout( function() {
  11843. throw error;
  11844. } );
  11845. };
  11846. // The deferred used on DOM ready
  11847. var readyList = jQuery.Deferred();
  11848. jQuery.fn.ready = function( fn ) {
  11849. readyList
  11850. .then( fn )
  11851. // Wrap jQuery.readyException in a function so that the lookup
  11852. // happens at the time of error handling instead of callback
  11853. // registration.
  11854. .catch( function( error ) {
  11855. jQuery.readyException( error );
  11856. } );
  11857. return this;
  11858. };
  11859. jQuery.extend( {
  11860. // Is the DOM ready to be used? Set to true once it occurs.
  11861. isReady: false,
  11862. // A counter to track how many items to wait for before
  11863. // the ready event fires. See #6781
  11864. readyWait: 1,
  11865. // Handle when the DOM is ready
  11866. ready: function( wait ) {
  11867. // Abort if there are pending holds or we're already ready
  11868. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11869. return;
  11870. }
  11871. // Remember that the DOM is ready
  11872. jQuery.isReady = true;
  11873. // If a normal DOM Ready event fired, decrement, and wait if need be
  11874. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11875. return;
  11876. }
  11877. // If there are functions bound, to execute
  11878. readyList.resolveWith( document, [ jQuery ] );
  11879. }
  11880. } );
  11881. jQuery.ready.then = readyList.then;
  11882. // The ready event handler and self cleanup method
  11883. function completed() {
  11884. document.removeEventListener( "DOMContentLoaded", completed );
  11885. window.removeEventListener( "load", completed );
  11886. jQuery.ready();
  11887. }
  11888. // Catch cases where $(document).ready() is called
  11889. // after the browser event has already occurred.
  11890. // Support: IE <=9 - 10 only
  11891. // Older IE sometimes signals "interactive" too soon
  11892. if ( document.readyState === "complete" ||
  11893. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11894. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11895. window.setTimeout( jQuery.ready );
  11896. } else {
  11897. // Use the handy event callback
  11898. document.addEventListener( "DOMContentLoaded", completed );
  11899. // A fallback to window.onload, that will always work
  11900. window.addEventListener( "load", completed );
  11901. }
  11902. // Multifunctional method to get and set values of a collection
  11903. // The value/s can optionally be executed if it's a function
  11904. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11905. var i = 0,
  11906. len = elems.length,
  11907. bulk = key == null;
  11908. // Sets many values
  11909. if ( toType( key ) === "object" ) {
  11910. chainable = true;
  11911. for ( i in key ) {
  11912. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11913. }
  11914. // Sets one value
  11915. } else if ( value !== undefined ) {
  11916. chainable = true;
  11917. if ( !isFunction( value ) ) {
  11918. raw = true;
  11919. }
  11920. if ( bulk ) {
  11921. // Bulk operations run against the entire set
  11922. if ( raw ) {
  11923. fn.call( elems, value );
  11924. fn = null;
  11925. // ...except when executing function values
  11926. } else {
  11927. bulk = fn;
  11928. fn = function( elem, key, value ) {
  11929. return bulk.call( jQuery( elem ), value );
  11930. };
  11931. }
  11932. }
  11933. if ( fn ) {
  11934. for ( ; i < len; i++ ) {
  11935. fn(
  11936. elems[ i ], key, raw ?
  11937. value :
  11938. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11939. );
  11940. }
  11941. }
  11942. }
  11943. if ( chainable ) {
  11944. return elems;
  11945. }
  11946. // Gets
  11947. if ( bulk ) {
  11948. return fn.call( elems );
  11949. }
  11950. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11951. };
  11952. // Matches dashed string for camelizing
  11953. var rmsPrefix = /^-ms-/,
  11954. rdashAlpha = /-([a-z])/g;
  11955. // Used by camelCase as callback to replace()
  11956. function fcamelCase( all, letter ) {
  11957. return letter.toUpperCase();
  11958. }
  11959. // Convert dashed to camelCase; used by the css and data modules
  11960. // Support: IE <=9 - 11, Edge 12 - 15
  11961. // Microsoft forgot to hump their vendor prefix (#9572)
  11962. function camelCase( string ) {
  11963. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11964. }
  11965. var acceptData = function( owner ) {
  11966. // Accepts only:
  11967. // - Node
  11968. // - Node.ELEMENT_NODE
  11969. // - Node.DOCUMENT_NODE
  11970. // - Object
  11971. // - Any
  11972. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11973. };
  11974. function Data() {
  11975. this.expando = jQuery.expando + Data.uid++;
  11976. }
  11977. Data.uid = 1;
  11978. Data.prototype = {
  11979. cache: function( owner ) {
  11980. // Check if the owner object already has a cache
  11981. var value = owner[ this.expando ];
  11982. // If not, create one
  11983. if ( !value ) {
  11984. value = {};
  11985. // We can accept data for non-element nodes in modern browsers,
  11986. // but we should not, see #8335.
  11987. // Always return an empty object.
  11988. if ( acceptData( owner ) ) {
  11989. // If it is a node unlikely to be stringify-ed or looped over
  11990. // use plain assignment
  11991. if ( owner.nodeType ) {
  11992. owner[ this.expando ] = value;
  11993. // Otherwise secure it in a non-enumerable property
  11994. // configurable must be true to allow the property to be
  11995. // deleted when data is removed
  11996. } else {
  11997. Object.defineProperty( owner, this.expando, {
  11998. value: value,
  11999. configurable: true
  12000. } );
  12001. }
  12002. }
  12003. }
  12004. return value;
  12005. },
  12006. set: function( owner, data, value ) {
  12007. var prop,
  12008. cache = this.cache( owner );
  12009. // Handle: [ owner, key, value ] args
  12010. // Always use camelCase key (gh-2257)
  12011. if ( typeof data === "string" ) {
  12012. cache[ camelCase( data ) ] = value;
  12013. // Handle: [ owner, { properties } ] args
  12014. } else {
  12015. // Copy the properties one-by-one to the cache object
  12016. for ( prop in data ) {
  12017. cache[ camelCase( prop ) ] = data[ prop ];
  12018. }
  12019. }
  12020. return cache;
  12021. },
  12022. get: function( owner, key ) {
  12023. return key === undefined ?
  12024. this.cache( owner ) :
  12025. // Always use camelCase key (gh-2257)
  12026. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12027. },
  12028. access: function( owner, key, value ) {
  12029. // In cases where either:
  12030. //
  12031. // 1. No key was specified
  12032. // 2. A string key was specified, but no value provided
  12033. //
  12034. // Take the "read" path and allow the get method to determine
  12035. // which value to return, respectively either:
  12036. //
  12037. // 1. The entire cache object
  12038. // 2. The data stored at the key
  12039. //
  12040. if ( key === undefined ||
  12041. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12042. return this.get( owner, key );
  12043. }
  12044. // When the key is not a string, or both a key and value
  12045. // are specified, set or extend (existing objects) with either:
  12046. //
  12047. // 1. An object of properties
  12048. // 2. A key and value
  12049. //
  12050. this.set( owner, key, value );
  12051. // Since the "set" path can have two possible entry points
  12052. // return the expected data based on which path was taken[*]
  12053. return value !== undefined ? value : key;
  12054. },
  12055. remove: function( owner, key ) {
  12056. var i,
  12057. cache = owner[ this.expando ];
  12058. if ( cache === undefined ) {
  12059. return;
  12060. }
  12061. if ( key !== undefined ) {
  12062. // Support array or space separated string of keys
  12063. if ( Array.isArray( key ) ) {
  12064. // If key is an array of keys...
  12065. // We always set camelCase keys, so remove that.
  12066. key = key.map( camelCase );
  12067. } else {
  12068. key = camelCase( key );
  12069. // If a key with the spaces exists, use it.
  12070. // Otherwise, create an array by matching non-whitespace
  12071. key = key in cache ?
  12072. [ key ] :
  12073. ( key.match( rnothtmlwhite ) || [] );
  12074. }
  12075. i = key.length;
  12076. while ( i-- ) {
  12077. delete cache[ key[ i ] ];
  12078. }
  12079. }
  12080. // Remove the expando if there's no more data
  12081. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12082. // Support: Chrome <=35 - 45
  12083. // Webkit & Blink performance suffers when deleting properties
  12084. // from DOM nodes, so set to undefined instead
  12085. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12086. if ( owner.nodeType ) {
  12087. owner[ this.expando ] = undefined;
  12088. } else {
  12089. delete owner[ this.expando ];
  12090. }
  12091. }
  12092. },
  12093. hasData: function( owner ) {
  12094. var cache = owner[ this.expando ];
  12095. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12096. }
  12097. };
  12098. var dataPriv = new Data();
  12099. var dataUser = new Data();
  12100. // Implementation Summary
  12101. //
  12102. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12103. // 2. Improve the module's maintainability by reducing the storage
  12104. // paths to a single mechanism.
  12105. // 3. Use the same single mechanism to support "private" and "user" data.
  12106. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12107. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12108. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12109. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12110. rmultiDash = /[A-Z]/g;
  12111. function getData( data ) {
  12112. if ( data === "true" ) {
  12113. return true;
  12114. }
  12115. if ( data === "false" ) {
  12116. return false;
  12117. }
  12118. if ( data === "null" ) {
  12119. return null;
  12120. }
  12121. // Only convert to a number if it doesn't change the string
  12122. if ( data === +data + "" ) {
  12123. return +data;
  12124. }
  12125. if ( rbrace.test( data ) ) {
  12126. return JSON.parse( data );
  12127. }
  12128. return data;
  12129. }
  12130. function dataAttr( elem, key, data ) {
  12131. var name;
  12132. // If nothing was found internally, try to fetch any
  12133. // data from the HTML5 data-* attribute
  12134. if ( data === undefined && elem.nodeType === 1 ) {
  12135. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12136. data = elem.getAttribute( name );
  12137. if ( typeof data === "string" ) {
  12138. try {
  12139. data = getData( data );
  12140. } catch ( e ) {}
  12141. // Make sure we set the data so it isn't changed later
  12142. dataUser.set( elem, key, data );
  12143. } else {
  12144. data = undefined;
  12145. }
  12146. }
  12147. return data;
  12148. }
  12149. jQuery.extend( {
  12150. hasData: function( elem ) {
  12151. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12152. },
  12153. data: function( elem, name, data ) {
  12154. return dataUser.access( elem, name, data );
  12155. },
  12156. removeData: function( elem, name ) {
  12157. dataUser.remove( elem, name );
  12158. },
  12159. // TODO: Now that all calls to _data and _removeData have been replaced
  12160. // with direct calls to dataPriv methods, these can be deprecated.
  12161. _data: function( elem, name, data ) {
  12162. return dataPriv.access( elem, name, data );
  12163. },
  12164. _removeData: function( elem, name ) {
  12165. dataPriv.remove( elem, name );
  12166. }
  12167. } );
  12168. jQuery.fn.extend( {
  12169. data: function( key, value ) {
  12170. var i, name, data,
  12171. elem = this[ 0 ],
  12172. attrs = elem && elem.attributes;
  12173. // Gets all values
  12174. if ( key === undefined ) {
  12175. if ( this.length ) {
  12176. data = dataUser.get( elem );
  12177. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12178. i = attrs.length;
  12179. while ( i-- ) {
  12180. // Support: IE 11 only
  12181. // The attrs elements can be null (#14894)
  12182. if ( attrs[ i ] ) {
  12183. name = attrs[ i ].name;
  12184. if ( name.indexOf( "data-" ) === 0 ) {
  12185. name = camelCase( name.slice( 5 ) );
  12186. dataAttr( elem, name, data[ name ] );
  12187. }
  12188. }
  12189. }
  12190. dataPriv.set( elem, "hasDataAttrs", true );
  12191. }
  12192. }
  12193. return data;
  12194. }
  12195. // Sets multiple values
  12196. if ( typeof key === "object" ) {
  12197. return this.each( function() {
  12198. dataUser.set( this, key );
  12199. } );
  12200. }
  12201. return access( this, function( value ) {
  12202. var data;
  12203. // The calling jQuery object (element matches) is not empty
  12204. // (and therefore has an element appears at this[ 0 ]) and the
  12205. // `value` parameter was not undefined. An empty jQuery object
  12206. // will result in `undefined` for elem = this[ 0 ] which will
  12207. // throw an exception if an attempt to read a data cache is made.
  12208. if ( elem && value === undefined ) {
  12209. // Attempt to get data from the cache
  12210. // The key will always be camelCased in Data
  12211. data = dataUser.get( elem, key );
  12212. if ( data !== undefined ) {
  12213. return data;
  12214. }
  12215. // Attempt to "discover" the data in
  12216. // HTML5 custom data-* attrs
  12217. data = dataAttr( elem, key );
  12218. if ( data !== undefined ) {
  12219. return data;
  12220. }
  12221. // We tried really hard, but the data doesn't exist.
  12222. return;
  12223. }
  12224. // Set the data...
  12225. this.each( function() {
  12226. // We always store the camelCased key
  12227. dataUser.set( this, key, value );
  12228. } );
  12229. }, null, value, arguments.length > 1, null, true );
  12230. },
  12231. removeData: function( key ) {
  12232. return this.each( function() {
  12233. dataUser.remove( this, key );
  12234. } );
  12235. }
  12236. } );
  12237. jQuery.extend( {
  12238. queue: function( elem, type, data ) {
  12239. var queue;
  12240. if ( elem ) {
  12241. type = ( type || "fx" ) + "queue";
  12242. queue = dataPriv.get( elem, type );
  12243. // Speed up dequeue by getting out quickly if this is just a lookup
  12244. if ( data ) {
  12245. if ( !queue || Array.isArray( data ) ) {
  12246. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12247. } else {
  12248. queue.push( data );
  12249. }
  12250. }
  12251. return queue || [];
  12252. }
  12253. },
  12254. dequeue: function( elem, type ) {
  12255. type = type || "fx";
  12256. var queue = jQuery.queue( elem, type ),
  12257. startLength = queue.length,
  12258. fn = queue.shift(),
  12259. hooks = jQuery._queueHooks( elem, type ),
  12260. next = function() {
  12261. jQuery.dequeue( elem, type );
  12262. };
  12263. // If the fx queue is dequeued, always remove the progress sentinel
  12264. if ( fn === "inprogress" ) {
  12265. fn = queue.shift();
  12266. startLength--;
  12267. }
  12268. if ( fn ) {
  12269. // Add a progress sentinel to prevent the fx queue from being
  12270. // automatically dequeued
  12271. if ( type === "fx" ) {
  12272. queue.unshift( "inprogress" );
  12273. }
  12274. // Clear up the last queue stop function
  12275. delete hooks.stop;
  12276. fn.call( elem, next, hooks );
  12277. }
  12278. if ( !startLength && hooks ) {
  12279. hooks.empty.fire();
  12280. }
  12281. },
  12282. // Not public - generate a queueHooks object, or return the current one
  12283. _queueHooks: function( elem, type ) {
  12284. var key = type + "queueHooks";
  12285. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12286. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12287. dataPriv.remove( elem, [ type + "queue", key ] );
  12288. } )
  12289. } );
  12290. }
  12291. } );
  12292. jQuery.fn.extend( {
  12293. queue: function( type, data ) {
  12294. var setter = 2;
  12295. if ( typeof type !== "string" ) {
  12296. data = type;
  12297. type = "fx";
  12298. setter--;
  12299. }
  12300. if ( arguments.length < setter ) {
  12301. return jQuery.queue( this[ 0 ], type );
  12302. }
  12303. return data === undefined ?
  12304. this :
  12305. this.each( function() {
  12306. var queue = jQuery.queue( this, type, data );
  12307. // Ensure a hooks for this queue
  12308. jQuery._queueHooks( this, type );
  12309. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12310. jQuery.dequeue( this, type );
  12311. }
  12312. } );
  12313. },
  12314. dequeue: function( type ) {
  12315. return this.each( function() {
  12316. jQuery.dequeue( this, type );
  12317. } );
  12318. },
  12319. clearQueue: function( type ) {
  12320. return this.queue( type || "fx", [] );
  12321. },
  12322. // Get a promise resolved when queues of a certain type
  12323. // are emptied (fx is the type by default)
  12324. promise: function( type, obj ) {
  12325. var tmp,
  12326. count = 1,
  12327. defer = jQuery.Deferred(),
  12328. elements = this,
  12329. i = this.length,
  12330. resolve = function() {
  12331. if ( !( --count ) ) {
  12332. defer.resolveWith( elements, [ elements ] );
  12333. }
  12334. };
  12335. if ( typeof type !== "string" ) {
  12336. obj = type;
  12337. type = undefined;
  12338. }
  12339. type = type || "fx";
  12340. while ( i-- ) {
  12341. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12342. if ( tmp && tmp.empty ) {
  12343. count++;
  12344. tmp.empty.add( resolve );
  12345. }
  12346. }
  12347. resolve();
  12348. return defer.promise( obj );
  12349. }
  12350. } );
  12351. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12352. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12353. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12354. var documentElement = document.documentElement;
  12355. var isAttached = function( elem ) {
  12356. return jQuery.contains( elem.ownerDocument, elem );
  12357. },
  12358. composed = { composed: true };
  12359. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12360. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12361. // Support: iOS 10.0-10.2 only
  12362. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12363. // leading to errors. We need to check for `getRootNode`.
  12364. if ( documentElement.getRootNode ) {
  12365. isAttached = function( elem ) {
  12366. return jQuery.contains( elem.ownerDocument, elem ) ||
  12367. elem.getRootNode( composed ) === elem.ownerDocument;
  12368. };
  12369. }
  12370. var isHiddenWithinTree = function( elem, el ) {
  12371. // isHiddenWithinTree might be called from jQuery#filter function;
  12372. // in that case, element will be second argument
  12373. elem = el || elem;
  12374. // Inline style trumps all
  12375. return elem.style.display === "none" ||
  12376. elem.style.display === "" &&
  12377. // Otherwise, check computed style
  12378. // Support: Firefox <=43 - 45
  12379. // Disconnected elements can have computed display: none, so first confirm that elem is
  12380. // in the document.
  12381. isAttached( elem ) &&
  12382. jQuery.css( elem, "display" ) === "none";
  12383. };
  12384. var swap = function( elem, options, callback, args ) {
  12385. var ret, name,
  12386. old = {};
  12387. // Remember the old values, and insert the new ones
  12388. for ( name in options ) {
  12389. old[ name ] = elem.style[ name ];
  12390. elem.style[ name ] = options[ name ];
  12391. }
  12392. ret = callback.apply( elem, args || [] );
  12393. // Revert the old values
  12394. for ( name in options ) {
  12395. elem.style[ name ] = old[ name ];
  12396. }
  12397. return ret;
  12398. };
  12399. function adjustCSS( elem, prop, valueParts, tween ) {
  12400. var adjusted, scale,
  12401. maxIterations = 20,
  12402. currentValue = tween ?
  12403. function() {
  12404. return tween.cur();
  12405. } :
  12406. function() {
  12407. return jQuery.css( elem, prop, "" );
  12408. },
  12409. initial = currentValue(),
  12410. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12411. // Starting value computation is required for potential unit mismatches
  12412. initialInUnit = elem.nodeType &&
  12413. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12414. rcssNum.exec( jQuery.css( elem, prop ) );
  12415. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12416. // Support: Firefox <=54
  12417. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12418. initial = initial / 2;
  12419. // Trust units reported by jQuery.css
  12420. unit = unit || initialInUnit[ 3 ];
  12421. // Iteratively approximate from a nonzero starting point
  12422. initialInUnit = +initial || 1;
  12423. while ( maxIterations-- ) {
  12424. // Evaluate and update our best guess (doubling guesses that zero out).
  12425. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12426. jQuery.style( elem, prop, initialInUnit + unit );
  12427. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12428. maxIterations = 0;
  12429. }
  12430. initialInUnit = initialInUnit / scale;
  12431. }
  12432. initialInUnit = initialInUnit * 2;
  12433. jQuery.style( elem, prop, initialInUnit + unit );
  12434. // Make sure we update the tween properties later on
  12435. valueParts = valueParts || [];
  12436. }
  12437. if ( valueParts ) {
  12438. initialInUnit = +initialInUnit || +initial || 0;
  12439. // Apply relative offset (+=/-=) if specified
  12440. adjusted = valueParts[ 1 ] ?
  12441. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12442. +valueParts[ 2 ];
  12443. if ( tween ) {
  12444. tween.unit = unit;
  12445. tween.start = initialInUnit;
  12446. tween.end = adjusted;
  12447. }
  12448. }
  12449. return adjusted;
  12450. }
  12451. var defaultDisplayMap = {};
  12452. function getDefaultDisplay( elem ) {
  12453. var temp,
  12454. doc = elem.ownerDocument,
  12455. nodeName = elem.nodeName,
  12456. display = defaultDisplayMap[ nodeName ];
  12457. if ( display ) {
  12458. return display;
  12459. }
  12460. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12461. display = jQuery.css( temp, "display" );
  12462. temp.parentNode.removeChild( temp );
  12463. if ( display === "none" ) {
  12464. display = "block";
  12465. }
  12466. defaultDisplayMap[ nodeName ] = display;
  12467. return display;
  12468. }
  12469. function showHide( elements, show ) {
  12470. var display, elem,
  12471. values = [],
  12472. index = 0,
  12473. length = elements.length;
  12474. // Determine new display value for elements that need to change
  12475. for ( ; index < length; index++ ) {
  12476. elem = elements[ index ];
  12477. if ( !elem.style ) {
  12478. continue;
  12479. }
  12480. display = elem.style.display;
  12481. if ( show ) {
  12482. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12483. // check is required in this first loop unless we have a nonempty display value (either
  12484. // inline or about-to-be-restored)
  12485. if ( display === "none" ) {
  12486. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12487. if ( !values[ index ] ) {
  12488. elem.style.display = "";
  12489. }
  12490. }
  12491. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12492. values[ index ] = getDefaultDisplay( elem );
  12493. }
  12494. } else {
  12495. if ( display !== "none" ) {
  12496. values[ index ] = "none";
  12497. // Remember what we're overwriting
  12498. dataPriv.set( elem, "display", display );
  12499. }
  12500. }
  12501. }
  12502. // Set the display of the elements in a second loop to avoid constant reflow
  12503. for ( index = 0; index < length; index++ ) {
  12504. if ( values[ index ] != null ) {
  12505. elements[ index ].style.display = values[ index ];
  12506. }
  12507. }
  12508. return elements;
  12509. }
  12510. jQuery.fn.extend( {
  12511. show: function() {
  12512. return showHide( this, true );
  12513. },
  12514. hide: function() {
  12515. return showHide( this );
  12516. },
  12517. toggle: function( state ) {
  12518. if ( typeof state === "boolean" ) {
  12519. return state ? this.show() : this.hide();
  12520. }
  12521. return this.each( function() {
  12522. if ( isHiddenWithinTree( this ) ) {
  12523. jQuery( this ).show();
  12524. } else {
  12525. jQuery( this ).hide();
  12526. }
  12527. } );
  12528. }
  12529. } );
  12530. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12531. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12532. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12533. // We have to close these tags to support XHTML (#13200)
  12534. var wrapMap = {
  12535. // Support: IE <=9 only
  12536. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12537. // XHTML parsers do not magically insert elements in the
  12538. // same way that tag soup parsers do. So we cannot shorten
  12539. // this by omitting <tbody> or other required elements.
  12540. thead: [ 1, "<table>", "</table>" ],
  12541. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12542. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12543. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12544. _default: [ 0, "", "" ]
  12545. };
  12546. // Support: IE <=9 only
  12547. wrapMap.optgroup = wrapMap.option;
  12548. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12549. wrapMap.th = wrapMap.td;
  12550. function getAll( context, tag ) {
  12551. // Support: IE <=9 - 11 only
  12552. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12553. var ret;
  12554. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12555. ret = context.getElementsByTagName( tag || "*" );
  12556. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12557. ret = context.querySelectorAll( tag || "*" );
  12558. } else {
  12559. ret = [];
  12560. }
  12561. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12562. return jQuery.merge( [ context ], ret );
  12563. }
  12564. return ret;
  12565. }
  12566. // Mark scripts as having already been evaluated
  12567. function setGlobalEval( elems, refElements ) {
  12568. var i = 0,
  12569. l = elems.length;
  12570. for ( ; i < l; i++ ) {
  12571. dataPriv.set(
  12572. elems[ i ],
  12573. "globalEval",
  12574. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12575. );
  12576. }
  12577. }
  12578. var rhtml = /<|&#?\w+;/;
  12579. function buildFragment( elems, context, scripts, selection, ignored ) {
  12580. var elem, tmp, tag, wrap, attached, j,
  12581. fragment = context.createDocumentFragment(),
  12582. nodes = [],
  12583. i = 0,
  12584. l = elems.length;
  12585. for ( ; i < l; i++ ) {
  12586. elem = elems[ i ];
  12587. if ( elem || elem === 0 ) {
  12588. // Add nodes directly
  12589. if ( toType( elem ) === "object" ) {
  12590. // Support: Android <=4.0 only, PhantomJS 1 only
  12591. // push.apply(_, arraylike) throws on ancient WebKit
  12592. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12593. // Convert non-html into a text node
  12594. } else if ( !rhtml.test( elem ) ) {
  12595. nodes.push( context.createTextNode( elem ) );
  12596. // Convert html into DOM nodes
  12597. } else {
  12598. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12599. // Deserialize a standard representation
  12600. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12601. wrap = wrapMap[ tag ] || wrapMap._default;
  12602. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12603. // Descend through wrappers to the right content
  12604. j = wrap[ 0 ];
  12605. while ( j-- ) {
  12606. tmp = tmp.lastChild;
  12607. }
  12608. // Support: Android <=4.0 only, PhantomJS 1 only
  12609. // push.apply(_, arraylike) throws on ancient WebKit
  12610. jQuery.merge( nodes, tmp.childNodes );
  12611. // Remember the top-level container
  12612. tmp = fragment.firstChild;
  12613. // Ensure the created nodes are orphaned (#12392)
  12614. tmp.textContent = "";
  12615. }
  12616. }
  12617. }
  12618. // Remove wrapper from fragment
  12619. fragment.textContent = "";
  12620. i = 0;
  12621. while ( ( elem = nodes[ i++ ] ) ) {
  12622. // Skip elements already in the context collection (trac-4087)
  12623. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12624. if ( ignored ) {
  12625. ignored.push( elem );
  12626. }
  12627. continue;
  12628. }
  12629. attached = isAttached( elem );
  12630. // Append to fragment
  12631. tmp = getAll( fragment.appendChild( elem ), "script" );
  12632. // Preserve script evaluation history
  12633. if ( attached ) {
  12634. setGlobalEval( tmp );
  12635. }
  12636. // Capture executables
  12637. if ( scripts ) {
  12638. j = 0;
  12639. while ( ( elem = tmp[ j++ ] ) ) {
  12640. if ( rscriptType.test( elem.type || "" ) ) {
  12641. scripts.push( elem );
  12642. }
  12643. }
  12644. }
  12645. }
  12646. return fragment;
  12647. }
  12648. ( function() {
  12649. var fragment = document.createDocumentFragment(),
  12650. div = fragment.appendChild( document.createElement( "div" ) ),
  12651. input = document.createElement( "input" );
  12652. // Support: Android 4.0 - 4.3 only
  12653. // Check state lost if the name is set (#11217)
  12654. // Support: Windows Web Apps (WWA)
  12655. // `name` and `type` must use .setAttribute for WWA (#14901)
  12656. input.setAttribute( "type", "radio" );
  12657. input.setAttribute( "checked", "checked" );
  12658. input.setAttribute( "name", "t" );
  12659. div.appendChild( input );
  12660. // Support: Android <=4.1 only
  12661. // Older WebKit doesn't clone checked state correctly in fragments
  12662. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12663. // Support: IE <=11 only
  12664. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12665. div.innerHTML = "<textarea>x</textarea>";
  12666. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12667. } )();
  12668. var
  12669. rkeyEvent = /^key/,
  12670. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12671. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12672. function returnTrue() {
  12673. return true;
  12674. }
  12675. function returnFalse() {
  12676. return false;
  12677. }
  12678. // Support: IE <=9 - 11+
  12679. // focus() and blur() are asynchronous, except when they are no-op.
  12680. // So expect focus to be synchronous when the element is already active,
  12681. // and blur to be synchronous when the element is not already active.
  12682. // (focus and blur are always synchronous in other supported browsers,
  12683. // this just defines when we can count on it).
  12684. function expectSync( elem, type ) {
  12685. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12686. }
  12687. // Support: IE <=9 only
  12688. // Accessing document.activeElement can throw unexpectedly
  12689. // https://bugs.jquery.com/ticket/13393
  12690. function safeActiveElement() {
  12691. try {
  12692. return document.activeElement;
  12693. } catch ( err ) { }
  12694. }
  12695. function on( elem, types, selector, data, fn, one ) {
  12696. var origFn, type;
  12697. // Types can be a map of types/handlers
  12698. if ( typeof types === "object" ) {
  12699. // ( types-Object, selector, data )
  12700. if ( typeof selector !== "string" ) {
  12701. // ( types-Object, data )
  12702. data = data || selector;
  12703. selector = undefined;
  12704. }
  12705. for ( type in types ) {
  12706. on( elem, type, selector, data, types[ type ], one );
  12707. }
  12708. return elem;
  12709. }
  12710. if ( data == null && fn == null ) {
  12711. // ( types, fn )
  12712. fn = selector;
  12713. data = selector = undefined;
  12714. } else if ( fn == null ) {
  12715. if ( typeof selector === "string" ) {
  12716. // ( types, selector, fn )
  12717. fn = data;
  12718. data = undefined;
  12719. } else {
  12720. // ( types, data, fn )
  12721. fn = data;
  12722. data = selector;
  12723. selector = undefined;
  12724. }
  12725. }
  12726. if ( fn === false ) {
  12727. fn = returnFalse;
  12728. } else if ( !fn ) {
  12729. return elem;
  12730. }
  12731. if ( one === 1 ) {
  12732. origFn = fn;
  12733. fn = function( event ) {
  12734. // Can use an empty set, since event contains the info
  12735. jQuery().off( event );
  12736. return origFn.apply( this, arguments );
  12737. };
  12738. // Use same guid so caller can remove using origFn
  12739. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12740. }
  12741. return elem.each( function() {
  12742. jQuery.event.add( this, types, fn, data, selector );
  12743. } );
  12744. }
  12745. /*
  12746. * Helper functions for managing events -- not part of the public interface.
  12747. * Props to Dean Edwards' addEvent library for many of the ideas.
  12748. */
  12749. jQuery.event = {
  12750. global: {},
  12751. add: function( elem, types, handler, data, selector ) {
  12752. var handleObjIn, eventHandle, tmp,
  12753. events, t, handleObj,
  12754. special, handlers, type, namespaces, origType,
  12755. elemData = dataPriv.get( elem );
  12756. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12757. if ( !elemData ) {
  12758. return;
  12759. }
  12760. // Caller can pass in an object of custom data in lieu of the handler
  12761. if ( handler.handler ) {
  12762. handleObjIn = handler;
  12763. handler = handleObjIn.handler;
  12764. selector = handleObjIn.selector;
  12765. }
  12766. // Ensure that invalid selectors throw exceptions at attach time
  12767. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12768. if ( selector ) {
  12769. jQuery.find.matchesSelector( documentElement, selector );
  12770. }
  12771. // Make sure that the handler has a unique ID, used to find/remove it later
  12772. if ( !handler.guid ) {
  12773. handler.guid = jQuery.guid++;
  12774. }
  12775. // Init the element's event structure and main handler, if this is the first
  12776. if ( !( events = elemData.events ) ) {
  12777. events = elemData.events = {};
  12778. }
  12779. if ( !( eventHandle = elemData.handle ) ) {
  12780. eventHandle = elemData.handle = function( e ) {
  12781. // Discard the second event of a jQuery.event.trigger() and
  12782. // when an event is called after a page has unloaded
  12783. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12784. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12785. };
  12786. }
  12787. // Handle multiple events separated by a space
  12788. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12789. t = types.length;
  12790. while ( t-- ) {
  12791. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12792. type = origType = tmp[ 1 ];
  12793. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12794. // There *must* be a type, no attaching namespace-only handlers
  12795. if ( !type ) {
  12796. continue;
  12797. }
  12798. // If event changes its type, use the special event handlers for the changed type
  12799. special = jQuery.event.special[ type ] || {};
  12800. // If selector defined, determine special event api type, otherwise given type
  12801. type = ( selector ? special.delegateType : special.bindType ) || type;
  12802. // Update special based on newly reset type
  12803. special = jQuery.event.special[ type ] || {};
  12804. // handleObj is passed to all event handlers
  12805. handleObj = jQuery.extend( {
  12806. type: type,
  12807. origType: origType,
  12808. data: data,
  12809. handler: handler,
  12810. guid: handler.guid,
  12811. selector: selector,
  12812. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12813. namespace: namespaces.join( "." )
  12814. }, handleObjIn );
  12815. // Init the event handler queue if we're the first
  12816. if ( !( handlers = events[ type ] ) ) {
  12817. handlers = events[ type ] = [];
  12818. handlers.delegateCount = 0;
  12819. // Only use addEventListener if the special events handler returns false
  12820. if ( !special.setup ||
  12821. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12822. if ( elem.addEventListener ) {
  12823. elem.addEventListener( type, eventHandle );
  12824. }
  12825. }
  12826. }
  12827. if ( special.add ) {
  12828. special.add.call( elem, handleObj );
  12829. if ( !handleObj.handler.guid ) {
  12830. handleObj.handler.guid = handler.guid;
  12831. }
  12832. }
  12833. // Add to the element's handler list, delegates in front
  12834. if ( selector ) {
  12835. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12836. } else {
  12837. handlers.push( handleObj );
  12838. }
  12839. // Keep track of which events have ever been used, for event optimization
  12840. jQuery.event.global[ type ] = true;
  12841. }
  12842. },
  12843. // Detach an event or set of events from an element
  12844. remove: function( elem, types, handler, selector, mappedTypes ) {
  12845. var j, origCount, tmp,
  12846. events, t, handleObj,
  12847. special, handlers, type, namespaces, origType,
  12848. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12849. if ( !elemData || !( events = elemData.events ) ) {
  12850. return;
  12851. }
  12852. // Once for each type.namespace in types; type may be omitted
  12853. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12854. t = types.length;
  12855. while ( t-- ) {
  12856. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12857. type = origType = tmp[ 1 ];
  12858. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12859. // Unbind all events (on this namespace, if provided) for the element
  12860. if ( !type ) {
  12861. for ( type in events ) {
  12862. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12863. }
  12864. continue;
  12865. }
  12866. special = jQuery.event.special[ type ] || {};
  12867. type = ( selector ? special.delegateType : special.bindType ) || type;
  12868. handlers = events[ type ] || [];
  12869. tmp = tmp[ 2 ] &&
  12870. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12871. // Remove matching events
  12872. origCount = j = handlers.length;
  12873. while ( j-- ) {
  12874. handleObj = handlers[ j ];
  12875. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12876. ( !handler || handler.guid === handleObj.guid ) &&
  12877. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12878. ( !selector || selector === handleObj.selector ||
  12879. selector === "**" && handleObj.selector ) ) {
  12880. handlers.splice( j, 1 );
  12881. if ( handleObj.selector ) {
  12882. handlers.delegateCount--;
  12883. }
  12884. if ( special.remove ) {
  12885. special.remove.call( elem, handleObj );
  12886. }
  12887. }
  12888. }
  12889. // Remove generic event handler if we removed something and no more handlers exist
  12890. // (avoids potential for endless recursion during removal of special event handlers)
  12891. if ( origCount && !handlers.length ) {
  12892. if ( !special.teardown ||
  12893. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12894. jQuery.removeEvent( elem, type, elemData.handle );
  12895. }
  12896. delete events[ type ];
  12897. }
  12898. }
  12899. // Remove data and the expando if it's no longer used
  12900. if ( jQuery.isEmptyObject( events ) ) {
  12901. dataPriv.remove( elem, "handle events" );
  12902. }
  12903. },
  12904. dispatch: function( nativeEvent ) {
  12905. // Make a writable jQuery.Event from the native event object
  12906. var event = jQuery.event.fix( nativeEvent );
  12907. var i, j, ret, matched, handleObj, handlerQueue,
  12908. args = new Array( arguments.length ),
  12909. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12910. special = jQuery.event.special[ event.type ] || {};
  12911. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12912. args[ 0 ] = event;
  12913. for ( i = 1; i < arguments.length; i++ ) {
  12914. args[ i ] = arguments[ i ];
  12915. }
  12916. event.delegateTarget = this;
  12917. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12918. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12919. return;
  12920. }
  12921. // Determine handlers
  12922. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12923. // Run delegates first; they may want to stop propagation beneath us
  12924. i = 0;
  12925. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12926. event.currentTarget = matched.elem;
  12927. j = 0;
  12928. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12929. !event.isImmediatePropagationStopped() ) {
  12930. // If the event is namespaced, then each handler is only invoked if it is
  12931. // specially universal or its namespaces are a superset of the event's.
  12932. if ( !event.rnamespace || handleObj.namespace === false ||
  12933. event.rnamespace.test( handleObj.namespace ) ) {
  12934. event.handleObj = handleObj;
  12935. event.data = handleObj.data;
  12936. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12937. handleObj.handler ).apply( matched.elem, args );
  12938. if ( ret !== undefined ) {
  12939. if ( ( event.result = ret ) === false ) {
  12940. event.preventDefault();
  12941. event.stopPropagation();
  12942. }
  12943. }
  12944. }
  12945. }
  12946. }
  12947. // Call the postDispatch hook for the mapped type
  12948. if ( special.postDispatch ) {
  12949. special.postDispatch.call( this, event );
  12950. }
  12951. return event.result;
  12952. },
  12953. handlers: function( event, handlers ) {
  12954. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12955. handlerQueue = [],
  12956. delegateCount = handlers.delegateCount,
  12957. cur = event.target;
  12958. // Find delegate handlers
  12959. if ( delegateCount &&
  12960. // Support: IE <=9
  12961. // Black-hole SVG <use> instance trees (trac-13180)
  12962. cur.nodeType &&
  12963. // Support: Firefox <=42
  12964. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12965. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12966. // Support: IE 11 only
  12967. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12968. !( event.type === "click" && event.button >= 1 ) ) {
  12969. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12970. // Don't check non-elements (#13208)
  12971. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12972. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12973. matchedHandlers = [];
  12974. matchedSelectors = {};
  12975. for ( i = 0; i < delegateCount; i++ ) {
  12976. handleObj = handlers[ i ];
  12977. // Don't conflict with Object.prototype properties (#13203)
  12978. sel = handleObj.selector + " ";
  12979. if ( matchedSelectors[ sel ] === undefined ) {
  12980. matchedSelectors[ sel ] = handleObj.needsContext ?
  12981. jQuery( sel, this ).index( cur ) > -1 :
  12982. jQuery.find( sel, this, null, [ cur ] ).length;
  12983. }
  12984. if ( matchedSelectors[ sel ] ) {
  12985. matchedHandlers.push( handleObj );
  12986. }
  12987. }
  12988. if ( matchedHandlers.length ) {
  12989. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12990. }
  12991. }
  12992. }
  12993. }
  12994. // Add the remaining (directly-bound) handlers
  12995. cur = this;
  12996. if ( delegateCount < handlers.length ) {
  12997. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12998. }
  12999. return handlerQueue;
  13000. },
  13001. addProp: function( name, hook ) {
  13002. Object.defineProperty( jQuery.Event.prototype, name, {
  13003. enumerable: true,
  13004. configurable: true,
  13005. get: isFunction( hook ) ?
  13006. function() {
  13007. if ( this.originalEvent ) {
  13008. return hook( this.originalEvent );
  13009. }
  13010. } :
  13011. function() {
  13012. if ( this.originalEvent ) {
  13013. return this.originalEvent[ name ];
  13014. }
  13015. },
  13016. set: function( value ) {
  13017. Object.defineProperty( this, name, {
  13018. enumerable: true,
  13019. configurable: true,
  13020. writable: true,
  13021. value: value
  13022. } );
  13023. }
  13024. } );
  13025. },
  13026. fix: function( originalEvent ) {
  13027. return originalEvent[ jQuery.expando ] ?
  13028. originalEvent :
  13029. new jQuery.Event( originalEvent );
  13030. },
  13031. special: {
  13032. load: {
  13033. // Prevent triggered image.load events from bubbling to window.load
  13034. noBubble: true
  13035. },
  13036. click: {
  13037. // Utilize native event to ensure correct state for checkable inputs
  13038. setup: function( data ) {
  13039. // For mutual compressibility with _default, replace `this` access with a local var.
  13040. // `|| data` is dead code meant only to preserve the variable through minification.
  13041. var el = this || data;
  13042. // Claim the first handler
  13043. if ( rcheckableType.test( el.type ) &&
  13044. el.click && nodeName( el, "input" ) ) {
  13045. // dataPriv.set( el, "click", ... )
  13046. leverageNative( el, "click", returnTrue );
  13047. }
  13048. // Return false to allow normal processing in the caller
  13049. return false;
  13050. },
  13051. trigger: function( data ) {
  13052. // For mutual compressibility with _default, replace `this` access with a local var.
  13053. // `|| data` is dead code meant only to preserve the variable through minification.
  13054. var el = this || data;
  13055. // Force setup before triggering a click
  13056. if ( rcheckableType.test( el.type ) &&
  13057. el.click && nodeName( el, "input" ) ) {
  13058. leverageNative( el, "click" );
  13059. }
  13060. // Return non-false to allow normal event-path propagation
  13061. return true;
  13062. },
  13063. // For cross-browser consistency, suppress native .click() on links
  13064. // Also prevent it if we're currently inside a leveraged native-event stack
  13065. _default: function( event ) {
  13066. var target = event.target;
  13067. return rcheckableType.test( target.type ) &&
  13068. target.click && nodeName( target, "input" ) &&
  13069. dataPriv.get( target, "click" ) ||
  13070. nodeName( target, "a" );
  13071. }
  13072. },
  13073. beforeunload: {
  13074. postDispatch: function( event ) {
  13075. // Support: Firefox 20+
  13076. // Firefox doesn't alert if the returnValue field is not set.
  13077. if ( event.result !== undefined && event.originalEvent ) {
  13078. event.originalEvent.returnValue = event.result;
  13079. }
  13080. }
  13081. }
  13082. }
  13083. };
  13084. // Ensure the presence of an event listener that handles manually-triggered
  13085. // synthetic events by interrupting progress until reinvoked in response to
  13086. // *native* events that it fires directly, ensuring that state changes have
  13087. // already occurred before other listeners are invoked.
  13088. function leverageNative( el, type, expectSync ) {
  13089. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13090. if ( !expectSync ) {
  13091. if ( dataPriv.get( el, type ) === undefined ) {
  13092. jQuery.event.add( el, type, returnTrue );
  13093. }
  13094. return;
  13095. }
  13096. // Register the controller as a special universal handler for all event namespaces
  13097. dataPriv.set( el, type, false );
  13098. jQuery.event.add( el, type, {
  13099. namespace: false,
  13100. handler: function( event ) {
  13101. var notAsync, result,
  13102. saved = dataPriv.get( this, type );
  13103. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13104. // Interrupt processing of the outer synthetic .trigger()ed event
  13105. // Saved data should be false in such cases, but might be a leftover capture object
  13106. // from an async native handler (gh-4350)
  13107. if ( !saved.length ) {
  13108. // Store arguments for use when handling the inner native event
  13109. // There will always be at least one argument (an event object), so this array
  13110. // will not be confused with a leftover capture object.
  13111. saved = slice.call( arguments );
  13112. dataPriv.set( this, type, saved );
  13113. // Trigger the native event and capture its result
  13114. // Support: IE <=9 - 11+
  13115. // focus() and blur() are asynchronous
  13116. notAsync = expectSync( this, type );
  13117. this[ type ]();
  13118. result = dataPriv.get( this, type );
  13119. if ( saved !== result || notAsync ) {
  13120. dataPriv.set( this, type, false );
  13121. } else {
  13122. result = {};
  13123. }
  13124. if ( saved !== result ) {
  13125. // Cancel the outer synthetic event
  13126. event.stopImmediatePropagation();
  13127. event.preventDefault();
  13128. return result.value;
  13129. }
  13130. // If this is an inner synthetic event for an event with a bubbling surrogate
  13131. // (focus or blur), assume that the surrogate already propagated from triggering the
  13132. // native event and prevent that from happening again here.
  13133. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13134. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13135. // less bad than duplication.
  13136. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13137. event.stopPropagation();
  13138. }
  13139. // If this is a native event triggered above, everything is now in order
  13140. // Fire an inner synthetic event with the original arguments
  13141. } else if ( saved.length ) {
  13142. // ...and capture the result
  13143. dataPriv.set( this, type, {
  13144. value: jQuery.event.trigger(
  13145. // Support: IE <=9 - 11+
  13146. // Extend with the prototype to reset the above stopImmediatePropagation()
  13147. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13148. saved.slice( 1 ),
  13149. this
  13150. )
  13151. } );
  13152. // Abort handling of the native event
  13153. event.stopImmediatePropagation();
  13154. }
  13155. }
  13156. } );
  13157. }
  13158. jQuery.removeEvent = function( elem, type, handle ) {
  13159. // This "if" is needed for plain objects
  13160. if ( elem.removeEventListener ) {
  13161. elem.removeEventListener( type, handle );
  13162. }
  13163. };
  13164. jQuery.Event = function( src, props ) {
  13165. // Allow instantiation without the 'new' keyword
  13166. if ( !( this instanceof jQuery.Event ) ) {
  13167. return new jQuery.Event( src, props );
  13168. }
  13169. // Event object
  13170. if ( src && src.type ) {
  13171. this.originalEvent = src;
  13172. this.type = src.type;
  13173. // Events bubbling up the document may have been marked as prevented
  13174. // by a handler lower down the tree; reflect the correct value.
  13175. this.isDefaultPrevented = src.defaultPrevented ||
  13176. src.defaultPrevented === undefined &&
  13177. // Support: Android <=2.3 only
  13178. src.returnValue === false ?
  13179. returnTrue :
  13180. returnFalse;
  13181. // Create target properties
  13182. // Support: Safari <=6 - 7 only
  13183. // Target should not be a text node (#504, #13143)
  13184. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13185. src.target.parentNode :
  13186. src.target;
  13187. this.currentTarget = src.currentTarget;
  13188. this.relatedTarget = src.relatedTarget;
  13189. // Event type
  13190. } else {
  13191. this.type = src;
  13192. }
  13193. // Put explicitly provided properties onto the event object
  13194. if ( props ) {
  13195. jQuery.extend( this, props );
  13196. }
  13197. // Create a timestamp if incoming event doesn't have one
  13198. this.timeStamp = src && src.timeStamp || Date.now();
  13199. // Mark it as fixed
  13200. this[ jQuery.expando ] = true;
  13201. };
  13202. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13203. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13204. jQuery.Event.prototype = {
  13205. constructor: jQuery.Event,
  13206. isDefaultPrevented: returnFalse,
  13207. isPropagationStopped: returnFalse,
  13208. isImmediatePropagationStopped: returnFalse,
  13209. isSimulated: false,
  13210. preventDefault: function() {
  13211. var e = this.originalEvent;
  13212. this.isDefaultPrevented = returnTrue;
  13213. if ( e && !this.isSimulated ) {
  13214. e.preventDefault();
  13215. }
  13216. },
  13217. stopPropagation: function() {
  13218. var e = this.originalEvent;
  13219. this.isPropagationStopped = returnTrue;
  13220. if ( e && !this.isSimulated ) {
  13221. e.stopPropagation();
  13222. }
  13223. },
  13224. stopImmediatePropagation: function() {
  13225. var e = this.originalEvent;
  13226. this.isImmediatePropagationStopped = returnTrue;
  13227. if ( e && !this.isSimulated ) {
  13228. e.stopImmediatePropagation();
  13229. }
  13230. this.stopPropagation();
  13231. }
  13232. };
  13233. // Includes all common event props including KeyEvent and MouseEvent specific props
  13234. jQuery.each( {
  13235. altKey: true,
  13236. bubbles: true,
  13237. cancelable: true,
  13238. changedTouches: true,
  13239. ctrlKey: true,
  13240. detail: true,
  13241. eventPhase: true,
  13242. metaKey: true,
  13243. pageX: true,
  13244. pageY: true,
  13245. shiftKey: true,
  13246. view: true,
  13247. "char": true,
  13248. code: true,
  13249. charCode: true,
  13250. key: true,
  13251. keyCode: true,
  13252. button: true,
  13253. buttons: true,
  13254. clientX: true,
  13255. clientY: true,
  13256. offsetX: true,
  13257. offsetY: true,
  13258. pointerId: true,
  13259. pointerType: true,
  13260. screenX: true,
  13261. screenY: true,
  13262. targetTouches: true,
  13263. toElement: true,
  13264. touches: true,
  13265. which: function( event ) {
  13266. var button = event.button;
  13267. // Add which for key events
  13268. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13269. return event.charCode != null ? event.charCode : event.keyCode;
  13270. }
  13271. // Add which for click: 1 === left; 2 === middle; 3 === right
  13272. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13273. if ( button & 1 ) {
  13274. return 1;
  13275. }
  13276. if ( button & 2 ) {
  13277. return 3;
  13278. }
  13279. if ( button & 4 ) {
  13280. return 2;
  13281. }
  13282. return 0;
  13283. }
  13284. return event.which;
  13285. }
  13286. }, jQuery.event.addProp );
  13287. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13288. jQuery.event.special[ type ] = {
  13289. // Utilize native event if possible so blur/focus sequence is correct
  13290. setup: function() {
  13291. // Claim the first handler
  13292. // dataPriv.set( this, "focus", ... )
  13293. // dataPriv.set( this, "blur", ... )
  13294. leverageNative( this, type, expectSync );
  13295. // Return false to allow normal processing in the caller
  13296. return false;
  13297. },
  13298. trigger: function() {
  13299. // Force setup before trigger
  13300. leverageNative( this, type );
  13301. // Return non-false to allow normal event-path propagation
  13302. return true;
  13303. },
  13304. delegateType: delegateType
  13305. };
  13306. } );
  13307. // Create mouseenter/leave events using mouseover/out and event-time checks
  13308. // so that event delegation works in jQuery.
  13309. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13310. //
  13311. // Support: Safari 7 only
  13312. // Safari sends mouseenter too often; see:
  13313. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13314. // for the description of the bug (it existed in older Chrome versions as well).
  13315. jQuery.each( {
  13316. mouseenter: "mouseover",
  13317. mouseleave: "mouseout",
  13318. pointerenter: "pointerover",
  13319. pointerleave: "pointerout"
  13320. }, function( orig, fix ) {
  13321. jQuery.event.special[ orig ] = {
  13322. delegateType: fix,
  13323. bindType: fix,
  13324. handle: function( event ) {
  13325. var ret,
  13326. target = this,
  13327. related = event.relatedTarget,
  13328. handleObj = event.handleObj;
  13329. // For mouseenter/leave call the handler if related is outside the target.
  13330. // NB: No relatedTarget if the mouse left/entered the browser window
  13331. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13332. event.type = handleObj.origType;
  13333. ret = handleObj.handler.apply( this, arguments );
  13334. event.type = fix;
  13335. }
  13336. return ret;
  13337. }
  13338. };
  13339. } );
  13340. jQuery.fn.extend( {
  13341. on: function( types, selector, data, fn ) {
  13342. return on( this, types, selector, data, fn );
  13343. },
  13344. one: function( types, selector, data, fn ) {
  13345. return on( this, types, selector, data, fn, 1 );
  13346. },
  13347. off: function( types, selector, fn ) {
  13348. var handleObj, type;
  13349. if ( types && types.preventDefault && types.handleObj ) {
  13350. // ( event ) dispatched jQuery.Event
  13351. handleObj = types.handleObj;
  13352. jQuery( types.delegateTarget ).off(
  13353. handleObj.namespace ?
  13354. handleObj.origType + "." + handleObj.namespace :
  13355. handleObj.origType,
  13356. handleObj.selector,
  13357. handleObj.handler
  13358. );
  13359. return this;
  13360. }
  13361. if ( typeof types === "object" ) {
  13362. // ( types-object [, selector] )
  13363. for ( type in types ) {
  13364. this.off( type, selector, types[ type ] );
  13365. }
  13366. return this;
  13367. }
  13368. if ( selector === false || typeof selector === "function" ) {
  13369. // ( types [, fn] )
  13370. fn = selector;
  13371. selector = undefined;
  13372. }
  13373. if ( fn === false ) {
  13374. fn = returnFalse;
  13375. }
  13376. return this.each( function() {
  13377. jQuery.event.remove( this, types, fn, selector );
  13378. } );
  13379. }
  13380. } );
  13381. var
  13382. /* eslint-disable max-len */
  13383. // See https://github.com/eslint/eslint/issues/3229
  13384. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13385. /* eslint-enable */
  13386. // Support: IE <=10 - 11, Edge 12 - 13 only
  13387. // In IE/Edge using regex groups here causes severe slowdowns.
  13388. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13389. rnoInnerhtml = /<script|<style|<link/i,
  13390. // checked="checked" or checked
  13391. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13392. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13393. // Prefer a tbody over its parent table for containing new rows
  13394. function manipulationTarget( elem, content ) {
  13395. if ( nodeName( elem, "table" ) &&
  13396. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13397. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13398. }
  13399. return elem;
  13400. }
  13401. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13402. function disableScript( elem ) {
  13403. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13404. return elem;
  13405. }
  13406. function restoreScript( elem ) {
  13407. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13408. elem.type = elem.type.slice( 5 );
  13409. } else {
  13410. elem.removeAttribute( "type" );
  13411. }
  13412. return elem;
  13413. }
  13414. function cloneCopyEvent( src, dest ) {
  13415. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13416. if ( dest.nodeType !== 1 ) {
  13417. return;
  13418. }
  13419. // 1. Copy private data: events, handlers, etc.
  13420. if ( dataPriv.hasData( src ) ) {
  13421. pdataOld = dataPriv.access( src );
  13422. pdataCur = dataPriv.set( dest, pdataOld );
  13423. events = pdataOld.events;
  13424. if ( events ) {
  13425. delete pdataCur.handle;
  13426. pdataCur.events = {};
  13427. for ( type in events ) {
  13428. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13429. jQuery.event.add( dest, type, events[ type ][ i ] );
  13430. }
  13431. }
  13432. }
  13433. }
  13434. // 2. Copy user data
  13435. if ( dataUser.hasData( src ) ) {
  13436. udataOld = dataUser.access( src );
  13437. udataCur = jQuery.extend( {}, udataOld );
  13438. dataUser.set( dest, udataCur );
  13439. }
  13440. }
  13441. // Fix IE bugs, see support tests
  13442. function fixInput( src, dest ) {
  13443. var nodeName = dest.nodeName.toLowerCase();
  13444. // Fails to persist the checked state of a cloned checkbox or radio button.
  13445. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13446. dest.checked = src.checked;
  13447. // Fails to return the selected option to the default selected state when cloning options
  13448. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13449. dest.defaultValue = src.defaultValue;
  13450. }
  13451. }
  13452. function domManip( collection, args, callback, ignored ) {
  13453. // Flatten any nested arrays
  13454. args = concat.apply( [], args );
  13455. var fragment, first, scripts, hasScripts, node, doc,
  13456. i = 0,
  13457. l = collection.length,
  13458. iNoClone = l - 1,
  13459. value = args[ 0 ],
  13460. valueIsFunction = isFunction( value );
  13461. // We can't cloneNode fragments that contain checked, in WebKit
  13462. if ( valueIsFunction ||
  13463. ( l > 1 && typeof value === "string" &&
  13464. !support.checkClone && rchecked.test( value ) ) ) {
  13465. return collection.each( function( index ) {
  13466. var self = collection.eq( index );
  13467. if ( valueIsFunction ) {
  13468. args[ 0 ] = value.call( this, index, self.html() );
  13469. }
  13470. domManip( self, args, callback, ignored );
  13471. } );
  13472. }
  13473. if ( l ) {
  13474. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13475. first = fragment.firstChild;
  13476. if ( fragment.childNodes.length === 1 ) {
  13477. fragment = first;
  13478. }
  13479. // Require either new content or an interest in ignored elements to invoke the callback
  13480. if ( first || ignored ) {
  13481. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13482. hasScripts = scripts.length;
  13483. // Use the original fragment for the last item
  13484. // instead of the first because it can end up
  13485. // being emptied incorrectly in certain situations (#8070).
  13486. for ( ; i < l; i++ ) {
  13487. node = fragment;
  13488. if ( i !== iNoClone ) {
  13489. node = jQuery.clone( node, true, true );
  13490. // Keep references to cloned scripts for later restoration
  13491. if ( hasScripts ) {
  13492. // Support: Android <=4.0 only, PhantomJS 1 only
  13493. // push.apply(_, arraylike) throws on ancient WebKit
  13494. jQuery.merge( scripts, getAll( node, "script" ) );
  13495. }
  13496. }
  13497. callback.call( collection[ i ], node, i );
  13498. }
  13499. if ( hasScripts ) {
  13500. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13501. // Reenable scripts
  13502. jQuery.map( scripts, restoreScript );
  13503. // Evaluate executable scripts on first document insertion
  13504. for ( i = 0; i < hasScripts; i++ ) {
  13505. node = scripts[ i ];
  13506. if ( rscriptType.test( node.type || "" ) &&
  13507. !dataPriv.access( node, "globalEval" ) &&
  13508. jQuery.contains( doc, node ) ) {
  13509. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13510. // Optional AJAX dependency, but won't run scripts if not present
  13511. if ( jQuery._evalUrl && !node.noModule ) {
  13512. jQuery._evalUrl( node.src, {
  13513. nonce: node.nonce || node.getAttribute( "nonce" )
  13514. } );
  13515. }
  13516. } else {
  13517. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13518. }
  13519. }
  13520. }
  13521. }
  13522. }
  13523. }
  13524. return collection;
  13525. }
  13526. function remove( elem, selector, keepData ) {
  13527. var node,
  13528. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13529. i = 0;
  13530. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13531. if ( !keepData && node.nodeType === 1 ) {
  13532. jQuery.cleanData( getAll( node ) );
  13533. }
  13534. if ( node.parentNode ) {
  13535. if ( keepData && isAttached( node ) ) {
  13536. setGlobalEval( getAll( node, "script" ) );
  13537. }
  13538. node.parentNode.removeChild( node );
  13539. }
  13540. }
  13541. return elem;
  13542. }
  13543. jQuery.extend( {
  13544. htmlPrefilter: function( html ) {
  13545. return html.replace( rxhtmlTag, "<$1></$2>" );
  13546. },
  13547. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13548. var i, l, srcElements, destElements,
  13549. clone = elem.cloneNode( true ),
  13550. inPage = isAttached( elem );
  13551. // Fix IE cloning issues
  13552. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13553. !jQuery.isXMLDoc( elem ) ) {
  13554. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13555. destElements = getAll( clone );
  13556. srcElements = getAll( elem );
  13557. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13558. fixInput( srcElements[ i ], destElements[ i ] );
  13559. }
  13560. }
  13561. // Copy the events from the original to the clone
  13562. if ( dataAndEvents ) {
  13563. if ( deepDataAndEvents ) {
  13564. srcElements = srcElements || getAll( elem );
  13565. destElements = destElements || getAll( clone );
  13566. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13567. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13568. }
  13569. } else {
  13570. cloneCopyEvent( elem, clone );
  13571. }
  13572. }
  13573. // Preserve script evaluation history
  13574. destElements = getAll( clone, "script" );
  13575. if ( destElements.length > 0 ) {
  13576. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13577. }
  13578. // Return the cloned set
  13579. return clone;
  13580. },
  13581. cleanData: function( elems ) {
  13582. var data, elem, type,
  13583. special = jQuery.event.special,
  13584. i = 0;
  13585. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13586. if ( acceptData( elem ) ) {
  13587. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13588. if ( data.events ) {
  13589. for ( type in data.events ) {
  13590. if ( special[ type ] ) {
  13591. jQuery.event.remove( elem, type );
  13592. // This is a shortcut to avoid jQuery.event.remove's overhead
  13593. } else {
  13594. jQuery.removeEvent( elem, type, data.handle );
  13595. }
  13596. }
  13597. }
  13598. // Support: Chrome <=35 - 45+
  13599. // Assign undefined instead of using delete, see Data#remove
  13600. elem[ dataPriv.expando ] = undefined;
  13601. }
  13602. if ( elem[ dataUser.expando ] ) {
  13603. // Support: Chrome <=35 - 45+
  13604. // Assign undefined instead of using delete, see Data#remove
  13605. elem[ dataUser.expando ] = undefined;
  13606. }
  13607. }
  13608. }
  13609. }
  13610. } );
  13611. jQuery.fn.extend( {
  13612. detach: function( selector ) {
  13613. return remove( this, selector, true );
  13614. },
  13615. remove: function( selector ) {
  13616. return remove( this, selector );
  13617. },
  13618. text: function( value ) {
  13619. return access( this, function( value ) {
  13620. return value === undefined ?
  13621. jQuery.text( this ) :
  13622. this.empty().each( function() {
  13623. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13624. this.textContent = value;
  13625. }
  13626. } );
  13627. }, null, value, arguments.length );
  13628. },
  13629. append: function() {
  13630. return domManip( this, arguments, function( elem ) {
  13631. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13632. var target = manipulationTarget( this, elem );
  13633. target.appendChild( elem );
  13634. }
  13635. } );
  13636. },
  13637. prepend: function() {
  13638. return domManip( this, arguments, function( elem ) {
  13639. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13640. var target = manipulationTarget( this, elem );
  13641. target.insertBefore( elem, target.firstChild );
  13642. }
  13643. } );
  13644. },
  13645. before: function() {
  13646. return domManip( this, arguments, function( elem ) {
  13647. if ( this.parentNode ) {
  13648. this.parentNode.insertBefore( elem, this );
  13649. }
  13650. } );
  13651. },
  13652. after: function() {
  13653. return domManip( this, arguments, function( elem ) {
  13654. if ( this.parentNode ) {
  13655. this.parentNode.insertBefore( elem, this.nextSibling );
  13656. }
  13657. } );
  13658. },
  13659. empty: function() {
  13660. var elem,
  13661. i = 0;
  13662. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13663. if ( elem.nodeType === 1 ) {
  13664. // Prevent memory leaks
  13665. jQuery.cleanData( getAll( elem, false ) );
  13666. // Remove any remaining nodes
  13667. elem.textContent = "";
  13668. }
  13669. }
  13670. return this;
  13671. },
  13672. clone: function( dataAndEvents, deepDataAndEvents ) {
  13673. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13674. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13675. return this.map( function() {
  13676. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13677. } );
  13678. },
  13679. html: function( value ) {
  13680. return access( this, function( value ) {
  13681. var elem = this[ 0 ] || {},
  13682. i = 0,
  13683. l = this.length;
  13684. if ( value === undefined && elem.nodeType === 1 ) {
  13685. return elem.innerHTML;
  13686. }
  13687. // See if we can take a shortcut and just use innerHTML
  13688. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13689. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13690. value = jQuery.htmlPrefilter( value );
  13691. try {
  13692. for ( ; i < l; i++ ) {
  13693. elem = this[ i ] || {};
  13694. // Remove element nodes and prevent memory leaks
  13695. if ( elem.nodeType === 1 ) {
  13696. jQuery.cleanData( getAll( elem, false ) );
  13697. elem.innerHTML = value;
  13698. }
  13699. }
  13700. elem = 0;
  13701. // If using innerHTML throws an exception, use the fallback method
  13702. } catch ( e ) {}
  13703. }
  13704. if ( elem ) {
  13705. this.empty().append( value );
  13706. }
  13707. }, null, value, arguments.length );
  13708. },
  13709. replaceWith: function() {
  13710. var ignored = [];
  13711. // Make the changes, replacing each non-ignored context element with the new content
  13712. return domManip( this, arguments, function( elem ) {
  13713. var parent = this.parentNode;
  13714. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13715. jQuery.cleanData( getAll( this ) );
  13716. if ( parent ) {
  13717. parent.replaceChild( elem, this );
  13718. }
  13719. }
  13720. // Force callback invocation
  13721. }, ignored );
  13722. }
  13723. } );
  13724. jQuery.each( {
  13725. appendTo: "append",
  13726. prependTo: "prepend",
  13727. insertBefore: "before",
  13728. insertAfter: "after",
  13729. replaceAll: "replaceWith"
  13730. }, function( name, original ) {
  13731. jQuery.fn[ name ] = function( selector ) {
  13732. var elems,
  13733. ret = [],
  13734. insert = jQuery( selector ),
  13735. last = insert.length - 1,
  13736. i = 0;
  13737. for ( ; i <= last; i++ ) {
  13738. elems = i === last ? this : this.clone( true );
  13739. jQuery( insert[ i ] )[ original ]( elems );
  13740. // Support: Android <=4.0 only, PhantomJS 1 only
  13741. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13742. push.apply( ret, elems.get() );
  13743. }
  13744. return this.pushStack( ret );
  13745. };
  13746. } );
  13747. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13748. var getStyles = function( elem ) {
  13749. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13750. // IE throws on elements created in popups
  13751. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13752. var view = elem.ownerDocument.defaultView;
  13753. if ( !view || !view.opener ) {
  13754. view = window;
  13755. }
  13756. return view.getComputedStyle( elem );
  13757. };
  13758. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13759. ( function() {
  13760. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13761. // so they're executed at the same time to save the second computation.
  13762. function computeStyleTests() {
  13763. // This is a singleton, we need to execute it only once
  13764. if ( !div ) {
  13765. return;
  13766. }
  13767. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13768. "margin-top:1px;padding:0;border:0";
  13769. div.style.cssText =
  13770. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13771. "margin:auto;border:1px;padding:1px;" +
  13772. "width:60%;top:1%";
  13773. documentElement.appendChild( container ).appendChild( div );
  13774. var divStyle = window.getComputedStyle( div );
  13775. pixelPositionVal = divStyle.top !== "1%";
  13776. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13777. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13778. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13779. // Some styles come back with percentage values, even though they shouldn't
  13780. div.style.right = "60%";
  13781. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13782. // Support: IE 9 - 11 only
  13783. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13784. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13785. // Support: IE 9 only
  13786. // Detect overflow:scroll screwiness (gh-3699)
  13787. // Support: Chrome <=64
  13788. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13789. div.style.position = "absolute";
  13790. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13791. documentElement.removeChild( container );
  13792. // Nullify the div so it wouldn't be stored in the memory and
  13793. // it will also be a sign that checks already performed
  13794. div = null;
  13795. }
  13796. function roundPixelMeasures( measure ) {
  13797. return Math.round( parseFloat( measure ) );
  13798. }
  13799. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13800. reliableMarginLeftVal,
  13801. container = document.createElement( "div" ),
  13802. div = document.createElement( "div" );
  13803. // Finish early in limited (non-browser) environments
  13804. if ( !div.style ) {
  13805. return;
  13806. }
  13807. // Support: IE <=9 - 11 only
  13808. // Style of cloned element affects source element cloned (#8908)
  13809. div.style.backgroundClip = "content-box";
  13810. div.cloneNode( true ).style.backgroundClip = "";
  13811. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13812. jQuery.extend( support, {
  13813. boxSizingReliable: function() {
  13814. computeStyleTests();
  13815. return boxSizingReliableVal;
  13816. },
  13817. pixelBoxStyles: function() {
  13818. computeStyleTests();
  13819. return pixelBoxStylesVal;
  13820. },
  13821. pixelPosition: function() {
  13822. computeStyleTests();
  13823. return pixelPositionVal;
  13824. },
  13825. reliableMarginLeft: function() {
  13826. computeStyleTests();
  13827. return reliableMarginLeftVal;
  13828. },
  13829. scrollboxSize: function() {
  13830. computeStyleTests();
  13831. return scrollboxSizeVal;
  13832. }
  13833. } );
  13834. } )();
  13835. function curCSS( elem, name, computed ) {
  13836. var width, minWidth, maxWidth, ret,
  13837. // Support: Firefox 51+
  13838. // Retrieving style before computed somehow
  13839. // fixes an issue with getting wrong values
  13840. // on detached elements
  13841. style = elem.style;
  13842. computed = computed || getStyles( elem );
  13843. // getPropertyValue is needed for:
  13844. // .css('filter') (IE 9 only, #12537)
  13845. // .css('--customProperty) (#3144)
  13846. if ( computed ) {
  13847. ret = computed.getPropertyValue( name ) || computed[ name ];
  13848. if ( ret === "" && !isAttached( elem ) ) {
  13849. ret = jQuery.style( elem, name );
  13850. }
  13851. // A tribute to the "awesome hack by Dean Edwards"
  13852. // Android Browser returns percentage for some values,
  13853. // but width seems to be reliably pixels.
  13854. // This is against the CSSOM draft spec:
  13855. // https://drafts.csswg.org/cssom/#resolved-values
  13856. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13857. // Remember the original values
  13858. width = style.width;
  13859. minWidth = style.minWidth;
  13860. maxWidth = style.maxWidth;
  13861. // Put in the new values to get a computed value out
  13862. style.minWidth = style.maxWidth = style.width = ret;
  13863. ret = computed.width;
  13864. // Revert the changed values
  13865. style.width = width;
  13866. style.minWidth = minWidth;
  13867. style.maxWidth = maxWidth;
  13868. }
  13869. }
  13870. return ret !== undefined ?
  13871. // Support: IE <=9 - 11 only
  13872. // IE returns zIndex value as an integer.
  13873. ret + "" :
  13874. ret;
  13875. }
  13876. function addGetHookIf( conditionFn, hookFn ) {
  13877. // Define the hook, we'll check on the first run if it's really needed.
  13878. return {
  13879. get: function() {
  13880. if ( conditionFn() ) {
  13881. // Hook not needed (or it's not possible to use it due
  13882. // to missing dependency), remove it.
  13883. delete this.get;
  13884. return;
  13885. }
  13886. // Hook needed; redefine it so that the support test is not executed again.
  13887. return ( this.get = hookFn ).apply( this, arguments );
  13888. }
  13889. };
  13890. }
  13891. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13892. emptyStyle = document.createElement( "div" ).style,
  13893. vendorProps = {};
  13894. // Return a vendor-prefixed property or undefined
  13895. function vendorPropName( name ) {
  13896. // Check for vendor prefixed names
  13897. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13898. i = cssPrefixes.length;
  13899. while ( i-- ) {
  13900. name = cssPrefixes[ i ] + capName;
  13901. if ( name in emptyStyle ) {
  13902. return name;
  13903. }
  13904. }
  13905. }
  13906. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13907. function finalPropName( name ) {
  13908. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13909. if ( final ) {
  13910. return final;
  13911. }
  13912. if ( name in emptyStyle ) {
  13913. return name;
  13914. }
  13915. return vendorProps[ name ] = vendorPropName( name ) || name;
  13916. }
  13917. var
  13918. // Swappable if display is none or starts with table
  13919. // except "table", "table-cell", or "table-caption"
  13920. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13921. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13922. rcustomProp = /^--/,
  13923. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13924. cssNormalTransform = {
  13925. letterSpacing: "0",
  13926. fontWeight: "400"
  13927. };
  13928. function setPositiveNumber( elem, value, subtract ) {
  13929. // Any relative (+/-) values have already been
  13930. // normalized at this point
  13931. var matches = rcssNum.exec( value );
  13932. return matches ?
  13933. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13934. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13935. value;
  13936. }
  13937. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13938. var i = dimension === "width" ? 1 : 0,
  13939. extra = 0,
  13940. delta = 0;
  13941. // Adjustment may not be necessary
  13942. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13943. return 0;
  13944. }
  13945. for ( ; i < 4; i += 2 ) {
  13946. // Both box models exclude margin
  13947. if ( box === "margin" ) {
  13948. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13949. }
  13950. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13951. if ( !isBorderBox ) {
  13952. // Add padding
  13953. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13954. // For "border" or "margin", add border
  13955. if ( box !== "padding" ) {
  13956. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13957. // But still keep track of it otherwise
  13958. } else {
  13959. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13960. }
  13961. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13962. // "padding" or "margin"
  13963. } else {
  13964. // For "content", subtract padding
  13965. if ( box === "content" ) {
  13966. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13967. }
  13968. // For "content" or "padding", subtract border
  13969. if ( box !== "margin" ) {
  13970. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13971. }
  13972. }
  13973. }
  13974. // Account for positive content-box scroll gutter when requested by providing computedVal
  13975. if ( !isBorderBox && computedVal >= 0 ) {
  13976. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13977. // Assuming integer scroll gutter, subtract the rest and round down
  13978. delta += Math.max( 0, Math.ceil(
  13979. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13980. computedVal -
  13981. delta -
  13982. extra -
  13983. 0.5
  13984. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13985. // Use an explicit zero to avoid NaN (gh-3964)
  13986. ) ) || 0;
  13987. }
  13988. return delta;
  13989. }
  13990. function getWidthOrHeight( elem, dimension, extra ) {
  13991. // Start with computed style
  13992. var styles = getStyles( elem ),
  13993. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13994. // Fake content-box until we know it's needed to know the true value.
  13995. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13996. isBorderBox = boxSizingNeeded &&
  13997. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13998. valueIsBorderBox = isBorderBox,
  13999. val = curCSS( elem, dimension, styles ),
  14000. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14001. // Support: Firefox <=54
  14002. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14003. if ( rnumnonpx.test( val ) ) {
  14004. if ( !extra ) {
  14005. return val;
  14006. }
  14007. val = "auto";
  14008. }
  14009. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14010. // This happens for inline elements with no explicit setting (gh-3571)
  14011. // Support: Android <=4.1 - 4.3 only
  14012. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14013. // Support: IE 9-11 only
  14014. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14015. // We use getClientRects() to check for hidden/disconnected.
  14016. // In those cases, the computed value can be trusted to be border-box
  14017. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14018. val === "auto" ||
  14019. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14020. elem.getClientRects().length ) {
  14021. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14022. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14023. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14024. // retrieved value as a content box dimension.
  14025. valueIsBorderBox = offsetProp in elem;
  14026. if ( valueIsBorderBox ) {
  14027. val = elem[ offsetProp ];
  14028. }
  14029. }
  14030. // Normalize "" and auto
  14031. val = parseFloat( val ) || 0;
  14032. // Adjust for the element's box model
  14033. return ( val +
  14034. boxModelAdjustment(
  14035. elem,
  14036. dimension,
  14037. extra || ( isBorderBox ? "border" : "content" ),
  14038. valueIsBorderBox,
  14039. styles,
  14040. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14041. val
  14042. )
  14043. ) + "px";
  14044. }
  14045. jQuery.extend( {
  14046. // Add in style property hooks for overriding the default
  14047. // behavior of getting and setting a style property
  14048. cssHooks: {
  14049. opacity: {
  14050. get: function( elem, computed ) {
  14051. if ( computed ) {
  14052. // We should always get a number back from opacity
  14053. var ret = curCSS( elem, "opacity" );
  14054. return ret === "" ? "1" : ret;
  14055. }
  14056. }
  14057. }
  14058. },
  14059. // Don't automatically add "px" to these possibly-unitless properties
  14060. cssNumber: {
  14061. "animationIterationCount": true,
  14062. "columnCount": true,
  14063. "fillOpacity": true,
  14064. "flexGrow": true,
  14065. "flexShrink": true,
  14066. "fontWeight": true,
  14067. "gridArea": true,
  14068. "gridColumn": true,
  14069. "gridColumnEnd": true,
  14070. "gridColumnStart": true,
  14071. "gridRow": true,
  14072. "gridRowEnd": true,
  14073. "gridRowStart": true,
  14074. "lineHeight": true,
  14075. "opacity": true,
  14076. "order": true,
  14077. "orphans": true,
  14078. "widows": true,
  14079. "zIndex": true,
  14080. "zoom": true
  14081. },
  14082. // Add in properties whose names you wish to fix before
  14083. // setting or getting the value
  14084. cssProps: {},
  14085. // Get and set the style property on a DOM Node
  14086. style: function( elem, name, value, extra ) {
  14087. // Don't set styles on text and comment nodes
  14088. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14089. return;
  14090. }
  14091. // Make sure that we're working with the right name
  14092. var ret, type, hooks,
  14093. origName = camelCase( name ),
  14094. isCustomProp = rcustomProp.test( name ),
  14095. style = elem.style;
  14096. // Make sure that we're working with the right name. We don't
  14097. // want to query the value if it is a CSS custom property
  14098. // since they are user-defined.
  14099. if ( !isCustomProp ) {
  14100. name = finalPropName( origName );
  14101. }
  14102. // Gets hook for the prefixed version, then unprefixed version
  14103. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14104. // Check if we're setting a value
  14105. if ( value !== undefined ) {
  14106. type = typeof value;
  14107. // Convert "+=" or "-=" to relative numbers (#7345)
  14108. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14109. value = adjustCSS( elem, name, ret );
  14110. // Fixes bug #9237
  14111. type = "number";
  14112. }
  14113. // Make sure that null and NaN values aren't set (#7116)
  14114. if ( value == null || value !== value ) {
  14115. return;
  14116. }
  14117. // If a number was passed in, add the unit (except for certain CSS properties)
  14118. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14119. // "px" to a few hardcoded values.
  14120. if ( type === "number" && !isCustomProp ) {
  14121. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14122. }
  14123. // background-* props affect original clone's values
  14124. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14125. style[ name ] = "inherit";
  14126. }
  14127. // If a hook was provided, use that value, otherwise just set the specified value
  14128. if ( !hooks || !( "set" in hooks ) ||
  14129. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14130. if ( isCustomProp ) {
  14131. style.setProperty( name, value );
  14132. } else {
  14133. style[ name ] = value;
  14134. }
  14135. }
  14136. } else {
  14137. // If a hook was provided get the non-computed value from there
  14138. if ( hooks && "get" in hooks &&
  14139. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14140. return ret;
  14141. }
  14142. // Otherwise just get the value from the style object
  14143. return style[ name ];
  14144. }
  14145. },
  14146. css: function( elem, name, extra, styles ) {
  14147. var val, num, hooks,
  14148. origName = camelCase( name ),
  14149. isCustomProp = rcustomProp.test( name );
  14150. // Make sure that we're working with the right name. We don't
  14151. // want to modify the value if it is a CSS custom property
  14152. // since they are user-defined.
  14153. if ( !isCustomProp ) {
  14154. name = finalPropName( origName );
  14155. }
  14156. // Try prefixed name followed by the unprefixed name
  14157. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14158. // If a hook was provided get the computed value from there
  14159. if ( hooks && "get" in hooks ) {
  14160. val = hooks.get( elem, true, extra );
  14161. }
  14162. // Otherwise, if a way to get the computed value exists, use that
  14163. if ( val === undefined ) {
  14164. val = curCSS( elem, name, styles );
  14165. }
  14166. // Convert "normal" to computed value
  14167. if ( val === "normal" && name in cssNormalTransform ) {
  14168. val = cssNormalTransform[ name ];
  14169. }
  14170. // Make numeric if forced or a qualifier was provided and val looks numeric
  14171. if ( extra === "" || extra ) {
  14172. num = parseFloat( val );
  14173. return extra === true || isFinite( num ) ? num || 0 : val;
  14174. }
  14175. return val;
  14176. }
  14177. } );
  14178. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14179. jQuery.cssHooks[ dimension ] = {
  14180. get: function( elem, computed, extra ) {
  14181. if ( computed ) {
  14182. // Certain elements can have dimension info if we invisibly show them
  14183. // but it must have a current display style that would benefit
  14184. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14185. // Support: Safari 8+
  14186. // Table columns in Safari have non-zero offsetWidth & zero
  14187. // getBoundingClientRect().width unless display is changed.
  14188. // Support: IE <=11 only
  14189. // Running getBoundingClientRect on a disconnected node
  14190. // in IE throws an error.
  14191. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14192. swap( elem, cssShow, function() {
  14193. return getWidthOrHeight( elem, dimension, extra );
  14194. } ) :
  14195. getWidthOrHeight( elem, dimension, extra );
  14196. }
  14197. },
  14198. set: function( elem, value, extra ) {
  14199. var matches,
  14200. styles = getStyles( elem ),
  14201. // Only read styles.position if the test has a chance to fail
  14202. // to avoid forcing a reflow.
  14203. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14204. styles.position === "absolute",
  14205. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14206. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14207. isBorderBox = boxSizingNeeded &&
  14208. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14209. subtract = extra ?
  14210. boxModelAdjustment(
  14211. elem,
  14212. dimension,
  14213. extra,
  14214. isBorderBox,
  14215. styles
  14216. ) :
  14217. 0;
  14218. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14219. // faking a content-box to get border and padding (gh-3699)
  14220. if ( isBorderBox && scrollboxSizeBuggy ) {
  14221. subtract -= Math.ceil(
  14222. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14223. parseFloat( styles[ dimension ] ) -
  14224. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14225. 0.5
  14226. );
  14227. }
  14228. // Convert to pixels if value adjustment is needed
  14229. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14230. ( matches[ 3 ] || "px" ) !== "px" ) {
  14231. elem.style[ dimension ] = value;
  14232. value = jQuery.css( elem, dimension );
  14233. }
  14234. return setPositiveNumber( elem, value, subtract );
  14235. }
  14236. };
  14237. } );
  14238. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14239. function( elem, computed ) {
  14240. if ( computed ) {
  14241. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14242. elem.getBoundingClientRect().left -
  14243. swap( elem, { marginLeft: 0 }, function() {
  14244. return elem.getBoundingClientRect().left;
  14245. } )
  14246. ) + "px";
  14247. }
  14248. }
  14249. );
  14250. // These hooks are used by animate to expand properties
  14251. jQuery.each( {
  14252. margin: "",
  14253. padding: "",
  14254. border: "Width"
  14255. }, function( prefix, suffix ) {
  14256. jQuery.cssHooks[ prefix + suffix ] = {
  14257. expand: function( value ) {
  14258. var i = 0,
  14259. expanded = {},
  14260. // Assumes a single number if not a string
  14261. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14262. for ( ; i < 4; i++ ) {
  14263. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14264. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14265. }
  14266. return expanded;
  14267. }
  14268. };
  14269. if ( prefix !== "margin" ) {
  14270. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14271. }
  14272. } );
  14273. jQuery.fn.extend( {
  14274. css: function( name, value ) {
  14275. return access( this, function( elem, name, value ) {
  14276. var styles, len,
  14277. map = {},
  14278. i = 0;
  14279. if ( Array.isArray( name ) ) {
  14280. styles = getStyles( elem );
  14281. len = name.length;
  14282. for ( ; i < len; i++ ) {
  14283. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14284. }
  14285. return map;
  14286. }
  14287. return value !== undefined ?
  14288. jQuery.style( elem, name, value ) :
  14289. jQuery.css( elem, name );
  14290. }, name, value, arguments.length > 1 );
  14291. }
  14292. } );
  14293. function Tween( elem, options, prop, end, easing ) {
  14294. return new Tween.prototype.init( elem, options, prop, end, easing );
  14295. }
  14296. jQuery.Tween = Tween;
  14297. Tween.prototype = {
  14298. constructor: Tween,
  14299. init: function( elem, options, prop, end, easing, unit ) {
  14300. this.elem = elem;
  14301. this.prop = prop;
  14302. this.easing = easing || jQuery.easing._default;
  14303. this.options = options;
  14304. this.start = this.now = this.cur();
  14305. this.end = end;
  14306. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14307. },
  14308. cur: function() {
  14309. var hooks = Tween.propHooks[ this.prop ];
  14310. return hooks && hooks.get ?
  14311. hooks.get( this ) :
  14312. Tween.propHooks._default.get( this );
  14313. },
  14314. run: function( percent ) {
  14315. var eased,
  14316. hooks = Tween.propHooks[ this.prop ];
  14317. if ( this.options.duration ) {
  14318. this.pos = eased = jQuery.easing[ this.easing ](
  14319. percent, this.options.duration * percent, 0, 1, this.options.duration
  14320. );
  14321. } else {
  14322. this.pos = eased = percent;
  14323. }
  14324. this.now = ( this.end - this.start ) * eased + this.start;
  14325. if ( this.options.step ) {
  14326. this.options.step.call( this.elem, this.now, this );
  14327. }
  14328. if ( hooks && hooks.set ) {
  14329. hooks.set( this );
  14330. } else {
  14331. Tween.propHooks._default.set( this );
  14332. }
  14333. return this;
  14334. }
  14335. };
  14336. Tween.prototype.init.prototype = Tween.prototype;
  14337. Tween.propHooks = {
  14338. _default: {
  14339. get: function( tween ) {
  14340. var result;
  14341. // Use a property on the element directly when it is not a DOM element,
  14342. // or when there is no matching style property that exists.
  14343. if ( tween.elem.nodeType !== 1 ||
  14344. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14345. return tween.elem[ tween.prop ];
  14346. }
  14347. // Passing an empty string as a 3rd parameter to .css will automatically
  14348. // attempt a parseFloat and fallback to a string if the parse fails.
  14349. // Simple values such as "10px" are parsed to Float;
  14350. // complex values such as "rotate(1rad)" are returned as-is.
  14351. result = jQuery.css( tween.elem, tween.prop, "" );
  14352. // Empty strings, null, undefined and "auto" are converted to 0.
  14353. return !result || result === "auto" ? 0 : result;
  14354. },
  14355. set: function( tween ) {
  14356. // Use step hook for back compat.
  14357. // Use cssHook if its there.
  14358. // Use .style if available and use plain properties where available.
  14359. if ( jQuery.fx.step[ tween.prop ] ) {
  14360. jQuery.fx.step[ tween.prop ]( tween );
  14361. } else if ( tween.elem.nodeType === 1 && (
  14362. jQuery.cssHooks[ tween.prop ] ||
  14363. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14364. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14365. } else {
  14366. tween.elem[ tween.prop ] = tween.now;
  14367. }
  14368. }
  14369. }
  14370. };
  14371. // Support: IE <=9 only
  14372. // Panic based approach to setting things on disconnected nodes
  14373. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14374. set: function( tween ) {
  14375. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14376. tween.elem[ tween.prop ] = tween.now;
  14377. }
  14378. }
  14379. };
  14380. jQuery.easing = {
  14381. linear: function( p ) {
  14382. return p;
  14383. },
  14384. swing: function( p ) {
  14385. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14386. },
  14387. _default: "swing"
  14388. };
  14389. jQuery.fx = Tween.prototype.init;
  14390. // Back compat <1.8 extension point
  14391. jQuery.fx.step = {};
  14392. var
  14393. fxNow, inProgress,
  14394. rfxtypes = /^(?:toggle|show|hide)$/,
  14395. rrun = /queueHooks$/;
  14396. function schedule() {
  14397. if ( inProgress ) {
  14398. if ( document.hidden === false && window.requestAnimationFrame ) {
  14399. window.requestAnimationFrame( schedule );
  14400. } else {
  14401. window.setTimeout( schedule, jQuery.fx.interval );
  14402. }
  14403. jQuery.fx.tick();
  14404. }
  14405. }
  14406. // Animations created synchronously will run synchronously
  14407. function createFxNow() {
  14408. window.setTimeout( function() {
  14409. fxNow = undefined;
  14410. } );
  14411. return ( fxNow = Date.now() );
  14412. }
  14413. // Generate parameters to create a standard animation
  14414. function genFx( type, includeWidth ) {
  14415. var which,
  14416. i = 0,
  14417. attrs = { height: type };
  14418. // If we include width, step value is 1 to do all cssExpand values,
  14419. // otherwise step value is 2 to skip over Left and Right
  14420. includeWidth = includeWidth ? 1 : 0;
  14421. for ( ; i < 4; i += 2 - includeWidth ) {
  14422. which = cssExpand[ i ];
  14423. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14424. }
  14425. if ( includeWidth ) {
  14426. attrs.opacity = attrs.width = type;
  14427. }
  14428. return attrs;
  14429. }
  14430. function createTween( value, prop, animation ) {
  14431. var tween,
  14432. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14433. index = 0,
  14434. length = collection.length;
  14435. for ( ; index < length; index++ ) {
  14436. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14437. // We're done with this property
  14438. return tween;
  14439. }
  14440. }
  14441. }
  14442. function defaultPrefilter( elem, props, opts ) {
  14443. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14444. isBox = "width" in props || "height" in props,
  14445. anim = this,
  14446. orig = {},
  14447. style = elem.style,
  14448. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14449. dataShow = dataPriv.get( elem, "fxshow" );
  14450. // Queue-skipping animations hijack the fx hooks
  14451. if ( !opts.queue ) {
  14452. hooks = jQuery._queueHooks( elem, "fx" );
  14453. if ( hooks.unqueued == null ) {
  14454. hooks.unqueued = 0;
  14455. oldfire = hooks.empty.fire;
  14456. hooks.empty.fire = function() {
  14457. if ( !hooks.unqueued ) {
  14458. oldfire();
  14459. }
  14460. };
  14461. }
  14462. hooks.unqueued++;
  14463. anim.always( function() {
  14464. // Ensure the complete handler is called before this completes
  14465. anim.always( function() {
  14466. hooks.unqueued--;
  14467. if ( !jQuery.queue( elem, "fx" ).length ) {
  14468. hooks.empty.fire();
  14469. }
  14470. } );
  14471. } );
  14472. }
  14473. // Detect show/hide animations
  14474. for ( prop in props ) {
  14475. value = props[ prop ];
  14476. if ( rfxtypes.test( value ) ) {
  14477. delete props[ prop ];
  14478. toggle = toggle || value === "toggle";
  14479. if ( value === ( hidden ? "hide" : "show" ) ) {
  14480. // Pretend to be hidden if this is a "show" and
  14481. // there is still data from a stopped show/hide
  14482. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14483. hidden = true;
  14484. // Ignore all other no-op show/hide data
  14485. } else {
  14486. continue;
  14487. }
  14488. }
  14489. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14490. }
  14491. }
  14492. // Bail out if this is a no-op like .hide().hide()
  14493. propTween = !jQuery.isEmptyObject( props );
  14494. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14495. return;
  14496. }
  14497. // Restrict "overflow" and "display" styles during box animations
  14498. if ( isBox && elem.nodeType === 1 ) {
  14499. // Support: IE <=9 - 11, Edge 12 - 15
  14500. // Record all 3 overflow attributes because IE does not infer the shorthand
  14501. // from identically-valued overflowX and overflowY and Edge just mirrors
  14502. // the overflowX value there.
  14503. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14504. // Identify a display type, preferring old show/hide data over the CSS cascade
  14505. restoreDisplay = dataShow && dataShow.display;
  14506. if ( restoreDisplay == null ) {
  14507. restoreDisplay = dataPriv.get( elem, "display" );
  14508. }
  14509. display = jQuery.css( elem, "display" );
  14510. if ( display === "none" ) {
  14511. if ( restoreDisplay ) {
  14512. display = restoreDisplay;
  14513. } else {
  14514. // Get nonempty value(s) by temporarily forcing visibility
  14515. showHide( [ elem ], true );
  14516. restoreDisplay = elem.style.display || restoreDisplay;
  14517. display = jQuery.css( elem, "display" );
  14518. showHide( [ elem ] );
  14519. }
  14520. }
  14521. // Animate inline elements as inline-block
  14522. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14523. if ( jQuery.css( elem, "float" ) === "none" ) {
  14524. // Restore the original display value at the end of pure show/hide animations
  14525. if ( !propTween ) {
  14526. anim.done( function() {
  14527. style.display = restoreDisplay;
  14528. } );
  14529. if ( restoreDisplay == null ) {
  14530. display = style.display;
  14531. restoreDisplay = display === "none" ? "" : display;
  14532. }
  14533. }
  14534. style.display = "inline-block";
  14535. }
  14536. }
  14537. }
  14538. if ( opts.overflow ) {
  14539. style.overflow = "hidden";
  14540. anim.always( function() {
  14541. style.overflow = opts.overflow[ 0 ];
  14542. style.overflowX = opts.overflow[ 1 ];
  14543. style.overflowY = opts.overflow[ 2 ];
  14544. } );
  14545. }
  14546. // Implement show/hide animations
  14547. propTween = false;
  14548. for ( prop in orig ) {
  14549. // General show/hide setup for this element animation
  14550. if ( !propTween ) {
  14551. if ( dataShow ) {
  14552. if ( "hidden" in dataShow ) {
  14553. hidden = dataShow.hidden;
  14554. }
  14555. } else {
  14556. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14557. }
  14558. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14559. if ( toggle ) {
  14560. dataShow.hidden = !hidden;
  14561. }
  14562. // Show elements before animating them
  14563. if ( hidden ) {
  14564. showHide( [ elem ], true );
  14565. }
  14566. /* eslint-disable no-loop-func */
  14567. anim.done( function() {
  14568. /* eslint-enable no-loop-func */
  14569. // The final step of a "hide" animation is actually hiding the element
  14570. if ( !hidden ) {
  14571. showHide( [ elem ] );
  14572. }
  14573. dataPriv.remove( elem, "fxshow" );
  14574. for ( prop in orig ) {
  14575. jQuery.style( elem, prop, orig[ prop ] );
  14576. }
  14577. } );
  14578. }
  14579. // Per-property setup
  14580. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14581. if ( !( prop in dataShow ) ) {
  14582. dataShow[ prop ] = propTween.start;
  14583. if ( hidden ) {
  14584. propTween.end = propTween.start;
  14585. propTween.start = 0;
  14586. }
  14587. }
  14588. }
  14589. }
  14590. function propFilter( props, specialEasing ) {
  14591. var index, name, easing, value, hooks;
  14592. // camelCase, specialEasing and expand cssHook pass
  14593. for ( index in props ) {
  14594. name = camelCase( index );
  14595. easing = specialEasing[ name ];
  14596. value = props[ index ];
  14597. if ( Array.isArray( value ) ) {
  14598. easing = value[ 1 ];
  14599. value = props[ index ] = value[ 0 ];
  14600. }
  14601. if ( index !== name ) {
  14602. props[ name ] = value;
  14603. delete props[ index ];
  14604. }
  14605. hooks = jQuery.cssHooks[ name ];
  14606. if ( hooks && "expand" in hooks ) {
  14607. value = hooks.expand( value );
  14608. delete props[ name ];
  14609. // Not quite $.extend, this won't overwrite existing keys.
  14610. // Reusing 'index' because we have the correct "name"
  14611. for ( index in value ) {
  14612. if ( !( index in props ) ) {
  14613. props[ index ] = value[ index ];
  14614. specialEasing[ index ] = easing;
  14615. }
  14616. }
  14617. } else {
  14618. specialEasing[ name ] = easing;
  14619. }
  14620. }
  14621. }
  14622. function Animation( elem, properties, options ) {
  14623. var result,
  14624. stopped,
  14625. index = 0,
  14626. length = Animation.prefilters.length,
  14627. deferred = jQuery.Deferred().always( function() {
  14628. // Don't match elem in the :animated selector
  14629. delete tick.elem;
  14630. } ),
  14631. tick = function() {
  14632. if ( stopped ) {
  14633. return false;
  14634. }
  14635. var currentTime = fxNow || createFxNow(),
  14636. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14637. // Support: Android 2.3 only
  14638. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14639. temp = remaining / animation.duration || 0,
  14640. percent = 1 - temp,
  14641. index = 0,
  14642. length = animation.tweens.length;
  14643. for ( ; index < length; index++ ) {
  14644. animation.tweens[ index ].run( percent );
  14645. }
  14646. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14647. // If there's more to do, yield
  14648. if ( percent < 1 && length ) {
  14649. return remaining;
  14650. }
  14651. // If this was an empty animation, synthesize a final progress notification
  14652. if ( !length ) {
  14653. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14654. }
  14655. // Resolve the animation and report its conclusion
  14656. deferred.resolveWith( elem, [ animation ] );
  14657. return false;
  14658. },
  14659. animation = deferred.promise( {
  14660. elem: elem,
  14661. props: jQuery.extend( {}, properties ),
  14662. opts: jQuery.extend( true, {
  14663. specialEasing: {},
  14664. easing: jQuery.easing._default
  14665. }, options ),
  14666. originalProperties: properties,
  14667. originalOptions: options,
  14668. startTime: fxNow || createFxNow(),
  14669. duration: options.duration,
  14670. tweens: [],
  14671. createTween: function( prop, end ) {
  14672. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14673. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14674. animation.tweens.push( tween );
  14675. return tween;
  14676. },
  14677. stop: function( gotoEnd ) {
  14678. var index = 0,
  14679. // If we are going to the end, we want to run all the tweens
  14680. // otherwise we skip this part
  14681. length = gotoEnd ? animation.tweens.length : 0;
  14682. if ( stopped ) {
  14683. return this;
  14684. }
  14685. stopped = true;
  14686. for ( ; index < length; index++ ) {
  14687. animation.tweens[ index ].run( 1 );
  14688. }
  14689. // Resolve when we played the last frame; otherwise, reject
  14690. if ( gotoEnd ) {
  14691. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14692. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14693. } else {
  14694. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14695. }
  14696. return this;
  14697. }
  14698. } ),
  14699. props = animation.props;
  14700. propFilter( props, animation.opts.specialEasing );
  14701. for ( ; index < length; index++ ) {
  14702. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14703. if ( result ) {
  14704. if ( isFunction( result.stop ) ) {
  14705. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14706. result.stop.bind( result );
  14707. }
  14708. return result;
  14709. }
  14710. }
  14711. jQuery.map( props, createTween, animation );
  14712. if ( isFunction( animation.opts.start ) ) {
  14713. animation.opts.start.call( elem, animation );
  14714. }
  14715. // Attach callbacks from options
  14716. animation
  14717. .progress( animation.opts.progress )
  14718. .done( animation.opts.done, animation.opts.complete )
  14719. .fail( animation.opts.fail )
  14720. .always( animation.opts.always );
  14721. jQuery.fx.timer(
  14722. jQuery.extend( tick, {
  14723. elem: elem,
  14724. anim: animation,
  14725. queue: animation.opts.queue
  14726. } )
  14727. );
  14728. return animation;
  14729. }
  14730. jQuery.Animation = jQuery.extend( Animation, {
  14731. tweeners: {
  14732. "*": [ function( prop, value ) {
  14733. var tween = this.createTween( prop, value );
  14734. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14735. return tween;
  14736. } ]
  14737. },
  14738. tweener: function( props, callback ) {
  14739. if ( isFunction( props ) ) {
  14740. callback = props;
  14741. props = [ "*" ];
  14742. } else {
  14743. props = props.match( rnothtmlwhite );
  14744. }
  14745. var prop,
  14746. index = 0,
  14747. length = props.length;
  14748. for ( ; index < length; index++ ) {
  14749. prop = props[ index ];
  14750. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14751. Animation.tweeners[ prop ].unshift( callback );
  14752. }
  14753. },
  14754. prefilters: [ defaultPrefilter ],
  14755. prefilter: function( callback, prepend ) {
  14756. if ( prepend ) {
  14757. Animation.prefilters.unshift( callback );
  14758. } else {
  14759. Animation.prefilters.push( callback );
  14760. }
  14761. }
  14762. } );
  14763. jQuery.speed = function( speed, easing, fn ) {
  14764. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14765. complete: fn || !fn && easing ||
  14766. isFunction( speed ) && speed,
  14767. duration: speed,
  14768. easing: fn && easing || easing && !isFunction( easing ) && easing
  14769. };
  14770. // Go to the end state if fx are off
  14771. if ( jQuery.fx.off ) {
  14772. opt.duration = 0;
  14773. } else {
  14774. if ( typeof opt.duration !== "number" ) {
  14775. if ( opt.duration in jQuery.fx.speeds ) {
  14776. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14777. } else {
  14778. opt.duration = jQuery.fx.speeds._default;
  14779. }
  14780. }
  14781. }
  14782. // Normalize opt.queue - true/undefined/null -> "fx"
  14783. if ( opt.queue == null || opt.queue === true ) {
  14784. opt.queue = "fx";
  14785. }
  14786. // Queueing
  14787. opt.old = opt.complete;
  14788. opt.complete = function() {
  14789. if ( isFunction( opt.old ) ) {
  14790. opt.old.call( this );
  14791. }
  14792. if ( opt.queue ) {
  14793. jQuery.dequeue( this, opt.queue );
  14794. }
  14795. };
  14796. return opt;
  14797. };
  14798. jQuery.fn.extend( {
  14799. fadeTo: function( speed, to, easing, callback ) {
  14800. // Show any hidden elements after setting opacity to 0
  14801. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14802. // Animate to the value specified
  14803. .end().animate( { opacity: to }, speed, easing, callback );
  14804. },
  14805. animate: function( prop, speed, easing, callback ) {
  14806. var empty = jQuery.isEmptyObject( prop ),
  14807. optall = jQuery.speed( speed, easing, callback ),
  14808. doAnimation = function() {
  14809. // Operate on a copy of prop so per-property easing won't be lost
  14810. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14811. // Empty animations, or finishing resolves immediately
  14812. if ( empty || dataPriv.get( this, "finish" ) ) {
  14813. anim.stop( true );
  14814. }
  14815. };
  14816. doAnimation.finish = doAnimation;
  14817. return empty || optall.queue === false ?
  14818. this.each( doAnimation ) :
  14819. this.queue( optall.queue, doAnimation );
  14820. },
  14821. stop: function( type, clearQueue, gotoEnd ) {
  14822. var stopQueue = function( hooks ) {
  14823. var stop = hooks.stop;
  14824. delete hooks.stop;
  14825. stop( gotoEnd );
  14826. };
  14827. if ( typeof type !== "string" ) {
  14828. gotoEnd = clearQueue;
  14829. clearQueue = type;
  14830. type = undefined;
  14831. }
  14832. if ( clearQueue && type !== false ) {
  14833. this.queue( type || "fx", [] );
  14834. }
  14835. return this.each( function() {
  14836. var dequeue = true,
  14837. index = type != null && type + "queueHooks",
  14838. timers = jQuery.timers,
  14839. data = dataPriv.get( this );
  14840. if ( index ) {
  14841. if ( data[ index ] && data[ index ].stop ) {
  14842. stopQueue( data[ index ] );
  14843. }
  14844. } else {
  14845. for ( index in data ) {
  14846. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14847. stopQueue( data[ index ] );
  14848. }
  14849. }
  14850. }
  14851. for ( index = timers.length; index--; ) {
  14852. if ( timers[ index ].elem === this &&
  14853. ( type == null || timers[ index ].queue === type ) ) {
  14854. timers[ index ].anim.stop( gotoEnd );
  14855. dequeue = false;
  14856. timers.splice( index, 1 );
  14857. }
  14858. }
  14859. // Start the next in the queue if the last step wasn't forced.
  14860. // Timers currently will call their complete callbacks, which
  14861. // will dequeue but only if they were gotoEnd.
  14862. if ( dequeue || !gotoEnd ) {
  14863. jQuery.dequeue( this, type );
  14864. }
  14865. } );
  14866. },
  14867. finish: function( type ) {
  14868. if ( type !== false ) {
  14869. type = type || "fx";
  14870. }
  14871. return this.each( function() {
  14872. var index,
  14873. data = dataPriv.get( this ),
  14874. queue = data[ type + "queue" ],
  14875. hooks = data[ type + "queueHooks" ],
  14876. timers = jQuery.timers,
  14877. length = queue ? queue.length : 0;
  14878. // Enable finishing flag on private data
  14879. data.finish = true;
  14880. // Empty the queue first
  14881. jQuery.queue( this, type, [] );
  14882. if ( hooks && hooks.stop ) {
  14883. hooks.stop.call( this, true );
  14884. }
  14885. // Look for any active animations, and finish them
  14886. for ( index = timers.length; index--; ) {
  14887. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14888. timers[ index ].anim.stop( true );
  14889. timers.splice( index, 1 );
  14890. }
  14891. }
  14892. // Look for any animations in the old queue and finish them
  14893. for ( index = 0; index < length; index++ ) {
  14894. if ( queue[ index ] && queue[ index ].finish ) {
  14895. queue[ index ].finish.call( this );
  14896. }
  14897. }
  14898. // Turn off finishing flag
  14899. delete data.finish;
  14900. } );
  14901. }
  14902. } );
  14903. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14904. var cssFn = jQuery.fn[ name ];
  14905. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14906. return speed == null || typeof speed === "boolean" ?
  14907. cssFn.apply( this, arguments ) :
  14908. this.animate( genFx( name, true ), speed, easing, callback );
  14909. };
  14910. } );
  14911. // Generate shortcuts for custom animations
  14912. jQuery.each( {
  14913. slideDown: genFx( "show" ),
  14914. slideUp: genFx( "hide" ),
  14915. slideToggle: genFx( "toggle" ),
  14916. fadeIn: { opacity: "show" },
  14917. fadeOut: { opacity: "hide" },
  14918. fadeToggle: { opacity: "toggle" }
  14919. }, function( name, props ) {
  14920. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14921. return this.animate( props, speed, easing, callback );
  14922. };
  14923. } );
  14924. jQuery.timers = [];
  14925. jQuery.fx.tick = function() {
  14926. var timer,
  14927. i = 0,
  14928. timers = jQuery.timers;
  14929. fxNow = Date.now();
  14930. for ( ; i < timers.length; i++ ) {
  14931. timer = timers[ i ];
  14932. // Run the timer and safely remove it when done (allowing for external removal)
  14933. if ( !timer() && timers[ i ] === timer ) {
  14934. timers.splice( i--, 1 );
  14935. }
  14936. }
  14937. if ( !timers.length ) {
  14938. jQuery.fx.stop();
  14939. }
  14940. fxNow = undefined;
  14941. };
  14942. jQuery.fx.timer = function( timer ) {
  14943. jQuery.timers.push( timer );
  14944. jQuery.fx.start();
  14945. };
  14946. jQuery.fx.interval = 13;
  14947. jQuery.fx.start = function() {
  14948. if ( inProgress ) {
  14949. return;
  14950. }
  14951. inProgress = true;
  14952. schedule();
  14953. };
  14954. jQuery.fx.stop = function() {
  14955. inProgress = null;
  14956. };
  14957. jQuery.fx.speeds = {
  14958. slow: 600,
  14959. fast: 200,
  14960. // Default speed
  14961. _default: 400
  14962. };
  14963. // Based off of the plugin by Clint Helfers, with permission.
  14964. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14965. jQuery.fn.delay = function( time, type ) {
  14966. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14967. type = type || "fx";
  14968. return this.queue( type, function( next, hooks ) {
  14969. var timeout = window.setTimeout( next, time );
  14970. hooks.stop = function() {
  14971. window.clearTimeout( timeout );
  14972. };
  14973. } );
  14974. };
  14975. ( function() {
  14976. var input = document.createElement( "input" ),
  14977. select = document.createElement( "select" ),
  14978. opt = select.appendChild( document.createElement( "option" ) );
  14979. input.type = "checkbox";
  14980. // Support: Android <=4.3 only
  14981. // Default value for a checkbox should be "on"
  14982. support.checkOn = input.value !== "";
  14983. // Support: IE <=11 only
  14984. // Must access selectedIndex to make default options select
  14985. support.optSelected = opt.selected;
  14986. // Support: IE <=11 only
  14987. // An input loses its value after becoming a radio
  14988. input = document.createElement( "input" );
  14989. input.value = "t";
  14990. input.type = "radio";
  14991. support.radioValue = input.value === "t";
  14992. } )();
  14993. var boolHook,
  14994. attrHandle = jQuery.expr.attrHandle;
  14995. jQuery.fn.extend( {
  14996. attr: function( name, value ) {
  14997. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14998. },
  14999. removeAttr: function( name ) {
  15000. return this.each( function() {
  15001. jQuery.removeAttr( this, name );
  15002. } );
  15003. }
  15004. } );
  15005. jQuery.extend( {
  15006. attr: function( elem, name, value ) {
  15007. var ret, hooks,
  15008. nType = elem.nodeType;
  15009. // Don't get/set attributes on text, comment and attribute nodes
  15010. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15011. return;
  15012. }
  15013. // Fallback to prop when attributes are not supported
  15014. if ( typeof elem.getAttribute === "undefined" ) {
  15015. return jQuery.prop( elem, name, value );
  15016. }
  15017. // Attribute hooks are determined by the lowercase version
  15018. // Grab necessary hook if one is defined
  15019. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15020. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15021. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15022. }
  15023. if ( value !== undefined ) {
  15024. if ( value === null ) {
  15025. jQuery.removeAttr( elem, name );
  15026. return;
  15027. }
  15028. if ( hooks && "set" in hooks &&
  15029. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15030. return ret;
  15031. }
  15032. elem.setAttribute( name, value + "" );
  15033. return value;
  15034. }
  15035. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15036. return ret;
  15037. }
  15038. ret = jQuery.find.attr( elem, name );
  15039. // Non-existent attributes return null, we normalize to undefined
  15040. return ret == null ? undefined : ret;
  15041. },
  15042. attrHooks: {
  15043. type: {
  15044. set: function( elem, value ) {
  15045. if ( !support.radioValue && value === "radio" &&
  15046. nodeName( elem, "input" ) ) {
  15047. var val = elem.value;
  15048. elem.setAttribute( "type", value );
  15049. if ( val ) {
  15050. elem.value = val;
  15051. }
  15052. return value;
  15053. }
  15054. }
  15055. }
  15056. },
  15057. removeAttr: function( elem, value ) {
  15058. var name,
  15059. i = 0,
  15060. // Attribute names can contain non-HTML whitespace characters
  15061. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15062. attrNames = value && value.match( rnothtmlwhite );
  15063. if ( attrNames && elem.nodeType === 1 ) {
  15064. while ( ( name = attrNames[ i++ ] ) ) {
  15065. elem.removeAttribute( name );
  15066. }
  15067. }
  15068. }
  15069. } );
  15070. // Hooks for boolean attributes
  15071. boolHook = {
  15072. set: function( elem, value, name ) {
  15073. if ( value === false ) {
  15074. // Remove boolean attributes when set to false
  15075. jQuery.removeAttr( elem, name );
  15076. } else {
  15077. elem.setAttribute( name, name );
  15078. }
  15079. return name;
  15080. }
  15081. };
  15082. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15083. var getter = attrHandle[ name ] || jQuery.find.attr;
  15084. attrHandle[ name ] = function( elem, name, isXML ) {
  15085. var ret, handle,
  15086. lowercaseName = name.toLowerCase();
  15087. if ( !isXML ) {
  15088. // Avoid an infinite loop by temporarily removing this function from the getter
  15089. handle = attrHandle[ lowercaseName ];
  15090. attrHandle[ lowercaseName ] = ret;
  15091. ret = getter( elem, name, isXML ) != null ?
  15092. lowercaseName :
  15093. null;
  15094. attrHandle[ lowercaseName ] = handle;
  15095. }
  15096. return ret;
  15097. };
  15098. } );
  15099. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15100. rclickable = /^(?:a|area)$/i;
  15101. jQuery.fn.extend( {
  15102. prop: function( name, value ) {
  15103. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15104. },
  15105. removeProp: function( name ) {
  15106. return this.each( function() {
  15107. delete this[ jQuery.propFix[ name ] || name ];
  15108. } );
  15109. }
  15110. } );
  15111. jQuery.extend( {
  15112. prop: function( elem, name, value ) {
  15113. var ret, hooks,
  15114. nType = elem.nodeType;
  15115. // Don't get/set properties on text, comment and attribute nodes
  15116. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15117. return;
  15118. }
  15119. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15120. // Fix name and attach hooks
  15121. name = jQuery.propFix[ name ] || name;
  15122. hooks = jQuery.propHooks[ name ];
  15123. }
  15124. if ( value !== undefined ) {
  15125. if ( hooks && "set" in hooks &&
  15126. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15127. return ret;
  15128. }
  15129. return ( elem[ name ] = value );
  15130. }
  15131. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15132. return ret;
  15133. }
  15134. return elem[ name ];
  15135. },
  15136. propHooks: {
  15137. tabIndex: {
  15138. get: function( elem ) {
  15139. // Support: IE <=9 - 11 only
  15140. // elem.tabIndex doesn't always return the
  15141. // correct value when it hasn't been explicitly set
  15142. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15143. // Use proper attribute retrieval(#12072)
  15144. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15145. if ( tabindex ) {
  15146. return parseInt( tabindex, 10 );
  15147. }
  15148. if (
  15149. rfocusable.test( elem.nodeName ) ||
  15150. rclickable.test( elem.nodeName ) &&
  15151. elem.href
  15152. ) {
  15153. return 0;
  15154. }
  15155. return -1;
  15156. }
  15157. }
  15158. },
  15159. propFix: {
  15160. "for": "htmlFor",
  15161. "class": "className"
  15162. }
  15163. } );
  15164. // Support: IE <=11 only
  15165. // Accessing the selectedIndex property
  15166. // forces the browser to respect setting selected
  15167. // on the option
  15168. // The getter ensures a default option is selected
  15169. // when in an optgroup
  15170. // eslint rule "no-unused-expressions" is disabled for this code
  15171. // since it considers such accessions noop
  15172. if ( !support.optSelected ) {
  15173. jQuery.propHooks.selected = {
  15174. get: function( elem ) {
  15175. /* eslint no-unused-expressions: "off" */
  15176. var parent = elem.parentNode;
  15177. if ( parent && parent.parentNode ) {
  15178. parent.parentNode.selectedIndex;
  15179. }
  15180. return null;
  15181. },
  15182. set: function( elem ) {
  15183. /* eslint no-unused-expressions: "off" */
  15184. var parent = elem.parentNode;
  15185. if ( parent ) {
  15186. parent.selectedIndex;
  15187. if ( parent.parentNode ) {
  15188. parent.parentNode.selectedIndex;
  15189. }
  15190. }
  15191. }
  15192. };
  15193. }
  15194. jQuery.each( [
  15195. "tabIndex",
  15196. "readOnly",
  15197. "maxLength",
  15198. "cellSpacing",
  15199. "cellPadding",
  15200. "rowSpan",
  15201. "colSpan",
  15202. "useMap",
  15203. "frameBorder",
  15204. "contentEditable"
  15205. ], function() {
  15206. jQuery.propFix[ this.toLowerCase() ] = this;
  15207. } );
  15208. // Strip and collapse whitespace according to HTML spec
  15209. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15210. function stripAndCollapse( value ) {
  15211. var tokens = value.match( rnothtmlwhite ) || [];
  15212. return tokens.join( " " );
  15213. }
  15214. function getClass( elem ) {
  15215. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15216. }
  15217. function classesToArray( value ) {
  15218. if ( Array.isArray( value ) ) {
  15219. return value;
  15220. }
  15221. if ( typeof value === "string" ) {
  15222. return value.match( rnothtmlwhite ) || [];
  15223. }
  15224. return [];
  15225. }
  15226. jQuery.fn.extend( {
  15227. addClass: function( value ) {
  15228. var classes, elem, cur, curValue, clazz, j, finalValue,
  15229. i = 0;
  15230. if ( isFunction( value ) ) {
  15231. return this.each( function( j ) {
  15232. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15233. } );
  15234. }
  15235. classes = classesToArray( value );
  15236. if ( classes.length ) {
  15237. while ( ( elem = this[ i++ ] ) ) {
  15238. curValue = getClass( elem );
  15239. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15240. if ( cur ) {
  15241. j = 0;
  15242. while ( ( clazz = classes[ j++ ] ) ) {
  15243. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15244. cur += clazz + " ";
  15245. }
  15246. }
  15247. // Only assign if different to avoid unneeded rendering.
  15248. finalValue = stripAndCollapse( cur );
  15249. if ( curValue !== finalValue ) {
  15250. elem.setAttribute( "class", finalValue );
  15251. }
  15252. }
  15253. }
  15254. }
  15255. return this;
  15256. },
  15257. removeClass: function( value ) {
  15258. var classes, elem, cur, curValue, clazz, j, finalValue,
  15259. i = 0;
  15260. if ( isFunction( value ) ) {
  15261. return this.each( function( j ) {
  15262. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15263. } );
  15264. }
  15265. if ( !arguments.length ) {
  15266. return this.attr( "class", "" );
  15267. }
  15268. classes = classesToArray( value );
  15269. if ( classes.length ) {
  15270. while ( ( elem = this[ i++ ] ) ) {
  15271. curValue = getClass( elem );
  15272. // This expression is here for better compressibility (see addClass)
  15273. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15274. if ( cur ) {
  15275. j = 0;
  15276. while ( ( clazz = classes[ j++ ] ) ) {
  15277. // Remove *all* instances
  15278. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15279. cur = cur.replace( " " + clazz + " ", " " );
  15280. }
  15281. }
  15282. // Only assign if different to avoid unneeded rendering.
  15283. finalValue = stripAndCollapse( cur );
  15284. if ( curValue !== finalValue ) {
  15285. elem.setAttribute( "class", finalValue );
  15286. }
  15287. }
  15288. }
  15289. }
  15290. return this;
  15291. },
  15292. toggleClass: function( value, stateVal ) {
  15293. var type = typeof value,
  15294. isValidValue = type === "string" || Array.isArray( value );
  15295. if ( typeof stateVal === "boolean" && isValidValue ) {
  15296. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15297. }
  15298. if ( isFunction( value ) ) {
  15299. return this.each( function( i ) {
  15300. jQuery( this ).toggleClass(
  15301. value.call( this, i, getClass( this ), stateVal ),
  15302. stateVal
  15303. );
  15304. } );
  15305. }
  15306. return this.each( function() {
  15307. var className, i, self, classNames;
  15308. if ( isValidValue ) {
  15309. // Toggle individual class names
  15310. i = 0;
  15311. self = jQuery( this );
  15312. classNames = classesToArray( value );
  15313. while ( ( className = classNames[ i++ ] ) ) {
  15314. // Check each className given, space separated list
  15315. if ( self.hasClass( className ) ) {
  15316. self.removeClass( className );
  15317. } else {
  15318. self.addClass( className );
  15319. }
  15320. }
  15321. // Toggle whole class name
  15322. } else if ( value === undefined || type === "boolean" ) {
  15323. className = getClass( this );
  15324. if ( className ) {
  15325. // Store className if set
  15326. dataPriv.set( this, "__className__", className );
  15327. }
  15328. // If the element has a class name or if we're passed `false`,
  15329. // then remove the whole classname (if there was one, the above saved it).
  15330. // Otherwise bring back whatever was previously saved (if anything),
  15331. // falling back to the empty string if nothing was stored.
  15332. if ( this.setAttribute ) {
  15333. this.setAttribute( "class",
  15334. className || value === false ?
  15335. "" :
  15336. dataPriv.get( this, "__className__" ) || ""
  15337. );
  15338. }
  15339. }
  15340. } );
  15341. },
  15342. hasClass: function( selector ) {
  15343. var className, elem,
  15344. i = 0;
  15345. className = " " + selector + " ";
  15346. while ( ( elem = this[ i++ ] ) ) {
  15347. if ( elem.nodeType === 1 &&
  15348. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15349. return true;
  15350. }
  15351. }
  15352. return false;
  15353. }
  15354. } );
  15355. var rreturn = /\r/g;
  15356. jQuery.fn.extend( {
  15357. val: function( value ) {
  15358. var hooks, ret, valueIsFunction,
  15359. elem = this[ 0 ];
  15360. if ( !arguments.length ) {
  15361. if ( elem ) {
  15362. hooks = jQuery.valHooks[ elem.type ] ||
  15363. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15364. if ( hooks &&
  15365. "get" in hooks &&
  15366. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15367. ) {
  15368. return ret;
  15369. }
  15370. ret = elem.value;
  15371. // Handle most common string cases
  15372. if ( typeof ret === "string" ) {
  15373. return ret.replace( rreturn, "" );
  15374. }
  15375. // Handle cases where value is null/undef or number
  15376. return ret == null ? "" : ret;
  15377. }
  15378. return;
  15379. }
  15380. valueIsFunction = isFunction( value );
  15381. return this.each( function( i ) {
  15382. var val;
  15383. if ( this.nodeType !== 1 ) {
  15384. return;
  15385. }
  15386. if ( valueIsFunction ) {
  15387. val = value.call( this, i, jQuery( this ).val() );
  15388. } else {
  15389. val = value;
  15390. }
  15391. // Treat null/undefined as ""; convert numbers to string
  15392. if ( val == null ) {
  15393. val = "";
  15394. } else if ( typeof val === "number" ) {
  15395. val += "";
  15396. } else if ( Array.isArray( val ) ) {
  15397. val = jQuery.map( val, function( value ) {
  15398. return value == null ? "" : value + "";
  15399. } );
  15400. }
  15401. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15402. // If set returns undefined, fall back to normal setting
  15403. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15404. this.value = val;
  15405. }
  15406. } );
  15407. }
  15408. } );
  15409. jQuery.extend( {
  15410. valHooks: {
  15411. option: {
  15412. get: function( elem ) {
  15413. var val = jQuery.find.attr( elem, "value" );
  15414. return val != null ?
  15415. val :
  15416. // Support: IE <=10 - 11 only
  15417. // option.text throws exceptions (#14686, #14858)
  15418. // Strip and collapse whitespace
  15419. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15420. stripAndCollapse( jQuery.text( elem ) );
  15421. }
  15422. },
  15423. select: {
  15424. get: function( elem ) {
  15425. var value, option, i,
  15426. options = elem.options,
  15427. index = elem.selectedIndex,
  15428. one = elem.type === "select-one",
  15429. values = one ? null : [],
  15430. max = one ? index + 1 : options.length;
  15431. if ( index < 0 ) {
  15432. i = max;
  15433. } else {
  15434. i = one ? index : 0;
  15435. }
  15436. // Loop through all the selected options
  15437. for ( ; i < max; i++ ) {
  15438. option = options[ i ];
  15439. // Support: IE <=9 only
  15440. // IE8-9 doesn't update selected after form reset (#2551)
  15441. if ( ( option.selected || i === index ) &&
  15442. // Don't return options that are disabled or in a disabled optgroup
  15443. !option.disabled &&
  15444. ( !option.parentNode.disabled ||
  15445. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15446. // Get the specific value for the option
  15447. value = jQuery( option ).val();
  15448. // We don't need an array for one selects
  15449. if ( one ) {
  15450. return value;
  15451. }
  15452. // Multi-Selects return an array
  15453. values.push( value );
  15454. }
  15455. }
  15456. return values;
  15457. },
  15458. set: function( elem, value ) {
  15459. var optionSet, option,
  15460. options = elem.options,
  15461. values = jQuery.makeArray( value ),
  15462. i = options.length;
  15463. while ( i-- ) {
  15464. option = options[ i ];
  15465. /* eslint-disable no-cond-assign */
  15466. if ( option.selected =
  15467. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15468. ) {
  15469. optionSet = true;
  15470. }
  15471. /* eslint-enable no-cond-assign */
  15472. }
  15473. // Force browsers to behave consistently when non-matching value is set
  15474. if ( !optionSet ) {
  15475. elem.selectedIndex = -1;
  15476. }
  15477. return values;
  15478. }
  15479. }
  15480. }
  15481. } );
  15482. // Radios and checkboxes getter/setter
  15483. jQuery.each( [ "radio", "checkbox" ], function() {
  15484. jQuery.valHooks[ this ] = {
  15485. set: function( elem, value ) {
  15486. if ( Array.isArray( value ) ) {
  15487. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15488. }
  15489. }
  15490. };
  15491. if ( !support.checkOn ) {
  15492. jQuery.valHooks[ this ].get = function( elem ) {
  15493. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15494. };
  15495. }
  15496. } );
  15497. // Return jQuery for attributes-only inclusion
  15498. support.focusin = "onfocusin" in window;
  15499. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15500. stopPropagationCallback = function( e ) {
  15501. e.stopPropagation();
  15502. };
  15503. jQuery.extend( jQuery.event, {
  15504. trigger: function( event, data, elem, onlyHandlers ) {
  15505. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15506. eventPath = [ elem || document ],
  15507. type = hasOwn.call( event, "type" ) ? event.type : event,
  15508. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15509. cur = lastElement = tmp = elem = elem || document;
  15510. // Don't do events on text and comment nodes
  15511. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15512. return;
  15513. }
  15514. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15515. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15516. return;
  15517. }
  15518. if ( type.indexOf( "." ) > -1 ) {
  15519. // Namespaced trigger; create a regexp to match event type in handle()
  15520. namespaces = type.split( "." );
  15521. type = namespaces.shift();
  15522. namespaces.sort();
  15523. }
  15524. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15525. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15526. event = event[ jQuery.expando ] ?
  15527. event :
  15528. new jQuery.Event( type, typeof event === "object" && event );
  15529. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15530. event.isTrigger = onlyHandlers ? 2 : 3;
  15531. event.namespace = namespaces.join( "." );
  15532. event.rnamespace = event.namespace ?
  15533. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15534. null;
  15535. // Clean up the event in case it is being reused
  15536. event.result = undefined;
  15537. if ( !event.target ) {
  15538. event.target = elem;
  15539. }
  15540. // Clone any incoming data and prepend the event, creating the handler arg list
  15541. data = data == null ?
  15542. [ event ] :
  15543. jQuery.makeArray( data, [ event ] );
  15544. // Allow special events to draw outside the lines
  15545. special = jQuery.event.special[ type ] || {};
  15546. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15547. return;
  15548. }
  15549. // Determine event propagation path in advance, per W3C events spec (#9951)
  15550. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15551. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15552. bubbleType = special.delegateType || type;
  15553. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15554. cur = cur.parentNode;
  15555. }
  15556. for ( ; cur; cur = cur.parentNode ) {
  15557. eventPath.push( cur );
  15558. tmp = cur;
  15559. }
  15560. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15561. if ( tmp === ( elem.ownerDocument || document ) ) {
  15562. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15563. }
  15564. }
  15565. // Fire handlers on the event path
  15566. i = 0;
  15567. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15568. lastElement = cur;
  15569. event.type = i > 1 ?
  15570. bubbleType :
  15571. special.bindType || type;
  15572. // jQuery handler
  15573. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15574. dataPriv.get( cur, "handle" );
  15575. if ( handle ) {
  15576. handle.apply( cur, data );
  15577. }
  15578. // Native handler
  15579. handle = ontype && cur[ ontype ];
  15580. if ( handle && handle.apply && acceptData( cur ) ) {
  15581. event.result = handle.apply( cur, data );
  15582. if ( event.result === false ) {
  15583. event.preventDefault();
  15584. }
  15585. }
  15586. }
  15587. event.type = type;
  15588. // If nobody prevented the default action, do it now
  15589. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15590. if ( ( !special._default ||
  15591. special._default.apply( eventPath.pop(), data ) === false ) &&
  15592. acceptData( elem ) ) {
  15593. // Call a native DOM method on the target with the same name as the event.
  15594. // Don't do default actions on window, that's where global variables be (#6170)
  15595. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15596. // Don't re-trigger an onFOO event when we call its FOO() method
  15597. tmp = elem[ ontype ];
  15598. if ( tmp ) {
  15599. elem[ ontype ] = null;
  15600. }
  15601. // Prevent re-triggering of the same event, since we already bubbled it above
  15602. jQuery.event.triggered = type;
  15603. if ( event.isPropagationStopped() ) {
  15604. lastElement.addEventListener( type, stopPropagationCallback );
  15605. }
  15606. elem[ type ]();
  15607. if ( event.isPropagationStopped() ) {
  15608. lastElement.removeEventListener( type, stopPropagationCallback );
  15609. }
  15610. jQuery.event.triggered = undefined;
  15611. if ( tmp ) {
  15612. elem[ ontype ] = tmp;
  15613. }
  15614. }
  15615. }
  15616. }
  15617. return event.result;
  15618. },
  15619. // Piggyback on a donor event to simulate a different one
  15620. // Used only for `focus(in | out)` events
  15621. simulate: function( type, elem, event ) {
  15622. var e = jQuery.extend(
  15623. new jQuery.Event(),
  15624. event,
  15625. {
  15626. type: type,
  15627. isSimulated: true
  15628. }
  15629. );
  15630. jQuery.event.trigger( e, null, elem );
  15631. }
  15632. } );
  15633. jQuery.fn.extend( {
  15634. trigger: function( type, data ) {
  15635. return this.each( function() {
  15636. jQuery.event.trigger( type, data, this );
  15637. } );
  15638. },
  15639. triggerHandler: function( type, data ) {
  15640. var elem = this[ 0 ];
  15641. if ( elem ) {
  15642. return jQuery.event.trigger( type, data, elem, true );
  15643. }
  15644. }
  15645. } );
  15646. // Support: Firefox <=44
  15647. // Firefox doesn't have focus(in | out) events
  15648. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15649. //
  15650. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15651. // focus(in | out) events fire after focus & blur events,
  15652. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15653. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15654. if ( !support.focusin ) {
  15655. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15656. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15657. var handler = function( event ) {
  15658. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15659. };
  15660. jQuery.event.special[ fix ] = {
  15661. setup: function() {
  15662. var doc = this.ownerDocument || this,
  15663. attaches = dataPriv.access( doc, fix );
  15664. if ( !attaches ) {
  15665. doc.addEventListener( orig, handler, true );
  15666. }
  15667. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15668. },
  15669. teardown: function() {
  15670. var doc = this.ownerDocument || this,
  15671. attaches = dataPriv.access( doc, fix ) - 1;
  15672. if ( !attaches ) {
  15673. doc.removeEventListener( orig, handler, true );
  15674. dataPriv.remove( doc, fix );
  15675. } else {
  15676. dataPriv.access( doc, fix, attaches );
  15677. }
  15678. }
  15679. };
  15680. } );
  15681. }
  15682. var location = window.location;
  15683. var nonce = Date.now();
  15684. var rquery = ( /\?/ );
  15685. // Cross-browser xml parsing
  15686. jQuery.parseXML = function( data ) {
  15687. var xml;
  15688. if ( !data || typeof data !== "string" ) {
  15689. return null;
  15690. }
  15691. // Support: IE 9 - 11 only
  15692. // IE throws on parseFromString with invalid input.
  15693. try {
  15694. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15695. } catch ( e ) {
  15696. xml = undefined;
  15697. }
  15698. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15699. jQuery.error( "Invalid XML: " + data );
  15700. }
  15701. return xml;
  15702. };
  15703. var
  15704. rbracket = /\[\]$/,
  15705. rCRLF = /\r?\n/g,
  15706. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15707. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15708. function buildParams( prefix, obj, traditional, add ) {
  15709. var name;
  15710. if ( Array.isArray( obj ) ) {
  15711. // Serialize array item.
  15712. jQuery.each( obj, function( i, v ) {
  15713. if ( traditional || rbracket.test( prefix ) ) {
  15714. // Treat each array item as a scalar.
  15715. add( prefix, v );
  15716. } else {
  15717. // Item is non-scalar (array or object), encode its numeric index.
  15718. buildParams(
  15719. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15720. v,
  15721. traditional,
  15722. add
  15723. );
  15724. }
  15725. } );
  15726. } else if ( !traditional && toType( obj ) === "object" ) {
  15727. // Serialize object item.
  15728. for ( name in obj ) {
  15729. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15730. }
  15731. } else {
  15732. // Serialize scalar item.
  15733. add( prefix, obj );
  15734. }
  15735. }
  15736. // Serialize an array of form elements or a set of
  15737. // key/values into a query string
  15738. jQuery.param = function( a, traditional ) {
  15739. var prefix,
  15740. s = [],
  15741. add = function( key, valueOrFunction ) {
  15742. // If value is a function, invoke it and use its return value
  15743. var value = isFunction( valueOrFunction ) ?
  15744. valueOrFunction() :
  15745. valueOrFunction;
  15746. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15747. encodeURIComponent( value == null ? "" : value );
  15748. };
  15749. if ( a == null ) {
  15750. return "";
  15751. }
  15752. // If an array was passed in, assume that it is an array of form elements.
  15753. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15754. // Serialize the form elements
  15755. jQuery.each( a, function() {
  15756. add( this.name, this.value );
  15757. } );
  15758. } else {
  15759. // If traditional, encode the "old" way (the way 1.3.2 or older
  15760. // did it), otherwise encode params recursively.
  15761. for ( prefix in a ) {
  15762. buildParams( prefix, a[ prefix ], traditional, add );
  15763. }
  15764. }
  15765. // Return the resulting serialization
  15766. return s.join( "&" );
  15767. };
  15768. jQuery.fn.extend( {
  15769. serialize: function() {
  15770. return jQuery.param( this.serializeArray() );
  15771. },
  15772. serializeArray: function() {
  15773. return this.map( function() {
  15774. // Can add propHook for "elements" to filter or add form elements
  15775. var elements = jQuery.prop( this, "elements" );
  15776. return elements ? jQuery.makeArray( elements ) : this;
  15777. } )
  15778. .filter( function() {
  15779. var type = this.type;
  15780. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15781. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15782. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15783. ( this.checked || !rcheckableType.test( type ) );
  15784. } )
  15785. .map( function( i, elem ) {
  15786. var val = jQuery( this ).val();
  15787. if ( val == null ) {
  15788. return null;
  15789. }
  15790. if ( Array.isArray( val ) ) {
  15791. return jQuery.map( val, function( val ) {
  15792. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15793. } );
  15794. }
  15795. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15796. } ).get();
  15797. }
  15798. } );
  15799. var
  15800. r20 = /%20/g,
  15801. rhash = /#.*$/,
  15802. rantiCache = /([?&])_=[^&]*/,
  15803. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15804. // #7653, #8125, #8152: local protocol detection
  15805. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15806. rnoContent = /^(?:GET|HEAD)$/,
  15807. rprotocol = /^\/\//,
  15808. /* Prefilters
  15809. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15810. * 2) These are called:
  15811. * - BEFORE asking for a transport
  15812. * - AFTER param serialization (s.data is a string if s.processData is true)
  15813. * 3) key is the dataType
  15814. * 4) the catchall symbol "*" can be used
  15815. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15816. */
  15817. prefilters = {},
  15818. /* Transports bindings
  15819. * 1) key is the dataType
  15820. * 2) the catchall symbol "*" can be used
  15821. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15822. */
  15823. transports = {},
  15824. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15825. allTypes = "*/".concat( "*" ),
  15826. // Anchor tag for parsing the document origin
  15827. originAnchor = document.createElement( "a" );
  15828. originAnchor.href = location.href;
  15829. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15830. function addToPrefiltersOrTransports( structure ) {
  15831. // dataTypeExpression is optional and defaults to "*"
  15832. return function( dataTypeExpression, func ) {
  15833. if ( typeof dataTypeExpression !== "string" ) {
  15834. func = dataTypeExpression;
  15835. dataTypeExpression = "*";
  15836. }
  15837. var dataType,
  15838. i = 0,
  15839. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15840. if ( isFunction( func ) ) {
  15841. // For each dataType in the dataTypeExpression
  15842. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15843. // Prepend if requested
  15844. if ( dataType[ 0 ] === "+" ) {
  15845. dataType = dataType.slice( 1 ) || "*";
  15846. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15847. // Otherwise append
  15848. } else {
  15849. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15850. }
  15851. }
  15852. }
  15853. };
  15854. }
  15855. // Base inspection function for prefilters and transports
  15856. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15857. var inspected = {},
  15858. seekingTransport = ( structure === transports );
  15859. function inspect( dataType ) {
  15860. var selected;
  15861. inspected[ dataType ] = true;
  15862. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15863. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15864. if ( typeof dataTypeOrTransport === "string" &&
  15865. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15866. options.dataTypes.unshift( dataTypeOrTransport );
  15867. inspect( dataTypeOrTransport );
  15868. return false;
  15869. } else if ( seekingTransport ) {
  15870. return !( selected = dataTypeOrTransport );
  15871. }
  15872. } );
  15873. return selected;
  15874. }
  15875. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15876. }
  15877. // A special extend for ajax options
  15878. // that takes "flat" options (not to be deep extended)
  15879. // Fixes #9887
  15880. function ajaxExtend( target, src ) {
  15881. var key, deep,
  15882. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15883. for ( key in src ) {
  15884. if ( src[ key ] !== undefined ) {
  15885. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15886. }
  15887. }
  15888. if ( deep ) {
  15889. jQuery.extend( true, target, deep );
  15890. }
  15891. return target;
  15892. }
  15893. /* Handles responses to an ajax request:
  15894. * - finds the right dataType (mediates between content-type and expected dataType)
  15895. * - returns the corresponding response
  15896. */
  15897. function ajaxHandleResponses( s, jqXHR, responses ) {
  15898. var ct, type, finalDataType, firstDataType,
  15899. contents = s.contents,
  15900. dataTypes = s.dataTypes;
  15901. // Remove auto dataType and get content-type in the process
  15902. while ( dataTypes[ 0 ] === "*" ) {
  15903. dataTypes.shift();
  15904. if ( ct === undefined ) {
  15905. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15906. }
  15907. }
  15908. // Check if we're dealing with a known content-type
  15909. if ( ct ) {
  15910. for ( type in contents ) {
  15911. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15912. dataTypes.unshift( type );
  15913. break;
  15914. }
  15915. }
  15916. }
  15917. // Check to see if we have a response for the expected dataType
  15918. if ( dataTypes[ 0 ] in responses ) {
  15919. finalDataType = dataTypes[ 0 ];
  15920. } else {
  15921. // Try convertible dataTypes
  15922. for ( type in responses ) {
  15923. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15924. finalDataType = type;
  15925. break;
  15926. }
  15927. if ( !firstDataType ) {
  15928. firstDataType = type;
  15929. }
  15930. }
  15931. // Or just use first one
  15932. finalDataType = finalDataType || firstDataType;
  15933. }
  15934. // If we found a dataType
  15935. // We add the dataType to the list if needed
  15936. // and return the corresponding response
  15937. if ( finalDataType ) {
  15938. if ( finalDataType !== dataTypes[ 0 ] ) {
  15939. dataTypes.unshift( finalDataType );
  15940. }
  15941. return responses[ finalDataType ];
  15942. }
  15943. }
  15944. /* Chain conversions given the request and the original response
  15945. * Also sets the responseXXX fields on the jqXHR instance
  15946. */
  15947. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15948. var conv2, current, conv, tmp, prev,
  15949. converters = {},
  15950. // Work with a copy of dataTypes in case we need to modify it for conversion
  15951. dataTypes = s.dataTypes.slice();
  15952. // Create converters map with lowercased keys
  15953. if ( dataTypes[ 1 ] ) {
  15954. for ( conv in s.converters ) {
  15955. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15956. }
  15957. }
  15958. current = dataTypes.shift();
  15959. // Convert to each sequential dataType
  15960. while ( current ) {
  15961. if ( s.responseFields[ current ] ) {
  15962. jqXHR[ s.responseFields[ current ] ] = response;
  15963. }
  15964. // Apply the dataFilter if provided
  15965. if ( !prev && isSuccess && s.dataFilter ) {
  15966. response = s.dataFilter( response, s.dataType );
  15967. }
  15968. prev = current;
  15969. current = dataTypes.shift();
  15970. if ( current ) {
  15971. // There's only work to do if current dataType is non-auto
  15972. if ( current === "*" ) {
  15973. current = prev;
  15974. // Convert response if prev dataType is non-auto and differs from current
  15975. } else if ( prev !== "*" && prev !== current ) {
  15976. // Seek a direct converter
  15977. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15978. // If none found, seek a pair
  15979. if ( !conv ) {
  15980. for ( conv2 in converters ) {
  15981. // If conv2 outputs current
  15982. tmp = conv2.split( " " );
  15983. if ( tmp[ 1 ] === current ) {
  15984. // If prev can be converted to accepted input
  15985. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15986. converters[ "* " + tmp[ 0 ] ];
  15987. if ( conv ) {
  15988. // Condense equivalence converters
  15989. if ( conv === true ) {
  15990. conv = converters[ conv2 ];
  15991. // Otherwise, insert the intermediate dataType
  15992. } else if ( converters[ conv2 ] !== true ) {
  15993. current = tmp[ 0 ];
  15994. dataTypes.unshift( tmp[ 1 ] );
  15995. }
  15996. break;
  15997. }
  15998. }
  15999. }
  16000. }
  16001. // Apply converter (if not an equivalence)
  16002. if ( conv !== true ) {
  16003. // Unless errors are allowed to bubble, catch and return them
  16004. if ( conv && s.throws ) {
  16005. response = conv( response );
  16006. } else {
  16007. try {
  16008. response = conv( response );
  16009. } catch ( e ) {
  16010. return {
  16011. state: "parsererror",
  16012. error: conv ? e : "No conversion from " + prev + " to " + current
  16013. };
  16014. }
  16015. }
  16016. }
  16017. }
  16018. }
  16019. }
  16020. return { state: "success", data: response };
  16021. }
  16022. jQuery.extend( {
  16023. // Counter for holding the number of active queries
  16024. active: 0,
  16025. // Last-Modified header cache for next request
  16026. lastModified: {},
  16027. etag: {},
  16028. ajaxSettings: {
  16029. url: location.href,
  16030. type: "GET",
  16031. isLocal: rlocalProtocol.test( location.protocol ),
  16032. global: true,
  16033. processData: true,
  16034. async: true,
  16035. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16036. /*
  16037. timeout: 0,
  16038. data: null,
  16039. dataType: null,
  16040. username: null,
  16041. password: null,
  16042. cache: null,
  16043. throws: false,
  16044. traditional: false,
  16045. headers: {},
  16046. */
  16047. accepts: {
  16048. "*": allTypes,
  16049. text: "text/plain",
  16050. html: "text/html",
  16051. xml: "application/xml, text/xml",
  16052. json: "application/json, text/javascript"
  16053. },
  16054. contents: {
  16055. xml: /\bxml\b/,
  16056. html: /\bhtml/,
  16057. json: /\bjson\b/
  16058. },
  16059. responseFields: {
  16060. xml: "responseXML",
  16061. text: "responseText",
  16062. json: "responseJSON"
  16063. },
  16064. // Data converters
  16065. // Keys separate source (or catchall "*") and destination types with a single space
  16066. converters: {
  16067. // Convert anything to text
  16068. "* text": String,
  16069. // Text to html (true = no transformation)
  16070. "text html": true,
  16071. // Evaluate text as a json expression
  16072. "text json": JSON.parse,
  16073. // Parse text as xml
  16074. "text xml": jQuery.parseXML
  16075. },
  16076. // For options that shouldn't be deep extended:
  16077. // you can add your own custom options here if
  16078. // and when you create one that shouldn't be
  16079. // deep extended (see ajaxExtend)
  16080. flatOptions: {
  16081. url: true,
  16082. context: true
  16083. }
  16084. },
  16085. // Creates a full fledged settings object into target
  16086. // with both ajaxSettings and settings fields.
  16087. // If target is omitted, writes into ajaxSettings.
  16088. ajaxSetup: function( target, settings ) {
  16089. return settings ?
  16090. // Building a settings object
  16091. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16092. // Extending ajaxSettings
  16093. ajaxExtend( jQuery.ajaxSettings, target );
  16094. },
  16095. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16096. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16097. // Main method
  16098. ajax: function( url, options ) {
  16099. // If url is an object, simulate pre-1.5 signature
  16100. if ( typeof url === "object" ) {
  16101. options = url;
  16102. url = undefined;
  16103. }
  16104. // Force options to be an object
  16105. options = options || {};
  16106. var transport,
  16107. // URL without anti-cache param
  16108. cacheURL,
  16109. // Response headers
  16110. responseHeadersString,
  16111. responseHeaders,
  16112. // timeout handle
  16113. timeoutTimer,
  16114. // Url cleanup var
  16115. urlAnchor,
  16116. // Request state (becomes false upon send and true upon completion)
  16117. completed,
  16118. // To know if global events are to be dispatched
  16119. fireGlobals,
  16120. // Loop variable
  16121. i,
  16122. // uncached part of the url
  16123. uncached,
  16124. // Create the final options object
  16125. s = jQuery.ajaxSetup( {}, options ),
  16126. // Callbacks context
  16127. callbackContext = s.context || s,
  16128. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16129. globalEventContext = s.context &&
  16130. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16131. jQuery( callbackContext ) :
  16132. jQuery.event,
  16133. // Deferreds
  16134. deferred = jQuery.Deferred(),
  16135. completeDeferred = jQuery.Callbacks( "once memory" ),
  16136. // Status-dependent callbacks
  16137. statusCode = s.statusCode || {},
  16138. // Headers (they are sent all at once)
  16139. requestHeaders = {},
  16140. requestHeadersNames = {},
  16141. // Default abort message
  16142. strAbort = "canceled",
  16143. // Fake xhr
  16144. jqXHR = {
  16145. readyState: 0,
  16146. // Builds headers hashtable if needed
  16147. getResponseHeader: function( key ) {
  16148. var match;
  16149. if ( completed ) {
  16150. if ( !responseHeaders ) {
  16151. responseHeaders = {};
  16152. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16153. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16154. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16155. .concat( match[ 2 ] );
  16156. }
  16157. }
  16158. match = responseHeaders[ key.toLowerCase() + " " ];
  16159. }
  16160. return match == null ? null : match.join( ", " );
  16161. },
  16162. // Raw string
  16163. getAllResponseHeaders: function() {
  16164. return completed ? responseHeadersString : null;
  16165. },
  16166. // Caches the header
  16167. setRequestHeader: function( name, value ) {
  16168. if ( completed == null ) {
  16169. name = requestHeadersNames[ name.toLowerCase() ] =
  16170. requestHeadersNames[ name.toLowerCase() ] || name;
  16171. requestHeaders[ name ] = value;
  16172. }
  16173. return this;
  16174. },
  16175. // Overrides response content-type header
  16176. overrideMimeType: function( type ) {
  16177. if ( completed == null ) {
  16178. s.mimeType = type;
  16179. }
  16180. return this;
  16181. },
  16182. // Status-dependent callbacks
  16183. statusCode: function( map ) {
  16184. var code;
  16185. if ( map ) {
  16186. if ( completed ) {
  16187. // Execute the appropriate callbacks
  16188. jqXHR.always( map[ jqXHR.status ] );
  16189. } else {
  16190. // Lazy-add the new callbacks in a way that preserves old ones
  16191. for ( code in map ) {
  16192. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16193. }
  16194. }
  16195. }
  16196. return this;
  16197. },
  16198. // Cancel the request
  16199. abort: function( statusText ) {
  16200. var finalText = statusText || strAbort;
  16201. if ( transport ) {
  16202. transport.abort( finalText );
  16203. }
  16204. done( 0, finalText );
  16205. return this;
  16206. }
  16207. };
  16208. // Attach deferreds
  16209. deferred.promise( jqXHR );
  16210. // Add protocol if not provided (prefilters might expect it)
  16211. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16212. // We also use the url parameter if available
  16213. s.url = ( ( url || s.url || location.href ) + "" )
  16214. .replace( rprotocol, location.protocol + "//" );
  16215. // Alias method option to type as per ticket #12004
  16216. s.type = options.method || options.type || s.method || s.type;
  16217. // Extract dataTypes list
  16218. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16219. // A cross-domain request is in order when the origin doesn't match the current origin.
  16220. if ( s.crossDomain == null ) {
  16221. urlAnchor = document.createElement( "a" );
  16222. // Support: IE <=8 - 11, Edge 12 - 15
  16223. // IE throws exception on accessing the href property if url is malformed,
  16224. // e.g. http://example.com:80x/
  16225. try {
  16226. urlAnchor.href = s.url;
  16227. // Support: IE <=8 - 11 only
  16228. // Anchor's host property isn't correctly set when s.url is relative
  16229. urlAnchor.href = urlAnchor.href;
  16230. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16231. urlAnchor.protocol + "//" + urlAnchor.host;
  16232. } catch ( e ) {
  16233. // If there is an error parsing the URL, assume it is crossDomain,
  16234. // it can be rejected by the transport if it is invalid
  16235. s.crossDomain = true;
  16236. }
  16237. }
  16238. // Convert data if not already a string
  16239. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16240. s.data = jQuery.param( s.data, s.traditional );
  16241. }
  16242. // Apply prefilters
  16243. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16244. // If request was aborted inside a prefilter, stop there
  16245. if ( completed ) {
  16246. return jqXHR;
  16247. }
  16248. // We can fire global events as of now if asked to
  16249. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16250. fireGlobals = jQuery.event && s.global;
  16251. // Watch for a new set of requests
  16252. if ( fireGlobals && jQuery.active++ === 0 ) {
  16253. jQuery.event.trigger( "ajaxStart" );
  16254. }
  16255. // Uppercase the type
  16256. s.type = s.type.toUpperCase();
  16257. // Determine if request has content
  16258. s.hasContent = !rnoContent.test( s.type );
  16259. // Save the URL in case we're toying with the If-Modified-Since
  16260. // and/or If-None-Match header later on
  16261. // Remove hash to simplify url manipulation
  16262. cacheURL = s.url.replace( rhash, "" );
  16263. // More options handling for requests with no content
  16264. if ( !s.hasContent ) {
  16265. // Remember the hash so we can put it back
  16266. uncached = s.url.slice( cacheURL.length );
  16267. // If data is available and should be processed, append data to url
  16268. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16269. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16270. // #9682: remove data so that it's not used in an eventual retry
  16271. delete s.data;
  16272. }
  16273. // Add or update anti-cache param if needed
  16274. if ( s.cache === false ) {
  16275. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16276. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16277. }
  16278. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16279. s.url = cacheURL + uncached;
  16280. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16281. } else if ( s.data && s.processData &&
  16282. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16283. s.data = s.data.replace( r20, "+" );
  16284. }
  16285. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16286. if ( s.ifModified ) {
  16287. if ( jQuery.lastModified[ cacheURL ] ) {
  16288. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16289. }
  16290. if ( jQuery.etag[ cacheURL ] ) {
  16291. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16292. }
  16293. }
  16294. // Set the correct header, if data is being sent
  16295. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16296. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16297. }
  16298. // Set the Accepts header for the server, depending on the dataType
  16299. jqXHR.setRequestHeader(
  16300. "Accept",
  16301. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16302. s.accepts[ s.dataTypes[ 0 ] ] +
  16303. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16304. s.accepts[ "*" ]
  16305. );
  16306. // Check for headers option
  16307. for ( i in s.headers ) {
  16308. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16309. }
  16310. // Allow custom headers/mimetypes and early abort
  16311. if ( s.beforeSend &&
  16312. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16313. // Abort if not done already and return
  16314. return jqXHR.abort();
  16315. }
  16316. // Aborting is no longer a cancellation
  16317. strAbort = "abort";
  16318. // Install callbacks on deferreds
  16319. completeDeferred.add( s.complete );
  16320. jqXHR.done( s.success );
  16321. jqXHR.fail( s.error );
  16322. // Get transport
  16323. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16324. // If no transport, we auto-abort
  16325. if ( !transport ) {
  16326. done( -1, "No Transport" );
  16327. } else {
  16328. jqXHR.readyState = 1;
  16329. // Send global event
  16330. if ( fireGlobals ) {
  16331. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16332. }
  16333. // If request was aborted inside ajaxSend, stop there
  16334. if ( completed ) {
  16335. return jqXHR;
  16336. }
  16337. // Timeout
  16338. if ( s.async && s.timeout > 0 ) {
  16339. timeoutTimer = window.setTimeout( function() {
  16340. jqXHR.abort( "timeout" );
  16341. }, s.timeout );
  16342. }
  16343. try {
  16344. completed = false;
  16345. transport.send( requestHeaders, done );
  16346. } catch ( e ) {
  16347. // Rethrow post-completion exceptions
  16348. if ( completed ) {
  16349. throw e;
  16350. }
  16351. // Propagate others as results
  16352. done( -1, e );
  16353. }
  16354. }
  16355. // Callback for when everything is done
  16356. function done( status, nativeStatusText, responses, headers ) {
  16357. var isSuccess, success, error, response, modified,
  16358. statusText = nativeStatusText;
  16359. // Ignore repeat invocations
  16360. if ( completed ) {
  16361. return;
  16362. }
  16363. completed = true;
  16364. // Clear timeout if it exists
  16365. if ( timeoutTimer ) {
  16366. window.clearTimeout( timeoutTimer );
  16367. }
  16368. // Dereference transport for early garbage collection
  16369. // (no matter how long the jqXHR object will be used)
  16370. transport = undefined;
  16371. // Cache response headers
  16372. responseHeadersString = headers || "";
  16373. // Set readyState
  16374. jqXHR.readyState = status > 0 ? 4 : 0;
  16375. // Determine if successful
  16376. isSuccess = status >= 200 && status < 300 || status === 304;
  16377. // Get response data
  16378. if ( responses ) {
  16379. response = ajaxHandleResponses( s, jqXHR, responses );
  16380. }
  16381. // Convert no matter what (that way responseXXX fields are always set)
  16382. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16383. // If successful, handle type chaining
  16384. if ( isSuccess ) {
  16385. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16386. if ( s.ifModified ) {
  16387. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16388. if ( modified ) {
  16389. jQuery.lastModified[ cacheURL ] = modified;
  16390. }
  16391. modified = jqXHR.getResponseHeader( "etag" );
  16392. if ( modified ) {
  16393. jQuery.etag[ cacheURL ] = modified;
  16394. }
  16395. }
  16396. // if no content
  16397. if ( status === 204 || s.type === "HEAD" ) {
  16398. statusText = "nocontent";
  16399. // if not modified
  16400. } else if ( status === 304 ) {
  16401. statusText = "notmodified";
  16402. // If we have data, let's convert it
  16403. } else {
  16404. statusText = response.state;
  16405. success = response.data;
  16406. error = response.error;
  16407. isSuccess = !error;
  16408. }
  16409. } else {
  16410. // Extract error from statusText and normalize for non-aborts
  16411. error = statusText;
  16412. if ( status || !statusText ) {
  16413. statusText = "error";
  16414. if ( status < 0 ) {
  16415. status = 0;
  16416. }
  16417. }
  16418. }
  16419. // Set data for the fake xhr object
  16420. jqXHR.status = status;
  16421. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16422. // Success/Error
  16423. if ( isSuccess ) {
  16424. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16425. } else {
  16426. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16427. }
  16428. // Status-dependent callbacks
  16429. jqXHR.statusCode( statusCode );
  16430. statusCode = undefined;
  16431. if ( fireGlobals ) {
  16432. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16433. [ jqXHR, s, isSuccess ? success : error ] );
  16434. }
  16435. // Complete
  16436. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16437. if ( fireGlobals ) {
  16438. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16439. // Handle the global AJAX counter
  16440. if ( !( --jQuery.active ) ) {
  16441. jQuery.event.trigger( "ajaxStop" );
  16442. }
  16443. }
  16444. }
  16445. return jqXHR;
  16446. },
  16447. getJSON: function( url, data, callback ) {
  16448. return jQuery.get( url, data, callback, "json" );
  16449. },
  16450. getScript: function( url, callback ) {
  16451. return jQuery.get( url, undefined, callback, "script" );
  16452. }
  16453. } );
  16454. jQuery.each( [ "get", "post" ], function( i, method ) {
  16455. jQuery[ method ] = function( url, data, callback, type ) {
  16456. // Shift arguments if data argument was omitted
  16457. if ( isFunction( data ) ) {
  16458. type = type || callback;
  16459. callback = data;
  16460. data = undefined;
  16461. }
  16462. // The url can be an options object (which then must have .url)
  16463. return jQuery.ajax( jQuery.extend( {
  16464. url: url,
  16465. type: method,
  16466. dataType: type,
  16467. data: data,
  16468. success: callback
  16469. }, jQuery.isPlainObject( url ) && url ) );
  16470. };
  16471. } );
  16472. jQuery._evalUrl = function( url, options ) {
  16473. return jQuery.ajax( {
  16474. url: url,
  16475. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16476. type: "GET",
  16477. dataType: "script",
  16478. cache: true,
  16479. async: false,
  16480. global: false,
  16481. // Only evaluate the response if it is successful (gh-4126)
  16482. // dataFilter is not invoked for failure responses, so using it instead
  16483. // of the default converter is kludgy but it works.
  16484. converters: {
  16485. "text script": function() {}
  16486. },
  16487. dataFilter: function( response ) {
  16488. jQuery.globalEval( response, options );
  16489. }
  16490. } );
  16491. };
  16492. jQuery.fn.extend( {
  16493. wrapAll: function( html ) {
  16494. var wrap;
  16495. if ( this[ 0 ] ) {
  16496. if ( isFunction( html ) ) {
  16497. html = html.call( this[ 0 ] );
  16498. }
  16499. // The elements to wrap the target around
  16500. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16501. if ( this[ 0 ].parentNode ) {
  16502. wrap.insertBefore( this[ 0 ] );
  16503. }
  16504. wrap.map( function() {
  16505. var elem = this;
  16506. while ( elem.firstElementChild ) {
  16507. elem = elem.firstElementChild;
  16508. }
  16509. return elem;
  16510. } ).append( this );
  16511. }
  16512. return this;
  16513. },
  16514. wrapInner: function( html ) {
  16515. if ( isFunction( html ) ) {
  16516. return this.each( function( i ) {
  16517. jQuery( this ).wrapInner( html.call( this, i ) );
  16518. } );
  16519. }
  16520. return this.each( function() {
  16521. var self = jQuery( this ),
  16522. contents = self.contents();
  16523. if ( contents.length ) {
  16524. contents.wrapAll( html );
  16525. } else {
  16526. self.append( html );
  16527. }
  16528. } );
  16529. },
  16530. wrap: function( html ) {
  16531. var htmlIsFunction = isFunction( html );
  16532. return this.each( function( i ) {
  16533. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16534. } );
  16535. },
  16536. unwrap: function( selector ) {
  16537. this.parent( selector ).not( "body" ).each( function() {
  16538. jQuery( this ).replaceWith( this.childNodes );
  16539. } );
  16540. return this;
  16541. }
  16542. } );
  16543. jQuery.expr.pseudos.hidden = function( elem ) {
  16544. return !jQuery.expr.pseudos.visible( elem );
  16545. };
  16546. jQuery.expr.pseudos.visible = function( elem ) {
  16547. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16548. };
  16549. jQuery.ajaxSettings.xhr = function() {
  16550. try {
  16551. return new window.XMLHttpRequest();
  16552. } catch ( e ) {}
  16553. };
  16554. var xhrSuccessStatus = {
  16555. // File protocol always yields status code 0, assume 200
  16556. 0: 200,
  16557. // Support: IE <=9 only
  16558. // #1450: sometimes IE returns 1223 when it should be 204
  16559. 1223: 204
  16560. },
  16561. xhrSupported = jQuery.ajaxSettings.xhr();
  16562. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16563. support.ajax = xhrSupported = !!xhrSupported;
  16564. jQuery.ajaxTransport( function( options ) {
  16565. var callback, errorCallback;
  16566. // Cross domain only allowed if supported through XMLHttpRequest
  16567. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16568. return {
  16569. send: function( headers, complete ) {
  16570. var i,
  16571. xhr = options.xhr();
  16572. xhr.open(
  16573. options.type,
  16574. options.url,
  16575. options.async,
  16576. options.username,
  16577. options.password
  16578. );
  16579. // Apply custom fields if provided
  16580. if ( options.xhrFields ) {
  16581. for ( i in options.xhrFields ) {
  16582. xhr[ i ] = options.xhrFields[ i ];
  16583. }
  16584. }
  16585. // Override mime type if needed
  16586. if ( options.mimeType && xhr.overrideMimeType ) {
  16587. xhr.overrideMimeType( options.mimeType );
  16588. }
  16589. // X-Requested-With header
  16590. // For cross-domain requests, seeing as conditions for a preflight are
  16591. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16592. // (it can always be set on a per-request basis or even using ajaxSetup)
  16593. // For same-domain requests, won't change header if already provided.
  16594. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16595. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16596. }
  16597. // Set headers
  16598. for ( i in headers ) {
  16599. xhr.setRequestHeader( i, headers[ i ] );
  16600. }
  16601. // Callback
  16602. callback = function( type ) {
  16603. return function() {
  16604. if ( callback ) {
  16605. callback = errorCallback = xhr.onload =
  16606. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16607. xhr.onreadystatechange = null;
  16608. if ( type === "abort" ) {
  16609. xhr.abort();
  16610. } else if ( type === "error" ) {
  16611. // Support: IE <=9 only
  16612. // On a manual native abort, IE9 throws
  16613. // errors on any property access that is not readyState
  16614. if ( typeof xhr.status !== "number" ) {
  16615. complete( 0, "error" );
  16616. } else {
  16617. complete(
  16618. // File: protocol always yields status 0; see #8605, #14207
  16619. xhr.status,
  16620. xhr.statusText
  16621. );
  16622. }
  16623. } else {
  16624. complete(
  16625. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16626. xhr.statusText,
  16627. // Support: IE <=9 only
  16628. // IE9 has no XHR2 but throws on binary (trac-11426)
  16629. // For XHR2 non-text, let the caller handle it (gh-2498)
  16630. ( xhr.responseType || "text" ) !== "text" ||
  16631. typeof xhr.responseText !== "string" ?
  16632. { binary: xhr.response } :
  16633. { text: xhr.responseText },
  16634. xhr.getAllResponseHeaders()
  16635. );
  16636. }
  16637. }
  16638. };
  16639. };
  16640. // Listen to events
  16641. xhr.onload = callback();
  16642. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16643. // Support: IE 9 only
  16644. // Use onreadystatechange to replace onabort
  16645. // to handle uncaught aborts
  16646. if ( xhr.onabort !== undefined ) {
  16647. xhr.onabort = errorCallback;
  16648. } else {
  16649. xhr.onreadystatechange = function() {
  16650. // Check readyState before timeout as it changes
  16651. if ( xhr.readyState === 4 ) {
  16652. // Allow onerror to be called first,
  16653. // but that will not handle a native abort
  16654. // Also, save errorCallback to a variable
  16655. // as xhr.onerror cannot be accessed
  16656. window.setTimeout( function() {
  16657. if ( callback ) {
  16658. errorCallback();
  16659. }
  16660. } );
  16661. }
  16662. };
  16663. }
  16664. // Create the abort callback
  16665. callback = callback( "abort" );
  16666. try {
  16667. // Do send the request (this may raise an exception)
  16668. xhr.send( options.hasContent && options.data || null );
  16669. } catch ( e ) {
  16670. // #14683: Only rethrow if this hasn't been notified as an error yet
  16671. if ( callback ) {
  16672. throw e;
  16673. }
  16674. }
  16675. },
  16676. abort: function() {
  16677. if ( callback ) {
  16678. callback();
  16679. }
  16680. }
  16681. };
  16682. }
  16683. } );
  16684. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16685. jQuery.ajaxPrefilter( function( s ) {
  16686. if ( s.crossDomain ) {
  16687. s.contents.script = false;
  16688. }
  16689. } );
  16690. // Install script dataType
  16691. jQuery.ajaxSetup( {
  16692. accepts: {
  16693. script: "text/javascript, application/javascript, " +
  16694. "application/ecmascript, application/x-ecmascript"
  16695. },
  16696. contents: {
  16697. script: /\b(?:java|ecma)script\b/
  16698. },
  16699. converters: {
  16700. "text script": function( text ) {
  16701. jQuery.globalEval( text );
  16702. return text;
  16703. }
  16704. }
  16705. } );
  16706. // Handle cache's special case and crossDomain
  16707. jQuery.ajaxPrefilter( "script", function( s ) {
  16708. if ( s.cache === undefined ) {
  16709. s.cache = false;
  16710. }
  16711. if ( s.crossDomain ) {
  16712. s.type = "GET";
  16713. }
  16714. } );
  16715. // Bind script tag hack transport
  16716. jQuery.ajaxTransport( "script", function( s ) {
  16717. // This transport only deals with cross domain or forced-by-attrs requests
  16718. if ( s.crossDomain || s.scriptAttrs ) {
  16719. var script, callback;
  16720. return {
  16721. send: function( _, complete ) {
  16722. script = jQuery( "<script>" )
  16723. .attr( s.scriptAttrs || {} )
  16724. .prop( { charset: s.scriptCharset, src: s.url } )
  16725. .on( "load error", callback = function( evt ) {
  16726. script.remove();
  16727. callback = null;
  16728. if ( evt ) {
  16729. complete( evt.type === "error" ? 404 : 200, evt.type );
  16730. }
  16731. } );
  16732. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16733. document.head.appendChild( script[ 0 ] );
  16734. },
  16735. abort: function() {
  16736. if ( callback ) {
  16737. callback();
  16738. }
  16739. }
  16740. };
  16741. }
  16742. } );
  16743. var oldCallbacks = [],
  16744. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16745. // Default jsonp settings
  16746. jQuery.ajaxSetup( {
  16747. jsonp: "callback",
  16748. jsonpCallback: function() {
  16749. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16750. this[ callback ] = true;
  16751. return callback;
  16752. }
  16753. } );
  16754. // Detect, normalize options and install callbacks for jsonp requests
  16755. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16756. var callbackName, overwritten, responseContainer,
  16757. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16758. "url" :
  16759. typeof s.data === "string" &&
  16760. ( s.contentType || "" )
  16761. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16762. rjsonp.test( s.data ) && "data"
  16763. );
  16764. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16765. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16766. // Get callback name, remembering preexisting value associated with it
  16767. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16768. s.jsonpCallback() :
  16769. s.jsonpCallback;
  16770. // Insert callback into url or form data
  16771. if ( jsonProp ) {
  16772. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16773. } else if ( s.jsonp !== false ) {
  16774. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16775. }
  16776. // Use data converter to retrieve json after script execution
  16777. s.converters[ "script json" ] = function() {
  16778. if ( !responseContainer ) {
  16779. jQuery.error( callbackName + " was not called" );
  16780. }
  16781. return responseContainer[ 0 ];
  16782. };
  16783. // Force json dataType
  16784. s.dataTypes[ 0 ] = "json";
  16785. // Install callback
  16786. overwritten = window[ callbackName ];
  16787. window[ callbackName ] = function() {
  16788. responseContainer = arguments;
  16789. };
  16790. // Clean-up function (fires after converters)
  16791. jqXHR.always( function() {
  16792. // If previous value didn't exist - remove it
  16793. if ( overwritten === undefined ) {
  16794. jQuery( window ).removeProp( callbackName );
  16795. // Otherwise restore preexisting value
  16796. } else {
  16797. window[ callbackName ] = overwritten;
  16798. }
  16799. // Save back as free
  16800. if ( s[ callbackName ] ) {
  16801. // Make sure that re-using the options doesn't screw things around
  16802. s.jsonpCallback = originalSettings.jsonpCallback;
  16803. // Save the callback name for future use
  16804. oldCallbacks.push( callbackName );
  16805. }
  16806. // Call if it was a function and we have a response
  16807. if ( responseContainer && isFunction( overwritten ) ) {
  16808. overwritten( responseContainer[ 0 ] );
  16809. }
  16810. responseContainer = overwritten = undefined;
  16811. } );
  16812. // Delegate to script
  16813. return "script";
  16814. }
  16815. } );
  16816. // Support: Safari 8 only
  16817. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16818. // collapse sibling forms: the second one becomes a child of the first one.
  16819. // Because of that, this security measure has to be disabled in Safari 8.
  16820. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16821. support.createHTMLDocument = ( function() {
  16822. var body = document.implementation.createHTMLDocument( "" ).body;
  16823. body.innerHTML = "<form></form><form></form>";
  16824. return body.childNodes.length === 2;
  16825. } )();
  16826. // Argument "data" should be string of html
  16827. // context (optional): If specified, the fragment will be created in this context,
  16828. // defaults to document
  16829. // keepScripts (optional): If true, will include scripts passed in the html string
  16830. jQuery.parseHTML = function( data, context, keepScripts ) {
  16831. if ( typeof data !== "string" ) {
  16832. return [];
  16833. }
  16834. if ( typeof context === "boolean" ) {
  16835. keepScripts = context;
  16836. context = false;
  16837. }
  16838. var base, parsed, scripts;
  16839. if ( !context ) {
  16840. // Stop scripts or inline event handlers from being executed immediately
  16841. // by using document.implementation
  16842. if ( support.createHTMLDocument ) {
  16843. context = document.implementation.createHTMLDocument( "" );
  16844. // Set the base href for the created document
  16845. // so any parsed elements with URLs
  16846. // are based on the document's URL (gh-2965)
  16847. base = context.createElement( "base" );
  16848. base.href = document.location.href;
  16849. context.head.appendChild( base );
  16850. } else {
  16851. context = document;
  16852. }
  16853. }
  16854. parsed = rsingleTag.exec( data );
  16855. scripts = !keepScripts && [];
  16856. // Single tag
  16857. if ( parsed ) {
  16858. return [ context.createElement( parsed[ 1 ] ) ];
  16859. }
  16860. parsed = buildFragment( [ data ], context, scripts );
  16861. if ( scripts && scripts.length ) {
  16862. jQuery( scripts ).remove();
  16863. }
  16864. return jQuery.merge( [], parsed.childNodes );
  16865. };
  16866. /**
  16867. * Load a url into a page
  16868. */
  16869. jQuery.fn.load = function( url, params, callback ) {
  16870. var selector, type, response,
  16871. self = this,
  16872. off = url.indexOf( " " );
  16873. if ( off > -1 ) {
  16874. selector = stripAndCollapse( url.slice( off ) );
  16875. url = url.slice( 0, off );
  16876. }
  16877. // If it's a function
  16878. if ( isFunction( params ) ) {
  16879. // We assume that it's the callback
  16880. callback = params;
  16881. params = undefined;
  16882. // Otherwise, build a param string
  16883. } else if ( params && typeof params === "object" ) {
  16884. type = "POST";
  16885. }
  16886. // If we have elements to modify, make the request
  16887. if ( self.length > 0 ) {
  16888. jQuery.ajax( {
  16889. url: url,
  16890. // If "type" variable is undefined, then "GET" method will be used.
  16891. // Make value of this field explicit since
  16892. // user can override it through ajaxSetup method
  16893. type: type || "GET",
  16894. dataType: "html",
  16895. data: params
  16896. } ).done( function( responseText ) {
  16897. // Save response for use in complete callback
  16898. response = arguments;
  16899. self.html( selector ?
  16900. // If a selector was specified, locate the right elements in a dummy div
  16901. // Exclude scripts to avoid IE 'Permission Denied' errors
  16902. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16903. // Otherwise use the full result
  16904. responseText );
  16905. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16906. // but they are ignored because response was set above.
  16907. // If it fails, this function gets "jqXHR", "status", "error"
  16908. } ).always( callback && function( jqXHR, status ) {
  16909. self.each( function() {
  16910. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16911. } );
  16912. } );
  16913. }
  16914. return this;
  16915. };
  16916. // Attach a bunch of functions for handling common AJAX events
  16917. jQuery.each( [
  16918. "ajaxStart",
  16919. "ajaxStop",
  16920. "ajaxComplete",
  16921. "ajaxError",
  16922. "ajaxSuccess",
  16923. "ajaxSend"
  16924. ], function( i, type ) {
  16925. jQuery.fn[ type ] = function( fn ) {
  16926. return this.on( type, fn );
  16927. };
  16928. } );
  16929. jQuery.expr.pseudos.animated = function( elem ) {
  16930. return jQuery.grep( jQuery.timers, function( fn ) {
  16931. return elem === fn.elem;
  16932. } ).length;
  16933. };
  16934. jQuery.offset = {
  16935. setOffset: function( elem, options, i ) {
  16936. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16937. position = jQuery.css( elem, "position" ),
  16938. curElem = jQuery( elem ),
  16939. props = {};
  16940. // Set position first, in-case top/left are set even on static elem
  16941. if ( position === "static" ) {
  16942. elem.style.position = "relative";
  16943. }
  16944. curOffset = curElem.offset();
  16945. curCSSTop = jQuery.css( elem, "top" );
  16946. curCSSLeft = jQuery.css( elem, "left" );
  16947. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16948. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16949. // Need to be able to calculate position if either
  16950. // top or left is auto and position is either absolute or fixed
  16951. if ( calculatePosition ) {
  16952. curPosition = curElem.position();
  16953. curTop = curPosition.top;
  16954. curLeft = curPosition.left;
  16955. } else {
  16956. curTop = parseFloat( curCSSTop ) || 0;
  16957. curLeft = parseFloat( curCSSLeft ) || 0;
  16958. }
  16959. if ( isFunction( options ) ) {
  16960. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16961. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16962. }
  16963. if ( options.top != null ) {
  16964. props.top = ( options.top - curOffset.top ) + curTop;
  16965. }
  16966. if ( options.left != null ) {
  16967. props.left = ( options.left - curOffset.left ) + curLeft;
  16968. }
  16969. if ( "using" in options ) {
  16970. options.using.call( elem, props );
  16971. } else {
  16972. curElem.css( props );
  16973. }
  16974. }
  16975. };
  16976. jQuery.fn.extend( {
  16977. // offset() relates an element's border box to the document origin
  16978. offset: function( options ) {
  16979. // Preserve chaining for setter
  16980. if ( arguments.length ) {
  16981. return options === undefined ?
  16982. this :
  16983. this.each( function( i ) {
  16984. jQuery.offset.setOffset( this, options, i );
  16985. } );
  16986. }
  16987. var rect, win,
  16988. elem = this[ 0 ];
  16989. if ( !elem ) {
  16990. return;
  16991. }
  16992. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16993. // Support: IE <=11 only
  16994. // Running getBoundingClientRect on a
  16995. // disconnected node in IE throws an error
  16996. if ( !elem.getClientRects().length ) {
  16997. return { top: 0, left: 0 };
  16998. }
  16999. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17000. rect = elem.getBoundingClientRect();
  17001. win = elem.ownerDocument.defaultView;
  17002. return {
  17003. top: rect.top + win.pageYOffset,
  17004. left: rect.left + win.pageXOffset
  17005. };
  17006. },
  17007. // position() relates an element's margin box to its offset parent's padding box
  17008. // This corresponds to the behavior of CSS absolute positioning
  17009. position: function() {
  17010. if ( !this[ 0 ] ) {
  17011. return;
  17012. }
  17013. var offsetParent, offset, doc,
  17014. elem = this[ 0 ],
  17015. parentOffset = { top: 0, left: 0 };
  17016. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17017. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17018. // Assume position:fixed implies availability of getBoundingClientRect
  17019. offset = elem.getBoundingClientRect();
  17020. } else {
  17021. offset = this.offset();
  17022. // Account for the *real* offset parent, which can be the document or its root element
  17023. // when a statically positioned element is identified
  17024. doc = elem.ownerDocument;
  17025. offsetParent = elem.offsetParent || doc.documentElement;
  17026. while ( offsetParent &&
  17027. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17028. jQuery.css( offsetParent, "position" ) === "static" ) {
  17029. offsetParent = offsetParent.parentNode;
  17030. }
  17031. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17032. // Incorporate borders into its offset, since they are outside its content origin
  17033. parentOffset = jQuery( offsetParent ).offset();
  17034. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17035. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17036. }
  17037. }
  17038. // Subtract parent offsets and element margins
  17039. return {
  17040. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17041. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17042. };
  17043. },
  17044. // This method will return documentElement in the following cases:
  17045. // 1) For the element inside the iframe without offsetParent, this method will return
  17046. // documentElement of the parent window
  17047. // 2) For the hidden or detached element
  17048. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17049. //
  17050. // but those exceptions were never presented as a real life use-cases
  17051. // and might be considered as more preferable results.
  17052. //
  17053. // This logic, however, is not guaranteed and can change at any point in the future
  17054. offsetParent: function() {
  17055. return this.map( function() {
  17056. var offsetParent = this.offsetParent;
  17057. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17058. offsetParent = offsetParent.offsetParent;
  17059. }
  17060. return offsetParent || documentElement;
  17061. } );
  17062. }
  17063. } );
  17064. // Create scrollLeft and scrollTop methods
  17065. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17066. var top = "pageYOffset" === prop;
  17067. jQuery.fn[ method ] = function( val ) {
  17068. return access( this, function( elem, method, val ) {
  17069. // Coalesce documents and windows
  17070. var win;
  17071. if ( isWindow( elem ) ) {
  17072. win = elem;
  17073. } else if ( elem.nodeType === 9 ) {
  17074. win = elem.defaultView;
  17075. }
  17076. if ( val === undefined ) {
  17077. return win ? win[ prop ] : elem[ method ];
  17078. }
  17079. if ( win ) {
  17080. win.scrollTo(
  17081. !top ? val : win.pageXOffset,
  17082. top ? val : win.pageYOffset
  17083. );
  17084. } else {
  17085. elem[ method ] = val;
  17086. }
  17087. }, method, val, arguments.length );
  17088. };
  17089. } );
  17090. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17091. // Add the top/left cssHooks using jQuery.fn.position
  17092. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17093. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17094. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17095. // rather than make the css module depend on the offset module, just check for it here
  17096. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17097. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17098. function( elem, computed ) {
  17099. if ( computed ) {
  17100. computed = curCSS( elem, prop );
  17101. // If curCSS returns percentage, fallback to offset
  17102. return rnumnonpx.test( computed ) ?
  17103. jQuery( elem ).position()[ prop ] + "px" :
  17104. computed;
  17105. }
  17106. }
  17107. );
  17108. } );
  17109. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17110. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17111. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17112. function( defaultExtra, funcName ) {
  17113. // Margin is only for outerHeight, outerWidth
  17114. jQuery.fn[ funcName ] = function( margin, value ) {
  17115. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17116. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17117. return access( this, function( elem, type, value ) {
  17118. var doc;
  17119. if ( isWindow( elem ) ) {
  17120. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17121. return funcName.indexOf( "outer" ) === 0 ?
  17122. elem[ "inner" + name ] :
  17123. elem.document.documentElement[ "client" + name ];
  17124. }
  17125. // Get document width or height
  17126. if ( elem.nodeType === 9 ) {
  17127. doc = elem.documentElement;
  17128. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17129. // whichever is greatest
  17130. return Math.max(
  17131. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17132. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17133. doc[ "client" + name ]
  17134. );
  17135. }
  17136. return value === undefined ?
  17137. // Get width or height on the element, requesting but not forcing parseFloat
  17138. jQuery.css( elem, type, extra ) :
  17139. // Set width or height on the element
  17140. jQuery.style( elem, type, value, extra );
  17141. }, type, chainable ? margin : undefined, chainable );
  17142. };
  17143. } );
  17144. } );
  17145. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17146. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17147. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17148. function( i, name ) {
  17149. // Handle event binding
  17150. jQuery.fn[ name ] = function( data, fn ) {
  17151. return arguments.length > 0 ?
  17152. this.on( name, null, data, fn ) :
  17153. this.trigger( name );
  17154. };
  17155. } );
  17156. jQuery.fn.extend( {
  17157. hover: function( fnOver, fnOut ) {
  17158. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17159. }
  17160. } );
  17161. jQuery.fn.extend( {
  17162. bind: function( types, data, fn ) {
  17163. return this.on( types, null, data, fn );
  17164. },
  17165. unbind: function( types, fn ) {
  17166. return this.off( types, null, fn );
  17167. },
  17168. delegate: function( selector, types, data, fn ) {
  17169. return this.on( types, selector, data, fn );
  17170. },
  17171. undelegate: function( selector, types, fn ) {
  17172. // ( namespace ) or ( selector, types [, fn] )
  17173. return arguments.length === 1 ?
  17174. this.off( selector, "**" ) :
  17175. this.off( types, selector || "**", fn );
  17176. }
  17177. } );
  17178. // Bind a function to a context, optionally partially applying any
  17179. // arguments.
  17180. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17181. // However, it is not slated for removal any time soon
  17182. jQuery.proxy = function( fn, context ) {
  17183. var tmp, args, proxy;
  17184. if ( typeof context === "string" ) {
  17185. tmp = fn[ context ];
  17186. context = fn;
  17187. fn = tmp;
  17188. }
  17189. // Quick check to determine if target is callable, in the spec
  17190. // this throws a TypeError, but we will just return undefined.
  17191. if ( !isFunction( fn ) ) {
  17192. return undefined;
  17193. }
  17194. // Simulated bind
  17195. args = slice.call( arguments, 2 );
  17196. proxy = function() {
  17197. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17198. };
  17199. // Set the guid of unique handler to the same of original handler, so it can be removed
  17200. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17201. return proxy;
  17202. };
  17203. jQuery.holdReady = function( hold ) {
  17204. if ( hold ) {
  17205. jQuery.readyWait++;
  17206. } else {
  17207. jQuery.ready( true );
  17208. }
  17209. };
  17210. jQuery.isArray = Array.isArray;
  17211. jQuery.parseJSON = JSON.parse;
  17212. jQuery.nodeName = nodeName;
  17213. jQuery.isFunction = isFunction;
  17214. jQuery.isWindow = isWindow;
  17215. jQuery.camelCase = camelCase;
  17216. jQuery.type = toType;
  17217. jQuery.now = Date.now;
  17218. jQuery.isNumeric = function( obj ) {
  17219. // As of jQuery 3.0, isNumeric is limited to
  17220. // strings and numbers (primitives or objects)
  17221. // that can be coerced to finite numbers (gh-2662)
  17222. var type = jQuery.type( obj );
  17223. return ( type === "number" || type === "string" ) &&
  17224. // parseFloat NaNs numeric-cast false positives ("")
  17225. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17226. // subtraction forces infinities to NaN
  17227. !isNaN( obj - parseFloat( obj ) );
  17228. };
  17229. // Register as a named AMD module, since jQuery can be concatenated with other
  17230. // files that may use define, but not via a proper concatenation script that
  17231. // understands anonymous AMD modules. A named AMD is safest and most robust
  17232. // way to register. Lowercase jquery is used because AMD module names are
  17233. // derived from file names, and jQuery is normally delivered in a lowercase
  17234. // file name. Do this after creating the global so that if an AMD module wants
  17235. // to call noConflict to hide this version of jQuery, it will work.
  17236. // Note that for maximum portability, libraries that are not jQuery should
  17237. // declare themselves as anonymous modules, and avoid setting a global if an
  17238. // AMD loader is present. jQuery is a special case. For more information, see
  17239. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17240. if ( true ) {
  17241. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17242. return jQuery;
  17243. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17244. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17245. }
  17246. var
  17247. // Map over jQuery in case of overwrite
  17248. _jQuery = window.jQuery,
  17249. // Map over the $ in case of overwrite
  17250. _$ = window.$;
  17251. jQuery.noConflict = function( deep ) {
  17252. if ( window.$ === jQuery ) {
  17253. window.$ = _$;
  17254. }
  17255. if ( deep && window.jQuery === jQuery ) {
  17256. window.jQuery = _jQuery;
  17257. }
  17258. return jQuery;
  17259. };
  17260. // Expose jQuery and $ identifiers, even in AMD
  17261. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17262. // and CommonJS for browser emulators (#13566)
  17263. if ( !noGlobal ) {
  17264. window.jQuery = window.$ = jQuery;
  17265. }
  17266. return jQuery;
  17267. } );
  17268. /***/ }),
  17269. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17270. /*!************************************************!*\
  17271. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17272. \************************************************/
  17273. /*! exports provided: default */
  17274. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17275. "use strict";
  17276. __webpack_require__.r(__webpack_exports__);
  17277. var classCallCheck = function (instance, Constructor) {
  17278. if (!(instance instanceof Constructor)) {
  17279. throw new TypeError("Cannot call a class as a function");
  17280. }
  17281. };
  17282. var createClass = function () {
  17283. function defineProperties(target, props) {
  17284. for (var i = 0; i < props.length; i++) {
  17285. var descriptor = props[i];
  17286. descriptor.enumerable = descriptor.enumerable || false;
  17287. descriptor.configurable = true;
  17288. if ("value" in descriptor) descriptor.writable = true;
  17289. Object.defineProperty(target, descriptor.key, descriptor);
  17290. }
  17291. }
  17292. return function (Constructor, protoProps, staticProps) {
  17293. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17294. if (staticProps) defineProperties(Constructor, staticProps);
  17295. return Constructor;
  17296. };
  17297. }();
  17298. var _extends = Object.assign || function (target) {
  17299. for (var i = 1; i < arguments.length; i++) {
  17300. var source = arguments[i];
  17301. for (var key in source) {
  17302. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17303. target[key] = source[key];
  17304. }
  17305. }
  17306. }
  17307. return target;
  17308. };
  17309. var inherits = function (subClass, superClass) {
  17310. if (typeof superClass !== "function" && superClass !== null) {
  17311. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17312. }
  17313. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17314. constructor: {
  17315. value: subClass,
  17316. enumerable: false,
  17317. writable: true,
  17318. configurable: true
  17319. }
  17320. });
  17321. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17322. };
  17323. var possibleConstructorReturn = function (self, call) {
  17324. if (!self) {
  17325. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17326. }
  17327. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17328. };
  17329. var Connector = function () {
  17330. /**
  17331. * Create a new class instance.
  17332. */
  17333. function Connector(options) {
  17334. classCallCheck(this, Connector);
  17335. /**
  17336. * Default connector options.
  17337. */
  17338. this._defaultOptions = {
  17339. auth: {
  17340. headers: {}
  17341. },
  17342. authEndpoint: '/broadcasting/auth',
  17343. broadcaster: 'pusher',
  17344. csrfToken: null,
  17345. host: null,
  17346. key: null,
  17347. namespace: 'App.Events'
  17348. };
  17349. this.setOptions(options);
  17350. this.connect();
  17351. }
  17352. /**
  17353. * Merge the custom options with the defaults.
  17354. */
  17355. createClass(Connector, [{
  17356. key: 'setOptions',
  17357. value: function setOptions(options) {
  17358. this.options = _extends(this._defaultOptions, options);
  17359. if (this.csrfToken()) {
  17360. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17361. }
  17362. return options;
  17363. }
  17364. /**
  17365. * Extract the CSRF token from the page.
  17366. */
  17367. }, {
  17368. key: 'csrfToken',
  17369. value: function csrfToken() {
  17370. var selector = void 0;
  17371. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17372. return window['Laravel'].csrfToken;
  17373. } else if (this.options.csrfToken) {
  17374. return this.options.csrfToken;
  17375. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17376. return selector.getAttribute('content');
  17377. }
  17378. return null;
  17379. }
  17380. }]);
  17381. return Connector;
  17382. }();
  17383. /**
  17384. * This class represents a basic channel.
  17385. */
  17386. var Channel = function () {
  17387. function Channel() {
  17388. classCallCheck(this, Channel);
  17389. }
  17390. createClass(Channel, [{
  17391. key: 'listenForWhisper',
  17392. /**
  17393. * Listen for a whisper event on the channel instance.
  17394. */
  17395. value: function listenForWhisper(event, callback) {
  17396. return this.listen('.client-' + event, callback);
  17397. }
  17398. /**
  17399. * Listen for an event on the channel instance.
  17400. */
  17401. }, {
  17402. key: 'notification',
  17403. value: function notification(callback) {
  17404. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17405. }
  17406. /**
  17407. * Stop listening for a whispser event on the channel instance.
  17408. */
  17409. }, {
  17410. key: 'stopListeningForWhisper',
  17411. value: function stopListeningForWhisper(event) {
  17412. return this.stopListening('.client-' + event);
  17413. }
  17414. }]);
  17415. return Channel;
  17416. }();
  17417. /**
  17418. * Event name formatter
  17419. */
  17420. var EventFormatter = function () {
  17421. /**
  17422. * Create a new class instance.
  17423. */
  17424. function EventFormatter(namespace) {
  17425. classCallCheck(this, EventFormatter);
  17426. this.setNamespace(namespace);
  17427. }
  17428. /**
  17429. * Format the given event name.
  17430. */
  17431. createClass(EventFormatter, [{
  17432. key: 'format',
  17433. value: function format(event) {
  17434. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17435. return event.substr(1);
  17436. } else if (this.namespace) {
  17437. event = this.namespace + '.' + event;
  17438. }
  17439. return event.replace(/\./g, '\\');
  17440. }
  17441. /**
  17442. * Set the event namespace.
  17443. */
  17444. }, {
  17445. key: 'setNamespace',
  17446. value: function setNamespace(value) {
  17447. this.namespace = value;
  17448. }
  17449. }]);
  17450. return EventFormatter;
  17451. }();
  17452. /**
  17453. * This class represents a Pusher channel.
  17454. */
  17455. var PusherChannel = function (_Channel) {
  17456. inherits(PusherChannel, _Channel);
  17457. /**
  17458. * Create a new class instance.
  17459. */
  17460. function PusherChannel(pusher, name, options) {
  17461. classCallCheck(this, PusherChannel);
  17462. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17463. _this.name = name;
  17464. _this.pusher = pusher;
  17465. _this.options = options;
  17466. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17467. _this.subscribe();
  17468. return _this;
  17469. }
  17470. /**
  17471. * Subscribe to a Pusher channel.
  17472. */
  17473. createClass(PusherChannel, [{
  17474. key: 'subscribe',
  17475. value: function subscribe() {
  17476. this.subscription = this.pusher.subscribe(this.name);
  17477. }
  17478. /**
  17479. * Unsubscribe from a Pusher channel.
  17480. */
  17481. }, {
  17482. key: 'unsubscribe',
  17483. value: function unsubscribe() {
  17484. this.pusher.unsubscribe(this.name);
  17485. }
  17486. /**
  17487. * Listen for an event on the channel instance.
  17488. */
  17489. }, {
  17490. key: 'listen',
  17491. value: function listen(event, callback) {
  17492. this.on(this.eventFormatter.format(event), callback);
  17493. return this;
  17494. }
  17495. /**
  17496. * Stop listening for an event on the channel instance.
  17497. */
  17498. }, {
  17499. key: 'stopListening',
  17500. value: function stopListening(event) {
  17501. this.subscription.unbind(this.eventFormatter.format(event));
  17502. return this;
  17503. }
  17504. /**
  17505. * Bind a channel to an event.
  17506. */
  17507. }, {
  17508. key: 'on',
  17509. value: function on(event, callback) {
  17510. this.subscription.bind(event, callback);
  17511. return this;
  17512. }
  17513. }]);
  17514. return PusherChannel;
  17515. }(Channel);
  17516. /**
  17517. * This class represents a Pusher private channel.
  17518. */
  17519. var PusherPrivateChannel = function (_PusherChannel) {
  17520. inherits(PusherPrivateChannel, _PusherChannel);
  17521. function PusherPrivateChannel() {
  17522. classCallCheck(this, PusherPrivateChannel);
  17523. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17524. }
  17525. createClass(PusherPrivateChannel, [{
  17526. key: 'whisper',
  17527. /**
  17528. * Trigger client event on the channel.
  17529. */
  17530. value: function whisper(eventName, data) {
  17531. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17532. return this;
  17533. }
  17534. }]);
  17535. return PusherPrivateChannel;
  17536. }(PusherChannel);
  17537. /**
  17538. * This class represents a Pusher presence channel.
  17539. */
  17540. var PusherPresenceChannel = function (_PusherChannel) {
  17541. inherits(PusherPresenceChannel, _PusherChannel);
  17542. function PusherPresenceChannel() {
  17543. classCallCheck(this, PusherPresenceChannel);
  17544. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17545. }
  17546. createClass(PusherPresenceChannel, [{
  17547. key: 'here',
  17548. /**
  17549. * Register a callback to be called anytime the member list changes.
  17550. */
  17551. value: function here(callback) {
  17552. this.on('pusher:subscription_succeeded', function (data) {
  17553. callback(Object.keys(data.members).map(function (k) {
  17554. return data.members[k];
  17555. }));
  17556. });
  17557. return this;
  17558. }
  17559. /**
  17560. * Listen for someone joining the channel.
  17561. */
  17562. }, {
  17563. key: 'joining',
  17564. value: function joining(callback) {
  17565. this.on('pusher:member_added', function (member) {
  17566. callback(member.info);
  17567. });
  17568. return this;
  17569. }
  17570. /**
  17571. * Listen for someone leaving the channel.
  17572. */
  17573. }, {
  17574. key: 'leaving',
  17575. value: function leaving(callback) {
  17576. this.on('pusher:member_removed', function (member) {
  17577. callback(member.info);
  17578. });
  17579. return this;
  17580. }
  17581. /**
  17582. * Trigger client event on the channel.
  17583. */
  17584. }, {
  17585. key: 'whisper',
  17586. value: function whisper(eventName, data) {
  17587. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17588. return this;
  17589. }
  17590. }]);
  17591. return PusherPresenceChannel;
  17592. }(PusherChannel);
  17593. /**
  17594. * This class represents a Socket.io channel.
  17595. */
  17596. var SocketIoChannel = function (_Channel) {
  17597. inherits(SocketIoChannel, _Channel);
  17598. /**
  17599. * Create a new class instance.
  17600. */
  17601. function SocketIoChannel(socket, name, options) {
  17602. classCallCheck(this, SocketIoChannel);
  17603. /**
  17604. * The event callbacks applied to the channel.
  17605. */
  17606. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17607. _this.events = {};
  17608. _this.name = name;
  17609. _this.socket = socket;
  17610. _this.options = options;
  17611. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17612. _this.subscribe();
  17613. _this.configureReconnector();
  17614. return _this;
  17615. }
  17616. /**
  17617. * Subscribe to a Socket.io channel.
  17618. */
  17619. createClass(SocketIoChannel, [{
  17620. key: 'subscribe',
  17621. value: function subscribe() {
  17622. this.socket.emit('subscribe', {
  17623. channel: this.name,
  17624. auth: this.options.auth || {}
  17625. });
  17626. }
  17627. /**
  17628. * Unsubscribe from channel and ubind event callbacks.
  17629. */
  17630. }, {
  17631. key: 'unsubscribe',
  17632. value: function unsubscribe() {
  17633. this.unbind();
  17634. this.socket.emit('unsubscribe', {
  17635. channel: this.name,
  17636. auth: this.options.auth || {}
  17637. });
  17638. }
  17639. /**
  17640. * Listen for an event on the channel instance.
  17641. */
  17642. }, {
  17643. key: 'listen',
  17644. value: function listen(event, callback) {
  17645. this.on(this.eventFormatter.format(event), callback);
  17646. return this;
  17647. }
  17648. /**
  17649. * Stop listening for an event on the channel instance.
  17650. */
  17651. }, {
  17652. key: 'stopListening',
  17653. value: function stopListening(event) {
  17654. var name = this.eventFormatter.format(event);
  17655. this.socket.removeListener(name);
  17656. delete this.events[name];
  17657. return this;
  17658. }
  17659. /**
  17660. * Bind the channel's socket to an event and store the callback.
  17661. */
  17662. }, {
  17663. key: 'on',
  17664. value: function on(event, callback) {
  17665. var _this2 = this;
  17666. var listener = function listener(channel, data) {
  17667. if (_this2.name == channel) {
  17668. callback(data);
  17669. }
  17670. };
  17671. this.socket.on(event, listener);
  17672. this.bind(event, listener);
  17673. }
  17674. /**
  17675. * Attach a 'reconnect' listener and bind the event.
  17676. */
  17677. }, {
  17678. key: 'configureReconnector',
  17679. value: function configureReconnector() {
  17680. var _this3 = this;
  17681. var listener = function listener() {
  17682. _this3.subscribe();
  17683. };
  17684. this.socket.on('reconnect', listener);
  17685. this.bind('reconnect', listener);
  17686. }
  17687. /**
  17688. * Bind the channel's socket to an event and store the callback.
  17689. */
  17690. }, {
  17691. key: 'bind',
  17692. value: function bind(event, callback) {
  17693. this.events[event] = this.events[event] || [];
  17694. this.events[event].push(callback);
  17695. }
  17696. /**
  17697. * Unbind the channel's socket from all stored event callbacks.
  17698. */
  17699. }, {
  17700. key: 'unbind',
  17701. value: function unbind() {
  17702. var _this4 = this;
  17703. Object.keys(this.events).forEach(function (event) {
  17704. _this4.events[event].forEach(function (callback) {
  17705. _this4.socket.removeListener(event, callback);
  17706. });
  17707. delete _this4.events[event];
  17708. });
  17709. }
  17710. }]);
  17711. return SocketIoChannel;
  17712. }(Channel);
  17713. /**
  17714. * This class represents a Socket.io presence channel.
  17715. */
  17716. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17717. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17718. function SocketIoPrivateChannel() {
  17719. classCallCheck(this, SocketIoPrivateChannel);
  17720. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17721. }
  17722. createClass(SocketIoPrivateChannel, [{
  17723. key: 'whisper',
  17724. /**
  17725. * Trigger client event on the channel.
  17726. */
  17727. value: function whisper(eventName, data) {
  17728. this.socket.emit('client event', {
  17729. channel: this.name,
  17730. event: 'client-' + eventName,
  17731. data: data
  17732. });
  17733. return this;
  17734. }
  17735. }]);
  17736. return SocketIoPrivateChannel;
  17737. }(SocketIoChannel);
  17738. /**
  17739. * This class represents a Socket.io presence channel.
  17740. */
  17741. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17742. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17743. function SocketIoPresenceChannel() {
  17744. classCallCheck(this, SocketIoPresenceChannel);
  17745. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17746. }
  17747. createClass(SocketIoPresenceChannel, [{
  17748. key: 'here',
  17749. /**
  17750. * Register a callback to be called anytime the member list changes.
  17751. */
  17752. value: function here(callback) {
  17753. this.on('presence:subscribed', function (members) {
  17754. callback(members.map(function (m) {
  17755. return m.user_info;
  17756. }));
  17757. });
  17758. return this;
  17759. }
  17760. /**
  17761. * Listen for someone joining the channel.
  17762. */
  17763. }, {
  17764. key: 'joining',
  17765. value: function joining(callback) {
  17766. this.on('presence:joining', function (member) {
  17767. return callback(member.user_info);
  17768. });
  17769. return this;
  17770. }
  17771. /**
  17772. * Listen for someone leaving the channel.
  17773. */
  17774. }, {
  17775. key: 'leaving',
  17776. value: function leaving(callback) {
  17777. this.on('presence:leaving', function (member) {
  17778. return callback(member.user_info);
  17779. });
  17780. return this;
  17781. }
  17782. }]);
  17783. return SocketIoPresenceChannel;
  17784. }(SocketIoPrivateChannel);
  17785. /**
  17786. * This class represents a null channel.
  17787. */
  17788. var NullChannel = function (_Channel) {
  17789. inherits(NullChannel, _Channel);
  17790. function NullChannel() {
  17791. classCallCheck(this, NullChannel);
  17792. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17793. }
  17794. createClass(NullChannel, [{
  17795. key: 'subscribe',
  17796. /**
  17797. * Subscribe to a channel.
  17798. */
  17799. value: function subscribe() {}
  17800. //
  17801. /**
  17802. * Unsubscribe from a channel.
  17803. */
  17804. }, {
  17805. key: 'unsubscribe',
  17806. value: function unsubscribe() {}
  17807. //
  17808. /**
  17809. * Listen for an event on the channel instance.
  17810. */
  17811. }, {
  17812. key: 'listen',
  17813. value: function listen(event, callback) {
  17814. return this;
  17815. }
  17816. /**
  17817. * Stop listening for an event on the channel instance.
  17818. */
  17819. }, {
  17820. key: 'stopListening',
  17821. value: function stopListening(event) {
  17822. return this;
  17823. }
  17824. /**
  17825. * Bind a channel to an event.
  17826. */
  17827. }, {
  17828. key: 'on',
  17829. value: function on(event, callback) {
  17830. return this;
  17831. }
  17832. }]);
  17833. return NullChannel;
  17834. }(Channel);
  17835. /**
  17836. * This class represents a null private channel.
  17837. */
  17838. var NullPrivateChannel = function (_NullChannel) {
  17839. inherits(NullPrivateChannel, _NullChannel);
  17840. function NullPrivateChannel() {
  17841. classCallCheck(this, NullPrivateChannel);
  17842. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17843. }
  17844. createClass(NullPrivateChannel, [{
  17845. key: 'whisper',
  17846. /**
  17847. * Trigger client event on the channel.
  17848. */
  17849. value: function whisper(eventName, data) {
  17850. return this;
  17851. }
  17852. }]);
  17853. return NullPrivateChannel;
  17854. }(NullChannel);
  17855. /**
  17856. * This class represents a null presence channel.
  17857. */
  17858. var NullPresenceChannel = function (_NullChannel) {
  17859. inherits(NullPresenceChannel, _NullChannel);
  17860. function NullPresenceChannel() {
  17861. classCallCheck(this, NullPresenceChannel);
  17862. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17863. }
  17864. createClass(NullPresenceChannel, [{
  17865. key: 'here',
  17866. /**
  17867. * Register a callback to be called anytime the member list changes.
  17868. */
  17869. value: function here(callback) {
  17870. return this;
  17871. }
  17872. /**
  17873. * Listen for someone joining the channel.
  17874. */
  17875. }, {
  17876. key: 'joining',
  17877. value: function joining(callback) {
  17878. return this;
  17879. }
  17880. /**
  17881. * Listen for someone leaving the channel.
  17882. */
  17883. }, {
  17884. key: 'leaving',
  17885. value: function leaving(callback) {
  17886. return this;
  17887. }
  17888. /**
  17889. * Trigger client event on the channel.
  17890. */
  17891. }, {
  17892. key: 'whisper',
  17893. value: function whisper(eventName, data) {
  17894. return this;
  17895. }
  17896. }]);
  17897. return NullPresenceChannel;
  17898. }(NullChannel);
  17899. /**
  17900. * This class creates a connector to Pusher.
  17901. */
  17902. var PusherConnector = function (_Connector) {
  17903. inherits(PusherConnector, _Connector);
  17904. function PusherConnector() {
  17905. classCallCheck(this, PusherConnector);
  17906. /**
  17907. * All of the subscribed channel names.
  17908. */
  17909. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17910. _this.channels = {};
  17911. return _this;
  17912. }
  17913. /**
  17914. * Create a fresh Pusher connection.
  17915. */
  17916. createClass(PusherConnector, [{
  17917. key: 'connect',
  17918. value: function connect() {
  17919. if (typeof this.options.client !== 'undefined') {
  17920. this.pusher = this.options.client;
  17921. } else {
  17922. this.pusher = new Pusher(this.options.key, this.options);
  17923. }
  17924. }
  17925. /**
  17926. * Listen for an event on a channel instance.
  17927. */
  17928. }, {
  17929. key: 'listen',
  17930. value: function listen(name, event, callback) {
  17931. return this.channel(name).listen(event, callback);
  17932. }
  17933. /**
  17934. * Get a channel instance by name.
  17935. */
  17936. }, {
  17937. key: 'channel',
  17938. value: function channel(name) {
  17939. if (!this.channels[name]) {
  17940. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17941. }
  17942. return this.channels[name];
  17943. }
  17944. /**
  17945. * Get a private channel instance by name.
  17946. */
  17947. }, {
  17948. key: 'privateChannel',
  17949. value: function privateChannel(name) {
  17950. if (!this.channels['private-' + name]) {
  17951. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17952. }
  17953. return this.channels['private-' + name];
  17954. }
  17955. /**
  17956. * Get a presence channel instance by name.
  17957. */
  17958. }, {
  17959. key: 'presenceChannel',
  17960. value: function presenceChannel(name) {
  17961. if (!this.channels['presence-' + name]) {
  17962. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17963. }
  17964. return this.channels['presence-' + name];
  17965. }
  17966. /**
  17967. * Leave the given channel, as well as its private and presence variants.
  17968. */
  17969. }, {
  17970. key: 'leave',
  17971. value: function leave(name) {
  17972. var _this2 = this;
  17973. var channels = [name, 'private-' + name, 'presence-' + name];
  17974. channels.forEach(function (name, index) {
  17975. _this2.leaveChannel(name);
  17976. });
  17977. }
  17978. /**
  17979. * Leave the given channel.
  17980. */
  17981. }, {
  17982. key: 'leaveChannel',
  17983. value: function leaveChannel(name) {
  17984. if (this.channels[name]) {
  17985. this.channels[name].unsubscribe();
  17986. delete this.channels[name];
  17987. }
  17988. }
  17989. /**
  17990. * Get the socket ID for the connection.
  17991. */
  17992. }, {
  17993. key: 'socketId',
  17994. value: function socketId() {
  17995. return this.pusher.connection.socket_id;
  17996. }
  17997. /**
  17998. * Disconnect Pusher connection.
  17999. */
  18000. }, {
  18001. key: 'disconnect',
  18002. value: function disconnect() {
  18003. this.pusher.disconnect();
  18004. }
  18005. }]);
  18006. return PusherConnector;
  18007. }(Connector);
  18008. /**
  18009. * This class creates a connnector to a Socket.io server.
  18010. */
  18011. var SocketIoConnector = function (_Connector) {
  18012. inherits(SocketIoConnector, _Connector);
  18013. function SocketIoConnector() {
  18014. classCallCheck(this, SocketIoConnector);
  18015. /**
  18016. * All of the subscribed channel names.
  18017. */
  18018. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18019. _this.channels = {};
  18020. return _this;
  18021. }
  18022. /**
  18023. * Create a fresh Socket.io connection.
  18024. */
  18025. createClass(SocketIoConnector, [{
  18026. key: 'connect',
  18027. value: function connect() {
  18028. var io = this.getSocketIO();
  18029. this.socket = io(this.options.host, this.options);
  18030. return this.socket;
  18031. }
  18032. /**
  18033. * Get socket.io module from global scope or options.
  18034. */
  18035. }, {
  18036. key: 'getSocketIO',
  18037. value: function getSocketIO() {
  18038. if (typeof this.options.client !== 'undefined') {
  18039. return this.options.client;
  18040. }
  18041. if (typeof io !== 'undefined') {
  18042. return io;
  18043. }
  18044. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18045. }
  18046. /**
  18047. * Listen for an event on a channel instance.
  18048. */
  18049. }, {
  18050. key: 'listen',
  18051. value: function listen(name, event, callback) {
  18052. return this.channel(name).listen(event, callback);
  18053. }
  18054. /**
  18055. * Get a channel instance by name.
  18056. */
  18057. }, {
  18058. key: 'channel',
  18059. value: function channel(name) {
  18060. if (!this.channels[name]) {
  18061. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18062. }
  18063. return this.channels[name];
  18064. }
  18065. /**
  18066. * Get a private channel instance by name.
  18067. */
  18068. }, {
  18069. key: 'privateChannel',
  18070. value: function privateChannel(name) {
  18071. if (!this.channels['private-' + name]) {
  18072. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18073. }
  18074. return this.channels['private-' + name];
  18075. }
  18076. /**
  18077. * Get a presence channel instance by name.
  18078. */
  18079. }, {
  18080. key: 'presenceChannel',
  18081. value: function presenceChannel(name) {
  18082. if (!this.channels['presence-' + name]) {
  18083. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18084. }
  18085. return this.channels['presence-' + name];
  18086. }
  18087. /**
  18088. * Leave the given channel, as well as its private and presence variants.
  18089. */
  18090. }, {
  18091. key: 'leave',
  18092. value: function leave(name) {
  18093. var _this2 = this;
  18094. var channels = [name, 'private-' + name, 'presence-' + name];
  18095. channels.forEach(function (name) {
  18096. _this2.leaveChannel(name);
  18097. });
  18098. }
  18099. /**
  18100. * Leave the given channel.
  18101. */
  18102. }, {
  18103. key: 'leaveChannel',
  18104. value: function leaveChannel(name) {
  18105. if (this.channels[name]) {
  18106. this.channels[name].unsubscribe();
  18107. delete this.channels[name];
  18108. }
  18109. }
  18110. /**
  18111. * Get the socket ID for the connection.
  18112. */
  18113. }, {
  18114. key: 'socketId',
  18115. value: function socketId() {
  18116. return this.socket.id;
  18117. }
  18118. /**
  18119. * Disconnect Socketio connection.
  18120. */
  18121. }, {
  18122. key: 'disconnect',
  18123. value: function disconnect() {
  18124. this.socket.disconnect();
  18125. }
  18126. }]);
  18127. return SocketIoConnector;
  18128. }(Connector);
  18129. /**
  18130. * This class creates a null connector.
  18131. */
  18132. var NullConnector = function (_Connector) {
  18133. inherits(NullConnector, _Connector);
  18134. function NullConnector() {
  18135. classCallCheck(this, NullConnector);
  18136. /**
  18137. * All of the subscribed channel names.
  18138. */
  18139. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18140. _this.channels = {};
  18141. return _this;
  18142. }
  18143. /**
  18144. * Create a fresh connection.
  18145. */
  18146. createClass(NullConnector, [{
  18147. key: 'connect',
  18148. value: function connect() {}
  18149. //
  18150. /**
  18151. * Listen for an event on a channel instance.
  18152. */
  18153. }, {
  18154. key: 'listen',
  18155. value: function listen(name, event, callback) {
  18156. return new NullChannel();
  18157. }
  18158. /**
  18159. * Get a channel instance by name.
  18160. */
  18161. }, {
  18162. key: 'channel',
  18163. value: function channel(name) {
  18164. return new NullChannel();
  18165. }
  18166. /**
  18167. * Get a private channel instance by name.
  18168. */
  18169. }, {
  18170. key: 'privateChannel',
  18171. value: function privateChannel(name) {
  18172. return new NullPrivateChannel();
  18173. }
  18174. /**
  18175. * Get a presence channel instance by name.
  18176. */
  18177. }, {
  18178. key: 'presenceChannel',
  18179. value: function presenceChannel(name) {
  18180. return new NullPresenceChannel();
  18181. }
  18182. /**
  18183. * Leave the given channel, as well as its private and presence variants.
  18184. */
  18185. }, {
  18186. key: 'leave',
  18187. value: function leave(name) {}
  18188. //
  18189. /**
  18190. * Leave the given channel.
  18191. */
  18192. }, {
  18193. key: 'leaveChannel',
  18194. value: function leaveChannel(name) {}
  18195. //
  18196. /**
  18197. * Get the socket ID for the connection.
  18198. */
  18199. }, {
  18200. key: 'socketId',
  18201. value: function socketId() {
  18202. return 'fake-socket-id';
  18203. }
  18204. /**
  18205. * Disconnect the connection.
  18206. */
  18207. }, {
  18208. key: 'disconnect',
  18209. value: function disconnect() {
  18210. //
  18211. }
  18212. }]);
  18213. return NullConnector;
  18214. }(Connector);
  18215. /**
  18216. * This class is the primary API for interacting with broadcasting.
  18217. */
  18218. var Echo = function () {
  18219. /**
  18220. * Create a new class instance.
  18221. */
  18222. function Echo(options) {
  18223. classCallCheck(this, Echo);
  18224. this.options = options;
  18225. this.connect();
  18226. if (!this.options.withoutInterceptors) {
  18227. this.registerInterceptors();
  18228. }
  18229. }
  18230. /**
  18231. * Get a channel instance by name.
  18232. */
  18233. createClass(Echo, [{
  18234. key: 'channel',
  18235. value: function channel(_channel) {
  18236. return this.connector.channel(_channel);
  18237. }
  18238. /**
  18239. * Create a new connection.
  18240. */
  18241. }, {
  18242. key: 'connect',
  18243. value: function connect() {
  18244. if (this.options.broadcaster == 'pusher') {
  18245. this.connector = new PusherConnector(this.options);
  18246. } else if (this.options.broadcaster == 'socket.io') {
  18247. this.connector = new SocketIoConnector(this.options);
  18248. } else if (this.options.broadcaster == 'null') {
  18249. this.connector = new NullConnector(this.options);
  18250. } else if (typeof this.options.broadcaster == 'function') {
  18251. this.connector = new this.options.broadcaster(this.options);
  18252. }
  18253. }
  18254. /**
  18255. * Disconnect from the Echo server.
  18256. */
  18257. }, {
  18258. key: 'disconnect',
  18259. value: function disconnect() {
  18260. this.connector.disconnect();
  18261. }
  18262. /**
  18263. * Get a presence channel instance by name.
  18264. */
  18265. }, {
  18266. key: 'join',
  18267. value: function join(channel) {
  18268. return this.connector.presenceChannel(channel);
  18269. }
  18270. /**
  18271. * Leave the given channel, as well as its private and presence variants.
  18272. */
  18273. }, {
  18274. key: 'leave',
  18275. value: function leave(channel) {
  18276. this.connector.leave(channel);
  18277. }
  18278. /**
  18279. * Leave the given channel.
  18280. */
  18281. }, {
  18282. key: 'leaveChannel',
  18283. value: function leaveChannel(channel) {
  18284. this.connector.leaveChannel(channel);
  18285. }
  18286. /**
  18287. * Listen for an event on a channel instance.
  18288. */
  18289. }, {
  18290. key: 'listen',
  18291. value: function listen(channel, event, callback) {
  18292. return this.connector.listen(channel, event, callback);
  18293. }
  18294. /**
  18295. * Get a private channel instance by name.
  18296. */
  18297. }, {
  18298. key: 'private',
  18299. value: function _private(channel) {
  18300. return this.connector.privateChannel(channel);
  18301. }
  18302. /**
  18303. * Get the Socket ID for the connection.
  18304. */
  18305. }, {
  18306. key: 'socketId',
  18307. value: function socketId() {
  18308. return this.connector.socketId();
  18309. }
  18310. /**
  18311. * Register 3rd party request interceptiors. These are used to automatically
  18312. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18313. */
  18314. }, {
  18315. key: 'registerInterceptors',
  18316. value: function registerInterceptors() {
  18317. if (typeof Vue === 'function' && Vue.http) {
  18318. this.registerVueRequestInterceptor();
  18319. }
  18320. if (typeof axios === 'function') {
  18321. this.registerAxiosRequestInterceptor();
  18322. }
  18323. if (typeof jQuery === 'function') {
  18324. this.registerjQueryAjaxSetup();
  18325. }
  18326. }
  18327. /**
  18328. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18329. */
  18330. }, {
  18331. key: 'registerVueRequestInterceptor',
  18332. value: function registerVueRequestInterceptor() {
  18333. var _this = this;
  18334. Vue.http.interceptors.push(function (request, next) {
  18335. if (_this.socketId()) {
  18336. request.headers.set('X-Socket-ID', _this.socketId());
  18337. }
  18338. next();
  18339. });
  18340. }
  18341. /**
  18342. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18343. */
  18344. }, {
  18345. key: 'registerAxiosRequestInterceptor',
  18346. value: function registerAxiosRequestInterceptor() {
  18347. var _this2 = this;
  18348. axios.interceptors.request.use(function (config) {
  18349. if (_this2.socketId()) {
  18350. config.headers['X-Socket-Id'] = _this2.socketId();
  18351. }
  18352. return config;
  18353. });
  18354. }
  18355. /**
  18356. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18357. */
  18358. }, {
  18359. key: 'registerjQueryAjaxSetup',
  18360. value: function registerjQueryAjaxSetup() {
  18361. var _this3 = this;
  18362. if (typeof jQuery.ajax != 'undefined') {
  18363. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18364. if (_this3.socketId()) {
  18365. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18366. }
  18367. });
  18368. }
  18369. }
  18370. }]);
  18371. return Echo;
  18372. }();
  18373. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18374. /***/ }),
  18375. /***/ "./node_modules/lodash/lodash.js":
  18376. /*!***************************************!*\
  18377. !*** ./node_modules/lodash/lodash.js ***!
  18378. \***************************************/
  18379. /*! no static exports found */
  18380. /***/ (function(module, exports, __webpack_require__) {
  18381. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18382. * @license
  18383. * Lodash <https://lodash.com/>
  18384. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18385. * Released under MIT license <https://lodash.com/license>
  18386. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18387. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18388. */
  18389. ;(function() {
  18390. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18391. var undefined;
  18392. /** Used as the semantic version number. */
  18393. var VERSION = '4.17.15';
  18394. /** Used as the size to enable large array optimizations. */
  18395. var LARGE_ARRAY_SIZE = 200;
  18396. /** Error message constants. */
  18397. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18398. FUNC_ERROR_TEXT = 'Expected a function';
  18399. /** Used to stand-in for `undefined` hash values. */
  18400. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18401. /** Used as the maximum memoize cache size. */
  18402. var MAX_MEMOIZE_SIZE = 500;
  18403. /** Used as the internal argument placeholder. */
  18404. var PLACEHOLDER = '__lodash_placeholder__';
  18405. /** Used to compose bitmasks for cloning. */
  18406. var CLONE_DEEP_FLAG = 1,
  18407. CLONE_FLAT_FLAG = 2,
  18408. CLONE_SYMBOLS_FLAG = 4;
  18409. /** Used to compose bitmasks for value comparisons. */
  18410. var COMPARE_PARTIAL_FLAG = 1,
  18411. COMPARE_UNORDERED_FLAG = 2;
  18412. /** Used to compose bitmasks for function metadata. */
  18413. var WRAP_BIND_FLAG = 1,
  18414. WRAP_BIND_KEY_FLAG = 2,
  18415. WRAP_CURRY_BOUND_FLAG = 4,
  18416. WRAP_CURRY_FLAG = 8,
  18417. WRAP_CURRY_RIGHT_FLAG = 16,
  18418. WRAP_PARTIAL_FLAG = 32,
  18419. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18420. WRAP_ARY_FLAG = 128,
  18421. WRAP_REARG_FLAG = 256,
  18422. WRAP_FLIP_FLAG = 512;
  18423. /** Used as default options for `_.truncate`. */
  18424. var DEFAULT_TRUNC_LENGTH = 30,
  18425. DEFAULT_TRUNC_OMISSION = '...';
  18426. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18427. var HOT_COUNT = 800,
  18428. HOT_SPAN = 16;
  18429. /** Used to indicate the type of lazy iteratees. */
  18430. var LAZY_FILTER_FLAG = 1,
  18431. LAZY_MAP_FLAG = 2,
  18432. LAZY_WHILE_FLAG = 3;
  18433. /** Used as references for various `Number` constants. */
  18434. var INFINITY = 1 / 0,
  18435. MAX_SAFE_INTEGER = 9007199254740991,
  18436. MAX_INTEGER = 1.7976931348623157e+308,
  18437. NAN = 0 / 0;
  18438. /** Used as references for the maximum length and index of an array. */
  18439. var MAX_ARRAY_LENGTH = 4294967295,
  18440. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18441. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18442. /** Used to associate wrap methods with their bit flags. */
  18443. var wrapFlags = [
  18444. ['ary', WRAP_ARY_FLAG],
  18445. ['bind', WRAP_BIND_FLAG],
  18446. ['bindKey', WRAP_BIND_KEY_FLAG],
  18447. ['curry', WRAP_CURRY_FLAG],
  18448. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18449. ['flip', WRAP_FLIP_FLAG],
  18450. ['partial', WRAP_PARTIAL_FLAG],
  18451. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18452. ['rearg', WRAP_REARG_FLAG]
  18453. ];
  18454. /** `Object#toString` result references. */
  18455. var argsTag = '[object Arguments]',
  18456. arrayTag = '[object Array]',
  18457. asyncTag = '[object AsyncFunction]',
  18458. boolTag = '[object Boolean]',
  18459. dateTag = '[object Date]',
  18460. domExcTag = '[object DOMException]',
  18461. errorTag = '[object Error]',
  18462. funcTag = '[object Function]',
  18463. genTag = '[object GeneratorFunction]',
  18464. mapTag = '[object Map]',
  18465. numberTag = '[object Number]',
  18466. nullTag = '[object Null]',
  18467. objectTag = '[object Object]',
  18468. promiseTag = '[object Promise]',
  18469. proxyTag = '[object Proxy]',
  18470. regexpTag = '[object RegExp]',
  18471. setTag = '[object Set]',
  18472. stringTag = '[object String]',
  18473. symbolTag = '[object Symbol]',
  18474. undefinedTag = '[object Undefined]',
  18475. weakMapTag = '[object WeakMap]',
  18476. weakSetTag = '[object WeakSet]';
  18477. var arrayBufferTag = '[object ArrayBuffer]',
  18478. dataViewTag = '[object DataView]',
  18479. float32Tag = '[object Float32Array]',
  18480. float64Tag = '[object Float64Array]',
  18481. int8Tag = '[object Int8Array]',
  18482. int16Tag = '[object Int16Array]',
  18483. int32Tag = '[object Int32Array]',
  18484. uint8Tag = '[object Uint8Array]',
  18485. uint8ClampedTag = '[object Uint8ClampedArray]',
  18486. uint16Tag = '[object Uint16Array]',
  18487. uint32Tag = '[object Uint32Array]';
  18488. /** Used to match empty string literals in compiled template source. */
  18489. var reEmptyStringLeading = /\b__p \+= '';/g,
  18490. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18491. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18492. /** Used to match HTML entities and HTML characters. */
  18493. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18494. reUnescapedHtml = /[&<>"']/g,
  18495. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18496. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18497. /** Used to match template delimiters. */
  18498. var reEscape = /<%-([\s\S]+?)%>/g,
  18499. reEvaluate = /<%([\s\S]+?)%>/g,
  18500. reInterpolate = /<%=([\s\S]+?)%>/g;
  18501. /** Used to match property names within property paths. */
  18502. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18503. reIsPlainProp = /^\w*$/,
  18504. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18505. /**
  18506. * Used to match `RegExp`
  18507. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18508. */
  18509. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18510. reHasRegExpChar = RegExp(reRegExpChar.source);
  18511. /** Used to match leading and trailing whitespace. */
  18512. var reTrim = /^\s+|\s+$/g,
  18513. reTrimStart = /^\s+/,
  18514. reTrimEnd = /\s+$/;
  18515. /** Used to match wrap detail comments. */
  18516. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18517. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18518. reSplitDetails = /,? & /;
  18519. /** Used to match words composed of alphanumeric characters. */
  18520. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18521. /** Used to match backslashes in property paths. */
  18522. var reEscapeChar = /\\(\\)?/g;
  18523. /**
  18524. * Used to match
  18525. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18526. */
  18527. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18528. /** Used to match `RegExp` flags from their coerced string values. */
  18529. var reFlags = /\w*$/;
  18530. /** Used to detect bad signed hexadecimal string values. */
  18531. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18532. /** Used to detect binary string values. */
  18533. var reIsBinary = /^0b[01]+$/i;
  18534. /** Used to detect host constructors (Safari). */
  18535. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18536. /** Used to detect octal string values. */
  18537. var reIsOctal = /^0o[0-7]+$/i;
  18538. /** Used to detect unsigned integer values. */
  18539. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18540. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18541. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18542. /** Used to ensure capturing order of template delimiters. */
  18543. var reNoMatch = /($^)/;
  18544. /** Used to match unescaped characters in compiled string literals. */
  18545. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18546. /** Used to compose unicode character classes. */
  18547. var rsAstralRange = '\\ud800-\\udfff',
  18548. rsComboMarksRange = '\\u0300-\\u036f',
  18549. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18550. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18551. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18552. rsDingbatRange = '\\u2700-\\u27bf',
  18553. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18554. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18555. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18556. rsPunctuationRange = '\\u2000-\\u206f',
  18557. 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',
  18558. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18559. rsVarRange = '\\ufe0e\\ufe0f',
  18560. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18561. /** Used to compose unicode capture groups. */
  18562. var rsApos = "['\u2019]",
  18563. rsAstral = '[' + rsAstralRange + ']',
  18564. rsBreak = '[' + rsBreakRange + ']',
  18565. rsCombo = '[' + rsComboRange + ']',
  18566. rsDigits = '\\d+',
  18567. rsDingbat = '[' + rsDingbatRange + ']',
  18568. rsLower = '[' + rsLowerRange + ']',
  18569. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18570. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18571. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18572. rsNonAstral = '[^' + rsAstralRange + ']',
  18573. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18574. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18575. rsUpper = '[' + rsUpperRange + ']',
  18576. rsZWJ = '\\u200d';
  18577. /** Used to compose unicode regexes. */
  18578. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18579. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18580. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18581. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18582. reOptMod = rsModifier + '?',
  18583. rsOptVar = '[' + rsVarRange + ']?',
  18584. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18585. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18586. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18587. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18588. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18589. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18590. /** Used to match apostrophes. */
  18591. var reApos = RegExp(rsApos, 'g');
  18592. /**
  18593. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18594. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18595. */
  18596. var reComboMark = RegExp(rsCombo, 'g');
  18597. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18598. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18599. /** Used to match complex or compound words. */
  18600. var reUnicodeWord = RegExp([
  18601. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18602. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18603. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18604. rsUpper + '+' + rsOptContrUpper,
  18605. rsOrdUpper,
  18606. rsOrdLower,
  18607. rsDigits,
  18608. rsEmoji
  18609. ].join('|'), 'g');
  18610. /** 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/). */
  18611. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18612. /** Used to detect strings that need a more robust regexp to match words. */
  18613. 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 ]/;
  18614. /** Used to assign default `context` object properties. */
  18615. var contextProps = [
  18616. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18617. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18618. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18619. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18620. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18621. ];
  18622. /** Used to make template sourceURLs easier to identify. */
  18623. var templateCounter = -1;
  18624. /** Used to identify `toStringTag` values of typed arrays. */
  18625. var typedArrayTags = {};
  18626. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18627. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18628. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18629. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18630. typedArrayTags[uint32Tag] = true;
  18631. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18632. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18633. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18634. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18635. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18636. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18637. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18638. typedArrayTags[weakMapTag] = false;
  18639. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18640. var cloneableTags = {};
  18641. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18642. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18643. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18644. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18645. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18646. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18647. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18648. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18649. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18650. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18651. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18652. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18653. cloneableTags[weakMapTag] = false;
  18654. /** Used to map Latin Unicode letters to basic Latin letters. */
  18655. var deburredLetters = {
  18656. // Latin-1 Supplement block.
  18657. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18658. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18659. '\xc7': 'C', '\xe7': 'c',
  18660. '\xd0': 'D', '\xf0': 'd',
  18661. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18662. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18663. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18664. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18665. '\xd1': 'N', '\xf1': 'n',
  18666. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18667. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18668. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18669. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18670. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18671. '\xc6': 'Ae', '\xe6': 'ae',
  18672. '\xde': 'Th', '\xfe': 'th',
  18673. '\xdf': 'ss',
  18674. // Latin Extended-A block.
  18675. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18676. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18677. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18678. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18679. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18680. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18681. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18682. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18683. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18684. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18685. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18686. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18687. '\u0134': 'J', '\u0135': 'j',
  18688. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18689. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18690. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18691. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18692. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18693. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18694. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18695. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18696. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18697. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18698. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18699. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18700. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18701. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18702. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18703. '\u0174': 'W', '\u0175': 'w',
  18704. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18705. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18706. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18707. '\u0132': 'IJ', '\u0133': 'ij',
  18708. '\u0152': 'Oe', '\u0153': 'oe',
  18709. '\u0149': "'n", '\u017f': 's'
  18710. };
  18711. /** Used to map characters to HTML entities. */
  18712. var htmlEscapes = {
  18713. '&': '&amp;',
  18714. '<': '&lt;',
  18715. '>': '&gt;',
  18716. '"': '&quot;',
  18717. "'": '&#39;'
  18718. };
  18719. /** Used to map HTML entities to characters. */
  18720. var htmlUnescapes = {
  18721. '&amp;': '&',
  18722. '&lt;': '<',
  18723. '&gt;': '>',
  18724. '&quot;': '"',
  18725. '&#39;': "'"
  18726. };
  18727. /** Used to escape characters for inclusion in compiled string literals. */
  18728. var stringEscapes = {
  18729. '\\': '\\',
  18730. "'": "'",
  18731. '\n': 'n',
  18732. '\r': 'r',
  18733. '\u2028': 'u2028',
  18734. '\u2029': 'u2029'
  18735. };
  18736. /** Built-in method references without a dependency on `root`. */
  18737. var freeParseFloat = parseFloat,
  18738. freeParseInt = parseInt;
  18739. /** Detect free variable `global` from Node.js. */
  18740. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18741. /** Detect free variable `self`. */
  18742. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18743. /** Used as a reference to the global object. */
  18744. var root = freeGlobal || freeSelf || Function('return this')();
  18745. /** Detect free variable `exports`. */
  18746. var freeExports = true && exports && !exports.nodeType && exports;
  18747. /** Detect free variable `module`. */
  18748. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18749. /** Detect the popular CommonJS extension `module.exports`. */
  18750. var moduleExports = freeModule && freeModule.exports === freeExports;
  18751. /** Detect free variable `process` from Node.js. */
  18752. var freeProcess = moduleExports && freeGlobal.process;
  18753. /** Used to access faster Node.js helpers. */
  18754. var nodeUtil = (function() {
  18755. try {
  18756. // Use `util.types` for Node.js 10+.
  18757. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18758. if (types) {
  18759. return types;
  18760. }
  18761. // Legacy `process.binding('util')` for Node.js < 10.
  18762. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18763. } catch (e) {}
  18764. }());
  18765. /* Node.js helper references. */
  18766. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18767. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18768. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18769. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18770. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18771. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18772. /*--------------------------------------------------------------------------*/
  18773. /**
  18774. * A faster alternative to `Function#apply`, this function invokes `func`
  18775. * with the `this` binding of `thisArg` and the arguments of `args`.
  18776. *
  18777. * @private
  18778. * @param {Function} func The function to invoke.
  18779. * @param {*} thisArg The `this` binding of `func`.
  18780. * @param {Array} args The arguments to invoke `func` with.
  18781. * @returns {*} Returns the result of `func`.
  18782. */
  18783. function apply(func, thisArg, args) {
  18784. switch (args.length) {
  18785. case 0: return func.call(thisArg);
  18786. case 1: return func.call(thisArg, args[0]);
  18787. case 2: return func.call(thisArg, args[0], args[1]);
  18788. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18789. }
  18790. return func.apply(thisArg, args);
  18791. }
  18792. /**
  18793. * A specialized version of `baseAggregator` for arrays.
  18794. *
  18795. * @private
  18796. * @param {Array} [array] The array to iterate over.
  18797. * @param {Function} setter The function to set `accumulator` values.
  18798. * @param {Function} iteratee The iteratee to transform keys.
  18799. * @param {Object} accumulator The initial aggregated object.
  18800. * @returns {Function} Returns `accumulator`.
  18801. */
  18802. function arrayAggregator(array, setter, iteratee, accumulator) {
  18803. var index = -1,
  18804. length = array == null ? 0 : array.length;
  18805. while (++index < length) {
  18806. var value = array[index];
  18807. setter(accumulator, value, iteratee(value), array);
  18808. }
  18809. return accumulator;
  18810. }
  18811. /**
  18812. * A specialized version of `_.forEach` for arrays without support for
  18813. * iteratee shorthands.
  18814. *
  18815. * @private
  18816. * @param {Array} [array] The array to iterate over.
  18817. * @param {Function} iteratee The function invoked per iteration.
  18818. * @returns {Array} Returns `array`.
  18819. */
  18820. function arrayEach(array, iteratee) {
  18821. var index = -1,
  18822. length = array == null ? 0 : array.length;
  18823. while (++index < length) {
  18824. if (iteratee(array[index], index, array) === false) {
  18825. break;
  18826. }
  18827. }
  18828. return array;
  18829. }
  18830. /**
  18831. * A specialized version of `_.forEachRight` for arrays without support for
  18832. * iteratee shorthands.
  18833. *
  18834. * @private
  18835. * @param {Array} [array] The array to iterate over.
  18836. * @param {Function} iteratee The function invoked per iteration.
  18837. * @returns {Array} Returns `array`.
  18838. */
  18839. function arrayEachRight(array, iteratee) {
  18840. var length = array == null ? 0 : array.length;
  18841. while (length--) {
  18842. if (iteratee(array[length], length, array) === false) {
  18843. break;
  18844. }
  18845. }
  18846. return array;
  18847. }
  18848. /**
  18849. * A specialized version of `_.every` for arrays without support for
  18850. * iteratee shorthands.
  18851. *
  18852. * @private
  18853. * @param {Array} [array] The array to iterate over.
  18854. * @param {Function} predicate The function invoked per iteration.
  18855. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18856. * else `false`.
  18857. */
  18858. function arrayEvery(array, predicate) {
  18859. var index = -1,
  18860. length = array == null ? 0 : array.length;
  18861. while (++index < length) {
  18862. if (!predicate(array[index], index, array)) {
  18863. return false;
  18864. }
  18865. }
  18866. return true;
  18867. }
  18868. /**
  18869. * A specialized version of `_.filter` for arrays without support for
  18870. * iteratee shorthands.
  18871. *
  18872. * @private
  18873. * @param {Array} [array] The array to iterate over.
  18874. * @param {Function} predicate The function invoked per iteration.
  18875. * @returns {Array} Returns the new filtered array.
  18876. */
  18877. function arrayFilter(array, predicate) {
  18878. var index = -1,
  18879. length = array == null ? 0 : array.length,
  18880. resIndex = 0,
  18881. result = [];
  18882. while (++index < length) {
  18883. var value = array[index];
  18884. if (predicate(value, index, array)) {
  18885. result[resIndex++] = value;
  18886. }
  18887. }
  18888. return result;
  18889. }
  18890. /**
  18891. * A specialized version of `_.includes` for arrays without support for
  18892. * specifying an index to search from.
  18893. *
  18894. * @private
  18895. * @param {Array} [array] The array to inspect.
  18896. * @param {*} target The value to search for.
  18897. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18898. */
  18899. function arrayIncludes(array, value) {
  18900. var length = array == null ? 0 : array.length;
  18901. return !!length && baseIndexOf(array, value, 0) > -1;
  18902. }
  18903. /**
  18904. * This function is like `arrayIncludes` except that it accepts a comparator.
  18905. *
  18906. * @private
  18907. * @param {Array} [array] The array to inspect.
  18908. * @param {*} target The value to search for.
  18909. * @param {Function} comparator The comparator invoked per element.
  18910. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18911. */
  18912. function arrayIncludesWith(array, value, comparator) {
  18913. var index = -1,
  18914. length = array == null ? 0 : array.length;
  18915. while (++index < length) {
  18916. if (comparator(value, array[index])) {
  18917. return true;
  18918. }
  18919. }
  18920. return false;
  18921. }
  18922. /**
  18923. * A specialized version of `_.map` for arrays without support for iteratee
  18924. * shorthands.
  18925. *
  18926. * @private
  18927. * @param {Array} [array] The array to iterate over.
  18928. * @param {Function} iteratee The function invoked per iteration.
  18929. * @returns {Array} Returns the new mapped array.
  18930. */
  18931. function arrayMap(array, iteratee) {
  18932. var index = -1,
  18933. length = array == null ? 0 : array.length,
  18934. result = Array(length);
  18935. while (++index < length) {
  18936. result[index] = iteratee(array[index], index, array);
  18937. }
  18938. return result;
  18939. }
  18940. /**
  18941. * Appends the elements of `values` to `array`.
  18942. *
  18943. * @private
  18944. * @param {Array} array The array to modify.
  18945. * @param {Array} values The values to append.
  18946. * @returns {Array} Returns `array`.
  18947. */
  18948. function arrayPush(array, values) {
  18949. var index = -1,
  18950. length = values.length,
  18951. offset = array.length;
  18952. while (++index < length) {
  18953. array[offset + index] = values[index];
  18954. }
  18955. return array;
  18956. }
  18957. /**
  18958. * A specialized version of `_.reduce` for arrays without support for
  18959. * iteratee shorthands.
  18960. *
  18961. * @private
  18962. * @param {Array} [array] The array to iterate over.
  18963. * @param {Function} iteratee The function invoked per iteration.
  18964. * @param {*} [accumulator] The initial value.
  18965. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18966. * the initial value.
  18967. * @returns {*} Returns the accumulated value.
  18968. */
  18969. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18970. var index = -1,
  18971. length = array == null ? 0 : array.length;
  18972. if (initAccum && length) {
  18973. accumulator = array[++index];
  18974. }
  18975. while (++index < length) {
  18976. accumulator = iteratee(accumulator, array[index], index, array);
  18977. }
  18978. return accumulator;
  18979. }
  18980. /**
  18981. * A specialized version of `_.reduceRight` for arrays without support for
  18982. * iteratee shorthands.
  18983. *
  18984. * @private
  18985. * @param {Array} [array] The array to iterate over.
  18986. * @param {Function} iteratee The function invoked per iteration.
  18987. * @param {*} [accumulator] The initial value.
  18988. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18989. * the initial value.
  18990. * @returns {*} Returns the accumulated value.
  18991. */
  18992. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18993. var length = array == null ? 0 : array.length;
  18994. if (initAccum && length) {
  18995. accumulator = array[--length];
  18996. }
  18997. while (length--) {
  18998. accumulator = iteratee(accumulator, array[length], length, array);
  18999. }
  19000. return accumulator;
  19001. }
  19002. /**
  19003. * A specialized version of `_.some` for arrays without support for iteratee
  19004. * shorthands.
  19005. *
  19006. * @private
  19007. * @param {Array} [array] The array to iterate over.
  19008. * @param {Function} predicate The function invoked per iteration.
  19009. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19010. * else `false`.
  19011. */
  19012. function arraySome(array, predicate) {
  19013. var index = -1,
  19014. length = array == null ? 0 : array.length;
  19015. while (++index < length) {
  19016. if (predicate(array[index], index, array)) {
  19017. return true;
  19018. }
  19019. }
  19020. return false;
  19021. }
  19022. /**
  19023. * Gets the size of an ASCII `string`.
  19024. *
  19025. * @private
  19026. * @param {string} string The string inspect.
  19027. * @returns {number} Returns the string size.
  19028. */
  19029. var asciiSize = baseProperty('length');
  19030. /**
  19031. * Converts an ASCII `string` to an array.
  19032. *
  19033. * @private
  19034. * @param {string} string The string to convert.
  19035. * @returns {Array} Returns the converted array.
  19036. */
  19037. function asciiToArray(string) {
  19038. return string.split('');
  19039. }
  19040. /**
  19041. * Splits an ASCII `string` into an array of its words.
  19042. *
  19043. * @private
  19044. * @param {string} The string to inspect.
  19045. * @returns {Array} Returns the words of `string`.
  19046. */
  19047. function asciiWords(string) {
  19048. return string.match(reAsciiWord) || [];
  19049. }
  19050. /**
  19051. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19052. * without support for iteratee shorthands, which iterates over `collection`
  19053. * using `eachFunc`.
  19054. *
  19055. * @private
  19056. * @param {Array|Object} collection The collection to inspect.
  19057. * @param {Function} predicate The function invoked per iteration.
  19058. * @param {Function} eachFunc The function to iterate over `collection`.
  19059. * @returns {*} Returns the found element or its key, else `undefined`.
  19060. */
  19061. function baseFindKey(collection, predicate, eachFunc) {
  19062. var result;
  19063. eachFunc(collection, function(value, key, collection) {
  19064. if (predicate(value, key, collection)) {
  19065. result = key;
  19066. return false;
  19067. }
  19068. });
  19069. return result;
  19070. }
  19071. /**
  19072. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19073. * support for iteratee shorthands.
  19074. *
  19075. * @private
  19076. * @param {Array} array The array to inspect.
  19077. * @param {Function} predicate The function invoked per iteration.
  19078. * @param {number} fromIndex The index to search from.
  19079. * @param {boolean} [fromRight] Specify iterating from right to left.
  19080. * @returns {number} Returns the index of the matched value, else `-1`.
  19081. */
  19082. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19083. var length = array.length,
  19084. index = fromIndex + (fromRight ? 1 : -1);
  19085. while ((fromRight ? index-- : ++index < length)) {
  19086. if (predicate(array[index], index, array)) {
  19087. return index;
  19088. }
  19089. }
  19090. return -1;
  19091. }
  19092. /**
  19093. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19094. *
  19095. * @private
  19096. * @param {Array} array The array to inspect.
  19097. * @param {*} value The value to search for.
  19098. * @param {number} fromIndex The index to search from.
  19099. * @returns {number} Returns the index of the matched value, else `-1`.
  19100. */
  19101. function baseIndexOf(array, value, fromIndex) {
  19102. return value === value
  19103. ? strictIndexOf(array, value, fromIndex)
  19104. : baseFindIndex(array, baseIsNaN, fromIndex);
  19105. }
  19106. /**
  19107. * This function is like `baseIndexOf` except that it accepts a comparator.
  19108. *
  19109. * @private
  19110. * @param {Array} array The array to inspect.
  19111. * @param {*} value The value to search for.
  19112. * @param {number} fromIndex The index to search from.
  19113. * @param {Function} comparator The comparator invoked per element.
  19114. * @returns {number} Returns the index of the matched value, else `-1`.
  19115. */
  19116. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19117. var index = fromIndex - 1,
  19118. length = array.length;
  19119. while (++index < length) {
  19120. if (comparator(array[index], value)) {
  19121. return index;
  19122. }
  19123. }
  19124. return -1;
  19125. }
  19126. /**
  19127. * The base implementation of `_.isNaN` without support for number objects.
  19128. *
  19129. * @private
  19130. * @param {*} value The value to check.
  19131. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19132. */
  19133. function baseIsNaN(value) {
  19134. return value !== value;
  19135. }
  19136. /**
  19137. * The base implementation of `_.mean` and `_.meanBy` without support for
  19138. * iteratee shorthands.
  19139. *
  19140. * @private
  19141. * @param {Array} array The array to iterate over.
  19142. * @param {Function} iteratee The function invoked per iteration.
  19143. * @returns {number} Returns the mean.
  19144. */
  19145. function baseMean(array, iteratee) {
  19146. var length = array == null ? 0 : array.length;
  19147. return length ? (baseSum(array, iteratee) / length) : NAN;
  19148. }
  19149. /**
  19150. * The base implementation of `_.property` without support for deep paths.
  19151. *
  19152. * @private
  19153. * @param {string} key The key of the property to get.
  19154. * @returns {Function} Returns the new accessor function.
  19155. */
  19156. function baseProperty(key) {
  19157. return function(object) {
  19158. return object == null ? undefined : object[key];
  19159. };
  19160. }
  19161. /**
  19162. * The base implementation of `_.propertyOf` without support for deep paths.
  19163. *
  19164. * @private
  19165. * @param {Object} object The object to query.
  19166. * @returns {Function} Returns the new accessor function.
  19167. */
  19168. function basePropertyOf(object) {
  19169. return function(key) {
  19170. return object == null ? undefined : object[key];
  19171. };
  19172. }
  19173. /**
  19174. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19175. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19176. *
  19177. * @private
  19178. * @param {Array|Object} collection The collection to iterate over.
  19179. * @param {Function} iteratee The function invoked per iteration.
  19180. * @param {*} accumulator The initial value.
  19181. * @param {boolean} initAccum Specify using the first or last element of
  19182. * `collection` as the initial value.
  19183. * @param {Function} eachFunc The function to iterate over `collection`.
  19184. * @returns {*} Returns the accumulated value.
  19185. */
  19186. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19187. eachFunc(collection, function(value, index, collection) {
  19188. accumulator = initAccum
  19189. ? (initAccum = false, value)
  19190. : iteratee(accumulator, value, index, collection);
  19191. });
  19192. return accumulator;
  19193. }
  19194. /**
  19195. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19196. * sort order of `array` and replaces criteria objects with their corresponding
  19197. * values.
  19198. *
  19199. * @private
  19200. * @param {Array} array The array to sort.
  19201. * @param {Function} comparer The function to define sort order.
  19202. * @returns {Array} Returns `array`.
  19203. */
  19204. function baseSortBy(array, comparer) {
  19205. var length = array.length;
  19206. array.sort(comparer);
  19207. while (length--) {
  19208. array[length] = array[length].value;
  19209. }
  19210. return array;
  19211. }
  19212. /**
  19213. * The base implementation of `_.sum` and `_.sumBy` without support for
  19214. * iteratee shorthands.
  19215. *
  19216. * @private
  19217. * @param {Array} array The array to iterate over.
  19218. * @param {Function} iteratee The function invoked per iteration.
  19219. * @returns {number} Returns the sum.
  19220. */
  19221. function baseSum(array, iteratee) {
  19222. var result,
  19223. index = -1,
  19224. length = array.length;
  19225. while (++index < length) {
  19226. var current = iteratee(array[index]);
  19227. if (current !== undefined) {
  19228. result = result === undefined ? current : (result + current);
  19229. }
  19230. }
  19231. return result;
  19232. }
  19233. /**
  19234. * The base implementation of `_.times` without support for iteratee shorthands
  19235. * or max array length checks.
  19236. *
  19237. * @private
  19238. * @param {number} n The number of times to invoke `iteratee`.
  19239. * @param {Function} iteratee The function invoked per iteration.
  19240. * @returns {Array} Returns the array of results.
  19241. */
  19242. function baseTimes(n, iteratee) {
  19243. var index = -1,
  19244. result = Array(n);
  19245. while (++index < n) {
  19246. result[index] = iteratee(index);
  19247. }
  19248. return result;
  19249. }
  19250. /**
  19251. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19252. * of key-value pairs for `object` corresponding to the property names of `props`.
  19253. *
  19254. * @private
  19255. * @param {Object} object The object to query.
  19256. * @param {Array} props The property names to get values for.
  19257. * @returns {Object} Returns the key-value pairs.
  19258. */
  19259. function baseToPairs(object, props) {
  19260. return arrayMap(props, function(key) {
  19261. return [key, object[key]];
  19262. });
  19263. }
  19264. /**
  19265. * The base implementation of `_.unary` without support for storing metadata.
  19266. *
  19267. * @private
  19268. * @param {Function} func The function to cap arguments for.
  19269. * @returns {Function} Returns the new capped function.
  19270. */
  19271. function baseUnary(func) {
  19272. return function(value) {
  19273. return func(value);
  19274. };
  19275. }
  19276. /**
  19277. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19278. * array of `object` property values corresponding to the property names
  19279. * of `props`.
  19280. *
  19281. * @private
  19282. * @param {Object} object The object to query.
  19283. * @param {Array} props The property names to get values for.
  19284. * @returns {Object} Returns the array of property values.
  19285. */
  19286. function baseValues(object, props) {
  19287. return arrayMap(props, function(key) {
  19288. return object[key];
  19289. });
  19290. }
  19291. /**
  19292. * Checks if a `cache` value for `key` exists.
  19293. *
  19294. * @private
  19295. * @param {Object} cache The cache to query.
  19296. * @param {string} key The key of the entry to check.
  19297. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19298. */
  19299. function cacheHas(cache, key) {
  19300. return cache.has(key);
  19301. }
  19302. /**
  19303. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19304. * that is not found in the character symbols.
  19305. *
  19306. * @private
  19307. * @param {Array} strSymbols The string symbols to inspect.
  19308. * @param {Array} chrSymbols The character symbols to find.
  19309. * @returns {number} Returns the index of the first unmatched string symbol.
  19310. */
  19311. function charsStartIndex(strSymbols, chrSymbols) {
  19312. var index = -1,
  19313. length = strSymbols.length;
  19314. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19315. return index;
  19316. }
  19317. /**
  19318. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19319. * that is not found in the character symbols.
  19320. *
  19321. * @private
  19322. * @param {Array} strSymbols The string symbols to inspect.
  19323. * @param {Array} chrSymbols The character symbols to find.
  19324. * @returns {number} Returns the index of the last unmatched string symbol.
  19325. */
  19326. function charsEndIndex(strSymbols, chrSymbols) {
  19327. var index = strSymbols.length;
  19328. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19329. return index;
  19330. }
  19331. /**
  19332. * Gets the number of `placeholder` occurrences in `array`.
  19333. *
  19334. * @private
  19335. * @param {Array} array The array to inspect.
  19336. * @param {*} placeholder The placeholder to search for.
  19337. * @returns {number} Returns the placeholder count.
  19338. */
  19339. function countHolders(array, placeholder) {
  19340. var length = array.length,
  19341. result = 0;
  19342. while (length--) {
  19343. if (array[length] === placeholder) {
  19344. ++result;
  19345. }
  19346. }
  19347. return result;
  19348. }
  19349. /**
  19350. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19351. * letters to basic Latin letters.
  19352. *
  19353. * @private
  19354. * @param {string} letter The matched letter to deburr.
  19355. * @returns {string} Returns the deburred letter.
  19356. */
  19357. var deburrLetter = basePropertyOf(deburredLetters);
  19358. /**
  19359. * Used by `_.escape` to convert characters to HTML entities.
  19360. *
  19361. * @private
  19362. * @param {string} chr The matched character to escape.
  19363. * @returns {string} Returns the escaped character.
  19364. */
  19365. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19366. /**
  19367. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19368. *
  19369. * @private
  19370. * @param {string} chr The matched character to escape.
  19371. * @returns {string} Returns the escaped character.
  19372. */
  19373. function escapeStringChar(chr) {
  19374. return '\\' + stringEscapes[chr];
  19375. }
  19376. /**
  19377. * Gets the value at `key` of `object`.
  19378. *
  19379. * @private
  19380. * @param {Object} [object] The object to query.
  19381. * @param {string} key The key of the property to get.
  19382. * @returns {*} Returns the property value.
  19383. */
  19384. function getValue(object, key) {
  19385. return object == null ? undefined : object[key];
  19386. }
  19387. /**
  19388. * Checks if `string` contains Unicode symbols.
  19389. *
  19390. * @private
  19391. * @param {string} string The string to inspect.
  19392. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19393. */
  19394. function hasUnicode(string) {
  19395. return reHasUnicode.test(string);
  19396. }
  19397. /**
  19398. * Checks if `string` contains a word composed of Unicode symbols.
  19399. *
  19400. * @private
  19401. * @param {string} string The string to inspect.
  19402. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19403. */
  19404. function hasUnicodeWord(string) {
  19405. return reHasUnicodeWord.test(string);
  19406. }
  19407. /**
  19408. * Converts `iterator` to an array.
  19409. *
  19410. * @private
  19411. * @param {Object} iterator The iterator to convert.
  19412. * @returns {Array} Returns the converted array.
  19413. */
  19414. function iteratorToArray(iterator) {
  19415. var data,
  19416. result = [];
  19417. while (!(data = iterator.next()).done) {
  19418. result.push(data.value);
  19419. }
  19420. return result;
  19421. }
  19422. /**
  19423. * Converts `map` to its key-value pairs.
  19424. *
  19425. * @private
  19426. * @param {Object} map The map to convert.
  19427. * @returns {Array} Returns the key-value pairs.
  19428. */
  19429. function mapToArray(map) {
  19430. var index = -1,
  19431. result = Array(map.size);
  19432. map.forEach(function(value, key) {
  19433. result[++index] = [key, value];
  19434. });
  19435. return result;
  19436. }
  19437. /**
  19438. * Creates a unary function that invokes `func` with its argument transformed.
  19439. *
  19440. * @private
  19441. * @param {Function} func The function to wrap.
  19442. * @param {Function} transform The argument transform.
  19443. * @returns {Function} Returns the new function.
  19444. */
  19445. function overArg(func, transform) {
  19446. return function(arg) {
  19447. return func(transform(arg));
  19448. };
  19449. }
  19450. /**
  19451. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19452. * and returns an array of their indexes.
  19453. *
  19454. * @private
  19455. * @param {Array} array The array to modify.
  19456. * @param {*} placeholder The placeholder to replace.
  19457. * @returns {Array} Returns the new array of placeholder indexes.
  19458. */
  19459. function replaceHolders(array, placeholder) {
  19460. var index = -1,
  19461. length = array.length,
  19462. resIndex = 0,
  19463. result = [];
  19464. while (++index < length) {
  19465. var value = array[index];
  19466. if (value === placeholder || value === PLACEHOLDER) {
  19467. array[index] = PLACEHOLDER;
  19468. result[resIndex++] = index;
  19469. }
  19470. }
  19471. return result;
  19472. }
  19473. /**
  19474. * Converts `set` to an array of its values.
  19475. *
  19476. * @private
  19477. * @param {Object} set The set to convert.
  19478. * @returns {Array} Returns the values.
  19479. */
  19480. function setToArray(set) {
  19481. var index = -1,
  19482. result = Array(set.size);
  19483. set.forEach(function(value) {
  19484. result[++index] = value;
  19485. });
  19486. return result;
  19487. }
  19488. /**
  19489. * Converts `set` to its value-value pairs.
  19490. *
  19491. * @private
  19492. * @param {Object} set The set to convert.
  19493. * @returns {Array} Returns the value-value pairs.
  19494. */
  19495. function setToPairs(set) {
  19496. var index = -1,
  19497. result = Array(set.size);
  19498. set.forEach(function(value) {
  19499. result[++index] = [value, value];
  19500. });
  19501. return result;
  19502. }
  19503. /**
  19504. * A specialized version of `_.indexOf` which performs strict equality
  19505. * comparisons of values, i.e. `===`.
  19506. *
  19507. * @private
  19508. * @param {Array} array The array to inspect.
  19509. * @param {*} value The value to search for.
  19510. * @param {number} fromIndex The index to search from.
  19511. * @returns {number} Returns the index of the matched value, else `-1`.
  19512. */
  19513. function strictIndexOf(array, value, fromIndex) {
  19514. var index = fromIndex - 1,
  19515. length = array.length;
  19516. while (++index < length) {
  19517. if (array[index] === value) {
  19518. return index;
  19519. }
  19520. }
  19521. return -1;
  19522. }
  19523. /**
  19524. * A specialized version of `_.lastIndexOf` which performs strict equality
  19525. * comparisons of values, i.e. `===`.
  19526. *
  19527. * @private
  19528. * @param {Array} array The array to inspect.
  19529. * @param {*} value The value to search for.
  19530. * @param {number} fromIndex The index to search from.
  19531. * @returns {number} Returns the index of the matched value, else `-1`.
  19532. */
  19533. function strictLastIndexOf(array, value, fromIndex) {
  19534. var index = fromIndex + 1;
  19535. while (index--) {
  19536. if (array[index] === value) {
  19537. return index;
  19538. }
  19539. }
  19540. return index;
  19541. }
  19542. /**
  19543. * Gets the number of symbols in `string`.
  19544. *
  19545. * @private
  19546. * @param {string} string The string to inspect.
  19547. * @returns {number} Returns the string size.
  19548. */
  19549. function stringSize(string) {
  19550. return hasUnicode(string)
  19551. ? unicodeSize(string)
  19552. : asciiSize(string);
  19553. }
  19554. /**
  19555. * Converts `string` to an array.
  19556. *
  19557. * @private
  19558. * @param {string} string The string to convert.
  19559. * @returns {Array} Returns the converted array.
  19560. */
  19561. function stringToArray(string) {
  19562. return hasUnicode(string)
  19563. ? unicodeToArray(string)
  19564. : asciiToArray(string);
  19565. }
  19566. /**
  19567. * Used by `_.unescape` to convert HTML entities to characters.
  19568. *
  19569. * @private
  19570. * @param {string} chr The matched character to unescape.
  19571. * @returns {string} Returns the unescaped character.
  19572. */
  19573. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19574. /**
  19575. * Gets the size of a Unicode `string`.
  19576. *
  19577. * @private
  19578. * @param {string} string The string inspect.
  19579. * @returns {number} Returns the string size.
  19580. */
  19581. function unicodeSize(string) {
  19582. var result = reUnicode.lastIndex = 0;
  19583. while (reUnicode.test(string)) {
  19584. ++result;
  19585. }
  19586. return result;
  19587. }
  19588. /**
  19589. * Converts a Unicode `string` to an array.
  19590. *
  19591. * @private
  19592. * @param {string} string The string to convert.
  19593. * @returns {Array} Returns the converted array.
  19594. */
  19595. function unicodeToArray(string) {
  19596. return string.match(reUnicode) || [];
  19597. }
  19598. /**
  19599. * Splits a Unicode `string` into an array of its words.
  19600. *
  19601. * @private
  19602. * @param {string} The string to inspect.
  19603. * @returns {Array} Returns the words of `string`.
  19604. */
  19605. function unicodeWords(string) {
  19606. return string.match(reUnicodeWord) || [];
  19607. }
  19608. /*--------------------------------------------------------------------------*/
  19609. /**
  19610. * Create a new pristine `lodash` function using the `context` object.
  19611. *
  19612. * @static
  19613. * @memberOf _
  19614. * @since 1.1.0
  19615. * @category Util
  19616. * @param {Object} [context=root] The context object.
  19617. * @returns {Function} Returns a new `lodash` function.
  19618. * @example
  19619. *
  19620. * _.mixin({ 'foo': _.constant('foo') });
  19621. *
  19622. * var lodash = _.runInContext();
  19623. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19624. *
  19625. * _.isFunction(_.foo);
  19626. * // => true
  19627. * _.isFunction(_.bar);
  19628. * // => false
  19629. *
  19630. * lodash.isFunction(lodash.foo);
  19631. * // => false
  19632. * lodash.isFunction(lodash.bar);
  19633. * // => true
  19634. *
  19635. * // Create a suped-up `defer` in Node.js.
  19636. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19637. */
  19638. var runInContext = (function runInContext(context) {
  19639. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19640. /** Built-in constructor references. */
  19641. var Array = context.Array,
  19642. Date = context.Date,
  19643. Error = context.Error,
  19644. Function = context.Function,
  19645. Math = context.Math,
  19646. Object = context.Object,
  19647. RegExp = context.RegExp,
  19648. String = context.String,
  19649. TypeError = context.TypeError;
  19650. /** Used for built-in method references. */
  19651. var arrayProto = Array.prototype,
  19652. funcProto = Function.prototype,
  19653. objectProto = Object.prototype;
  19654. /** Used to detect overreaching core-js shims. */
  19655. var coreJsData = context['__core-js_shared__'];
  19656. /** Used to resolve the decompiled source of functions. */
  19657. var funcToString = funcProto.toString;
  19658. /** Used to check objects for own properties. */
  19659. var hasOwnProperty = objectProto.hasOwnProperty;
  19660. /** Used to generate unique IDs. */
  19661. var idCounter = 0;
  19662. /** Used to detect methods masquerading as native. */
  19663. var maskSrcKey = (function() {
  19664. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19665. return uid ? ('Symbol(src)_1.' + uid) : '';
  19666. }());
  19667. /**
  19668. * Used to resolve the
  19669. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19670. * of values.
  19671. */
  19672. var nativeObjectToString = objectProto.toString;
  19673. /** Used to infer the `Object` constructor. */
  19674. var objectCtorString = funcToString.call(Object);
  19675. /** Used to restore the original `_` reference in `_.noConflict`. */
  19676. var oldDash = root._;
  19677. /** Used to detect if a method is native. */
  19678. var reIsNative = RegExp('^' +
  19679. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19680. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19681. );
  19682. /** Built-in value references. */
  19683. var Buffer = moduleExports ? context.Buffer : undefined,
  19684. Symbol = context.Symbol,
  19685. Uint8Array = context.Uint8Array,
  19686. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19687. getPrototype = overArg(Object.getPrototypeOf, Object),
  19688. objectCreate = Object.create,
  19689. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19690. splice = arrayProto.splice,
  19691. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19692. symIterator = Symbol ? Symbol.iterator : undefined,
  19693. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19694. var defineProperty = (function() {
  19695. try {
  19696. var func = getNative(Object, 'defineProperty');
  19697. func({}, '', {});
  19698. return func;
  19699. } catch (e) {}
  19700. }());
  19701. /** Mocked built-ins. */
  19702. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19703. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19704. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19705. /* Built-in method references for those with the same name as other `lodash` methods. */
  19706. var nativeCeil = Math.ceil,
  19707. nativeFloor = Math.floor,
  19708. nativeGetSymbols = Object.getOwnPropertySymbols,
  19709. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19710. nativeIsFinite = context.isFinite,
  19711. nativeJoin = arrayProto.join,
  19712. nativeKeys = overArg(Object.keys, Object),
  19713. nativeMax = Math.max,
  19714. nativeMin = Math.min,
  19715. nativeNow = Date.now,
  19716. nativeParseInt = context.parseInt,
  19717. nativeRandom = Math.random,
  19718. nativeReverse = arrayProto.reverse;
  19719. /* Built-in method references that are verified to be native. */
  19720. var DataView = getNative(context, 'DataView'),
  19721. Map = getNative(context, 'Map'),
  19722. Promise = getNative(context, 'Promise'),
  19723. Set = getNative(context, 'Set'),
  19724. WeakMap = getNative(context, 'WeakMap'),
  19725. nativeCreate = getNative(Object, 'create');
  19726. /** Used to store function metadata. */
  19727. var metaMap = WeakMap && new WeakMap;
  19728. /** Used to lookup unminified function names. */
  19729. var realNames = {};
  19730. /** Used to detect maps, sets, and weakmaps. */
  19731. var dataViewCtorString = toSource(DataView),
  19732. mapCtorString = toSource(Map),
  19733. promiseCtorString = toSource(Promise),
  19734. setCtorString = toSource(Set),
  19735. weakMapCtorString = toSource(WeakMap);
  19736. /** Used to convert symbols to primitives and strings. */
  19737. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19738. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19739. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19740. /*------------------------------------------------------------------------*/
  19741. /**
  19742. * Creates a `lodash` object which wraps `value` to enable implicit method
  19743. * chain sequences. Methods that operate on and return arrays, collections,
  19744. * and functions can be chained together. Methods that retrieve a single value
  19745. * or may return a primitive value will automatically end the chain sequence
  19746. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19747. * with `_#value`.
  19748. *
  19749. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19750. * enabled using `_.chain`.
  19751. *
  19752. * The execution of chained methods is lazy, that is, it's deferred until
  19753. * `_#value` is implicitly or explicitly called.
  19754. *
  19755. * Lazy evaluation allows several methods to support shortcut fusion.
  19756. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19757. * the creation of intermediate arrays and can greatly reduce the number of
  19758. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19759. * fusion if the section is applied to an array and iteratees accept only
  19760. * one argument. The heuristic for whether a section qualifies for shortcut
  19761. * fusion is subject to change.
  19762. *
  19763. * Chaining is supported in custom builds as long as the `_#value` method is
  19764. * directly or indirectly included in the build.
  19765. *
  19766. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19767. *
  19768. * The wrapper `Array` methods are:
  19769. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19770. *
  19771. * The wrapper `String` methods are:
  19772. * `replace` and `split`
  19773. *
  19774. * The wrapper methods that support shortcut fusion are:
  19775. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19776. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19777. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19778. *
  19779. * The chainable wrapper methods are:
  19780. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19781. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19782. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19783. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19784. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19785. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19786. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19787. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19788. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19789. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19790. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19791. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19792. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19793. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19794. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19795. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19796. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19797. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19798. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19799. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19800. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19801. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19802. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19803. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19804. *
  19805. * The wrapper methods that are **not** chainable by default are:
  19806. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19807. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19808. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19809. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19810. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19811. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19812. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19813. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19814. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19815. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19816. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19817. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19818. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19819. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19820. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19821. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19822. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19823. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19824. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19825. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19826. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19827. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19828. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19829. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19830. * `upperFirst`, `value`, and `words`
  19831. *
  19832. * @name _
  19833. * @constructor
  19834. * @category Seq
  19835. * @param {*} value The value to wrap in a `lodash` instance.
  19836. * @returns {Object} Returns the new `lodash` wrapper instance.
  19837. * @example
  19838. *
  19839. * function square(n) {
  19840. * return n * n;
  19841. * }
  19842. *
  19843. * var wrapped = _([1, 2, 3]);
  19844. *
  19845. * // Returns an unwrapped value.
  19846. * wrapped.reduce(_.add);
  19847. * // => 6
  19848. *
  19849. * // Returns a wrapped value.
  19850. * var squares = wrapped.map(square);
  19851. *
  19852. * _.isArray(squares);
  19853. * // => false
  19854. *
  19855. * _.isArray(squares.value());
  19856. * // => true
  19857. */
  19858. function lodash(value) {
  19859. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19860. if (value instanceof LodashWrapper) {
  19861. return value;
  19862. }
  19863. if (hasOwnProperty.call(value, '__wrapped__')) {
  19864. return wrapperClone(value);
  19865. }
  19866. }
  19867. return new LodashWrapper(value);
  19868. }
  19869. /**
  19870. * The base implementation of `_.create` without support for assigning
  19871. * properties to the created object.
  19872. *
  19873. * @private
  19874. * @param {Object} proto The object to inherit from.
  19875. * @returns {Object} Returns the new object.
  19876. */
  19877. var baseCreate = (function() {
  19878. function object() {}
  19879. return function(proto) {
  19880. if (!isObject(proto)) {
  19881. return {};
  19882. }
  19883. if (objectCreate) {
  19884. return objectCreate(proto);
  19885. }
  19886. object.prototype = proto;
  19887. var result = new object;
  19888. object.prototype = undefined;
  19889. return result;
  19890. };
  19891. }());
  19892. /**
  19893. * The function whose prototype chain sequence wrappers inherit from.
  19894. *
  19895. * @private
  19896. */
  19897. function baseLodash() {
  19898. // No operation performed.
  19899. }
  19900. /**
  19901. * The base constructor for creating `lodash` wrapper objects.
  19902. *
  19903. * @private
  19904. * @param {*} value The value to wrap.
  19905. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19906. */
  19907. function LodashWrapper(value, chainAll) {
  19908. this.__wrapped__ = value;
  19909. this.__actions__ = [];
  19910. this.__chain__ = !!chainAll;
  19911. this.__index__ = 0;
  19912. this.__values__ = undefined;
  19913. }
  19914. /**
  19915. * By default, the template delimiters used by lodash are like those in
  19916. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19917. * following template settings to use alternative delimiters.
  19918. *
  19919. * @static
  19920. * @memberOf _
  19921. * @type {Object}
  19922. */
  19923. lodash.templateSettings = {
  19924. /**
  19925. * Used to detect `data` property values to be HTML-escaped.
  19926. *
  19927. * @memberOf _.templateSettings
  19928. * @type {RegExp}
  19929. */
  19930. 'escape': reEscape,
  19931. /**
  19932. * Used to detect code to be evaluated.
  19933. *
  19934. * @memberOf _.templateSettings
  19935. * @type {RegExp}
  19936. */
  19937. 'evaluate': reEvaluate,
  19938. /**
  19939. * Used to detect `data` property values to inject.
  19940. *
  19941. * @memberOf _.templateSettings
  19942. * @type {RegExp}
  19943. */
  19944. 'interpolate': reInterpolate,
  19945. /**
  19946. * Used to reference the data object in the template text.
  19947. *
  19948. * @memberOf _.templateSettings
  19949. * @type {string}
  19950. */
  19951. 'variable': '',
  19952. /**
  19953. * Used to import variables into the compiled template.
  19954. *
  19955. * @memberOf _.templateSettings
  19956. * @type {Object}
  19957. */
  19958. 'imports': {
  19959. /**
  19960. * A reference to the `lodash` function.
  19961. *
  19962. * @memberOf _.templateSettings.imports
  19963. * @type {Function}
  19964. */
  19965. '_': lodash
  19966. }
  19967. };
  19968. // Ensure wrappers are instances of `baseLodash`.
  19969. lodash.prototype = baseLodash.prototype;
  19970. lodash.prototype.constructor = lodash;
  19971. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19972. LodashWrapper.prototype.constructor = LodashWrapper;
  19973. /*------------------------------------------------------------------------*/
  19974. /**
  19975. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19976. *
  19977. * @private
  19978. * @constructor
  19979. * @param {*} value The value to wrap.
  19980. */
  19981. function LazyWrapper(value) {
  19982. this.__wrapped__ = value;
  19983. this.__actions__ = [];
  19984. this.__dir__ = 1;
  19985. this.__filtered__ = false;
  19986. this.__iteratees__ = [];
  19987. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19988. this.__views__ = [];
  19989. }
  19990. /**
  19991. * Creates a clone of the lazy wrapper object.
  19992. *
  19993. * @private
  19994. * @name clone
  19995. * @memberOf LazyWrapper
  19996. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19997. */
  19998. function lazyClone() {
  19999. var result = new LazyWrapper(this.__wrapped__);
  20000. result.__actions__ = copyArray(this.__actions__);
  20001. result.__dir__ = this.__dir__;
  20002. result.__filtered__ = this.__filtered__;
  20003. result.__iteratees__ = copyArray(this.__iteratees__);
  20004. result.__takeCount__ = this.__takeCount__;
  20005. result.__views__ = copyArray(this.__views__);
  20006. return result;
  20007. }
  20008. /**
  20009. * Reverses the direction of lazy iteration.
  20010. *
  20011. * @private
  20012. * @name reverse
  20013. * @memberOf LazyWrapper
  20014. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20015. */
  20016. function lazyReverse() {
  20017. if (this.__filtered__) {
  20018. var result = new LazyWrapper(this);
  20019. result.__dir__ = -1;
  20020. result.__filtered__ = true;
  20021. } else {
  20022. result = this.clone();
  20023. result.__dir__ *= -1;
  20024. }
  20025. return result;
  20026. }
  20027. /**
  20028. * Extracts the unwrapped value from its lazy wrapper.
  20029. *
  20030. * @private
  20031. * @name value
  20032. * @memberOf LazyWrapper
  20033. * @returns {*} Returns the unwrapped value.
  20034. */
  20035. function lazyValue() {
  20036. var array = this.__wrapped__.value(),
  20037. dir = this.__dir__,
  20038. isArr = isArray(array),
  20039. isRight = dir < 0,
  20040. arrLength = isArr ? array.length : 0,
  20041. view = getView(0, arrLength, this.__views__),
  20042. start = view.start,
  20043. end = view.end,
  20044. length = end - start,
  20045. index = isRight ? end : (start - 1),
  20046. iteratees = this.__iteratees__,
  20047. iterLength = iteratees.length,
  20048. resIndex = 0,
  20049. takeCount = nativeMin(length, this.__takeCount__);
  20050. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20051. return baseWrapperValue(array, this.__actions__);
  20052. }
  20053. var result = [];
  20054. outer:
  20055. while (length-- && resIndex < takeCount) {
  20056. index += dir;
  20057. var iterIndex = -1,
  20058. value = array[index];
  20059. while (++iterIndex < iterLength) {
  20060. var data = iteratees[iterIndex],
  20061. iteratee = data.iteratee,
  20062. type = data.type,
  20063. computed = iteratee(value);
  20064. if (type == LAZY_MAP_FLAG) {
  20065. value = computed;
  20066. } else if (!computed) {
  20067. if (type == LAZY_FILTER_FLAG) {
  20068. continue outer;
  20069. } else {
  20070. break outer;
  20071. }
  20072. }
  20073. }
  20074. result[resIndex++] = value;
  20075. }
  20076. return result;
  20077. }
  20078. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20079. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20080. LazyWrapper.prototype.constructor = LazyWrapper;
  20081. /*------------------------------------------------------------------------*/
  20082. /**
  20083. * Creates a hash object.
  20084. *
  20085. * @private
  20086. * @constructor
  20087. * @param {Array} [entries] The key-value pairs to cache.
  20088. */
  20089. function Hash(entries) {
  20090. var index = -1,
  20091. length = entries == null ? 0 : entries.length;
  20092. this.clear();
  20093. while (++index < length) {
  20094. var entry = entries[index];
  20095. this.set(entry[0], entry[1]);
  20096. }
  20097. }
  20098. /**
  20099. * Removes all key-value entries from the hash.
  20100. *
  20101. * @private
  20102. * @name clear
  20103. * @memberOf Hash
  20104. */
  20105. function hashClear() {
  20106. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20107. this.size = 0;
  20108. }
  20109. /**
  20110. * Removes `key` and its value from the hash.
  20111. *
  20112. * @private
  20113. * @name delete
  20114. * @memberOf Hash
  20115. * @param {Object} hash The hash to modify.
  20116. * @param {string} key The key of the value to remove.
  20117. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20118. */
  20119. function hashDelete(key) {
  20120. var result = this.has(key) && delete this.__data__[key];
  20121. this.size -= result ? 1 : 0;
  20122. return result;
  20123. }
  20124. /**
  20125. * Gets the hash value for `key`.
  20126. *
  20127. * @private
  20128. * @name get
  20129. * @memberOf Hash
  20130. * @param {string} key The key of the value to get.
  20131. * @returns {*} Returns the entry value.
  20132. */
  20133. function hashGet(key) {
  20134. var data = this.__data__;
  20135. if (nativeCreate) {
  20136. var result = data[key];
  20137. return result === HASH_UNDEFINED ? undefined : result;
  20138. }
  20139. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20140. }
  20141. /**
  20142. * Checks if a hash value for `key` exists.
  20143. *
  20144. * @private
  20145. * @name has
  20146. * @memberOf Hash
  20147. * @param {string} key The key of the entry to check.
  20148. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20149. */
  20150. function hashHas(key) {
  20151. var data = this.__data__;
  20152. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20153. }
  20154. /**
  20155. * Sets the hash `key` to `value`.
  20156. *
  20157. * @private
  20158. * @name set
  20159. * @memberOf Hash
  20160. * @param {string} key The key of the value to set.
  20161. * @param {*} value The value to set.
  20162. * @returns {Object} Returns the hash instance.
  20163. */
  20164. function hashSet(key, value) {
  20165. var data = this.__data__;
  20166. this.size += this.has(key) ? 0 : 1;
  20167. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20168. return this;
  20169. }
  20170. // Add methods to `Hash`.
  20171. Hash.prototype.clear = hashClear;
  20172. Hash.prototype['delete'] = hashDelete;
  20173. Hash.prototype.get = hashGet;
  20174. Hash.prototype.has = hashHas;
  20175. Hash.prototype.set = hashSet;
  20176. /*------------------------------------------------------------------------*/
  20177. /**
  20178. * Creates an list cache object.
  20179. *
  20180. * @private
  20181. * @constructor
  20182. * @param {Array} [entries] The key-value pairs to cache.
  20183. */
  20184. function ListCache(entries) {
  20185. var index = -1,
  20186. length = entries == null ? 0 : entries.length;
  20187. this.clear();
  20188. while (++index < length) {
  20189. var entry = entries[index];
  20190. this.set(entry[0], entry[1]);
  20191. }
  20192. }
  20193. /**
  20194. * Removes all key-value entries from the list cache.
  20195. *
  20196. * @private
  20197. * @name clear
  20198. * @memberOf ListCache
  20199. */
  20200. function listCacheClear() {
  20201. this.__data__ = [];
  20202. this.size = 0;
  20203. }
  20204. /**
  20205. * Removes `key` and its value from the list cache.
  20206. *
  20207. * @private
  20208. * @name delete
  20209. * @memberOf ListCache
  20210. * @param {string} key The key of the value to remove.
  20211. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20212. */
  20213. function listCacheDelete(key) {
  20214. var data = this.__data__,
  20215. index = assocIndexOf(data, key);
  20216. if (index < 0) {
  20217. return false;
  20218. }
  20219. var lastIndex = data.length - 1;
  20220. if (index == lastIndex) {
  20221. data.pop();
  20222. } else {
  20223. splice.call(data, index, 1);
  20224. }
  20225. --this.size;
  20226. return true;
  20227. }
  20228. /**
  20229. * Gets the list cache value for `key`.
  20230. *
  20231. * @private
  20232. * @name get
  20233. * @memberOf ListCache
  20234. * @param {string} key The key of the value to get.
  20235. * @returns {*} Returns the entry value.
  20236. */
  20237. function listCacheGet(key) {
  20238. var data = this.__data__,
  20239. index = assocIndexOf(data, key);
  20240. return index < 0 ? undefined : data[index][1];
  20241. }
  20242. /**
  20243. * Checks if a list cache value for `key` exists.
  20244. *
  20245. * @private
  20246. * @name has
  20247. * @memberOf ListCache
  20248. * @param {string} key The key of the entry to check.
  20249. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20250. */
  20251. function listCacheHas(key) {
  20252. return assocIndexOf(this.__data__, key) > -1;
  20253. }
  20254. /**
  20255. * Sets the list cache `key` to `value`.
  20256. *
  20257. * @private
  20258. * @name set
  20259. * @memberOf ListCache
  20260. * @param {string} key The key of the value to set.
  20261. * @param {*} value The value to set.
  20262. * @returns {Object} Returns the list cache instance.
  20263. */
  20264. function listCacheSet(key, value) {
  20265. var data = this.__data__,
  20266. index = assocIndexOf(data, key);
  20267. if (index < 0) {
  20268. ++this.size;
  20269. data.push([key, value]);
  20270. } else {
  20271. data[index][1] = value;
  20272. }
  20273. return this;
  20274. }
  20275. // Add methods to `ListCache`.
  20276. ListCache.prototype.clear = listCacheClear;
  20277. ListCache.prototype['delete'] = listCacheDelete;
  20278. ListCache.prototype.get = listCacheGet;
  20279. ListCache.prototype.has = listCacheHas;
  20280. ListCache.prototype.set = listCacheSet;
  20281. /*------------------------------------------------------------------------*/
  20282. /**
  20283. * Creates a map cache object to store key-value pairs.
  20284. *
  20285. * @private
  20286. * @constructor
  20287. * @param {Array} [entries] The key-value pairs to cache.
  20288. */
  20289. function MapCache(entries) {
  20290. var index = -1,
  20291. length = entries == null ? 0 : entries.length;
  20292. this.clear();
  20293. while (++index < length) {
  20294. var entry = entries[index];
  20295. this.set(entry[0], entry[1]);
  20296. }
  20297. }
  20298. /**
  20299. * Removes all key-value entries from the map.
  20300. *
  20301. * @private
  20302. * @name clear
  20303. * @memberOf MapCache
  20304. */
  20305. function mapCacheClear() {
  20306. this.size = 0;
  20307. this.__data__ = {
  20308. 'hash': new Hash,
  20309. 'map': new (Map || ListCache),
  20310. 'string': new Hash
  20311. };
  20312. }
  20313. /**
  20314. * Removes `key` and its value from the map.
  20315. *
  20316. * @private
  20317. * @name delete
  20318. * @memberOf MapCache
  20319. * @param {string} key The key of the value to remove.
  20320. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20321. */
  20322. function mapCacheDelete(key) {
  20323. var result = getMapData(this, key)['delete'](key);
  20324. this.size -= result ? 1 : 0;
  20325. return result;
  20326. }
  20327. /**
  20328. * Gets the map value for `key`.
  20329. *
  20330. * @private
  20331. * @name get
  20332. * @memberOf MapCache
  20333. * @param {string} key The key of the value to get.
  20334. * @returns {*} Returns the entry value.
  20335. */
  20336. function mapCacheGet(key) {
  20337. return getMapData(this, key).get(key);
  20338. }
  20339. /**
  20340. * Checks if a map value for `key` exists.
  20341. *
  20342. * @private
  20343. * @name has
  20344. * @memberOf MapCache
  20345. * @param {string} key The key of the entry to check.
  20346. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20347. */
  20348. function mapCacheHas(key) {
  20349. return getMapData(this, key).has(key);
  20350. }
  20351. /**
  20352. * Sets the map `key` to `value`.
  20353. *
  20354. * @private
  20355. * @name set
  20356. * @memberOf MapCache
  20357. * @param {string} key The key of the value to set.
  20358. * @param {*} value The value to set.
  20359. * @returns {Object} Returns the map cache instance.
  20360. */
  20361. function mapCacheSet(key, value) {
  20362. var data = getMapData(this, key),
  20363. size = data.size;
  20364. data.set(key, value);
  20365. this.size += data.size == size ? 0 : 1;
  20366. return this;
  20367. }
  20368. // Add methods to `MapCache`.
  20369. MapCache.prototype.clear = mapCacheClear;
  20370. MapCache.prototype['delete'] = mapCacheDelete;
  20371. MapCache.prototype.get = mapCacheGet;
  20372. MapCache.prototype.has = mapCacheHas;
  20373. MapCache.prototype.set = mapCacheSet;
  20374. /*------------------------------------------------------------------------*/
  20375. /**
  20376. *
  20377. * Creates an array cache object to store unique values.
  20378. *
  20379. * @private
  20380. * @constructor
  20381. * @param {Array} [values] The values to cache.
  20382. */
  20383. function SetCache(values) {
  20384. var index = -1,
  20385. length = values == null ? 0 : values.length;
  20386. this.__data__ = new MapCache;
  20387. while (++index < length) {
  20388. this.add(values[index]);
  20389. }
  20390. }
  20391. /**
  20392. * Adds `value` to the array cache.
  20393. *
  20394. * @private
  20395. * @name add
  20396. * @memberOf SetCache
  20397. * @alias push
  20398. * @param {*} value The value to cache.
  20399. * @returns {Object} Returns the cache instance.
  20400. */
  20401. function setCacheAdd(value) {
  20402. this.__data__.set(value, HASH_UNDEFINED);
  20403. return this;
  20404. }
  20405. /**
  20406. * Checks if `value` is in the array cache.
  20407. *
  20408. * @private
  20409. * @name has
  20410. * @memberOf SetCache
  20411. * @param {*} value The value to search for.
  20412. * @returns {number} Returns `true` if `value` is found, else `false`.
  20413. */
  20414. function setCacheHas(value) {
  20415. return this.__data__.has(value);
  20416. }
  20417. // Add methods to `SetCache`.
  20418. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20419. SetCache.prototype.has = setCacheHas;
  20420. /*------------------------------------------------------------------------*/
  20421. /**
  20422. * Creates a stack cache object to store key-value pairs.
  20423. *
  20424. * @private
  20425. * @constructor
  20426. * @param {Array} [entries] The key-value pairs to cache.
  20427. */
  20428. function Stack(entries) {
  20429. var data = this.__data__ = new ListCache(entries);
  20430. this.size = data.size;
  20431. }
  20432. /**
  20433. * Removes all key-value entries from the stack.
  20434. *
  20435. * @private
  20436. * @name clear
  20437. * @memberOf Stack
  20438. */
  20439. function stackClear() {
  20440. this.__data__ = new ListCache;
  20441. this.size = 0;
  20442. }
  20443. /**
  20444. * Removes `key` and its value from the stack.
  20445. *
  20446. * @private
  20447. * @name delete
  20448. * @memberOf Stack
  20449. * @param {string} key The key of the value to remove.
  20450. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20451. */
  20452. function stackDelete(key) {
  20453. var data = this.__data__,
  20454. result = data['delete'](key);
  20455. this.size = data.size;
  20456. return result;
  20457. }
  20458. /**
  20459. * Gets the stack value for `key`.
  20460. *
  20461. * @private
  20462. * @name get
  20463. * @memberOf Stack
  20464. * @param {string} key The key of the value to get.
  20465. * @returns {*} Returns the entry value.
  20466. */
  20467. function stackGet(key) {
  20468. return this.__data__.get(key);
  20469. }
  20470. /**
  20471. * Checks if a stack value for `key` exists.
  20472. *
  20473. * @private
  20474. * @name has
  20475. * @memberOf Stack
  20476. * @param {string} key The key of the entry to check.
  20477. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20478. */
  20479. function stackHas(key) {
  20480. return this.__data__.has(key);
  20481. }
  20482. /**
  20483. * Sets the stack `key` to `value`.
  20484. *
  20485. * @private
  20486. * @name set
  20487. * @memberOf Stack
  20488. * @param {string} key The key of the value to set.
  20489. * @param {*} value The value to set.
  20490. * @returns {Object} Returns the stack cache instance.
  20491. */
  20492. function stackSet(key, value) {
  20493. var data = this.__data__;
  20494. if (data instanceof ListCache) {
  20495. var pairs = data.__data__;
  20496. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20497. pairs.push([key, value]);
  20498. this.size = ++data.size;
  20499. return this;
  20500. }
  20501. data = this.__data__ = new MapCache(pairs);
  20502. }
  20503. data.set(key, value);
  20504. this.size = data.size;
  20505. return this;
  20506. }
  20507. // Add methods to `Stack`.
  20508. Stack.prototype.clear = stackClear;
  20509. Stack.prototype['delete'] = stackDelete;
  20510. Stack.prototype.get = stackGet;
  20511. Stack.prototype.has = stackHas;
  20512. Stack.prototype.set = stackSet;
  20513. /*------------------------------------------------------------------------*/
  20514. /**
  20515. * Creates an array of the enumerable property names of the array-like `value`.
  20516. *
  20517. * @private
  20518. * @param {*} value The value to query.
  20519. * @param {boolean} inherited Specify returning inherited property names.
  20520. * @returns {Array} Returns the array of property names.
  20521. */
  20522. function arrayLikeKeys(value, inherited) {
  20523. var isArr = isArray(value),
  20524. isArg = !isArr && isArguments(value),
  20525. isBuff = !isArr && !isArg && isBuffer(value),
  20526. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20527. skipIndexes = isArr || isArg || isBuff || isType,
  20528. result = skipIndexes ? baseTimes(value.length, String) : [],
  20529. length = result.length;
  20530. for (var key in value) {
  20531. if ((inherited || hasOwnProperty.call(value, key)) &&
  20532. !(skipIndexes && (
  20533. // Safari 9 has enumerable `arguments.length` in strict mode.
  20534. key == 'length' ||
  20535. // Node.js 0.10 has enumerable non-index properties on buffers.
  20536. (isBuff && (key == 'offset' || key == 'parent')) ||
  20537. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20538. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20539. // Skip index properties.
  20540. isIndex(key, length)
  20541. ))) {
  20542. result.push(key);
  20543. }
  20544. }
  20545. return result;
  20546. }
  20547. /**
  20548. * A specialized version of `_.sample` for arrays.
  20549. *
  20550. * @private
  20551. * @param {Array} array The array to sample.
  20552. * @returns {*} Returns the random element.
  20553. */
  20554. function arraySample(array) {
  20555. var length = array.length;
  20556. return length ? array[baseRandom(0, length - 1)] : undefined;
  20557. }
  20558. /**
  20559. * A specialized version of `_.sampleSize` for arrays.
  20560. *
  20561. * @private
  20562. * @param {Array} array The array to sample.
  20563. * @param {number} n The number of elements to sample.
  20564. * @returns {Array} Returns the random elements.
  20565. */
  20566. function arraySampleSize(array, n) {
  20567. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20568. }
  20569. /**
  20570. * A specialized version of `_.shuffle` for arrays.
  20571. *
  20572. * @private
  20573. * @param {Array} array The array to shuffle.
  20574. * @returns {Array} Returns the new shuffled array.
  20575. */
  20576. function arrayShuffle(array) {
  20577. return shuffleSelf(copyArray(array));
  20578. }
  20579. /**
  20580. * This function is like `assignValue` except that it doesn't assign
  20581. * `undefined` values.
  20582. *
  20583. * @private
  20584. * @param {Object} object The object to modify.
  20585. * @param {string} key The key of the property to assign.
  20586. * @param {*} value The value to assign.
  20587. */
  20588. function assignMergeValue(object, key, value) {
  20589. if ((value !== undefined && !eq(object[key], value)) ||
  20590. (value === undefined && !(key in object))) {
  20591. baseAssignValue(object, key, value);
  20592. }
  20593. }
  20594. /**
  20595. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20596. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20597. * for equality comparisons.
  20598. *
  20599. * @private
  20600. * @param {Object} object The object to modify.
  20601. * @param {string} key The key of the property to assign.
  20602. * @param {*} value The value to assign.
  20603. */
  20604. function assignValue(object, key, value) {
  20605. var objValue = object[key];
  20606. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20607. (value === undefined && !(key in object))) {
  20608. baseAssignValue(object, key, value);
  20609. }
  20610. }
  20611. /**
  20612. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20613. *
  20614. * @private
  20615. * @param {Array} array The array to inspect.
  20616. * @param {*} key The key to search for.
  20617. * @returns {number} Returns the index of the matched value, else `-1`.
  20618. */
  20619. function assocIndexOf(array, key) {
  20620. var length = array.length;
  20621. while (length--) {
  20622. if (eq(array[length][0], key)) {
  20623. return length;
  20624. }
  20625. }
  20626. return -1;
  20627. }
  20628. /**
  20629. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20630. * by `iteratee` and values set by `setter`.
  20631. *
  20632. * @private
  20633. * @param {Array|Object} collection The collection to iterate over.
  20634. * @param {Function} setter The function to set `accumulator` values.
  20635. * @param {Function} iteratee The iteratee to transform keys.
  20636. * @param {Object} accumulator The initial aggregated object.
  20637. * @returns {Function} Returns `accumulator`.
  20638. */
  20639. function baseAggregator(collection, setter, iteratee, accumulator) {
  20640. baseEach(collection, function(value, key, collection) {
  20641. setter(accumulator, value, iteratee(value), collection);
  20642. });
  20643. return accumulator;
  20644. }
  20645. /**
  20646. * The base implementation of `_.assign` without support for multiple sources
  20647. * or `customizer` functions.
  20648. *
  20649. * @private
  20650. * @param {Object} object The destination object.
  20651. * @param {Object} source The source object.
  20652. * @returns {Object} Returns `object`.
  20653. */
  20654. function baseAssign(object, source) {
  20655. return object && copyObject(source, keys(source), object);
  20656. }
  20657. /**
  20658. * The base implementation of `_.assignIn` without support for multiple sources
  20659. * or `customizer` functions.
  20660. *
  20661. * @private
  20662. * @param {Object} object The destination object.
  20663. * @param {Object} source The source object.
  20664. * @returns {Object} Returns `object`.
  20665. */
  20666. function baseAssignIn(object, source) {
  20667. return object && copyObject(source, keysIn(source), object);
  20668. }
  20669. /**
  20670. * The base implementation of `assignValue` and `assignMergeValue` without
  20671. * value checks.
  20672. *
  20673. * @private
  20674. * @param {Object} object The object to modify.
  20675. * @param {string} key The key of the property to assign.
  20676. * @param {*} value The value to assign.
  20677. */
  20678. function baseAssignValue(object, key, value) {
  20679. if (key == '__proto__' && defineProperty) {
  20680. defineProperty(object, key, {
  20681. 'configurable': true,
  20682. 'enumerable': true,
  20683. 'value': value,
  20684. 'writable': true
  20685. });
  20686. } else {
  20687. object[key] = value;
  20688. }
  20689. }
  20690. /**
  20691. * The base implementation of `_.at` without support for individual paths.
  20692. *
  20693. * @private
  20694. * @param {Object} object The object to iterate over.
  20695. * @param {string[]} paths The property paths to pick.
  20696. * @returns {Array} Returns the picked elements.
  20697. */
  20698. function baseAt(object, paths) {
  20699. var index = -1,
  20700. length = paths.length,
  20701. result = Array(length),
  20702. skip = object == null;
  20703. while (++index < length) {
  20704. result[index] = skip ? undefined : get(object, paths[index]);
  20705. }
  20706. return result;
  20707. }
  20708. /**
  20709. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20710. *
  20711. * @private
  20712. * @param {number} number The number to clamp.
  20713. * @param {number} [lower] The lower bound.
  20714. * @param {number} upper The upper bound.
  20715. * @returns {number} Returns the clamped number.
  20716. */
  20717. function baseClamp(number, lower, upper) {
  20718. if (number === number) {
  20719. if (upper !== undefined) {
  20720. number = number <= upper ? number : upper;
  20721. }
  20722. if (lower !== undefined) {
  20723. number = number >= lower ? number : lower;
  20724. }
  20725. }
  20726. return number;
  20727. }
  20728. /**
  20729. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20730. * traversed objects.
  20731. *
  20732. * @private
  20733. * @param {*} value The value to clone.
  20734. * @param {boolean} bitmask The bitmask flags.
  20735. * 1 - Deep clone
  20736. * 2 - Flatten inherited properties
  20737. * 4 - Clone symbols
  20738. * @param {Function} [customizer] The function to customize cloning.
  20739. * @param {string} [key] The key of `value`.
  20740. * @param {Object} [object] The parent object of `value`.
  20741. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20742. * @returns {*} Returns the cloned value.
  20743. */
  20744. function baseClone(value, bitmask, customizer, key, object, stack) {
  20745. var result,
  20746. isDeep = bitmask & CLONE_DEEP_FLAG,
  20747. isFlat = bitmask & CLONE_FLAT_FLAG,
  20748. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20749. if (customizer) {
  20750. result = object ? customizer(value, key, object, stack) : customizer(value);
  20751. }
  20752. if (result !== undefined) {
  20753. return result;
  20754. }
  20755. if (!isObject(value)) {
  20756. return value;
  20757. }
  20758. var isArr = isArray(value);
  20759. if (isArr) {
  20760. result = initCloneArray(value);
  20761. if (!isDeep) {
  20762. return copyArray(value, result);
  20763. }
  20764. } else {
  20765. var tag = getTag(value),
  20766. isFunc = tag == funcTag || tag == genTag;
  20767. if (isBuffer(value)) {
  20768. return cloneBuffer(value, isDeep);
  20769. }
  20770. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20771. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20772. if (!isDeep) {
  20773. return isFlat
  20774. ? copySymbolsIn(value, baseAssignIn(result, value))
  20775. : copySymbols(value, baseAssign(result, value));
  20776. }
  20777. } else {
  20778. if (!cloneableTags[tag]) {
  20779. return object ? value : {};
  20780. }
  20781. result = initCloneByTag(value, tag, isDeep);
  20782. }
  20783. }
  20784. // Check for circular references and return its corresponding clone.
  20785. stack || (stack = new Stack);
  20786. var stacked = stack.get(value);
  20787. if (stacked) {
  20788. return stacked;
  20789. }
  20790. stack.set(value, result);
  20791. if (isSet(value)) {
  20792. value.forEach(function(subValue) {
  20793. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20794. });
  20795. } else if (isMap(value)) {
  20796. value.forEach(function(subValue, key) {
  20797. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20798. });
  20799. }
  20800. var keysFunc = isFull
  20801. ? (isFlat ? getAllKeysIn : getAllKeys)
  20802. : (isFlat ? keysIn : keys);
  20803. var props = isArr ? undefined : keysFunc(value);
  20804. arrayEach(props || value, function(subValue, key) {
  20805. if (props) {
  20806. key = subValue;
  20807. subValue = value[key];
  20808. }
  20809. // Recursively populate clone (susceptible to call stack limits).
  20810. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20811. });
  20812. return result;
  20813. }
  20814. /**
  20815. * The base implementation of `_.conforms` which doesn't clone `source`.
  20816. *
  20817. * @private
  20818. * @param {Object} source The object of property predicates to conform to.
  20819. * @returns {Function} Returns the new spec function.
  20820. */
  20821. function baseConforms(source) {
  20822. var props = keys(source);
  20823. return function(object) {
  20824. return baseConformsTo(object, source, props);
  20825. };
  20826. }
  20827. /**
  20828. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20829. *
  20830. * @private
  20831. * @param {Object} object The object to inspect.
  20832. * @param {Object} source The object of property predicates to conform to.
  20833. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20834. */
  20835. function baseConformsTo(object, source, props) {
  20836. var length = props.length;
  20837. if (object == null) {
  20838. return !length;
  20839. }
  20840. object = Object(object);
  20841. while (length--) {
  20842. var key = props[length],
  20843. predicate = source[key],
  20844. value = object[key];
  20845. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20846. return false;
  20847. }
  20848. }
  20849. return true;
  20850. }
  20851. /**
  20852. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20853. * to provide to `func`.
  20854. *
  20855. * @private
  20856. * @param {Function} func The function to delay.
  20857. * @param {number} wait The number of milliseconds to delay invocation.
  20858. * @param {Array} args The arguments to provide to `func`.
  20859. * @returns {number|Object} Returns the timer id or timeout object.
  20860. */
  20861. function baseDelay(func, wait, args) {
  20862. if (typeof func != 'function') {
  20863. throw new TypeError(FUNC_ERROR_TEXT);
  20864. }
  20865. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20866. }
  20867. /**
  20868. * The base implementation of methods like `_.difference` without support
  20869. * for excluding multiple arrays or iteratee shorthands.
  20870. *
  20871. * @private
  20872. * @param {Array} array The array to inspect.
  20873. * @param {Array} values The values to exclude.
  20874. * @param {Function} [iteratee] The iteratee invoked per element.
  20875. * @param {Function} [comparator] The comparator invoked per element.
  20876. * @returns {Array} Returns the new array of filtered values.
  20877. */
  20878. function baseDifference(array, values, iteratee, comparator) {
  20879. var index = -1,
  20880. includes = arrayIncludes,
  20881. isCommon = true,
  20882. length = array.length,
  20883. result = [],
  20884. valuesLength = values.length;
  20885. if (!length) {
  20886. return result;
  20887. }
  20888. if (iteratee) {
  20889. values = arrayMap(values, baseUnary(iteratee));
  20890. }
  20891. if (comparator) {
  20892. includes = arrayIncludesWith;
  20893. isCommon = false;
  20894. }
  20895. else if (values.length >= LARGE_ARRAY_SIZE) {
  20896. includes = cacheHas;
  20897. isCommon = false;
  20898. values = new SetCache(values);
  20899. }
  20900. outer:
  20901. while (++index < length) {
  20902. var value = array[index],
  20903. computed = iteratee == null ? value : iteratee(value);
  20904. value = (comparator || value !== 0) ? value : 0;
  20905. if (isCommon && computed === computed) {
  20906. var valuesIndex = valuesLength;
  20907. while (valuesIndex--) {
  20908. if (values[valuesIndex] === computed) {
  20909. continue outer;
  20910. }
  20911. }
  20912. result.push(value);
  20913. }
  20914. else if (!includes(values, computed, comparator)) {
  20915. result.push(value);
  20916. }
  20917. }
  20918. return result;
  20919. }
  20920. /**
  20921. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20922. *
  20923. * @private
  20924. * @param {Array|Object} collection The collection to iterate over.
  20925. * @param {Function} iteratee The function invoked per iteration.
  20926. * @returns {Array|Object} Returns `collection`.
  20927. */
  20928. var baseEach = createBaseEach(baseForOwn);
  20929. /**
  20930. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20931. *
  20932. * @private
  20933. * @param {Array|Object} collection The collection to iterate over.
  20934. * @param {Function} iteratee The function invoked per iteration.
  20935. * @returns {Array|Object} Returns `collection`.
  20936. */
  20937. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20938. /**
  20939. * The base implementation of `_.every` without support for iteratee shorthands.
  20940. *
  20941. * @private
  20942. * @param {Array|Object} collection The collection to iterate over.
  20943. * @param {Function} predicate The function invoked per iteration.
  20944. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20945. * else `false`
  20946. */
  20947. function baseEvery(collection, predicate) {
  20948. var result = true;
  20949. baseEach(collection, function(value, index, collection) {
  20950. result = !!predicate(value, index, collection);
  20951. return result;
  20952. });
  20953. return result;
  20954. }
  20955. /**
  20956. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20957. * `comparator` to determine the extremum value.
  20958. *
  20959. * @private
  20960. * @param {Array} array The array to iterate over.
  20961. * @param {Function} iteratee The iteratee invoked per iteration.
  20962. * @param {Function} comparator The comparator used to compare values.
  20963. * @returns {*} Returns the extremum value.
  20964. */
  20965. function baseExtremum(array, iteratee, comparator) {
  20966. var index = -1,
  20967. length = array.length;
  20968. while (++index < length) {
  20969. var value = array[index],
  20970. current = iteratee(value);
  20971. if (current != null && (computed === undefined
  20972. ? (current === current && !isSymbol(current))
  20973. : comparator(current, computed)
  20974. )) {
  20975. var computed = current,
  20976. result = value;
  20977. }
  20978. }
  20979. return result;
  20980. }
  20981. /**
  20982. * The base implementation of `_.fill` without an iteratee call guard.
  20983. *
  20984. * @private
  20985. * @param {Array} array The array to fill.
  20986. * @param {*} value The value to fill `array` with.
  20987. * @param {number} [start=0] The start position.
  20988. * @param {number} [end=array.length] The end position.
  20989. * @returns {Array} Returns `array`.
  20990. */
  20991. function baseFill(array, value, start, end) {
  20992. var length = array.length;
  20993. start = toInteger(start);
  20994. if (start < 0) {
  20995. start = -start > length ? 0 : (length + start);
  20996. }
  20997. end = (end === undefined || end > length) ? length : toInteger(end);
  20998. if (end < 0) {
  20999. end += length;
  21000. }
  21001. end = start > end ? 0 : toLength(end);
  21002. while (start < end) {
  21003. array[start++] = value;
  21004. }
  21005. return array;
  21006. }
  21007. /**
  21008. * The base implementation of `_.filter` without support for iteratee shorthands.
  21009. *
  21010. * @private
  21011. * @param {Array|Object} collection The collection to iterate over.
  21012. * @param {Function} predicate The function invoked per iteration.
  21013. * @returns {Array} Returns the new filtered array.
  21014. */
  21015. function baseFilter(collection, predicate) {
  21016. var result = [];
  21017. baseEach(collection, function(value, index, collection) {
  21018. if (predicate(value, index, collection)) {
  21019. result.push(value);
  21020. }
  21021. });
  21022. return result;
  21023. }
  21024. /**
  21025. * The base implementation of `_.flatten` with support for restricting flattening.
  21026. *
  21027. * @private
  21028. * @param {Array} array The array to flatten.
  21029. * @param {number} depth The maximum recursion depth.
  21030. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21031. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21032. * @param {Array} [result=[]] The initial result value.
  21033. * @returns {Array} Returns the new flattened array.
  21034. */
  21035. function baseFlatten(array, depth, predicate, isStrict, result) {
  21036. var index = -1,
  21037. length = array.length;
  21038. predicate || (predicate = isFlattenable);
  21039. result || (result = []);
  21040. while (++index < length) {
  21041. var value = array[index];
  21042. if (depth > 0 && predicate(value)) {
  21043. if (depth > 1) {
  21044. // Recursively flatten arrays (susceptible to call stack limits).
  21045. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21046. } else {
  21047. arrayPush(result, value);
  21048. }
  21049. } else if (!isStrict) {
  21050. result[result.length] = value;
  21051. }
  21052. }
  21053. return result;
  21054. }
  21055. /**
  21056. * The base implementation of `baseForOwn` which iterates over `object`
  21057. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21058. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21059. *
  21060. * @private
  21061. * @param {Object} object The object to iterate over.
  21062. * @param {Function} iteratee The function invoked per iteration.
  21063. * @param {Function} keysFunc The function to get the keys of `object`.
  21064. * @returns {Object} Returns `object`.
  21065. */
  21066. var baseFor = createBaseFor();
  21067. /**
  21068. * This function is like `baseFor` except that it iterates over properties
  21069. * in the opposite order.
  21070. *
  21071. * @private
  21072. * @param {Object} object The object to iterate over.
  21073. * @param {Function} iteratee The function invoked per iteration.
  21074. * @param {Function} keysFunc The function to get the keys of `object`.
  21075. * @returns {Object} Returns `object`.
  21076. */
  21077. var baseForRight = createBaseFor(true);
  21078. /**
  21079. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21080. *
  21081. * @private
  21082. * @param {Object} object The object to iterate over.
  21083. * @param {Function} iteratee The function invoked per iteration.
  21084. * @returns {Object} Returns `object`.
  21085. */
  21086. function baseForOwn(object, iteratee) {
  21087. return object && baseFor(object, iteratee, keys);
  21088. }
  21089. /**
  21090. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21091. *
  21092. * @private
  21093. * @param {Object} object The object to iterate over.
  21094. * @param {Function} iteratee The function invoked per iteration.
  21095. * @returns {Object} Returns `object`.
  21096. */
  21097. function baseForOwnRight(object, iteratee) {
  21098. return object && baseForRight(object, iteratee, keys);
  21099. }
  21100. /**
  21101. * The base implementation of `_.functions` which creates an array of
  21102. * `object` function property names filtered from `props`.
  21103. *
  21104. * @private
  21105. * @param {Object} object The object to inspect.
  21106. * @param {Array} props The property names to filter.
  21107. * @returns {Array} Returns the function names.
  21108. */
  21109. function baseFunctions(object, props) {
  21110. return arrayFilter(props, function(key) {
  21111. return isFunction(object[key]);
  21112. });
  21113. }
  21114. /**
  21115. * The base implementation of `_.get` without support for default values.
  21116. *
  21117. * @private
  21118. * @param {Object} object The object to query.
  21119. * @param {Array|string} path The path of the property to get.
  21120. * @returns {*} Returns the resolved value.
  21121. */
  21122. function baseGet(object, path) {
  21123. path = castPath(path, object);
  21124. var index = 0,
  21125. length = path.length;
  21126. while (object != null && index < length) {
  21127. object = object[toKey(path[index++])];
  21128. }
  21129. return (index && index == length) ? object : undefined;
  21130. }
  21131. /**
  21132. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21133. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21134. * symbols of `object`.
  21135. *
  21136. * @private
  21137. * @param {Object} object The object to query.
  21138. * @param {Function} keysFunc The function to get the keys of `object`.
  21139. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21140. * @returns {Array} Returns the array of property names and symbols.
  21141. */
  21142. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21143. var result = keysFunc(object);
  21144. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21145. }
  21146. /**
  21147. * The base implementation of `getTag` without fallbacks for buggy environments.
  21148. *
  21149. * @private
  21150. * @param {*} value The value to query.
  21151. * @returns {string} Returns the `toStringTag`.
  21152. */
  21153. function baseGetTag(value) {
  21154. if (value == null) {
  21155. return value === undefined ? undefinedTag : nullTag;
  21156. }
  21157. return (symToStringTag && symToStringTag in Object(value))
  21158. ? getRawTag(value)
  21159. : objectToString(value);
  21160. }
  21161. /**
  21162. * The base implementation of `_.gt` which doesn't coerce arguments.
  21163. *
  21164. * @private
  21165. * @param {*} value The value to compare.
  21166. * @param {*} other The other value to compare.
  21167. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21168. * else `false`.
  21169. */
  21170. function baseGt(value, other) {
  21171. return value > other;
  21172. }
  21173. /**
  21174. * The base implementation of `_.has` without support for deep paths.
  21175. *
  21176. * @private
  21177. * @param {Object} [object] The object to query.
  21178. * @param {Array|string} key The key to check.
  21179. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21180. */
  21181. function baseHas(object, key) {
  21182. return object != null && hasOwnProperty.call(object, key);
  21183. }
  21184. /**
  21185. * The base implementation of `_.hasIn` without support for deep paths.
  21186. *
  21187. * @private
  21188. * @param {Object} [object] The object to query.
  21189. * @param {Array|string} key The key to check.
  21190. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21191. */
  21192. function baseHasIn(object, key) {
  21193. return object != null && key in Object(object);
  21194. }
  21195. /**
  21196. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21197. *
  21198. * @private
  21199. * @param {number} number The number to check.
  21200. * @param {number} start The start of the range.
  21201. * @param {number} end The end of the range.
  21202. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21203. */
  21204. function baseInRange(number, start, end) {
  21205. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21206. }
  21207. /**
  21208. * The base implementation of methods like `_.intersection`, without support
  21209. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21210. *
  21211. * @private
  21212. * @param {Array} arrays The arrays to inspect.
  21213. * @param {Function} [iteratee] The iteratee invoked per element.
  21214. * @param {Function} [comparator] The comparator invoked per element.
  21215. * @returns {Array} Returns the new array of shared values.
  21216. */
  21217. function baseIntersection(arrays, iteratee, comparator) {
  21218. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21219. length = arrays[0].length,
  21220. othLength = arrays.length,
  21221. othIndex = othLength,
  21222. caches = Array(othLength),
  21223. maxLength = Infinity,
  21224. result = [];
  21225. while (othIndex--) {
  21226. var array = arrays[othIndex];
  21227. if (othIndex && iteratee) {
  21228. array = arrayMap(array, baseUnary(iteratee));
  21229. }
  21230. maxLength = nativeMin(array.length, maxLength);
  21231. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21232. ? new SetCache(othIndex && array)
  21233. : undefined;
  21234. }
  21235. array = arrays[0];
  21236. var index = -1,
  21237. seen = caches[0];
  21238. outer:
  21239. while (++index < length && result.length < maxLength) {
  21240. var value = array[index],
  21241. computed = iteratee ? iteratee(value) : value;
  21242. value = (comparator || value !== 0) ? value : 0;
  21243. if (!(seen
  21244. ? cacheHas(seen, computed)
  21245. : includes(result, computed, comparator)
  21246. )) {
  21247. othIndex = othLength;
  21248. while (--othIndex) {
  21249. var cache = caches[othIndex];
  21250. if (!(cache
  21251. ? cacheHas(cache, computed)
  21252. : includes(arrays[othIndex], computed, comparator))
  21253. ) {
  21254. continue outer;
  21255. }
  21256. }
  21257. if (seen) {
  21258. seen.push(computed);
  21259. }
  21260. result.push(value);
  21261. }
  21262. }
  21263. return result;
  21264. }
  21265. /**
  21266. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21267. * `object` with values transformed by `iteratee` and set by `setter`.
  21268. *
  21269. * @private
  21270. * @param {Object} object The object to iterate over.
  21271. * @param {Function} setter The function to set `accumulator` values.
  21272. * @param {Function} iteratee The iteratee to transform values.
  21273. * @param {Object} accumulator The initial inverted object.
  21274. * @returns {Function} Returns `accumulator`.
  21275. */
  21276. function baseInverter(object, setter, iteratee, accumulator) {
  21277. baseForOwn(object, function(value, key, object) {
  21278. setter(accumulator, iteratee(value), key, object);
  21279. });
  21280. return accumulator;
  21281. }
  21282. /**
  21283. * The base implementation of `_.invoke` without support for individual
  21284. * method arguments.
  21285. *
  21286. * @private
  21287. * @param {Object} object The object to query.
  21288. * @param {Array|string} path The path of the method to invoke.
  21289. * @param {Array} args The arguments to invoke the method with.
  21290. * @returns {*} Returns the result of the invoked method.
  21291. */
  21292. function baseInvoke(object, path, args) {
  21293. path = castPath(path, object);
  21294. object = parent(object, path);
  21295. var func = object == null ? object : object[toKey(last(path))];
  21296. return func == null ? undefined : apply(func, object, args);
  21297. }
  21298. /**
  21299. * The base implementation of `_.isArguments`.
  21300. *
  21301. * @private
  21302. * @param {*} value The value to check.
  21303. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21304. */
  21305. function baseIsArguments(value) {
  21306. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21307. }
  21308. /**
  21309. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21310. *
  21311. * @private
  21312. * @param {*} value The value to check.
  21313. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21314. */
  21315. function baseIsArrayBuffer(value) {
  21316. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21317. }
  21318. /**
  21319. * The base implementation of `_.isDate` without Node.js optimizations.
  21320. *
  21321. * @private
  21322. * @param {*} value The value to check.
  21323. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21324. */
  21325. function baseIsDate(value) {
  21326. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21327. }
  21328. /**
  21329. * The base implementation of `_.isEqual` which supports partial comparisons
  21330. * and tracks traversed objects.
  21331. *
  21332. * @private
  21333. * @param {*} value The value to compare.
  21334. * @param {*} other The other value to compare.
  21335. * @param {boolean} bitmask The bitmask flags.
  21336. * 1 - Unordered comparison
  21337. * 2 - Partial comparison
  21338. * @param {Function} [customizer] The function to customize comparisons.
  21339. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21340. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21341. */
  21342. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21343. if (value === other) {
  21344. return true;
  21345. }
  21346. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21347. return value !== value && other !== other;
  21348. }
  21349. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21350. }
  21351. /**
  21352. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21353. * deep comparisons and tracks traversed objects enabling objects with circular
  21354. * references to be compared.
  21355. *
  21356. * @private
  21357. * @param {Object} object The object to compare.
  21358. * @param {Object} other The other object to compare.
  21359. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21360. * @param {Function} customizer The function to customize comparisons.
  21361. * @param {Function} equalFunc The function to determine equivalents of values.
  21362. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21363. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21364. */
  21365. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21366. var objIsArr = isArray(object),
  21367. othIsArr = isArray(other),
  21368. objTag = objIsArr ? arrayTag : getTag(object),
  21369. othTag = othIsArr ? arrayTag : getTag(other);
  21370. objTag = objTag == argsTag ? objectTag : objTag;
  21371. othTag = othTag == argsTag ? objectTag : othTag;
  21372. var objIsObj = objTag == objectTag,
  21373. othIsObj = othTag == objectTag,
  21374. isSameTag = objTag == othTag;
  21375. if (isSameTag && isBuffer(object)) {
  21376. if (!isBuffer(other)) {
  21377. return false;
  21378. }
  21379. objIsArr = true;
  21380. objIsObj = false;
  21381. }
  21382. if (isSameTag && !objIsObj) {
  21383. stack || (stack = new Stack);
  21384. return (objIsArr || isTypedArray(object))
  21385. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21386. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21387. }
  21388. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21389. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21390. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21391. if (objIsWrapped || othIsWrapped) {
  21392. var objUnwrapped = objIsWrapped ? object.value() : object,
  21393. othUnwrapped = othIsWrapped ? other.value() : other;
  21394. stack || (stack = new Stack);
  21395. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21396. }
  21397. }
  21398. if (!isSameTag) {
  21399. return false;
  21400. }
  21401. stack || (stack = new Stack);
  21402. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21403. }
  21404. /**
  21405. * The base implementation of `_.isMap` without Node.js optimizations.
  21406. *
  21407. * @private
  21408. * @param {*} value The value to check.
  21409. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21410. */
  21411. function baseIsMap(value) {
  21412. return isObjectLike(value) && getTag(value) == mapTag;
  21413. }
  21414. /**
  21415. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21416. *
  21417. * @private
  21418. * @param {Object} object The object to inspect.
  21419. * @param {Object} source The object of property values to match.
  21420. * @param {Array} matchData The property names, values, and compare flags to match.
  21421. * @param {Function} [customizer] The function to customize comparisons.
  21422. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21423. */
  21424. function baseIsMatch(object, source, matchData, customizer) {
  21425. var index = matchData.length,
  21426. length = index,
  21427. noCustomizer = !customizer;
  21428. if (object == null) {
  21429. return !length;
  21430. }
  21431. object = Object(object);
  21432. while (index--) {
  21433. var data = matchData[index];
  21434. if ((noCustomizer && data[2])
  21435. ? data[1] !== object[data[0]]
  21436. : !(data[0] in object)
  21437. ) {
  21438. return false;
  21439. }
  21440. }
  21441. while (++index < length) {
  21442. data = matchData[index];
  21443. var key = data[0],
  21444. objValue = object[key],
  21445. srcValue = data[1];
  21446. if (noCustomizer && data[2]) {
  21447. if (objValue === undefined && !(key in object)) {
  21448. return false;
  21449. }
  21450. } else {
  21451. var stack = new Stack;
  21452. if (customizer) {
  21453. var result = customizer(objValue, srcValue, key, object, source, stack);
  21454. }
  21455. if (!(result === undefined
  21456. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21457. : result
  21458. )) {
  21459. return false;
  21460. }
  21461. }
  21462. }
  21463. return true;
  21464. }
  21465. /**
  21466. * The base implementation of `_.isNative` without bad shim checks.
  21467. *
  21468. * @private
  21469. * @param {*} value The value to check.
  21470. * @returns {boolean} Returns `true` if `value` is a native function,
  21471. * else `false`.
  21472. */
  21473. function baseIsNative(value) {
  21474. if (!isObject(value) || isMasked(value)) {
  21475. return false;
  21476. }
  21477. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21478. return pattern.test(toSource(value));
  21479. }
  21480. /**
  21481. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21482. *
  21483. * @private
  21484. * @param {*} value The value to check.
  21485. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21486. */
  21487. function baseIsRegExp(value) {
  21488. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21489. }
  21490. /**
  21491. * The base implementation of `_.isSet` without Node.js optimizations.
  21492. *
  21493. * @private
  21494. * @param {*} value The value to check.
  21495. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21496. */
  21497. function baseIsSet(value) {
  21498. return isObjectLike(value) && getTag(value) == setTag;
  21499. }
  21500. /**
  21501. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21502. *
  21503. * @private
  21504. * @param {*} value The value to check.
  21505. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21506. */
  21507. function baseIsTypedArray(value) {
  21508. return isObjectLike(value) &&
  21509. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21510. }
  21511. /**
  21512. * The base implementation of `_.iteratee`.
  21513. *
  21514. * @private
  21515. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21516. * @returns {Function} Returns the iteratee.
  21517. */
  21518. function baseIteratee(value) {
  21519. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21520. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21521. if (typeof value == 'function') {
  21522. return value;
  21523. }
  21524. if (value == null) {
  21525. return identity;
  21526. }
  21527. if (typeof value == 'object') {
  21528. return isArray(value)
  21529. ? baseMatchesProperty(value[0], value[1])
  21530. : baseMatches(value);
  21531. }
  21532. return property(value);
  21533. }
  21534. /**
  21535. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21536. *
  21537. * @private
  21538. * @param {Object} object The object to query.
  21539. * @returns {Array} Returns the array of property names.
  21540. */
  21541. function baseKeys(object) {
  21542. if (!isPrototype(object)) {
  21543. return nativeKeys(object);
  21544. }
  21545. var result = [];
  21546. for (var key in Object(object)) {
  21547. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21548. result.push(key);
  21549. }
  21550. }
  21551. return result;
  21552. }
  21553. /**
  21554. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21555. *
  21556. * @private
  21557. * @param {Object} object The object to query.
  21558. * @returns {Array} Returns the array of property names.
  21559. */
  21560. function baseKeysIn(object) {
  21561. if (!isObject(object)) {
  21562. return nativeKeysIn(object);
  21563. }
  21564. var isProto = isPrototype(object),
  21565. result = [];
  21566. for (var key in object) {
  21567. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21568. result.push(key);
  21569. }
  21570. }
  21571. return result;
  21572. }
  21573. /**
  21574. * The base implementation of `_.lt` which doesn't coerce arguments.
  21575. *
  21576. * @private
  21577. * @param {*} value The value to compare.
  21578. * @param {*} other The other value to compare.
  21579. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21580. * else `false`.
  21581. */
  21582. function baseLt(value, other) {
  21583. return value < other;
  21584. }
  21585. /**
  21586. * The base implementation of `_.map` without support for iteratee shorthands.
  21587. *
  21588. * @private
  21589. * @param {Array|Object} collection The collection to iterate over.
  21590. * @param {Function} iteratee The function invoked per iteration.
  21591. * @returns {Array} Returns the new mapped array.
  21592. */
  21593. function baseMap(collection, iteratee) {
  21594. var index = -1,
  21595. result = isArrayLike(collection) ? Array(collection.length) : [];
  21596. baseEach(collection, function(value, key, collection) {
  21597. result[++index] = iteratee(value, key, collection);
  21598. });
  21599. return result;
  21600. }
  21601. /**
  21602. * The base implementation of `_.matches` which doesn't clone `source`.
  21603. *
  21604. * @private
  21605. * @param {Object} source The object of property values to match.
  21606. * @returns {Function} Returns the new spec function.
  21607. */
  21608. function baseMatches(source) {
  21609. var matchData = getMatchData(source);
  21610. if (matchData.length == 1 && matchData[0][2]) {
  21611. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21612. }
  21613. return function(object) {
  21614. return object === source || baseIsMatch(object, source, matchData);
  21615. };
  21616. }
  21617. /**
  21618. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21619. *
  21620. * @private
  21621. * @param {string} path The path of the property to get.
  21622. * @param {*} srcValue The value to match.
  21623. * @returns {Function} Returns the new spec function.
  21624. */
  21625. function baseMatchesProperty(path, srcValue) {
  21626. if (isKey(path) && isStrictComparable(srcValue)) {
  21627. return matchesStrictComparable(toKey(path), srcValue);
  21628. }
  21629. return function(object) {
  21630. var objValue = get(object, path);
  21631. return (objValue === undefined && objValue === srcValue)
  21632. ? hasIn(object, path)
  21633. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21634. };
  21635. }
  21636. /**
  21637. * The base implementation of `_.merge` without support for multiple sources.
  21638. *
  21639. * @private
  21640. * @param {Object} object The destination object.
  21641. * @param {Object} source The source object.
  21642. * @param {number} srcIndex The index of `source`.
  21643. * @param {Function} [customizer] The function to customize merged values.
  21644. * @param {Object} [stack] Tracks traversed source values and their merged
  21645. * counterparts.
  21646. */
  21647. function baseMerge(object, source, srcIndex, customizer, stack) {
  21648. if (object === source) {
  21649. return;
  21650. }
  21651. baseFor(source, function(srcValue, key) {
  21652. stack || (stack = new Stack);
  21653. if (isObject(srcValue)) {
  21654. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21655. }
  21656. else {
  21657. var newValue = customizer
  21658. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21659. : undefined;
  21660. if (newValue === undefined) {
  21661. newValue = srcValue;
  21662. }
  21663. assignMergeValue(object, key, newValue);
  21664. }
  21665. }, keysIn);
  21666. }
  21667. /**
  21668. * A specialized version of `baseMerge` for arrays and objects which performs
  21669. * deep merges and tracks traversed objects enabling objects with circular
  21670. * references to be merged.
  21671. *
  21672. * @private
  21673. * @param {Object} object The destination object.
  21674. * @param {Object} source The source object.
  21675. * @param {string} key The key of the value to merge.
  21676. * @param {number} srcIndex The index of `source`.
  21677. * @param {Function} mergeFunc The function to merge values.
  21678. * @param {Function} [customizer] The function to customize assigned values.
  21679. * @param {Object} [stack] Tracks traversed source values and their merged
  21680. * counterparts.
  21681. */
  21682. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21683. var objValue = safeGet(object, key),
  21684. srcValue = safeGet(source, key),
  21685. stacked = stack.get(srcValue);
  21686. if (stacked) {
  21687. assignMergeValue(object, key, stacked);
  21688. return;
  21689. }
  21690. var newValue = customizer
  21691. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21692. : undefined;
  21693. var isCommon = newValue === undefined;
  21694. if (isCommon) {
  21695. var isArr = isArray(srcValue),
  21696. isBuff = !isArr && isBuffer(srcValue),
  21697. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21698. newValue = srcValue;
  21699. if (isArr || isBuff || isTyped) {
  21700. if (isArray(objValue)) {
  21701. newValue = objValue;
  21702. }
  21703. else if (isArrayLikeObject(objValue)) {
  21704. newValue = copyArray(objValue);
  21705. }
  21706. else if (isBuff) {
  21707. isCommon = false;
  21708. newValue = cloneBuffer(srcValue, true);
  21709. }
  21710. else if (isTyped) {
  21711. isCommon = false;
  21712. newValue = cloneTypedArray(srcValue, true);
  21713. }
  21714. else {
  21715. newValue = [];
  21716. }
  21717. }
  21718. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21719. newValue = objValue;
  21720. if (isArguments(objValue)) {
  21721. newValue = toPlainObject(objValue);
  21722. }
  21723. else if (!isObject(objValue) || isFunction(objValue)) {
  21724. newValue = initCloneObject(srcValue);
  21725. }
  21726. }
  21727. else {
  21728. isCommon = false;
  21729. }
  21730. }
  21731. if (isCommon) {
  21732. // Recursively merge objects and arrays (susceptible to call stack limits).
  21733. stack.set(srcValue, newValue);
  21734. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21735. stack['delete'](srcValue);
  21736. }
  21737. assignMergeValue(object, key, newValue);
  21738. }
  21739. /**
  21740. * The base implementation of `_.nth` which doesn't coerce arguments.
  21741. *
  21742. * @private
  21743. * @param {Array} array The array to query.
  21744. * @param {number} n The index of the element to return.
  21745. * @returns {*} Returns the nth element of `array`.
  21746. */
  21747. function baseNth(array, n) {
  21748. var length = array.length;
  21749. if (!length) {
  21750. return;
  21751. }
  21752. n += n < 0 ? length : 0;
  21753. return isIndex(n, length) ? array[n] : undefined;
  21754. }
  21755. /**
  21756. * The base implementation of `_.orderBy` without param guards.
  21757. *
  21758. * @private
  21759. * @param {Array|Object} collection The collection to iterate over.
  21760. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21761. * @param {string[]} orders The sort orders of `iteratees`.
  21762. * @returns {Array} Returns the new sorted array.
  21763. */
  21764. function baseOrderBy(collection, iteratees, orders) {
  21765. var index = -1;
  21766. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21767. var result = baseMap(collection, function(value, key, collection) {
  21768. var criteria = arrayMap(iteratees, function(iteratee) {
  21769. return iteratee(value);
  21770. });
  21771. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21772. });
  21773. return baseSortBy(result, function(object, other) {
  21774. return compareMultiple(object, other, orders);
  21775. });
  21776. }
  21777. /**
  21778. * The base implementation of `_.pick` without support for individual
  21779. * property identifiers.
  21780. *
  21781. * @private
  21782. * @param {Object} object The source object.
  21783. * @param {string[]} paths The property paths to pick.
  21784. * @returns {Object} Returns the new object.
  21785. */
  21786. function basePick(object, paths) {
  21787. return basePickBy(object, paths, function(value, path) {
  21788. return hasIn(object, path);
  21789. });
  21790. }
  21791. /**
  21792. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21793. *
  21794. * @private
  21795. * @param {Object} object The source object.
  21796. * @param {string[]} paths The property paths to pick.
  21797. * @param {Function} predicate The function invoked per property.
  21798. * @returns {Object} Returns the new object.
  21799. */
  21800. function basePickBy(object, paths, predicate) {
  21801. var index = -1,
  21802. length = paths.length,
  21803. result = {};
  21804. while (++index < length) {
  21805. var path = paths[index],
  21806. value = baseGet(object, path);
  21807. if (predicate(value, path)) {
  21808. baseSet(result, castPath(path, object), value);
  21809. }
  21810. }
  21811. return result;
  21812. }
  21813. /**
  21814. * A specialized version of `baseProperty` which supports deep paths.
  21815. *
  21816. * @private
  21817. * @param {Array|string} path The path of the property to get.
  21818. * @returns {Function} Returns the new accessor function.
  21819. */
  21820. function basePropertyDeep(path) {
  21821. return function(object) {
  21822. return baseGet(object, path);
  21823. };
  21824. }
  21825. /**
  21826. * The base implementation of `_.pullAllBy` without support for iteratee
  21827. * shorthands.
  21828. *
  21829. * @private
  21830. * @param {Array} array The array to modify.
  21831. * @param {Array} values The values to remove.
  21832. * @param {Function} [iteratee] The iteratee invoked per element.
  21833. * @param {Function} [comparator] The comparator invoked per element.
  21834. * @returns {Array} Returns `array`.
  21835. */
  21836. function basePullAll(array, values, iteratee, comparator) {
  21837. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21838. index = -1,
  21839. length = values.length,
  21840. seen = array;
  21841. if (array === values) {
  21842. values = copyArray(values);
  21843. }
  21844. if (iteratee) {
  21845. seen = arrayMap(array, baseUnary(iteratee));
  21846. }
  21847. while (++index < length) {
  21848. var fromIndex = 0,
  21849. value = values[index],
  21850. computed = iteratee ? iteratee(value) : value;
  21851. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21852. if (seen !== array) {
  21853. splice.call(seen, fromIndex, 1);
  21854. }
  21855. splice.call(array, fromIndex, 1);
  21856. }
  21857. }
  21858. return array;
  21859. }
  21860. /**
  21861. * The base implementation of `_.pullAt` without support for individual
  21862. * indexes or capturing the removed elements.
  21863. *
  21864. * @private
  21865. * @param {Array} array The array to modify.
  21866. * @param {number[]} indexes The indexes of elements to remove.
  21867. * @returns {Array} Returns `array`.
  21868. */
  21869. function basePullAt(array, indexes) {
  21870. var length = array ? indexes.length : 0,
  21871. lastIndex = length - 1;
  21872. while (length--) {
  21873. var index = indexes[length];
  21874. if (length == lastIndex || index !== previous) {
  21875. var previous = index;
  21876. if (isIndex(index)) {
  21877. splice.call(array, index, 1);
  21878. } else {
  21879. baseUnset(array, index);
  21880. }
  21881. }
  21882. }
  21883. return array;
  21884. }
  21885. /**
  21886. * The base implementation of `_.random` without support for returning
  21887. * floating-point numbers.
  21888. *
  21889. * @private
  21890. * @param {number} lower The lower bound.
  21891. * @param {number} upper The upper bound.
  21892. * @returns {number} Returns the random number.
  21893. */
  21894. function baseRandom(lower, upper) {
  21895. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21896. }
  21897. /**
  21898. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21899. * coerce arguments.
  21900. *
  21901. * @private
  21902. * @param {number} start The start of the range.
  21903. * @param {number} end The end of the range.
  21904. * @param {number} step The value to increment or decrement by.
  21905. * @param {boolean} [fromRight] Specify iterating from right to left.
  21906. * @returns {Array} Returns the range of numbers.
  21907. */
  21908. function baseRange(start, end, step, fromRight) {
  21909. var index = -1,
  21910. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21911. result = Array(length);
  21912. while (length--) {
  21913. result[fromRight ? length : ++index] = start;
  21914. start += step;
  21915. }
  21916. return result;
  21917. }
  21918. /**
  21919. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21920. *
  21921. * @private
  21922. * @param {string} string The string to repeat.
  21923. * @param {number} n The number of times to repeat the string.
  21924. * @returns {string} Returns the repeated string.
  21925. */
  21926. function baseRepeat(string, n) {
  21927. var result = '';
  21928. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21929. return result;
  21930. }
  21931. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21932. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21933. do {
  21934. if (n % 2) {
  21935. result += string;
  21936. }
  21937. n = nativeFloor(n / 2);
  21938. if (n) {
  21939. string += string;
  21940. }
  21941. } while (n);
  21942. return result;
  21943. }
  21944. /**
  21945. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21946. *
  21947. * @private
  21948. * @param {Function} func The function to apply a rest parameter to.
  21949. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21950. * @returns {Function} Returns the new function.
  21951. */
  21952. function baseRest(func, start) {
  21953. return setToString(overRest(func, start, identity), func + '');
  21954. }
  21955. /**
  21956. * The base implementation of `_.sample`.
  21957. *
  21958. * @private
  21959. * @param {Array|Object} collection The collection to sample.
  21960. * @returns {*} Returns the random element.
  21961. */
  21962. function baseSample(collection) {
  21963. return arraySample(values(collection));
  21964. }
  21965. /**
  21966. * The base implementation of `_.sampleSize` without param guards.
  21967. *
  21968. * @private
  21969. * @param {Array|Object} collection The collection to sample.
  21970. * @param {number} n The number of elements to sample.
  21971. * @returns {Array} Returns the random elements.
  21972. */
  21973. function baseSampleSize(collection, n) {
  21974. var array = values(collection);
  21975. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21976. }
  21977. /**
  21978. * The base implementation of `_.set`.
  21979. *
  21980. * @private
  21981. * @param {Object} object The object to modify.
  21982. * @param {Array|string} path The path of the property to set.
  21983. * @param {*} value The value to set.
  21984. * @param {Function} [customizer] The function to customize path creation.
  21985. * @returns {Object} Returns `object`.
  21986. */
  21987. function baseSet(object, path, value, customizer) {
  21988. if (!isObject(object)) {
  21989. return object;
  21990. }
  21991. path = castPath(path, object);
  21992. var index = -1,
  21993. length = path.length,
  21994. lastIndex = length - 1,
  21995. nested = object;
  21996. while (nested != null && ++index < length) {
  21997. var key = toKey(path[index]),
  21998. newValue = value;
  21999. if (index != lastIndex) {
  22000. var objValue = nested[key];
  22001. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22002. if (newValue === undefined) {
  22003. newValue = isObject(objValue)
  22004. ? objValue
  22005. : (isIndex(path[index + 1]) ? [] : {});
  22006. }
  22007. }
  22008. assignValue(nested, key, newValue);
  22009. nested = nested[key];
  22010. }
  22011. return object;
  22012. }
  22013. /**
  22014. * The base implementation of `setData` without support for hot loop shorting.
  22015. *
  22016. * @private
  22017. * @param {Function} func The function to associate metadata with.
  22018. * @param {*} data The metadata.
  22019. * @returns {Function} Returns `func`.
  22020. */
  22021. var baseSetData = !metaMap ? identity : function(func, data) {
  22022. metaMap.set(func, data);
  22023. return func;
  22024. };
  22025. /**
  22026. * The base implementation of `setToString` without support for hot loop shorting.
  22027. *
  22028. * @private
  22029. * @param {Function} func The function to modify.
  22030. * @param {Function} string The `toString` result.
  22031. * @returns {Function} Returns `func`.
  22032. */
  22033. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22034. return defineProperty(func, 'toString', {
  22035. 'configurable': true,
  22036. 'enumerable': false,
  22037. 'value': constant(string),
  22038. 'writable': true
  22039. });
  22040. };
  22041. /**
  22042. * The base implementation of `_.shuffle`.
  22043. *
  22044. * @private
  22045. * @param {Array|Object} collection The collection to shuffle.
  22046. * @returns {Array} Returns the new shuffled array.
  22047. */
  22048. function baseShuffle(collection) {
  22049. return shuffleSelf(values(collection));
  22050. }
  22051. /**
  22052. * The base implementation of `_.slice` without an iteratee call guard.
  22053. *
  22054. * @private
  22055. * @param {Array} array The array to slice.
  22056. * @param {number} [start=0] The start position.
  22057. * @param {number} [end=array.length] The end position.
  22058. * @returns {Array} Returns the slice of `array`.
  22059. */
  22060. function baseSlice(array, start, end) {
  22061. var index = -1,
  22062. length = array.length;
  22063. if (start < 0) {
  22064. start = -start > length ? 0 : (length + start);
  22065. }
  22066. end = end > length ? length : end;
  22067. if (end < 0) {
  22068. end += length;
  22069. }
  22070. length = start > end ? 0 : ((end - start) >>> 0);
  22071. start >>>= 0;
  22072. var result = Array(length);
  22073. while (++index < length) {
  22074. result[index] = array[index + start];
  22075. }
  22076. return result;
  22077. }
  22078. /**
  22079. * The base implementation of `_.some` without support for iteratee shorthands.
  22080. *
  22081. * @private
  22082. * @param {Array|Object} collection The collection to iterate over.
  22083. * @param {Function} predicate The function invoked per iteration.
  22084. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22085. * else `false`.
  22086. */
  22087. function baseSome(collection, predicate) {
  22088. var result;
  22089. baseEach(collection, function(value, index, collection) {
  22090. result = predicate(value, index, collection);
  22091. return !result;
  22092. });
  22093. return !!result;
  22094. }
  22095. /**
  22096. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22097. * performs a binary search of `array` to determine the index at which `value`
  22098. * should be inserted into `array` in order to maintain its sort order.
  22099. *
  22100. * @private
  22101. * @param {Array} array The sorted array to inspect.
  22102. * @param {*} value The value to evaluate.
  22103. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22104. * @returns {number} Returns the index at which `value` should be inserted
  22105. * into `array`.
  22106. */
  22107. function baseSortedIndex(array, value, retHighest) {
  22108. var low = 0,
  22109. high = array == null ? low : array.length;
  22110. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22111. while (low < high) {
  22112. var mid = (low + high) >>> 1,
  22113. computed = array[mid];
  22114. if (computed !== null && !isSymbol(computed) &&
  22115. (retHighest ? (computed <= value) : (computed < value))) {
  22116. low = mid + 1;
  22117. } else {
  22118. high = mid;
  22119. }
  22120. }
  22121. return high;
  22122. }
  22123. return baseSortedIndexBy(array, value, identity, retHighest);
  22124. }
  22125. /**
  22126. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22127. * which invokes `iteratee` for `value` and each element of `array` to compute
  22128. * their sort ranking. The iteratee is invoked with one argument; (value).
  22129. *
  22130. * @private
  22131. * @param {Array} array The sorted array to inspect.
  22132. * @param {*} value The value to evaluate.
  22133. * @param {Function} iteratee The iteratee invoked per element.
  22134. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22135. * @returns {number} Returns the index at which `value` should be inserted
  22136. * into `array`.
  22137. */
  22138. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22139. value = iteratee(value);
  22140. var low = 0,
  22141. high = array == null ? 0 : array.length,
  22142. valIsNaN = value !== value,
  22143. valIsNull = value === null,
  22144. valIsSymbol = isSymbol(value),
  22145. valIsUndefined = value === undefined;
  22146. while (low < high) {
  22147. var mid = nativeFloor((low + high) / 2),
  22148. computed = iteratee(array[mid]),
  22149. othIsDefined = computed !== undefined,
  22150. othIsNull = computed === null,
  22151. othIsReflexive = computed === computed,
  22152. othIsSymbol = isSymbol(computed);
  22153. if (valIsNaN) {
  22154. var setLow = retHighest || othIsReflexive;
  22155. } else if (valIsUndefined) {
  22156. setLow = othIsReflexive && (retHighest || othIsDefined);
  22157. } else if (valIsNull) {
  22158. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22159. } else if (valIsSymbol) {
  22160. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22161. } else if (othIsNull || othIsSymbol) {
  22162. setLow = false;
  22163. } else {
  22164. setLow = retHighest ? (computed <= value) : (computed < value);
  22165. }
  22166. if (setLow) {
  22167. low = mid + 1;
  22168. } else {
  22169. high = mid;
  22170. }
  22171. }
  22172. return nativeMin(high, MAX_ARRAY_INDEX);
  22173. }
  22174. /**
  22175. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22176. * support for iteratee shorthands.
  22177. *
  22178. * @private
  22179. * @param {Array} array The array to inspect.
  22180. * @param {Function} [iteratee] The iteratee invoked per element.
  22181. * @returns {Array} Returns the new duplicate free array.
  22182. */
  22183. function baseSortedUniq(array, iteratee) {
  22184. var index = -1,
  22185. length = array.length,
  22186. resIndex = 0,
  22187. result = [];
  22188. while (++index < length) {
  22189. var value = array[index],
  22190. computed = iteratee ? iteratee(value) : value;
  22191. if (!index || !eq(computed, seen)) {
  22192. var seen = computed;
  22193. result[resIndex++] = value === 0 ? 0 : value;
  22194. }
  22195. }
  22196. return result;
  22197. }
  22198. /**
  22199. * The base implementation of `_.toNumber` which doesn't ensure correct
  22200. * conversions of binary, hexadecimal, or octal string values.
  22201. *
  22202. * @private
  22203. * @param {*} value The value to process.
  22204. * @returns {number} Returns the number.
  22205. */
  22206. function baseToNumber(value) {
  22207. if (typeof value == 'number') {
  22208. return value;
  22209. }
  22210. if (isSymbol(value)) {
  22211. return NAN;
  22212. }
  22213. return +value;
  22214. }
  22215. /**
  22216. * The base implementation of `_.toString` which doesn't convert nullish
  22217. * values to empty strings.
  22218. *
  22219. * @private
  22220. * @param {*} value The value to process.
  22221. * @returns {string} Returns the string.
  22222. */
  22223. function baseToString(value) {
  22224. // Exit early for strings to avoid a performance hit in some environments.
  22225. if (typeof value == 'string') {
  22226. return value;
  22227. }
  22228. if (isArray(value)) {
  22229. // Recursively convert values (susceptible to call stack limits).
  22230. return arrayMap(value, baseToString) + '';
  22231. }
  22232. if (isSymbol(value)) {
  22233. return symbolToString ? symbolToString.call(value) : '';
  22234. }
  22235. var result = (value + '');
  22236. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22237. }
  22238. /**
  22239. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22240. *
  22241. * @private
  22242. * @param {Array} array The array to inspect.
  22243. * @param {Function} [iteratee] The iteratee invoked per element.
  22244. * @param {Function} [comparator] The comparator invoked per element.
  22245. * @returns {Array} Returns the new duplicate free array.
  22246. */
  22247. function baseUniq(array, iteratee, comparator) {
  22248. var index = -1,
  22249. includes = arrayIncludes,
  22250. length = array.length,
  22251. isCommon = true,
  22252. result = [],
  22253. seen = result;
  22254. if (comparator) {
  22255. isCommon = false;
  22256. includes = arrayIncludesWith;
  22257. }
  22258. else if (length >= LARGE_ARRAY_SIZE) {
  22259. var set = iteratee ? null : createSet(array);
  22260. if (set) {
  22261. return setToArray(set);
  22262. }
  22263. isCommon = false;
  22264. includes = cacheHas;
  22265. seen = new SetCache;
  22266. }
  22267. else {
  22268. seen = iteratee ? [] : result;
  22269. }
  22270. outer:
  22271. while (++index < length) {
  22272. var value = array[index],
  22273. computed = iteratee ? iteratee(value) : value;
  22274. value = (comparator || value !== 0) ? value : 0;
  22275. if (isCommon && computed === computed) {
  22276. var seenIndex = seen.length;
  22277. while (seenIndex--) {
  22278. if (seen[seenIndex] === computed) {
  22279. continue outer;
  22280. }
  22281. }
  22282. if (iteratee) {
  22283. seen.push(computed);
  22284. }
  22285. result.push(value);
  22286. }
  22287. else if (!includes(seen, computed, comparator)) {
  22288. if (seen !== result) {
  22289. seen.push(computed);
  22290. }
  22291. result.push(value);
  22292. }
  22293. }
  22294. return result;
  22295. }
  22296. /**
  22297. * The base implementation of `_.unset`.
  22298. *
  22299. * @private
  22300. * @param {Object} object The object to modify.
  22301. * @param {Array|string} path The property path to unset.
  22302. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22303. */
  22304. function baseUnset(object, path) {
  22305. path = castPath(path, object);
  22306. object = parent(object, path);
  22307. return object == null || delete object[toKey(last(path))];
  22308. }
  22309. /**
  22310. * The base implementation of `_.update`.
  22311. *
  22312. * @private
  22313. * @param {Object} object The object to modify.
  22314. * @param {Array|string} path The path of the property to update.
  22315. * @param {Function} updater The function to produce the updated value.
  22316. * @param {Function} [customizer] The function to customize path creation.
  22317. * @returns {Object} Returns `object`.
  22318. */
  22319. function baseUpdate(object, path, updater, customizer) {
  22320. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22321. }
  22322. /**
  22323. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22324. * without support for iteratee shorthands.
  22325. *
  22326. * @private
  22327. * @param {Array} array The array to query.
  22328. * @param {Function} predicate The function invoked per iteration.
  22329. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22330. * @param {boolean} [fromRight] Specify iterating from right to left.
  22331. * @returns {Array} Returns the slice of `array`.
  22332. */
  22333. function baseWhile(array, predicate, isDrop, fromRight) {
  22334. var length = array.length,
  22335. index = fromRight ? length : -1;
  22336. while ((fromRight ? index-- : ++index < length) &&
  22337. predicate(array[index], index, array)) {}
  22338. return isDrop
  22339. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22340. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22341. }
  22342. /**
  22343. * The base implementation of `wrapperValue` which returns the result of
  22344. * performing a sequence of actions on the unwrapped `value`, where each
  22345. * successive action is supplied the return value of the previous.
  22346. *
  22347. * @private
  22348. * @param {*} value The unwrapped value.
  22349. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22350. * @returns {*} Returns the resolved value.
  22351. */
  22352. function baseWrapperValue(value, actions) {
  22353. var result = value;
  22354. if (result instanceof LazyWrapper) {
  22355. result = result.value();
  22356. }
  22357. return arrayReduce(actions, function(result, action) {
  22358. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22359. }, result);
  22360. }
  22361. /**
  22362. * The base implementation of methods like `_.xor`, without support for
  22363. * iteratee shorthands, that accepts an array of arrays to inspect.
  22364. *
  22365. * @private
  22366. * @param {Array} arrays The arrays to inspect.
  22367. * @param {Function} [iteratee] The iteratee invoked per element.
  22368. * @param {Function} [comparator] The comparator invoked per element.
  22369. * @returns {Array} Returns the new array of values.
  22370. */
  22371. function baseXor(arrays, iteratee, comparator) {
  22372. var length = arrays.length;
  22373. if (length < 2) {
  22374. return length ? baseUniq(arrays[0]) : [];
  22375. }
  22376. var index = -1,
  22377. result = Array(length);
  22378. while (++index < length) {
  22379. var array = arrays[index],
  22380. othIndex = -1;
  22381. while (++othIndex < length) {
  22382. if (othIndex != index) {
  22383. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22384. }
  22385. }
  22386. }
  22387. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22388. }
  22389. /**
  22390. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22391. *
  22392. * @private
  22393. * @param {Array} props The property identifiers.
  22394. * @param {Array} values The property values.
  22395. * @param {Function} assignFunc The function to assign values.
  22396. * @returns {Object} Returns the new object.
  22397. */
  22398. function baseZipObject(props, values, assignFunc) {
  22399. var index = -1,
  22400. length = props.length,
  22401. valsLength = values.length,
  22402. result = {};
  22403. while (++index < length) {
  22404. var value = index < valsLength ? values[index] : undefined;
  22405. assignFunc(result, props[index], value);
  22406. }
  22407. return result;
  22408. }
  22409. /**
  22410. * Casts `value` to an empty array if it's not an array like object.
  22411. *
  22412. * @private
  22413. * @param {*} value The value to inspect.
  22414. * @returns {Array|Object} Returns the cast array-like object.
  22415. */
  22416. function castArrayLikeObject(value) {
  22417. return isArrayLikeObject(value) ? value : [];
  22418. }
  22419. /**
  22420. * Casts `value` to `identity` if it's not a function.
  22421. *
  22422. * @private
  22423. * @param {*} value The value to inspect.
  22424. * @returns {Function} Returns cast function.
  22425. */
  22426. function castFunction(value) {
  22427. return typeof value == 'function' ? value : identity;
  22428. }
  22429. /**
  22430. * Casts `value` to a path array if it's not one.
  22431. *
  22432. * @private
  22433. * @param {*} value The value to inspect.
  22434. * @param {Object} [object] The object to query keys on.
  22435. * @returns {Array} Returns the cast property path array.
  22436. */
  22437. function castPath(value, object) {
  22438. if (isArray(value)) {
  22439. return value;
  22440. }
  22441. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22442. }
  22443. /**
  22444. * A `baseRest` alias which can be replaced with `identity` by module
  22445. * replacement plugins.
  22446. *
  22447. * @private
  22448. * @type {Function}
  22449. * @param {Function} func The function to apply a rest parameter to.
  22450. * @returns {Function} Returns the new function.
  22451. */
  22452. var castRest = baseRest;
  22453. /**
  22454. * Casts `array` to a slice if it's needed.
  22455. *
  22456. * @private
  22457. * @param {Array} array The array to inspect.
  22458. * @param {number} start The start position.
  22459. * @param {number} [end=array.length] The end position.
  22460. * @returns {Array} Returns the cast slice.
  22461. */
  22462. function castSlice(array, start, end) {
  22463. var length = array.length;
  22464. end = end === undefined ? length : end;
  22465. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22466. }
  22467. /**
  22468. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22469. *
  22470. * @private
  22471. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22472. */
  22473. var clearTimeout = ctxClearTimeout || function(id) {
  22474. return root.clearTimeout(id);
  22475. };
  22476. /**
  22477. * Creates a clone of `buffer`.
  22478. *
  22479. * @private
  22480. * @param {Buffer} buffer The buffer to clone.
  22481. * @param {boolean} [isDeep] Specify a deep clone.
  22482. * @returns {Buffer} Returns the cloned buffer.
  22483. */
  22484. function cloneBuffer(buffer, isDeep) {
  22485. if (isDeep) {
  22486. return buffer.slice();
  22487. }
  22488. var length = buffer.length,
  22489. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22490. buffer.copy(result);
  22491. return result;
  22492. }
  22493. /**
  22494. * Creates a clone of `arrayBuffer`.
  22495. *
  22496. * @private
  22497. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22498. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22499. */
  22500. function cloneArrayBuffer(arrayBuffer) {
  22501. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22502. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22503. return result;
  22504. }
  22505. /**
  22506. * Creates a clone of `dataView`.
  22507. *
  22508. * @private
  22509. * @param {Object} dataView The data view to clone.
  22510. * @param {boolean} [isDeep] Specify a deep clone.
  22511. * @returns {Object} Returns the cloned data view.
  22512. */
  22513. function cloneDataView(dataView, isDeep) {
  22514. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22515. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22516. }
  22517. /**
  22518. * Creates a clone of `regexp`.
  22519. *
  22520. * @private
  22521. * @param {Object} regexp The regexp to clone.
  22522. * @returns {Object} Returns the cloned regexp.
  22523. */
  22524. function cloneRegExp(regexp) {
  22525. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22526. result.lastIndex = regexp.lastIndex;
  22527. return result;
  22528. }
  22529. /**
  22530. * Creates a clone of the `symbol` object.
  22531. *
  22532. * @private
  22533. * @param {Object} symbol The symbol object to clone.
  22534. * @returns {Object} Returns the cloned symbol object.
  22535. */
  22536. function cloneSymbol(symbol) {
  22537. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22538. }
  22539. /**
  22540. * Creates a clone of `typedArray`.
  22541. *
  22542. * @private
  22543. * @param {Object} typedArray The typed array to clone.
  22544. * @param {boolean} [isDeep] Specify a deep clone.
  22545. * @returns {Object} Returns the cloned typed array.
  22546. */
  22547. function cloneTypedArray(typedArray, isDeep) {
  22548. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22549. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22550. }
  22551. /**
  22552. * Compares values to sort them in ascending order.
  22553. *
  22554. * @private
  22555. * @param {*} value The value to compare.
  22556. * @param {*} other The other value to compare.
  22557. * @returns {number} Returns the sort order indicator for `value`.
  22558. */
  22559. function compareAscending(value, other) {
  22560. if (value !== other) {
  22561. var valIsDefined = value !== undefined,
  22562. valIsNull = value === null,
  22563. valIsReflexive = value === value,
  22564. valIsSymbol = isSymbol(value);
  22565. var othIsDefined = other !== undefined,
  22566. othIsNull = other === null,
  22567. othIsReflexive = other === other,
  22568. othIsSymbol = isSymbol(other);
  22569. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22570. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22571. (valIsNull && othIsDefined && othIsReflexive) ||
  22572. (!valIsDefined && othIsReflexive) ||
  22573. !valIsReflexive) {
  22574. return 1;
  22575. }
  22576. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22577. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22578. (othIsNull && valIsDefined && valIsReflexive) ||
  22579. (!othIsDefined && valIsReflexive) ||
  22580. !othIsReflexive) {
  22581. return -1;
  22582. }
  22583. }
  22584. return 0;
  22585. }
  22586. /**
  22587. * Used by `_.orderBy` to compare multiple properties of a value to another
  22588. * and stable sort them.
  22589. *
  22590. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22591. * specify an order of "desc" for descending or "asc" for ascending sort order
  22592. * of corresponding values.
  22593. *
  22594. * @private
  22595. * @param {Object} object The object to compare.
  22596. * @param {Object} other The other object to compare.
  22597. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22598. * @returns {number} Returns the sort order indicator for `object`.
  22599. */
  22600. function compareMultiple(object, other, orders) {
  22601. var index = -1,
  22602. objCriteria = object.criteria,
  22603. othCriteria = other.criteria,
  22604. length = objCriteria.length,
  22605. ordersLength = orders.length;
  22606. while (++index < length) {
  22607. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22608. if (result) {
  22609. if (index >= ordersLength) {
  22610. return result;
  22611. }
  22612. var order = orders[index];
  22613. return result * (order == 'desc' ? -1 : 1);
  22614. }
  22615. }
  22616. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22617. // that causes it, under certain circumstances, to provide the same value for
  22618. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22619. // for more details.
  22620. //
  22621. // This also ensures a stable sort in V8 and other engines.
  22622. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22623. return object.index - other.index;
  22624. }
  22625. /**
  22626. * Creates an array that is the composition of partially applied arguments,
  22627. * placeholders, and provided arguments into a single array of arguments.
  22628. *
  22629. * @private
  22630. * @param {Array} args The provided arguments.
  22631. * @param {Array} partials The arguments to prepend to those provided.
  22632. * @param {Array} holders The `partials` placeholder indexes.
  22633. * @params {boolean} [isCurried] Specify composing for a curried function.
  22634. * @returns {Array} Returns the new array of composed arguments.
  22635. */
  22636. function composeArgs(args, partials, holders, isCurried) {
  22637. var argsIndex = -1,
  22638. argsLength = args.length,
  22639. holdersLength = holders.length,
  22640. leftIndex = -1,
  22641. leftLength = partials.length,
  22642. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22643. result = Array(leftLength + rangeLength),
  22644. isUncurried = !isCurried;
  22645. while (++leftIndex < leftLength) {
  22646. result[leftIndex] = partials[leftIndex];
  22647. }
  22648. while (++argsIndex < holdersLength) {
  22649. if (isUncurried || argsIndex < argsLength) {
  22650. result[holders[argsIndex]] = args[argsIndex];
  22651. }
  22652. }
  22653. while (rangeLength--) {
  22654. result[leftIndex++] = args[argsIndex++];
  22655. }
  22656. return result;
  22657. }
  22658. /**
  22659. * This function is like `composeArgs` except that the arguments composition
  22660. * is tailored for `_.partialRight`.
  22661. *
  22662. * @private
  22663. * @param {Array} args The provided arguments.
  22664. * @param {Array} partials The arguments to append to those provided.
  22665. * @param {Array} holders The `partials` placeholder indexes.
  22666. * @params {boolean} [isCurried] Specify composing for a curried function.
  22667. * @returns {Array} Returns the new array of composed arguments.
  22668. */
  22669. function composeArgsRight(args, partials, holders, isCurried) {
  22670. var argsIndex = -1,
  22671. argsLength = args.length,
  22672. holdersIndex = -1,
  22673. holdersLength = holders.length,
  22674. rightIndex = -1,
  22675. rightLength = partials.length,
  22676. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22677. result = Array(rangeLength + rightLength),
  22678. isUncurried = !isCurried;
  22679. while (++argsIndex < rangeLength) {
  22680. result[argsIndex] = args[argsIndex];
  22681. }
  22682. var offset = argsIndex;
  22683. while (++rightIndex < rightLength) {
  22684. result[offset + rightIndex] = partials[rightIndex];
  22685. }
  22686. while (++holdersIndex < holdersLength) {
  22687. if (isUncurried || argsIndex < argsLength) {
  22688. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22689. }
  22690. }
  22691. return result;
  22692. }
  22693. /**
  22694. * Copies the values of `source` to `array`.
  22695. *
  22696. * @private
  22697. * @param {Array} source The array to copy values from.
  22698. * @param {Array} [array=[]] The array to copy values to.
  22699. * @returns {Array} Returns `array`.
  22700. */
  22701. function copyArray(source, array) {
  22702. var index = -1,
  22703. length = source.length;
  22704. array || (array = Array(length));
  22705. while (++index < length) {
  22706. array[index] = source[index];
  22707. }
  22708. return array;
  22709. }
  22710. /**
  22711. * Copies properties of `source` to `object`.
  22712. *
  22713. * @private
  22714. * @param {Object} source The object to copy properties from.
  22715. * @param {Array} props The property identifiers to copy.
  22716. * @param {Object} [object={}] The object to copy properties to.
  22717. * @param {Function} [customizer] The function to customize copied values.
  22718. * @returns {Object} Returns `object`.
  22719. */
  22720. function copyObject(source, props, object, customizer) {
  22721. var isNew = !object;
  22722. object || (object = {});
  22723. var index = -1,
  22724. length = props.length;
  22725. while (++index < length) {
  22726. var key = props[index];
  22727. var newValue = customizer
  22728. ? customizer(object[key], source[key], key, object, source)
  22729. : undefined;
  22730. if (newValue === undefined) {
  22731. newValue = source[key];
  22732. }
  22733. if (isNew) {
  22734. baseAssignValue(object, key, newValue);
  22735. } else {
  22736. assignValue(object, key, newValue);
  22737. }
  22738. }
  22739. return object;
  22740. }
  22741. /**
  22742. * Copies own symbols of `source` to `object`.
  22743. *
  22744. * @private
  22745. * @param {Object} source The object to copy symbols from.
  22746. * @param {Object} [object={}] The object to copy symbols to.
  22747. * @returns {Object} Returns `object`.
  22748. */
  22749. function copySymbols(source, object) {
  22750. return copyObject(source, getSymbols(source), object);
  22751. }
  22752. /**
  22753. * Copies own and inherited symbols of `source` to `object`.
  22754. *
  22755. * @private
  22756. * @param {Object} source The object to copy symbols from.
  22757. * @param {Object} [object={}] The object to copy symbols to.
  22758. * @returns {Object} Returns `object`.
  22759. */
  22760. function copySymbolsIn(source, object) {
  22761. return copyObject(source, getSymbolsIn(source), object);
  22762. }
  22763. /**
  22764. * Creates a function like `_.groupBy`.
  22765. *
  22766. * @private
  22767. * @param {Function} setter The function to set accumulator values.
  22768. * @param {Function} [initializer] The accumulator object initializer.
  22769. * @returns {Function} Returns the new aggregator function.
  22770. */
  22771. function createAggregator(setter, initializer) {
  22772. return function(collection, iteratee) {
  22773. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22774. accumulator = initializer ? initializer() : {};
  22775. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22776. };
  22777. }
  22778. /**
  22779. * Creates a function like `_.assign`.
  22780. *
  22781. * @private
  22782. * @param {Function} assigner The function to assign values.
  22783. * @returns {Function} Returns the new assigner function.
  22784. */
  22785. function createAssigner(assigner) {
  22786. return baseRest(function(object, sources) {
  22787. var index = -1,
  22788. length = sources.length,
  22789. customizer = length > 1 ? sources[length - 1] : undefined,
  22790. guard = length > 2 ? sources[2] : undefined;
  22791. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22792. ? (length--, customizer)
  22793. : undefined;
  22794. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22795. customizer = length < 3 ? undefined : customizer;
  22796. length = 1;
  22797. }
  22798. object = Object(object);
  22799. while (++index < length) {
  22800. var source = sources[index];
  22801. if (source) {
  22802. assigner(object, source, index, customizer);
  22803. }
  22804. }
  22805. return object;
  22806. });
  22807. }
  22808. /**
  22809. * Creates a `baseEach` or `baseEachRight` function.
  22810. *
  22811. * @private
  22812. * @param {Function} eachFunc The function to iterate over a collection.
  22813. * @param {boolean} [fromRight] Specify iterating from right to left.
  22814. * @returns {Function} Returns the new base function.
  22815. */
  22816. function createBaseEach(eachFunc, fromRight) {
  22817. return function(collection, iteratee) {
  22818. if (collection == null) {
  22819. return collection;
  22820. }
  22821. if (!isArrayLike(collection)) {
  22822. return eachFunc(collection, iteratee);
  22823. }
  22824. var length = collection.length,
  22825. index = fromRight ? length : -1,
  22826. iterable = Object(collection);
  22827. while ((fromRight ? index-- : ++index < length)) {
  22828. if (iteratee(iterable[index], index, iterable) === false) {
  22829. break;
  22830. }
  22831. }
  22832. return collection;
  22833. };
  22834. }
  22835. /**
  22836. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22837. *
  22838. * @private
  22839. * @param {boolean} [fromRight] Specify iterating from right to left.
  22840. * @returns {Function} Returns the new base function.
  22841. */
  22842. function createBaseFor(fromRight) {
  22843. return function(object, iteratee, keysFunc) {
  22844. var index = -1,
  22845. iterable = Object(object),
  22846. props = keysFunc(object),
  22847. length = props.length;
  22848. while (length--) {
  22849. var key = props[fromRight ? length : ++index];
  22850. if (iteratee(iterable[key], key, iterable) === false) {
  22851. break;
  22852. }
  22853. }
  22854. return object;
  22855. };
  22856. }
  22857. /**
  22858. * Creates a function that wraps `func` to invoke it with the optional `this`
  22859. * binding of `thisArg`.
  22860. *
  22861. * @private
  22862. * @param {Function} func The function to wrap.
  22863. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22864. * @param {*} [thisArg] The `this` binding of `func`.
  22865. * @returns {Function} Returns the new wrapped function.
  22866. */
  22867. function createBind(func, bitmask, thisArg) {
  22868. var isBind = bitmask & WRAP_BIND_FLAG,
  22869. Ctor = createCtor(func);
  22870. function wrapper() {
  22871. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22872. return fn.apply(isBind ? thisArg : this, arguments);
  22873. }
  22874. return wrapper;
  22875. }
  22876. /**
  22877. * Creates a function like `_.lowerFirst`.
  22878. *
  22879. * @private
  22880. * @param {string} methodName The name of the `String` case method to use.
  22881. * @returns {Function} Returns the new case function.
  22882. */
  22883. function createCaseFirst(methodName) {
  22884. return function(string) {
  22885. string = toString(string);
  22886. var strSymbols = hasUnicode(string)
  22887. ? stringToArray(string)
  22888. : undefined;
  22889. var chr = strSymbols
  22890. ? strSymbols[0]
  22891. : string.charAt(0);
  22892. var trailing = strSymbols
  22893. ? castSlice(strSymbols, 1).join('')
  22894. : string.slice(1);
  22895. return chr[methodName]() + trailing;
  22896. };
  22897. }
  22898. /**
  22899. * Creates a function like `_.camelCase`.
  22900. *
  22901. * @private
  22902. * @param {Function} callback The function to combine each word.
  22903. * @returns {Function} Returns the new compounder function.
  22904. */
  22905. function createCompounder(callback) {
  22906. return function(string) {
  22907. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22908. };
  22909. }
  22910. /**
  22911. * Creates a function that produces an instance of `Ctor` regardless of
  22912. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22913. *
  22914. * @private
  22915. * @param {Function} Ctor The constructor to wrap.
  22916. * @returns {Function} Returns the new wrapped function.
  22917. */
  22918. function createCtor(Ctor) {
  22919. return function() {
  22920. // Use a `switch` statement to work with class constructors. See
  22921. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22922. // for more details.
  22923. var args = arguments;
  22924. switch (args.length) {
  22925. case 0: return new Ctor;
  22926. case 1: return new Ctor(args[0]);
  22927. case 2: return new Ctor(args[0], args[1]);
  22928. case 3: return new Ctor(args[0], args[1], args[2]);
  22929. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22930. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22931. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22932. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22933. }
  22934. var thisBinding = baseCreate(Ctor.prototype),
  22935. result = Ctor.apply(thisBinding, args);
  22936. // Mimic the constructor's `return` behavior.
  22937. // See https://es5.github.io/#x13.2.2 for more details.
  22938. return isObject(result) ? result : thisBinding;
  22939. };
  22940. }
  22941. /**
  22942. * Creates a function that wraps `func` to enable currying.
  22943. *
  22944. * @private
  22945. * @param {Function} func The function to wrap.
  22946. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22947. * @param {number} arity The arity of `func`.
  22948. * @returns {Function} Returns the new wrapped function.
  22949. */
  22950. function createCurry(func, bitmask, arity) {
  22951. var Ctor = createCtor(func);
  22952. function wrapper() {
  22953. var length = arguments.length,
  22954. args = Array(length),
  22955. index = length,
  22956. placeholder = getHolder(wrapper);
  22957. while (index--) {
  22958. args[index] = arguments[index];
  22959. }
  22960. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22961. ? []
  22962. : replaceHolders(args, placeholder);
  22963. length -= holders.length;
  22964. if (length < arity) {
  22965. return createRecurry(
  22966. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22967. args, holders, undefined, undefined, arity - length);
  22968. }
  22969. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22970. return apply(fn, this, args);
  22971. }
  22972. return wrapper;
  22973. }
  22974. /**
  22975. * Creates a `_.find` or `_.findLast` function.
  22976. *
  22977. * @private
  22978. * @param {Function} findIndexFunc The function to find the collection index.
  22979. * @returns {Function} Returns the new find function.
  22980. */
  22981. function createFind(findIndexFunc) {
  22982. return function(collection, predicate, fromIndex) {
  22983. var iterable = Object(collection);
  22984. if (!isArrayLike(collection)) {
  22985. var iteratee = getIteratee(predicate, 3);
  22986. collection = keys(collection);
  22987. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22988. }
  22989. var index = findIndexFunc(collection, predicate, fromIndex);
  22990. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22991. };
  22992. }
  22993. /**
  22994. * Creates a `_.flow` or `_.flowRight` function.
  22995. *
  22996. * @private
  22997. * @param {boolean} [fromRight] Specify iterating from right to left.
  22998. * @returns {Function} Returns the new flow function.
  22999. */
  23000. function createFlow(fromRight) {
  23001. return flatRest(function(funcs) {
  23002. var length = funcs.length,
  23003. index = length,
  23004. prereq = LodashWrapper.prototype.thru;
  23005. if (fromRight) {
  23006. funcs.reverse();
  23007. }
  23008. while (index--) {
  23009. var func = funcs[index];
  23010. if (typeof func != 'function') {
  23011. throw new TypeError(FUNC_ERROR_TEXT);
  23012. }
  23013. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23014. var wrapper = new LodashWrapper([], true);
  23015. }
  23016. }
  23017. index = wrapper ? index : length;
  23018. while (++index < length) {
  23019. func = funcs[index];
  23020. var funcName = getFuncName(func),
  23021. data = funcName == 'wrapper' ? getData(func) : undefined;
  23022. if (data && isLaziable(data[0]) &&
  23023. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23024. !data[4].length && data[9] == 1
  23025. ) {
  23026. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23027. } else {
  23028. wrapper = (func.length == 1 && isLaziable(func))
  23029. ? wrapper[funcName]()
  23030. : wrapper.thru(func);
  23031. }
  23032. }
  23033. return function() {
  23034. var args = arguments,
  23035. value = args[0];
  23036. if (wrapper && args.length == 1 && isArray(value)) {
  23037. return wrapper.plant(value).value();
  23038. }
  23039. var index = 0,
  23040. result = length ? funcs[index].apply(this, args) : value;
  23041. while (++index < length) {
  23042. result = funcs[index].call(this, result);
  23043. }
  23044. return result;
  23045. };
  23046. });
  23047. }
  23048. /**
  23049. * Creates a function that wraps `func` to invoke it with optional `this`
  23050. * binding of `thisArg`, partial application, and currying.
  23051. *
  23052. * @private
  23053. * @param {Function|string} func The function or method name to wrap.
  23054. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23055. * @param {*} [thisArg] The `this` binding of `func`.
  23056. * @param {Array} [partials] The arguments to prepend to those provided to
  23057. * the new function.
  23058. * @param {Array} [holders] The `partials` placeholder indexes.
  23059. * @param {Array} [partialsRight] The arguments to append to those provided
  23060. * to the new function.
  23061. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23062. * @param {Array} [argPos] The argument positions of the new function.
  23063. * @param {number} [ary] The arity cap of `func`.
  23064. * @param {number} [arity] The arity of `func`.
  23065. * @returns {Function} Returns the new wrapped function.
  23066. */
  23067. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23068. var isAry = bitmask & WRAP_ARY_FLAG,
  23069. isBind = bitmask & WRAP_BIND_FLAG,
  23070. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23071. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23072. isFlip = bitmask & WRAP_FLIP_FLAG,
  23073. Ctor = isBindKey ? undefined : createCtor(func);
  23074. function wrapper() {
  23075. var length = arguments.length,
  23076. args = Array(length),
  23077. index = length;
  23078. while (index--) {
  23079. args[index] = arguments[index];
  23080. }
  23081. if (isCurried) {
  23082. var placeholder = getHolder(wrapper),
  23083. holdersCount = countHolders(args, placeholder);
  23084. }
  23085. if (partials) {
  23086. args = composeArgs(args, partials, holders, isCurried);
  23087. }
  23088. if (partialsRight) {
  23089. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23090. }
  23091. length -= holdersCount;
  23092. if (isCurried && length < arity) {
  23093. var newHolders = replaceHolders(args, placeholder);
  23094. return createRecurry(
  23095. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23096. args, newHolders, argPos, ary, arity - length
  23097. );
  23098. }
  23099. var thisBinding = isBind ? thisArg : this,
  23100. fn = isBindKey ? thisBinding[func] : func;
  23101. length = args.length;
  23102. if (argPos) {
  23103. args = reorder(args, argPos);
  23104. } else if (isFlip && length > 1) {
  23105. args.reverse();
  23106. }
  23107. if (isAry && ary < length) {
  23108. args.length = ary;
  23109. }
  23110. if (this && this !== root && this instanceof wrapper) {
  23111. fn = Ctor || createCtor(fn);
  23112. }
  23113. return fn.apply(thisBinding, args);
  23114. }
  23115. return wrapper;
  23116. }
  23117. /**
  23118. * Creates a function like `_.invertBy`.
  23119. *
  23120. * @private
  23121. * @param {Function} setter The function to set accumulator values.
  23122. * @param {Function} toIteratee The function to resolve iteratees.
  23123. * @returns {Function} Returns the new inverter function.
  23124. */
  23125. function createInverter(setter, toIteratee) {
  23126. return function(object, iteratee) {
  23127. return baseInverter(object, setter, toIteratee(iteratee), {});
  23128. };
  23129. }
  23130. /**
  23131. * Creates a function that performs a mathematical operation on two values.
  23132. *
  23133. * @private
  23134. * @param {Function} operator The function to perform the operation.
  23135. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23136. * @returns {Function} Returns the new mathematical operation function.
  23137. */
  23138. function createMathOperation(operator, defaultValue) {
  23139. return function(value, other) {
  23140. var result;
  23141. if (value === undefined && other === undefined) {
  23142. return defaultValue;
  23143. }
  23144. if (value !== undefined) {
  23145. result = value;
  23146. }
  23147. if (other !== undefined) {
  23148. if (result === undefined) {
  23149. return other;
  23150. }
  23151. if (typeof value == 'string' || typeof other == 'string') {
  23152. value = baseToString(value);
  23153. other = baseToString(other);
  23154. } else {
  23155. value = baseToNumber(value);
  23156. other = baseToNumber(other);
  23157. }
  23158. result = operator(value, other);
  23159. }
  23160. return result;
  23161. };
  23162. }
  23163. /**
  23164. * Creates a function like `_.over`.
  23165. *
  23166. * @private
  23167. * @param {Function} arrayFunc The function to iterate over iteratees.
  23168. * @returns {Function} Returns the new over function.
  23169. */
  23170. function createOver(arrayFunc) {
  23171. return flatRest(function(iteratees) {
  23172. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23173. return baseRest(function(args) {
  23174. var thisArg = this;
  23175. return arrayFunc(iteratees, function(iteratee) {
  23176. return apply(iteratee, thisArg, args);
  23177. });
  23178. });
  23179. });
  23180. }
  23181. /**
  23182. * Creates the padding for `string` based on `length`. The `chars` string
  23183. * is truncated if the number of characters exceeds `length`.
  23184. *
  23185. * @private
  23186. * @param {number} length The padding length.
  23187. * @param {string} [chars=' '] The string used as padding.
  23188. * @returns {string} Returns the padding for `string`.
  23189. */
  23190. function createPadding(length, chars) {
  23191. chars = chars === undefined ? ' ' : baseToString(chars);
  23192. var charsLength = chars.length;
  23193. if (charsLength < 2) {
  23194. return charsLength ? baseRepeat(chars, length) : chars;
  23195. }
  23196. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23197. return hasUnicode(chars)
  23198. ? castSlice(stringToArray(result), 0, length).join('')
  23199. : result.slice(0, length);
  23200. }
  23201. /**
  23202. * Creates a function that wraps `func` to invoke it with the `this` binding
  23203. * of `thisArg` and `partials` prepended to the arguments it receives.
  23204. *
  23205. * @private
  23206. * @param {Function} func The function to wrap.
  23207. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23208. * @param {*} thisArg The `this` binding of `func`.
  23209. * @param {Array} partials The arguments to prepend to those provided to
  23210. * the new function.
  23211. * @returns {Function} Returns the new wrapped function.
  23212. */
  23213. function createPartial(func, bitmask, thisArg, partials) {
  23214. var isBind = bitmask & WRAP_BIND_FLAG,
  23215. Ctor = createCtor(func);
  23216. function wrapper() {
  23217. var argsIndex = -1,
  23218. argsLength = arguments.length,
  23219. leftIndex = -1,
  23220. leftLength = partials.length,
  23221. args = Array(leftLength + argsLength),
  23222. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23223. while (++leftIndex < leftLength) {
  23224. args[leftIndex] = partials[leftIndex];
  23225. }
  23226. while (argsLength--) {
  23227. args[leftIndex++] = arguments[++argsIndex];
  23228. }
  23229. return apply(fn, isBind ? thisArg : this, args);
  23230. }
  23231. return wrapper;
  23232. }
  23233. /**
  23234. * Creates a `_.range` or `_.rangeRight` function.
  23235. *
  23236. * @private
  23237. * @param {boolean} [fromRight] Specify iterating from right to left.
  23238. * @returns {Function} Returns the new range function.
  23239. */
  23240. function createRange(fromRight) {
  23241. return function(start, end, step) {
  23242. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23243. end = step = undefined;
  23244. }
  23245. // Ensure the sign of `-0` is preserved.
  23246. start = toFinite(start);
  23247. if (end === undefined) {
  23248. end = start;
  23249. start = 0;
  23250. } else {
  23251. end = toFinite(end);
  23252. }
  23253. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23254. return baseRange(start, end, step, fromRight);
  23255. };
  23256. }
  23257. /**
  23258. * Creates a function that performs a relational operation on two values.
  23259. *
  23260. * @private
  23261. * @param {Function} operator The function to perform the operation.
  23262. * @returns {Function} Returns the new relational operation function.
  23263. */
  23264. function createRelationalOperation(operator) {
  23265. return function(value, other) {
  23266. if (!(typeof value == 'string' && typeof other == 'string')) {
  23267. value = toNumber(value);
  23268. other = toNumber(other);
  23269. }
  23270. return operator(value, other);
  23271. };
  23272. }
  23273. /**
  23274. * Creates a function that wraps `func` to continue currying.
  23275. *
  23276. * @private
  23277. * @param {Function} func The function to wrap.
  23278. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23279. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23280. * @param {*} placeholder The placeholder value.
  23281. * @param {*} [thisArg] The `this` binding of `func`.
  23282. * @param {Array} [partials] The arguments to prepend to those provided to
  23283. * the new function.
  23284. * @param {Array} [holders] The `partials` placeholder indexes.
  23285. * @param {Array} [argPos] The argument positions of the new function.
  23286. * @param {number} [ary] The arity cap of `func`.
  23287. * @param {number} [arity] The arity of `func`.
  23288. * @returns {Function} Returns the new wrapped function.
  23289. */
  23290. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23291. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23292. newHolders = isCurry ? holders : undefined,
  23293. newHoldersRight = isCurry ? undefined : holders,
  23294. newPartials = isCurry ? partials : undefined,
  23295. newPartialsRight = isCurry ? undefined : partials;
  23296. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23297. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23298. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23299. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23300. }
  23301. var newData = [
  23302. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23303. newHoldersRight, argPos, ary, arity
  23304. ];
  23305. var result = wrapFunc.apply(undefined, newData);
  23306. if (isLaziable(func)) {
  23307. setData(result, newData);
  23308. }
  23309. result.placeholder = placeholder;
  23310. return setWrapToString(result, func, bitmask);
  23311. }
  23312. /**
  23313. * Creates a function like `_.round`.
  23314. *
  23315. * @private
  23316. * @param {string} methodName The name of the `Math` method to use when rounding.
  23317. * @returns {Function} Returns the new round function.
  23318. */
  23319. function createRound(methodName) {
  23320. var func = Math[methodName];
  23321. return function(number, precision) {
  23322. number = toNumber(number);
  23323. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23324. if (precision && nativeIsFinite(number)) {
  23325. // Shift with exponential notation to avoid floating-point issues.
  23326. // See [MDN](https://mdn.io/round#Examples) for more details.
  23327. var pair = (toString(number) + 'e').split('e'),
  23328. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23329. pair = (toString(value) + 'e').split('e');
  23330. return +(pair[0] + 'e' + (+pair[1] - precision));
  23331. }
  23332. return func(number);
  23333. };
  23334. }
  23335. /**
  23336. * Creates a set object of `values`.
  23337. *
  23338. * @private
  23339. * @param {Array} values The values to add to the set.
  23340. * @returns {Object} Returns the new set.
  23341. */
  23342. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23343. return new Set(values);
  23344. };
  23345. /**
  23346. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23347. *
  23348. * @private
  23349. * @param {Function} keysFunc The function to get the keys of a given object.
  23350. * @returns {Function} Returns the new pairs function.
  23351. */
  23352. function createToPairs(keysFunc) {
  23353. return function(object) {
  23354. var tag = getTag(object);
  23355. if (tag == mapTag) {
  23356. return mapToArray(object);
  23357. }
  23358. if (tag == setTag) {
  23359. return setToPairs(object);
  23360. }
  23361. return baseToPairs(object, keysFunc(object));
  23362. };
  23363. }
  23364. /**
  23365. * Creates a function that either curries or invokes `func` with optional
  23366. * `this` binding and partially applied arguments.
  23367. *
  23368. * @private
  23369. * @param {Function|string} func The function or method name to wrap.
  23370. * @param {number} bitmask The bitmask flags.
  23371. * 1 - `_.bind`
  23372. * 2 - `_.bindKey`
  23373. * 4 - `_.curry` or `_.curryRight` of a bound function
  23374. * 8 - `_.curry`
  23375. * 16 - `_.curryRight`
  23376. * 32 - `_.partial`
  23377. * 64 - `_.partialRight`
  23378. * 128 - `_.rearg`
  23379. * 256 - `_.ary`
  23380. * 512 - `_.flip`
  23381. * @param {*} [thisArg] The `this` binding of `func`.
  23382. * @param {Array} [partials] The arguments to be partially applied.
  23383. * @param {Array} [holders] The `partials` placeholder indexes.
  23384. * @param {Array} [argPos] The argument positions of the new function.
  23385. * @param {number} [ary] The arity cap of `func`.
  23386. * @param {number} [arity] The arity of `func`.
  23387. * @returns {Function} Returns the new wrapped function.
  23388. */
  23389. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23390. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23391. if (!isBindKey && typeof func != 'function') {
  23392. throw new TypeError(FUNC_ERROR_TEXT);
  23393. }
  23394. var length = partials ? partials.length : 0;
  23395. if (!length) {
  23396. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23397. partials = holders = undefined;
  23398. }
  23399. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23400. arity = arity === undefined ? arity : toInteger(arity);
  23401. length -= holders ? holders.length : 0;
  23402. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23403. var partialsRight = partials,
  23404. holdersRight = holders;
  23405. partials = holders = undefined;
  23406. }
  23407. var data = isBindKey ? undefined : getData(func);
  23408. var newData = [
  23409. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23410. argPos, ary, arity
  23411. ];
  23412. if (data) {
  23413. mergeData(newData, data);
  23414. }
  23415. func = newData[0];
  23416. bitmask = newData[1];
  23417. thisArg = newData[2];
  23418. partials = newData[3];
  23419. holders = newData[4];
  23420. arity = newData[9] = newData[9] === undefined
  23421. ? (isBindKey ? 0 : func.length)
  23422. : nativeMax(newData[9] - length, 0);
  23423. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23424. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23425. }
  23426. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23427. var result = createBind(func, bitmask, thisArg);
  23428. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23429. result = createCurry(func, bitmask, arity);
  23430. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23431. result = createPartial(func, bitmask, thisArg, partials);
  23432. } else {
  23433. result = createHybrid.apply(undefined, newData);
  23434. }
  23435. var setter = data ? baseSetData : setData;
  23436. return setWrapToString(setter(result, newData), func, bitmask);
  23437. }
  23438. /**
  23439. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23440. * of source objects to the destination object for all destination properties
  23441. * that resolve to `undefined`.
  23442. *
  23443. * @private
  23444. * @param {*} objValue The destination value.
  23445. * @param {*} srcValue The source value.
  23446. * @param {string} key The key of the property to assign.
  23447. * @param {Object} object The parent object of `objValue`.
  23448. * @returns {*} Returns the value to assign.
  23449. */
  23450. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23451. if (objValue === undefined ||
  23452. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23453. return srcValue;
  23454. }
  23455. return objValue;
  23456. }
  23457. /**
  23458. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23459. * objects into destination objects that are passed thru.
  23460. *
  23461. * @private
  23462. * @param {*} objValue The destination value.
  23463. * @param {*} srcValue The source value.
  23464. * @param {string} key The key of the property to merge.
  23465. * @param {Object} object The parent object of `objValue`.
  23466. * @param {Object} source The parent object of `srcValue`.
  23467. * @param {Object} [stack] Tracks traversed source values and their merged
  23468. * counterparts.
  23469. * @returns {*} Returns the value to assign.
  23470. */
  23471. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23472. if (isObject(objValue) && isObject(srcValue)) {
  23473. // Recursively merge objects and arrays (susceptible to call stack limits).
  23474. stack.set(srcValue, objValue);
  23475. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23476. stack['delete'](srcValue);
  23477. }
  23478. return objValue;
  23479. }
  23480. /**
  23481. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23482. * objects.
  23483. *
  23484. * @private
  23485. * @param {*} value The value to inspect.
  23486. * @param {string} key The key of the property to inspect.
  23487. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23488. */
  23489. function customOmitClone(value) {
  23490. return isPlainObject(value) ? undefined : value;
  23491. }
  23492. /**
  23493. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23494. * partial deep comparisons.
  23495. *
  23496. * @private
  23497. * @param {Array} array The array to compare.
  23498. * @param {Array} other The other array to compare.
  23499. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23500. * @param {Function} customizer The function to customize comparisons.
  23501. * @param {Function} equalFunc The function to determine equivalents of values.
  23502. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23503. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23504. */
  23505. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23506. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23507. arrLength = array.length,
  23508. othLength = other.length;
  23509. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23510. return false;
  23511. }
  23512. // Assume cyclic values are equal.
  23513. var stacked = stack.get(array);
  23514. if (stacked && stack.get(other)) {
  23515. return stacked == other;
  23516. }
  23517. var index = -1,
  23518. result = true,
  23519. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23520. stack.set(array, other);
  23521. stack.set(other, array);
  23522. // Ignore non-index properties.
  23523. while (++index < arrLength) {
  23524. var arrValue = array[index],
  23525. othValue = other[index];
  23526. if (customizer) {
  23527. var compared = isPartial
  23528. ? customizer(othValue, arrValue, index, other, array, stack)
  23529. : customizer(arrValue, othValue, index, array, other, stack);
  23530. }
  23531. if (compared !== undefined) {
  23532. if (compared) {
  23533. continue;
  23534. }
  23535. result = false;
  23536. break;
  23537. }
  23538. // Recursively compare arrays (susceptible to call stack limits).
  23539. if (seen) {
  23540. if (!arraySome(other, function(othValue, othIndex) {
  23541. if (!cacheHas(seen, othIndex) &&
  23542. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23543. return seen.push(othIndex);
  23544. }
  23545. })) {
  23546. result = false;
  23547. break;
  23548. }
  23549. } else if (!(
  23550. arrValue === othValue ||
  23551. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23552. )) {
  23553. result = false;
  23554. break;
  23555. }
  23556. }
  23557. stack['delete'](array);
  23558. stack['delete'](other);
  23559. return result;
  23560. }
  23561. /**
  23562. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23563. * the same `toStringTag`.
  23564. *
  23565. * **Note:** This function only supports comparing values with tags of
  23566. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23567. *
  23568. * @private
  23569. * @param {Object} object The object to compare.
  23570. * @param {Object} other The other object to compare.
  23571. * @param {string} tag The `toStringTag` of the objects to compare.
  23572. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23573. * @param {Function} customizer The function to customize comparisons.
  23574. * @param {Function} equalFunc The function to determine equivalents of values.
  23575. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23576. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23577. */
  23578. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23579. switch (tag) {
  23580. case dataViewTag:
  23581. if ((object.byteLength != other.byteLength) ||
  23582. (object.byteOffset != other.byteOffset)) {
  23583. return false;
  23584. }
  23585. object = object.buffer;
  23586. other = other.buffer;
  23587. case arrayBufferTag:
  23588. if ((object.byteLength != other.byteLength) ||
  23589. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23590. return false;
  23591. }
  23592. return true;
  23593. case boolTag:
  23594. case dateTag:
  23595. case numberTag:
  23596. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23597. // Invalid dates are coerced to `NaN`.
  23598. return eq(+object, +other);
  23599. case errorTag:
  23600. return object.name == other.name && object.message == other.message;
  23601. case regexpTag:
  23602. case stringTag:
  23603. // Coerce regexes to strings and treat strings, primitives and objects,
  23604. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23605. // for more details.
  23606. return object == (other + '');
  23607. case mapTag:
  23608. var convert = mapToArray;
  23609. case setTag:
  23610. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23611. convert || (convert = setToArray);
  23612. if (object.size != other.size && !isPartial) {
  23613. return false;
  23614. }
  23615. // Assume cyclic values are equal.
  23616. var stacked = stack.get(object);
  23617. if (stacked) {
  23618. return stacked == other;
  23619. }
  23620. bitmask |= COMPARE_UNORDERED_FLAG;
  23621. // Recursively compare objects (susceptible to call stack limits).
  23622. stack.set(object, other);
  23623. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23624. stack['delete'](object);
  23625. return result;
  23626. case symbolTag:
  23627. if (symbolValueOf) {
  23628. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23629. }
  23630. }
  23631. return false;
  23632. }
  23633. /**
  23634. * A specialized version of `baseIsEqualDeep` for objects with support for
  23635. * partial deep comparisons.
  23636. *
  23637. * @private
  23638. * @param {Object} object The object to compare.
  23639. * @param {Object} other The other object to compare.
  23640. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23641. * @param {Function} customizer The function to customize comparisons.
  23642. * @param {Function} equalFunc The function to determine equivalents of values.
  23643. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23644. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23645. */
  23646. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23647. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23648. objProps = getAllKeys(object),
  23649. objLength = objProps.length,
  23650. othProps = getAllKeys(other),
  23651. othLength = othProps.length;
  23652. if (objLength != othLength && !isPartial) {
  23653. return false;
  23654. }
  23655. var index = objLength;
  23656. while (index--) {
  23657. var key = objProps[index];
  23658. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23659. return false;
  23660. }
  23661. }
  23662. // Assume cyclic values are equal.
  23663. var stacked = stack.get(object);
  23664. if (stacked && stack.get(other)) {
  23665. return stacked == other;
  23666. }
  23667. var result = true;
  23668. stack.set(object, other);
  23669. stack.set(other, object);
  23670. var skipCtor = isPartial;
  23671. while (++index < objLength) {
  23672. key = objProps[index];
  23673. var objValue = object[key],
  23674. othValue = other[key];
  23675. if (customizer) {
  23676. var compared = isPartial
  23677. ? customizer(othValue, objValue, key, other, object, stack)
  23678. : customizer(objValue, othValue, key, object, other, stack);
  23679. }
  23680. // Recursively compare objects (susceptible to call stack limits).
  23681. if (!(compared === undefined
  23682. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23683. : compared
  23684. )) {
  23685. result = false;
  23686. break;
  23687. }
  23688. skipCtor || (skipCtor = key == 'constructor');
  23689. }
  23690. if (result && !skipCtor) {
  23691. var objCtor = object.constructor,
  23692. othCtor = other.constructor;
  23693. // Non `Object` object instances with different constructors are not equal.
  23694. if (objCtor != othCtor &&
  23695. ('constructor' in object && 'constructor' in other) &&
  23696. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23697. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23698. result = false;
  23699. }
  23700. }
  23701. stack['delete'](object);
  23702. stack['delete'](other);
  23703. return result;
  23704. }
  23705. /**
  23706. * A specialized version of `baseRest` which flattens the rest array.
  23707. *
  23708. * @private
  23709. * @param {Function} func The function to apply a rest parameter to.
  23710. * @returns {Function} Returns the new function.
  23711. */
  23712. function flatRest(func) {
  23713. return setToString(overRest(func, undefined, flatten), func + '');
  23714. }
  23715. /**
  23716. * Creates an array of own enumerable property names and symbols of `object`.
  23717. *
  23718. * @private
  23719. * @param {Object} object The object to query.
  23720. * @returns {Array} Returns the array of property names and symbols.
  23721. */
  23722. function getAllKeys(object) {
  23723. return baseGetAllKeys(object, keys, getSymbols);
  23724. }
  23725. /**
  23726. * Creates an array of own and inherited enumerable property names and
  23727. * symbols of `object`.
  23728. *
  23729. * @private
  23730. * @param {Object} object The object to query.
  23731. * @returns {Array} Returns the array of property names and symbols.
  23732. */
  23733. function getAllKeysIn(object) {
  23734. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23735. }
  23736. /**
  23737. * Gets metadata for `func`.
  23738. *
  23739. * @private
  23740. * @param {Function} func The function to query.
  23741. * @returns {*} Returns the metadata for `func`.
  23742. */
  23743. var getData = !metaMap ? noop : function(func) {
  23744. return metaMap.get(func);
  23745. };
  23746. /**
  23747. * Gets the name of `func`.
  23748. *
  23749. * @private
  23750. * @param {Function} func The function to query.
  23751. * @returns {string} Returns the function name.
  23752. */
  23753. function getFuncName(func) {
  23754. var result = (func.name + ''),
  23755. array = realNames[result],
  23756. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23757. while (length--) {
  23758. var data = array[length],
  23759. otherFunc = data.func;
  23760. if (otherFunc == null || otherFunc == func) {
  23761. return data.name;
  23762. }
  23763. }
  23764. return result;
  23765. }
  23766. /**
  23767. * Gets the argument placeholder value for `func`.
  23768. *
  23769. * @private
  23770. * @param {Function} func The function to inspect.
  23771. * @returns {*} Returns the placeholder value.
  23772. */
  23773. function getHolder(func) {
  23774. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23775. return object.placeholder;
  23776. }
  23777. /**
  23778. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23779. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23780. * If arguments are provided, the chosen function is invoked with them and
  23781. * its result is returned.
  23782. *
  23783. * @private
  23784. * @param {*} [value] The value to convert to an iteratee.
  23785. * @param {number} [arity] The arity of the created iteratee.
  23786. * @returns {Function} Returns the chosen function or its result.
  23787. */
  23788. function getIteratee() {
  23789. var result = lodash.iteratee || iteratee;
  23790. result = result === iteratee ? baseIteratee : result;
  23791. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23792. }
  23793. /**
  23794. * Gets the data for `map`.
  23795. *
  23796. * @private
  23797. * @param {Object} map The map to query.
  23798. * @param {string} key The reference key.
  23799. * @returns {*} Returns the map data.
  23800. */
  23801. function getMapData(map, key) {
  23802. var data = map.__data__;
  23803. return isKeyable(key)
  23804. ? data[typeof key == 'string' ? 'string' : 'hash']
  23805. : data.map;
  23806. }
  23807. /**
  23808. * Gets the property names, values, and compare flags of `object`.
  23809. *
  23810. * @private
  23811. * @param {Object} object The object to query.
  23812. * @returns {Array} Returns the match data of `object`.
  23813. */
  23814. function getMatchData(object) {
  23815. var result = keys(object),
  23816. length = result.length;
  23817. while (length--) {
  23818. var key = result[length],
  23819. value = object[key];
  23820. result[length] = [key, value, isStrictComparable(value)];
  23821. }
  23822. return result;
  23823. }
  23824. /**
  23825. * Gets the native function at `key` of `object`.
  23826. *
  23827. * @private
  23828. * @param {Object} object The object to query.
  23829. * @param {string} key The key of the method to get.
  23830. * @returns {*} Returns the function if it's native, else `undefined`.
  23831. */
  23832. function getNative(object, key) {
  23833. var value = getValue(object, key);
  23834. return baseIsNative(value) ? value : undefined;
  23835. }
  23836. /**
  23837. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23838. *
  23839. * @private
  23840. * @param {*} value The value to query.
  23841. * @returns {string} Returns the raw `toStringTag`.
  23842. */
  23843. function getRawTag(value) {
  23844. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23845. tag = value[symToStringTag];
  23846. try {
  23847. value[symToStringTag] = undefined;
  23848. var unmasked = true;
  23849. } catch (e) {}
  23850. var result = nativeObjectToString.call(value);
  23851. if (unmasked) {
  23852. if (isOwn) {
  23853. value[symToStringTag] = tag;
  23854. } else {
  23855. delete value[symToStringTag];
  23856. }
  23857. }
  23858. return result;
  23859. }
  23860. /**
  23861. * Creates an array of the own enumerable symbols of `object`.
  23862. *
  23863. * @private
  23864. * @param {Object} object The object to query.
  23865. * @returns {Array} Returns the array of symbols.
  23866. */
  23867. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23868. if (object == null) {
  23869. return [];
  23870. }
  23871. object = Object(object);
  23872. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23873. return propertyIsEnumerable.call(object, symbol);
  23874. });
  23875. };
  23876. /**
  23877. * Creates an array of the own and inherited enumerable symbols of `object`.
  23878. *
  23879. * @private
  23880. * @param {Object} object The object to query.
  23881. * @returns {Array} Returns the array of symbols.
  23882. */
  23883. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23884. var result = [];
  23885. while (object) {
  23886. arrayPush(result, getSymbols(object));
  23887. object = getPrototype(object);
  23888. }
  23889. return result;
  23890. };
  23891. /**
  23892. * Gets the `toStringTag` of `value`.
  23893. *
  23894. * @private
  23895. * @param {*} value The value to query.
  23896. * @returns {string} Returns the `toStringTag`.
  23897. */
  23898. var getTag = baseGetTag;
  23899. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23900. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23901. (Map && getTag(new Map) != mapTag) ||
  23902. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23903. (Set && getTag(new Set) != setTag) ||
  23904. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23905. getTag = function(value) {
  23906. var result = baseGetTag(value),
  23907. Ctor = result == objectTag ? value.constructor : undefined,
  23908. ctorString = Ctor ? toSource(Ctor) : '';
  23909. if (ctorString) {
  23910. switch (ctorString) {
  23911. case dataViewCtorString: return dataViewTag;
  23912. case mapCtorString: return mapTag;
  23913. case promiseCtorString: return promiseTag;
  23914. case setCtorString: return setTag;
  23915. case weakMapCtorString: return weakMapTag;
  23916. }
  23917. }
  23918. return result;
  23919. };
  23920. }
  23921. /**
  23922. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23923. *
  23924. * @private
  23925. * @param {number} start The start of the view.
  23926. * @param {number} end The end of the view.
  23927. * @param {Array} transforms The transformations to apply to the view.
  23928. * @returns {Object} Returns an object containing the `start` and `end`
  23929. * positions of the view.
  23930. */
  23931. function getView(start, end, transforms) {
  23932. var index = -1,
  23933. length = transforms.length;
  23934. while (++index < length) {
  23935. var data = transforms[index],
  23936. size = data.size;
  23937. switch (data.type) {
  23938. case 'drop': start += size; break;
  23939. case 'dropRight': end -= size; break;
  23940. case 'take': end = nativeMin(end, start + size); break;
  23941. case 'takeRight': start = nativeMax(start, end - size); break;
  23942. }
  23943. }
  23944. return { 'start': start, 'end': end };
  23945. }
  23946. /**
  23947. * Extracts wrapper details from the `source` body comment.
  23948. *
  23949. * @private
  23950. * @param {string} source The source to inspect.
  23951. * @returns {Array} Returns the wrapper details.
  23952. */
  23953. function getWrapDetails(source) {
  23954. var match = source.match(reWrapDetails);
  23955. return match ? match[1].split(reSplitDetails) : [];
  23956. }
  23957. /**
  23958. * Checks if `path` exists on `object`.
  23959. *
  23960. * @private
  23961. * @param {Object} object The object to query.
  23962. * @param {Array|string} path The path to check.
  23963. * @param {Function} hasFunc The function to check properties.
  23964. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23965. */
  23966. function hasPath(object, path, hasFunc) {
  23967. path = castPath(path, object);
  23968. var index = -1,
  23969. length = path.length,
  23970. result = false;
  23971. while (++index < length) {
  23972. var key = toKey(path[index]);
  23973. if (!(result = object != null && hasFunc(object, key))) {
  23974. break;
  23975. }
  23976. object = object[key];
  23977. }
  23978. if (result || ++index != length) {
  23979. return result;
  23980. }
  23981. length = object == null ? 0 : object.length;
  23982. return !!length && isLength(length) && isIndex(key, length) &&
  23983. (isArray(object) || isArguments(object));
  23984. }
  23985. /**
  23986. * Initializes an array clone.
  23987. *
  23988. * @private
  23989. * @param {Array} array The array to clone.
  23990. * @returns {Array} Returns the initialized clone.
  23991. */
  23992. function initCloneArray(array) {
  23993. var length = array.length,
  23994. result = new array.constructor(length);
  23995. // Add properties assigned by `RegExp#exec`.
  23996. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23997. result.index = array.index;
  23998. result.input = array.input;
  23999. }
  24000. return result;
  24001. }
  24002. /**
  24003. * Initializes an object clone.
  24004. *
  24005. * @private
  24006. * @param {Object} object The object to clone.
  24007. * @returns {Object} Returns the initialized clone.
  24008. */
  24009. function initCloneObject(object) {
  24010. return (typeof object.constructor == 'function' && !isPrototype(object))
  24011. ? baseCreate(getPrototype(object))
  24012. : {};
  24013. }
  24014. /**
  24015. * Initializes an object clone based on its `toStringTag`.
  24016. *
  24017. * **Note:** This function only supports cloning values with tags of
  24018. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24019. *
  24020. * @private
  24021. * @param {Object} object The object to clone.
  24022. * @param {string} tag The `toStringTag` of the object to clone.
  24023. * @param {boolean} [isDeep] Specify a deep clone.
  24024. * @returns {Object} Returns the initialized clone.
  24025. */
  24026. function initCloneByTag(object, tag, isDeep) {
  24027. var Ctor = object.constructor;
  24028. switch (tag) {
  24029. case arrayBufferTag:
  24030. return cloneArrayBuffer(object);
  24031. case boolTag:
  24032. case dateTag:
  24033. return new Ctor(+object);
  24034. case dataViewTag:
  24035. return cloneDataView(object, isDeep);
  24036. case float32Tag: case float64Tag:
  24037. case int8Tag: case int16Tag: case int32Tag:
  24038. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24039. return cloneTypedArray(object, isDeep);
  24040. case mapTag:
  24041. return new Ctor;
  24042. case numberTag:
  24043. case stringTag:
  24044. return new Ctor(object);
  24045. case regexpTag:
  24046. return cloneRegExp(object);
  24047. case setTag:
  24048. return new Ctor;
  24049. case symbolTag:
  24050. return cloneSymbol(object);
  24051. }
  24052. }
  24053. /**
  24054. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24055. *
  24056. * @private
  24057. * @param {string} source The source to modify.
  24058. * @returns {Array} details The details to insert.
  24059. * @returns {string} Returns the modified source.
  24060. */
  24061. function insertWrapDetails(source, details) {
  24062. var length = details.length;
  24063. if (!length) {
  24064. return source;
  24065. }
  24066. var lastIndex = length - 1;
  24067. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24068. details = details.join(length > 2 ? ', ' : ' ');
  24069. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24070. }
  24071. /**
  24072. * Checks if `value` is a flattenable `arguments` object or array.
  24073. *
  24074. * @private
  24075. * @param {*} value The value to check.
  24076. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24077. */
  24078. function isFlattenable(value) {
  24079. return isArray(value) || isArguments(value) ||
  24080. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24081. }
  24082. /**
  24083. * Checks if `value` is a valid array-like index.
  24084. *
  24085. * @private
  24086. * @param {*} value The value to check.
  24087. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24088. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24089. */
  24090. function isIndex(value, length) {
  24091. var type = typeof value;
  24092. length = length == null ? MAX_SAFE_INTEGER : length;
  24093. return !!length &&
  24094. (type == 'number' ||
  24095. (type != 'symbol' && reIsUint.test(value))) &&
  24096. (value > -1 && value % 1 == 0 && value < length);
  24097. }
  24098. /**
  24099. * Checks if the given arguments are from an iteratee call.
  24100. *
  24101. * @private
  24102. * @param {*} value The potential iteratee value argument.
  24103. * @param {*} index The potential iteratee index or key argument.
  24104. * @param {*} object The potential iteratee object argument.
  24105. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24106. * else `false`.
  24107. */
  24108. function isIterateeCall(value, index, object) {
  24109. if (!isObject(object)) {
  24110. return false;
  24111. }
  24112. var type = typeof index;
  24113. if (type == 'number'
  24114. ? (isArrayLike(object) && isIndex(index, object.length))
  24115. : (type == 'string' && index in object)
  24116. ) {
  24117. return eq(object[index], value);
  24118. }
  24119. return false;
  24120. }
  24121. /**
  24122. * Checks if `value` is a property name and not a property path.
  24123. *
  24124. * @private
  24125. * @param {*} value The value to check.
  24126. * @param {Object} [object] The object to query keys on.
  24127. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24128. */
  24129. function isKey(value, object) {
  24130. if (isArray(value)) {
  24131. return false;
  24132. }
  24133. var type = typeof value;
  24134. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24135. value == null || isSymbol(value)) {
  24136. return true;
  24137. }
  24138. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24139. (object != null && value in Object(object));
  24140. }
  24141. /**
  24142. * Checks if `value` is suitable for use as unique object key.
  24143. *
  24144. * @private
  24145. * @param {*} value The value to check.
  24146. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24147. */
  24148. function isKeyable(value) {
  24149. var type = typeof value;
  24150. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24151. ? (value !== '__proto__')
  24152. : (value === null);
  24153. }
  24154. /**
  24155. * Checks if `func` has a lazy counterpart.
  24156. *
  24157. * @private
  24158. * @param {Function} func The function to check.
  24159. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24160. * else `false`.
  24161. */
  24162. function isLaziable(func) {
  24163. var funcName = getFuncName(func),
  24164. other = lodash[funcName];
  24165. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24166. return false;
  24167. }
  24168. if (func === other) {
  24169. return true;
  24170. }
  24171. var data = getData(other);
  24172. return !!data && func === data[0];
  24173. }
  24174. /**
  24175. * Checks if `func` has its source masked.
  24176. *
  24177. * @private
  24178. * @param {Function} func The function to check.
  24179. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24180. */
  24181. function isMasked(func) {
  24182. return !!maskSrcKey && (maskSrcKey in func);
  24183. }
  24184. /**
  24185. * Checks if `func` is capable of being masked.
  24186. *
  24187. * @private
  24188. * @param {*} value The value to check.
  24189. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24190. */
  24191. var isMaskable = coreJsData ? isFunction : stubFalse;
  24192. /**
  24193. * Checks if `value` is likely a prototype object.
  24194. *
  24195. * @private
  24196. * @param {*} value The value to check.
  24197. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24198. */
  24199. function isPrototype(value) {
  24200. var Ctor = value && value.constructor,
  24201. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24202. return value === proto;
  24203. }
  24204. /**
  24205. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24206. *
  24207. * @private
  24208. * @param {*} value The value to check.
  24209. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24210. * equality comparisons, else `false`.
  24211. */
  24212. function isStrictComparable(value) {
  24213. return value === value && !isObject(value);
  24214. }
  24215. /**
  24216. * A specialized version of `matchesProperty` for source values suitable
  24217. * for strict equality comparisons, i.e. `===`.
  24218. *
  24219. * @private
  24220. * @param {string} key The key of the property to get.
  24221. * @param {*} srcValue The value to match.
  24222. * @returns {Function} Returns the new spec function.
  24223. */
  24224. function matchesStrictComparable(key, srcValue) {
  24225. return function(object) {
  24226. if (object == null) {
  24227. return false;
  24228. }
  24229. return object[key] === srcValue &&
  24230. (srcValue !== undefined || (key in Object(object)));
  24231. };
  24232. }
  24233. /**
  24234. * A specialized version of `_.memoize` which clears the memoized function's
  24235. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24236. *
  24237. * @private
  24238. * @param {Function} func The function to have its output memoized.
  24239. * @returns {Function} Returns the new memoized function.
  24240. */
  24241. function memoizeCapped(func) {
  24242. var result = memoize(func, function(key) {
  24243. if (cache.size === MAX_MEMOIZE_SIZE) {
  24244. cache.clear();
  24245. }
  24246. return key;
  24247. });
  24248. var cache = result.cache;
  24249. return result;
  24250. }
  24251. /**
  24252. * Merges the function metadata of `source` into `data`.
  24253. *
  24254. * Merging metadata reduces the number of wrappers used to invoke a function.
  24255. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24256. * may be applied regardless of execution order. Methods like `_.ary` and
  24257. * `_.rearg` modify function arguments, making the order in which they are
  24258. * executed important, preventing the merging of metadata. However, we make
  24259. * an exception for a safe combined case where curried functions have `_.ary`
  24260. * and or `_.rearg` applied.
  24261. *
  24262. * @private
  24263. * @param {Array} data The destination metadata.
  24264. * @param {Array} source The source metadata.
  24265. * @returns {Array} Returns `data`.
  24266. */
  24267. function mergeData(data, source) {
  24268. var bitmask = data[1],
  24269. srcBitmask = source[1],
  24270. newBitmask = bitmask | srcBitmask,
  24271. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24272. var isCombo =
  24273. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24274. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24275. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24276. // Exit early if metadata can't be merged.
  24277. if (!(isCommon || isCombo)) {
  24278. return data;
  24279. }
  24280. // Use source `thisArg` if available.
  24281. if (srcBitmask & WRAP_BIND_FLAG) {
  24282. data[2] = source[2];
  24283. // Set when currying a bound function.
  24284. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24285. }
  24286. // Compose partial arguments.
  24287. var value = source[3];
  24288. if (value) {
  24289. var partials = data[3];
  24290. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24291. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24292. }
  24293. // Compose partial right arguments.
  24294. value = source[5];
  24295. if (value) {
  24296. partials = data[5];
  24297. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24298. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24299. }
  24300. // Use source `argPos` if available.
  24301. value = source[7];
  24302. if (value) {
  24303. data[7] = value;
  24304. }
  24305. // Use source `ary` if it's smaller.
  24306. if (srcBitmask & WRAP_ARY_FLAG) {
  24307. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24308. }
  24309. // Use source `arity` if one is not provided.
  24310. if (data[9] == null) {
  24311. data[9] = source[9];
  24312. }
  24313. // Use source `func` and merge bitmasks.
  24314. data[0] = source[0];
  24315. data[1] = newBitmask;
  24316. return data;
  24317. }
  24318. /**
  24319. * This function is like
  24320. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24321. * except that it includes inherited enumerable properties.
  24322. *
  24323. * @private
  24324. * @param {Object} object The object to query.
  24325. * @returns {Array} Returns the array of property names.
  24326. */
  24327. function nativeKeysIn(object) {
  24328. var result = [];
  24329. if (object != null) {
  24330. for (var key in Object(object)) {
  24331. result.push(key);
  24332. }
  24333. }
  24334. return result;
  24335. }
  24336. /**
  24337. * Converts `value` to a string using `Object.prototype.toString`.
  24338. *
  24339. * @private
  24340. * @param {*} value The value to convert.
  24341. * @returns {string} Returns the converted string.
  24342. */
  24343. function objectToString(value) {
  24344. return nativeObjectToString.call(value);
  24345. }
  24346. /**
  24347. * A specialized version of `baseRest` which transforms the rest array.
  24348. *
  24349. * @private
  24350. * @param {Function} func The function to apply a rest parameter to.
  24351. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24352. * @param {Function} transform The rest array transform.
  24353. * @returns {Function} Returns the new function.
  24354. */
  24355. function overRest(func, start, transform) {
  24356. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24357. return function() {
  24358. var args = arguments,
  24359. index = -1,
  24360. length = nativeMax(args.length - start, 0),
  24361. array = Array(length);
  24362. while (++index < length) {
  24363. array[index] = args[start + index];
  24364. }
  24365. index = -1;
  24366. var otherArgs = Array(start + 1);
  24367. while (++index < start) {
  24368. otherArgs[index] = args[index];
  24369. }
  24370. otherArgs[start] = transform(array);
  24371. return apply(func, this, otherArgs);
  24372. };
  24373. }
  24374. /**
  24375. * Gets the parent value at `path` of `object`.
  24376. *
  24377. * @private
  24378. * @param {Object} object The object to query.
  24379. * @param {Array} path The path to get the parent value of.
  24380. * @returns {*} Returns the parent value.
  24381. */
  24382. function parent(object, path) {
  24383. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24384. }
  24385. /**
  24386. * Reorder `array` according to the specified indexes where the element at
  24387. * the first index is assigned as the first element, the element at
  24388. * the second index is assigned as the second element, and so on.
  24389. *
  24390. * @private
  24391. * @param {Array} array The array to reorder.
  24392. * @param {Array} indexes The arranged array indexes.
  24393. * @returns {Array} Returns `array`.
  24394. */
  24395. function reorder(array, indexes) {
  24396. var arrLength = array.length,
  24397. length = nativeMin(indexes.length, arrLength),
  24398. oldArray = copyArray(array);
  24399. while (length--) {
  24400. var index = indexes[length];
  24401. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24402. }
  24403. return array;
  24404. }
  24405. /**
  24406. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24407. *
  24408. * @private
  24409. * @param {Object} object The object to query.
  24410. * @param {string} key The key of the property to get.
  24411. * @returns {*} Returns the property value.
  24412. */
  24413. function safeGet(object, key) {
  24414. if (key === 'constructor' && typeof object[key] === 'function') {
  24415. return;
  24416. }
  24417. if (key == '__proto__') {
  24418. return;
  24419. }
  24420. return object[key];
  24421. }
  24422. /**
  24423. * Sets metadata for `func`.
  24424. *
  24425. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24426. * period of time, it will trip its breaker and transition to an identity
  24427. * function to avoid garbage collection pauses in V8. See
  24428. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24429. * for more details.
  24430. *
  24431. * @private
  24432. * @param {Function} func The function to associate metadata with.
  24433. * @param {*} data The metadata.
  24434. * @returns {Function} Returns `func`.
  24435. */
  24436. var setData = shortOut(baseSetData);
  24437. /**
  24438. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24439. *
  24440. * @private
  24441. * @param {Function} func The function to delay.
  24442. * @param {number} wait The number of milliseconds to delay invocation.
  24443. * @returns {number|Object} Returns the timer id or timeout object.
  24444. */
  24445. var setTimeout = ctxSetTimeout || function(func, wait) {
  24446. return root.setTimeout(func, wait);
  24447. };
  24448. /**
  24449. * Sets the `toString` method of `func` to return `string`.
  24450. *
  24451. * @private
  24452. * @param {Function} func The function to modify.
  24453. * @param {Function} string The `toString` result.
  24454. * @returns {Function} Returns `func`.
  24455. */
  24456. var setToString = shortOut(baseSetToString);
  24457. /**
  24458. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24459. * with wrapper details in a comment at the top of the source body.
  24460. *
  24461. * @private
  24462. * @param {Function} wrapper The function to modify.
  24463. * @param {Function} reference The reference function.
  24464. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24465. * @returns {Function} Returns `wrapper`.
  24466. */
  24467. function setWrapToString(wrapper, reference, bitmask) {
  24468. var source = (reference + '');
  24469. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24470. }
  24471. /**
  24472. * Creates a function that'll short out and invoke `identity` instead
  24473. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24474. * milliseconds.
  24475. *
  24476. * @private
  24477. * @param {Function} func The function to restrict.
  24478. * @returns {Function} Returns the new shortable function.
  24479. */
  24480. function shortOut(func) {
  24481. var count = 0,
  24482. lastCalled = 0;
  24483. return function() {
  24484. var stamp = nativeNow(),
  24485. remaining = HOT_SPAN - (stamp - lastCalled);
  24486. lastCalled = stamp;
  24487. if (remaining > 0) {
  24488. if (++count >= HOT_COUNT) {
  24489. return arguments[0];
  24490. }
  24491. } else {
  24492. count = 0;
  24493. }
  24494. return func.apply(undefined, arguments);
  24495. };
  24496. }
  24497. /**
  24498. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24499. *
  24500. * @private
  24501. * @param {Array} array The array to shuffle.
  24502. * @param {number} [size=array.length] The size of `array`.
  24503. * @returns {Array} Returns `array`.
  24504. */
  24505. function shuffleSelf(array, size) {
  24506. var index = -1,
  24507. length = array.length,
  24508. lastIndex = length - 1;
  24509. size = size === undefined ? length : size;
  24510. while (++index < size) {
  24511. var rand = baseRandom(index, lastIndex),
  24512. value = array[rand];
  24513. array[rand] = array[index];
  24514. array[index] = value;
  24515. }
  24516. array.length = size;
  24517. return array;
  24518. }
  24519. /**
  24520. * Converts `string` to a property path array.
  24521. *
  24522. * @private
  24523. * @param {string} string The string to convert.
  24524. * @returns {Array} Returns the property path array.
  24525. */
  24526. var stringToPath = memoizeCapped(function(string) {
  24527. var result = [];
  24528. if (string.charCodeAt(0) === 46 /* . */) {
  24529. result.push('');
  24530. }
  24531. string.replace(rePropName, function(match, number, quote, subString) {
  24532. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24533. });
  24534. return result;
  24535. });
  24536. /**
  24537. * Converts `value` to a string key if it's not a string or symbol.
  24538. *
  24539. * @private
  24540. * @param {*} value The value to inspect.
  24541. * @returns {string|symbol} Returns the key.
  24542. */
  24543. function toKey(value) {
  24544. if (typeof value == 'string' || isSymbol(value)) {
  24545. return value;
  24546. }
  24547. var result = (value + '');
  24548. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24549. }
  24550. /**
  24551. * Converts `func` to its source code.
  24552. *
  24553. * @private
  24554. * @param {Function} func The function to convert.
  24555. * @returns {string} Returns the source code.
  24556. */
  24557. function toSource(func) {
  24558. if (func != null) {
  24559. try {
  24560. return funcToString.call(func);
  24561. } catch (e) {}
  24562. try {
  24563. return (func + '');
  24564. } catch (e) {}
  24565. }
  24566. return '';
  24567. }
  24568. /**
  24569. * Updates wrapper `details` based on `bitmask` flags.
  24570. *
  24571. * @private
  24572. * @returns {Array} details The details to modify.
  24573. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24574. * @returns {Array} Returns `details`.
  24575. */
  24576. function updateWrapDetails(details, bitmask) {
  24577. arrayEach(wrapFlags, function(pair) {
  24578. var value = '_.' + pair[0];
  24579. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24580. details.push(value);
  24581. }
  24582. });
  24583. return details.sort();
  24584. }
  24585. /**
  24586. * Creates a clone of `wrapper`.
  24587. *
  24588. * @private
  24589. * @param {Object} wrapper The wrapper to clone.
  24590. * @returns {Object} Returns the cloned wrapper.
  24591. */
  24592. function wrapperClone(wrapper) {
  24593. if (wrapper instanceof LazyWrapper) {
  24594. return wrapper.clone();
  24595. }
  24596. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24597. result.__actions__ = copyArray(wrapper.__actions__);
  24598. result.__index__ = wrapper.__index__;
  24599. result.__values__ = wrapper.__values__;
  24600. return result;
  24601. }
  24602. /*------------------------------------------------------------------------*/
  24603. /**
  24604. * Creates an array of elements split into groups the length of `size`.
  24605. * If `array` can't be split evenly, the final chunk will be the remaining
  24606. * elements.
  24607. *
  24608. * @static
  24609. * @memberOf _
  24610. * @since 3.0.0
  24611. * @category Array
  24612. * @param {Array} array The array to process.
  24613. * @param {number} [size=1] The length of each chunk
  24614. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24615. * @returns {Array} Returns the new array of chunks.
  24616. * @example
  24617. *
  24618. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24619. * // => [['a', 'b'], ['c', 'd']]
  24620. *
  24621. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24622. * // => [['a', 'b', 'c'], ['d']]
  24623. */
  24624. function chunk(array, size, guard) {
  24625. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24626. size = 1;
  24627. } else {
  24628. size = nativeMax(toInteger(size), 0);
  24629. }
  24630. var length = array == null ? 0 : array.length;
  24631. if (!length || size < 1) {
  24632. return [];
  24633. }
  24634. var index = 0,
  24635. resIndex = 0,
  24636. result = Array(nativeCeil(length / size));
  24637. while (index < length) {
  24638. result[resIndex++] = baseSlice(array, index, (index += size));
  24639. }
  24640. return result;
  24641. }
  24642. /**
  24643. * Creates an array with all falsey values removed. The values `false`, `null`,
  24644. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24645. *
  24646. * @static
  24647. * @memberOf _
  24648. * @since 0.1.0
  24649. * @category Array
  24650. * @param {Array} array The array to compact.
  24651. * @returns {Array} Returns the new array of filtered values.
  24652. * @example
  24653. *
  24654. * _.compact([0, 1, false, 2, '', 3]);
  24655. * // => [1, 2, 3]
  24656. */
  24657. function compact(array) {
  24658. var index = -1,
  24659. length = array == null ? 0 : array.length,
  24660. resIndex = 0,
  24661. result = [];
  24662. while (++index < length) {
  24663. var value = array[index];
  24664. if (value) {
  24665. result[resIndex++] = value;
  24666. }
  24667. }
  24668. return result;
  24669. }
  24670. /**
  24671. * Creates a new array concatenating `array` with any additional arrays
  24672. * and/or values.
  24673. *
  24674. * @static
  24675. * @memberOf _
  24676. * @since 4.0.0
  24677. * @category Array
  24678. * @param {Array} array The array to concatenate.
  24679. * @param {...*} [values] The values to concatenate.
  24680. * @returns {Array} Returns the new concatenated array.
  24681. * @example
  24682. *
  24683. * var array = [1];
  24684. * var other = _.concat(array, 2, [3], [[4]]);
  24685. *
  24686. * console.log(other);
  24687. * // => [1, 2, 3, [4]]
  24688. *
  24689. * console.log(array);
  24690. * // => [1]
  24691. */
  24692. function concat() {
  24693. var length = arguments.length;
  24694. if (!length) {
  24695. return [];
  24696. }
  24697. var args = Array(length - 1),
  24698. array = arguments[0],
  24699. index = length;
  24700. while (index--) {
  24701. args[index - 1] = arguments[index];
  24702. }
  24703. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24704. }
  24705. /**
  24706. * Creates an array of `array` values not included in the other given arrays
  24707. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24708. * for equality comparisons. The order and references of result values are
  24709. * determined by the first array.
  24710. *
  24711. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24712. *
  24713. * @static
  24714. * @memberOf _
  24715. * @since 0.1.0
  24716. * @category Array
  24717. * @param {Array} array The array to inspect.
  24718. * @param {...Array} [values] The values to exclude.
  24719. * @returns {Array} Returns the new array of filtered values.
  24720. * @see _.without, _.xor
  24721. * @example
  24722. *
  24723. * _.difference([2, 1], [2, 3]);
  24724. * // => [1]
  24725. */
  24726. var difference = baseRest(function(array, values) {
  24727. return isArrayLikeObject(array)
  24728. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24729. : [];
  24730. });
  24731. /**
  24732. * This method is like `_.difference` except that it accepts `iteratee` which
  24733. * is invoked for each element of `array` and `values` to generate the criterion
  24734. * by which they're compared. The order and references of result values are
  24735. * determined by the first array. The iteratee is invoked with one argument:
  24736. * (value).
  24737. *
  24738. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24739. *
  24740. * @static
  24741. * @memberOf _
  24742. * @since 4.0.0
  24743. * @category Array
  24744. * @param {Array} array The array to inspect.
  24745. * @param {...Array} [values] The values to exclude.
  24746. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24747. * @returns {Array} Returns the new array of filtered values.
  24748. * @example
  24749. *
  24750. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24751. * // => [1.2]
  24752. *
  24753. * // The `_.property` iteratee shorthand.
  24754. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24755. * // => [{ 'x': 2 }]
  24756. */
  24757. var differenceBy = baseRest(function(array, values) {
  24758. var iteratee = last(values);
  24759. if (isArrayLikeObject(iteratee)) {
  24760. iteratee = undefined;
  24761. }
  24762. return isArrayLikeObject(array)
  24763. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24764. : [];
  24765. });
  24766. /**
  24767. * This method is like `_.difference` except that it accepts `comparator`
  24768. * which is invoked to compare elements of `array` to `values`. The order and
  24769. * references of result values are determined by the first array. The comparator
  24770. * is invoked with two arguments: (arrVal, othVal).
  24771. *
  24772. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24773. *
  24774. * @static
  24775. * @memberOf _
  24776. * @since 4.0.0
  24777. * @category Array
  24778. * @param {Array} array The array to inspect.
  24779. * @param {...Array} [values] The values to exclude.
  24780. * @param {Function} [comparator] The comparator invoked per element.
  24781. * @returns {Array} Returns the new array of filtered values.
  24782. * @example
  24783. *
  24784. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24785. *
  24786. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24787. * // => [{ 'x': 2, 'y': 1 }]
  24788. */
  24789. var differenceWith = baseRest(function(array, values) {
  24790. var comparator = last(values);
  24791. if (isArrayLikeObject(comparator)) {
  24792. comparator = undefined;
  24793. }
  24794. return isArrayLikeObject(array)
  24795. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24796. : [];
  24797. });
  24798. /**
  24799. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24800. *
  24801. * @static
  24802. * @memberOf _
  24803. * @since 0.5.0
  24804. * @category Array
  24805. * @param {Array} array The array to query.
  24806. * @param {number} [n=1] The number of elements to drop.
  24807. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24808. * @returns {Array} Returns the slice of `array`.
  24809. * @example
  24810. *
  24811. * _.drop([1, 2, 3]);
  24812. * // => [2, 3]
  24813. *
  24814. * _.drop([1, 2, 3], 2);
  24815. * // => [3]
  24816. *
  24817. * _.drop([1, 2, 3], 5);
  24818. * // => []
  24819. *
  24820. * _.drop([1, 2, 3], 0);
  24821. * // => [1, 2, 3]
  24822. */
  24823. function drop(array, n, guard) {
  24824. var length = array == null ? 0 : array.length;
  24825. if (!length) {
  24826. return [];
  24827. }
  24828. n = (guard || n === undefined) ? 1 : toInteger(n);
  24829. return baseSlice(array, n < 0 ? 0 : n, length);
  24830. }
  24831. /**
  24832. * Creates a slice of `array` with `n` elements dropped from the end.
  24833. *
  24834. * @static
  24835. * @memberOf _
  24836. * @since 3.0.0
  24837. * @category Array
  24838. * @param {Array} array The array to query.
  24839. * @param {number} [n=1] The number of elements to drop.
  24840. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24841. * @returns {Array} Returns the slice of `array`.
  24842. * @example
  24843. *
  24844. * _.dropRight([1, 2, 3]);
  24845. * // => [1, 2]
  24846. *
  24847. * _.dropRight([1, 2, 3], 2);
  24848. * // => [1]
  24849. *
  24850. * _.dropRight([1, 2, 3], 5);
  24851. * // => []
  24852. *
  24853. * _.dropRight([1, 2, 3], 0);
  24854. * // => [1, 2, 3]
  24855. */
  24856. function dropRight(array, n, guard) {
  24857. var length = array == null ? 0 : array.length;
  24858. if (!length) {
  24859. return [];
  24860. }
  24861. n = (guard || n === undefined) ? 1 : toInteger(n);
  24862. n = length - n;
  24863. return baseSlice(array, 0, n < 0 ? 0 : n);
  24864. }
  24865. /**
  24866. * Creates a slice of `array` excluding elements dropped from the end.
  24867. * Elements are dropped until `predicate` returns falsey. The predicate is
  24868. * invoked with three arguments: (value, index, array).
  24869. *
  24870. * @static
  24871. * @memberOf _
  24872. * @since 3.0.0
  24873. * @category Array
  24874. * @param {Array} array The array to query.
  24875. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24876. * @returns {Array} Returns the slice of `array`.
  24877. * @example
  24878. *
  24879. * var users = [
  24880. * { 'user': 'barney', 'active': true },
  24881. * { 'user': 'fred', 'active': false },
  24882. * { 'user': 'pebbles', 'active': false }
  24883. * ];
  24884. *
  24885. * _.dropRightWhile(users, function(o) { return !o.active; });
  24886. * // => objects for ['barney']
  24887. *
  24888. * // The `_.matches` iteratee shorthand.
  24889. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24890. * // => objects for ['barney', 'fred']
  24891. *
  24892. * // The `_.matchesProperty` iteratee shorthand.
  24893. * _.dropRightWhile(users, ['active', false]);
  24894. * // => objects for ['barney']
  24895. *
  24896. * // The `_.property` iteratee shorthand.
  24897. * _.dropRightWhile(users, 'active');
  24898. * // => objects for ['barney', 'fred', 'pebbles']
  24899. */
  24900. function dropRightWhile(array, predicate) {
  24901. return (array && array.length)
  24902. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24903. : [];
  24904. }
  24905. /**
  24906. * Creates a slice of `array` excluding elements dropped from the beginning.
  24907. * Elements are dropped until `predicate` returns falsey. The predicate is
  24908. * invoked with three arguments: (value, index, array).
  24909. *
  24910. * @static
  24911. * @memberOf _
  24912. * @since 3.0.0
  24913. * @category Array
  24914. * @param {Array} array The array to query.
  24915. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24916. * @returns {Array} Returns the slice of `array`.
  24917. * @example
  24918. *
  24919. * var users = [
  24920. * { 'user': 'barney', 'active': false },
  24921. * { 'user': 'fred', 'active': false },
  24922. * { 'user': 'pebbles', 'active': true }
  24923. * ];
  24924. *
  24925. * _.dropWhile(users, function(o) { return !o.active; });
  24926. * // => objects for ['pebbles']
  24927. *
  24928. * // The `_.matches` iteratee shorthand.
  24929. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24930. * // => objects for ['fred', 'pebbles']
  24931. *
  24932. * // The `_.matchesProperty` iteratee shorthand.
  24933. * _.dropWhile(users, ['active', false]);
  24934. * // => objects for ['pebbles']
  24935. *
  24936. * // The `_.property` iteratee shorthand.
  24937. * _.dropWhile(users, 'active');
  24938. * // => objects for ['barney', 'fred', 'pebbles']
  24939. */
  24940. function dropWhile(array, predicate) {
  24941. return (array && array.length)
  24942. ? baseWhile(array, getIteratee(predicate, 3), true)
  24943. : [];
  24944. }
  24945. /**
  24946. * Fills elements of `array` with `value` from `start` up to, but not
  24947. * including, `end`.
  24948. *
  24949. * **Note:** This method mutates `array`.
  24950. *
  24951. * @static
  24952. * @memberOf _
  24953. * @since 3.2.0
  24954. * @category Array
  24955. * @param {Array} array The array to fill.
  24956. * @param {*} value The value to fill `array` with.
  24957. * @param {number} [start=0] The start position.
  24958. * @param {number} [end=array.length] The end position.
  24959. * @returns {Array} Returns `array`.
  24960. * @example
  24961. *
  24962. * var array = [1, 2, 3];
  24963. *
  24964. * _.fill(array, 'a');
  24965. * console.log(array);
  24966. * // => ['a', 'a', 'a']
  24967. *
  24968. * _.fill(Array(3), 2);
  24969. * // => [2, 2, 2]
  24970. *
  24971. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24972. * // => [4, '*', '*', 10]
  24973. */
  24974. function fill(array, value, start, end) {
  24975. var length = array == null ? 0 : array.length;
  24976. if (!length) {
  24977. return [];
  24978. }
  24979. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24980. start = 0;
  24981. end = length;
  24982. }
  24983. return baseFill(array, value, start, end);
  24984. }
  24985. /**
  24986. * This method is like `_.find` except that it returns the index of the first
  24987. * element `predicate` returns truthy for instead of the element itself.
  24988. *
  24989. * @static
  24990. * @memberOf _
  24991. * @since 1.1.0
  24992. * @category Array
  24993. * @param {Array} array The array to inspect.
  24994. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24995. * @param {number} [fromIndex=0] The index to search from.
  24996. * @returns {number} Returns the index of the found element, else `-1`.
  24997. * @example
  24998. *
  24999. * var users = [
  25000. * { 'user': 'barney', 'active': false },
  25001. * { 'user': 'fred', 'active': false },
  25002. * { 'user': 'pebbles', 'active': true }
  25003. * ];
  25004. *
  25005. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25006. * // => 0
  25007. *
  25008. * // The `_.matches` iteratee shorthand.
  25009. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25010. * // => 1
  25011. *
  25012. * // The `_.matchesProperty` iteratee shorthand.
  25013. * _.findIndex(users, ['active', false]);
  25014. * // => 0
  25015. *
  25016. * // The `_.property` iteratee shorthand.
  25017. * _.findIndex(users, 'active');
  25018. * // => 2
  25019. */
  25020. function findIndex(array, predicate, fromIndex) {
  25021. var length = array == null ? 0 : array.length;
  25022. if (!length) {
  25023. return -1;
  25024. }
  25025. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25026. if (index < 0) {
  25027. index = nativeMax(length + index, 0);
  25028. }
  25029. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25030. }
  25031. /**
  25032. * This method is like `_.findIndex` except that it iterates over elements
  25033. * of `collection` from right to left.
  25034. *
  25035. * @static
  25036. * @memberOf _
  25037. * @since 2.0.0
  25038. * @category Array
  25039. * @param {Array} array The array to inspect.
  25040. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25041. * @param {number} [fromIndex=array.length-1] The index to search from.
  25042. * @returns {number} Returns the index of the found element, else `-1`.
  25043. * @example
  25044. *
  25045. * var users = [
  25046. * { 'user': 'barney', 'active': true },
  25047. * { 'user': 'fred', 'active': false },
  25048. * { 'user': 'pebbles', 'active': false }
  25049. * ];
  25050. *
  25051. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25052. * // => 2
  25053. *
  25054. * // The `_.matches` iteratee shorthand.
  25055. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25056. * // => 0
  25057. *
  25058. * // The `_.matchesProperty` iteratee shorthand.
  25059. * _.findLastIndex(users, ['active', false]);
  25060. * // => 2
  25061. *
  25062. * // The `_.property` iteratee shorthand.
  25063. * _.findLastIndex(users, 'active');
  25064. * // => 0
  25065. */
  25066. function findLastIndex(array, predicate, fromIndex) {
  25067. var length = array == null ? 0 : array.length;
  25068. if (!length) {
  25069. return -1;
  25070. }
  25071. var index = length - 1;
  25072. if (fromIndex !== undefined) {
  25073. index = toInteger(fromIndex);
  25074. index = fromIndex < 0
  25075. ? nativeMax(length + index, 0)
  25076. : nativeMin(index, length - 1);
  25077. }
  25078. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25079. }
  25080. /**
  25081. * Flattens `array` a single level deep.
  25082. *
  25083. * @static
  25084. * @memberOf _
  25085. * @since 0.1.0
  25086. * @category Array
  25087. * @param {Array} array The array to flatten.
  25088. * @returns {Array} Returns the new flattened array.
  25089. * @example
  25090. *
  25091. * _.flatten([1, [2, [3, [4]], 5]]);
  25092. * // => [1, 2, [3, [4]], 5]
  25093. */
  25094. function flatten(array) {
  25095. var length = array == null ? 0 : array.length;
  25096. return length ? baseFlatten(array, 1) : [];
  25097. }
  25098. /**
  25099. * Recursively flattens `array`.
  25100. *
  25101. * @static
  25102. * @memberOf _
  25103. * @since 3.0.0
  25104. * @category Array
  25105. * @param {Array} array The array to flatten.
  25106. * @returns {Array} Returns the new flattened array.
  25107. * @example
  25108. *
  25109. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25110. * // => [1, 2, 3, 4, 5]
  25111. */
  25112. function flattenDeep(array) {
  25113. var length = array == null ? 0 : array.length;
  25114. return length ? baseFlatten(array, INFINITY) : [];
  25115. }
  25116. /**
  25117. * Recursively flatten `array` up to `depth` times.
  25118. *
  25119. * @static
  25120. * @memberOf _
  25121. * @since 4.4.0
  25122. * @category Array
  25123. * @param {Array} array The array to flatten.
  25124. * @param {number} [depth=1] The maximum recursion depth.
  25125. * @returns {Array} Returns the new flattened array.
  25126. * @example
  25127. *
  25128. * var array = [1, [2, [3, [4]], 5]];
  25129. *
  25130. * _.flattenDepth(array, 1);
  25131. * // => [1, 2, [3, [4]], 5]
  25132. *
  25133. * _.flattenDepth(array, 2);
  25134. * // => [1, 2, 3, [4], 5]
  25135. */
  25136. function flattenDepth(array, depth) {
  25137. var length = array == null ? 0 : array.length;
  25138. if (!length) {
  25139. return [];
  25140. }
  25141. depth = depth === undefined ? 1 : toInteger(depth);
  25142. return baseFlatten(array, depth);
  25143. }
  25144. /**
  25145. * The inverse of `_.toPairs`; this method returns an object composed
  25146. * from key-value `pairs`.
  25147. *
  25148. * @static
  25149. * @memberOf _
  25150. * @since 4.0.0
  25151. * @category Array
  25152. * @param {Array} pairs The key-value pairs.
  25153. * @returns {Object} Returns the new object.
  25154. * @example
  25155. *
  25156. * _.fromPairs([['a', 1], ['b', 2]]);
  25157. * // => { 'a': 1, 'b': 2 }
  25158. */
  25159. function fromPairs(pairs) {
  25160. var index = -1,
  25161. length = pairs == null ? 0 : pairs.length,
  25162. result = {};
  25163. while (++index < length) {
  25164. var pair = pairs[index];
  25165. result[pair[0]] = pair[1];
  25166. }
  25167. return result;
  25168. }
  25169. /**
  25170. * Gets the first element of `array`.
  25171. *
  25172. * @static
  25173. * @memberOf _
  25174. * @since 0.1.0
  25175. * @alias first
  25176. * @category Array
  25177. * @param {Array} array The array to query.
  25178. * @returns {*} Returns the first element of `array`.
  25179. * @example
  25180. *
  25181. * _.head([1, 2, 3]);
  25182. * // => 1
  25183. *
  25184. * _.head([]);
  25185. * // => undefined
  25186. */
  25187. function head(array) {
  25188. return (array && array.length) ? array[0] : undefined;
  25189. }
  25190. /**
  25191. * Gets the index at which the first occurrence of `value` is found in `array`
  25192. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25193. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25194. * offset from the end of `array`.
  25195. *
  25196. * @static
  25197. * @memberOf _
  25198. * @since 0.1.0
  25199. * @category Array
  25200. * @param {Array} array The array to inspect.
  25201. * @param {*} value The value to search for.
  25202. * @param {number} [fromIndex=0] The index to search from.
  25203. * @returns {number} Returns the index of the matched value, else `-1`.
  25204. * @example
  25205. *
  25206. * _.indexOf([1, 2, 1, 2], 2);
  25207. * // => 1
  25208. *
  25209. * // Search from the `fromIndex`.
  25210. * _.indexOf([1, 2, 1, 2], 2, 2);
  25211. * // => 3
  25212. */
  25213. function indexOf(array, value, fromIndex) {
  25214. var length = array == null ? 0 : array.length;
  25215. if (!length) {
  25216. return -1;
  25217. }
  25218. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25219. if (index < 0) {
  25220. index = nativeMax(length + index, 0);
  25221. }
  25222. return baseIndexOf(array, value, index);
  25223. }
  25224. /**
  25225. * Gets all but the last element of `array`.
  25226. *
  25227. * @static
  25228. * @memberOf _
  25229. * @since 0.1.0
  25230. * @category Array
  25231. * @param {Array} array The array to query.
  25232. * @returns {Array} Returns the slice of `array`.
  25233. * @example
  25234. *
  25235. * _.initial([1, 2, 3]);
  25236. * // => [1, 2]
  25237. */
  25238. function initial(array) {
  25239. var length = array == null ? 0 : array.length;
  25240. return length ? baseSlice(array, 0, -1) : [];
  25241. }
  25242. /**
  25243. * Creates an array of unique values that are included in all given arrays
  25244. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25245. * for equality comparisons. The order and references of result values are
  25246. * determined by the first array.
  25247. *
  25248. * @static
  25249. * @memberOf _
  25250. * @since 0.1.0
  25251. * @category Array
  25252. * @param {...Array} [arrays] The arrays to inspect.
  25253. * @returns {Array} Returns the new array of intersecting values.
  25254. * @example
  25255. *
  25256. * _.intersection([2, 1], [2, 3]);
  25257. * // => [2]
  25258. */
  25259. var intersection = baseRest(function(arrays) {
  25260. var mapped = arrayMap(arrays, castArrayLikeObject);
  25261. return (mapped.length && mapped[0] === arrays[0])
  25262. ? baseIntersection(mapped)
  25263. : [];
  25264. });
  25265. /**
  25266. * This method is like `_.intersection` except that it accepts `iteratee`
  25267. * which is invoked for each element of each `arrays` to generate the criterion
  25268. * by which they're compared. The order and references of result values are
  25269. * determined by the first array. The iteratee is invoked with one argument:
  25270. * (value).
  25271. *
  25272. * @static
  25273. * @memberOf _
  25274. * @since 4.0.0
  25275. * @category Array
  25276. * @param {...Array} [arrays] The arrays to inspect.
  25277. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25278. * @returns {Array} Returns the new array of intersecting values.
  25279. * @example
  25280. *
  25281. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25282. * // => [2.1]
  25283. *
  25284. * // The `_.property` iteratee shorthand.
  25285. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25286. * // => [{ 'x': 1 }]
  25287. */
  25288. var intersectionBy = baseRest(function(arrays) {
  25289. var iteratee = last(arrays),
  25290. mapped = arrayMap(arrays, castArrayLikeObject);
  25291. if (iteratee === last(mapped)) {
  25292. iteratee = undefined;
  25293. } else {
  25294. mapped.pop();
  25295. }
  25296. return (mapped.length && mapped[0] === arrays[0])
  25297. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25298. : [];
  25299. });
  25300. /**
  25301. * This method is like `_.intersection` except that it accepts `comparator`
  25302. * which is invoked to compare elements of `arrays`. The order and references
  25303. * of result values are determined by the first array. The comparator is
  25304. * invoked with two arguments: (arrVal, othVal).
  25305. *
  25306. * @static
  25307. * @memberOf _
  25308. * @since 4.0.0
  25309. * @category Array
  25310. * @param {...Array} [arrays] The arrays to inspect.
  25311. * @param {Function} [comparator] The comparator invoked per element.
  25312. * @returns {Array} Returns the new array of intersecting values.
  25313. * @example
  25314. *
  25315. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25316. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25317. *
  25318. * _.intersectionWith(objects, others, _.isEqual);
  25319. * // => [{ 'x': 1, 'y': 2 }]
  25320. */
  25321. var intersectionWith = baseRest(function(arrays) {
  25322. var comparator = last(arrays),
  25323. mapped = arrayMap(arrays, castArrayLikeObject);
  25324. comparator = typeof comparator == 'function' ? comparator : undefined;
  25325. if (comparator) {
  25326. mapped.pop();
  25327. }
  25328. return (mapped.length && mapped[0] === arrays[0])
  25329. ? baseIntersection(mapped, undefined, comparator)
  25330. : [];
  25331. });
  25332. /**
  25333. * Converts all elements in `array` into a string separated by `separator`.
  25334. *
  25335. * @static
  25336. * @memberOf _
  25337. * @since 4.0.0
  25338. * @category Array
  25339. * @param {Array} array The array to convert.
  25340. * @param {string} [separator=','] The element separator.
  25341. * @returns {string} Returns the joined string.
  25342. * @example
  25343. *
  25344. * _.join(['a', 'b', 'c'], '~');
  25345. * // => 'a~b~c'
  25346. */
  25347. function join(array, separator) {
  25348. return array == null ? '' : nativeJoin.call(array, separator);
  25349. }
  25350. /**
  25351. * Gets the last element of `array`.
  25352. *
  25353. * @static
  25354. * @memberOf _
  25355. * @since 0.1.0
  25356. * @category Array
  25357. * @param {Array} array The array to query.
  25358. * @returns {*} Returns the last element of `array`.
  25359. * @example
  25360. *
  25361. * _.last([1, 2, 3]);
  25362. * // => 3
  25363. */
  25364. function last(array) {
  25365. var length = array == null ? 0 : array.length;
  25366. return length ? array[length - 1] : undefined;
  25367. }
  25368. /**
  25369. * This method is like `_.indexOf` except that it iterates over elements of
  25370. * `array` from right to left.
  25371. *
  25372. * @static
  25373. * @memberOf _
  25374. * @since 0.1.0
  25375. * @category Array
  25376. * @param {Array} array The array to inspect.
  25377. * @param {*} value The value to search for.
  25378. * @param {number} [fromIndex=array.length-1] The index to search from.
  25379. * @returns {number} Returns the index of the matched value, else `-1`.
  25380. * @example
  25381. *
  25382. * _.lastIndexOf([1, 2, 1, 2], 2);
  25383. * // => 3
  25384. *
  25385. * // Search from the `fromIndex`.
  25386. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25387. * // => 1
  25388. */
  25389. function lastIndexOf(array, value, fromIndex) {
  25390. var length = array == null ? 0 : array.length;
  25391. if (!length) {
  25392. return -1;
  25393. }
  25394. var index = length;
  25395. if (fromIndex !== undefined) {
  25396. index = toInteger(fromIndex);
  25397. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25398. }
  25399. return value === value
  25400. ? strictLastIndexOf(array, value, index)
  25401. : baseFindIndex(array, baseIsNaN, index, true);
  25402. }
  25403. /**
  25404. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25405. * element from the end is returned.
  25406. *
  25407. * @static
  25408. * @memberOf _
  25409. * @since 4.11.0
  25410. * @category Array
  25411. * @param {Array} array The array to query.
  25412. * @param {number} [n=0] The index of the element to return.
  25413. * @returns {*} Returns the nth element of `array`.
  25414. * @example
  25415. *
  25416. * var array = ['a', 'b', 'c', 'd'];
  25417. *
  25418. * _.nth(array, 1);
  25419. * // => 'b'
  25420. *
  25421. * _.nth(array, -2);
  25422. * // => 'c';
  25423. */
  25424. function nth(array, n) {
  25425. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25426. }
  25427. /**
  25428. * Removes all given values from `array` using
  25429. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25430. * for equality comparisons.
  25431. *
  25432. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25433. * to remove elements from an array by predicate.
  25434. *
  25435. * @static
  25436. * @memberOf _
  25437. * @since 2.0.0
  25438. * @category Array
  25439. * @param {Array} array The array to modify.
  25440. * @param {...*} [values] The values to remove.
  25441. * @returns {Array} Returns `array`.
  25442. * @example
  25443. *
  25444. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25445. *
  25446. * _.pull(array, 'a', 'c');
  25447. * console.log(array);
  25448. * // => ['b', 'b']
  25449. */
  25450. var pull = baseRest(pullAll);
  25451. /**
  25452. * This method is like `_.pull` except that it accepts an array of values to remove.
  25453. *
  25454. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25455. *
  25456. * @static
  25457. * @memberOf _
  25458. * @since 4.0.0
  25459. * @category Array
  25460. * @param {Array} array The array to modify.
  25461. * @param {Array} values The values to remove.
  25462. * @returns {Array} Returns `array`.
  25463. * @example
  25464. *
  25465. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25466. *
  25467. * _.pullAll(array, ['a', 'c']);
  25468. * console.log(array);
  25469. * // => ['b', 'b']
  25470. */
  25471. function pullAll(array, values) {
  25472. return (array && array.length && values && values.length)
  25473. ? basePullAll(array, values)
  25474. : array;
  25475. }
  25476. /**
  25477. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25478. * invoked for each element of `array` and `values` to generate the criterion
  25479. * by which they're compared. The iteratee is invoked with one argument: (value).
  25480. *
  25481. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25482. *
  25483. * @static
  25484. * @memberOf _
  25485. * @since 4.0.0
  25486. * @category Array
  25487. * @param {Array} array The array to modify.
  25488. * @param {Array} values The values to remove.
  25489. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25490. * @returns {Array} Returns `array`.
  25491. * @example
  25492. *
  25493. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25494. *
  25495. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25496. * console.log(array);
  25497. * // => [{ 'x': 2 }]
  25498. */
  25499. function pullAllBy(array, values, iteratee) {
  25500. return (array && array.length && values && values.length)
  25501. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25502. : array;
  25503. }
  25504. /**
  25505. * This method is like `_.pullAll` except that it accepts `comparator` which
  25506. * is invoked to compare elements of `array` to `values`. The comparator is
  25507. * invoked with two arguments: (arrVal, othVal).
  25508. *
  25509. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25510. *
  25511. * @static
  25512. * @memberOf _
  25513. * @since 4.6.0
  25514. * @category Array
  25515. * @param {Array} array The array to modify.
  25516. * @param {Array} values The values to remove.
  25517. * @param {Function} [comparator] The comparator invoked per element.
  25518. * @returns {Array} Returns `array`.
  25519. * @example
  25520. *
  25521. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25522. *
  25523. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25524. * console.log(array);
  25525. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25526. */
  25527. function pullAllWith(array, values, comparator) {
  25528. return (array && array.length && values && values.length)
  25529. ? basePullAll(array, values, undefined, comparator)
  25530. : array;
  25531. }
  25532. /**
  25533. * Removes elements from `array` corresponding to `indexes` and returns an
  25534. * array of removed elements.
  25535. *
  25536. * **Note:** Unlike `_.at`, this method mutates `array`.
  25537. *
  25538. * @static
  25539. * @memberOf _
  25540. * @since 3.0.0
  25541. * @category Array
  25542. * @param {Array} array The array to modify.
  25543. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25544. * @returns {Array} Returns the new array of removed elements.
  25545. * @example
  25546. *
  25547. * var array = ['a', 'b', 'c', 'd'];
  25548. * var pulled = _.pullAt(array, [1, 3]);
  25549. *
  25550. * console.log(array);
  25551. * // => ['a', 'c']
  25552. *
  25553. * console.log(pulled);
  25554. * // => ['b', 'd']
  25555. */
  25556. var pullAt = flatRest(function(array, indexes) {
  25557. var length = array == null ? 0 : array.length,
  25558. result = baseAt(array, indexes);
  25559. basePullAt(array, arrayMap(indexes, function(index) {
  25560. return isIndex(index, length) ? +index : index;
  25561. }).sort(compareAscending));
  25562. return result;
  25563. });
  25564. /**
  25565. * Removes all elements from `array` that `predicate` returns truthy for
  25566. * and returns an array of the removed elements. The predicate is invoked
  25567. * with three arguments: (value, index, array).
  25568. *
  25569. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25570. * to pull elements from an array by value.
  25571. *
  25572. * @static
  25573. * @memberOf _
  25574. * @since 2.0.0
  25575. * @category Array
  25576. * @param {Array} array The array to modify.
  25577. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25578. * @returns {Array} Returns the new array of removed elements.
  25579. * @example
  25580. *
  25581. * var array = [1, 2, 3, 4];
  25582. * var evens = _.remove(array, function(n) {
  25583. * return n % 2 == 0;
  25584. * });
  25585. *
  25586. * console.log(array);
  25587. * // => [1, 3]
  25588. *
  25589. * console.log(evens);
  25590. * // => [2, 4]
  25591. */
  25592. function remove(array, predicate) {
  25593. var result = [];
  25594. if (!(array && array.length)) {
  25595. return result;
  25596. }
  25597. var index = -1,
  25598. indexes = [],
  25599. length = array.length;
  25600. predicate = getIteratee(predicate, 3);
  25601. while (++index < length) {
  25602. var value = array[index];
  25603. if (predicate(value, index, array)) {
  25604. result.push(value);
  25605. indexes.push(index);
  25606. }
  25607. }
  25608. basePullAt(array, indexes);
  25609. return result;
  25610. }
  25611. /**
  25612. * Reverses `array` so that the first element becomes the last, the second
  25613. * element becomes the second to last, and so on.
  25614. *
  25615. * **Note:** This method mutates `array` and is based on
  25616. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25617. *
  25618. * @static
  25619. * @memberOf _
  25620. * @since 4.0.0
  25621. * @category Array
  25622. * @param {Array} array The array to modify.
  25623. * @returns {Array} Returns `array`.
  25624. * @example
  25625. *
  25626. * var array = [1, 2, 3];
  25627. *
  25628. * _.reverse(array);
  25629. * // => [3, 2, 1]
  25630. *
  25631. * console.log(array);
  25632. * // => [3, 2, 1]
  25633. */
  25634. function reverse(array) {
  25635. return array == null ? array : nativeReverse.call(array);
  25636. }
  25637. /**
  25638. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25639. *
  25640. * **Note:** This method is used instead of
  25641. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25642. * returned.
  25643. *
  25644. * @static
  25645. * @memberOf _
  25646. * @since 3.0.0
  25647. * @category Array
  25648. * @param {Array} array The array to slice.
  25649. * @param {number} [start=0] The start position.
  25650. * @param {number} [end=array.length] The end position.
  25651. * @returns {Array} Returns the slice of `array`.
  25652. */
  25653. function slice(array, start, end) {
  25654. var length = array == null ? 0 : array.length;
  25655. if (!length) {
  25656. return [];
  25657. }
  25658. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25659. start = 0;
  25660. end = length;
  25661. }
  25662. else {
  25663. start = start == null ? 0 : toInteger(start);
  25664. end = end === undefined ? length : toInteger(end);
  25665. }
  25666. return baseSlice(array, start, end);
  25667. }
  25668. /**
  25669. * Uses a binary search to determine the lowest index at which `value`
  25670. * should be inserted into `array` in order to maintain its sort order.
  25671. *
  25672. * @static
  25673. * @memberOf _
  25674. * @since 0.1.0
  25675. * @category Array
  25676. * @param {Array} array The sorted array to inspect.
  25677. * @param {*} value The value to evaluate.
  25678. * @returns {number} Returns the index at which `value` should be inserted
  25679. * into `array`.
  25680. * @example
  25681. *
  25682. * _.sortedIndex([30, 50], 40);
  25683. * // => 1
  25684. */
  25685. function sortedIndex(array, value) {
  25686. return baseSortedIndex(array, value);
  25687. }
  25688. /**
  25689. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25690. * which is invoked for `value` and each element of `array` to compute their
  25691. * sort ranking. The iteratee is invoked with one argument: (value).
  25692. *
  25693. * @static
  25694. * @memberOf _
  25695. * @since 4.0.0
  25696. * @category Array
  25697. * @param {Array} array The sorted array to inspect.
  25698. * @param {*} value The value to evaluate.
  25699. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25700. * @returns {number} Returns the index at which `value` should be inserted
  25701. * into `array`.
  25702. * @example
  25703. *
  25704. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25705. *
  25706. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25707. * // => 0
  25708. *
  25709. * // The `_.property` iteratee shorthand.
  25710. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25711. * // => 0
  25712. */
  25713. function sortedIndexBy(array, value, iteratee) {
  25714. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25715. }
  25716. /**
  25717. * This method is like `_.indexOf` except that it performs a binary
  25718. * search on a sorted `array`.
  25719. *
  25720. * @static
  25721. * @memberOf _
  25722. * @since 4.0.0
  25723. * @category Array
  25724. * @param {Array} array The array to inspect.
  25725. * @param {*} value The value to search for.
  25726. * @returns {number} Returns the index of the matched value, else `-1`.
  25727. * @example
  25728. *
  25729. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25730. * // => 1
  25731. */
  25732. function sortedIndexOf(array, value) {
  25733. var length = array == null ? 0 : array.length;
  25734. if (length) {
  25735. var index = baseSortedIndex(array, value);
  25736. if (index < length && eq(array[index], value)) {
  25737. return index;
  25738. }
  25739. }
  25740. return -1;
  25741. }
  25742. /**
  25743. * This method is like `_.sortedIndex` except that it returns the highest
  25744. * index at which `value` should be inserted into `array` in order to
  25745. * maintain its sort order.
  25746. *
  25747. * @static
  25748. * @memberOf _
  25749. * @since 3.0.0
  25750. * @category Array
  25751. * @param {Array} array The sorted array to inspect.
  25752. * @param {*} value The value to evaluate.
  25753. * @returns {number} Returns the index at which `value` should be inserted
  25754. * into `array`.
  25755. * @example
  25756. *
  25757. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25758. * // => 4
  25759. */
  25760. function sortedLastIndex(array, value) {
  25761. return baseSortedIndex(array, value, true);
  25762. }
  25763. /**
  25764. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25765. * which is invoked for `value` and each element of `array` to compute their
  25766. * sort ranking. The iteratee is invoked with one argument: (value).
  25767. *
  25768. * @static
  25769. * @memberOf _
  25770. * @since 4.0.0
  25771. * @category Array
  25772. * @param {Array} array The sorted array to inspect.
  25773. * @param {*} value The value to evaluate.
  25774. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25775. * @returns {number} Returns the index at which `value` should be inserted
  25776. * into `array`.
  25777. * @example
  25778. *
  25779. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25780. *
  25781. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25782. * // => 1
  25783. *
  25784. * // The `_.property` iteratee shorthand.
  25785. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25786. * // => 1
  25787. */
  25788. function sortedLastIndexBy(array, value, iteratee) {
  25789. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25790. }
  25791. /**
  25792. * This method is like `_.lastIndexOf` except that it performs a binary
  25793. * search on a sorted `array`.
  25794. *
  25795. * @static
  25796. * @memberOf _
  25797. * @since 4.0.0
  25798. * @category Array
  25799. * @param {Array} array The array to inspect.
  25800. * @param {*} value The value to search for.
  25801. * @returns {number} Returns the index of the matched value, else `-1`.
  25802. * @example
  25803. *
  25804. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25805. * // => 3
  25806. */
  25807. function sortedLastIndexOf(array, value) {
  25808. var length = array == null ? 0 : array.length;
  25809. if (length) {
  25810. var index = baseSortedIndex(array, value, true) - 1;
  25811. if (eq(array[index], value)) {
  25812. return index;
  25813. }
  25814. }
  25815. return -1;
  25816. }
  25817. /**
  25818. * This method is like `_.uniq` except that it's designed and optimized
  25819. * for sorted arrays.
  25820. *
  25821. * @static
  25822. * @memberOf _
  25823. * @since 4.0.0
  25824. * @category Array
  25825. * @param {Array} array The array to inspect.
  25826. * @returns {Array} Returns the new duplicate free array.
  25827. * @example
  25828. *
  25829. * _.sortedUniq([1, 1, 2]);
  25830. * // => [1, 2]
  25831. */
  25832. function sortedUniq(array) {
  25833. return (array && array.length)
  25834. ? baseSortedUniq(array)
  25835. : [];
  25836. }
  25837. /**
  25838. * This method is like `_.uniqBy` except that it's designed and optimized
  25839. * for sorted arrays.
  25840. *
  25841. * @static
  25842. * @memberOf _
  25843. * @since 4.0.0
  25844. * @category Array
  25845. * @param {Array} array The array to inspect.
  25846. * @param {Function} [iteratee] The iteratee invoked per element.
  25847. * @returns {Array} Returns the new duplicate free array.
  25848. * @example
  25849. *
  25850. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25851. * // => [1.1, 2.3]
  25852. */
  25853. function sortedUniqBy(array, iteratee) {
  25854. return (array && array.length)
  25855. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25856. : [];
  25857. }
  25858. /**
  25859. * Gets all but the first element of `array`.
  25860. *
  25861. * @static
  25862. * @memberOf _
  25863. * @since 4.0.0
  25864. * @category Array
  25865. * @param {Array} array The array to query.
  25866. * @returns {Array} Returns the slice of `array`.
  25867. * @example
  25868. *
  25869. * _.tail([1, 2, 3]);
  25870. * // => [2, 3]
  25871. */
  25872. function tail(array) {
  25873. var length = array == null ? 0 : array.length;
  25874. return length ? baseSlice(array, 1, length) : [];
  25875. }
  25876. /**
  25877. * Creates a slice of `array` with `n` elements taken from the beginning.
  25878. *
  25879. * @static
  25880. * @memberOf _
  25881. * @since 0.1.0
  25882. * @category Array
  25883. * @param {Array} array The array to query.
  25884. * @param {number} [n=1] The number of elements to take.
  25885. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25886. * @returns {Array} Returns the slice of `array`.
  25887. * @example
  25888. *
  25889. * _.take([1, 2, 3]);
  25890. * // => [1]
  25891. *
  25892. * _.take([1, 2, 3], 2);
  25893. * // => [1, 2]
  25894. *
  25895. * _.take([1, 2, 3], 5);
  25896. * // => [1, 2, 3]
  25897. *
  25898. * _.take([1, 2, 3], 0);
  25899. * // => []
  25900. */
  25901. function take(array, n, guard) {
  25902. if (!(array && array.length)) {
  25903. return [];
  25904. }
  25905. n = (guard || n === undefined) ? 1 : toInteger(n);
  25906. return baseSlice(array, 0, n < 0 ? 0 : n);
  25907. }
  25908. /**
  25909. * Creates a slice of `array` with `n` elements taken from the end.
  25910. *
  25911. * @static
  25912. * @memberOf _
  25913. * @since 3.0.0
  25914. * @category Array
  25915. * @param {Array} array The array to query.
  25916. * @param {number} [n=1] The number of elements to take.
  25917. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25918. * @returns {Array} Returns the slice of `array`.
  25919. * @example
  25920. *
  25921. * _.takeRight([1, 2, 3]);
  25922. * // => [3]
  25923. *
  25924. * _.takeRight([1, 2, 3], 2);
  25925. * // => [2, 3]
  25926. *
  25927. * _.takeRight([1, 2, 3], 5);
  25928. * // => [1, 2, 3]
  25929. *
  25930. * _.takeRight([1, 2, 3], 0);
  25931. * // => []
  25932. */
  25933. function takeRight(array, n, guard) {
  25934. var length = array == null ? 0 : array.length;
  25935. if (!length) {
  25936. return [];
  25937. }
  25938. n = (guard || n === undefined) ? 1 : toInteger(n);
  25939. n = length - n;
  25940. return baseSlice(array, n < 0 ? 0 : n, length);
  25941. }
  25942. /**
  25943. * Creates a slice of `array` with elements taken from the end. Elements are
  25944. * taken until `predicate` returns falsey. The predicate is invoked with
  25945. * three arguments: (value, index, array).
  25946. *
  25947. * @static
  25948. * @memberOf _
  25949. * @since 3.0.0
  25950. * @category Array
  25951. * @param {Array} array The array to query.
  25952. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25953. * @returns {Array} Returns the slice of `array`.
  25954. * @example
  25955. *
  25956. * var users = [
  25957. * { 'user': 'barney', 'active': true },
  25958. * { 'user': 'fred', 'active': false },
  25959. * { 'user': 'pebbles', 'active': false }
  25960. * ];
  25961. *
  25962. * _.takeRightWhile(users, function(o) { return !o.active; });
  25963. * // => objects for ['fred', 'pebbles']
  25964. *
  25965. * // The `_.matches` iteratee shorthand.
  25966. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25967. * // => objects for ['pebbles']
  25968. *
  25969. * // The `_.matchesProperty` iteratee shorthand.
  25970. * _.takeRightWhile(users, ['active', false]);
  25971. * // => objects for ['fred', 'pebbles']
  25972. *
  25973. * // The `_.property` iteratee shorthand.
  25974. * _.takeRightWhile(users, 'active');
  25975. * // => []
  25976. */
  25977. function takeRightWhile(array, predicate) {
  25978. return (array && array.length)
  25979. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25980. : [];
  25981. }
  25982. /**
  25983. * Creates a slice of `array` with elements taken from the beginning. Elements
  25984. * are taken until `predicate` returns falsey. The predicate is invoked with
  25985. * three arguments: (value, index, array).
  25986. *
  25987. * @static
  25988. * @memberOf _
  25989. * @since 3.0.0
  25990. * @category Array
  25991. * @param {Array} array The array to query.
  25992. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25993. * @returns {Array} Returns the slice of `array`.
  25994. * @example
  25995. *
  25996. * var users = [
  25997. * { 'user': 'barney', 'active': false },
  25998. * { 'user': 'fred', 'active': false },
  25999. * { 'user': 'pebbles', 'active': true }
  26000. * ];
  26001. *
  26002. * _.takeWhile(users, function(o) { return !o.active; });
  26003. * // => objects for ['barney', 'fred']
  26004. *
  26005. * // The `_.matches` iteratee shorthand.
  26006. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26007. * // => objects for ['barney']
  26008. *
  26009. * // The `_.matchesProperty` iteratee shorthand.
  26010. * _.takeWhile(users, ['active', false]);
  26011. * // => objects for ['barney', 'fred']
  26012. *
  26013. * // The `_.property` iteratee shorthand.
  26014. * _.takeWhile(users, 'active');
  26015. * // => []
  26016. */
  26017. function takeWhile(array, predicate) {
  26018. return (array && array.length)
  26019. ? baseWhile(array, getIteratee(predicate, 3))
  26020. : [];
  26021. }
  26022. /**
  26023. * Creates an array of unique values, in order, from all given arrays using
  26024. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26025. * for equality comparisons.
  26026. *
  26027. * @static
  26028. * @memberOf _
  26029. * @since 0.1.0
  26030. * @category Array
  26031. * @param {...Array} [arrays] The arrays to inspect.
  26032. * @returns {Array} Returns the new array of combined values.
  26033. * @example
  26034. *
  26035. * _.union([2], [1, 2]);
  26036. * // => [2, 1]
  26037. */
  26038. var union = baseRest(function(arrays) {
  26039. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26040. });
  26041. /**
  26042. * This method is like `_.union` except that it accepts `iteratee` which is
  26043. * invoked for each element of each `arrays` to generate the criterion by
  26044. * which uniqueness is computed. Result values are chosen from the first
  26045. * array in which the value occurs. The iteratee is invoked with one argument:
  26046. * (value).
  26047. *
  26048. * @static
  26049. * @memberOf _
  26050. * @since 4.0.0
  26051. * @category Array
  26052. * @param {...Array} [arrays] The arrays to inspect.
  26053. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26054. * @returns {Array} Returns the new array of combined values.
  26055. * @example
  26056. *
  26057. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26058. * // => [2.1, 1.2]
  26059. *
  26060. * // The `_.property` iteratee shorthand.
  26061. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26062. * // => [{ 'x': 1 }, { 'x': 2 }]
  26063. */
  26064. var unionBy = baseRest(function(arrays) {
  26065. var iteratee = last(arrays);
  26066. if (isArrayLikeObject(iteratee)) {
  26067. iteratee = undefined;
  26068. }
  26069. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26070. });
  26071. /**
  26072. * This method is like `_.union` except that it accepts `comparator` which
  26073. * is invoked to compare elements of `arrays`. Result values are chosen from
  26074. * the first array in which the value occurs. The comparator is invoked
  26075. * with two arguments: (arrVal, othVal).
  26076. *
  26077. * @static
  26078. * @memberOf _
  26079. * @since 4.0.0
  26080. * @category Array
  26081. * @param {...Array} [arrays] The arrays to inspect.
  26082. * @param {Function} [comparator] The comparator invoked per element.
  26083. * @returns {Array} Returns the new array of combined values.
  26084. * @example
  26085. *
  26086. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26087. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26088. *
  26089. * _.unionWith(objects, others, _.isEqual);
  26090. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26091. */
  26092. var unionWith = baseRest(function(arrays) {
  26093. var comparator = last(arrays);
  26094. comparator = typeof comparator == 'function' ? comparator : undefined;
  26095. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26096. });
  26097. /**
  26098. * Creates a duplicate-free version of an array, using
  26099. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26100. * for equality comparisons, in which only the first occurrence of each element
  26101. * is kept. The order of result values is determined by the order they occur
  26102. * in the array.
  26103. *
  26104. * @static
  26105. * @memberOf _
  26106. * @since 0.1.0
  26107. * @category Array
  26108. * @param {Array} array The array to inspect.
  26109. * @returns {Array} Returns the new duplicate free array.
  26110. * @example
  26111. *
  26112. * _.uniq([2, 1, 2]);
  26113. * // => [2, 1]
  26114. */
  26115. function uniq(array) {
  26116. return (array && array.length) ? baseUniq(array) : [];
  26117. }
  26118. /**
  26119. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26120. * invoked for each element in `array` to generate the criterion by which
  26121. * uniqueness is computed. The order of result values is determined by the
  26122. * order they occur in the array. The iteratee is invoked with one argument:
  26123. * (value).
  26124. *
  26125. * @static
  26126. * @memberOf _
  26127. * @since 4.0.0
  26128. * @category Array
  26129. * @param {Array} array The array to inspect.
  26130. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26131. * @returns {Array} Returns the new duplicate free array.
  26132. * @example
  26133. *
  26134. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26135. * // => [2.1, 1.2]
  26136. *
  26137. * // The `_.property` iteratee shorthand.
  26138. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26139. * // => [{ 'x': 1 }, { 'x': 2 }]
  26140. */
  26141. function uniqBy(array, iteratee) {
  26142. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26143. }
  26144. /**
  26145. * This method is like `_.uniq` except that it accepts `comparator` which
  26146. * is invoked to compare elements of `array`. The order of result values is
  26147. * determined by the order they occur in the array.The comparator is invoked
  26148. * with two arguments: (arrVal, othVal).
  26149. *
  26150. * @static
  26151. * @memberOf _
  26152. * @since 4.0.0
  26153. * @category Array
  26154. * @param {Array} array The array to inspect.
  26155. * @param {Function} [comparator] The comparator invoked per element.
  26156. * @returns {Array} Returns the new duplicate free array.
  26157. * @example
  26158. *
  26159. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26160. *
  26161. * _.uniqWith(objects, _.isEqual);
  26162. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26163. */
  26164. function uniqWith(array, comparator) {
  26165. comparator = typeof comparator == 'function' ? comparator : undefined;
  26166. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26167. }
  26168. /**
  26169. * This method is like `_.zip` except that it accepts an array of grouped
  26170. * elements and creates an array regrouping the elements to their pre-zip
  26171. * configuration.
  26172. *
  26173. * @static
  26174. * @memberOf _
  26175. * @since 1.2.0
  26176. * @category Array
  26177. * @param {Array} array The array of grouped elements to process.
  26178. * @returns {Array} Returns the new array of regrouped elements.
  26179. * @example
  26180. *
  26181. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26182. * // => [['a', 1, true], ['b', 2, false]]
  26183. *
  26184. * _.unzip(zipped);
  26185. * // => [['a', 'b'], [1, 2], [true, false]]
  26186. */
  26187. function unzip(array) {
  26188. if (!(array && array.length)) {
  26189. return [];
  26190. }
  26191. var length = 0;
  26192. array = arrayFilter(array, function(group) {
  26193. if (isArrayLikeObject(group)) {
  26194. length = nativeMax(group.length, length);
  26195. return true;
  26196. }
  26197. });
  26198. return baseTimes(length, function(index) {
  26199. return arrayMap(array, baseProperty(index));
  26200. });
  26201. }
  26202. /**
  26203. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26204. * how regrouped values should be combined. The iteratee is invoked with the
  26205. * elements of each group: (...group).
  26206. *
  26207. * @static
  26208. * @memberOf _
  26209. * @since 3.8.0
  26210. * @category Array
  26211. * @param {Array} array The array of grouped elements to process.
  26212. * @param {Function} [iteratee=_.identity] The function to combine
  26213. * regrouped values.
  26214. * @returns {Array} Returns the new array of regrouped elements.
  26215. * @example
  26216. *
  26217. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26218. * // => [[1, 10, 100], [2, 20, 200]]
  26219. *
  26220. * _.unzipWith(zipped, _.add);
  26221. * // => [3, 30, 300]
  26222. */
  26223. function unzipWith(array, iteratee) {
  26224. if (!(array && array.length)) {
  26225. return [];
  26226. }
  26227. var result = unzip(array);
  26228. if (iteratee == null) {
  26229. return result;
  26230. }
  26231. return arrayMap(result, function(group) {
  26232. return apply(iteratee, undefined, group);
  26233. });
  26234. }
  26235. /**
  26236. * Creates an array excluding all given values using
  26237. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26238. * for equality comparisons.
  26239. *
  26240. * **Note:** Unlike `_.pull`, this method returns a new array.
  26241. *
  26242. * @static
  26243. * @memberOf _
  26244. * @since 0.1.0
  26245. * @category Array
  26246. * @param {Array} array The array to inspect.
  26247. * @param {...*} [values] The values to exclude.
  26248. * @returns {Array} Returns the new array of filtered values.
  26249. * @see _.difference, _.xor
  26250. * @example
  26251. *
  26252. * _.without([2, 1, 2, 3], 1, 2);
  26253. * // => [3]
  26254. */
  26255. var without = baseRest(function(array, values) {
  26256. return isArrayLikeObject(array)
  26257. ? baseDifference(array, values)
  26258. : [];
  26259. });
  26260. /**
  26261. * Creates an array of unique values that is the
  26262. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26263. * of the given arrays. The order of result values is determined by the order
  26264. * they occur in the arrays.
  26265. *
  26266. * @static
  26267. * @memberOf _
  26268. * @since 2.4.0
  26269. * @category Array
  26270. * @param {...Array} [arrays] The arrays to inspect.
  26271. * @returns {Array} Returns the new array of filtered values.
  26272. * @see _.difference, _.without
  26273. * @example
  26274. *
  26275. * _.xor([2, 1], [2, 3]);
  26276. * // => [1, 3]
  26277. */
  26278. var xor = baseRest(function(arrays) {
  26279. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26280. });
  26281. /**
  26282. * This method is like `_.xor` except that it accepts `iteratee` which is
  26283. * invoked for each element of each `arrays` to generate the criterion by
  26284. * which by which they're compared. The order of result values is determined
  26285. * by the order they occur in the arrays. The iteratee is invoked with one
  26286. * argument: (value).
  26287. *
  26288. * @static
  26289. * @memberOf _
  26290. * @since 4.0.0
  26291. * @category Array
  26292. * @param {...Array} [arrays] The arrays to inspect.
  26293. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26294. * @returns {Array} Returns the new array of filtered values.
  26295. * @example
  26296. *
  26297. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26298. * // => [1.2, 3.4]
  26299. *
  26300. * // The `_.property` iteratee shorthand.
  26301. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26302. * // => [{ 'x': 2 }]
  26303. */
  26304. var xorBy = baseRest(function(arrays) {
  26305. var iteratee = last(arrays);
  26306. if (isArrayLikeObject(iteratee)) {
  26307. iteratee = undefined;
  26308. }
  26309. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26310. });
  26311. /**
  26312. * This method is like `_.xor` except that it accepts `comparator` which is
  26313. * invoked to compare elements of `arrays`. The order of result values is
  26314. * determined by the order they occur in the arrays. The comparator is invoked
  26315. * with two arguments: (arrVal, othVal).
  26316. *
  26317. * @static
  26318. * @memberOf _
  26319. * @since 4.0.0
  26320. * @category Array
  26321. * @param {...Array} [arrays] The arrays to inspect.
  26322. * @param {Function} [comparator] The comparator invoked per element.
  26323. * @returns {Array} Returns the new array of filtered values.
  26324. * @example
  26325. *
  26326. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26327. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26328. *
  26329. * _.xorWith(objects, others, _.isEqual);
  26330. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26331. */
  26332. var xorWith = baseRest(function(arrays) {
  26333. var comparator = last(arrays);
  26334. comparator = typeof comparator == 'function' ? comparator : undefined;
  26335. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26336. });
  26337. /**
  26338. * Creates an array of grouped elements, the first of which contains the
  26339. * first elements of the given arrays, the second of which contains the
  26340. * second elements of the given arrays, and so on.
  26341. *
  26342. * @static
  26343. * @memberOf _
  26344. * @since 0.1.0
  26345. * @category Array
  26346. * @param {...Array} [arrays] The arrays to process.
  26347. * @returns {Array} Returns the new array of grouped elements.
  26348. * @example
  26349. *
  26350. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26351. * // => [['a', 1, true], ['b', 2, false]]
  26352. */
  26353. var zip = baseRest(unzip);
  26354. /**
  26355. * This method is like `_.fromPairs` except that it accepts two arrays,
  26356. * one of property identifiers and one of corresponding values.
  26357. *
  26358. * @static
  26359. * @memberOf _
  26360. * @since 0.4.0
  26361. * @category Array
  26362. * @param {Array} [props=[]] The property identifiers.
  26363. * @param {Array} [values=[]] The property values.
  26364. * @returns {Object} Returns the new object.
  26365. * @example
  26366. *
  26367. * _.zipObject(['a', 'b'], [1, 2]);
  26368. * // => { 'a': 1, 'b': 2 }
  26369. */
  26370. function zipObject(props, values) {
  26371. return baseZipObject(props || [], values || [], assignValue);
  26372. }
  26373. /**
  26374. * This method is like `_.zipObject` except that it supports property paths.
  26375. *
  26376. * @static
  26377. * @memberOf _
  26378. * @since 4.1.0
  26379. * @category Array
  26380. * @param {Array} [props=[]] The property identifiers.
  26381. * @param {Array} [values=[]] The property values.
  26382. * @returns {Object} Returns the new object.
  26383. * @example
  26384. *
  26385. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26386. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26387. */
  26388. function zipObjectDeep(props, values) {
  26389. return baseZipObject(props || [], values || [], baseSet);
  26390. }
  26391. /**
  26392. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26393. * how grouped values should be combined. The iteratee is invoked with the
  26394. * elements of each group: (...group).
  26395. *
  26396. * @static
  26397. * @memberOf _
  26398. * @since 3.8.0
  26399. * @category Array
  26400. * @param {...Array} [arrays] The arrays to process.
  26401. * @param {Function} [iteratee=_.identity] The function to combine
  26402. * grouped values.
  26403. * @returns {Array} Returns the new array of grouped elements.
  26404. * @example
  26405. *
  26406. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26407. * return a + b + c;
  26408. * });
  26409. * // => [111, 222]
  26410. */
  26411. var zipWith = baseRest(function(arrays) {
  26412. var length = arrays.length,
  26413. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26414. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26415. return unzipWith(arrays, iteratee);
  26416. });
  26417. /*------------------------------------------------------------------------*/
  26418. /**
  26419. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26420. * chain sequences enabled. The result of such sequences must be unwrapped
  26421. * with `_#value`.
  26422. *
  26423. * @static
  26424. * @memberOf _
  26425. * @since 1.3.0
  26426. * @category Seq
  26427. * @param {*} value The value to wrap.
  26428. * @returns {Object} Returns the new `lodash` wrapper instance.
  26429. * @example
  26430. *
  26431. * var users = [
  26432. * { 'user': 'barney', 'age': 36 },
  26433. * { 'user': 'fred', 'age': 40 },
  26434. * { 'user': 'pebbles', 'age': 1 }
  26435. * ];
  26436. *
  26437. * var youngest = _
  26438. * .chain(users)
  26439. * .sortBy('age')
  26440. * .map(function(o) {
  26441. * return o.user + ' is ' + o.age;
  26442. * })
  26443. * .head()
  26444. * .value();
  26445. * // => 'pebbles is 1'
  26446. */
  26447. function chain(value) {
  26448. var result = lodash(value);
  26449. result.__chain__ = true;
  26450. return result;
  26451. }
  26452. /**
  26453. * This method invokes `interceptor` and returns `value`. The interceptor
  26454. * is invoked with one argument; (value). The purpose of this method is to
  26455. * "tap into" a method chain sequence in order to modify intermediate results.
  26456. *
  26457. * @static
  26458. * @memberOf _
  26459. * @since 0.1.0
  26460. * @category Seq
  26461. * @param {*} value The value to provide to `interceptor`.
  26462. * @param {Function} interceptor The function to invoke.
  26463. * @returns {*} Returns `value`.
  26464. * @example
  26465. *
  26466. * _([1, 2, 3])
  26467. * .tap(function(array) {
  26468. * // Mutate input array.
  26469. * array.pop();
  26470. * })
  26471. * .reverse()
  26472. * .value();
  26473. * // => [2, 1]
  26474. */
  26475. function tap(value, interceptor) {
  26476. interceptor(value);
  26477. return value;
  26478. }
  26479. /**
  26480. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26481. * The purpose of this method is to "pass thru" values replacing intermediate
  26482. * results in a method chain sequence.
  26483. *
  26484. * @static
  26485. * @memberOf _
  26486. * @since 3.0.0
  26487. * @category Seq
  26488. * @param {*} value The value to provide to `interceptor`.
  26489. * @param {Function} interceptor The function to invoke.
  26490. * @returns {*} Returns the result of `interceptor`.
  26491. * @example
  26492. *
  26493. * _(' abc ')
  26494. * .chain()
  26495. * .trim()
  26496. * .thru(function(value) {
  26497. * return [value];
  26498. * })
  26499. * .value();
  26500. * // => ['abc']
  26501. */
  26502. function thru(value, interceptor) {
  26503. return interceptor(value);
  26504. }
  26505. /**
  26506. * This method is the wrapper version of `_.at`.
  26507. *
  26508. * @name at
  26509. * @memberOf _
  26510. * @since 1.0.0
  26511. * @category Seq
  26512. * @param {...(string|string[])} [paths] The property paths to pick.
  26513. * @returns {Object} Returns the new `lodash` wrapper instance.
  26514. * @example
  26515. *
  26516. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26517. *
  26518. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26519. * // => [3, 4]
  26520. */
  26521. var wrapperAt = flatRest(function(paths) {
  26522. var length = paths.length,
  26523. start = length ? paths[0] : 0,
  26524. value = this.__wrapped__,
  26525. interceptor = function(object) { return baseAt(object, paths); };
  26526. if (length > 1 || this.__actions__.length ||
  26527. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26528. return this.thru(interceptor);
  26529. }
  26530. value = value.slice(start, +start + (length ? 1 : 0));
  26531. value.__actions__.push({
  26532. 'func': thru,
  26533. 'args': [interceptor],
  26534. 'thisArg': undefined
  26535. });
  26536. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26537. if (length && !array.length) {
  26538. array.push(undefined);
  26539. }
  26540. return array;
  26541. });
  26542. });
  26543. /**
  26544. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26545. *
  26546. * @name chain
  26547. * @memberOf _
  26548. * @since 0.1.0
  26549. * @category Seq
  26550. * @returns {Object} Returns the new `lodash` wrapper instance.
  26551. * @example
  26552. *
  26553. * var users = [
  26554. * { 'user': 'barney', 'age': 36 },
  26555. * { 'user': 'fred', 'age': 40 }
  26556. * ];
  26557. *
  26558. * // A sequence without explicit chaining.
  26559. * _(users).head();
  26560. * // => { 'user': 'barney', 'age': 36 }
  26561. *
  26562. * // A sequence with explicit chaining.
  26563. * _(users)
  26564. * .chain()
  26565. * .head()
  26566. * .pick('user')
  26567. * .value();
  26568. * // => { 'user': 'barney' }
  26569. */
  26570. function wrapperChain() {
  26571. return chain(this);
  26572. }
  26573. /**
  26574. * Executes the chain sequence and returns the wrapped result.
  26575. *
  26576. * @name commit
  26577. * @memberOf _
  26578. * @since 3.2.0
  26579. * @category Seq
  26580. * @returns {Object} Returns the new `lodash` wrapper instance.
  26581. * @example
  26582. *
  26583. * var array = [1, 2];
  26584. * var wrapped = _(array).push(3);
  26585. *
  26586. * console.log(array);
  26587. * // => [1, 2]
  26588. *
  26589. * wrapped = wrapped.commit();
  26590. * console.log(array);
  26591. * // => [1, 2, 3]
  26592. *
  26593. * wrapped.last();
  26594. * // => 3
  26595. *
  26596. * console.log(array);
  26597. * // => [1, 2, 3]
  26598. */
  26599. function wrapperCommit() {
  26600. return new LodashWrapper(this.value(), this.__chain__);
  26601. }
  26602. /**
  26603. * Gets the next value on a wrapped object following the
  26604. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26605. *
  26606. * @name next
  26607. * @memberOf _
  26608. * @since 4.0.0
  26609. * @category Seq
  26610. * @returns {Object} Returns the next iterator value.
  26611. * @example
  26612. *
  26613. * var wrapped = _([1, 2]);
  26614. *
  26615. * wrapped.next();
  26616. * // => { 'done': false, 'value': 1 }
  26617. *
  26618. * wrapped.next();
  26619. * // => { 'done': false, 'value': 2 }
  26620. *
  26621. * wrapped.next();
  26622. * // => { 'done': true, 'value': undefined }
  26623. */
  26624. function wrapperNext() {
  26625. if (this.__values__ === undefined) {
  26626. this.__values__ = toArray(this.value());
  26627. }
  26628. var done = this.__index__ >= this.__values__.length,
  26629. value = done ? undefined : this.__values__[this.__index__++];
  26630. return { 'done': done, 'value': value };
  26631. }
  26632. /**
  26633. * Enables the wrapper to be iterable.
  26634. *
  26635. * @name Symbol.iterator
  26636. * @memberOf _
  26637. * @since 4.0.0
  26638. * @category Seq
  26639. * @returns {Object} Returns the wrapper object.
  26640. * @example
  26641. *
  26642. * var wrapped = _([1, 2]);
  26643. *
  26644. * wrapped[Symbol.iterator]() === wrapped;
  26645. * // => true
  26646. *
  26647. * Array.from(wrapped);
  26648. * // => [1, 2]
  26649. */
  26650. function wrapperToIterator() {
  26651. return this;
  26652. }
  26653. /**
  26654. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26655. *
  26656. * @name plant
  26657. * @memberOf _
  26658. * @since 3.2.0
  26659. * @category Seq
  26660. * @param {*} value The value to plant.
  26661. * @returns {Object} Returns the new `lodash` wrapper instance.
  26662. * @example
  26663. *
  26664. * function square(n) {
  26665. * return n * n;
  26666. * }
  26667. *
  26668. * var wrapped = _([1, 2]).map(square);
  26669. * var other = wrapped.plant([3, 4]);
  26670. *
  26671. * other.value();
  26672. * // => [9, 16]
  26673. *
  26674. * wrapped.value();
  26675. * // => [1, 4]
  26676. */
  26677. function wrapperPlant(value) {
  26678. var result,
  26679. parent = this;
  26680. while (parent instanceof baseLodash) {
  26681. var clone = wrapperClone(parent);
  26682. clone.__index__ = 0;
  26683. clone.__values__ = undefined;
  26684. if (result) {
  26685. previous.__wrapped__ = clone;
  26686. } else {
  26687. result = clone;
  26688. }
  26689. var previous = clone;
  26690. parent = parent.__wrapped__;
  26691. }
  26692. previous.__wrapped__ = value;
  26693. return result;
  26694. }
  26695. /**
  26696. * This method is the wrapper version of `_.reverse`.
  26697. *
  26698. * **Note:** This method mutates the wrapped array.
  26699. *
  26700. * @name reverse
  26701. * @memberOf _
  26702. * @since 0.1.0
  26703. * @category Seq
  26704. * @returns {Object} Returns the new `lodash` wrapper instance.
  26705. * @example
  26706. *
  26707. * var array = [1, 2, 3];
  26708. *
  26709. * _(array).reverse().value()
  26710. * // => [3, 2, 1]
  26711. *
  26712. * console.log(array);
  26713. * // => [3, 2, 1]
  26714. */
  26715. function wrapperReverse() {
  26716. var value = this.__wrapped__;
  26717. if (value instanceof LazyWrapper) {
  26718. var wrapped = value;
  26719. if (this.__actions__.length) {
  26720. wrapped = new LazyWrapper(this);
  26721. }
  26722. wrapped = wrapped.reverse();
  26723. wrapped.__actions__.push({
  26724. 'func': thru,
  26725. 'args': [reverse],
  26726. 'thisArg': undefined
  26727. });
  26728. return new LodashWrapper(wrapped, this.__chain__);
  26729. }
  26730. return this.thru(reverse);
  26731. }
  26732. /**
  26733. * Executes the chain sequence to resolve the unwrapped value.
  26734. *
  26735. * @name value
  26736. * @memberOf _
  26737. * @since 0.1.0
  26738. * @alias toJSON, valueOf
  26739. * @category Seq
  26740. * @returns {*} Returns the resolved unwrapped value.
  26741. * @example
  26742. *
  26743. * _([1, 2, 3]).value();
  26744. * // => [1, 2, 3]
  26745. */
  26746. function wrapperValue() {
  26747. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26748. }
  26749. /*------------------------------------------------------------------------*/
  26750. /**
  26751. * Creates an object composed of keys generated from the results of running
  26752. * each element of `collection` thru `iteratee`. The corresponding value of
  26753. * each key is the number of times the key was returned by `iteratee`. The
  26754. * iteratee is invoked with one argument: (value).
  26755. *
  26756. * @static
  26757. * @memberOf _
  26758. * @since 0.5.0
  26759. * @category Collection
  26760. * @param {Array|Object} collection The collection to iterate over.
  26761. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26762. * @returns {Object} Returns the composed aggregate object.
  26763. * @example
  26764. *
  26765. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26766. * // => { '4': 1, '6': 2 }
  26767. *
  26768. * // The `_.property` iteratee shorthand.
  26769. * _.countBy(['one', 'two', 'three'], 'length');
  26770. * // => { '3': 2, '5': 1 }
  26771. */
  26772. var countBy = createAggregator(function(result, value, key) {
  26773. if (hasOwnProperty.call(result, key)) {
  26774. ++result[key];
  26775. } else {
  26776. baseAssignValue(result, key, 1);
  26777. }
  26778. });
  26779. /**
  26780. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26781. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26782. * invoked with three arguments: (value, index|key, collection).
  26783. *
  26784. * **Note:** This method returns `true` for
  26785. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26786. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26787. * elements of empty collections.
  26788. *
  26789. * @static
  26790. * @memberOf _
  26791. * @since 0.1.0
  26792. * @category Collection
  26793. * @param {Array|Object} collection The collection to iterate over.
  26794. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26796. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26797. * else `false`.
  26798. * @example
  26799. *
  26800. * _.every([true, 1, null, 'yes'], Boolean);
  26801. * // => false
  26802. *
  26803. * var users = [
  26804. * { 'user': 'barney', 'age': 36, 'active': false },
  26805. * { 'user': 'fred', 'age': 40, 'active': false }
  26806. * ];
  26807. *
  26808. * // The `_.matches` iteratee shorthand.
  26809. * _.every(users, { 'user': 'barney', 'active': false });
  26810. * // => false
  26811. *
  26812. * // The `_.matchesProperty` iteratee shorthand.
  26813. * _.every(users, ['active', false]);
  26814. * // => true
  26815. *
  26816. * // The `_.property` iteratee shorthand.
  26817. * _.every(users, 'active');
  26818. * // => false
  26819. */
  26820. function every(collection, predicate, guard) {
  26821. var func = isArray(collection) ? arrayEvery : baseEvery;
  26822. if (guard && isIterateeCall(collection, predicate, guard)) {
  26823. predicate = undefined;
  26824. }
  26825. return func(collection, getIteratee(predicate, 3));
  26826. }
  26827. /**
  26828. * Iterates over elements of `collection`, returning an array of all elements
  26829. * `predicate` returns truthy for. The predicate is invoked with three
  26830. * arguments: (value, index|key, collection).
  26831. *
  26832. * **Note:** Unlike `_.remove`, this method returns a new array.
  26833. *
  26834. * @static
  26835. * @memberOf _
  26836. * @since 0.1.0
  26837. * @category Collection
  26838. * @param {Array|Object} collection The collection to iterate over.
  26839. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26840. * @returns {Array} Returns the new filtered array.
  26841. * @see _.reject
  26842. * @example
  26843. *
  26844. * var users = [
  26845. * { 'user': 'barney', 'age': 36, 'active': true },
  26846. * { 'user': 'fred', 'age': 40, 'active': false }
  26847. * ];
  26848. *
  26849. * _.filter(users, function(o) { return !o.active; });
  26850. * // => objects for ['fred']
  26851. *
  26852. * // The `_.matches` iteratee shorthand.
  26853. * _.filter(users, { 'age': 36, 'active': true });
  26854. * // => objects for ['barney']
  26855. *
  26856. * // The `_.matchesProperty` iteratee shorthand.
  26857. * _.filter(users, ['active', false]);
  26858. * // => objects for ['fred']
  26859. *
  26860. * // The `_.property` iteratee shorthand.
  26861. * _.filter(users, 'active');
  26862. * // => objects for ['barney']
  26863. */
  26864. function filter(collection, predicate) {
  26865. var func = isArray(collection) ? arrayFilter : baseFilter;
  26866. return func(collection, getIteratee(predicate, 3));
  26867. }
  26868. /**
  26869. * Iterates over elements of `collection`, returning the first element
  26870. * `predicate` returns truthy for. The predicate is invoked with three
  26871. * arguments: (value, index|key, collection).
  26872. *
  26873. * @static
  26874. * @memberOf _
  26875. * @since 0.1.0
  26876. * @category Collection
  26877. * @param {Array|Object} collection The collection to inspect.
  26878. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26879. * @param {number} [fromIndex=0] The index to search from.
  26880. * @returns {*} Returns the matched element, else `undefined`.
  26881. * @example
  26882. *
  26883. * var users = [
  26884. * { 'user': 'barney', 'age': 36, 'active': true },
  26885. * { 'user': 'fred', 'age': 40, 'active': false },
  26886. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26887. * ];
  26888. *
  26889. * _.find(users, function(o) { return o.age < 40; });
  26890. * // => object for 'barney'
  26891. *
  26892. * // The `_.matches` iteratee shorthand.
  26893. * _.find(users, { 'age': 1, 'active': true });
  26894. * // => object for 'pebbles'
  26895. *
  26896. * // The `_.matchesProperty` iteratee shorthand.
  26897. * _.find(users, ['active', false]);
  26898. * // => object for 'fred'
  26899. *
  26900. * // The `_.property` iteratee shorthand.
  26901. * _.find(users, 'active');
  26902. * // => object for 'barney'
  26903. */
  26904. var find = createFind(findIndex);
  26905. /**
  26906. * This method is like `_.find` except that it iterates over elements of
  26907. * `collection` from right to left.
  26908. *
  26909. * @static
  26910. * @memberOf _
  26911. * @since 2.0.0
  26912. * @category Collection
  26913. * @param {Array|Object} collection The collection to inspect.
  26914. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26915. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26916. * @returns {*} Returns the matched element, else `undefined`.
  26917. * @example
  26918. *
  26919. * _.findLast([1, 2, 3, 4], function(n) {
  26920. * return n % 2 == 1;
  26921. * });
  26922. * // => 3
  26923. */
  26924. var findLast = createFind(findLastIndex);
  26925. /**
  26926. * Creates a flattened array of values by running each element in `collection`
  26927. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26928. * with three arguments: (value, index|key, collection).
  26929. *
  26930. * @static
  26931. * @memberOf _
  26932. * @since 4.0.0
  26933. * @category Collection
  26934. * @param {Array|Object} collection The collection to iterate over.
  26935. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26936. * @returns {Array} Returns the new flattened array.
  26937. * @example
  26938. *
  26939. * function duplicate(n) {
  26940. * return [n, n];
  26941. * }
  26942. *
  26943. * _.flatMap([1, 2], duplicate);
  26944. * // => [1, 1, 2, 2]
  26945. */
  26946. function flatMap(collection, iteratee) {
  26947. return baseFlatten(map(collection, iteratee), 1);
  26948. }
  26949. /**
  26950. * This method is like `_.flatMap` except that it recursively flattens the
  26951. * mapped results.
  26952. *
  26953. * @static
  26954. * @memberOf _
  26955. * @since 4.7.0
  26956. * @category Collection
  26957. * @param {Array|Object} collection The collection to iterate over.
  26958. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26959. * @returns {Array} Returns the new flattened array.
  26960. * @example
  26961. *
  26962. * function duplicate(n) {
  26963. * return [[[n, n]]];
  26964. * }
  26965. *
  26966. * _.flatMapDeep([1, 2], duplicate);
  26967. * // => [1, 1, 2, 2]
  26968. */
  26969. function flatMapDeep(collection, iteratee) {
  26970. return baseFlatten(map(collection, iteratee), INFINITY);
  26971. }
  26972. /**
  26973. * This method is like `_.flatMap` except that it recursively flattens the
  26974. * mapped results up to `depth` times.
  26975. *
  26976. * @static
  26977. * @memberOf _
  26978. * @since 4.7.0
  26979. * @category Collection
  26980. * @param {Array|Object} collection The collection to iterate over.
  26981. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26982. * @param {number} [depth=1] The maximum recursion depth.
  26983. * @returns {Array} Returns the new flattened array.
  26984. * @example
  26985. *
  26986. * function duplicate(n) {
  26987. * return [[[n, n]]];
  26988. * }
  26989. *
  26990. * _.flatMapDepth([1, 2], duplicate, 2);
  26991. * // => [[1, 1], [2, 2]]
  26992. */
  26993. function flatMapDepth(collection, iteratee, depth) {
  26994. depth = depth === undefined ? 1 : toInteger(depth);
  26995. return baseFlatten(map(collection, iteratee), depth);
  26996. }
  26997. /**
  26998. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26999. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27000. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27001. *
  27002. * **Note:** As with other "Collections" methods, objects with a "length"
  27003. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27004. * or `_.forOwn` for object iteration.
  27005. *
  27006. * @static
  27007. * @memberOf _
  27008. * @since 0.1.0
  27009. * @alias each
  27010. * @category Collection
  27011. * @param {Array|Object} collection The collection to iterate over.
  27012. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27013. * @returns {Array|Object} Returns `collection`.
  27014. * @see _.forEachRight
  27015. * @example
  27016. *
  27017. * _.forEach([1, 2], function(value) {
  27018. * console.log(value);
  27019. * });
  27020. * // => Logs `1` then `2`.
  27021. *
  27022. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27023. * console.log(key);
  27024. * });
  27025. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27026. */
  27027. function forEach(collection, iteratee) {
  27028. var func = isArray(collection) ? arrayEach : baseEach;
  27029. return func(collection, getIteratee(iteratee, 3));
  27030. }
  27031. /**
  27032. * This method is like `_.forEach` except that it iterates over elements of
  27033. * `collection` from right to left.
  27034. *
  27035. * @static
  27036. * @memberOf _
  27037. * @since 2.0.0
  27038. * @alias eachRight
  27039. * @category Collection
  27040. * @param {Array|Object} collection The collection to iterate over.
  27041. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27042. * @returns {Array|Object} Returns `collection`.
  27043. * @see _.forEach
  27044. * @example
  27045. *
  27046. * _.forEachRight([1, 2], function(value) {
  27047. * console.log(value);
  27048. * });
  27049. * // => Logs `2` then `1`.
  27050. */
  27051. function forEachRight(collection, iteratee) {
  27052. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27053. return func(collection, getIteratee(iteratee, 3));
  27054. }
  27055. /**
  27056. * Creates an object composed of keys generated from the results of running
  27057. * each element of `collection` thru `iteratee`. The order of grouped values
  27058. * is determined by the order they occur in `collection`. The corresponding
  27059. * value of each key is an array of elements responsible for generating the
  27060. * key. The iteratee is invoked with one argument: (value).
  27061. *
  27062. * @static
  27063. * @memberOf _
  27064. * @since 0.1.0
  27065. * @category Collection
  27066. * @param {Array|Object} collection The collection to iterate over.
  27067. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27068. * @returns {Object} Returns the composed aggregate object.
  27069. * @example
  27070. *
  27071. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27072. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27073. *
  27074. * // The `_.property` iteratee shorthand.
  27075. * _.groupBy(['one', 'two', 'three'], 'length');
  27076. * // => { '3': ['one', 'two'], '5': ['three'] }
  27077. */
  27078. var groupBy = createAggregator(function(result, value, key) {
  27079. if (hasOwnProperty.call(result, key)) {
  27080. result[key].push(value);
  27081. } else {
  27082. baseAssignValue(result, key, [value]);
  27083. }
  27084. });
  27085. /**
  27086. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27087. * checked for a substring of `value`, otherwise
  27088. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27089. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27090. * the offset from the end of `collection`.
  27091. *
  27092. * @static
  27093. * @memberOf _
  27094. * @since 0.1.0
  27095. * @category Collection
  27096. * @param {Array|Object|string} collection The collection to inspect.
  27097. * @param {*} value The value to search for.
  27098. * @param {number} [fromIndex=0] The index to search from.
  27099. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27100. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27101. * @example
  27102. *
  27103. * _.includes([1, 2, 3], 1);
  27104. * // => true
  27105. *
  27106. * _.includes([1, 2, 3], 1, 2);
  27107. * // => false
  27108. *
  27109. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27110. * // => true
  27111. *
  27112. * _.includes('abcd', 'bc');
  27113. * // => true
  27114. */
  27115. function includes(collection, value, fromIndex, guard) {
  27116. collection = isArrayLike(collection) ? collection : values(collection);
  27117. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27118. var length = collection.length;
  27119. if (fromIndex < 0) {
  27120. fromIndex = nativeMax(length + fromIndex, 0);
  27121. }
  27122. return isString(collection)
  27123. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27124. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27125. }
  27126. /**
  27127. * Invokes the method at `path` of each element in `collection`, returning
  27128. * an array of the results of each invoked method. Any additional arguments
  27129. * are provided to each invoked method. If `path` is a function, it's invoked
  27130. * for, and `this` bound to, each element in `collection`.
  27131. *
  27132. * @static
  27133. * @memberOf _
  27134. * @since 4.0.0
  27135. * @category Collection
  27136. * @param {Array|Object} collection The collection to iterate over.
  27137. * @param {Array|Function|string} path The path of the method to invoke or
  27138. * the function invoked per iteration.
  27139. * @param {...*} [args] The arguments to invoke each method with.
  27140. * @returns {Array} Returns the array of results.
  27141. * @example
  27142. *
  27143. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27144. * // => [[1, 5, 7], [1, 2, 3]]
  27145. *
  27146. * _.invokeMap([123, 456], String.prototype.split, '');
  27147. * // => [['1', '2', '3'], ['4', '5', '6']]
  27148. */
  27149. var invokeMap = baseRest(function(collection, path, args) {
  27150. var index = -1,
  27151. isFunc = typeof path == 'function',
  27152. result = isArrayLike(collection) ? Array(collection.length) : [];
  27153. baseEach(collection, function(value) {
  27154. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27155. });
  27156. return result;
  27157. });
  27158. /**
  27159. * Creates an object composed of keys generated from the results of running
  27160. * each element of `collection` thru `iteratee`. The corresponding value of
  27161. * each key is the last element responsible for generating the key. The
  27162. * iteratee is invoked with one argument: (value).
  27163. *
  27164. * @static
  27165. * @memberOf _
  27166. * @since 4.0.0
  27167. * @category Collection
  27168. * @param {Array|Object} collection The collection to iterate over.
  27169. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27170. * @returns {Object} Returns the composed aggregate object.
  27171. * @example
  27172. *
  27173. * var array = [
  27174. * { 'dir': 'left', 'code': 97 },
  27175. * { 'dir': 'right', 'code': 100 }
  27176. * ];
  27177. *
  27178. * _.keyBy(array, function(o) {
  27179. * return String.fromCharCode(o.code);
  27180. * });
  27181. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27182. *
  27183. * _.keyBy(array, 'dir');
  27184. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27185. */
  27186. var keyBy = createAggregator(function(result, value, key) {
  27187. baseAssignValue(result, key, value);
  27188. });
  27189. /**
  27190. * Creates an array of values by running each element in `collection` thru
  27191. * `iteratee`. The iteratee is invoked with three arguments:
  27192. * (value, index|key, collection).
  27193. *
  27194. * Many lodash methods are guarded to work as iteratees for methods like
  27195. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27196. *
  27197. * The guarded methods are:
  27198. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27199. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27200. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27201. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27202. *
  27203. * @static
  27204. * @memberOf _
  27205. * @since 0.1.0
  27206. * @category Collection
  27207. * @param {Array|Object} collection The collection to iterate over.
  27208. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27209. * @returns {Array} Returns the new mapped array.
  27210. * @example
  27211. *
  27212. * function square(n) {
  27213. * return n * n;
  27214. * }
  27215. *
  27216. * _.map([4, 8], square);
  27217. * // => [16, 64]
  27218. *
  27219. * _.map({ 'a': 4, 'b': 8 }, square);
  27220. * // => [16, 64] (iteration order is not guaranteed)
  27221. *
  27222. * var users = [
  27223. * { 'user': 'barney' },
  27224. * { 'user': 'fred' }
  27225. * ];
  27226. *
  27227. * // The `_.property` iteratee shorthand.
  27228. * _.map(users, 'user');
  27229. * // => ['barney', 'fred']
  27230. */
  27231. function map(collection, iteratee) {
  27232. var func = isArray(collection) ? arrayMap : baseMap;
  27233. return func(collection, getIteratee(iteratee, 3));
  27234. }
  27235. /**
  27236. * This method is like `_.sortBy` except that it allows specifying the sort
  27237. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27238. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27239. * descending or "asc" for ascending sort order of corresponding values.
  27240. *
  27241. * @static
  27242. * @memberOf _
  27243. * @since 4.0.0
  27244. * @category Collection
  27245. * @param {Array|Object} collection The collection to iterate over.
  27246. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27247. * The iteratees to sort by.
  27248. * @param {string[]} [orders] The sort orders of `iteratees`.
  27249. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27250. * @returns {Array} Returns the new sorted array.
  27251. * @example
  27252. *
  27253. * var users = [
  27254. * { 'user': 'fred', 'age': 48 },
  27255. * { 'user': 'barney', 'age': 34 },
  27256. * { 'user': 'fred', 'age': 40 },
  27257. * { 'user': 'barney', 'age': 36 }
  27258. * ];
  27259. *
  27260. * // Sort by `user` in ascending order and by `age` in descending order.
  27261. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27262. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27263. */
  27264. function orderBy(collection, iteratees, orders, guard) {
  27265. if (collection == null) {
  27266. return [];
  27267. }
  27268. if (!isArray(iteratees)) {
  27269. iteratees = iteratees == null ? [] : [iteratees];
  27270. }
  27271. orders = guard ? undefined : orders;
  27272. if (!isArray(orders)) {
  27273. orders = orders == null ? [] : [orders];
  27274. }
  27275. return baseOrderBy(collection, iteratees, orders);
  27276. }
  27277. /**
  27278. * Creates an array of elements split into two groups, the first of which
  27279. * contains elements `predicate` returns truthy for, the second of which
  27280. * contains elements `predicate` returns falsey for. The predicate is
  27281. * invoked with one argument: (value).
  27282. *
  27283. * @static
  27284. * @memberOf _
  27285. * @since 3.0.0
  27286. * @category Collection
  27287. * @param {Array|Object} collection The collection to iterate over.
  27288. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27289. * @returns {Array} Returns the array of grouped elements.
  27290. * @example
  27291. *
  27292. * var users = [
  27293. * { 'user': 'barney', 'age': 36, 'active': false },
  27294. * { 'user': 'fred', 'age': 40, 'active': true },
  27295. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27296. * ];
  27297. *
  27298. * _.partition(users, function(o) { return o.active; });
  27299. * // => objects for [['fred'], ['barney', 'pebbles']]
  27300. *
  27301. * // The `_.matches` iteratee shorthand.
  27302. * _.partition(users, { 'age': 1, 'active': false });
  27303. * // => objects for [['pebbles'], ['barney', 'fred']]
  27304. *
  27305. * // The `_.matchesProperty` iteratee shorthand.
  27306. * _.partition(users, ['active', false]);
  27307. * // => objects for [['barney', 'pebbles'], ['fred']]
  27308. *
  27309. * // The `_.property` iteratee shorthand.
  27310. * _.partition(users, 'active');
  27311. * // => objects for [['fred'], ['barney', 'pebbles']]
  27312. */
  27313. var partition = createAggregator(function(result, value, key) {
  27314. result[key ? 0 : 1].push(value);
  27315. }, function() { return [[], []]; });
  27316. /**
  27317. * Reduces `collection` to a value which is the accumulated result of running
  27318. * each element in `collection` thru `iteratee`, where each successive
  27319. * invocation is supplied the return value of the previous. If `accumulator`
  27320. * is not given, the first element of `collection` is used as the initial
  27321. * value. The iteratee is invoked with four arguments:
  27322. * (accumulator, value, index|key, collection).
  27323. *
  27324. * Many lodash methods are guarded to work as iteratees for methods like
  27325. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27326. *
  27327. * The guarded methods are:
  27328. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27329. * and `sortBy`
  27330. *
  27331. * @static
  27332. * @memberOf _
  27333. * @since 0.1.0
  27334. * @category Collection
  27335. * @param {Array|Object} collection The collection to iterate over.
  27336. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27337. * @param {*} [accumulator] The initial value.
  27338. * @returns {*} Returns the accumulated value.
  27339. * @see _.reduceRight
  27340. * @example
  27341. *
  27342. * _.reduce([1, 2], function(sum, n) {
  27343. * return sum + n;
  27344. * }, 0);
  27345. * // => 3
  27346. *
  27347. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27348. * (result[value] || (result[value] = [])).push(key);
  27349. * return result;
  27350. * }, {});
  27351. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27352. */
  27353. function reduce(collection, iteratee, accumulator) {
  27354. var func = isArray(collection) ? arrayReduce : baseReduce,
  27355. initAccum = arguments.length < 3;
  27356. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27357. }
  27358. /**
  27359. * This method is like `_.reduce` except that it iterates over elements of
  27360. * `collection` from right to left.
  27361. *
  27362. * @static
  27363. * @memberOf _
  27364. * @since 0.1.0
  27365. * @category Collection
  27366. * @param {Array|Object} collection The collection to iterate over.
  27367. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27368. * @param {*} [accumulator] The initial value.
  27369. * @returns {*} Returns the accumulated value.
  27370. * @see _.reduce
  27371. * @example
  27372. *
  27373. * var array = [[0, 1], [2, 3], [4, 5]];
  27374. *
  27375. * _.reduceRight(array, function(flattened, other) {
  27376. * return flattened.concat(other);
  27377. * }, []);
  27378. * // => [4, 5, 2, 3, 0, 1]
  27379. */
  27380. function reduceRight(collection, iteratee, accumulator) {
  27381. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27382. initAccum = arguments.length < 3;
  27383. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27384. }
  27385. /**
  27386. * The opposite of `_.filter`; this method returns the elements of `collection`
  27387. * that `predicate` does **not** return truthy for.
  27388. *
  27389. * @static
  27390. * @memberOf _
  27391. * @since 0.1.0
  27392. * @category Collection
  27393. * @param {Array|Object} collection The collection to iterate over.
  27394. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27395. * @returns {Array} Returns the new filtered array.
  27396. * @see _.filter
  27397. * @example
  27398. *
  27399. * var users = [
  27400. * { 'user': 'barney', 'age': 36, 'active': false },
  27401. * { 'user': 'fred', 'age': 40, 'active': true }
  27402. * ];
  27403. *
  27404. * _.reject(users, function(o) { return !o.active; });
  27405. * // => objects for ['fred']
  27406. *
  27407. * // The `_.matches` iteratee shorthand.
  27408. * _.reject(users, { 'age': 40, 'active': true });
  27409. * // => objects for ['barney']
  27410. *
  27411. * // The `_.matchesProperty` iteratee shorthand.
  27412. * _.reject(users, ['active', false]);
  27413. * // => objects for ['fred']
  27414. *
  27415. * // The `_.property` iteratee shorthand.
  27416. * _.reject(users, 'active');
  27417. * // => objects for ['barney']
  27418. */
  27419. function reject(collection, predicate) {
  27420. var func = isArray(collection) ? arrayFilter : baseFilter;
  27421. return func(collection, negate(getIteratee(predicate, 3)));
  27422. }
  27423. /**
  27424. * Gets a random element from `collection`.
  27425. *
  27426. * @static
  27427. * @memberOf _
  27428. * @since 2.0.0
  27429. * @category Collection
  27430. * @param {Array|Object} collection The collection to sample.
  27431. * @returns {*} Returns the random element.
  27432. * @example
  27433. *
  27434. * _.sample([1, 2, 3, 4]);
  27435. * // => 2
  27436. */
  27437. function sample(collection) {
  27438. var func = isArray(collection) ? arraySample : baseSample;
  27439. return func(collection);
  27440. }
  27441. /**
  27442. * Gets `n` random elements at unique keys from `collection` up to the
  27443. * size of `collection`.
  27444. *
  27445. * @static
  27446. * @memberOf _
  27447. * @since 4.0.0
  27448. * @category Collection
  27449. * @param {Array|Object} collection The collection to sample.
  27450. * @param {number} [n=1] The number of elements to sample.
  27451. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27452. * @returns {Array} Returns the random elements.
  27453. * @example
  27454. *
  27455. * _.sampleSize([1, 2, 3], 2);
  27456. * // => [3, 1]
  27457. *
  27458. * _.sampleSize([1, 2, 3], 4);
  27459. * // => [2, 3, 1]
  27460. */
  27461. function sampleSize(collection, n, guard) {
  27462. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27463. n = 1;
  27464. } else {
  27465. n = toInteger(n);
  27466. }
  27467. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27468. return func(collection, n);
  27469. }
  27470. /**
  27471. * Creates an array of shuffled values, using a version of the
  27472. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27473. *
  27474. * @static
  27475. * @memberOf _
  27476. * @since 0.1.0
  27477. * @category Collection
  27478. * @param {Array|Object} collection The collection to shuffle.
  27479. * @returns {Array} Returns the new shuffled array.
  27480. * @example
  27481. *
  27482. * _.shuffle([1, 2, 3, 4]);
  27483. * // => [4, 1, 3, 2]
  27484. */
  27485. function shuffle(collection) {
  27486. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27487. return func(collection);
  27488. }
  27489. /**
  27490. * Gets the size of `collection` by returning its length for array-like
  27491. * values or the number of own enumerable string keyed properties for objects.
  27492. *
  27493. * @static
  27494. * @memberOf _
  27495. * @since 0.1.0
  27496. * @category Collection
  27497. * @param {Array|Object|string} collection The collection to inspect.
  27498. * @returns {number} Returns the collection size.
  27499. * @example
  27500. *
  27501. * _.size([1, 2, 3]);
  27502. * // => 3
  27503. *
  27504. * _.size({ 'a': 1, 'b': 2 });
  27505. * // => 2
  27506. *
  27507. * _.size('pebbles');
  27508. * // => 7
  27509. */
  27510. function size(collection) {
  27511. if (collection == null) {
  27512. return 0;
  27513. }
  27514. if (isArrayLike(collection)) {
  27515. return isString(collection) ? stringSize(collection) : collection.length;
  27516. }
  27517. var tag = getTag(collection);
  27518. if (tag == mapTag || tag == setTag) {
  27519. return collection.size;
  27520. }
  27521. return baseKeys(collection).length;
  27522. }
  27523. /**
  27524. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27525. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27526. * invoked with three arguments: (value, index|key, collection).
  27527. *
  27528. * @static
  27529. * @memberOf _
  27530. * @since 0.1.0
  27531. * @category Collection
  27532. * @param {Array|Object} collection The collection to iterate over.
  27533. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27534. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27535. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27536. * else `false`.
  27537. * @example
  27538. *
  27539. * _.some([null, 0, 'yes', false], Boolean);
  27540. * // => true
  27541. *
  27542. * var users = [
  27543. * { 'user': 'barney', 'active': true },
  27544. * { 'user': 'fred', 'active': false }
  27545. * ];
  27546. *
  27547. * // The `_.matches` iteratee shorthand.
  27548. * _.some(users, { 'user': 'barney', 'active': false });
  27549. * // => false
  27550. *
  27551. * // The `_.matchesProperty` iteratee shorthand.
  27552. * _.some(users, ['active', false]);
  27553. * // => true
  27554. *
  27555. * // The `_.property` iteratee shorthand.
  27556. * _.some(users, 'active');
  27557. * // => true
  27558. */
  27559. function some(collection, predicate, guard) {
  27560. var func = isArray(collection) ? arraySome : baseSome;
  27561. if (guard && isIterateeCall(collection, predicate, guard)) {
  27562. predicate = undefined;
  27563. }
  27564. return func(collection, getIteratee(predicate, 3));
  27565. }
  27566. /**
  27567. * Creates an array of elements, sorted in ascending order by the results of
  27568. * running each element in a collection thru each iteratee. This method
  27569. * performs a stable sort, that is, it preserves the original sort order of
  27570. * equal elements. The iteratees are invoked with one argument: (value).
  27571. *
  27572. * @static
  27573. * @memberOf _
  27574. * @since 0.1.0
  27575. * @category Collection
  27576. * @param {Array|Object} collection The collection to iterate over.
  27577. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27578. * The iteratees to sort by.
  27579. * @returns {Array} Returns the new sorted array.
  27580. * @example
  27581. *
  27582. * var users = [
  27583. * { 'user': 'fred', 'age': 48 },
  27584. * { 'user': 'barney', 'age': 36 },
  27585. * { 'user': 'fred', 'age': 40 },
  27586. * { 'user': 'barney', 'age': 34 }
  27587. * ];
  27588. *
  27589. * _.sortBy(users, [function(o) { return o.user; }]);
  27590. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27591. *
  27592. * _.sortBy(users, ['user', 'age']);
  27593. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27594. */
  27595. var sortBy = baseRest(function(collection, iteratees) {
  27596. if (collection == null) {
  27597. return [];
  27598. }
  27599. var length = iteratees.length;
  27600. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27601. iteratees = [];
  27602. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27603. iteratees = [iteratees[0]];
  27604. }
  27605. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27606. });
  27607. /*------------------------------------------------------------------------*/
  27608. /**
  27609. * Gets the timestamp of the number of milliseconds that have elapsed since
  27610. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27611. *
  27612. * @static
  27613. * @memberOf _
  27614. * @since 2.4.0
  27615. * @category Date
  27616. * @returns {number} Returns the timestamp.
  27617. * @example
  27618. *
  27619. * _.defer(function(stamp) {
  27620. * console.log(_.now() - stamp);
  27621. * }, _.now());
  27622. * // => Logs the number of milliseconds it took for the deferred invocation.
  27623. */
  27624. var now = ctxNow || function() {
  27625. return root.Date.now();
  27626. };
  27627. /*------------------------------------------------------------------------*/
  27628. /**
  27629. * The opposite of `_.before`; this method creates a function that invokes
  27630. * `func` once it's called `n` or more times.
  27631. *
  27632. * @static
  27633. * @memberOf _
  27634. * @since 0.1.0
  27635. * @category Function
  27636. * @param {number} n The number of calls before `func` is invoked.
  27637. * @param {Function} func The function to restrict.
  27638. * @returns {Function} Returns the new restricted function.
  27639. * @example
  27640. *
  27641. * var saves = ['profile', 'settings'];
  27642. *
  27643. * var done = _.after(saves.length, function() {
  27644. * console.log('done saving!');
  27645. * });
  27646. *
  27647. * _.forEach(saves, function(type) {
  27648. * asyncSave({ 'type': type, 'complete': done });
  27649. * });
  27650. * // => Logs 'done saving!' after the two async saves have completed.
  27651. */
  27652. function after(n, func) {
  27653. if (typeof func != 'function') {
  27654. throw new TypeError(FUNC_ERROR_TEXT);
  27655. }
  27656. n = toInteger(n);
  27657. return function() {
  27658. if (--n < 1) {
  27659. return func.apply(this, arguments);
  27660. }
  27661. };
  27662. }
  27663. /**
  27664. * Creates a function that invokes `func`, with up to `n` arguments,
  27665. * ignoring any additional arguments.
  27666. *
  27667. * @static
  27668. * @memberOf _
  27669. * @since 3.0.0
  27670. * @category Function
  27671. * @param {Function} func The function to cap arguments for.
  27672. * @param {number} [n=func.length] The arity cap.
  27673. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27674. * @returns {Function} Returns the new capped function.
  27675. * @example
  27676. *
  27677. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27678. * // => [6, 8, 10]
  27679. */
  27680. function ary(func, n, guard) {
  27681. n = guard ? undefined : n;
  27682. n = (func && n == null) ? func.length : n;
  27683. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27684. }
  27685. /**
  27686. * Creates a function that invokes `func`, with the `this` binding and arguments
  27687. * of the created function, while it's called less than `n` times. Subsequent
  27688. * calls to the created function return the result of the last `func` invocation.
  27689. *
  27690. * @static
  27691. * @memberOf _
  27692. * @since 3.0.0
  27693. * @category Function
  27694. * @param {number} n The number of calls at which `func` is no longer invoked.
  27695. * @param {Function} func The function to restrict.
  27696. * @returns {Function} Returns the new restricted function.
  27697. * @example
  27698. *
  27699. * jQuery(element).on('click', _.before(5, addContactToList));
  27700. * // => Allows adding up to 4 contacts to the list.
  27701. */
  27702. function before(n, func) {
  27703. var result;
  27704. if (typeof func != 'function') {
  27705. throw new TypeError(FUNC_ERROR_TEXT);
  27706. }
  27707. n = toInteger(n);
  27708. return function() {
  27709. if (--n > 0) {
  27710. result = func.apply(this, arguments);
  27711. }
  27712. if (n <= 1) {
  27713. func = undefined;
  27714. }
  27715. return result;
  27716. };
  27717. }
  27718. /**
  27719. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27720. * and `partials` prepended to the arguments it receives.
  27721. *
  27722. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27723. * may be used as a placeholder for partially applied arguments.
  27724. *
  27725. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27726. * property of bound functions.
  27727. *
  27728. * @static
  27729. * @memberOf _
  27730. * @since 0.1.0
  27731. * @category Function
  27732. * @param {Function} func The function to bind.
  27733. * @param {*} thisArg The `this` binding of `func`.
  27734. * @param {...*} [partials] The arguments to be partially applied.
  27735. * @returns {Function} Returns the new bound function.
  27736. * @example
  27737. *
  27738. * function greet(greeting, punctuation) {
  27739. * return greeting + ' ' + this.user + punctuation;
  27740. * }
  27741. *
  27742. * var object = { 'user': 'fred' };
  27743. *
  27744. * var bound = _.bind(greet, object, 'hi');
  27745. * bound('!');
  27746. * // => 'hi fred!'
  27747. *
  27748. * // Bound with placeholders.
  27749. * var bound = _.bind(greet, object, _, '!');
  27750. * bound('hi');
  27751. * // => 'hi fred!'
  27752. */
  27753. var bind = baseRest(function(func, thisArg, partials) {
  27754. var bitmask = WRAP_BIND_FLAG;
  27755. if (partials.length) {
  27756. var holders = replaceHolders(partials, getHolder(bind));
  27757. bitmask |= WRAP_PARTIAL_FLAG;
  27758. }
  27759. return createWrap(func, bitmask, thisArg, partials, holders);
  27760. });
  27761. /**
  27762. * Creates a function that invokes the method at `object[key]` with `partials`
  27763. * prepended to the arguments it receives.
  27764. *
  27765. * This method differs from `_.bind` by allowing bound functions to reference
  27766. * methods that may be redefined or don't yet exist. See
  27767. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27768. * for more details.
  27769. *
  27770. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27771. * builds, may be used as a placeholder for partially applied arguments.
  27772. *
  27773. * @static
  27774. * @memberOf _
  27775. * @since 0.10.0
  27776. * @category Function
  27777. * @param {Object} object The object to invoke the method on.
  27778. * @param {string} key The key of the method.
  27779. * @param {...*} [partials] The arguments to be partially applied.
  27780. * @returns {Function} Returns the new bound function.
  27781. * @example
  27782. *
  27783. * var object = {
  27784. * 'user': 'fred',
  27785. * 'greet': function(greeting, punctuation) {
  27786. * return greeting + ' ' + this.user + punctuation;
  27787. * }
  27788. * };
  27789. *
  27790. * var bound = _.bindKey(object, 'greet', 'hi');
  27791. * bound('!');
  27792. * // => 'hi fred!'
  27793. *
  27794. * object.greet = function(greeting, punctuation) {
  27795. * return greeting + 'ya ' + this.user + punctuation;
  27796. * };
  27797. *
  27798. * bound('!');
  27799. * // => 'hiya fred!'
  27800. *
  27801. * // Bound with placeholders.
  27802. * var bound = _.bindKey(object, 'greet', _, '!');
  27803. * bound('hi');
  27804. * // => 'hiya fred!'
  27805. */
  27806. var bindKey = baseRest(function(object, key, partials) {
  27807. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27808. if (partials.length) {
  27809. var holders = replaceHolders(partials, getHolder(bindKey));
  27810. bitmask |= WRAP_PARTIAL_FLAG;
  27811. }
  27812. return createWrap(key, bitmask, object, partials, holders);
  27813. });
  27814. /**
  27815. * Creates a function that accepts arguments of `func` and either invokes
  27816. * `func` returning its result, if at least `arity` number of arguments have
  27817. * been provided, or returns a function that accepts the remaining `func`
  27818. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27819. * is not sufficient.
  27820. *
  27821. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27822. * may be used as a placeholder for provided arguments.
  27823. *
  27824. * **Note:** This method doesn't set the "length" property of curried functions.
  27825. *
  27826. * @static
  27827. * @memberOf _
  27828. * @since 2.0.0
  27829. * @category Function
  27830. * @param {Function} func The function to curry.
  27831. * @param {number} [arity=func.length] The arity of `func`.
  27832. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27833. * @returns {Function} Returns the new curried function.
  27834. * @example
  27835. *
  27836. * var abc = function(a, b, c) {
  27837. * return [a, b, c];
  27838. * };
  27839. *
  27840. * var curried = _.curry(abc);
  27841. *
  27842. * curried(1)(2)(3);
  27843. * // => [1, 2, 3]
  27844. *
  27845. * curried(1, 2)(3);
  27846. * // => [1, 2, 3]
  27847. *
  27848. * curried(1, 2, 3);
  27849. * // => [1, 2, 3]
  27850. *
  27851. * // Curried with placeholders.
  27852. * curried(1)(_, 3)(2);
  27853. * // => [1, 2, 3]
  27854. */
  27855. function curry(func, arity, guard) {
  27856. arity = guard ? undefined : arity;
  27857. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27858. result.placeholder = curry.placeholder;
  27859. return result;
  27860. }
  27861. /**
  27862. * This method is like `_.curry` except that arguments are applied to `func`
  27863. * in the manner of `_.partialRight` instead of `_.partial`.
  27864. *
  27865. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27866. * builds, may be used as a placeholder for provided arguments.
  27867. *
  27868. * **Note:** This method doesn't set the "length" property of curried functions.
  27869. *
  27870. * @static
  27871. * @memberOf _
  27872. * @since 3.0.0
  27873. * @category Function
  27874. * @param {Function} func The function to curry.
  27875. * @param {number} [arity=func.length] The arity of `func`.
  27876. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27877. * @returns {Function} Returns the new curried function.
  27878. * @example
  27879. *
  27880. * var abc = function(a, b, c) {
  27881. * return [a, b, c];
  27882. * };
  27883. *
  27884. * var curried = _.curryRight(abc);
  27885. *
  27886. * curried(3)(2)(1);
  27887. * // => [1, 2, 3]
  27888. *
  27889. * curried(2, 3)(1);
  27890. * // => [1, 2, 3]
  27891. *
  27892. * curried(1, 2, 3);
  27893. * // => [1, 2, 3]
  27894. *
  27895. * // Curried with placeholders.
  27896. * curried(3)(1, _)(2);
  27897. * // => [1, 2, 3]
  27898. */
  27899. function curryRight(func, arity, guard) {
  27900. arity = guard ? undefined : arity;
  27901. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27902. result.placeholder = curryRight.placeholder;
  27903. return result;
  27904. }
  27905. /**
  27906. * Creates a debounced function that delays invoking `func` until after `wait`
  27907. * milliseconds have elapsed since the last time the debounced function was
  27908. * invoked. The debounced function comes with a `cancel` method to cancel
  27909. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27910. * Provide `options` to indicate whether `func` should be invoked on the
  27911. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27912. * with the last arguments provided to the debounced function. Subsequent
  27913. * calls to the debounced function return the result of the last `func`
  27914. * invocation.
  27915. *
  27916. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27917. * invoked on the trailing edge of the timeout only if the debounced function
  27918. * is invoked more than once during the `wait` timeout.
  27919. *
  27920. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27921. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27922. *
  27923. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27924. * for details over the differences between `_.debounce` and `_.throttle`.
  27925. *
  27926. * @static
  27927. * @memberOf _
  27928. * @since 0.1.0
  27929. * @category Function
  27930. * @param {Function} func The function to debounce.
  27931. * @param {number} [wait=0] The number of milliseconds to delay.
  27932. * @param {Object} [options={}] The options object.
  27933. * @param {boolean} [options.leading=false]
  27934. * Specify invoking on the leading edge of the timeout.
  27935. * @param {number} [options.maxWait]
  27936. * The maximum time `func` is allowed to be delayed before it's invoked.
  27937. * @param {boolean} [options.trailing=true]
  27938. * Specify invoking on the trailing edge of the timeout.
  27939. * @returns {Function} Returns the new debounced function.
  27940. * @example
  27941. *
  27942. * // Avoid costly calculations while the window size is in flux.
  27943. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27944. *
  27945. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27946. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27947. * 'leading': true,
  27948. * 'trailing': false
  27949. * }));
  27950. *
  27951. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27952. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27953. * var source = new EventSource('/stream');
  27954. * jQuery(source).on('message', debounced);
  27955. *
  27956. * // Cancel the trailing debounced invocation.
  27957. * jQuery(window).on('popstate', debounced.cancel);
  27958. */
  27959. function debounce(func, wait, options) {
  27960. var lastArgs,
  27961. lastThis,
  27962. maxWait,
  27963. result,
  27964. timerId,
  27965. lastCallTime,
  27966. lastInvokeTime = 0,
  27967. leading = false,
  27968. maxing = false,
  27969. trailing = true;
  27970. if (typeof func != 'function') {
  27971. throw new TypeError(FUNC_ERROR_TEXT);
  27972. }
  27973. wait = toNumber(wait) || 0;
  27974. if (isObject(options)) {
  27975. leading = !!options.leading;
  27976. maxing = 'maxWait' in options;
  27977. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27978. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27979. }
  27980. function invokeFunc(time) {
  27981. var args = lastArgs,
  27982. thisArg = lastThis;
  27983. lastArgs = lastThis = undefined;
  27984. lastInvokeTime = time;
  27985. result = func.apply(thisArg, args);
  27986. return result;
  27987. }
  27988. function leadingEdge(time) {
  27989. // Reset any `maxWait` timer.
  27990. lastInvokeTime = time;
  27991. // Start the timer for the trailing edge.
  27992. timerId = setTimeout(timerExpired, wait);
  27993. // Invoke the leading edge.
  27994. return leading ? invokeFunc(time) : result;
  27995. }
  27996. function remainingWait(time) {
  27997. var timeSinceLastCall = time - lastCallTime,
  27998. timeSinceLastInvoke = time - lastInvokeTime,
  27999. timeWaiting = wait - timeSinceLastCall;
  28000. return maxing
  28001. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28002. : timeWaiting;
  28003. }
  28004. function shouldInvoke(time) {
  28005. var timeSinceLastCall = time - lastCallTime,
  28006. timeSinceLastInvoke = time - lastInvokeTime;
  28007. // Either this is the first call, activity has stopped and we're at the
  28008. // trailing edge, the system time has gone backwards and we're treating
  28009. // it as the trailing edge, or we've hit the `maxWait` limit.
  28010. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28011. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28012. }
  28013. function timerExpired() {
  28014. var time = now();
  28015. if (shouldInvoke(time)) {
  28016. return trailingEdge(time);
  28017. }
  28018. // Restart the timer.
  28019. timerId = setTimeout(timerExpired, remainingWait(time));
  28020. }
  28021. function trailingEdge(time) {
  28022. timerId = undefined;
  28023. // Only invoke if we have `lastArgs` which means `func` has been
  28024. // debounced at least once.
  28025. if (trailing && lastArgs) {
  28026. return invokeFunc(time);
  28027. }
  28028. lastArgs = lastThis = undefined;
  28029. return result;
  28030. }
  28031. function cancel() {
  28032. if (timerId !== undefined) {
  28033. clearTimeout(timerId);
  28034. }
  28035. lastInvokeTime = 0;
  28036. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28037. }
  28038. function flush() {
  28039. return timerId === undefined ? result : trailingEdge(now());
  28040. }
  28041. function debounced() {
  28042. var time = now(),
  28043. isInvoking = shouldInvoke(time);
  28044. lastArgs = arguments;
  28045. lastThis = this;
  28046. lastCallTime = time;
  28047. if (isInvoking) {
  28048. if (timerId === undefined) {
  28049. return leadingEdge(lastCallTime);
  28050. }
  28051. if (maxing) {
  28052. // Handle invocations in a tight loop.
  28053. clearTimeout(timerId);
  28054. timerId = setTimeout(timerExpired, wait);
  28055. return invokeFunc(lastCallTime);
  28056. }
  28057. }
  28058. if (timerId === undefined) {
  28059. timerId = setTimeout(timerExpired, wait);
  28060. }
  28061. return result;
  28062. }
  28063. debounced.cancel = cancel;
  28064. debounced.flush = flush;
  28065. return debounced;
  28066. }
  28067. /**
  28068. * Defers invoking the `func` until the current call stack has cleared. Any
  28069. * additional arguments are provided to `func` when it's invoked.
  28070. *
  28071. * @static
  28072. * @memberOf _
  28073. * @since 0.1.0
  28074. * @category Function
  28075. * @param {Function} func The function to defer.
  28076. * @param {...*} [args] The arguments to invoke `func` with.
  28077. * @returns {number} Returns the timer id.
  28078. * @example
  28079. *
  28080. * _.defer(function(text) {
  28081. * console.log(text);
  28082. * }, 'deferred');
  28083. * // => Logs 'deferred' after one millisecond.
  28084. */
  28085. var defer = baseRest(function(func, args) {
  28086. return baseDelay(func, 1, args);
  28087. });
  28088. /**
  28089. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28090. * provided to `func` when it's invoked.
  28091. *
  28092. * @static
  28093. * @memberOf _
  28094. * @since 0.1.0
  28095. * @category Function
  28096. * @param {Function} func The function to delay.
  28097. * @param {number} wait The number of milliseconds to delay invocation.
  28098. * @param {...*} [args] The arguments to invoke `func` with.
  28099. * @returns {number} Returns the timer id.
  28100. * @example
  28101. *
  28102. * _.delay(function(text) {
  28103. * console.log(text);
  28104. * }, 1000, 'later');
  28105. * // => Logs 'later' after one second.
  28106. */
  28107. var delay = baseRest(function(func, wait, args) {
  28108. return baseDelay(func, toNumber(wait) || 0, args);
  28109. });
  28110. /**
  28111. * Creates a function that invokes `func` with arguments reversed.
  28112. *
  28113. * @static
  28114. * @memberOf _
  28115. * @since 4.0.0
  28116. * @category Function
  28117. * @param {Function} func The function to flip arguments for.
  28118. * @returns {Function} Returns the new flipped function.
  28119. * @example
  28120. *
  28121. * var flipped = _.flip(function() {
  28122. * return _.toArray(arguments);
  28123. * });
  28124. *
  28125. * flipped('a', 'b', 'c', 'd');
  28126. * // => ['d', 'c', 'b', 'a']
  28127. */
  28128. function flip(func) {
  28129. return createWrap(func, WRAP_FLIP_FLAG);
  28130. }
  28131. /**
  28132. * Creates a function that memoizes the result of `func`. If `resolver` is
  28133. * provided, it determines the cache key for storing the result based on the
  28134. * arguments provided to the memoized function. By default, the first argument
  28135. * provided to the memoized function is used as the map cache key. The `func`
  28136. * is invoked with the `this` binding of the memoized function.
  28137. *
  28138. * **Note:** The cache is exposed as the `cache` property on the memoized
  28139. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28140. * constructor with one whose instances implement the
  28141. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28142. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28143. *
  28144. * @static
  28145. * @memberOf _
  28146. * @since 0.1.0
  28147. * @category Function
  28148. * @param {Function} func The function to have its output memoized.
  28149. * @param {Function} [resolver] The function to resolve the cache key.
  28150. * @returns {Function} Returns the new memoized function.
  28151. * @example
  28152. *
  28153. * var object = { 'a': 1, 'b': 2 };
  28154. * var other = { 'c': 3, 'd': 4 };
  28155. *
  28156. * var values = _.memoize(_.values);
  28157. * values(object);
  28158. * // => [1, 2]
  28159. *
  28160. * values(other);
  28161. * // => [3, 4]
  28162. *
  28163. * object.a = 2;
  28164. * values(object);
  28165. * // => [1, 2]
  28166. *
  28167. * // Modify the result cache.
  28168. * values.cache.set(object, ['a', 'b']);
  28169. * values(object);
  28170. * // => ['a', 'b']
  28171. *
  28172. * // Replace `_.memoize.Cache`.
  28173. * _.memoize.Cache = WeakMap;
  28174. */
  28175. function memoize(func, resolver) {
  28176. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28177. throw new TypeError(FUNC_ERROR_TEXT);
  28178. }
  28179. var memoized = function() {
  28180. var args = arguments,
  28181. key = resolver ? resolver.apply(this, args) : args[0],
  28182. cache = memoized.cache;
  28183. if (cache.has(key)) {
  28184. return cache.get(key);
  28185. }
  28186. var result = func.apply(this, args);
  28187. memoized.cache = cache.set(key, result) || cache;
  28188. return result;
  28189. };
  28190. memoized.cache = new (memoize.Cache || MapCache);
  28191. return memoized;
  28192. }
  28193. // Expose `MapCache`.
  28194. memoize.Cache = MapCache;
  28195. /**
  28196. * Creates a function that negates the result of the predicate `func`. The
  28197. * `func` predicate is invoked with the `this` binding and arguments of the
  28198. * created function.
  28199. *
  28200. * @static
  28201. * @memberOf _
  28202. * @since 3.0.0
  28203. * @category Function
  28204. * @param {Function} predicate The predicate to negate.
  28205. * @returns {Function} Returns the new negated function.
  28206. * @example
  28207. *
  28208. * function isEven(n) {
  28209. * return n % 2 == 0;
  28210. * }
  28211. *
  28212. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28213. * // => [1, 3, 5]
  28214. */
  28215. function negate(predicate) {
  28216. if (typeof predicate != 'function') {
  28217. throw new TypeError(FUNC_ERROR_TEXT);
  28218. }
  28219. return function() {
  28220. var args = arguments;
  28221. switch (args.length) {
  28222. case 0: return !predicate.call(this);
  28223. case 1: return !predicate.call(this, args[0]);
  28224. case 2: return !predicate.call(this, args[0], args[1]);
  28225. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28226. }
  28227. return !predicate.apply(this, args);
  28228. };
  28229. }
  28230. /**
  28231. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28232. * to the function return the value of the first invocation. The `func` is
  28233. * invoked with the `this` binding and arguments of the created function.
  28234. *
  28235. * @static
  28236. * @memberOf _
  28237. * @since 0.1.0
  28238. * @category Function
  28239. * @param {Function} func The function to restrict.
  28240. * @returns {Function} Returns the new restricted function.
  28241. * @example
  28242. *
  28243. * var initialize = _.once(createApplication);
  28244. * initialize();
  28245. * initialize();
  28246. * // => `createApplication` is invoked once
  28247. */
  28248. function once(func) {
  28249. return before(2, func);
  28250. }
  28251. /**
  28252. * Creates a function that invokes `func` with its arguments transformed.
  28253. *
  28254. * @static
  28255. * @since 4.0.0
  28256. * @memberOf _
  28257. * @category Function
  28258. * @param {Function} func The function to wrap.
  28259. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28260. * The argument transforms.
  28261. * @returns {Function} Returns the new function.
  28262. * @example
  28263. *
  28264. * function doubled(n) {
  28265. * return n * 2;
  28266. * }
  28267. *
  28268. * function square(n) {
  28269. * return n * n;
  28270. * }
  28271. *
  28272. * var func = _.overArgs(function(x, y) {
  28273. * return [x, y];
  28274. * }, [square, doubled]);
  28275. *
  28276. * func(9, 3);
  28277. * // => [81, 6]
  28278. *
  28279. * func(10, 5);
  28280. * // => [100, 10]
  28281. */
  28282. var overArgs = castRest(function(func, transforms) {
  28283. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28284. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28285. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28286. var funcsLength = transforms.length;
  28287. return baseRest(function(args) {
  28288. var index = -1,
  28289. length = nativeMin(args.length, funcsLength);
  28290. while (++index < length) {
  28291. args[index] = transforms[index].call(this, args[index]);
  28292. }
  28293. return apply(func, this, args);
  28294. });
  28295. });
  28296. /**
  28297. * Creates a function that invokes `func` with `partials` prepended to the
  28298. * arguments it receives. This method is like `_.bind` except it does **not**
  28299. * alter the `this` binding.
  28300. *
  28301. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28302. * builds, may be used as a placeholder for partially applied arguments.
  28303. *
  28304. * **Note:** This method doesn't set the "length" property of partially
  28305. * applied functions.
  28306. *
  28307. * @static
  28308. * @memberOf _
  28309. * @since 0.2.0
  28310. * @category Function
  28311. * @param {Function} func The function to partially apply arguments to.
  28312. * @param {...*} [partials] The arguments to be partially applied.
  28313. * @returns {Function} Returns the new partially applied function.
  28314. * @example
  28315. *
  28316. * function greet(greeting, name) {
  28317. * return greeting + ' ' + name;
  28318. * }
  28319. *
  28320. * var sayHelloTo = _.partial(greet, 'hello');
  28321. * sayHelloTo('fred');
  28322. * // => 'hello fred'
  28323. *
  28324. * // Partially applied with placeholders.
  28325. * var greetFred = _.partial(greet, _, 'fred');
  28326. * greetFred('hi');
  28327. * // => 'hi fred'
  28328. */
  28329. var partial = baseRest(function(func, partials) {
  28330. var holders = replaceHolders(partials, getHolder(partial));
  28331. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28332. });
  28333. /**
  28334. * This method is like `_.partial` except that partially applied arguments
  28335. * are appended to the arguments it receives.
  28336. *
  28337. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28338. * builds, may be used as a placeholder for partially applied arguments.
  28339. *
  28340. * **Note:** This method doesn't set the "length" property of partially
  28341. * applied functions.
  28342. *
  28343. * @static
  28344. * @memberOf _
  28345. * @since 1.0.0
  28346. * @category Function
  28347. * @param {Function} func The function to partially apply arguments to.
  28348. * @param {...*} [partials] The arguments to be partially applied.
  28349. * @returns {Function} Returns the new partially applied function.
  28350. * @example
  28351. *
  28352. * function greet(greeting, name) {
  28353. * return greeting + ' ' + name;
  28354. * }
  28355. *
  28356. * var greetFred = _.partialRight(greet, 'fred');
  28357. * greetFred('hi');
  28358. * // => 'hi fred'
  28359. *
  28360. * // Partially applied with placeholders.
  28361. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28362. * sayHelloTo('fred');
  28363. * // => 'hello fred'
  28364. */
  28365. var partialRight = baseRest(function(func, partials) {
  28366. var holders = replaceHolders(partials, getHolder(partialRight));
  28367. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28368. });
  28369. /**
  28370. * Creates a function that invokes `func` with arguments arranged according
  28371. * to the specified `indexes` where the argument value at the first index is
  28372. * provided as the first argument, the argument value at the second index is
  28373. * provided as the second argument, and so on.
  28374. *
  28375. * @static
  28376. * @memberOf _
  28377. * @since 3.0.0
  28378. * @category Function
  28379. * @param {Function} func The function to rearrange arguments for.
  28380. * @param {...(number|number[])} indexes The arranged argument indexes.
  28381. * @returns {Function} Returns the new function.
  28382. * @example
  28383. *
  28384. * var rearged = _.rearg(function(a, b, c) {
  28385. * return [a, b, c];
  28386. * }, [2, 0, 1]);
  28387. *
  28388. * rearged('b', 'c', 'a')
  28389. * // => ['a', 'b', 'c']
  28390. */
  28391. var rearg = flatRest(function(func, indexes) {
  28392. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28393. });
  28394. /**
  28395. * Creates a function that invokes `func` with the `this` binding of the
  28396. * created function and arguments from `start` and beyond provided as
  28397. * an array.
  28398. *
  28399. * **Note:** This method is based on the
  28400. * [rest parameter](https://mdn.io/rest_parameters).
  28401. *
  28402. * @static
  28403. * @memberOf _
  28404. * @since 4.0.0
  28405. * @category Function
  28406. * @param {Function} func The function to apply a rest parameter to.
  28407. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28408. * @returns {Function} Returns the new function.
  28409. * @example
  28410. *
  28411. * var say = _.rest(function(what, names) {
  28412. * return what + ' ' + _.initial(names).join(', ') +
  28413. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28414. * });
  28415. *
  28416. * say('hello', 'fred', 'barney', 'pebbles');
  28417. * // => 'hello fred, barney, & pebbles'
  28418. */
  28419. function rest(func, start) {
  28420. if (typeof func != 'function') {
  28421. throw new TypeError(FUNC_ERROR_TEXT);
  28422. }
  28423. start = start === undefined ? start : toInteger(start);
  28424. return baseRest(func, start);
  28425. }
  28426. /**
  28427. * Creates a function that invokes `func` with the `this` binding of the
  28428. * create function and an array of arguments much like
  28429. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28430. *
  28431. * **Note:** This method is based on the
  28432. * [spread operator](https://mdn.io/spread_operator).
  28433. *
  28434. * @static
  28435. * @memberOf _
  28436. * @since 3.2.0
  28437. * @category Function
  28438. * @param {Function} func The function to spread arguments over.
  28439. * @param {number} [start=0] The start position of the spread.
  28440. * @returns {Function} Returns the new function.
  28441. * @example
  28442. *
  28443. * var say = _.spread(function(who, what) {
  28444. * return who + ' says ' + what;
  28445. * });
  28446. *
  28447. * say(['fred', 'hello']);
  28448. * // => 'fred says hello'
  28449. *
  28450. * var numbers = Promise.all([
  28451. * Promise.resolve(40),
  28452. * Promise.resolve(36)
  28453. * ]);
  28454. *
  28455. * numbers.then(_.spread(function(x, y) {
  28456. * return x + y;
  28457. * }));
  28458. * // => a Promise of 76
  28459. */
  28460. function spread(func, start) {
  28461. if (typeof func != 'function') {
  28462. throw new TypeError(FUNC_ERROR_TEXT);
  28463. }
  28464. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28465. return baseRest(function(args) {
  28466. var array = args[start],
  28467. otherArgs = castSlice(args, 0, start);
  28468. if (array) {
  28469. arrayPush(otherArgs, array);
  28470. }
  28471. return apply(func, this, otherArgs);
  28472. });
  28473. }
  28474. /**
  28475. * Creates a throttled function that only invokes `func` at most once per
  28476. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28477. * method to cancel delayed `func` invocations and a `flush` method to
  28478. * immediately invoke them. Provide `options` to indicate whether `func`
  28479. * should be invoked on the leading and/or trailing edge of the `wait`
  28480. * timeout. The `func` is invoked with the last arguments provided to the
  28481. * throttled function. Subsequent calls to the throttled function return the
  28482. * result of the last `func` invocation.
  28483. *
  28484. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28485. * invoked on the trailing edge of the timeout only if the throttled function
  28486. * is invoked more than once during the `wait` timeout.
  28487. *
  28488. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28489. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28490. *
  28491. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28492. * for details over the differences between `_.throttle` and `_.debounce`.
  28493. *
  28494. * @static
  28495. * @memberOf _
  28496. * @since 0.1.0
  28497. * @category Function
  28498. * @param {Function} func The function to throttle.
  28499. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28500. * @param {Object} [options={}] The options object.
  28501. * @param {boolean} [options.leading=true]
  28502. * Specify invoking on the leading edge of the timeout.
  28503. * @param {boolean} [options.trailing=true]
  28504. * Specify invoking on the trailing edge of the timeout.
  28505. * @returns {Function} Returns the new throttled function.
  28506. * @example
  28507. *
  28508. * // Avoid excessively updating the position while scrolling.
  28509. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28510. *
  28511. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28512. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28513. * jQuery(element).on('click', throttled);
  28514. *
  28515. * // Cancel the trailing throttled invocation.
  28516. * jQuery(window).on('popstate', throttled.cancel);
  28517. */
  28518. function throttle(func, wait, options) {
  28519. var leading = true,
  28520. trailing = true;
  28521. if (typeof func != 'function') {
  28522. throw new TypeError(FUNC_ERROR_TEXT);
  28523. }
  28524. if (isObject(options)) {
  28525. leading = 'leading' in options ? !!options.leading : leading;
  28526. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28527. }
  28528. return debounce(func, wait, {
  28529. 'leading': leading,
  28530. 'maxWait': wait,
  28531. 'trailing': trailing
  28532. });
  28533. }
  28534. /**
  28535. * Creates a function that accepts up to one argument, ignoring any
  28536. * additional arguments.
  28537. *
  28538. * @static
  28539. * @memberOf _
  28540. * @since 4.0.0
  28541. * @category Function
  28542. * @param {Function} func The function to cap arguments for.
  28543. * @returns {Function} Returns the new capped function.
  28544. * @example
  28545. *
  28546. * _.map(['6', '8', '10'], _.unary(parseInt));
  28547. * // => [6, 8, 10]
  28548. */
  28549. function unary(func) {
  28550. return ary(func, 1);
  28551. }
  28552. /**
  28553. * Creates a function that provides `value` to `wrapper` as its first
  28554. * argument. Any additional arguments provided to the function are appended
  28555. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28556. * binding of the created function.
  28557. *
  28558. * @static
  28559. * @memberOf _
  28560. * @since 0.1.0
  28561. * @category Function
  28562. * @param {*} value The value to wrap.
  28563. * @param {Function} [wrapper=identity] The wrapper function.
  28564. * @returns {Function} Returns the new function.
  28565. * @example
  28566. *
  28567. * var p = _.wrap(_.escape, function(func, text) {
  28568. * return '<p>' + func(text) + '</p>';
  28569. * });
  28570. *
  28571. * p('fred, barney, & pebbles');
  28572. * // => '<p>fred, barney, &amp; pebbles</p>'
  28573. */
  28574. function wrap(value, wrapper) {
  28575. return partial(castFunction(wrapper), value);
  28576. }
  28577. /*------------------------------------------------------------------------*/
  28578. /**
  28579. * Casts `value` as an array if it's not one.
  28580. *
  28581. * @static
  28582. * @memberOf _
  28583. * @since 4.4.0
  28584. * @category Lang
  28585. * @param {*} value The value to inspect.
  28586. * @returns {Array} Returns the cast array.
  28587. * @example
  28588. *
  28589. * _.castArray(1);
  28590. * // => [1]
  28591. *
  28592. * _.castArray({ 'a': 1 });
  28593. * // => [{ 'a': 1 }]
  28594. *
  28595. * _.castArray('abc');
  28596. * // => ['abc']
  28597. *
  28598. * _.castArray(null);
  28599. * // => [null]
  28600. *
  28601. * _.castArray(undefined);
  28602. * // => [undefined]
  28603. *
  28604. * _.castArray();
  28605. * // => []
  28606. *
  28607. * var array = [1, 2, 3];
  28608. * console.log(_.castArray(array) === array);
  28609. * // => true
  28610. */
  28611. function castArray() {
  28612. if (!arguments.length) {
  28613. return [];
  28614. }
  28615. var value = arguments[0];
  28616. return isArray(value) ? value : [value];
  28617. }
  28618. /**
  28619. * Creates a shallow clone of `value`.
  28620. *
  28621. * **Note:** This method is loosely based on the
  28622. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28623. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28624. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28625. * arrays. The own enumerable properties of `arguments` objects are cloned
  28626. * as plain objects. An empty object is returned for uncloneable values such
  28627. * as error objects, functions, DOM nodes, and WeakMaps.
  28628. *
  28629. * @static
  28630. * @memberOf _
  28631. * @since 0.1.0
  28632. * @category Lang
  28633. * @param {*} value The value to clone.
  28634. * @returns {*} Returns the cloned value.
  28635. * @see _.cloneDeep
  28636. * @example
  28637. *
  28638. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28639. *
  28640. * var shallow = _.clone(objects);
  28641. * console.log(shallow[0] === objects[0]);
  28642. * // => true
  28643. */
  28644. function clone(value) {
  28645. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28646. }
  28647. /**
  28648. * This method is like `_.clone` except that it accepts `customizer` which
  28649. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28650. * cloning is handled by the method instead. The `customizer` is invoked with
  28651. * up to four arguments; (value [, index|key, object, stack]).
  28652. *
  28653. * @static
  28654. * @memberOf _
  28655. * @since 4.0.0
  28656. * @category Lang
  28657. * @param {*} value The value to clone.
  28658. * @param {Function} [customizer] The function to customize cloning.
  28659. * @returns {*} Returns the cloned value.
  28660. * @see _.cloneDeepWith
  28661. * @example
  28662. *
  28663. * function customizer(value) {
  28664. * if (_.isElement(value)) {
  28665. * return value.cloneNode(false);
  28666. * }
  28667. * }
  28668. *
  28669. * var el = _.cloneWith(document.body, customizer);
  28670. *
  28671. * console.log(el === document.body);
  28672. * // => false
  28673. * console.log(el.nodeName);
  28674. * // => 'BODY'
  28675. * console.log(el.childNodes.length);
  28676. * // => 0
  28677. */
  28678. function cloneWith(value, customizer) {
  28679. customizer = typeof customizer == 'function' ? customizer : undefined;
  28680. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28681. }
  28682. /**
  28683. * This method is like `_.clone` except that it recursively clones `value`.
  28684. *
  28685. * @static
  28686. * @memberOf _
  28687. * @since 1.0.0
  28688. * @category Lang
  28689. * @param {*} value The value to recursively clone.
  28690. * @returns {*} Returns the deep cloned value.
  28691. * @see _.clone
  28692. * @example
  28693. *
  28694. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28695. *
  28696. * var deep = _.cloneDeep(objects);
  28697. * console.log(deep[0] === objects[0]);
  28698. * // => false
  28699. */
  28700. function cloneDeep(value) {
  28701. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28702. }
  28703. /**
  28704. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28705. *
  28706. * @static
  28707. * @memberOf _
  28708. * @since 4.0.0
  28709. * @category Lang
  28710. * @param {*} value The value to recursively clone.
  28711. * @param {Function} [customizer] The function to customize cloning.
  28712. * @returns {*} Returns the deep cloned value.
  28713. * @see _.cloneWith
  28714. * @example
  28715. *
  28716. * function customizer(value) {
  28717. * if (_.isElement(value)) {
  28718. * return value.cloneNode(true);
  28719. * }
  28720. * }
  28721. *
  28722. * var el = _.cloneDeepWith(document.body, customizer);
  28723. *
  28724. * console.log(el === document.body);
  28725. * // => false
  28726. * console.log(el.nodeName);
  28727. * // => 'BODY'
  28728. * console.log(el.childNodes.length);
  28729. * // => 20
  28730. */
  28731. function cloneDeepWith(value, customizer) {
  28732. customizer = typeof customizer == 'function' ? customizer : undefined;
  28733. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28734. }
  28735. /**
  28736. * Checks if `object` conforms to `source` by invoking the predicate
  28737. * properties of `source` with the corresponding property values of `object`.
  28738. *
  28739. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28740. * partially applied.
  28741. *
  28742. * @static
  28743. * @memberOf _
  28744. * @since 4.14.0
  28745. * @category Lang
  28746. * @param {Object} object The object to inspect.
  28747. * @param {Object} source The object of property predicates to conform to.
  28748. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28749. * @example
  28750. *
  28751. * var object = { 'a': 1, 'b': 2 };
  28752. *
  28753. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28754. * // => true
  28755. *
  28756. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28757. * // => false
  28758. */
  28759. function conformsTo(object, source) {
  28760. return source == null || baseConformsTo(object, source, keys(source));
  28761. }
  28762. /**
  28763. * Performs a
  28764. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28765. * comparison between two values to determine if they are equivalent.
  28766. *
  28767. * @static
  28768. * @memberOf _
  28769. * @since 4.0.0
  28770. * @category Lang
  28771. * @param {*} value The value to compare.
  28772. * @param {*} other The other value to compare.
  28773. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28774. * @example
  28775. *
  28776. * var object = { 'a': 1 };
  28777. * var other = { 'a': 1 };
  28778. *
  28779. * _.eq(object, object);
  28780. * // => true
  28781. *
  28782. * _.eq(object, other);
  28783. * // => false
  28784. *
  28785. * _.eq('a', 'a');
  28786. * // => true
  28787. *
  28788. * _.eq('a', Object('a'));
  28789. * // => false
  28790. *
  28791. * _.eq(NaN, NaN);
  28792. * // => true
  28793. */
  28794. function eq(value, other) {
  28795. return value === other || (value !== value && other !== other);
  28796. }
  28797. /**
  28798. * Checks if `value` is greater than `other`.
  28799. *
  28800. * @static
  28801. * @memberOf _
  28802. * @since 3.9.0
  28803. * @category Lang
  28804. * @param {*} value The value to compare.
  28805. * @param {*} other The other value to compare.
  28806. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28807. * else `false`.
  28808. * @see _.lt
  28809. * @example
  28810. *
  28811. * _.gt(3, 1);
  28812. * // => true
  28813. *
  28814. * _.gt(3, 3);
  28815. * // => false
  28816. *
  28817. * _.gt(1, 3);
  28818. * // => false
  28819. */
  28820. var gt = createRelationalOperation(baseGt);
  28821. /**
  28822. * Checks if `value` is greater than or equal to `other`.
  28823. *
  28824. * @static
  28825. * @memberOf _
  28826. * @since 3.9.0
  28827. * @category Lang
  28828. * @param {*} value The value to compare.
  28829. * @param {*} other The other value to compare.
  28830. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28831. * `other`, else `false`.
  28832. * @see _.lte
  28833. * @example
  28834. *
  28835. * _.gte(3, 1);
  28836. * // => true
  28837. *
  28838. * _.gte(3, 3);
  28839. * // => true
  28840. *
  28841. * _.gte(1, 3);
  28842. * // => false
  28843. */
  28844. var gte = createRelationalOperation(function(value, other) {
  28845. return value >= other;
  28846. });
  28847. /**
  28848. * Checks if `value` is likely an `arguments` object.
  28849. *
  28850. * @static
  28851. * @memberOf _
  28852. * @since 0.1.0
  28853. * @category Lang
  28854. * @param {*} value The value to check.
  28855. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28856. * else `false`.
  28857. * @example
  28858. *
  28859. * _.isArguments(function() { return arguments; }());
  28860. * // => true
  28861. *
  28862. * _.isArguments([1, 2, 3]);
  28863. * // => false
  28864. */
  28865. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28866. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28867. !propertyIsEnumerable.call(value, 'callee');
  28868. };
  28869. /**
  28870. * Checks if `value` is classified as an `Array` object.
  28871. *
  28872. * @static
  28873. * @memberOf _
  28874. * @since 0.1.0
  28875. * @category Lang
  28876. * @param {*} value The value to check.
  28877. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28878. * @example
  28879. *
  28880. * _.isArray([1, 2, 3]);
  28881. * // => true
  28882. *
  28883. * _.isArray(document.body.children);
  28884. * // => false
  28885. *
  28886. * _.isArray('abc');
  28887. * // => false
  28888. *
  28889. * _.isArray(_.noop);
  28890. * // => false
  28891. */
  28892. var isArray = Array.isArray;
  28893. /**
  28894. * Checks if `value` is classified as an `ArrayBuffer` object.
  28895. *
  28896. * @static
  28897. * @memberOf _
  28898. * @since 4.3.0
  28899. * @category Lang
  28900. * @param {*} value The value to check.
  28901. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28902. * @example
  28903. *
  28904. * _.isArrayBuffer(new ArrayBuffer(2));
  28905. * // => true
  28906. *
  28907. * _.isArrayBuffer(new Array(2));
  28908. * // => false
  28909. */
  28910. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28911. /**
  28912. * Checks if `value` is array-like. A value is considered array-like if it's
  28913. * not a function and has a `value.length` that's an integer greater than or
  28914. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28915. *
  28916. * @static
  28917. * @memberOf _
  28918. * @since 4.0.0
  28919. * @category Lang
  28920. * @param {*} value The value to check.
  28921. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28922. * @example
  28923. *
  28924. * _.isArrayLike([1, 2, 3]);
  28925. * // => true
  28926. *
  28927. * _.isArrayLike(document.body.children);
  28928. * // => true
  28929. *
  28930. * _.isArrayLike('abc');
  28931. * // => true
  28932. *
  28933. * _.isArrayLike(_.noop);
  28934. * // => false
  28935. */
  28936. function isArrayLike(value) {
  28937. return value != null && isLength(value.length) && !isFunction(value);
  28938. }
  28939. /**
  28940. * This method is like `_.isArrayLike` except that it also checks if `value`
  28941. * is an object.
  28942. *
  28943. * @static
  28944. * @memberOf _
  28945. * @since 4.0.0
  28946. * @category Lang
  28947. * @param {*} value The value to check.
  28948. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28949. * else `false`.
  28950. * @example
  28951. *
  28952. * _.isArrayLikeObject([1, 2, 3]);
  28953. * // => true
  28954. *
  28955. * _.isArrayLikeObject(document.body.children);
  28956. * // => true
  28957. *
  28958. * _.isArrayLikeObject('abc');
  28959. * // => false
  28960. *
  28961. * _.isArrayLikeObject(_.noop);
  28962. * // => false
  28963. */
  28964. function isArrayLikeObject(value) {
  28965. return isObjectLike(value) && isArrayLike(value);
  28966. }
  28967. /**
  28968. * Checks if `value` is classified as a boolean primitive or object.
  28969. *
  28970. * @static
  28971. * @memberOf _
  28972. * @since 0.1.0
  28973. * @category Lang
  28974. * @param {*} value The value to check.
  28975. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28976. * @example
  28977. *
  28978. * _.isBoolean(false);
  28979. * // => true
  28980. *
  28981. * _.isBoolean(null);
  28982. * // => false
  28983. */
  28984. function isBoolean(value) {
  28985. return value === true || value === false ||
  28986. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28987. }
  28988. /**
  28989. * Checks if `value` is a buffer.
  28990. *
  28991. * @static
  28992. * @memberOf _
  28993. * @since 4.3.0
  28994. * @category Lang
  28995. * @param {*} value The value to check.
  28996. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28997. * @example
  28998. *
  28999. * _.isBuffer(new Buffer(2));
  29000. * // => true
  29001. *
  29002. * _.isBuffer(new Uint8Array(2));
  29003. * // => false
  29004. */
  29005. var isBuffer = nativeIsBuffer || stubFalse;
  29006. /**
  29007. * Checks if `value` is classified as a `Date` object.
  29008. *
  29009. * @static
  29010. * @memberOf _
  29011. * @since 0.1.0
  29012. * @category Lang
  29013. * @param {*} value The value to check.
  29014. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29015. * @example
  29016. *
  29017. * _.isDate(new Date);
  29018. * // => true
  29019. *
  29020. * _.isDate('Mon April 23 2012');
  29021. * // => false
  29022. */
  29023. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29024. /**
  29025. * Checks if `value` is likely a DOM element.
  29026. *
  29027. * @static
  29028. * @memberOf _
  29029. * @since 0.1.0
  29030. * @category Lang
  29031. * @param {*} value The value to check.
  29032. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29033. * @example
  29034. *
  29035. * _.isElement(document.body);
  29036. * // => true
  29037. *
  29038. * _.isElement('<body>');
  29039. * // => false
  29040. */
  29041. function isElement(value) {
  29042. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29043. }
  29044. /**
  29045. * Checks if `value` is an empty object, collection, map, or set.
  29046. *
  29047. * Objects are considered empty if they have no own enumerable string keyed
  29048. * properties.
  29049. *
  29050. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29051. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29052. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29053. *
  29054. * @static
  29055. * @memberOf _
  29056. * @since 0.1.0
  29057. * @category Lang
  29058. * @param {*} value The value to check.
  29059. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29060. * @example
  29061. *
  29062. * _.isEmpty(null);
  29063. * // => true
  29064. *
  29065. * _.isEmpty(true);
  29066. * // => true
  29067. *
  29068. * _.isEmpty(1);
  29069. * // => true
  29070. *
  29071. * _.isEmpty([1, 2, 3]);
  29072. * // => false
  29073. *
  29074. * _.isEmpty({ 'a': 1 });
  29075. * // => false
  29076. */
  29077. function isEmpty(value) {
  29078. if (value == null) {
  29079. return true;
  29080. }
  29081. if (isArrayLike(value) &&
  29082. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29083. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29084. return !value.length;
  29085. }
  29086. var tag = getTag(value);
  29087. if (tag == mapTag || tag == setTag) {
  29088. return !value.size;
  29089. }
  29090. if (isPrototype(value)) {
  29091. return !baseKeys(value).length;
  29092. }
  29093. for (var key in value) {
  29094. if (hasOwnProperty.call(value, key)) {
  29095. return false;
  29096. }
  29097. }
  29098. return true;
  29099. }
  29100. /**
  29101. * Performs a deep comparison between two values to determine if they are
  29102. * equivalent.
  29103. *
  29104. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29105. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29106. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29107. * by their own, not inherited, enumerable properties. Functions and DOM
  29108. * nodes are compared by strict equality, i.e. `===`.
  29109. *
  29110. * @static
  29111. * @memberOf _
  29112. * @since 0.1.0
  29113. * @category Lang
  29114. * @param {*} value The value to compare.
  29115. * @param {*} other The other value to compare.
  29116. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29117. * @example
  29118. *
  29119. * var object = { 'a': 1 };
  29120. * var other = { 'a': 1 };
  29121. *
  29122. * _.isEqual(object, other);
  29123. * // => true
  29124. *
  29125. * object === other;
  29126. * // => false
  29127. */
  29128. function isEqual(value, other) {
  29129. return baseIsEqual(value, other);
  29130. }
  29131. /**
  29132. * This method is like `_.isEqual` except that it accepts `customizer` which
  29133. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29134. * are handled by the method instead. The `customizer` is invoked with up to
  29135. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29136. *
  29137. * @static
  29138. * @memberOf _
  29139. * @since 4.0.0
  29140. * @category Lang
  29141. * @param {*} value The value to compare.
  29142. * @param {*} other The other value to compare.
  29143. * @param {Function} [customizer] The function to customize comparisons.
  29144. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29145. * @example
  29146. *
  29147. * function isGreeting(value) {
  29148. * return /^h(?:i|ello)$/.test(value);
  29149. * }
  29150. *
  29151. * function customizer(objValue, othValue) {
  29152. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29153. * return true;
  29154. * }
  29155. * }
  29156. *
  29157. * var array = ['hello', 'goodbye'];
  29158. * var other = ['hi', 'goodbye'];
  29159. *
  29160. * _.isEqualWith(array, other, customizer);
  29161. * // => true
  29162. */
  29163. function isEqualWith(value, other, customizer) {
  29164. customizer = typeof customizer == 'function' ? customizer : undefined;
  29165. var result = customizer ? customizer(value, other) : undefined;
  29166. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29167. }
  29168. /**
  29169. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29170. * `SyntaxError`, `TypeError`, or `URIError` object.
  29171. *
  29172. * @static
  29173. * @memberOf _
  29174. * @since 3.0.0
  29175. * @category Lang
  29176. * @param {*} value The value to check.
  29177. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29178. * @example
  29179. *
  29180. * _.isError(new Error);
  29181. * // => true
  29182. *
  29183. * _.isError(Error);
  29184. * // => false
  29185. */
  29186. function isError(value) {
  29187. if (!isObjectLike(value)) {
  29188. return false;
  29189. }
  29190. var tag = baseGetTag(value);
  29191. return tag == errorTag || tag == domExcTag ||
  29192. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29193. }
  29194. /**
  29195. * Checks if `value` is a finite primitive number.
  29196. *
  29197. * **Note:** This method is based on
  29198. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29199. *
  29200. * @static
  29201. * @memberOf _
  29202. * @since 0.1.0
  29203. * @category Lang
  29204. * @param {*} value The value to check.
  29205. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29206. * @example
  29207. *
  29208. * _.isFinite(3);
  29209. * // => true
  29210. *
  29211. * _.isFinite(Number.MIN_VALUE);
  29212. * // => true
  29213. *
  29214. * _.isFinite(Infinity);
  29215. * // => false
  29216. *
  29217. * _.isFinite('3');
  29218. * // => false
  29219. */
  29220. function isFinite(value) {
  29221. return typeof value == 'number' && nativeIsFinite(value);
  29222. }
  29223. /**
  29224. * Checks if `value` is classified as a `Function` object.
  29225. *
  29226. * @static
  29227. * @memberOf _
  29228. * @since 0.1.0
  29229. * @category Lang
  29230. * @param {*} value The value to check.
  29231. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29232. * @example
  29233. *
  29234. * _.isFunction(_);
  29235. * // => true
  29236. *
  29237. * _.isFunction(/abc/);
  29238. * // => false
  29239. */
  29240. function isFunction(value) {
  29241. if (!isObject(value)) {
  29242. return false;
  29243. }
  29244. // The use of `Object#toString` avoids issues with the `typeof` operator
  29245. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29246. var tag = baseGetTag(value);
  29247. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29248. }
  29249. /**
  29250. * Checks if `value` is an integer.
  29251. *
  29252. * **Note:** This method is based on
  29253. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29254. *
  29255. * @static
  29256. * @memberOf _
  29257. * @since 4.0.0
  29258. * @category Lang
  29259. * @param {*} value The value to check.
  29260. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29261. * @example
  29262. *
  29263. * _.isInteger(3);
  29264. * // => true
  29265. *
  29266. * _.isInteger(Number.MIN_VALUE);
  29267. * // => false
  29268. *
  29269. * _.isInteger(Infinity);
  29270. * // => false
  29271. *
  29272. * _.isInteger('3');
  29273. * // => false
  29274. */
  29275. function isInteger(value) {
  29276. return typeof value == 'number' && value == toInteger(value);
  29277. }
  29278. /**
  29279. * Checks if `value` is a valid array-like length.
  29280. *
  29281. * **Note:** This method is loosely based on
  29282. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29283. *
  29284. * @static
  29285. * @memberOf _
  29286. * @since 4.0.0
  29287. * @category Lang
  29288. * @param {*} value The value to check.
  29289. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29290. * @example
  29291. *
  29292. * _.isLength(3);
  29293. * // => true
  29294. *
  29295. * _.isLength(Number.MIN_VALUE);
  29296. * // => false
  29297. *
  29298. * _.isLength(Infinity);
  29299. * // => false
  29300. *
  29301. * _.isLength('3');
  29302. * // => false
  29303. */
  29304. function isLength(value) {
  29305. return typeof value == 'number' &&
  29306. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29307. }
  29308. /**
  29309. * Checks if `value` is the
  29310. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29311. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29312. *
  29313. * @static
  29314. * @memberOf _
  29315. * @since 0.1.0
  29316. * @category Lang
  29317. * @param {*} value The value to check.
  29318. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29319. * @example
  29320. *
  29321. * _.isObject({});
  29322. * // => true
  29323. *
  29324. * _.isObject([1, 2, 3]);
  29325. * // => true
  29326. *
  29327. * _.isObject(_.noop);
  29328. * // => true
  29329. *
  29330. * _.isObject(null);
  29331. * // => false
  29332. */
  29333. function isObject(value) {
  29334. var type = typeof value;
  29335. return value != null && (type == 'object' || type == 'function');
  29336. }
  29337. /**
  29338. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29339. * and has a `typeof` result of "object".
  29340. *
  29341. * @static
  29342. * @memberOf _
  29343. * @since 4.0.0
  29344. * @category Lang
  29345. * @param {*} value The value to check.
  29346. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29347. * @example
  29348. *
  29349. * _.isObjectLike({});
  29350. * // => true
  29351. *
  29352. * _.isObjectLike([1, 2, 3]);
  29353. * // => true
  29354. *
  29355. * _.isObjectLike(_.noop);
  29356. * // => false
  29357. *
  29358. * _.isObjectLike(null);
  29359. * // => false
  29360. */
  29361. function isObjectLike(value) {
  29362. return value != null && typeof value == 'object';
  29363. }
  29364. /**
  29365. * Checks if `value` is classified as a `Map` object.
  29366. *
  29367. * @static
  29368. * @memberOf _
  29369. * @since 4.3.0
  29370. * @category Lang
  29371. * @param {*} value The value to check.
  29372. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29373. * @example
  29374. *
  29375. * _.isMap(new Map);
  29376. * // => true
  29377. *
  29378. * _.isMap(new WeakMap);
  29379. * // => false
  29380. */
  29381. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29382. /**
  29383. * Performs a partial deep comparison between `object` and `source` to
  29384. * determine if `object` contains equivalent property values.
  29385. *
  29386. * **Note:** This method is equivalent to `_.matches` when `source` is
  29387. * partially applied.
  29388. *
  29389. * Partial comparisons will match empty array and empty object `source`
  29390. * values against any array or object value, respectively. See `_.isEqual`
  29391. * for a list of supported value comparisons.
  29392. *
  29393. * @static
  29394. * @memberOf _
  29395. * @since 3.0.0
  29396. * @category Lang
  29397. * @param {Object} object The object to inspect.
  29398. * @param {Object} source The object of property values to match.
  29399. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29400. * @example
  29401. *
  29402. * var object = { 'a': 1, 'b': 2 };
  29403. *
  29404. * _.isMatch(object, { 'b': 2 });
  29405. * // => true
  29406. *
  29407. * _.isMatch(object, { 'b': 1 });
  29408. * // => false
  29409. */
  29410. function isMatch(object, source) {
  29411. return object === source || baseIsMatch(object, source, getMatchData(source));
  29412. }
  29413. /**
  29414. * This method is like `_.isMatch` except that it accepts `customizer` which
  29415. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29416. * are handled by the method instead. The `customizer` is invoked with five
  29417. * arguments: (objValue, srcValue, index|key, object, source).
  29418. *
  29419. * @static
  29420. * @memberOf _
  29421. * @since 4.0.0
  29422. * @category Lang
  29423. * @param {Object} object The object to inspect.
  29424. * @param {Object} source The object of property values to match.
  29425. * @param {Function} [customizer] The function to customize comparisons.
  29426. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29427. * @example
  29428. *
  29429. * function isGreeting(value) {
  29430. * return /^h(?:i|ello)$/.test(value);
  29431. * }
  29432. *
  29433. * function customizer(objValue, srcValue) {
  29434. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29435. * return true;
  29436. * }
  29437. * }
  29438. *
  29439. * var object = { 'greeting': 'hello' };
  29440. * var source = { 'greeting': 'hi' };
  29441. *
  29442. * _.isMatchWith(object, source, customizer);
  29443. * // => true
  29444. */
  29445. function isMatchWith(object, source, customizer) {
  29446. customizer = typeof customizer == 'function' ? customizer : undefined;
  29447. return baseIsMatch(object, source, getMatchData(source), customizer);
  29448. }
  29449. /**
  29450. * Checks if `value` is `NaN`.
  29451. *
  29452. * **Note:** This method is based on
  29453. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29454. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29455. * `undefined` and other non-number values.
  29456. *
  29457. * @static
  29458. * @memberOf _
  29459. * @since 0.1.0
  29460. * @category Lang
  29461. * @param {*} value The value to check.
  29462. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29463. * @example
  29464. *
  29465. * _.isNaN(NaN);
  29466. * // => true
  29467. *
  29468. * _.isNaN(new Number(NaN));
  29469. * // => true
  29470. *
  29471. * isNaN(undefined);
  29472. * // => true
  29473. *
  29474. * _.isNaN(undefined);
  29475. * // => false
  29476. */
  29477. function isNaN(value) {
  29478. // An `NaN` primitive is the only value that is not equal to itself.
  29479. // Perform the `toStringTag` check first to avoid errors with some
  29480. // ActiveX objects in IE.
  29481. return isNumber(value) && value != +value;
  29482. }
  29483. /**
  29484. * Checks if `value` is a pristine native function.
  29485. *
  29486. * **Note:** This method can't reliably detect native functions in the presence
  29487. * of the core-js package because core-js circumvents this kind of detection.
  29488. * Despite multiple requests, the core-js maintainer has made it clear: any
  29489. * attempt to fix the detection will be obstructed. As a result, we're left
  29490. * with little choice but to throw an error. Unfortunately, this also affects
  29491. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29492. * which rely on core-js.
  29493. *
  29494. * @static
  29495. * @memberOf _
  29496. * @since 3.0.0
  29497. * @category Lang
  29498. * @param {*} value The value to check.
  29499. * @returns {boolean} Returns `true` if `value` is a native function,
  29500. * else `false`.
  29501. * @example
  29502. *
  29503. * _.isNative(Array.prototype.push);
  29504. * // => true
  29505. *
  29506. * _.isNative(_);
  29507. * // => false
  29508. */
  29509. function isNative(value) {
  29510. if (isMaskable(value)) {
  29511. throw new Error(CORE_ERROR_TEXT);
  29512. }
  29513. return baseIsNative(value);
  29514. }
  29515. /**
  29516. * Checks if `value` is `null`.
  29517. *
  29518. * @static
  29519. * @memberOf _
  29520. * @since 0.1.0
  29521. * @category Lang
  29522. * @param {*} value The value to check.
  29523. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29524. * @example
  29525. *
  29526. * _.isNull(null);
  29527. * // => true
  29528. *
  29529. * _.isNull(void 0);
  29530. * // => false
  29531. */
  29532. function isNull(value) {
  29533. return value === null;
  29534. }
  29535. /**
  29536. * Checks if `value` is `null` or `undefined`.
  29537. *
  29538. * @static
  29539. * @memberOf _
  29540. * @since 4.0.0
  29541. * @category Lang
  29542. * @param {*} value The value to check.
  29543. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29544. * @example
  29545. *
  29546. * _.isNil(null);
  29547. * // => true
  29548. *
  29549. * _.isNil(void 0);
  29550. * // => true
  29551. *
  29552. * _.isNil(NaN);
  29553. * // => false
  29554. */
  29555. function isNil(value) {
  29556. return value == null;
  29557. }
  29558. /**
  29559. * Checks if `value` is classified as a `Number` primitive or object.
  29560. *
  29561. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29562. * classified as numbers, use the `_.isFinite` method.
  29563. *
  29564. * @static
  29565. * @memberOf _
  29566. * @since 0.1.0
  29567. * @category Lang
  29568. * @param {*} value The value to check.
  29569. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29570. * @example
  29571. *
  29572. * _.isNumber(3);
  29573. * // => true
  29574. *
  29575. * _.isNumber(Number.MIN_VALUE);
  29576. * // => true
  29577. *
  29578. * _.isNumber(Infinity);
  29579. * // => true
  29580. *
  29581. * _.isNumber('3');
  29582. * // => false
  29583. */
  29584. function isNumber(value) {
  29585. return typeof value == 'number' ||
  29586. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29587. }
  29588. /**
  29589. * Checks if `value` is a plain object, that is, an object created by the
  29590. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29591. *
  29592. * @static
  29593. * @memberOf _
  29594. * @since 0.8.0
  29595. * @category Lang
  29596. * @param {*} value The value to check.
  29597. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29598. * @example
  29599. *
  29600. * function Foo() {
  29601. * this.a = 1;
  29602. * }
  29603. *
  29604. * _.isPlainObject(new Foo);
  29605. * // => false
  29606. *
  29607. * _.isPlainObject([1, 2, 3]);
  29608. * // => false
  29609. *
  29610. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29611. * // => true
  29612. *
  29613. * _.isPlainObject(Object.create(null));
  29614. * // => true
  29615. */
  29616. function isPlainObject(value) {
  29617. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29618. return false;
  29619. }
  29620. var proto = getPrototype(value);
  29621. if (proto === null) {
  29622. return true;
  29623. }
  29624. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29625. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29626. funcToString.call(Ctor) == objectCtorString;
  29627. }
  29628. /**
  29629. * Checks if `value` is classified as a `RegExp` object.
  29630. *
  29631. * @static
  29632. * @memberOf _
  29633. * @since 0.1.0
  29634. * @category Lang
  29635. * @param {*} value The value to check.
  29636. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29637. * @example
  29638. *
  29639. * _.isRegExp(/abc/);
  29640. * // => true
  29641. *
  29642. * _.isRegExp('/abc/');
  29643. * // => false
  29644. */
  29645. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29646. /**
  29647. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29648. * double precision number which isn't the result of a rounded unsafe integer.
  29649. *
  29650. * **Note:** This method is based on
  29651. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29652. *
  29653. * @static
  29654. * @memberOf _
  29655. * @since 4.0.0
  29656. * @category Lang
  29657. * @param {*} value The value to check.
  29658. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29659. * @example
  29660. *
  29661. * _.isSafeInteger(3);
  29662. * // => true
  29663. *
  29664. * _.isSafeInteger(Number.MIN_VALUE);
  29665. * // => false
  29666. *
  29667. * _.isSafeInteger(Infinity);
  29668. * // => false
  29669. *
  29670. * _.isSafeInteger('3');
  29671. * // => false
  29672. */
  29673. function isSafeInteger(value) {
  29674. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29675. }
  29676. /**
  29677. * Checks if `value` is classified as a `Set` object.
  29678. *
  29679. * @static
  29680. * @memberOf _
  29681. * @since 4.3.0
  29682. * @category Lang
  29683. * @param {*} value The value to check.
  29684. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29685. * @example
  29686. *
  29687. * _.isSet(new Set);
  29688. * // => true
  29689. *
  29690. * _.isSet(new WeakSet);
  29691. * // => false
  29692. */
  29693. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29694. /**
  29695. * Checks if `value` is classified as a `String` primitive or object.
  29696. *
  29697. * @static
  29698. * @since 0.1.0
  29699. * @memberOf _
  29700. * @category Lang
  29701. * @param {*} value The value to check.
  29702. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29703. * @example
  29704. *
  29705. * _.isString('abc');
  29706. * // => true
  29707. *
  29708. * _.isString(1);
  29709. * // => false
  29710. */
  29711. function isString(value) {
  29712. return typeof value == 'string' ||
  29713. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29714. }
  29715. /**
  29716. * Checks if `value` is classified as a `Symbol` primitive or object.
  29717. *
  29718. * @static
  29719. * @memberOf _
  29720. * @since 4.0.0
  29721. * @category Lang
  29722. * @param {*} value The value to check.
  29723. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29724. * @example
  29725. *
  29726. * _.isSymbol(Symbol.iterator);
  29727. * // => true
  29728. *
  29729. * _.isSymbol('abc');
  29730. * // => false
  29731. */
  29732. function isSymbol(value) {
  29733. return typeof value == 'symbol' ||
  29734. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29735. }
  29736. /**
  29737. * Checks if `value` is classified as a typed array.
  29738. *
  29739. * @static
  29740. * @memberOf _
  29741. * @since 3.0.0
  29742. * @category Lang
  29743. * @param {*} value The value to check.
  29744. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29745. * @example
  29746. *
  29747. * _.isTypedArray(new Uint8Array);
  29748. * // => true
  29749. *
  29750. * _.isTypedArray([]);
  29751. * // => false
  29752. */
  29753. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29754. /**
  29755. * Checks if `value` is `undefined`.
  29756. *
  29757. * @static
  29758. * @since 0.1.0
  29759. * @memberOf _
  29760. * @category Lang
  29761. * @param {*} value The value to check.
  29762. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29763. * @example
  29764. *
  29765. * _.isUndefined(void 0);
  29766. * // => true
  29767. *
  29768. * _.isUndefined(null);
  29769. * // => false
  29770. */
  29771. function isUndefined(value) {
  29772. return value === undefined;
  29773. }
  29774. /**
  29775. * Checks if `value` is classified as a `WeakMap` object.
  29776. *
  29777. * @static
  29778. * @memberOf _
  29779. * @since 4.3.0
  29780. * @category Lang
  29781. * @param {*} value The value to check.
  29782. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29783. * @example
  29784. *
  29785. * _.isWeakMap(new WeakMap);
  29786. * // => true
  29787. *
  29788. * _.isWeakMap(new Map);
  29789. * // => false
  29790. */
  29791. function isWeakMap(value) {
  29792. return isObjectLike(value) && getTag(value) == weakMapTag;
  29793. }
  29794. /**
  29795. * Checks if `value` is classified as a `WeakSet` object.
  29796. *
  29797. * @static
  29798. * @memberOf _
  29799. * @since 4.3.0
  29800. * @category Lang
  29801. * @param {*} value The value to check.
  29802. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29803. * @example
  29804. *
  29805. * _.isWeakSet(new WeakSet);
  29806. * // => true
  29807. *
  29808. * _.isWeakSet(new Set);
  29809. * // => false
  29810. */
  29811. function isWeakSet(value) {
  29812. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29813. }
  29814. /**
  29815. * Checks if `value` is less than `other`.
  29816. *
  29817. * @static
  29818. * @memberOf _
  29819. * @since 3.9.0
  29820. * @category Lang
  29821. * @param {*} value The value to compare.
  29822. * @param {*} other The other value to compare.
  29823. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29824. * else `false`.
  29825. * @see _.gt
  29826. * @example
  29827. *
  29828. * _.lt(1, 3);
  29829. * // => true
  29830. *
  29831. * _.lt(3, 3);
  29832. * // => false
  29833. *
  29834. * _.lt(3, 1);
  29835. * // => false
  29836. */
  29837. var lt = createRelationalOperation(baseLt);
  29838. /**
  29839. * Checks if `value` is less than or equal to `other`.
  29840. *
  29841. * @static
  29842. * @memberOf _
  29843. * @since 3.9.0
  29844. * @category Lang
  29845. * @param {*} value The value to compare.
  29846. * @param {*} other The other value to compare.
  29847. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29848. * `other`, else `false`.
  29849. * @see _.gte
  29850. * @example
  29851. *
  29852. * _.lte(1, 3);
  29853. * // => true
  29854. *
  29855. * _.lte(3, 3);
  29856. * // => true
  29857. *
  29858. * _.lte(3, 1);
  29859. * // => false
  29860. */
  29861. var lte = createRelationalOperation(function(value, other) {
  29862. return value <= other;
  29863. });
  29864. /**
  29865. * Converts `value` to an array.
  29866. *
  29867. * @static
  29868. * @since 0.1.0
  29869. * @memberOf _
  29870. * @category Lang
  29871. * @param {*} value The value to convert.
  29872. * @returns {Array} Returns the converted array.
  29873. * @example
  29874. *
  29875. * _.toArray({ 'a': 1, 'b': 2 });
  29876. * // => [1, 2]
  29877. *
  29878. * _.toArray('abc');
  29879. * // => ['a', 'b', 'c']
  29880. *
  29881. * _.toArray(1);
  29882. * // => []
  29883. *
  29884. * _.toArray(null);
  29885. * // => []
  29886. */
  29887. function toArray(value) {
  29888. if (!value) {
  29889. return [];
  29890. }
  29891. if (isArrayLike(value)) {
  29892. return isString(value) ? stringToArray(value) : copyArray(value);
  29893. }
  29894. if (symIterator && value[symIterator]) {
  29895. return iteratorToArray(value[symIterator]());
  29896. }
  29897. var tag = getTag(value),
  29898. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29899. return func(value);
  29900. }
  29901. /**
  29902. * Converts `value` to a finite number.
  29903. *
  29904. * @static
  29905. * @memberOf _
  29906. * @since 4.12.0
  29907. * @category Lang
  29908. * @param {*} value The value to convert.
  29909. * @returns {number} Returns the converted number.
  29910. * @example
  29911. *
  29912. * _.toFinite(3.2);
  29913. * // => 3.2
  29914. *
  29915. * _.toFinite(Number.MIN_VALUE);
  29916. * // => 5e-324
  29917. *
  29918. * _.toFinite(Infinity);
  29919. * // => 1.7976931348623157e+308
  29920. *
  29921. * _.toFinite('3.2');
  29922. * // => 3.2
  29923. */
  29924. function toFinite(value) {
  29925. if (!value) {
  29926. return value === 0 ? value : 0;
  29927. }
  29928. value = toNumber(value);
  29929. if (value === INFINITY || value === -INFINITY) {
  29930. var sign = (value < 0 ? -1 : 1);
  29931. return sign * MAX_INTEGER;
  29932. }
  29933. return value === value ? value : 0;
  29934. }
  29935. /**
  29936. * Converts `value` to an integer.
  29937. *
  29938. * **Note:** This method is loosely based on
  29939. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29940. *
  29941. * @static
  29942. * @memberOf _
  29943. * @since 4.0.0
  29944. * @category Lang
  29945. * @param {*} value The value to convert.
  29946. * @returns {number} Returns the converted integer.
  29947. * @example
  29948. *
  29949. * _.toInteger(3.2);
  29950. * // => 3
  29951. *
  29952. * _.toInteger(Number.MIN_VALUE);
  29953. * // => 0
  29954. *
  29955. * _.toInteger(Infinity);
  29956. * // => 1.7976931348623157e+308
  29957. *
  29958. * _.toInteger('3.2');
  29959. * // => 3
  29960. */
  29961. function toInteger(value) {
  29962. var result = toFinite(value),
  29963. remainder = result % 1;
  29964. return result === result ? (remainder ? result - remainder : result) : 0;
  29965. }
  29966. /**
  29967. * Converts `value` to an integer suitable for use as the length of an
  29968. * array-like object.
  29969. *
  29970. * **Note:** This method is based on
  29971. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29972. *
  29973. * @static
  29974. * @memberOf _
  29975. * @since 4.0.0
  29976. * @category Lang
  29977. * @param {*} value The value to convert.
  29978. * @returns {number} Returns the converted integer.
  29979. * @example
  29980. *
  29981. * _.toLength(3.2);
  29982. * // => 3
  29983. *
  29984. * _.toLength(Number.MIN_VALUE);
  29985. * // => 0
  29986. *
  29987. * _.toLength(Infinity);
  29988. * // => 4294967295
  29989. *
  29990. * _.toLength('3.2');
  29991. * // => 3
  29992. */
  29993. function toLength(value) {
  29994. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29995. }
  29996. /**
  29997. * Converts `value` to a number.
  29998. *
  29999. * @static
  30000. * @memberOf _
  30001. * @since 4.0.0
  30002. * @category Lang
  30003. * @param {*} value The value to process.
  30004. * @returns {number} Returns the number.
  30005. * @example
  30006. *
  30007. * _.toNumber(3.2);
  30008. * // => 3.2
  30009. *
  30010. * _.toNumber(Number.MIN_VALUE);
  30011. * // => 5e-324
  30012. *
  30013. * _.toNumber(Infinity);
  30014. * // => Infinity
  30015. *
  30016. * _.toNumber('3.2');
  30017. * // => 3.2
  30018. */
  30019. function toNumber(value) {
  30020. if (typeof value == 'number') {
  30021. return value;
  30022. }
  30023. if (isSymbol(value)) {
  30024. return NAN;
  30025. }
  30026. if (isObject(value)) {
  30027. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30028. value = isObject(other) ? (other + '') : other;
  30029. }
  30030. if (typeof value != 'string') {
  30031. return value === 0 ? value : +value;
  30032. }
  30033. value = value.replace(reTrim, '');
  30034. var isBinary = reIsBinary.test(value);
  30035. return (isBinary || reIsOctal.test(value))
  30036. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30037. : (reIsBadHex.test(value) ? NAN : +value);
  30038. }
  30039. /**
  30040. * Converts `value` to a plain object flattening inherited enumerable string
  30041. * keyed properties of `value` to own properties of the plain object.
  30042. *
  30043. * @static
  30044. * @memberOf _
  30045. * @since 3.0.0
  30046. * @category Lang
  30047. * @param {*} value The value to convert.
  30048. * @returns {Object} Returns the converted plain object.
  30049. * @example
  30050. *
  30051. * function Foo() {
  30052. * this.b = 2;
  30053. * }
  30054. *
  30055. * Foo.prototype.c = 3;
  30056. *
  30057. * _.assign({ 'a': 1 }, new Foo);
  30058. * // => { 'a': 1, 'b': 2 }
  30059. *
  30060. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30061. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30062. */
  30063. function toPlainObject(value) {
  30064. return copyObject(value, keysIn(value));
  30065. }
  30066. /**
  30067. * Converts `value` to a safe integer. A safe integer can be compared and
  30068. * represented correctly.
  30069. *
  30070. * @static
  30071. * @memberOf _
  30072. * @since 4.0.0
  30073. * @category Lang
  30074. * @param {*} value The value to convert.
  30075. * @returns {number} Returns the converted integer.
  30076. * @example
  30077. *
  30078. * _.toSafeInteger(3.2);
  30079. * // => 3
  30080. *
  30081. * _.toSafeInteger(Number.MIN_VALUE);
  30082. * // => 0
  30083. *
  30084. * _.toSafeInteger(Infinity);
  30085. * // => 9007199254740991
  30086. *
  30087. * _.toSafeInteger('3.2');
  30088. * // => 3
  30089. */
  30090. function toSafeInteger(value) {
  30091. return value
  30092. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30093. : (value === 0 ? value : 0);
  30094. }
  30095. /**
  30096. * Converts `value` to a string. An empty string is returned for `null`
  30097. * and `undefined` values. The sign of `-0` is preserved.
  30098. *
  30099. * @static
  30100. * @memberOf _
  30101. * @since 4.0.0
  30102. * @category Lang
  30103. * @param {*} value The value to convert.
  30104. * @returns {string} Returns the converted string.
  30105. * @example
  30106. *
  30107. * _.toString(null);
  30108. * // => ''
  30109. *
  30110. * _.toString(-0);
  30111. * // => '-0'
  30112. *
  30113. * _.toString([1, 2, 3]);
  30114. * // => '1,2,3'
  30115. */
  30116. function toString(value) {
  30117. return value == null ? '' : baseToString(value);
  30118. }
  30119. /*------------------------------------------------------------------------*/
  30120. /**
  30121. * Assigns own enumerable string keyed properties of source objects to the
  30122. * destination object. Source objects are applied from left to right.
  30123. * Subsequent sources overwrite property assignments of previous sources.
  30124. *
  30125. * **Note:** This method mutates `object` and is loosely based on
  30126. * [`Object.assign`](https://mdn.io/Object/assign).
  30127. *
  30128. * @static
  30129. * @memberOf _
  30130. * @since 0.10.0
  30131. * @category Object
  30132. * @param {Object} object The destination object.
  30133. * @param {...Object} [sources] The source objects.
  30134. * @returns {Object} Returns `object`.
  30135. * @see _.assignIn
  30136. * @example
  30137. *
  30138. * function Foo() {
  30139. * this.a = 1;
  30140. * }
  30141. *
  30142. * function Bar() {
  30143. * this.c = 3;
  30144. * }
  30145. *
  30146. * Foo.prototype.b = 2;
  30147. * Bar.prototype.d = 4;
  30148. *
  30149. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30150. * // => { 'a': 1, 'c': 3 }
  30151. */
  30152. var assign = createAssigner(function(object, source) {
  30153. if (isPrototype(source) || isArrayLike(source)) {
  30154. copyObject(source, keys(source), object);
  30155. return;
  30156. }
  30157. for (var key in source) {
  30158. if (hasOwnProperty.call(source, key)) {
  30159. assignValue(object, key, source[key]);
  30160. }
  30161. }
  30162. });
  30163. /**
  30164. * This method is like `_.assign` except that it iterates over own and
  30165. * inherited source properties.
  30166. *
  30167. * **Note:** This method mutates `object`.
  30168. *
  30169. * @static
  30170. * @memberOf _
  30171. * @since 4.0.0
  30172. * @alias extend
  30173. * @category Object
  30174. * @param {Object} object The destination object.
  30175. * @param {...Object} [sources] The source objects.
  30176. * @returns {Object} Returns `object`.
  30177. * @see _.assign
  30178. * @example
  30179. *
  30180. * function Foo() {
  30181. * this.a = 1;
  30182. * }
  30183. *
  30184. * function Bar() {
  30185. * this.c = 3;
  30186. * }
  30187. *
  30188. * Foo.prototype.b = 2;
  30189. * Bar.prototype.d = 4;
  30190. *
  30191. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30192. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30193. */
  30194. var assignIn = createAssigner(function(object, source) {
  30195. copyObject(source, keysIn(source), object);
  30196. });
  30197. /**
  30198. * This method is like `_.assignIn` except that it accepts `customizer`
  30199. * which is invoked to produce the assigned values. If `customizer` returns
  30200. * `undefined`, assignment is handled by the method instead. The `customizer`
  30201. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30202. *
  30203. * **Note:** This method mutates `object`.
  30204. *
  30205. * @static
  30206. * @memberOf _
  30207. * @since 4.0.0
  30208. * @alias extendWith
  30209. * @category Object
  30210. * @param {Object} object The destination object.
  30211. * @param {...Object} sources The source objects.
  30212. * @param {Function} [customizer] The function to customize assigned values.
  30213. * @returns {Object} Returns `object`.
  30214. * @see _.assignWith
  30215. * @example
  30216. *
  30217. * function customizer(objValue, srcValue) {
  30218. * return _.isUndefined(objValue) ? srcValue : objValue;
  30219. * }
  30220. *
  30221. * var defaults = _.partialRight(_.assignInWith, customizer);
  30222. *
  30223. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30224. * // => { 'a': 1, 'b': 2 }
  30225. */
  30226. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30227. copyObject(source, keysIn(source), object, customizer);
  30228. });
  30229. /**
  30230. * This method is like `_.assign` except that it accepts `customizer`
  30231. * which is invoked to produce the assigned values. If `customizer` returns
  30232. * `undefined`, assignment is handled by the method instead. The `customizer`
  30233. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30234. *
  30235. * **Note:** This method mutates `object`.
  30236. *
  30237. * @static
  30238. * @memberOf _
  30239. * @since 4.0.0
  30240. * @category Object
  30241. * @param {Object} object The destination object.
  30242. * @param {...Object} sources The source objects.
  30243. * @param {Function} [customizer] The function to customize assigned values.
  30244. * @returns {Object} Returns `object`.
  30245. * @see _.assignInWith
  30246. * @example
  30247. *
  30248. * function customizer(objValue, srcValue) {
  30249. * return _.isUndefined(objValue) ? srcValue : objValue;
  30250. * }
  30251. *
  30252. * var defaults = _.partialRight(_.assignWith, customizer);
  30253. *
  30254. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30255. * // => { 'a': 1, 'b': 2 }
  30256. */
  30257. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30258. copyObject(source, keys(source), object, customizer);
  30259. });
  30260. /**
  30261. * Creates an array of values corresponding to `paths` of `object`.
  30262. *
  30263. * @static
  30264. * @memberOf _
  30265. * @since 1.0.0
  30266. * @category Object
  30267. * @param {Object} object The object to iterate over.
  30268. * @param {...(string|string[])} [paths] The property paths to pick.
  30269. * @returns {Array} Returns the picked values.
  30270. * @example
  30271. *
  30272. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30273. *
  30274. * _.at(object, ['a[0].b.c', 'a[1]']);
  30275. * // => [3, 4]
  30276. */
  30277. var at = flatRest(baseAt);
  30278. /**
  30279. * Creates an object that inherits from the `prototype` object. If a
  30280. * `properties` object is given, its own enumerable string keyed properties
  30281. * are assigned to the created object.
  30282. *
  30283. * @static
  30284. * @memberOf _
  30285. * @since 2.3.0
  30286. * @category Object
  30287. * @param {Object} prototype The object to inherit from.
  30288. * @param {Object} [properties] The properties to assign to the object.
  30289. * @returns {Object} Returns the new object.
  30290. * @example
  30291. *
  30292. * function Shape() {
  30293. * this.x = 0;
  30294. * this.y = 0;
  30295. * }
  30296. *
  30297. * function Circle() {
  30298. * Shape.call(this);
  30299. * }
  30300. *
  30301. * Circle.prototype = _.create(Shape.prototype, {
  30302. * 'constructor': Circle
  30303. * });
  30304. *
  30305. * var circle = new Circle;
  30306. * circle instanceof Circle;
  30307. * // => true
  30308. *
  30309. * circle instanceof Shape;
  30310. * // => true
  30311. */
  30312. function create(prototype, properties) {
  30313. var result = baseCreate(prototype);
  30314. return properties == null ? result : baseAssign(result, properties);
  30315. }
  30316. /**
  30317. * Assigns own and inherited enumerable string keyed properties of source
  30318. * objects to the destination object for all destination properties that
  30319. * resolve to `undefined`. Source objects are applied from left to right.
  30320. * Once a property is set, additional values of the same property are ignored.
  30321. *
  30322. * **Note:** This method mutates `object`.
  30323. *
  30324. * @static
  30325. * @since 0.1.0
  30326. * @memberOf _
  30327. * @category Object
  30328. * @param {Object} object The destination object.
  30329. * @param {...Object} [sources] The source objects.
  30330. * @returns {Object} Returns `object`.
  30331. * @see _.defaultsDeep
  30332. * @example
  30333. *
  30334. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30335. * // => { 'a': 1, 'b': 2 }
  30336. */
  30337. var defaults = baseRest(function(object, sources) {
  30338. object = Object(object);
  30339. var index = -1;
  30340. var length = sources.length;
  30341. var guard = length > 2 ? sources[2] : undefined;
  30342. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30343. length = 1;
  30344. }
  30345. while (++index < length) {
  30346. var source = sources[index];
  30347. var props = keysIn(source);
  30348. var propsIndex = -1;
  30349. var propsLength = props.length;
  30350. while (++propsIndex < propsLength) {
  30351. var key = props[propsIndex];
  30352. var value = object[key];
  30353. if (value === undefined ||
  30354. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30355. object[key] = source[key];
  30356. }
  30357. }
  30358. }
  30359. return object;
  30360. });
  30361. /**
  30362. * This method is like `_.defaults` except that it recursively assigns
  30363. * default properties.
  30364. *
  30365. * **Note:** This method mutates `object`.
  30366. *
  30367. * @static
  30368. * @memberOf _
  30369. * @since 3.10.0
  30370. * @category Object
  30371. * @param {Object} object The destination object.
  30372. * @param {...Object} [sources] The source objects.
  30373. * @returns {Object} Returns `object`.
  30374. * @see _.defaults
  30375. * @example
  30376. *
  30377. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30378. * // => { 'a': { 'b': 2, 'c': 3 } }
  30379. */
  30380. var defaultsDeep = baseRest(function(args) {
  30381. args.push(undefined, customDefaultsMerge);
  30382. return apply(mergeWith, undefined, args);
  30383. });
  30384. /**
  30385. * This method is like `_.find` except that it returns the key of the first
  30386. * element `predicate` returns truthy for instead of the element itself.
  30387. *
  30388. * @static
  30389. * @memberOf _
  30390. * @since 1.1.0
  30391. * @category Object
  30392. * @param {Object} object The object to inspect.
  30393. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30394. * @returns {string|undefined} Returns the key of the matched element,
  30395. * else `undefined`.
  30396. * @example
  30397. *
  30398. * var users = {
  30399. * 'barney': { 'age': 36, 'active': true },
  30400. * 'fred': { 'age': 40, 'active': false },
  30401. * 'pebbles': { 'age': 1, 'active': true }
  30402. * };
  30403. *
  30404. * _.findKey(users, function(o) { return o.age < 40; });
  30405. * // => 'barney' (iteration order is not guaranteed)
  30406. *
  30407. * // The `_.matches` iteratee shorthand.
  30408. * _.findKey(users, { 'age': 1, 'active': true });
  30409. * // => 'pebbles'
  30410. *
  30411. * // The `_.matchesProperty` iteratee shorthand.
  30412. * _.findKey(users, ['active', false]);
  30413. * // => 'fred'
  30414. *
  30415. * // The `_.property` iteratee shorthand.
  30416. * _.findKey(users, 'active');
  30417. * // => 'barney'
  30418. */
  30419. function findKey(object, predicate) {
  30420. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30421. }
  30422. /**
  30423. * This method is like `_.findKey` except that it iterates over elements of
  30424. * a collection in the opposite order.
  30425. *
  30426. * @static
  30427. * @memberOf _
  30428. * @since 2.0.0
  30429. * @category Object
  30430. * @param {Object} object The object to inspect.
  30431. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30432. * @returns {string|undefined} Returns the key of the matched element,
  30433. * else `undefined`.
  30434. * @example
  30435. *
  30436. * var users = {
  30437. * 'barney': { 'age': 36, 'active': true },
  30438. * 'fred': { 'age': 40, 'active': false },
  30439. * 'pebbles': { 'age': 1, 'active': true }
  30440. * };
  30441. *
  30442. * _.findLastKey(users, function(o) { return o.age < 40; });
  30443. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30444. *
  30445. * // The `_.matches` iteratee shorthand.
  30446. * _.findLastKey(users, { 'age': 36, 'active': true });
  30447. * // => 'barney'
  30448. *
  30449. * // The `_.matchesProperty` iteratee shorthand.
  30450. * _.findLastKey(users, ['active', false]);
  30451. * // => 'fred'
  30452. *
  30453. * // The `_.property` iteratee shorthand.
  30454. * _.findLastKey(users, 'active');
  30455. * // => 'pebbles'
  30456. */
  30457. function findLastKey(object, predicate) {
  30458. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30459. }
  30460. /**
  30461. * Iterates over own and inherited enumerable string keyed properties of an
  30462. * object and invokes `iteratee` for each property. The iteratee is invoked
  30463. * with three arguments: (value, key, object). Iteratee functions may exit
  30464. * iteration early by explicitly returning `false`.
  30465. *
  30466. * @static
  30467. * @memberOf _
  30468. * @since 0.3.0
  30469. * @category Object
  30470. * @param {Object} object The object to iterate over.
  30471. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30472. * @returns {Object} Returns `object`.
  30473. * @see _.forInRight
  30474. * @example
  30475. *
  30476. * function Foo() {
  30477. * this.a = 1;
  30478. * this.b = 2;
  30479. * }
  30480. *
  30481. * Foo.prototype.c = 3;
  30482. *
  30483. * _.forIn(new Foo, function(value, key) {
  30484. * console.log(key);
  30485. * });
  30486. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30487. */
  30488. function forIn(object, iteratee) {
  30489. return object == null
  30490. ? object
  30491. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30492. }
  30493. /**
  30494. * This method is like `_.forIn` except that it iterates over properties of
  30495. * `object` in the opposite order.
  30496. *
  30497. * @static
  30498. * @memberOf _
  30499. * @since 2.0.0
  30500. * @category Object
  30501. * @param {Object} object The object to iterate over.
  30502. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30503. * @returns {Object} Returns `object`.
  30504. * @see _.forIn
  30505. * @example
  30506. *
  30507. * function Foo() {
  30508. * this.a = 1;
  30509. * this.b = 2;
  30510. * }
  30511. *
  30512. * Foo.prototype.c = 3;
  30513. *
  30514. * _.forInRight(new Foo, function(value, key) {
  30515. * console.log(key);
  30516. * });
  30517. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30518. */
  30519. function forInRight(object, iteratee) {
  30520. return object == null
  30521. ? object
  30522. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30523. }
  30524. /**
  30525. * Iterates over own enumerable string keyed properties of an object and
  30526. * invokes `iteratee` for each property. The iteratee is invoked with three
  30527. * arguments: (value, key, object). Iteratee functions may exit iteration
  30528. * early by explicitly returning `false`.
  30529. *
  30530. * @static
  30531. * @memberOf _
  30532. * @since 0.3.0
  30533. * @category Object
  30534. * @param {Object} object The object to iterate over.
  30535. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30536. * @returns {Object} Returns `object`.
  30537. * @see _.forOwnRight
  30538. * @example
  30539. *
  30540. * function Foo() {
  30541. * this.a = 1;
  30542. * this.b = 2;
  30543. * }
  30544. *
  30545. * Foo.prototype.c = 3;
  30546. *
  30547. * _.forOwn(new Foo, function(value, key) {
  30548. * console.log(key);
  30549. * });
  30550. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30551. */
  30552. function forOwn(object, iteratee) {
  30553. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30554. }
  30555. /**
  30556. * This method is like `_.forOwn` except that it iterates over properties of
  30557. * `object` in the opposite order.
  30558. *
  30559. * @static
  30560. * @memberOf _
  30561. * @since 2.0.0
  30562. * @category Object
  30563. * @param {Object} object The object to iterate over.
  30564. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30565. * @returns {Object} Returns `object`.
  30566. * @see _.forOwn
  30567. * @example
  30568. *
  30569. * function Foo() {
  30570. * this.a = 1;
  30571. * this.b = 2;
  30572. * }
  30573. *
  30574. * Foo.prototype.c = 3;
  30575. *
  30576. * _.forOwnRight(new Foo, function(value, key) {
  30577. * console.log(key);
  30578. * });
  30579. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30580. */
  30581. function forOwnRight(object, iteratee) {
  30582. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30583. }
  30584. /**
  30585. * Creates an array of function property names from own enumerable properties
  30586. * of `object`.
  30587. *
  30588. * @static
  30589. * @since 0.1.0
  30590. * @memberOf _
  30591. * @category Object
  30592. * @param {Object} object The object to inspect.
  30593. * @returns {Array} Returns the function names.
  30594. * @see _.functionsIn
  30595. * @example
  30596. *
  30597. * function Foo() {
  30598. * this.a = _.constant('a');
  30599. * this.b = _.constant('b');
  30600. * }
  30601. *
  30602. * Foo.prototype.c = _.constant('c');
  30603. *
  30604. * _.functions(new Foo);
  30605. * // => ['a', 'b']
  30606. */
  30607. function functions(object) {
  30608. return object == null ? [] : baseFunctions(object, keys(object));
  30609. }
  30610. /**
  30611. * Creates an array of function property names from own and inherited
  30612. * enumerable properties of `object`.
  30613. *
  30614. * @static
  30615. * @memberOf _
  30616. * @since 4.0.0
  30617. * @category Object
  30618. * @param {Object} object The object to inspect.
  30619. * @returns {Array} Returns the function names.
  30620. * @see _.functions
  30621. * @example
  30622. *
  30623. * function Foo() {
  30624. * this.a = _.constant('a');
  30625. * this.b = _.constant('b');
  30626. * }
  30627. *
  30628. * Foo.prototype.c = _.constant('c');
  30629. *
  30630. * _.functionsIn(new Foo);
  30631. * // => ['a', 'b', 'c']
  30632. */
  30633. function functionsIn(object) {
  30634. return object == null ? [] : baseFunctions(object, keysIn(object));
  30635. }
  30636. /**
  30637. * Gets the value at `path` of `object`. If the resolved value is
  30638. * `undefined`, the `defaultValue` is returned in its place.
  30639. *
  30640. * @static
  30641. * @memberOf _
  30642. * @since 3.7.0
  30643. * @category Object
  30644. * @param {Object} object The object to query.
  30645. * @param {Array|string} path The path of the property to get.
  30646. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30647. * @returns {*} Returns the resolved value.
  30648. * @example
  30649. *
  30650. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30651. *
  30652. * _.get(object, 'a[0].b.c');
  30653. * // => 3
  30654. *
  30655. * _.get(object, ['a', '0', 'b', 'c']);
  30656. * // => 3
  30657. *
  30658. * _.get(object, 'a.b.c', 'default');
  30659. * // => 'default'
  30660. */
  30661. function get(object, path, defaultValue) {
  30662. var result = object == null ? undefined : baseGet(object, path);
  30663. return result === undefined ? defaultValue : result;
  30664. }
  30665. /**
  30666. * Checks if `path` is a direct property of `object`.
  30667. *
  30668. * @static
  30669. * @since 0.1.0
  30670. * @memberOf _
  30671. * @category Object
  30672. * @param {Object} object The object to query.
  30673. * @param {Array|string} path The path to check.
  30674. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30675. * @example
  30676. *
  30677. * var object = { 'a': { 'b': 2 } };
  30678. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30679. *
  30680. * _.has(object, 'a');
  30681. * // => true
  30682. *
  30683. * _.has(object, 'a.b');
  30684. * // => true
  30685. *
  30686. * _.has(object, ['a', 'b']);
  30687. * // => true
  30688. *
  30689. * _.has(other, 'a');
  30690. * // => false
  30691. */
  30692. function has(object, path) {
  30693. return object != null && hasPath(object, path, baseHas);
  30694. }
  30695. /**
  30696. * Checks if `path` is a direct or inherited property of `object`.
  30697. *
  30698. * @static
  30699. * @memberOf _
  30700. * @since 4.0.0
  30701. * @category Object
  30702. * @param {Object} object The object to query.
  30703. * @param {Array|string} path The path to check.
  30704. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30705. * @example
  30706. *
  30707. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30708. *
  30709. * _.hasIn(object, 'a');
  30710. * // => true
  30711. *
  30712. * _.hasIn(object, 'a.b');
  30713. * // => true
  30714. *
  30715. * _.hasIn(object, ['a', 'b']);
  30716. * // => true
  30717. *
  30718. * _.hasIn(object, 'b');
  30719. * // => false
  30720. */
  30721. function hasIn(object, path) {
  30722. return object != null && hasPath(object, path, baseHasIn);
  30723. }
  30724. /**
  30725. * Creates an object composed of the inverted keys and values of `object`.
  30726. * If `object` contains duplicate values, subsequent values overwrite
  30727. * property assignments of previous values.
  30728. *
  30729. * @static
  30730. * @memberOf _
  30731. * @since 0.7.0
  30732. * @category Object
  30733. * @param {Object} object The object to invert.
  30734. * @returns {Object} Returns the new inverted object.
  30735. * @example
  30736. *
  30737. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30738. *
  30739. * _.invert(object);
  30740. * // => { '1': 'c', '2': 'b' }
  30741. */
  30742. var invert = createInverter(function(result, value, key) {
  30743. if (value != null &&
  30744. typeof value.toString != 'function') {
  30745. value = nativeObjectToString.call(value);
  30746. }
  30747. result[value] = key;
  30748. }, constant(identity));
  30749. /**
  30750. * This method is like `_.invert` except that the inverted object is generated
  30751. * from the results of running each element of `object` thru `iteratee`. The
  30752. * corresponding inverted value of each inverted key is an array of keys
  30753. * responsible for generating the inverted value. The iteratee is invoked
  30754. * with one argument: (value).
  30755. *
  30756. * @static
  30757. * @memberOf _
  30758. * @since 4.1.0
  30759. * @category Object
  30760. * @param {Object} object The object to invert.
  30761. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30762. * @returns {Object} Returns the new inverted object.
  30763. * @example
  30764. *
  30765. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30766. *
  30767. * _.invertBy(object);
  30768. * // => { '1': ['a', 'c'], '2': ['b'] }
  30769. *
  30770. * _.invertBy(object, function(value) {
  30771. * return 'group' + value;
  30772. * });
  30773. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30774. */
  30775. var invertBy = createInverter(function(result, value, key) {
  30776. if (value != null &&
  30777. typeof value.toString != 'function') {
  30778. value = nativeObjectToString.call(value);
  30779. }
  30780. if (hasOwnProperty.call(result, value)) {
  30781. result[value].push(key);
  30782. } else {
  30783. result[value] = [key];
  30784. }
  30785. }, getIteratee);
  30786. /**
  30787. * Invokes the method at `path` of `object`.
  30788. *
  30789. * @static
  30790. * @memberOf _
  30791. * @since 4.0.0
  30792. * @category Object
  30793. * @param {Object} object The object to query.
  30794. * @param {Array|string} path The path of the method to invoke.
  30795. * @param {...*} [args] The arguments to invoke the method with.
  30796. * @returns {*} Returns the result of the invoked method.
  30797. * @example
  30798. *
  30799. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30800. *
  30801. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30802. * // => [2, 3]
  30803. */
  30804. var invoke = baseRest(baseInvoke);
  30805. /**
  30806. * Creates an array of the own enumerable property names of `object`.
  30807. *
  30808. * **Note:** Non-object values are coerced to objects. See the
  30809. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30810. * for more details.
  30811. *
  30812. * @static
  30813. * @since 0.1.0
  30814. * @memberOf _
  30815. * @category Object
  30816. * @param {Object} object The object to query.
  30817. * @returns {Array} Returns the array of property names.
  30818. * @example
  30819. *
  30820. * function Foo() {
  30821. * this.a = 1;
  30822. * this.b = 2;
  30823. * }
  30824. *
  30825. * Foo.prototype.c = 3;
  30826. *
  30827. * _.keys(new Foo);
  30828. * // => ['a', 'b'] (iteration order is not guaranteed)
  30829. *
  30830. * _.keys('hi');
  30831. * // => ['0', '1']
  30832. */
  30833. function keys(object) {
  30834. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30835. }
  30836. /**
  30837. * Creates an array of the own and inherited enumerable property names of `object`.
  30838. *
  30839. * **Note:** Non-object values are coerced to objects.
  30840. *
  30841. * @static
  30842. * @memberOf _
  30843. * @since 3.0.0
  30844. * @category Object
  30845. * @param {Object} object The object to query.
  30846. * @returns {Array} Returns the array of property names.
  30847. * @example
  30848. *
  30849. * function Foo() {
  30850. * this.a = 1;
  30851. * this.b = 2;
  30852. * }
  30853. *
  30854. * Foo.prototype.c = 3;
  30855. *
  30856. * _.keysIn(new Foo);
  30857. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30858. */
  30859. function keysIn(object) {
  30860. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30861. }
  30862. /**
  30863. * The opposite of `_.mapValues`; this method creates an object with the
  30864. * same values as `object` and keys generated by running each own enumerable
  30865. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30866. * with three arguments: (value, key, object).
  30867. *
  30868. * @static
  30869. * @memberOf _
  30870. * @since 3.8.0
  30871. * @category Object
  30872. * @param {Object} object The object to iterate over.
  30873. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30874. * @returns {Object} Returns the new mapped object.
  30875. * @see _.mapValues
  30876. * @example
  30877. *
  30878. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30879. * return key + value;
  30880. * });
  30881. * // => { 'a1': 1, 'b2': 2 }
  30882. */
  30883. function mapKeys(object, iteratee) {
  30884. var result = {};
  30885. iteratee = getIteratee(iteratee, 3);
  30886. baseForOwn(object, function(value, key, object) {
  30887. baseAssignValue(result, iteratee(value, key, object), value);
  30888. });
  30889. return result;
  30890. }
  30891. /**
  30892. * Creates an object with the same keys as `object` and values generated
  30893. * by running each own enumerable string keyed property of `object` thru
  30894. * `iteratee`. The iteratee is invoked with three arguments:
  30895. * (value, key, object).
  30896. *
  30897. * @static
  30898. * @memberOf _
  30899. * @since 2.4.0
  30900. * @category Object
  30901. * @param {Object} object The object to iterate over.
  30902. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30903. * @returns {Object} Returns the new mapped object.
  30904. * @see _.mapKeys
  30905. * @example
  30906. *
  30907. * var users = {
  30908. * 'fred': { 'user': 'fred', 'age': 40 },
  30909. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30910. * };
  30911. *
  30912. * _.mapValues(users, function(o) { return o.age; });
  30913. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30914. *
  30915. * // The `_.property` iteratee shorthand.
  30916. * _.mapValues(users, 'age');
  30917. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30918. */
  30919. function mapValues(object, iteratee) {
  30920. var result = {};
  30921. iteratee = getIteratee(iteratee, 3);
  30922. baseForOwn(object, function(value, key, object) {
  30923. baseAssignValue(result, key, iteratee(value, key, object));
  30924. });
  30925. return result;
  30926. }
  30927. /**
  30928. * This method is like `_.assign` except that it recursively merges own and
  30929. * inherited enumerable string keyed properties of source objects into the
  30930. * destination object. Source properties that resolve to `undefined` are
  30931. * skipped if a destination value exists. Array and plain object properties
  30932. * are merged recursively. Other objects and value types are overridden by
  30933. * assignment. Source objects are applied from left to right. Subsequent
  30934. * sources overwrite property assignments of previous sources.
  30935. *
  30936. * **Note:** This method mutates `object`.
  30937. *
  30938. * @static
  30939. * @memberOf _
  30940. * @since 0.5.0
  30941. * @category Object
  30942. * @param {Object} object The destination object.
  30943. * @param {...Object} [sources] The source objects.
  30944. * @returns {Object} Returns `object`.
  30945. * @example
  30946. *
  30947. * var object = {
  30948. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30949. * };
  30950. *
  30951. * var other = {
  30952. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30953. * };
  30954. *
  30955. * _.merge(object, other);
  30956. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30957. */
  30958. var merge = createAssigner(function(object, source, srcIndex) {
  30959. baseMerge(object, source, srcIndex);
  30960. });
  30961. /**
  30962. * This method is like `_.merge` except that it accepts `customizer` which
  30963. * is invoked to produce the merged values of the destination and source
  30964. * properties. If `customizer` returns `undefined`, merging is handled by the
  30965. * method instead. The `customizer` is invoked with six arguments:
  30966. * (objValue, srcValue, key, object, source, stack).
  30967. *
  30968. * **Note:** This method mutates `object`.
  30969. *
  30970. * @static
  30971. * @memberOf _
  30972. * @since 4.0.0
  30973. * @category Object
  30974. * @param {Object} object The destination object.
  30975. * @param {...Object} sources The source objects.
  30976. * @param {Function} customizer The function to customize assigned values.
  30977. * @returns {Object} Returns `object`.
  30978. * @example
  30979. *
  30980. * function customizer(objValue, srcValue) {
  30981. * if (_.isArray(objValue)) {
  30982. * return objValue.concat(srcValue);
  30983. * }
  30984. * }
  30985. *
  30986. * var object = { 'a': [1], 'b': [2] };
  30987. * var other = { 'a': [3], 'b': [4] };
  30988. *
  30989. * _.mergeWith(object, other, customizer);
  30990. * // => { 'a': [1, 3], 'b': [2, 4] }
  30991. */
  30992. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30993. baseMerge(object, source, srcIndex, customizer);
  30994. });
  30995. /**
  30996. * The opposite of `_.pick`; this method creates an object composed of the
  30997. * own and inherited enumerable property paths of `object` that are not omitted.
  30998. *
  30999. * **Note:** This method is considerably slower than `_.pick`.
  31000. *
  31001. * @static
  31002. * @since 0.1.0
  31003. * @memberOf _
  31004. * @category Object
  31005. * @param {Object} object The source object.
  31006. * @param {...(string|string[])} [paths] The property paths to omit.
  31007. * @returns {Object} Returns the new object.
  31008. * @example
  31009. *
  31010. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31011. *
  31012. * _.omit(object, ['a', 'c']);
  31013. * // => { 'b': '2' }
  31014. */
  31015. var omit = flatRest(function(object, paths) {
  31016. var result = {};
  31017. if (object == null) {
  31018. return result;
  31019. }
  31020. var isDeep = false;
  31021. paths = arrayMap(paths, function(path) {
  31022. path = castPath(path, object);
  31023. isDeep || (isDeep = path.length > 1);
  31024. return path;
  31025. });
  31026. copyObject(object, getAllKeysIn(object), result);
  31027. if (isDeep) {
  31028. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31029. }
  31030. var length = paths.length;
  31031. while (length--) {
  31032. baseUnset(result, paths[length]);
  31033. }
  31034. return result;
  31035. });
  31036. /**
  31037. * The opposite of `_.pickBy`; this method creates an object composed of
  31038. * the own and inherited enumerable string keyed properties of `object` that
  31039. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31040. * arguments: (value, key).
  31041. *
  31042. * @static
  31043. * @memberOf _
  31044. * @since 4.0.0
  31045. * @category Object
  31046. * @param {Object} object The source object.
  31047. * @param {Function} [predicate=_.identity] The function invoked per property.
  31048. * @returns {Object} Returns the new object.
  31049. * @example
  31050. *
  31051. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31052. *
  31053. * _.omitBy(object, _.isNumber);
  31054. * // => { 'b': '2' }
  31055. */
  31056. function omitBy(object, predicate) {
  31057. return pickBy(object, negate(getIteratee(predicate)));
  31058. }
  31059. /**
  31060. * Creates an object composed of the picked `object` properties.
  31061. *
  31062. * @static
  31063. * @since 0.1.0
  31064. * @memberOf _
  31065. * @category Object
  31066. * @param {Object} object The source object.
  31067. * @param {...(string|string[])} [paths] The property paths to pick.
  31068. * @returns {Object} Returns the new object.
  31069. * @example
  31070. *
  31071. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31072. *
  31073. * _.pick(object, ['a', 'c']);
  31074. * // => { 'a': 1, 'c': 3 }
  31075. */
  31076. var pick = flatRest(function(object, paths) {
  31077. return object == null ? {} : basePick(object, paths);
  31078. });
  31079. /**
  31080. * Creates an object composed of the `object` properties `predicate` returns
  31081. * truthy for. The predicate is invoked with two arguments: (value, key).
  31082. *
  31083. * @static
  31084. * @memberOf _
  31085. * @since 4.0.0
  31086. * @category Object
  31087. * @param {Object} object The source object.
  31088. * @param {Function} [predicate=_.identity] The function invoked per property.
  31089. * @returns {Object} Returns the new object.
  31090. * @example
  31091. *
  31092. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31093. *
  31094. * _.pickBy(object, _.isNumber);
  31095. * // => { 'a': 1, 'c': 3 }
  31096. */
  31097. function pickBy(object, predicate) {
  31098. if (object == null) {
  31099. return {};
  31100. }
  31101. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31102. return [prop];
  31103. });
  31104. predicate = getIteratee(predicate);
  31105. return basePickBy(object, props, function(value, path) {
  31106. return predicate(value, path[0]);
  31107. });
  31108. }
  31109. /**
  31110. * This method is like `_.get` except that if the resolved value is a
  31111. * function it's invoked with the `this` binding of its parent object and
  31112. * its result is returned.
  31113. *
  31114. * @static
  31115. * @since 0.1.0
  31116. * @memberOf _
  31117. * @category Object
  31118. * @param {Object} object The object to query.
  31119. * @param {Array|string} path The path of the property to resolve.
  31120. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31121. * @returns {*} Returns the resolved value.
  31122. * @example
  31123. *
  31124. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31125. *
  31126. * _.result(object, 'a[0].b.c1');
  31127. * // => 3
  31128. *
  31129. * _.result(object, 'a[0].b.c2');
  31130. * // => 4
  31131. *
  31132. * _.result(object, 'a[0].b.c3', 'default');
  31133. * // => 'default'
  31134. *
  31135. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31136. * // => 'default'
  31137. */
  31138. function result(object, path, defaultValue) {
  31139. path = castPath(path, object);
  31140. var index = -1,
  31141. length = path.length;
  31142. // Ensure the loop is entered when path is empty.
  31143. if (!length) {
  31144. length = 1;
  31145. object = undefined;
  31146. }
  31147. while (++index < length) {
  31148. var value = object == null ? undefined : object[toKey(path[index])];
  31149. if (value === undefined) {
  31150. index = length;
  31151. value = defaultValue;
  31152. }
  31153. object = isFunction(value) ? value.call(object) : value;
  31154. }
  31155. return object;
  31156. }
  31157. /**
  31158. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31159. * it's created. Arrays are created for missing index properties while objects
  31160. * are created for all other missing properties. Use `_.setWith` to customize
  31161. * `path` creation.
  31162. *
  31163. * **Note:** This method mutates `object`.
  31164. *
  31165. * @static
  31166. * @memberOf _
  31167. * @since 3.7.0
  31168. * @category Object
  31169. * @param {Object} object The object to modify.
  31170. * @param {Array|string} path The path of the property to set.
  31171. * @param {*} value The value to set.
  31172. * @returns {Object} Returns `object`.
  31173. * @example
  31174. *
  31175. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31176. *
  31177. * _.set(object, 'a[0].b.c', 4);
  31178. * console.log(object.a[0].b.c);
  31179. * // => 4
  31180. *
  31181. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31182. * console.log(object.x[0].y.z);
  31183. * // => 5
  31184. */
  31185. function set(object, path, value) {
  31186. return object == null ? object : baseSet(object, path, value);
  31187. }
  31188. /**
  31189. * This method is like `_.set` except that it accepts `customizer` which is
  31190. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31191. * path creation is handled by the method instead. The `customizer` is invoked
  31192. * with three arguments: (nsValue, key, nsObject).
  31193. *
  31194. * **Note:** This method mutates `object`.
  31195. *
  31196. * @static
  31197. * @memberOf _
  31198. * @since 4.0.0
  31199. * @category Object
  31200. * @param {Object} object The object to modify.
  31201. * @param {Array|string} path The path of the property to set.
  31202. * @param {*} value The value to set.
  31203. * @param {Function} [customizer] The function to customize assigned values.
  31204. * @returns {Object} Returns `object`.
  31205. * @example
  31206. *
  31207. * var object = {};
  31208. *
  31209. * _.setWith(object, '[0][1]', 'a', Object);
  31210. * // => { '0': { '1': 'a' } }
  31211. */
  31212. function setWith(object, path, value, customizer) {
  31213. customizer = typeof customizer == 'function' ? customizer : undefined;
  31214. return object == null ? object : baseSet(object, path, value, customizer);
  31215. }
  31216. /**
  31217. * Creates an array of own enumerable string keyed-value pairs for `object`
  31218. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31219. * entries are returned.
  31220. *
  31221. * @static
  31222. * @memberOf _
  31223. * @since 4.0.0
  31224. * @alias entries
  31225. * @category Object
  31226. * @param {Object} object The object to query.
  31227. * @returns {Array} Returns the key-value pairs.
  31228. * @example
  31229. *
  31230. * function Foo() {
  31231. * this.a = 1;
  31232. * this.b = 2;
  31233. * }
  31234. *
  31235. * Foo.prototype.c = 3;
  31236. *
  31237. * _.toPairs(new Foo);
  31238. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31239. */
  31240. var toPairs = createToPairs(keys);
  31241. /**
  31242. * Creates an array of own and inherited enumerable string keyed-value pairs
  31243. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31244. * or set, its entries are returned.
  31245. *
  31246. * @static
  31247. * @memberOf _
  31248. * @since 4.0.0
  31249. * @alias entriesIn
  31250. * @category Object
  31251. * @param {Object} object The object to query.
  31252. * @returns {Array} Returns the key-value pairs.
  31253. * @example
  31254. *
  31255. * function Foo() {
  31256. * this.a = 1;
  31257. * this.b = 2;
  31258. * }
  31259. *
  31260. * Foo.prototype.c = 3;
  31261. *
  31262. * _.toPairsIn(new Foo);
  31263. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31264. */
  31265. var toPairsIn = createToPairs(keysIn);
  31266. /**
  31267. * An alternative to `_.reduce`; this method transforms `object` to a new
  31268. * `accumulator` object which is the result of running each of its own
  31269. * enumerable string keyed properties thru `iteratee`, with each invocation
  31270. * potentially mutating the `accumulator` object. If `accumulator` is not
  31271. * provided, a new object with the same `[[Prototype]]` will be used. The
  31272. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31273. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31274. *
  31275. * @static
  31276. * @memberOf _
  31277. * @since 1.3.0
  31278. * @category Object
  31279. * @param {Object} object The object to iterate over.
  31280. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31281. * @param {*} [accumulator] The custom accumulator value.
  31282. * @returns {*} Returns the accumulated value.
  31283. * @example
  31284. *
  31285. * _.transform([2, 3, 4], function(result, n) {
  31286. * result.push(n *= n);
  31287. * return n % 2 == 0;
  31288. * }, []);
  31289. * // => [4, 9]
  31290. *
  31291. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31292. * (result[value] || (result[value] = [])).push(key);
  31293. * }, {});
  31294. * // => { '1': ['a', 'c'], '2': ['b'] }
  31295. */
  31296. function transform(object, iteratee, accumulator) {
  31297. var isArr = isArray(object),
  31298. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31299. iteratee = getIteratee(iteratee, 4);
  31300. if (accumulator == null) {
  31301. var Ctor = object && object.constructor;
  31302. if (isArrLike) {
  31303. accumulator = isArr ? new Ctor : [];
  31304. }
  31305. else if (isObject(object)) {
  31306. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31307. }
  31308. else {
  31309. accumulator = {};
  31310. }
  31311. }
  31312. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31313. return iteratee(accumulator, value, index, object);
  31314. });
  31315. return accumulator;
  31316. }
  31317. /**
  31318. * Removes the property at `path` of `object`.
  31319. *
  31320. * **Note:** This method mutates `object`.
  31321. *
  31322. * @static
  31323. * @memberOf _
  31324. * @since 4.0.0
  31325. * @category Object
  31326. * @param {Object} object The object to modify.
  31327. * @param {Array|string} path The path of the property to unset.
  31328. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31329. * @example
  31330. *
  31331. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31332. * _.unset(object, 'a[0].b.c');
  31333. * // => true
  31334. *
  31335. * console.log(object);
  31336. * // => { 'a': [{ 'b': {} }] };
  31337. *
  31338. * _.unset(object, ['a', '0', 'b', 'c']);
  31339. * // => true
  31340. *
  31341. * console.log(object);
  31342. * // => { 'a': [{ 'b': {} }] };
  31343. */
  31344. function unset(object, path) {
  31345. return object == null ? true : baseUnset(object, path);
  31346. }
  31347. /**
  31348. * This method is like `_.set` except that accepts `updater` to produce the
  31349. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31350. * is invoked with one argument: (value).
  31351. *
  31352. * **Note:** This method mutates `object`.
  31353. *
  31354. * @static
  31355. * @memberOf _
  31356. * @since 4.6.0
  31357. * @category Object
  31358. * @param {Object} object The object to modify.
  31359. * @param {Array|string} path The path of the property to set.
  31360. * @param {Function} updater The function to produce the updated value.
  31361. * @returns {Object} Returns `object`.
  31362. * @example
  31363. *
  31364. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31365. *
  31366. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31367. * console.log(object.a[0].b.c);
  31368. * // => 9
  31369. *
  31370. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31371. * console.log(object.x[0].y.z);
  31372. * // => 0
  31373. */
  31374. function update(object, path, updater) {
  31375. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31376. }
  31377. /**
  31378. * This method is like `_.update` except that it accepts `customizer` which is
  31379. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31380. * path creation is handled by the method instead. The `customizer` is invoked
  31381. * with three arguments: (nsValue, key, nsObject).
  31382. *
  31383. * **Note:** This method mutates `object`.
  31384. *
  31385. * @static
  31386. * @memberOf _
  31387. * @since 4.6.0
  31388. * @category Object
  31389. * @param {Object} object The object to modify.
  31390. * @param {Array|string} path The path of the property to set.
  31391. * @param {Function} updater The function to produce the updated value.
  31392. * @param {Function} [customizer] The function to customize assigned values.
  31393. * @returns {Object} Returns `object`.
  31394. * @example
  31395. *
  31396. * var object = {};
  31397. *
  31398. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31399. * // => { '0': { '1': 'a' } }
  31400. */
  31401. function updateWith(object, path, updater, customizer) {
  31402. customizer = typeof customizer == 'function' ? customizer : undefined;
  31403. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31404. }
  31405. /**
  31406. * Creates an array of the own enumerable string keyed property values of `object`.
  31407. *
  31408. * **Note:** Non-object values are coerced to objects.
  31409. *
  31410. * @static
  31411. * @since 0.1.0
  31412. * @memberOf _
  31413. * @category Object
  31414. * @param {Object} object The object to query.
  31415. * @returns {Array} Returns the array of property values.
  31416. * @example
  31417. *
  31418. * function Foo() {
  31419. * this.a = 1;
  31420. * this.b = 2;
  31421. * }
  31422. *
  31423. * Foo.prototype.c = 3;
  31424. *
  31425. * _.values(new Foo);
  31426. * // => [1, 2] (iteration order is not guaranteed)
  31427. *
  31428. * _.values('hi');
  31429. * // => ['h', 'i']
  31430. */
  31431. function values(object) {
  31432. return object == null ? [] : baseValues(object, keys(object));
  31433. }
  31434. /**
  31435. * Creates an array of the own and inherited enumerable string keyed property
  31436. * values of `object`.
  31437. *
  31438. * **Note:** Non-object values are coerced to objects.
  31439. *
  31440. * @static
  31441. * @memberOf _
  31442. * @since 3.0.0
  31443. * @category Object
  31444. * @param {Object} object The object to query.
  31445. * @returns {Array} Returns the array of property values.
  31446. * @example
  31447. *
  31448. * function Foo() {
  31449. * this.a = 1;
  31450. * this.b = 2;
  31451. * }
  31452. *
  31453. * Foo.prototype.c = 3;
  31454. *
  31455. * _.valuesIn(new Foo);
  31456. * // => [1, 2, 3] (iteration order is not guaranteed)
  31457. */
  31458. function valuesIn(object) {
  31459. return object == null ? [] : baseValues(object, keysIn(object));
  31460. }
  31461. /*------------------------------------------------------------------------*/
  31462. /**
  31463. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31464. *
  31465. * @static
  31466. * @memberOf _
  31467. * @since 4.0.0
  31468. * @category Number
  31469. * @param {number} number The number to clamp.
  31470. * @param {number} [lower] The lower bound.
  31471. * @param {number} upper The upper bound.
  31472. * @returns {number} Returns the clamped number.
  31473. * @example
  31474. *
  31475. * _.clamp(-10, -5, 5);
  31476. * // => -5
  31477. *
  31478. * _.clamp(10, -5, 5);
  31479. * // => 5
  31480. */
  31481. function clamp(number, lower, upper) {
  31482. if (upper === undefined) {
  31483. upper = lower;
  31484. lower = undefined;
  31485. }
  31486. if (upper !== undefined) {
  31487. upper = toNumber(upper);
  31488. upper = upper === upper ? upper : 0;
  31489. }
  31490. if (lower !== undefined) {
  31491. lower = toNumber(lower);
  31492. lower = lower === lower ? lower : 0;
  31493. }
  31494. return baseClamp(toNumber(number), lower, upper);
  31495. }
  31496. /**
  31497. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31498. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31499. * If `start` is greater than `end` the params are swapped to support
  31500. * negative ranges.
  31501. *
  31502. * @static
  31503. * @memberOf _
  31504. * @since 3.3.0
  31505. * @category Number
  31506. * @param {number} number The number to check.
  31507. * @param {number} [start=0] The start of the range.
  31508. * @param {number} end The end of the range.
  31509. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31510. * @see _.range, _.rangeRight
  31511. * @example
  31512. *
  31513. * _.inRange(3, 2, 4);
  31514. * // => true
  31515. *
  31516. * _.inRange(4, 8);
  31517. * // => true
  31518. *
  31519. * _.inRange(4, 2);
  31520. * // => false
  31521. *
  31522. * _.inRange(2, 2);
  31523. * // => false
  31524. *
  31525. * _.inRange(1.2, 2);
  31526. * // => true
  31527. *
  31528. * _.inRange(5.2, 4);
  31529. * // => false
  31530. *
  31531. * _.inRange(-3, -2, -6);
  31532. * // => true
  31533. */
  31534. function inRange(number, start, end) {
  31535. start = toFinite(start);
  31536. if (end === undefined) {
  31537. end = start;
  31538. start = 0;
  31539. } else {
  31540. end = toFinite(end);
  31541. }
  31542. number = toNumber(number);
  31543. return baseInRange(number, start, end);
  31544. }
  31545. /**
  31546. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31547. * If only one argument is provided a number between `0` and the given number
  31548. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31549. * floats, a floating-point number is returned instead of an integer.
  31550. *
  31551. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31552. * floating-point values which can produce unexpected results.
  31553. *
  31554. * @static
  31555. * @memberOf _
  31556. * @since 0.7.0
  31557. * @category Number
  31558. * @param {number} [lower=0] The lower bound.
  31559. * @param {number} [upper=1] The upper bound.
  31560. * @param {boolean} [floating] Specify returning a floating-point number.
  31561. * @returns {number} Returns the random number.
  31562. * @example
  31563. *
  31564. * _.random(0, 5);
  31565. * // => an integer between 0 and 5
  31566. *
  31567. * _.random(5);
  31568. * // => also an integer between 0 and 5
  31569. *
  31570. * _.random(5, true);
  31571. * // => a floating-point number between 0 and 5
  31572. *
  31573. * _.random(1.2, 5.2);
  31574. * // => a floating-point number between 1.2 and 5.2
  31575. */
  31576. function random(lower, upper, floating) {
  31577. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31578. upper = floating = undefined;
  31579. }
  31580. if (floating === undefined) {
  31581. if (typeof upper == 'boolean') {
  31582. floating = upper;
  31583. upper = undefined;
  31584. }
  31585. else if (typeof lower == 'boolean') {
  31586. floating = lower;
  31587. lower = undefined;
  31588. }
  31589. }
  31590. if (lower === undefined && upper === undefined) {
  31591. lower = 0;
  31592. upper = 1;
  31593. }
  31594. else {
  31595. lower = toFinite(lower);
  31596. if (upper === undefined) {
  31597. upper = lower;
  31598. lower = 0;
  31599. } else {
  31600. upper = toFinite(upper);
  31601. }
  31602. }
  31603. if (lower > upper) {
  31604. var temp = lower;
  31605. lower = upper;
  31606. upper = temp;
  31607. }
  31608. if (floating || lower % 1 || upper % 1) {
  31609. var rand = nativeRandom();
  31610. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31611. }
  31612. return baseRandom(lower, upper);
  31613. }
  31614. /*------------------------------------------------------------------------*/
  31615. /**
  31616. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31617. *
  31618. * @static
  31619. * @memberOf _
  31620. * @since 3.0.0
  31621. * @category String
  31622. * @param {string} [string=''] The string to convert.
  31623. * @returns {string} Returns the camel cased string.
  31624. * @example
  31625. *
  31626. * _.camelCase('Foo Bar');
  31627. * // => 'fooBar'
  31628. *
  31629. * _.camelCase('--foo-bar--');
  31630. * // => 'fooBar'
  31631. *
  31632. * _.camelCase('__FOO_BAR__');
  31633. * // => 'fooBar'
  31634. */
  31635. var camelCase = createCompounder(function(result, word, index) {
  31636. word = word.toLowerCase();
  31637. return result + (index ? capitalize(word) : word);
  31638. });
  31639. /**
  31640. * Converts the first character of `string` to upper case and the remaining
  31641. * to lower case.
  31642. *
  31643. * @static
  31644. * @memberOf _
  31645. * @since 3.0.0
  31646. * @category String
  31647. * @param {string} [string=''] The string to capitalize.
  31648. * @returns {string} Returns the capitalized string.
  31649. * @example
  31650. *
  31651. * _.capitalize('FRED');
  31652. * // => 'Fred'
  31653. */
  31654. function capitalize(string) {
  31655. return upperFirst(toString(string).toLowerCase());
  31656. }
  31657. /**
  31658. * Deburrs `string` by converting
  31659. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31660. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31661. * letters to basic Latin letters and removing
  31662. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31663. *
  31664. * @static
  31665. * @memberOf _
  31666. * @since 3.0.0
  31667. * @category String
  31668. * @param {string} [string=''] The string to deburr.
  31669. * @returns {string} Returns the deburred string.
  31670. * @example
  31671. *
  31672. * _.deburr('déjà vu');
  31673. * // => 'deja vu'
  31674. */
  31675. function deburr(string) {
  31676. string = toString(string);
  31677. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31678. }
  31679. /**
  31680. * Checks if `string` ends with the given target string.
  31681. *
  31682. * @static
  31683. * @memberOf _
  31684. * @since 3.0.0
  31685. * @category String
  31686. * @param {string} [string=''] The string to inspect.
  31687. * @param {string} [target] The string to search for.
  31688. * @param {number} [position=string.length] The position to search up to.
  31689. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31690. * else `false`.
  31691. * @example
  31692. *
  31693. * _.endsWith('abc', 'c');
  31694. * // => true
  31695. *
  31696. * _.endsWith('abc', 'b');
  31697. * // => false
  31698. *
  31699. * _.endsWith('abc', 'b', 2);
  31700. * // => true
  31701. */
  31702. function endsWith(string, target, position) {
  31703. string = toString(string);
  31704. target = baseToString(target);
  31705. var length = string.length;
  31706. position = position === undefined
  31707. ? length
  31708. : baseClamp(toInteger(position), 0, length);
  31709. var end = position;
  31710. position -= target.length;
  31711. return position >= 0 && string.slice(position, end) == target;
  31712. }
  31713. /**
  31714. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31715. * corresponding HTML entities.
  31716. *
  31717. * **Note:** No other characters are escaped. To escape additional
  31718. * characters use a third-party library like [_he_](https://mths.be/he).
  31719. *
  31720. * Though the ">" character is escaped for symmetry, characters like
  31721. * ">" and "/" don't need escaping in HTML and have no special meaning
  31722. * unless they're part of a tag or unquoted attribute value. See
  31723. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31724. * (under "semi-related fun fact") for more details.
  31725. *
  31726. * When working with HTML you should always
  31727. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31728. * XSS vectors.
  31729. *
  31730. * @static
  31731. * @since 0.1.0
  31732. * @memberOf _
  31733. * @category String
  31734. * @param {string} [string=''] The string to escape.
  31735. * @returns {string} Returns the escaped string.
  31736. * @example
  31737. *
  31738. * _.escape('fred, barney, & pebbles');
  31739. * // => 'fred, barney, &amp; pebbles'
  31740. */
  31741. function escape(string) {
  31742. string = toString(string);
  31743. return (string && reHasUnescapedHtml.test(string))
  31744. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31745. : string;
  31746. }
  31747. /**
  31748. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31749. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31750. *
  31751. * @static
  31752. * @memberOf _
  31753. * @since 3.0.0
  31754. * @category String
  31755. * @param {string} [string=''] The string to escape.
  31756. * @returns {string} Returns the escaped string.
  31757. * @example
  31758. *
  31759. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31760. * // => '\[lodash\]\(https://lodash\.com/\)'
  31761. */
  31762. function escapeRegExp(string) {
  31763. string = toString(string);
  31764. return (string && reHasRegExpChar.test(string))
  31765. ? string.replace(reRegExpChar, '\\$&')
  31766. : string;
  31767. }
  31768. /**
  31769. * Converts `string` to
  31770. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31771. *
  31772. * @static
  31773. * @memberOf _
  31774. * @since 3.0.0
  31775. * @category String
  31776. * @param {string} [string=''] The string to convert.
  31777. * @returns {string} Returns the kebab cased string.
  31778. * @example
  31779. *
  31780. * _.kebabCase('Foo Bar');
  31781. * // => 'foo-bar'
  31782. *
  31783. * _.kebabCase('fooBar');
  31784. * // => 'foo-bar'
  31785. *
  31786. * _.kebabCase('__FOO_BAR__');
  31787. * // => 'foo-bar'
  31788. */
  31789. var kebabCase = createCompounder(function(result, word, index) {
  31790. return result + (index ? '-' : '') + word.toLowerCase();
  31791. });
  31792. /**
  31793. * Converts `string`, as space separated words, to lower case.
  31794. *
  31795. * @static
  31796. * @memberOf _
  31797. * @since 4.0.0
  31798. * @category String
  31799. * @param {string} [string=''] The string to convert.
  31800. * @returns {string} Returns the lower cased string.
  31801. * @example
  31802. *
  31803. * _.lowerCase('--Foo-Bar--');
  31804. * // => 'foo bar'
  31805. *
  31806. * _.lowerCase('fooBar');
  31807. * // => 'foo bar'
  31808. *
  31809. * _.lowerCase('__FOO_BAR__');
  31810. * // => 'foo bar'
  31811. */
  31812. var lowerCase = createCompounder(function(result, word, index) {
  31813. return result + (index ? ' ' : '') + word.toLowerCase();
  31814. });
  31815. /**
  31816. * Converts the first character of `string` to lower case.
  31817. *
  31818. * @static
  31819. * @memberOf _
  31820. * @since 4.0.0
  31821. * @category String
  31822. * @param {string} [string=''] The string to convert.
  31823. * @returns {string} Returns the converted string.
  31824. * @example
  31825. *
  31826. * _.lowerFirst('Fred');
  31827. * // => 'fred'
  31828. *
  31829. * _.lowerFirst('FRED');
  31830. * // => 'fRED'
  31831. */
  31832. var lowerFirst = createCaseFirst('toLowerCase');
  31833. /**
  31834. * Pads `string` on the left and right sides if it's shorter than `length`.
  31835. * Padding characters are truncated if they can't be evenly divided by `length`.
  31836. *
  31837. * @static
  31838. * @memberOf _
  31839. * @since 3.0.0
  31840. * @category String
  31841. * @param {string} [string=''] The string to pad.
  31842. * @param {number} [length=0] The padding length.
  31843. * @param {string} [chars=' '] The string used as padding.
  31844. * @returns {string} Returns the padded string.
  31845. * @example
  31846. *
  31847. * _.pad('abc', 8);
  31848. * // => ' abc '
  31849. *
  31850. * _.pad('abc', 8, '_-');
  31851. * // => '_-abc_-_'
  31852. *
  31853. * _.pad('abc', 3);
  31854. * // => 'abc'
  31855. */
  31856. function pad(string, length, chars) {
  31857. string = toString(string);
  31858. length = toInteger(length);
  31859. var strLength = length ? stringSize(string) : 0;
  31860. if (!length || strLength >= length) {
  31861. return string;
  31862. }
  31863. var mid = (length - strLength) / 2;
  31864. return (
  31865. createPadding(nativeFloor(mid), chars) +
  31866. string +
  31867. createPadding(nativeCeil(mid), chars)
  31868. );
  31869. }
  31870. /**
  31871. * Pads `string` on the right side if it's shorter than `length`. Padding
  31872. * characters are truncated if they exceed `length`.
  31873. *
  31874. * @static
  31875. * @memberOf _
  31876. * @since 4.0.0
  31877. * @category String
  31878. * @param {string} [string=''] The string to pad.
  31879. * @param {number} [length=0] The padding length.
  31880. * @param {string} [chars=' '] The string used as padding.
  31881. * @returns {string} Returns the padded string.
  31882. * @example
  31883. *
  31884. * _.padEnd('abc', 6);
  31885. * // => 'abc '
  31886. *
  31887. * _.padEnd('abc', 6, '_-');
  31888. * // => 'abc_-_'
  31889. *
  31890. * _.padEnd('abc', 3);
  31891. * // => 'abc'
  31892. */
  31893. function padEnd(string, length, chars) {
  31894. string = toString(string);
  31895. length = toInteger(length);
  31896. var strLength = length ? stringSize(string) : 0;
  31897. return (length && strLength < length)
  31898. ? (string + createPadding(length - strLength, chars))
  31899. : string;
  31900. }
  31901. /**
  31902. * Pads `string` on the left side if it's shorter than `length`. Padding
  31903. * characters are truncated if they exceed `length`.
  31904. *
  31905. * @static
  31906. * @memberOf _
  31907. * @since 4.0.0
  31908. * @category String
  31909. * @param {string} [string=''] The string to pad.
  31910. * @param {number} [length=0] The padding length.
  31911. * @param {string} [chars=' '] The string used as padding.
  31912. * @returns {string} Returns the padded string.
  31913. * @example
  31914. *
  31915. * _.padStart('abc', 6);
  31916. * // => ' abc'
  31917. *
  31918. * _.padStart('abc', 6, '_-');
  31919. * // => '_-_abc'
  31920. *
  31921. * _.padStart('abc', 3);
  31922. * // => 'abc'
  31923. */
  31924. function padStart(string, length, chars) {
  31925. string = toString(string);
  31926. length = toInteger(length);
  31927. var strLength = length ? stringSize(string) : 0;
  31928. return (length && strLength < length)
  31929. ? (createPadding(length - strLength, chars) + string)
  31930. : string;
  31931. }
  31932. /**
  31933. * Converts `string` to an integer of the specified radix. If `radix` is
  31934. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31935. * hexadecimal, in which case a `radix` of `16` is used.
  31936. *
  31937. * **Note:** This method aligns with the
  31938. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31939. *
  31940. * @static
  31941. * @memberOf _
  31942. * @since 1.1.0
  31943. * @category String
  31944. * @param {string} string The string to convert.
  31945. * @param {number} [radix=10] The radix to interpret `value` by.
  31946. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31947. * @returns {number} Returns the converted integer.
  31948. * @example
  31949. *
  31950. * _.parseInt('08');
  31951. * // => 8
  31952. *
  31953. * _.map(['6', '08', '10'], _.parseInt);
  31954. * // => [6, 8, 10]
  31955. */
  31956. function parseInt(string, radix, guard) {
  31957. if (guard || radix == null) {
  31958. radix = 0;
  31959. } else if (radix) {
  31960. radix = +radix;
  31961. }
  31962. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31963. }
  31964. /**
  31965. * Repeats the given string `n` times.
  31966. *
  31967. * @static
  31968. * @memberOf _
  31969. * @since 3.0.0
  31970. * @category String
  31971. * @param {string} [string=''] The string to repeat.
  31972. * @param {number} [n=1] The number of times to repeat the string.
  31973. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31974. * @returns {string} Returns the repeated string.
  31975. * @example
  31976. *
  31977. * _.repeat('*', 3);
  31978. * // => '***'
  31979. *
  31980. * _.repeat('abc', 2);
  31981. * // => 'abcabc'
  31982. *
  31983. * _.repeat('abc', 0);
  31984. * // => ''
  31985. */
  31986. function repeat(string, n, guard) {
  31987. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31988. n = 1;
  31989. } else {
  31990. n = toInteger(n);
  31991. }
  31992. return baseRepeat(toString(string), n);
  31993. }
  31994. /**
  31995. * Replaces matches for `pattern` in `string` with `replacement`.
  31996. *
  31997. * **Note:** This method is based on
  31998. * [`String#replace`](https://mdn.io/String/replace).
  31999. *
  32000. * @static
  32001. * @memberOf _
  32002. * @since 4.0.0
  32003. * @category String
  32004. * @param {string} [string=''] The string to modify.
  32005. * @param {RegExp|string} pattern The pattern to replace.
  32006. * @param {Function|string} replacement The match replacement.
  32007. * @returns {string} Returns the modified string.
  32008. * @example
  32009. *
  32010. * _.replace('Hi Fred', 'Fred', 'Barney');
  32011. * // => 'Hi Barney'
  32012. */
  32013. function replace() {
  32014. var args = arguments,
  32015. string = toString(args[0]);
  32016. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32017. }
  32018. /**
  32019. * Converts `string` to
  32020. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32021. *
  32022. * @static
  32023. * @memberOf _
  32024. * @since 3.0.0
  32025. * @category String
  32026. * @param {string} [string=''] The string to convert.
  32027. * @returns {string} Returns the snake cased string.
  32028. * @example
  32029. *
  32030. * _.snakeCase('Foo Bar');
  32031. * // => 'foo_bar'
  32032. *
  32033. * _.snakeCase('fooBar');
  32034. * // => 'foo_bar'
  32035. *
  32036. * _.snakeCase('--FOO-BAR--');
  32037. * // => 'foo_bar'
  32038. */
  32039. var snakeCase = createCompounder(function(result, word, index) {
  32040. return result + (index ? '_' : '') + word.toLowerCase();
  32041. });
  32042. /**
  32043. * Splits `string` by `separator`.
  32044. *
  32045. * **Note:** This method is based on
  32046. * [`String#split`](https://mdn.io/String/split).
  32047. *
  32048. * @static
  32049. * @memberOf _
  32050. * @since 4.0.0
  32051. * @category String
  32052. * @param {string} [string=''] The string to split.
  32053. * @param {RegExp|string} separator The separator pattern to split by.
  32054. * @param {number} [limit] The length to truncate results to.
  32055. * @returns {Array} Returns the string segments.
  32056. * @example
  32057. *
  32058. * _.split('a-b-c', '-', 2);
  32059. * // => ['a', 'b']
  32060. */
  32061. function split(string, separator, limit) {
  32062. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32063. separator = limit = undefined;
  32064. }
  32065. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32066. if (!limit) {
  32067. return [];
  32068. }
  32069. string = toString(string);
  32070. if (string && (
  32071. typeof separator == 'string' ||
  32072. (separator != null && !isRegExp(separator))
  32073. )) {
  32074. separator = baseToString(separator);
  32075. if (!separator && hasUnicode(string)) {
  32076. return castSlice(stringToArray(string), 0, limit);
  32077. }
  32078. }
  32079. return string.split(separator, limit);
  32080. }
  32081. /**
  32082. * Converts `string` to
  32083. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32084. *
  32085. * @static
  32086. * @memberOf _
  32087. * @since 3.1.0
  32088. * @category String
  32089. * @param {string} [string=''] The string to convert.
  32090. * @returns {string} Returns the start cased string.
  32091. * @example
  32092. *
  32093. * _.startCase('--foo-bar--');
  32094. * // => 'Foo Bar'
  32095. *
  32096. * _.startCase('fooBar');
  32097. * // => 'Foo Bar'
  32098. *
  32099. * _.startCase('__FOO_BAR__');
  32100. * // => 'FOO BAR'
  32101. */
  32102. var startCase = createCompounder(function(result, word, index) {
  32103. return result + (index ? ' ' : '') + upperFirst(word);
  32104. });
  32105. /**
  32106. * Checks if `string` starts with the given target string.
  32107. *
  32108. * @static
  32109. * @memberOf _
  32110. * @since 3.0.0
  32111. * @category String
  32112. * @param {string} [string=''] The string to inspect.
  32113. * @param {string} [target] The string to search for.
  32114. * @param {number} [position=0] The position to search from.
  32115. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32116. * else `false`.
  32117. * @example
  32118. *
  32119. * _.startsWith('abc', 'a');
  32120. * // => true
  32121. *
  32122. * _.startsWith('abc', 'b');
  32123. * // => false
  32124. *
  32125. * _.startsWith('abc', 'b', 1);
  32126. * // => true
  32127. */
  32128. function startsWith(string, target, position) {
  32129. string = toString(string);
  32130. position = position == null
  32131. ? 0
  32132. : baseClamp(toInteger(position), 0, string.length);
  32133. target = baseToString(target);
  32134. return string.slice(position, position + target.length) == target;
  32135. }
  32136. /**
  32137. * Creates a compiled template function that can interpolate data properties
  32138. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32139. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32140. * properties may be accessed as free variables in the template. If a setting
  32141. * object is given, it takes precedence over `_.templateSettings` values.
  32142. *
  32143. * **Note:** In the development build `_.template` utilizes
  32144. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32145. * for easier debugging.
  32146. *
  32147. * For more information on precompiling templates see
  32148. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32149. *
  32150. * For more information on Chrome extension sandboxes see
  32151. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32152. *
  32153. * @static
  32154. * @since 0.1.0
  32155. * @memberOf _
  32156. * @category String
  32157. * @param {string} [string=''] The template string.
  32158. * @param {Object} [options={}] The options object.
  32159. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32160. * The HTML "escape" delimiter.
  32161. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32162. * The "evaluate" delimiter.
  32163. * @param {Object} [options.imports=_.templateSettings.imports]
  32164. * An object to import into the template as free variables.
  32165. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32166. * The "interpolate" delimiter.
  32167. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32168. * The sourceURL of the compiled template.
  32169. * @param {string} [options.variable='obj']
  32170. * The data object variable name.
  32171. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32172. * @returns {Function} Returns the compiled template function.
  32173. * @example
  32174. *
  32175. * // Use the "interpolate" delimiter to create a compiled template.
  32176. * var compiled = _.template('hello <%= user %>!');
  32177. * compiled({ 'user': 'fred' });
  32178. * // => 'hello fred!'
  32179. *
  32180. * // Use the HTML "escape" delimiter to escape data property values.
  32181. * var compiled = _.template('<b><%- value %></b>');
  32182. * compiled({ 'value': '<script>' });
  32183. * // => '<b>&lt;script&gt;</b>'
  32184. *
  32185. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32186. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32187. * compiled({ 'users': ['fred', 'barney'] });
  32188. * // => '<li>fred</li><li>barney</li>'
  32189. *
  32190. * // Use the internal `print` function in "evaluate" delimiters.
  32191. * var compiled = _.template('<% print("hello " + user); %>!');
  32192. * compiled({ 'user': 'barney' });
  32193. * // => 'hello barney!'
  32194. *
  32195. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32196. * // Disable support by replacing the "interpolate" delimiter.
  32197. * var compiled = _.template('hello ${ user }!');
  32198. * compiled({ 'user': 'pebbles' });
  32199. * // => 'hello pebbles!'
  32200. *
  32201. * // Use backslashes to treat delimiters as plain text.
  32202. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32203. * compiled({ 'value': 'ignored' });
  32204. * // => '<%- value %>'
  32205. *
  32206. * // Use the `imports` option to import `jQuery` as `jq`.
  32207. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32208. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32209. * compiled({ 'users': ['fred', 'barney'] });
  32210. * // => '<li>fred</li><li>barney</li>'
  32211. *
  32212. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32213. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32214. * compiled(data);
  32215. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32216. *
  32217. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32218. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32219. * compiled.source;
  32220. * // => function(data) {
  32221. * // var __t, __p = '';
  32222. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32223. * // return __p;
  32224. * // }
  32225. *
  32226. * // Use custom template delimiters.
  32227. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32228. * var compiled = _.template('hello {{ user }}!');
  32229. * compiled({ 'user': 'mustache' });
  32230. * // => 'hello mustache!'
  32231. *
  32232. * // Use the `source` property to inline compiled templates for meaningful
  32233. * // line numbers in error messages and stack traces.
  32234. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32235. * var JST = {\
  32236. * "main": ' + _.template(mainText).source + '\
  32237. * };\
  32238. * ');
  32239. */
  32240. function template(string, options, guard) {
  32241. // Based on John Resig's `tmpl` implementation
  32242. // (http://ejohn.org/blog/javascript-micro-templating/)
  32243. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32244. var settings = lodash.templateSettings;
  32245. if (guard && isIterateeCall(string, options, guard)) {
  32246. options = undefined;
  32247. }
  32248. string = toString(string);
  32249. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32250. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32251. importsKeys = keys(imports),
  32252. importsValues = baseValues(imports, importsKeys);
  32253. var isEscaping,
  32254. isEvaluating,
  32255. index = 0,
  32256. interpolate = options.interpolate || reNoMatch,
  32257. source = "__p += '";
  32258. // Compile the regexp to match each delimiter.
  32259. var reDelimiters = RegExp(
  32260. (options.escape || reNoMatch).source + '|' +
  32261. interpolate.source + '|' +
  32262. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32263. (options.evaluate || reNoMatch).source + '|$'
  32264. , 'g');
  32265. // Use a sourceURL for easier debugging.
  32266. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32267. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32268. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32269. var sourceURL = '//# sourceURL=' +
  32270. (hasOwnProperty.call(options, 'sourceURL')
  32271. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32272. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32273. ) + '\n';
  32274. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32275. interpolateValue || (interpolateValue = esTemplateValue);
  32276. // Escape characters that can't be included in string literals.
  32277. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32278. // Replace delimiters with snippets.
  32279. if (escapeValue) {
  32280. isEscaping = true;
  32281. source += "' +\n__e(" + escapeValue + ") +\n'";
  32282. }
  32283. if (evaluateValue) {
  32284. isEvaluating = true;
  32285. source += "';\n" + evaluateValue + ";\n__p += '";
  32286. }
  32287. if (interpolateValue) {
  32288. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32289. }
  32290. index = offset + match.length;
  32291. // The JS engine embedded in Adobe products needs `match` returned in
  32292. // order to produce the correct `offset` value.
  32293. return match;
  32294. });
  32295. source += "';\n";
  32296. // If `variable` is not specified wrap a with-statement around the generated
  32297. // code to add the data object to the top of the scope chain.
  32298. // Like with sourceURL, we take care to not check the option's prototype,
  32299. // as this configuration is a code injection vector.
  32300. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32301. if (!variable) {
  32302. source = 'with (obj) {\n' + source + '\n}\n';
  32303. }
  32304. // Cleanup code by stripping empty strings.
  32305. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32306. .replace(reEmptyStringMiddle, '$1')
  32307. .replace(reEmptyStringTrailing, '$1;');
  32308. // Frame code as the function body.
  32309. source = 'function(' + (variable || 'obj') + ') {\n' +
  32310. (variable
  32311. ? ''
  32312. : 'obj || (obj = {});\n'
  32313. ) +
  32314. "var __t, __p = ''" +
  32315. (isEscaping
  32316. ? ', __e = _.escape'
  32317. : ''
  32318. ) +
  32319. (isEvaluating
  32320. ? ', __j = Array.prototype.join;\n' +
  32321. "function print() { __p += __j.call(arguments, '') }\n"
  32322. : ';\n'
  32323. ) +
  32324. source +
  32325. 'return __p\n}';
  32326. var result = attempt(function() {
  32327. return Function(importsKeys, sourceURL + 'return ' + source)
  32328. .apply(undefined, importsValues);
  32329. });
  32330. // Provide the compiled function's source by its `toString` method or
  32331. // the `source` property as a convenience for inlining compiled templates.
  32332. result.source = source;
  32333. if (isError(result)) {
  32334. throw result;
  32335. }
  32336. return result;
  32337. }
  32338. /**
  32339. * Converts `string`, as a whole, to lower case just like
  32340. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32341. *
  32342. * @static
  32343. * @memberOf _
  32344. * @since 4.0.0
  32345. * @category String
  32346. * @param {string} [string=''] The string to convert.
  32347. * @returns {string} Returns the lower cased string.
  32348. * @example
  32349. *
  32350. * _.toLower('--Foo-Bar--');
  32351. * // => '--foo-bar--'
  32352. *
  32353. * _.toLower('fooBar');
  32354. * // => 'foobar'
  32355. *
  32356. * _.toLower('__FOO_BAR__');
  32357. * // => '__foo_bar__'
  32358. */
  32359. function toLower(value) {
  32360. return toString(value).toLowerCase();
  32361. }
  32362. /**
  32363. * Converts `string`, as a whole, to upper case just like
  32364. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32365. *
  32366. * @static
  32367. * @memberOf _
  32368. * @since 4.0.0
  32369. * @category String
  32370. * @param {string} [string=''] The string to convert.
  32371. * @returns {string} Returns the upper cased string.
  32372. * @example
  32373. *
  32374. * _.toUpper('--foo-bar--');
  32375. * // => '--FOO-BAR--'
  32376. *
  32377. * _.toUpper('fooBar');
  32378. * // => 'FOOBAR'
  32379. *
  32380. * _.toUpper('__foo_bar__');
  32381. * // => '__FOO_BAR__'
  32382. */
  32383. function toUpper(value) {
  32384. return toString(value).toUpperCase();
  32385. }
  32386. /**
  32387. * Removes leading and trailing whitespace or specified characters from `string`.
  32388. *
  32389. * @static
  32390. * @memberOf _
  32391. * @since 3.0.0
  32392. * @category String
  32393. * @param {string} [string=''] The string to trim.
  32394. * @param {string} [chars=whitespace] The characters to trim.
  32395. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32396. * @returns {string} Returns the trimmed string.
  32397. * @example
  32398. *
  32399. * _.trim(' abc ');
  32400. * // => 'abc'
  32401. *
  32402. * _.trim('-_-abc-_-', '_-');
  32403. * // => 'abc'
  32404. *
  32405. * _.map([' foo ', ' bar '], _.trim);
  32406. * // => ['foo', 'bar']
  32407. */
  32408. function trim(string, chars, guard) {
  32409. string = toString(string);
  32410. if (string && (guard || chars === undefined)) {
  32411. return string.replace(reTrim, '');
  32412. }
  32413. if (!string || !(chars = baseToString(chars))) {
  32414. return string;
  32415. }
  32416. var strSymbols = stringToArray(string),
  32417. chrSymbols = stringToArray(chars),
  32418. start = charsStartIndex(strSymbols, chrSymbols),
  32419. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32420. return castSlice(strSymbols, start, end).join('');
  32421. }
  32422. /**
  32423. * Removes trailing whitespace or specified characters from `string`.
  32424. *
  32425. * @static
  32426. * @memberOf _
  32427. * @since 4.0.0
  32428. * @category String
  32429. * @param {string} [string=''] The string to trim.
  32430. * @param {string} [chars=whitespace] The characters to trim.
  32431. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32432. * @returns {string} Returns the trimmed string.
  32433. * @example
  32434. *
  32435. * _.trimEnd(' abc ');
  32436. * // => ' abc'
  32437. *
  32438. * _.trimEnd('-_-abc-_-', '_-');
  32439. * // => '-_-abc'
  32440. */
  32441. function trimEnd(string, chars, guard) {
  32442. string = toString(string);
  32443. if (string && (guard || chars === undefined)) {
  32444. return string.replace(reTrimEnd, '');
  32445. }
  32446. if (!string || !(chars = baseToString(chars))) {
  32447. return string;
  32448. }
  32449. var strSymbols = stringToArray(string),
  32450. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32451. return castSlice(strSymbols, 0, end).join('');
  32452. }
  32453. /**
  32454. * Removes leading whitespace or specified characters from `string`.
  32455. *
  32456. * @static
  32457. * @memberOf _
  32458. * @since 4.0.0
  32459. * @category String
  32460. * @param {string} [string=''] The string to trim.
  32461. * @param {string} [chars=whitespace] The characters to trim.
  32462. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32463. * @returns {string} Returns the trimmed string.
  32464. * @example
  32465. *
  32466. * _.trimStart(' abc ');
  32467. * // => 'abc '
  32468. *
  32469. * _.trimStart('-_-abc-_-', '_-');
  32470. * // => 'abc-_-'
  32471. */
  32472. function trimStart(string, chars, guard) {
  32473. string = toString(string);
  32474. if (string && (guard || chars === undefined)) {
  32475. return string.replace(reTrimStart, '');
  32476. }
  32477. if (!string || !(chars = baseToString(chars))) {
  32478. return string;
  32479. }
  32480. var strSymbols = stringToArray(string),
  32481. start = charsStartIndex(strSymbols, stringToArray(chars));
  32482. return castSlice(strSymbols, start).join('');
  32483. }
  32484. /**
  32485. * Truncates `string` if it's longer than the given maximum string length.
  32486. * The last characters of the truncated string are replaced with the omission
  32487. * string which defaults to "...".
  32488. *
  32489. * @static
  32490. * @memberOf _
  32491. * @since 4.0.0
  32492. * @category String
  32493. * @param {string} [string=''] The string to truncate.
  32494. * @param {Object} [options={}] The options object.
  32495. * @param {number} [options.length=30] The maximum string length.
  32496. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32497. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32498. * @returns {string} Returns the truncated string.
  32499. * @example
  32500. *
  32501. * _.truncate('hi-diddly-ho there, neighborino');
  32502. * // => 'hi-diddly-ho there, neighbo...'
  32503. *
  32504. * _.truncate('hi-diddly-ho there, neighborino', {
  32505. * 'length': 24,
  32506. * 'separator': ' '
  32507. * });
  32508. * // => 'hi-diddly-ho there,...'
  32509. *
  32510. * _.truncate('hi-diddly-ho there, neighborino', {
  32511. * 'length': 24,
  32512. * 'separator': /,? +/
  32513. * });
  32514. * // => 'hi-diddly-ho there...'
  32515. *
  32516. * _.truncate('hi-diddly-ho there, neighborino', {
  32517. * 'omission': ' [...]'
  32518. * });
  32519. * // => 'hi-diddly-ho there, neig [...]'
  32520. */
  32521. function truncate(string, options) {
  32522. var length = DEFAULT_TRUNC_LENGTH,
  32523. omission = DEFAULT_TRUNC_OMISSION;
  32524. if (isObject(options)) {
  32525. var separator = 'separator' in options ? options.separator : separator;
  32526. length = 'length' in options ? toInteger(options.length) : length;
  32527. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32528. }
  32529. string = toString(string);
  32530. var strLength = string.length;
  32531. if (hasUnicode(string)) {
  32532. var strSymbols = stringToArray(string);
  32533. strLength = strSymbols.length;
  32534. }
  32535. if (length >= strLength) {
  32536. return string;
  32537. }
  32538. var end = length - stringSize(omission);
  32539. if (end < 1) {
  32540. return omission;
  32541. }
  32542. var result = strSymbols
  32543. ? castSlice(strSymbols, 0, end).join('')
  32544. : string.slice(0, end);
  32545. if (separator === undefined) {
  32546. return result + omission;
  32547. }
  32548. if (strSymbols) {
  32549. end += (result.length - end);
  32550. }
  32551. if (isRegExp(separator)) {
  32552. if (string.slice(end).search(separator)) {
  32553. var match,
  32554. substring = result;
  32555. if (!separator.global) {
  32556. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32557. }
  32558. separator.lastIndex = 0;
  32559. while ((match = separator.exec(substring))) {
  32560. var newEnd = match.index;
  32561. }
  32562. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32563. }
  32564. } else if (string.indexOf(baseToString(separator), end) != end) {
  32565. var index = result.lastIndexOf(separator);
  32566. if (index > -1) {
  32567. result = result.slice(0, index);
  32568. }
  32569. }
  32570. return result + omission;
  32571. }
  32572. /**
  32573. * The inverse of `_.escape`; this method converts the HTML entities
  32574. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32575. * their corresponding characters.
  32576. *
  32577. * **Note:** No other HTML entities are unescaped. To unescape additional
  32578. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32579. *
  32580. * @static
  32581. * @memberOf _
  32582. * @since 0.6.0
  32583. * @category String
  32584. * @param {string} [string=''] The string to unescape.
  32585. * @returns {string} Returns the unescaped string.
  32586. * @example
  32587. *
  32588. * _.unescape('fred, barney, &amp; pebbles');
  32589. * // => 'fred, barney, & pebbles'
  32590. */
  32591. function unescape(string) {
  32592. string = toString(string);
  32593. return (string && reHasEscapedHtml.test(string))
  32594. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32595. : string;
  32596. }
  32597. /**
  32598. * Converts `string`, as space separated words, to upper case.
  32599. *
  32600. * @static
  32601. * @memberOf _
  32602. * @since 4.0.0
  32603. * @category String
  32604. * @param {string} [string=''] The string to convert.
  32605. * @returns {string} Returns the upper cased string.
  32606. * @example
  32607. *
  32608. * _.upperCase('--foo-bar');
  32609. * // => 'FOO BAR'
  32610. *
  32611. * _.upperCase('fooBar');
  32612. * // => 'FOO BAR'
  32613. *
  32614. * _.upperCase('__foo_bar__');
  32615. * // => 'FOO BAR'
  32616. */
  32617. var upperCase = createCompounder(function(result, word, index) {
  32618. return result + (index ? ' ' : '') + word.toUpperCase();
  32619. });
  32620. /**
  32621. * Converts the first character of `string` to upper case.
  32622. *
  32623. * @static
  32624. * @memberOf _
  32625. * @since 4.0.0
  32626. * @category String
  32627. * @param {string} [string=''] The string to convert.
  32628. * @returns {string} Returns the converted string.
  32629. * @example
  32630. *
  32631. * _.upperFirst('fred');
  32632. * // => 'Fred'
  32633. *
  32634. * _.upperFirst('FRED');
  32635. * // => 'FRED'
  32636. */
  32637. var upperFirst = createCaseFirst('toUpperCase');
  32638. /**
  32639. * Splits `string` into an array of its words.
  32640. *
  32641. * @static
  32642. * @memberOf _
  32643. * @since 3.0.0
  32644. * @category String
  32645. * @param {string} [string=''] The string to inspect.
  32646. * @param {RegExp|string} [pattern] The pattern to match words.
  32647. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32648. * @returns {Array} Returns the words of `string`.
  32649. * @example
  32650. *
  32651. * _.words('fred, barney, & pebbles');
  32652. * // => ['fred', 'barney', 'pebbles']
  32653. *
  32654. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32655. * // => ['fred', 'barney', '&', 'pebbles']
  32656. */
  32657. function words(string, pattern, guard) {
  32658. string = toString(string);
  32659. pattern = guard ? undefined : pattern;
  32660. if (pattern === undefined) {
  32661. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32662. }
  32663. return string.match(pattern) || [];
  32664. }
  32665. /*------------------------------------------------------------------------*/
  32666. /**
  32667. * Attempts to invoke `func`, returning either the result or the caught error
  32668. * object. Any additional arguments are provided to `func` when it's invoked.
  32669. *
  32670. * @static
  32671. * @memberOf _
  32672. * @since 3.0.0
  32673. * @category Util
  32674. * @param {Function} func The function to attempt.
  32675. * @param {...*} [args] The arguments to invoke `func` with.
  32676. * @returns {*} Returns the `func` result or error object.
  32677. * @example
  32678. *
  32679. * // Avoid throwing errors for invalid selectors.
  32680. * var elements = _.attempt(function(selector) {
  32681. * return document.querySelectorAll(selector);
  32682. * }, '>_>');
  32683. *
  32684. * if (_.isError(elements)) {
  32685. * elements = [];
  32686. * }
  32687. */
  32688. var attempt = baseRest(function(func, args) {
  32689. try {
  32690. return apply(func, undefined, args);
  32691. } catch (e) {
  32692. return isError(e) ? e : new Error(e);
  32693. }
  32694. });
  32695. /**
  32696. * Binds methods of an object to the object itself, overwriting the existing
  32697. * method.
  32698. *
  32699. * **Note:** This method doesn't set the "length" property of bound functions.
  32700. *
  32701. * @static
  32702. * @since 0.1.0
  32703. * @memberOf _
  32704. * @category Util
  32705. * @param {Object} object The object to bind and assign the bound methods to.
  32706. * @param {...(string|string[])} methodNames The object method names to bind.
  32707. * @returns {Object} Returns `object`.
  32708. * @example
  32709. *
  32710. * var view = {
  32711. * 'label': 'docs',
  32712. * 'click': function() {
  32713. * console.log('clicked ' + this.label);
  32714. * }
  32715. * };
  32716. *
  32717. * _.bindAll(view, ['click']);
  32718. * jQuery(element).on('click', view.click);
  32719. * // => Logs 'clicked docs' when clicked.
  32720. */
  32721. var bindAll = flatRest(function(object, methodNames) {
  32722. arrayEach(methodNames, function(key) {
  32723. key = toKey(key);
  32724. baseAssignValue(object, key, bind(object[key], object));
  32725. });
  32726. return object;
  32727. });
  32728. /**
  32729. * Creates a function that iterates over `pairs` and invokes the corresponding
  32730. * function of the first predicate to return truthy. The predicate-function
  32731. * pairs are invoked with the `this` binding and arguments of the created
  32732. * function.
  32733. *
  32734. * @static
  32735. * @memberOf _
  32736. * @since 4.0.0
  32737. * @category Util
  32738. * @param {Array} pairs The predicate-function pairs.
  32739. * @returns {Function} Returns the new composite function.
  32740. * @example
  32741. *
  32742. * var func = _.cond([
  32743. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32744. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32745. * [_.stubTrue, _.constant('no match')]
  32746. * ]);
  32747. *
  32748. * func({ 'a': 1, 'b': 2 });
  32749. * // => 'matches A'
  32750. *
  32751. * func({ 'a': 0, 'b': 1 });
  32752. * // => 'matches B'
  32753. *
  32754. * func({ 'a': '1', 'b': '2' });
  32755. * // => 'no match'
  32756. */
  32757. function cond(pairs) {
  32758. var length = pairs == null ? 0 : pairs.length,
  32759. toIteratee = getIteratee();
  32760. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32761. if (typeof pair[1] != 'function') {
  32762. throw new TypeError(FUNC_ERROR_TEXT);
  32763. }
  32764. return [toIteratee(pair[0]), pair[1]];
  32765. });
  32766. return baseRest(function(args) {
  32767. var index = -1;
  32768. while (++index < length) {
  32769. var pair = pairs[index];
  32770. if (apply(pair[0], this, args)) {
  32771. return apply(pair[1], this, args);
  32772. }
  32773. }
  32774. });
  32775. }
  32776. /**
  32777. * Creates a function that invokes the predicate properties of `source` with
  32778. * the corresponding property values of a given object, returning `true` if
  32779. * all predicates return truthy, else `false`.
  32780. *
  32781. * **Note:** The created function is equivalent to `_.conformsTo` with
  32782. * `source` partially applied.
  32783. *
  32784. * @static
  32785. * @memberOf _
  32786. * @since 4.0.0
  32787. * @category Util
  32788. * @param {Object} source The object of property predicates to conform to.
  32789. * @returns {Function} Returns the new spec function.
  32790. * @example
  32791. *
  32792. * var objects = [
  32793. * { 'a': 2, 'b': 1 },
  32794. * { 'a': 1, 'b': 2 }
  32795. * ];
  32796. *
  32797. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32798. * // => [{ 'a': 1, 'b': 2 }]
  32799. */
  32800. function conforms(source) {
  32801. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32802. }
  32803. /**
  32804. * Creates a function that returns `value`.
  32805. *
  32806. * @static
  32807. * @memberOf _
  32808. * @since 2.4.0
  32809. * @category Util
  32810. * @param {*} value The value to return from the new function.
  32811. * @returns {Function} Returns the new constant function.
  32812. * @example
  32813. *
  32814. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32815. *
  32816. * console.log(objects);
  32817. * // => [{ 'a': 1 }, { 'a': 1 }]
  32818. *
  32819. * console.log(objects[0] === objects[1]);
  32820. * // => true
  32821. */
  32822. function constant(value) {
  32823. return function() {
  32824. return value;
  32825. };
  32826. }
  32827. /**
  32828. * Checks `value` to determine whether a default value should be returned in
  32829. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32830. * or `undefined`.
  32831. *
  32832. * @static
  32833. * @memberOf _
  32834. * @since 4.14.0
  32835. * @category Util
  32836. * @param {*} value The value to check.
  32837. * @param {*} defaultValue The default value.
  32838. * @returns {*} Returns the resolved value.
  32839. * @example
  32840. *
  32841. * _.defaultTo(1, 10);
  32842. * // => 1
  32843. *
  32844. * _.defaultTo(undefined, 10);
  32845. * // => 10
  32846. */
  32847. function defaultTo(value, defaultValue) {
  32848. return (value == null || value !== value) ? defaultValue : value;
  32849. }
  32850. /**
  32851. * Creates a function that returns the result of invoking the given functions
  32852. * with the `this` binding of the created function, where each successive
  32853. * invocation is supplied the return value of the previous.
  32854. *
  32855. * @static
  32856. * @memberOf _
  32857. * @since 3.0.0
  32858. * @category Util
  32859. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32860. * @returns {Function} Returns the new composite function.
  32861. * @see _.flowRight
  32862. * @example
  32863. *
  32864. * function square(n) {
  32865. * return n * n;
  32866. * }
  32867. *
  32868. * var addSquare = _.flow([_.add, square]);
  32869. * addSquare(1, 2);
  32870. * // => 9
  32871. */
  32872. var flow = createFlow();
  32873. /**
  32874. * This method is like `_.flow` except that it creates a function that
  32875. * invokes the given functions from right to left.
  32876. *
  32877. * @static
  32878. * @since 3.0.0
  32879. * @memberOf _
  32880. * @category Util
  32881. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32882. * @returns {Function} Returns the new composite function.
  32883. * @see _.flow
  32884. * @example
  32885. *
  32886. * function square(n) {
  32887. * return n * n;
  32888. * }
  32889. *
  32890. * var addSquare = _.flowRight([square, _.add]);
  32891. * addSquare(1, 2);
  32892. * // => 9
  32893. */
  32894. var flowRight = createFlow(true);
  32895. /**
  32896. * This method returns the first argument it receives.
  32897. *
  32898. * @static
  32899. * @since 0.1.0
  32900. * @memberOf _
  32901. * @category Util
  32902. * @param {*} value Any value.
  32903. * @returns {*} Returns `value`.
  32904. * @example
  32905. *
  32906. * var object = { 'a': 1 };
  32907. *
  32908. * console.log(_.identity(object) === object);
  32909. * // => true
  32910. */
  32911. function identity(value) {
  32912. return value;
  32913. }
  32914. /**
  32915. * Creates a function that invokes `func` with the arguments of the created
  32916. * function. If `func` is a property name, the created function returns the
  32917. * property value for a given element. If `func` is an array or object, the
  32918. * created function returns `true` for elements that contain the equivalent
  32919. * source properties, otherwise it returns `false`.
  32920. *
  32921. * @static
  32922. * @since 4.0.0
  32923. * @memberOf _
  32924. * @category Util
  32925. * @param {*} [func=_.identity] The value to convert to a callback.
  32926. * @returns {Function} Returns the callback.
  32927. * @example
  32928. *
  32929. * var users = [
  32930. * { 'user': 'barney', 'age': 36, 'active': true },
  32931. * { 'user': 'fred', 'age': 40, 'active': false }
  32932. * ];
  32933. *
  32934. * // The `_.matches` iteratee shorthand.
  32935. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32936. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32937. *
  32938. * // The `_.matchesProperty` iteratee shorthand.
  32939. * _.filter(users, _.iteratee(['user', 'fred']));
  32940. * // => [{ 'user': 'fred', 'age': 40 }]
  32941. *
  32942. * // The `_.property` iteratee shorthand.
  32943. * _.map(users, _.iteratee('user'));
  32944. * // => ['barney', 'fred']
  32945. *
  32946. * // Create custom iteratee shorthands.
  32947. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32948. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32949. * return func.test(string);
  32950. * };
  32951. * });
  32952. *
  32953. * _.filter(['abc', 'def'], /ef/);
  32954. * // => ['def']
  32955. */
  32956. function iteratee(func) {
  32957. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32958. }
  32959. /**
  32960. * Creates a function that performs a partial deep comparison between a given
  32961. * object and `source`, returning `true` if the given object has equivalent
  32962. * property values, else `false`.
  32963. *
  32964. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32965. * partially applied.
  32966. *
  32967. * Partial comparisons will match empty array and empty object `source`
  32968. * values against any array or object value, respectively. See `_.isEqual`
  32969. * for a list of supported value comparisons.
  32970. *
  32971. * @static
  32972. * @memberOf _
  32973. * @since 3.0.0
  32974. * @category Util
  32975. * @param {Object} source The object of property values to match.
  32976. * @returns {Function} Returns the new spec function.
  32977. * @example
  32978. *
  32979. * var objects = [
  32980. * { 'a': 1, 'b': 2, 'c': 3 },
  32981. * { 'a': 4, 'b': 5, 'c': 6 }
  32982. * ];
  32983. *
  32984. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32985. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32986. */
  32987. function matches(source) {
  32988. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32989. }
  32990. /**
  32991. * Creates a function that performs a partial deep comparison between the
  32992. * value at `path` of a given object to `srcValue`, returning `true` if the
  32993. * object value is equivalent, else `false`.
  32994. *
  32995. * **Note:** Partial comparisons will match empty array and empty object
  32996. * `srcValue` values against any array or object value, respectively. See
  32997. * `_.isEqual` for a list of supported value comparisons.
  32998. *
  32999. * @static
  33000. * @memberOf _
  33001. * @since 3.2.0
  33002. * @category Util
  33003. * @param {Array|string} path The path of the property to get.
  33004. * @param {*} srcValue The value to match.
  33005. * @returns {Function} Returns the new spec function.
  33006. * @example
  33007. *
  33008. * var objects = [
  33009. * { 'a': 1, 'b': 2, 'c': 3 },
  33010. * { 'a': 4, 'b': 5, 'c': 6 }
  33011. * ];
  33012. *
  33013. * _.find(objects, _.matchesProperty('a', 4));
  33014. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33015. */
  33016. function matchesProperty(path, srcValue) {
  33017. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33018. }
  33019. /**
  33020. * Creates a function that invokes the method at `path` of a given object.
  33021. * Any additional arguments are provided to the invoked method.
  33022. *
  33023. * @static
  33024. * @memberOf _
  33025. * @since 3.7.0
  33026. * @category Util
  33027. * @param {Array|string} path The path of the method to invoke.
  33028. * @param {...*} [args] The arguments to invoke the method with.
  33029. * @returns {Function} Returns the new invoker function.
  33030. * @example
  33031. *
  33032. * var objects = [
  33033. * { 'a': { 'b': _.constant(2) } },
  33034. * { 'a': { 'b': _.constant(1) } }
  33035. * ];
  33036. *
  33037. * _.map(objects, _.method('a.b'));
  33038. * // => [2, 1]
  33039. *
  33040. * _.map(objects, _.method(['a', 'b']));
  33041. * // => [2, 1]
  33042. */
  33043. var method = baseRest(function(path, args) {
  33044. return function(object) {
  33045. return baseInvoke(object, path, args);
  33046. };
  33047. });
  33048. /**
  33049. * The opposite of `_.method`; this method creates a function that invokes
  33050. * the method at a given path of `object`. Any additional arguments are
  33051. * provided to the invoked method.
  33052. *
  33053. * @static
  33054. * @memberOf _
  33055. * @since 3.7.0
  33056. * @category Util
  33057. * @param {Object} object The object to query.
  33058. * @param {...*} [args] The arguments to invoke the method with.
  33059. * @returns {Function} Returns the new invoker function.
  33060. * @example
  33061. *
  33062. * var array = _.times(3, _.constant),
  33063. * object = { 'a': array, 'b': array, 'c': array };
  33064. *
  33065. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33066. * // => [2, 0]
  33067. *
  33068. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33069. * // => [2, 0]
  33070. */
  33071. var methodOf = baseRest(function(object, args) {
  33072. return function(path) {
  33073. return baseInvoke(object, path, args);
  33074. };
  33075. });
  33076. /**
  33077. * Adds all own enumerable string keyed function properties of a source
  33078. * object to the destination object. If `object` is a function, then methods
  33079. * are added to its prototype as well.
  33080. *
  33081. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33082. * avoid conflicts caused by modifying the original.
  33083. *
  33084. * @static
  33085. * @since 0.1.0
  33086. * @memberOf _
  33087. * @category Util
  33088. * @param {Function|Object} [object=lodash] The destination object.
  33089. * @param {Object} source The object of functions to add.
  33090. * @param {Object} [options={}] The options object.
  33091. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33092. * @returns {Function|Object} Returns `object`.
  33093. * @example
  33094. *
  33095. * function vowels(string) {
  33096. * return _.filter(string, function(v) {
  33097. * return /[aeiou]/i.test(v);
  33098. * });
  33099. * }
  33100. *
  33101. * _.mixin({ 'vowels': vowels });
  33102. * _.vowels('fred');
  33103. * // => ['e']
  33104. *
  33105. * _('fred').vowels().value();
  33106. * // => ['e']
  33107. *
  33108. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33109. * _('fred').vowels();
  33110. * // => ['e']
  33111. */
  33112. function mixin(object, source, options) {
  33113. var props = keys(source),
  33114. methodNames = baseFunctions(source, props);
  33115. if (options == null &&
  33116. !(isObject(source) && (methodNames.length || !props.length))) {
  33117. options = source;
  33118. source = object;
  33119. object = this;
  33120. methodNames = baseFunctions(source, keys(source));
  33121. }
  33122. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33123. isFunc = isFunction(object);
  33124. arrayEach(methodNames, function(methodName) {
  33125. var func = source[methodName];
  33126. object[methodName] = func;
  33127. if (isFunc) {
  33128. object.prototype[methodName] = function() {
  33129. var chainAll = this.__chain__;
  33130. if (chain || chainAll) {
  33131. var result = object(this.__wrapped__),
  33132. actions = result.__actions__ = copyArray(this.__actions__);
  33133. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33134. result.__chain__ = chainAll;
  33135. return result;
  33136. }
  33137. return func.apply(object, arrayPush([this.value()], arguments));
  33138. };
  33139. }
  33140. });
  33141. return object;
  33142. }
  33143. /**
  33144. * Reverts the `_` variable to its previous value and returns a reference to
  33145. * the `lodash` function.
  33146. *
  33147. * @static
  33148. * @since 0.1.0
  33149. * @memberOf _
  33150. * @category Util
  33151. * @returns {Function} Returns the `lodash` function.
  33152. * @example
  33153. *
  33154. * var lodash = _.noConflict();
  33155. */
  33156. function noConflict() {
  33157. if (root._ === this) {
  33158. root._ = oldDash;
  33159. }
  33160. return this;
  33161. }
  33162. /**
  33163. * This method returns `undefined`.
  33164. *
  33165. * @static
  33166. * @memberOf _
  33167. * @since 2.3.0
  33168. * @category Util
  33169. * @example
  33170. *
  33171. * _.times(2, _.noop);
  33172. * // => [undefined, undefined]
  33173. */
  33174. function noop() {
  33175. // No operation performed.
  33176. }
  33177. /**
  33178. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33179. * the nth argument from the end is returned.
  33180. *
  33181. * @static
  33182. * @memberOf _
  33183. * @since 4.0.0
  33184. * @category Util
  33185. * @param {number} [n=0] The index of the argument to return.
  33186. * @returns {Function} Returns the new pass-thru function.
  33187. * @example
  33188. *
  33189. * var func = _.nthArg(1);
  33190. * func('a', 'b', 'c', 'd');
  33191. * // => 'b'
  33192. *
  33193. * var func = _.nthArg(-2);
  33194. * func('a', 'b', 'c', 'd');
  33195. * // => 'c'
  33196. */
  33197. function nthArg(n) {
  33198. n = toInteger(n);
  33199. return baseRest(function(args) {
  33200. return baseNth(args, n);
  33201. });
  33202. }
  33203. /**
  33204. * Creates a function that invokes `iteratees` with the arguments it receives
  33205. * and returns their results.
  33206. *
  33207. * @static
  33208. * @memberOf _
  33209. * @since 4.0.0
  33210. * @category Util
  33211. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33212. * The iteratees to invoke.
  33213. * @returns {Function} Returns the new function.
  33214. * @example
  33215. *
  33216. * var func = _.over([Math.max, Math.min]);
  33217. *
  33218. * func(1, 2, 3, 4);
  33219. * // => [4, 1]
  33220. */
  33221. var over = createOver(arrayMap);
  33222. /**
  33223. * Creates a function that checks if **all** of the `predicates` return
  33224. * truthy when invoked with the arguments it receives.
  33225. *
  33226. * @static
  33227. * @memberOf _
  33228. * @since 4.0.0
  33229. * @category Util
  33230. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33231. * The predicates to check.
  33232. * @returns {Function} Returns the new function.
  33233. * @example
  33234. *
  33235. * var func = _.overEvery([Boolean, isFinite]);
  33236. *
  33237. * func('1');
  33238. * // => true
  33239. *
  33240. * func(null);
  33241. * // => false
  33242. *
  33243. * func(NaN);
  33244. * // => false
  33245. */
  33246. var overEvery = createOver(arrayEvery);
  33247. /**
  33248. * Creates a function that checks if **any** of the `predicates` return
  33249. * truthy when invoked with the arguments it receives.
  33250. *
  33251. * @static
  33252. * @memberOf _
  33253. * @since 4.0.0
  33254. * @category Util
  33255. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33256. * The predicates to check.
  33257. * @returns {Function} Returns the new function.
  33258. * @example
  33259. *
  33260. * var func = _.overSome([Boolean, isFinite]);
  33261. *
  33262. * func('1');
  33263. * // => true
  33264. *
  33265. * func(null);
  33266. * // => true
  33267. *
  33268. * func(NaN);
  33269. * // => false
  33270. */
  33271. var overSome = createOver(arraySome);
  33272. /**
  33273. * Creates a function that returns the value at `path` of a given object.
  33274. *
  33275. * @static
  33276. * @memberOf _
  33277. * @since 2.4.0
  33278. * @category Util
  33279. * @param {Array|string} path The path of the property to get.
  33280. * @returns {Function} Returns the new accessor function.
  33281. * @example
  33282. *
  33283. * var objects = [
  33284. * { 'a': { 'b': 2 } },
  33285. * { 'a': { 'b': 1 } }
  33286. * ];
  33287. *
  33288. * _.map(objects, _.property('a.b'));
  33289. * // => [2, 1]
  33290. *
  33291. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33292. * // => [1, 2]
  33293. */
  33294. function property(path) {
  33295. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33296. }
  33297. /**
  33298. * The opposite of `_.property`; this method creates a function that returns
  33299. * the value at a given path of `object`.
  33300. *
  33301. * @static
  33302. * @memberOf _
  33303. * @since 3.0.0
  33304. * @category Util
  33305. * @param {Object} object The object to query.
  33306. * @returns {Function} Returns the new accessor function.
  33307. * @example
  33308. *
  33309. * var array = [0, 1, 2],
  33310. * object = { 'a': array, 'b': array, 'c': array };
  33311. *
  33312. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33313. * // => [2, 0]
  33314. *
  33315. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33316. * // => [2, 0]
  33317. */
  33318. function propertyOf(object) {
  33319. return function(path) {
  33320. return object == null ? undefined : baseGet(object, path);
  33321. };
  33322. }
  33323. /**
  33324. * Creates an array of numbers (positive and/or negative) progressing from
  33325. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33326. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33327. * it's set to `start` with `start` then set to `0`.
  33328. *
  33329. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33330. * floating-point values which can produce unexpected results.
  33331. *
  33332. * @static
  33333. * @since 0.1.0
  33334. * @memberOf _
  33335. * @category Util
  33336. * @param {number} [start=0] The start of the range.
  33337. * @param {number} end The end of the range.
  33338. * @param {number} [step=1] The value to increment or decrement by.
  33339. * @returns {Array} Returns the range of numbers.
  33340. * @see _.inRange, _.rangeRight
  33341. * @example
  33342. *
  33343. * _.range(4);
  33344. * // => [0, 1, 2, 3]
  33345. *
  33346. * _.range(-4);
  33347. * // => [0, -1, -2, -3]
  33348. *
  33349. * _.range(1, 5);
  33350. * // => [1, 2, 3, 4]
  33351. *
  33352. * _.range(0, 20, 5);
  33353. * // => [0, 5, 10, 15]
  33354. *
  33355. * _.range(0, -4, -1);
  33356. * // => [0, -1, -2, -3]
  33357. *
  33358. * _.range(1, 4, 0);
  33359. * // => [1, 1, 1]
  33360. *
  33361. * _.range(0);
  33362. * // => []
  33363. */
  33364. var range = createRange();
  33365. /**
  33366. * This method is like `_.range` except that it populates values in
  33367. * descending order.
  33368. *
  33369. * @static
  33370. * @memberOf _
  33371. * @since 4.0.0
  33372. * @category Util
  33373. * @param {number} [start=0] The start of the range.
  33374. * @param {number} end The end of the range.
  33375. * @param {number} [step=1] The value to increment or decrement by.
  33376. * @returns {Array} Returns the range of numbers.
  33377. * @see _.inRange, _.range
  33378. * @example
  33379. *
  33380. * _.rangeRight(4);
  33381. * // => [3, 2, 1, 0]
  33382. *
  33383. * _.rangeRight(-4);
  33384. * // => [-3, -2, -1, 0]
  33385. *
  33386. * _.rangeRight(1, 5);
  33387. * // => [4, 3, 2, 1]
  33388. *
  33389. * _.rangeRight(0, 20, 5);
  33390. * // => [15, 10, 5, 0]
  33391. *
  33392. * _.rangeRight(0, -4, -1);
  33393. * // => [-3, -2, -1, 0]
  33394. *
  33395. * _.rangeRight(1, 4, 0);
  33396. * // => [1, 1, 1]
  33397. *
  33398. * _.rangeRight(0);
  33399. * // => []
  33400. */
  33401. var rangeRight = createRange(true);
  33402. /**
  33403. * This method returns a new empty array.
  33404. *
  33405. * @static
  33406. * @memberOf _
  33407. * @since 4.13.0
  33408. * @category Util
  33409. * @returns {Array} Returns the new empty array.
  33410. * @example
  33411. *
  33412. * var arrays = _.times(2, _.stubArray);
  33413. *
  33414. * console.log(arrays);
  33415. * // => [[], []]
  33416. *
  33417. * console.log(arrays[0] === arrays[1]);
  33418. * // => false
  33419. */
  33420. function stubArray() {
  33421. return [];
  33422. }
  33423. /**
  33424. * This method returns `false`.
  33425. *
  33426. * @static
  33427. * @memberOf _
  33428. * @since 4.13.0
  33429. * @category Util
  33430. * @returns {boolean} Returns `false`.
  33431. * @example
  33432. *
  33433. * _.times(2, _.stubFalse);
  33434. * // => [false, false]
  33435. */
  33436. function stubFalse() {
  33437. return false;
  33438. }
  33439. /**
  33440. * This method returns a new empty object.
  33441. *
  33442. * @static
  33443. * @memberOf _
  33444. * @since 4.13.0
  33445. * @category Util
  33446. * @returns {Object} Returns the new empty object.
  33447. * @example
  33448. *
  33449. * var objects = _.times(2, _.stubObject);
  33450. *
  33451. * console.log(objects);
  33452. * // => [{}, {}]
  33453. *
  33454. * console.log(objects[0] === objects[1]);
  33455. * // => false
  33456. */
  33457. function stubObject() {
  33458. return {};
  33459. }
  33460. /**
  33461. * This method returns an empty string.
  33462. *
  33463. * @static
  33464. * @memberOf _
  33465. * @since 4.13.0
  33466. * @category Util
  33467. * @returns {string} Returns the empty string.
  33468. * @example
  33469. *
  33470. * _.times(2, _.stubString);
  33471. * // => ['', '']
  33472. */
  33473. function stubString() {
  33474. return '';
  33475. }
  33476. /**
  33477. * This method returns `true`.
  33478. *
  33479. * @static
  33480. * @memberOf _
  33481. * @since 4.13.0
  33482. * @category Util
  33483. * @returns {boolean} Returns `true`.
  33484. * @example
  33485. *
  33486. * _.times(2, _.stubTrue);
  33487. * // => [true, true]
  33488. */
  33489. function stubTrue() {
  33490. return true;
  33491. }
  33492. /**
  33493. * Invokes the iteratee `n` times, returning an array of the results of
  33494. * each invocation. The iteratee is invoked with one argument; (index).
  33495. *
  33496. * @static
  33497. * @since 0.1.0
  33498. * @memberOf _
  33499. * @category Util
  33500. * @param {number} n The number of times to invoke `iteratee`.
  33501. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33502. * @returns {Array} Returns the array of results.
  33503. * @example
  33504. *
  33505. * _.times(3, String);
  33506. * // => ['0', '1', '2']
  33507. *
  33508. * _.times(4, _.constant(0));
  33509. * // => [0, 0, 0, 0]
  33510. */
  33511. function times(n, iteratee) {
  33512. n = toInteger(n);
  33513. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33514. return [];
  33515. }
  33516. var index = MAX_ARRAY_LENGTH,
  33517. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33518. iteratee = getIteratee(iteratee);
  33519. n -= MAX_ARRAY_LENGTH;
  33520. var result = baseTimes(length, iteratee);
  33521. while (++index < n) {
  33522. iteratee(index);
  33523. }
  33524. return result;
  33525. }
  33526. /**
  33527. * Converts `value` to a property path array.
  33528. *
  33529. * @static
  33530. * @memberOf _
  33531. * @since 4.0.0
  33532. * @category Util
  33533. * @param {*} value The value to convert.
  33534. * @returns {Array} Returns the new property path array.
  33535. * @example
  33536. *
  33537. * _.toPath('a.b.c');
  33538. * // => ['a', 'b', 'c']
  33539. *
  33540. * _.toPath('a[0].b.c');
  33541. * // => ['a', '0', 'b', 'c']
  33542. */
  33543. function toPath(value) {
  33544. if (isArray(value)) {
  33545. return arrayMap(value, toKey);
  33546. }
  33547. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33548. }
  33549. /**
  33550. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33551. *
  33552. * @static
  33553. * @since 0.1.0
  33554. * @memberOf _
  33555. * @category Util
  33556. * @param {string} [prefix=''] The value to prefix the ID with.
  33557. * @returns {string} Returns the unique ID.
  33558. * @example
  33559. *
  33560. * _.uniqueId('contact_');
  33561. * // => 'contact_104'
  33562. *
  33563. * _.uniqueId();
  33564. * // => '105'
  33565. */
  33566. function uniqueId(prefix) {
  33567. var id = ++idCounter;
  33568. return toString(prefix) + id;
  33569. }
  33570. /*------------------------------------------------------------------------*/
  33571. /**
  33572. * Adds two numbers.
  33573. *
  33574. * @static
  33575. * @memberOf _
  33576. * @since 3.4.0
  33577. * @category Math
  33578. * @param {number} augend The first number in an addition.
  33579. * @param {number} addend The second number in an addition.
  33580. * @returns {number} Returns the total.
  33581. * @example
  33582. *
  33583. * _.add(6, 4);
  33584. * // => 10
  33585. */
  33586. var add = createMathOperation(function(augend, addend) {
  33587. return augend + addend;
  33588. }, 0);
  33589. /**
  33590. * Computes `number` rounded up to `precision`.
  33591. *
  33592. * @static
  33593. * @memberOf _
  33594. * @since 3.10.0
  33595. * @category Math
  33596. * @param {number} number The number to round up.
  33597. * @param {number} [precision=0] The precision to round up to.
  33598. * @returns {number} Returns the rounded up number.
  33599. * @example
  33600. *
  33601. * _.ceil(4.006);
  33602. * // => 5
  33603. *
  33604. * _.ceil(6.004, 2);
  33605. * // => 6.01
  33606. *
  33607. * _.ceil(6040, -2);
  33608. * // => 6100
  33609. */
  33610. var ceil = createRound('ceil');
  33611. /**
  33612. * Divide two numbers.
  33613. *
  33614. * @static
  33615. * @memberOf _
  33616. * @since 4.7.0
  33617. * @category Math
  33618. * @param {number} dividend The first number in a division.
  33619. * @param {number} divisor The second number in a division.
  33620. * @returns {number} Returns the quotient.
  33621. * @example
  33622. *
  33623. * _.divide(6, 4);
  33624. * // => 1.5
  33625. */
  33626. var divide = createMathOperation(function(dividend, divisor) {
  33627. return dividend / divisor;
  33628. }, 1);
  33629. /**
  33630. * Computes `number` rounded down to `precision`.
  33631. *
  33632. * @static
  33633. * @memberOf _
  33634. * @since 3.10.0
  33635. * @category Math
  33636. * @param {number} number The number to round down.
  33637. * @param {number} [precision=0] The precision to round down to.
  33638. * @returns {number} Returns the rounded down number.
  33639. * @example
  33640. *
  33641. * _.floor(4.006);
  33642. * // => 4
  33643. *
  33644. * _.floor(0.046, 2);
  33645. * // => 0.04
  33646. *
  33647. * _.floor(4060, -2);
  33648. * // => 4000
  33649. */
  33650. var floor = createRound('floor');
  33651. /**
  33652. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33653. * `undefined` is returned.
  33654. *
  33655. * @static
  33656. * @since 0.1.0
  33657. * @memberOf _
  33658. * @category Math
  33659. * @param {Array} array The array to iterate over.
  33660. * @returns {*} Returns the maximum value.
  33661. * @example
  33662. *
  33663. * _.max([4, 2, 8, 6]);
  33664. * // => 8
  33665. *
  33666. * _.max([]);
  33667. * // => undefined
  33668. */
  33669. function max(array) {
  33670. return (array && array.length)
  33671. ? baseExtremum(array, identity, baseGt)
  33672. : undefined;
  33673. }
  33674. /**
  33675. * This method is like `_.max` except that it accepts `iteratee` which is
  33676. * invoked for each element in `array` to generate the criterion by which
  33677. * the value is ranked. The iteratee is invoked with one argument: (value).
  33678. *
  33679. * @static
  33680. * @memberOf _
  33681. * @since 4.0.0
  33682. * @category Math
  33683. * @param {Array} array The array to iterate over.
  33684. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33685. * @returns {*} Returns the maximum value.
  33686. * @example
  33687. *
  33688. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33689. *
  33690. * _.maxBy(objects, function(o) { return o.n; });
  33691. * // => { 'n': 2 }
  33692. *
  33693. * // The `_.property` iteratee shorthand.
  33694. * _.maxBy(objects, 'n');
  33695. * // => { 'n': 2 }
  33696. */
  33697. function maxBy(array, iteratee) {
  33698. return (array && array.length)
  33699. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33700. : undefined;
  33701. }
  33702. /**
  33703. * Computes the mean of the values in `array`.
  33704. *
  33705. * @static
  33706. * @memberOf _
  33707. * @since 4.0.0
  33708. * @category Math
  33709. * @param {Array} array The array to iterate over.
  33710. * @returns {number} Returns the mean.
  33711. * @example
  33712. *
  33713. * _.mean([4, 2, 8, 6]);
  33714. * // => 5
  33715. */
  33716. function mean(array) {
  33717. return baseMean(array, identity);
  33718. }
  33719. /**
  33720. * This method is like `_.mean` except that it accepts `iteratee` which is
  33721. * invoked for each element in `array` to generate the value to be averaged.
  33722. * The iteratee is invoked with one argument: (value).
  33723. *
  33724. * @static
  33725. * @memberOf _
  33726. * @since 4.7.0
  33727. * @category Math
  33728. * @param {Array} array The array to iterate over.
  33729. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33730. * @returns {number} Returns the mean.
  33731. * @example
  33732. *
  33733. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33734. *
  33735. * _.meanBy(objects, function(o) { return o.n; });
  33736. * // => 5
  33737. *
  33738. * // The `_.property` iteratee shorthand.
  33739. * _.meanBy(objects, 'n');
  33740. * // => 5
  33741. */
  33742. function meanBy(array, iteratee) {
  33743. return baseMean(array, getIteratee(iteratee, 2));
  33744. }
  33745. /**
  33746. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33747. * `undefined` is returned.
  33748. *
  33749. * @static
  33750. * @since 0.1.0
  33751. * @memberOf _
  33752. * @category Math
  33753. * @param {Array} array The array to iterate over.
  33754. * @returns {*} Returns the minimum value.
  33755. * @example
  33756. *
  33757. * _.min([4, 2, 8, 6]);
  33758. * // => 2
  33759. *
  33760. * _.min([]);
  33761. * // => undefined
  33762. */
  33763. function min(array) {
  33764. return (array && array.length)
  33765. ? baseExtremum(array, identity, baseLt)
  33766. : undefined;
  33767. }
  33768. /**
  33769. * This method is like `_.min` except that it accepts `iteratee` which is
  33770. * invoked for each element in `array` to generate the criterion by which
  33771. * the value is ranked. The iteratee is invoked with one argument: (value).
  33772. *
  33773. * @static
  33774. * @memberOf _
  33775. * @since 4.0.0
  33776. * @category Math
  33777. * @param {Array} array The array to iterate over.
  33778. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33779. * @returns {*} Returns the minimum value.
  33780. * @example
  33781. *
  33782. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33783. *
  33784. * _.minBy(objects, function(o) { return o.n; });
  33785. * // => { 'n': 1 }
  33786. *
  33787. * // The `_.property` iteratee shorthand.
  33788. * _.minBy(objects, 'n');
  33789. * // => { 'n': 1 }
  33790. */
  33791. function minBy(array, iteratee) {
  33792. return (array && array.length)
  33793. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33794. : undefined;
  33795. }
  33796. /**
  33797. * Multiply two numbers.
  33798. *
  33799. * @static
  33800. * @memberOf _
  33801. * @since 4.7.0
  33802. * @category Math
  33803. * @param {number} multiplier The first number in a multiplication.
  33804. * @param {number} multiplicand The second number in a multiplication.
  33805. * @returns {number} Returns the product.
  33806. * @example
  33807. *
  33808. * _.multiply(6, 4);
  33809. * // => 24
  33810. */
  33811. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33812. return multiplier * multiplicand;
  33813. }, 1);
  33814. /**
  33815. * Computes `number` rounded to `precision`.
  33816. *
  33817. * @static
  33818. * @memberOf _
  33819. * @since 3.10.0
  33820. * @category Math
  33821. * @param {number} number The number to round.
  33822. * @param {number} [precision=0] The precision to round to.
  33823. * @returns {number} Returns the rounded number.
  33824. * @example
  33825. *
  33826. * _.round(4.006);
  33827. * // => 4
  33828. *
  33829. * _.round(4.006, 2);
  33830. * // => 4.01
  33831. *
  33832. * _.round(4060, -2);
  33833. * // => 4100
  33834. */
  33835. var round = createRound('round');
  33836. /**
  33837. * Subtract two numbers.
  33838. *
  33839. * @static
  33840. * @memberOf _
  33841. * @since 4.0.0
  33842. * @category Math
  33843. * @param {number} minuend The first number in a subtraction.
  33844. * @param {number} subtrahend The second number in a subtraction.
  33845. * @returns {number} Returns the difference.
  33846. * @example
  33847. *
  33848. * _.subtract(6, 4);
  33849. * // => 2
  33850. */
  33851. var subtract = createMathOperation(function(minuend, subtrahend) {
  33852. return minuend - subtrahend;
  33853. }, 0);
  33854. /**
  33855. * Computes the sum of the values in `array`.
  33856. *
  33857. * @static
  33858. * @memberOf _
  33859. * @since 3.4.0
  33860. * @category Math
  33861. * @param {Array} array The array to iterate over.
  33862. * @returns {number} Returns the sum.
  33863. * @example
  33864. *
  33865. * _.sum([4, 2, 8, 6]);
  33866. * // => 20
  33867. */
  33868. function sum(array) {
  33869. return (array && array.length)
  33870. ? baseSum(array, identity)
  33871. : 0;
  33872. }
  33873. /**
  33874. * This method is like `_.sum` except that it accepts `iteratee` which is
  33875. * invoked for each element in `array` to generate the value to be summed.
  33876. * The iteratee is invoked with one argument: (value).
  33877. *
  33878. * @static
  33879. * @memberOf _
  33880. * @since 4.0.0
  33881. * @category Math
  33882. * @param {Array} array The array to iterate over.
  33883. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33884. * @returns {number} Returns the sum.
  33885. * @example
  33886. *
  33887. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33888. *
  33889. * _.sumBy(objects, function(o) { return o.n; });
  33890. * // => 20
  33891. *
  33892. * // The `_.property` iteratee shorthand.
  33893. * _.sumBy(objects, 'n');
  33894. * // => 20
  33895. */
  33896. function sumBy(array, iteratee) {
  33897. return (array && array.length)
  33898. ? baseSum(array, getIteratee(iteratee, 2))
  33899. : 0;
  33900. }
  33901. /*------------------------------------------------------------------------*/
  33902. // Add methods that return wrapped values in chain sequences.
  33903. lodash.after = after;
  33904. lodash.ary = ary;
  33905. lodash.assign = assign;
  33906. lodash.assignIn = assignIn;
  33907. lodash.assignInWith = assignInWith;
  33908. lodash.assignWith = assignWith;
  33909. lodash.at = at;
  33910. lodash.before = before;
  33911. lodash.bind = bind;
  33912. lodash.bindAll = bindAll;
  33913. lodash.bindKey = bindKey;
  33914. lodash.castArray = castArray;
  33915. lodash.chain = chain;
  33916. lodash.chunk = chunk;
  33917. lodash.compact = compact;
  33918. lodash.concat = concat;
  33919. lodash.cond = cond;
  33920. lodash.conforms = conforms;
  33921. lodash.constant = constant;
  33922. lodash.countBy = countBy;
  33923. lodash.create = create;
  33924. lodash.curry = curry;
  33925. lodash.curryRight = curryRight;
  33926. lodash.debounce = debounce;
  33927. lodash.defaults = defaults;
  33928. lodash.defaultsDeep = defaultsDeep;
  33929. lodash.defer = defer;
  33930. lodash.delay = delay;
  33931. lodash.difference = difference;
  33932. lodash.differenceBy = differenceBy;
  33933. lodash.differenceWith = differenceWith;
  33934. lodash.drop = drop;
  33935. lodash.dropRight = dropRight;
  33936. lodash.dropRightWhile = dropRightWhile;
  33937. lodash.dropWhile = dropWhile;
  33938. lodash.fill = fill;
  33939. lodash.filter = filter;
  33940. lodash.flatMap = flatMap;
  33941. lodash.flatMapDeep = flatMapDeep;
  33942. lodash.flatMapDepth = flatMapDepth;
  33943. lodash.flatten = flatten;
  33944. lodash.flattenDeep = flattenDeep;
  33945. lodash.flattenDepth = flattenDepth;
  33946. lodash.flip = flip;
  33947. lodash.flow = flow;
  33948. lodash.flowRight = flowRight;
  33949. lodash.fromPairs = fromPairs;
  33950. lodash.functions = functions;
  33951. lodash.functionsIn = functionsIn;
  33952. lodash.groupBy = groupBy;
  33953. lodash.initial = initial;
  33954. lodash.intersection = intersection;
  33955. lodash.intersectionBy = intersectionBy;
  33956. lodash.intersectionWith = intersectionWith;
  33957. lodash.invert = invert;
  33958. lodash.invertBy = invertBy;
  33959. lodash.invokeMap = invokeMap;
  33960. lodash.iteratee = iteratee;
  33961. lodash.keyBy = keyBy;
  33962. lodash.keys = keys;
  33963. lodash.keysIn = keysIn;
  33964. lodash.map = map;
  33965. lodash.mapKeys = mapKeys;
  33966. lodash.mapValues = mapValues;
  33967. lodash.matches = matches;
  33968. lodash.matchesProperty = matchesProperty;
  33969. lodash.memoize = memoize;
  33970. lodash.merge = merge;
  33971. lodash.mergeWith = mergeWith;
  33972. lodash.method = method;
  33973. lodash.methodOf = methodOf;
  33974. lodash.mixin = mixin;
  33975. lodash.negate = negate;
  33976. lodash.nthArg = nthArg;
  33977. lodash.omit = omit;
  33978. lodash.omitBy = omitBy;
  33979. lodash.once = once;
  33980. lodash.orderBy = orderBy;
  33981. lodash.over = over;
  33982. lodash.overArgs = overArgs;
  33983. lodash.overEvery = overEvery;
  33984. lodash.overSome = overSome;
  33985. lodash.partial = partial;
  33986. lodash.partialRight = partialRight;
  33987. lodash.partition = partition;
  33988. lodash.pick = pick;
  33989. lodash.pickBy = pickBy;
  33990. lodash.property = property;
  33991. lodash.propertyOf = propertyOf;
  33992. lodash.pull = pull;
  33993. lodash.pullAll = pullAll;
  33994. lodash.pullAllBy = pullAllBy;
  33995. lodash.pullAllWith = pullAllWith;
  33996. lodash.pullAt = pullAt;
  33997. lodash.range = range;
  33998. lodash.rangeRight = rangeRight;
  33999. lodash.rearg = rearg;
  34000. lodash.reject = reject;
  34001. lodash.remove = remove;
  34002. lodash.rest = rest;
  34003. lodash.reverse = reverse;
  34004. lodash.sampleSize = sampleSize;
  34005. lodash.set = set;
  34006. lodash.setWith = setWith;
  34007. lodash.shuffle = shuffle;
  34008. lodash.slice = slice;
  34009. lodash.sortBy = sortBy;
  34010. lodash.sortedUniq = sortedUniq;
  34011. lodash.sortedUniqBy = sortedUniqBy;
  34012. lodash.split = split;
  34013. lodash.spread = spread;
  34014. lodash.tail = tail;
  34015. lodash.take = take;
  34016. lodash.takeRight = takeRight;
  34017. lodash.takeRightWhile = takeRightWhile;
  34018. lodash.takeWhile = takeWhile;
  34019. lodash.tap = tap;
  34020. lodash.throttle = throttle;
  34021. lodash.thru = thru;
  34022. lodash.toArray = toArray;
  34023. lodash.toPairs = toPairs;
  34024. lodash.toPairsIn = toPairsIn;
  34025. lodash.toPath = toPath;
  34026. lodash.toPlainObject = toPlainObject;
  34027. lodash.transform = transform;
  34028. lodash.unary = unary;
  34029. lodash.union = union;
  34030. lodash.unionBy = unionBy;
  34031. lodash.unionWith = unionWith;
  34032. lodash.uniq = uniq;
  34033. lodash.uniqBy = uniqBy;
  34034. lodash.uniqWith = uniqWith;
  34035. lodash.unset = unset;
  34036. lodash.unzip = unzip;
  34037. lodash.unzipWith = unzipWith;
  34038. lodash.update = update;
  34039. lodash.updateWith = updateWith;
  34040. lodash.values = values;
  34041. lodash.valuesIn = valuesIn;
  34042. lodash.without = without;
  34043. lodash.words = words;
  34044. lodash.wrap = wrap;
  34045. lodash.xor = xor;
  34046. lodash.xorBy = xorBy;
  34047. lodash.xorWith = xorWith;
  34048. lodash.zip = zip;
  34049. lodash.zipObject = zipObject;
  34050. lodash.zipObjectDeep = zipObjectDeep;
  34051. lodash.zipWith = zipWith;
  34052. // Add aliases.
  34053. lodash.entries = toPairs;
  34054. lodash.entriesIn = toPairsIn;
  34055. lodash.extend = assignIn;
  34056. lodash.extendWith = assignInWith;
  34057. // Add methods to `lodash.prototype`.
  34058. mixin(lodash, lodash);
  34059. /*------------------------------------------------------------------------*/
  34060. // Add methods that return unwrapped values in chain sequences.
  34061. lodash.add = add;
  34062. lodash.attempt = attempt;
  34063. lodash.camelCase = camelCase;
  34064. lodash.capitalize = capitalize;
  34065. lodash.ceil = ceil;
  34066. lodash.clamp = clamp;
  34067. lodash.clone = clone;
  34068. lodash.cloneDeep = cloneDeep;
  34069. lodash.cloneDeepWith = cloneDeepWith;
  34070. lodash.cloneWith = cloneWith;
  34071. lodash.conformsTo = conformsTo;
  34072. lodash.deburr = deburr;
  34073. lodash.defaultTo = defaultTo;
  34074. lodash.divide = divide;
  34075. lodash.endsWith = endsWith;
  34076. lodash.eq = eq;
  34077. lodash.escape = escape;
  34078. lodash.escapeRegExp = escapeRegExp;
  34079. lodash.every = every;
  34080. lodash.find = find;
  34081. lodash.findIndex = findIndex;
  34082. lodash.findKey = findKey;
  34083. lodash.findLast = findLast;
  34084. lodash.findLastIndex = findLastIndex;
  34085. lodash.findLastKey = findLastKey;
  34086. lodash.floor = floor;
  34087. lodash.forEach = forEach;
  34088. lodash.forEachRight = forEachRight;
  34089. lodash.forIn = forIn;
  34090. lodash.forInRight = forInRight;
  34091. lodash.forOwn = forOwn;
  34092. lodash.forOwnRight = forOwnRight;
  34093. lodash.get = get;
  34094. lodash.gt = gt;
  34095. lodash.gte = gte;
  34096. lodash.has = has;
  34097. lodash.hasIn = hasIn;
  34098. lodash.head = head;
  34099. lodash.identity = identity;
  34100. lodash.includes = includes;
  34101. lodash.indexOf = indexOf;
  34102. lodash.inRange = inRange;
  34103. lodash.invoke = invoke;
  34104. lodash.isArguments = isArguments;
  34105. lodash.isArray = isArray;
  34106. lodash.isArrayBuffer = isArrayBuffer;
  34107. lodash.isArrayLike = isArrayLike;
  34108. lodash.isArrayLikeObject = isArrayLikeObject;
  34109. lodash.isBoolean = isBoolean;
  34110. lodash.isBuffer = isBuffer;
  34111. lodash.isDate = isDate;
  34112. lodash.isElement = isElement;
  34113. lodash.isEmpty = isEmpty;
  34114. lodash.isEqual = isEqual;
  34115. lodash.isEqualWith = isEqualWith;
  34116. lodash.isError = isError;
  34117. lodash.isFinite = isFinite;
  34118. lodash.isFunction = isFunction;
  34119. lodash.isInteger = isInteger;
  34120. lodash.isLength = isLength;
  34121. lodash.isMap = isMap;
  34122. lodash.isMatch = isMatch;
  34123. lodash.isMatchWith = isMatchWith;
  34124. lodash.isNaN = isNaN;
  34125. lodash.isNative = isNative;
  34126. lodash.isNil = isNil;
  34127. lodash.isNull = isNull;
  34128. lodash.isNumber = isNumber;
  34129. lodash.isObject = isObject;
  34130. lodash.isObjectLike = isObjectLike;
  34131. lodash.isPlainObject = isPlainObject;
  34132. lodash.isRegExp = isRegExp;
  34133. lodash.isSafeInteger = isSafeInteger;
  34134. lodash.isSet = isSet;
  34135. lodash.isString = isString;
  34136. lodash.isSymbol = isSymbol;
  34137. lodash.isTypedArray = isTypedArray;
  34138. lodash.isUndefined = isUndefined;
  34139. lodash.isWeakMap = isWeakMap;
  34140. lodash.isWeakSet = isWeakSet;
  34141. lodash.join = join;
  34142. lodash.kebabCase = kebabCase;
  34143. lodash.last = last;
  34144. lodash.lastIndexOf = lastIndexOf;
  34145. lodash.lowerCase = lowerCase;
  34146. lodash.lowerFirst = lowerFirst;
  34147. lodash.lt = lt;
  34148. lodash.lte = lte;
  34149. lodash.max = max;
  34150. lodash.maxBy = maxBy;
  34151. lodash.mean = mean;
  34152. lodash.meanBy = meanBy;
  34153. lodash.min = min;
  34154. lodash.minBy = minBy;
  34155. lodash.stubArray = stubArray;
  34156. lodash.stubFalse = stubFalse;
  34157. lodash.stubObject = stubObject;
  34158. lodash.stubString = stubString;
  34159. lodash.stubTrue = stubTrue;
  34160. lodash.multiply = multiply;
  34161. lodash.nth = nth;
  34162. lodash.noConflict = noConflict;
  34163. lodash.noop = noop;
  34164. lodash.now = now;
  34165. lodash.pad = pad;
  34166. lodash.padEnd = padEnd;
  34167. lodash.padStart = padStart;
  34168. lodash.parseInt = parseInt;
  34169. lodash.random = random;
  34170. lodash.reduce = reduce;
  34171. lodash.reduceRight = reduceRight;
  34172. lodash.repeat = repeat;
  34173. lodash.replace = replace;
  34174. lodash.result = result;
  34175. lodash.round = round;
  34176. lodash.runInContext = runInContext;
  34177. lodash.sample = sample;
  34178. lodash.size = size;
  34179. lodash.snakeCase = snakeCase;
  34180. lodash.some = some;
  34181. lodash.sortedIndex = sortedIndex;
  34182. lodash.sortedIndexBy = sortedIndexBy;
  34183. lodash.sortedIndexOf = sortedIndexOf;
  34184. lodash.sortedLastIndex = sortedLastIndex;
  34185. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34186. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34187. lodash.startCase = startCase;
  34188. lodash.startsWith = startsWith;
  34189. lodash.subtract = subtract;
  34190. lodash.sum = sum;
  34191. lodash.sumBy = sumBy;
  34192. lodash.template = template;
  34193. lodash.times = times;
  34194. lodash.toFinite = toFinite;
  34195. lodash.toInteger = toInteger;
  34196. lodash.toLength = toLength;
  34197. lodash.toLower = toLower;
  34198. lodash.toNumber = toNumber;
  34199. lodash.toSafeInteger = toSafeInteger;
  34200. lodash.toString = toString;
  34201. lodash.toUpper = toUpper;
  34202. lodash.trim = trim;
  34203. lodash.trimEnd = trimEnd;
  34204. lodash.trimStart = trimStart;
  34205. lodash.truncate = truncate;
  34206. lodash.unescape = unescape;
  34207. lodash.uniqueId = uniqueId;
  34208. lodash.upperCase = upperCase;
  34209. lodash.upperFirst = upperFirst;
  34210. // Add aliases.
  34211. lodash.each = forEach;
  34212. lodash.eachRight = forEachRight;
  34213. lodash.first = head;
  34214. mixin(lodash, (function() {
  34215. var source = {};
  34216. baseForOwn(lodash, function(func, methodName) {
  34217. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34218. source[methodName] = func;
  34219. }
  34220. });
  34221. return source;
  34222. }()), { 'chain': false });
  34223. /*------------------------------------------------------------------------*/
  34224. /**
  34225. * The semantic version number.
  34226. *
  34227. * @static
  34228. * @memberOf _
  34229. * @type {string}
  34230. */
  34231. lodash.VERSION = VERSION;
  34232. // Assign default placeholders.
  34233. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34234. lodash[methodName].placeholder = lodash;
  34235. });
  34236. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34237. arrayEach(['drop', 'take'], function(methodName, index) {
  34238. LazyWrapper.prototype[methodName] = function(n) {
  34239. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34240. var result = (this.__filtered__ && !index)
  34241. ? new LazyWrapper(this)
  34242. : this.clone();
  34243. if (result.__filtered__) {
  34244. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34245. } else {
  34246. result.__views__.push({
  34247. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34248. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34249. });
  34250. }
  34251. return result;
  34252. };
  34253. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34254. return this.reverse()[methodName](n).reverse();
  34255. };
  34256. });
  34257. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34258. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34259. var type = index + 1,
  34260. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34261. LazyWrapper.prototype[methodName] = function(iteratee) {
  34262. var result = this.clone();
  34263. result.__iteratees__.push({
  34264. 'iteratee': getIteratee(iteratee, 3),
  34265. 'type': type
  34266. });
  34267. result.__filtered__ = result.__filtered__ || isFilter;
  34268. return result;
  34269. };
  34270. });
  34271. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34272. arrayEach(['head', 'last'], function(methodName, index) {
  34273. var takeName = 'take' + (index ? 'Right' : '');
  34274. LazyWrapper.prototype[methodName] = function() {
  34275. return this[takeName](1).value()[0];
  34276. };
  34277. });
  34278. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34279. arrayEach(['initial', 'tail'], function(methodName, index) {
  34280. var dropName = 'drop' + (index ? '' : 'Right');
  34281. LazyWrapper.prototype[methodName] = function() {
  34282. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34283. };
  34284. });
  34285. LazyWrapper.prototype.compact = function() {
  34286. return this.filter(identity);
  34287. };
  34288. LazyWrapper.prototype.find = function(predicate) {
  34289. return this.filter(predicate).head();
  34290. };
  34291. LazyWrapper.prototype.findLast = function(predicate) {
  34292. return this.reverse().find(predicate);
  34293. };
  34294. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34295. if (typeof path == 'function') {
  34296. return new LazyWrapper(this);
  34297. }
  34298. return this.map(function(value) {
  34299. return baseInvoke(value, path, args);
  34300. });
  34301. });
  34302. LazyWrapper.prototype.reject = function(predicate) {
  34303. return this.filter(negate(getIteratee(predicate)));
  34304. };
  34305. LazyWrapper.prototype.slice = function(start, end) {
  34306. start = toInteger(start);
  34307. var result = this;
  34308. if (result.__filtered__ && (start > 0 || end < 0)) {
  34309. return new LazyWrapper(result);
  34310. }
  34311. if (start < 0) {
  34312. result = result.takeRight(-start);
  34313. } else if (start) {
  34314. result = result.drop(start);
  34315. }
  34316. if (end !== undefined) {
  34317. end = toInteger(end);
  34318. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34319. }
  34320. return result;
  34321. };
  34322. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34323. return this.reverse().takeWhile(predicate).reverse();
  34324. };
  34325. LazyWrapper.prototype.toArray = function() {
  34326. return this.take(MAX_ARRAY_LENGTH);
  34327. };
  34328. // Add `LazyWrapper` methods to `lodash.prototype`.
  34329. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34330. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34331. isTaker = /^(?:head|last)$/.test(methodName),
  34332. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34333. retUnwrapped = isTaker || /^find/.test(methodName);
  34334. if (!lodashFunc) {
  34335. return;
  34336. }
  34337. lodash.prototype[methodName] = function() {
  34338. var value = this.__wrapped__,
  34339. args = isTaker ? [1] : arguments,
  34340. isLazy = value instanceof LazyWrapper,
  34341. iteratee = args[0],
  34342. useLazy = isLazy || isArray(value);
  34343. var interceptor = function(value) {
  34344. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34345. return (isTaker && chainAll) ? result[0] : result;
  34346. };
  34347. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34348. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34349. isLazy = useLazy = false;
  34350. }
  34351. var chainAll = this.__chain__,
  34352. isHybrid = !!this.__actions__.length,
  34353. isUnwrapped = retUnwrapped && !chainAll,
  34354. onlyLazy = isLazy && !isHybrid;
  34355. if (!retUnwrapped && useLazy) {
  34356. value = onlyLazy ? value : new LazyWrapper(this);
  34357. var result = func.apply(value, args);
  34358. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34359. return new LodashWrapper(result, chainAll);
  34360. }
  34361. if (isUnwrapped && onlyLazy) {
  34362. return func.apply(this, args);
  34363. }
  34364. result = this.thru(interceptor);
  34365. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34366. };
  34367. });
  34368. // Add `Array` methods to `lodash.prototype`.
  34369. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34370. var func = arrayProto[methodName],
  34371. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34372. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34373. lodash.prototype[methodName] = function() {
  34374. var args = arguments;
  34375. if (retUnwrapped && !this.__chain__) {
  34376. var value = this.value();
  34377. return func.apply(isArray(value) ? value : [], args);
  34378. }
  34379. return this[chainName](function(value) {
  34380. return func.apply(isArray(value) ? value : [], args);
  34381. });
  34382. };
  34383. });
  34384. // Map minified method names to their real names.
  34385. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34386. var lodashFunc = lodash[methodName];
  34387. if (lodashFunc) {
  34388. var key = lodashFunc.name + '';
  34389. if (!hasOwnProperty.call(realNames, key)) {
  34390. realNames[key] = [];
  34391. }
  34392. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34393. }
  34394. });
  34395. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34396. 'name': 'wrapper',
  34397. 'func': undefined
  34398. }];
  34399. // Add methods to `LazyWrapper`.
  34400. LazyWrapper.prototype.clone = lazyClone;
  34401. LazyWrapper.prototype.reverse = lazyReverse;
  34402. LazyWrapper.prototype.value = lazyValue;
  34403. // Add chain sequence methods to the `lodash` wrapper.
  34404. lodash.prototype.at = wrapperAt;
  34405. lodash.prototype.chain = wrapperChain;
  34406. lodash.prototype.commit = wrapperCommit;
  34407. lodash.prototype.next = wrapperNext;
  34408. lodash.prototype.plant = wrapperPlant;
  34409. lodash.prototype.reverse = wrapperReverse;
  34410. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34411. // Add lazy aliases.
  34412. lodash.prototype.first = lodash.prototype.head;
  34413. if (symIterator) {
  34414. lodash.prototype[symIterator] = wrapperToIterator;
  34415. }
  34416. return lodash;
  34417. });
  34418. /*--------------------------------------------------------------------------*/
  34419. // Export lodash.
  34420. var _ = runInContext();
  34421. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34422. if (true) {
  34423. // Expose Lodash on the global object to prevent errors when Lodash is
  34424. // loaded by a script tag in the presence of an AMD loader.
  34425. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34426. // Use `_.noConflict` to remove Lodash from the global object.
  34427. root._ = _;
  34428. // Define as an anonymous module so, through path mapping, it can be
  34429. // referenced as the "underscore" module.
  34430. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34431. return _;
  34432. }).call(exports, __webpack_require__, exports, module),
  34433. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34434. }
  34435. // Check for `exports` after `define` in case a build optimizer adds it.
  34436. else {}
  34437. }.call(this));
  34438. /* 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)))
  34439. /***/ }),
  34440. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34441. /*!***************************************************!*\
  34442. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34443. \***************************************************/
  34444. /*! exports provided: default */
  34445. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34446. "use strict";
  34447. __webpack_require__.r(__webpack_exports__);
  34448. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34449. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34450. * @version 1.16.1
  34451. * @license
  34452. * Copyright (c) 2016 Federico Zivolo and contributors
  34453. *
  34454. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34455. * of this software and associated documentation files (the "Software"), to deal
  34456. * in the Software without restriction, including without limitation the rights
  34457. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34458. * copies of the Software, and to permit persons to whom the Software is
  34459. * furnished to do so, subject to the following conditions:
  34460. *
  34461. * The above copyright notice and this permission notice shall be included in all
  34462. * copies or substantial portions of the Software.
  34463. *
  34464. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34465. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34466. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34467. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34468. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34469. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34470. * SOFTWARE.
  34471. */
  34472. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34473. var timeoutDuration = function () {
  34474. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34475. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34476. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34477. return 1;
  34478. }
  34479. }
  34480. return 0;
  34481. }();
  34482. function microtaskDebounce(fn) {
  34483. var called = false;
  34484. return function () {
  34485. if (called) {
  34486. return;
  34487. }
  34488. called = true;
  34489. window.Promise.resolve().then(function () {
  34490. called = false;
  34491. fn();
  34492. });
  34493. };
  34494. }
  34495. function taskDebounce(fn) {
  34496. var scheduled = false;
  34497. return function () {
  34498. if (!scheduled) {
  34499. scheduled = true;
  34500. setTimeout(function () {
  34501. scheduled = false;
  34502. fn();
  34503. }, timeoutDuration);
  34504. }
  34505. };
  34506. }
  34507. var supportsMicroTasks = isBrowser && window.Promise;
  34508. /**
  34509. * Create a debounced version of a method, that's asynchronously deferred
  34510. * but called in the minimum time possible.
  34511. *
  34512. * @method
  34513. * @memberof Popper.Utils
  34514. * @argument {Function} fn
  34515. * @returns {Function}
  34516. */
  34517. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34518. /**
  34519. * Check if the given variable is a function
  34520. * @method
  34521. * @memberof Popper.Utils
  34522. * @argument {Any} functionToCheck - variable to check
  34523. * @returns {Boolean} answer to: is a function?
  34524. */
  34525. function isFunction(functionToCheck) {
  34526. var getType = {};
  34527. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34528. }
  34529. /**
  34530. * Get CSS computed property of the given element
  34531. * @method
  34532. * @memberof Popper.Utils
  34533. * @argument {Eement} element
  34534. * @argument {String} property
  34535. */
  34536. function getStyleComputedProperty(element, property) {
  34537. if (element.nodeType !== 1) {
  34538. return [];
  34539. }
  34540. // NOTE: 1 DOM access here
  34541. var window = element.ownerDocument.defaultView;
  34542. var css = window.getComputedStyle(element, null);
  34543. return property ? css[property] : css;
  34544. }
  34545. /**
  34546. * Returns the parentNode or the host of the element
  34547. * @method
  34548. * @memberof Popper.Utils
  34549. * @argument {Element} element
  34550. * @returns {Element} parent
  34551. */
  34552. function getParentNode(element) {
  34553. if (element.nodeName === 'HTML') {
  34554. return element;
  34555. }
  34556. return element.parentNode || element.host;
  34557. }
  34558. /**
  34559. * Returns the scrolling parent of the given element
  34560. * @method
  34561. * @memberof Popper.Utils
  34562. * @argument {Element} element
  34563. * @returns {Element} scroll parent
  34564. */
  34565. function getScrollParent(element) {
  34566. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34567. if (!element) {
  34568. return document.body;
  34569. }
  34570. switch (element.nodeName) {
  34571. case 'HTML':
  34572. case 'BODY':
  34573. return element.ownerDocument.body;
  34574. case '#document':
  34575. return element.body;
  34576. }
  34577. // Firefox want us to check `-x` and `-y` variations as well
  34578. var _getStyleComputedProp = getStyleComputedProperty(element),
  34579. overflow = _getStyleComputedProp.overflow,
  34580. overflowX = _getStyleComputedProp.overflowX,
  34581. overflowY = _getStyleComputedProp.overflowY;
  34582. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34583. return element;
  34584. }
  34585. return getScrollParent(getParentNode(element));
  34586. }
  34587. /**
  34588. * Returns the reference node of the reference object, or the reference object itself.
  34589. * @method
  34590. * @memberof Popper.Utils
  34591. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34592. * @returns {Element} parent
  34593. */
  34594. function getReferenceNode(reference) {
  34595. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34596. }
  34597. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34598. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34599. /**
  34600. * Determines if the browser is Internet Explorer
  34601. * @method
  34602. * @memberof Popper.Utils
  34603. * @param {Number} version to check
  34604. * @returns {Boolean} isIE
  34605. */
  34606. function isIE(version) {
  34607. if (version === 11) {
  34608. return isIE11;
  34609. }
  34610. if (version === 10) {
  34611. return isIE10;
  34612. }
  34613. return isIE11 || isIE10;
  34614. }
  34615. /**
  34616. * Returns the offset parent of the given element
  34617. * @method
  34618. * @memberof Popper.Utils
  34619. * @argument {Element} element
  34620. * @returns {Element} offset parent
  34621. */
  34622. function getOffsetParent(element) {
  34623. if (!element) {
  34624. return document.documentElement;
  34625. }
  34626. var noOffsetParent = isIE(10) ? document.body : null;
  34627. // NOTE: 1 DOM access here
  34628. var offsetParent = element.offsetParent || null;
  34629. // Skip hidden elements which don't have an offsetParent
  34630. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34631. offsetParent = (element = element.nextElementSibling).offsetParent;
  34632. }
  34633. var nodeName = offsetParent && offsetParent.nodeName;
  34634. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34635. return element ? element.ownerDocument.documentElement : document.documentElement;
  34636. }
  34637. // .offsetParent will return the closest TH, TD or TABLE in case
  34638. // no offsetParent is present, I hate this job...
  34639. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34640. return getOffsetParent(offsetParent);
  34641. }
  34642. return offsetParent;
  34643. }
  34644. function isOffsetContainer(element) {
  34645. var nodeName = element.nodeName;
  34646. if (nodeName === 'BODY') {
  34647. return false;
  34648. }
  34649. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34650. }
  34651. /**
  34652. * Finds the root node (document, shadowDOM root) of the given element
  34653. * @method
  34654. * @memberof Popper.Utils
  34655. * @argument {Element} node
  34656. * @returns {Element} root node
  34657. */
  34658. function getRoot(node) {
  34659. if (node.parentNode !== null) {
  34660. return getRoot(node.parentNode);
  34661. }
  34662. return node;
  34663. }
  34664. /**
  34665. * Finds the offset parent common to the two provided nodes
  34666. * @method
  34667. * @memberof Popper.Utils
  34668. * @argument {Element} element1
  34669. * @argument {Element} element2
  34670. * @returns {Element} common offset parent
  34671. */
  34672. function findCommonOffsetParent(element1, element2) {
  34673. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34674. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34675. return document.documentElement;
  34676. }
  34677. // Here we make sure to give as "start" the element that comes first in the DOM
  34678. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34679. var start = order ? element1 : element2;
  34680. var end = order ? element2 : element1;
  34681. // Get common ancestor container
  34682. var range = document.createRange();
  34683. range.setStart(start, 0);
  34684. range.setEnd(end, 0);
  34685. var commonAncestorContainer = range.commonAncestorContainer;
  34686. // Both nodes are inside #document
  34687. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34688. if (isOffsetContainer(commonAncestorContainer)) {
  34689. return commonAncestorContainer;
  34690. }
  34691. return getOffsetParent(commonAncestorContainer);
  34692. }
  34693. // one of the nodes is inside shadowDOM, find which one
  34694. var element1root = getRoot(element1);
  34695. if (element1root.host) {
  34696. return findCommonOffsetParent(element1root.host, element2);
  34697. } else {
  34698. return findCommonOffsetParent(element1, getRoot(element2).host);
  34699. }
  34700. }
  34701. /**
  34702. * Gets the scroll value of the given element in the given side (top and left)
  34703. * @method
  34704. * @memberof Popper.Utils
  34705. * @argument {Element} element
  34706. * @argument {String} side `top` or `left`
  34707. * @returns {number} amount of scrolled pixels
  34708. */
  34709. function getScroll(element) {
  34710. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34711. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34712. var nodeName = element.nodeName;
  34713. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34714. var html = element.ownerDocument.documentElement;
  34715. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34716. return scrollingElement[upperSide];
  34717. }
  34718. return element[upperSide];
  34719. }
  34720. /*
  34721. * Sum or subtract the element scroll values (left and top) from a given rect object
  34722. * @method
  34723. * @memberof Popper.Utils
  34724. * @param {Object} rect - Rect object you want to change
  34725. * @param {HTMLElement} element - The element from the function reads the scroll values
  34726. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34727. * @return {Object} rect - The modifier rect object
  34728. */
  34729. function includeScroll(rect, element) {
  34730. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34731. var scrollTop = getScroll(element, 'top');
  34732. var scrollLeft = getScroll(element, 'left');
  34733. var modifier = subtract ? -1 : 1;
  34734. rect.top += scrollTop * modifier;
  34735. rect.bottom += scrollTop * modifier;
  34736. rect.left += scrollLeft * modifier;
  34737. rect.right += scrollLeft * modifier;
  34738. return rect;
  34739. }
  34740. /*
  34741. * Helper to detect borders of a given element
  34742. * @method
  34743. * @memberof Popper.Utils
  34744. * @param {CSSStyleDeclaration} styles
  34745. * Result of `getStyleComputedProperty` on the given element
  34746. * @param {String} axis - `x` or `y`
  34747. * @return {number} borders - The borders size of the given axis
  34748. */
  34749. function getBordersSize(styles, axis) {
  34750. var sideA = axis === 'x' ? 'Left' : 'Top';
  34751. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34752. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34753. }
  34754. function getSize(axis, body, html, computedStyle) {
  34755. 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);
  34756. }
  34757. function getWindowSizes(document) {
  34758. var body = document.body;
  34759. var html = document.documentElement;
  34760. var computedStyle = isIE(10) && getComputedStyle(html);
  34761. return {
  34762. height: getSize('Height', body, html, computedStyle),
  34763. width: getSize('Width', body, html, computedStyle)
  34764. };
  34765. }
  34766. var classCallCheck = function (instance, Constructor) {
  34767. if (!(instance instanceof Constructor)) {
  34768. throw new TypeError("Cannot call a class as a function");
  34769. }
  34770. };
  34771. var createClass = function () {
  34772. function defineProperties(target, props) {
  34773. for (var i = 0; i < props.length; i++) {
  34774. var descriptor = props[i];
  34775. descriptor.enumerable = descriptor.enumerable || false;
  34776. descriptor.configurable = true;
  34777. if ("value" in descriptor) descriptor.writable = true;
  34778. Object.defineProperty(target, descriptor.key, descriptor);
  34779. }
  34780. }
  34781. return function (Constructor, protoProps, staticProps) {
  34782. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34783. if (staticProps) defineProperties(Constructor, staticProps);
  34784. return Constructor;
  34785. };
  34786. }();
  34787. var defineProperty = function (obj, key, value) {
  34788. if (key in obj) {
  34789. Object.defineProperty(obj, key, {
  34790. value: value,
  34791. enumerable: true,
  34792. configurable: true,
  34793. writable: true
  34794. });
  34795. } else {
  34796. obj[key] = value;
  34797. }
  34798. return obj;
  34799. };
  34800. var _extends = Object.assign || function (target) {
  34801. for (var i = 1; i < arguments.length; i++) {
  34802. var source = arguments[i];
  34803. for (var key in source) {
  34804. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34805. target[key] = source[key];
  34806. }
  34807. }
  34808. }
  34809. return target;
  34810. };
  34811. /**
  34812. * Given element offsets, generate an output similar to getBoundingClientRect
  34813. * @method
  34814. * @memberof Popper.Utils
  34815. * @argument {Object} offsets
  34816. * @returns {Object} ClientRect like output
  34817. */
  34818. function getClientRect(offsets) {
  34819. return _extends({}, offsets, {
  34820. right: offsets.left + offsets.width,
  34821. bottom: offsets.top + offsets.height
  34822. });
  34823. }
  34824. /**
  34825. * Get bounding client rect of given element
  34826. * @method
  34827. * @memberof Popper.Utils
  34828. * @param {HTMLElement} element
  34829. * @return {Object} client rect
  34830. */
  34831. function getBoundingClientRect(element) {
  34832. var rect = {};
  34833. // IE10 10 FIX: Please, don't ask, the element isn't
  34834. // considered in DOM in some circumstances...
  34835. // This isn't reproducible in IE10 compatibility mode of IE11
  34836. try {
  34837. if (isIE(10)) {
  34838. rect = element.getBoundingClientRect();
  34839. var scrollTop = getScroll(element, 'top');
  34840. var scrollLeft = getScroll(element, 'left');
  34841. rect.top += scrollTop;
  34842. rect.left += scrollLeft;
  34843. rect.bottom += scrollTop;
  34844. rect.right += scrollLeft;
  34845. } else {
  34846. rect = element.getBoundingClientRect();
  34847. }
  34848. } catch (e) {}
  34849. var result = {
  34850. left: rect.left,
  34851. top: rect.top,
  34852. width: rect.right - rect.left,
  34853. height: rect.bottom - rect.top
  34854. };
  34855. // subtract scrollbar size from sizes
  34856. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34857. var width = sizes.width || element.clientWidth || result.width;
  34858. var height = sizes.height || element.clientHeight || result.height;
  34859. var horizScrollbar = element.offsetWidth - width;
  34860. var vertScrollbar = element.offsetHeight - height;
  34861. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34862. // we make this check conditional for performance reasons
  34863. if (horizScrollbar || vertScrollbar) {
  34864. var styles = getStyleComputedProperty(element);
  34865. horizScrollbar -= getBordersSize(styles, 'x');
  34866. vertScrollbar -= getBordersSize(styles, 'y');
  34867. result.width -= horizScrollbar;
  34868. result.height -= vertScrollbar;
  34869. }
  34870. return getClientRect(result);
  34871. }
  34872. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34873. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34874. var isIE10 = isIE(10);
  34875. var isHTML = parent.nodeName === 'HTML';
  34876. var childrenRect = getBoundingClientRect(children);
  34877. var parentRect = getBoundingClientRect(parent);
  34878. var scrollParent = getScrollParent(children);
  34879. var styles = getStyleComputedProperty(parent);
  34880. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34881. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34882. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34883. if (fixedPosition && isHTML) {
  34884. parentRect.top = Math.max(parentRect.top, 0);
  34885. parentRect.left = Math.max(parentRect.left, 0);
  34886. }
  34887. var offsets = getClientRect({
  34888. top: childrenRect.top - parentRect.top - borderTopWidth,
  34889. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34890. width: childrenRect.width,
  34891. height: childrenRect.height
  34892. });
  34893. offsets.marginTop = 0;
  34894. offsets.marginLeft = 0;
  34895. // Subtract margins of documentElement in case it's being used as parent
  34896. // we do this only on HTML because it's the only element that behaves
  34897. // differently when margins are applied to it. The margins are included in
  34898. // the box of the documentElement, in the other cases not.
  34899. if (!isIE10 && isHTML) {
  34900. var marginTop = parseFloat(styles.marginTop);
  34901. var marginLeft = parseFloat(styles.marginLeft);
  34902. offsets.top -= borderTopWidth - marginTop;
  34903. offsets.bottom -= borderTopWidth - marginTop;
  34904. offsets.left -= borderLeftWidth - marginLeft;
  34905. offsets.right -= borderLeftWidth - marginLeft;
  34906. // Attach marginTop and marginLeft because in some circumstances we may need them
  34907. offsets.marginTop = marginTop;
  34908. offsets.marginLeft = marginLeft;
  34909. }
  34910. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34911. offsets = includeScroll(offsets, parent);
  34912. }
  34913. return offsets;
  34914. }
  34915. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34916. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34917. var html = element.ownerDocument.documentElement;
  34918. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34919. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34920. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34921. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34922. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34923. var offset = {
  34924. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34925. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34926. width: width,
  34927. height: height
  34928. };
  34929. return getClientRect(offset);
  34930. }
  34931. /**
  34932. * Check if the given element is fixed or is inside a fixed parent
  34933. * @method
  34934. * @memberof Popper.Utils
  34935. * @argument {Element} element
  34936. * @argument {Element} customContainer
  34937. * @returns {Boolean} answer to "isFixed?"
  34938. */
  34939. function isFixed(element) {
  34940. var nodeName = element.nodeName;
  34941. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34942. return false;
  34943. }
  34944. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34945. return true;
  34946. }
  34947. var parentNode = getParentNode(element);
  34948. if (!parentNode) {
  34949. return false;
  34950. }
  34951. return isFixed(parentNode);
  34952. }
  34953. /**
  34954. * Finds the first parent of an element that has a transformed property defined
  34955. * @method
  34956. * @memberof Popper.Utils
  34957. * @argument {Element} element
  34958. * @returns {Element} first transformed parent or documentElement
  34959. */
  34960. function getFixedPositionOffsetParent(element) {
  34961. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34962. if (!element || !element.parentElement || isIE()) {
  34963. return document.documentElement;
  34964. }
  34965. var el = element.parentElement;
  34966. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34967. el = el.parentElement;
  34968. }
  34969. return el || document.documentElement;
  34970. }
  34971. /**
  34972. * Computed the boundaries limits and return them
  34973. * @method
  34974. * @memberof Popper.Utils
  34975. * @param {HTMLElement} popper
  34976. * @param {HTMLElement} reference
  34977. * @param {number} padding
  34978. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34979. * @param {Boolean} fixedPosition - Is in fixed position mode
  34980. * @returns {Object} Coordinates of the boundaries
  34981. */
  34982. function getBoundaries(popper, reference, padding, boundariesElement) {
  34983. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34984. // NOTE: 1 DOM access here
  34985. var boundaries = { top: 0, left: 0 };
  34986. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34987. // Handle viewport case
  34988. if (boundariesElement === 'viewport') {
  34989. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34990. } else {
  34991. // Handle other cases based on DOM element used as boundaries
  34992. var boundariesNode = void 0;
  34993. if (boundariesElement === 'scrollParent') {
  34994. boundariesNode = getScrollParent(getParentNode(reference));
  34995. if (boundariesNode.nodeName === 'BODY') {
  34996. boundariesNode = popper.ownerDocument.documentElement;
  34997. }
  34998. } else if (boundariesElement === 'window') {
  34999. boundariesNode = popper.ownerDocument.documentElement;
  35000. } else {
  35001. boundariesNode = boundariesElement;
  35002. }
  35003. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35004. // In case of HTML, we need a different computation
  35005. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35006. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35007. height = _getWindowSizes.height,
  35008. width = _getWindowSizes.width;
  35009. boundaries.top += offsets.top - offsets.marginTop;
  35010. boundaries.bottom = height + offsets.top;
  35011. boundaries.left += offsets.left - offsets.marginLeft;
  35012. boundaries.right = width + offsets.left;
  35013. } else {
  35014. // for all the other DOM elements, this one is good
  35015. boundaries = offsets;
  35016. }
  35017. }
  35018. // Add paddings
  35019. padding = padding || 0;
  35020. var isPaddingNumber = typeof padding === 'number';
  35021. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35022. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35023. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35024. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35025. return boundaries;
  35026. }
  35027. function getArea(_ref) {
  35028. var width = _ref.width,
  35029. height = _ref.height;
  35030. return width * height;
  35031. }
  35032. /**
  35033. * Utility used to transform the `auto` placement to the placement with more
  35034. * available space.
  35035. * @method
  35036. * @memberof Popper.Utils
  35037. * @argument {Object} data - The data object generated by update method
  35038. * @argument {Object} options - Modifiers configuration and options
  35039. * @returns {Object} The data object, properly modified
  35040. */
  35041. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35042. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35043. if (placement.indexOf('auto') === -1) {
  35044. return placement;
  35045. }
  35046. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35047. var rects = {
  35048. top: {
  35049. width: boundaries.width,
  35050. height: refRect.top - boundaries.top
  35051. },
  35052. right: {
  35053. width: boundaries.right - refRect.right,
  35054. height: boundaries.height
  35055. },
  35056. bottom: {
  35057. width: boundaries.width,
  35058. height: boundaries.bottom - refRect.bottom
  35059. },
  35060. left: {
  35061. width: refRect.left - boundaries.left,
  35062. height: boundaries.height
  35063. }
  35064. };
  35065. var sortedAreas = Object.keys(rects).map(function (key) {
  35066. return _extends({
  35067. key: key
  35068. }, rects[key], {
  35069. area: getArea(rects[key])
  35070. });
  35071. }).sort(function (a, b) {
  35072. return b.area - a.area;
  35073. });
  35074. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35075. var width = _ref2.width,
  35076. height = _ref2.height;
  35077. return width >= popper.clientWidth && height >= popper.clientHeight;
  35078. });
  35079. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35080. var variation = placement.split('-')[1];
  35081. return computedPlacement + (variation ? '-' + variation : '');
  35082. }
  35083. /**
  35084. * Get offsets to the reference element
  35085. * @method
  35086. * @memberof Popper.Utils
  35087. * @param {Object} state
  35088. * @param {Element} popper - the popper element
  35089. * @param {Element} reference - the reference element (the popper will be relative to this)
  35090. * @param {Element} fixedPosition - is in fixed position mode
  35091. * @returns {Object} An object containing the offsets which will be applied to the popper
  35092. */
  35093. function getReferenceOffsets(state, popper, reference) {
  35094. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35095. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35096. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35097. }
  35098. /**
  35099. * Get the outer sizes of the given element (offset size + margins)
  35100. * @method
  35101. * @memberof Popper.Utils
  35102. * @argument {Element} element
  35103. * @returns {Object} object containing width and height properties
  35104. */
  35105. function getOuterSizes(element) {
  35106. var window = element.ownerDocument.defaultView;
  35107. var styles = window.getComputedStyle(element);
  35108. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35109. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35110. var result = {
  35111. width: element.offsetWidth + y,
  35112. height: element.offsetHeight + x
  35113. };
  35114. return result;
  35115. }
  35116. /**
  35117. * Get the opposite placement of the given one
  35118. * @method
  35119. * @memberof Popper.Utils
  35120. * @argument {String} placement
  35121. * @returns {String} flipped placement
  35122. */
  35123. function getOppositePlacement(placement) {
  35124. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35125. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35126. return hash[matched];
  35127. });
  35128. }
  35129. /**
  35130. * Get offsets to the popper
  35131. * @method
  35132. * @memberof Popper.Utils
  35133. * @param {Object} position - CSS position the Popper will get applied
  35134. * @param {HTMLElement} popper - the popper element
  35135. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35136. * @param {String} placement - one of the valid placement options
  35137. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35138. */
  35139. function getPopperOffsets(popper, referenceOffsets, placement) {
  35140. placement = placement.split('-')[0];
  35141. // Get popper node sizes
  35142. var popperRect = getOuterSizes(popper);
  35143. // Add position, width and height to our offsets object
  35144. var popperOffsets = {
  35145. width: popperRect.width,
  35146. height: popperRect.height
  35147. };
  35148. // depending by the popper placement we have to compute its offsets slightly differently
  35149. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35150. var mainSide = isHoriz ? 'top' : 'left';
  35151. var secondarySide = isHoriz ? 'left' : 'top';
  35152. var measurement = isHoriz ? 'height' : 'width';
  35153. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35154. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35155. if (placement === secondarySide) {
  35156. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35157. } else {
  35158. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35159. }
  35160. return popperOffsets;
  35161. }
  35162. /**
  35163. * Mimics the `find` method of Array
  35164. * @method
  35165. * @memberof Popper.Utils
  35166. * @argument {Array} arr
  35167. * @argument prop
  35168. * @argument value
  35169. * @returns index or -1
  35170. */
  35171. function find(arr, check) {
  35172. // use native find if supported
  35173. if (Array.prototype.find) {
  35174. return arr.find(check);
  35175. }
  35176. // use `filter` to obtain the same behavior of `find`
  35177. return arr.filter(check)[0];
  35178. }
  35179. /**
  35180. * Return the index of the matching object
  35181. * @method
  35182. * @memberof Popper.Utils
  35183. * @argument {Array} arr
  35184. * @argument prop
  35185. * @argument value
  35186. * @returns index or -1
  35187. */
  35188. function findIndex(arr, prop, value) {
  35189. // use native findIndex if supported
  35190. if (Array.prototype.findIndex) {
  35191. return arr.findIndex(function (cur) {
  35192. return cur[prop] === value;
  35193. });
  35194. }
  35195. // use `find` + `indexOf` if `findIndex` isn't supported
  35196. var match = find(arr, function (obj) {
  35197. return obj[prop] === value;
  35198. });
  35199. return arr.indexOf(match);
  35200. }
  35201. /**
  35202. * Loop trough the list of modifiers and run them in order,
  35203. * each of them will then edit the data object.
  35204. * @method
  35205. * @memberof Popper.Utils
  35206. * @param {dataObject} data
  35207. * @param {Array} modifiers
  35208. * @param {String} ends - Optional modifier name used as stopper
  35209. * @returns {dataObject}
  35210. */
  35211. function runModifiers(modifiers, data, ends) {
  35212. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35213. modifiersToRun.forEach(function (modifier) {
  35214. if (modifier['function']) {
  35215. // eslint-disable-line dot-notation
  35216. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35217. }
  35218. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35219. if (modifier.enabled && isFunction(fn)) {
  35220. // Add properties to offsets to make them a complete clientRect object
  35221. // we do this before each modifier to make sure the previous one doesn't
  35222. // mess with these values
  35223. data.offsets.popper = getClientRect(data.offsets.popper);
  35224. data.offsets.reference = getClientRect(data.offsets.reference);
  35225. data = fn(data, modifier);
  35226. }
  35227. });
  35228. return data;
  35229. }
  35230. /**
  35231. * Updates the position of the popper, computing the new offsets and applying
  35232. * the new style.<br />
  35233. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35234. * @method
  35235. * @memberof Popper
  35236. */
  35237. function update() {
  35238. // if popper is destroyed, don't perform any further update
  35239. if (this.state.isDestroyed) {
  35240. return;
  35241. }
  35242. var data = {
  35243. instance: this,
  35244. styles: {},
  35245. arrowStyles: {},
  35246. attributes: {},
  35247. flipped: false,
  35248. offsets: {}
  35249. };
  35250. // compute reference element offsets
  35251. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35252. // compute auto placement, store placement inside the data object,
  35253. // modifiers will be able to edit `placement` if needed
  35254. // and refer to originalPlacement to know the original value
  35255. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35256. // store the computed placement inside `originalPlacement`
  35257. data.originalPlacement = data.placement;
  35258. data.positionFixed = this.options.positionFixed;
  35259. // compute the popper offsets
  35260. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35261. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35262. // run the modifiers
  35263. data = runModifiers(this.modifiers, data);
  35264. // the first `update` will call `onCreate` callback
  35265. // the other ones will call `onUpdate` callback
  35266. if (!this.state.isCreated) {
  35267. this.state.isCreated = true;
  35268. this.options.onCreate(data);
  35269. } else {
  35270. this.options.onUpdate(data);
  35271. }
  35272. }
  35273. /**
  35274. * Helper used to know if the given modifier is enabled.
  35275. * @method
  35276. * @memberof Popper.Utils
  35277. * @returns {Boolean}
  35278. */
  35279. function isModifierEnabled(modifiers, modifierName) {
  35280. return modifiers.some(function (_ref) {
  35281. var name = _ref.name,
  35282. enabled = _ref.enabled;
  35283. return enabled && name === modifierName;
  35284. });
  35285. }
  35286. /**
  35287. * Get the prefixed supported property name
  35288. * @method
  35289. * @memberof Popper.Utils
  35290. * @argument {String} property (camelCase)
  35291. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35292. */
  35293. function getSupportedPropertyName(property) {
  35294. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35295. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35296. for (var i = 0; i < prefixes.length; i++) {
  35297. var prefix = prefixes[i];
  35298. var toCheck = prefix ? '' + prefix + upperProp : property;
  35299. if (typeof document.body.style[toCheck] !== 'undefined') {
  35300. return toCheck;
  35301. }
  35302. }
  35303. return null;
  35304. }
  35305. /**
  35306. * Destroys the popper.
  35307. * @method
  35308. * @memberof Popper
  35309. */
  35310. function destroy() {
  35311. this.state.isDestroyed = true;
  35312. // touch DOM only if `applyStyle` modifier is enabled
  35313. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35314. this.popper.removeAttribute('x-placement');
  35315. this.popper.style.position = '';
  35316. this.popper.style.top = '';
  35317. this.popper.style.left = '';
  35318. this.popper.style.right = '';
  35319. this.popper.style.bottom = '';
  35320. this.popper.style.willChange = '';
  35321. this.popper.style[getSupportedPropertyName('transform')] = '';
  35322. }
  35323. this.disableEventListeners();
  35324. // remove the popper if user explicitly asked for the deletion on destroy
  35325. // do not use `remove` because IE11 doesn't support it
  35326. if (this.options.removeOnDestroy) {
  35327. this.popper.parentNode.removeChild(this.popper);
  35328. }
  35329. return this;
  35330. }
  35331. /**
  35332. * Get the window associated with the element
  35333. * @argument {Element} element
  35334. * @returns {Window}
  35335. */
  35336. function getWindow(element) {
  35337. var ownerDocument = element.ownerDocument;
  35338. return ownerDocument ? ownerDocument.defaultView : window;
  35339. }
  35340. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35341. var isBody = scrollParent.nodeName === 'BODY';
  35342. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35343. target.addEventListener(event, callback, { passive: true });
  35344. if (!isBody) {
  35345. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35346. }
  35347. scrollParents.push(target);
  35348. }
  35349. /**
  35350. * Setup needed event listeners used to update the popper position
  35351. * @method
  35352. * @memberof Popper.Utils
  35353. * @private
  35354. */
  35355. function setupEventListeners(reference, options, state, updateBound) {
  35356. // Resize event listener on window
  35357. state.updateBound = updateBound;
  35358. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35359. // Scroll event listener on scroll parents
  35360. var scrollElement = getScrollParent(reference);
  35361. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35362. state.scrollElement = scrollElement;
  35363. state.eventsEnabled = true;
  35364. return state;
  35365. }
  35366. /**
  35367. * It will add resize/scroll events and start recalculating
  35368. * position of the popper element when they are triggered.
  35369. * @method
  35370. * @memberof Popper
  35371. */
  35372. function enableEventListeners() {
  35373. if (!this.state.eventsEnabled) {
  35374. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35375. }
  35376. }
  35377. /**
  35378. * Remove event listeners used to update the popper position
  35379. * @method
  35380. * @memberof Popper.Utils
  35381. * @private
  35382. */
  35383. function removeEventListeners(reference, state) {
  35384. // Remove resize event listener on window
  35385. getWindow(reference).removeEventListener('resize', state.updateBound);
  35386. // Remove scroll event listener on scroll parents
  35387. state.scrollParents.forEach(function (target) {
  35388. target.removeEventListener('scroll', state.updateBound);
  35389. });
  35390. // Reset state
  35391. state.updateBound = null;
  35392. state.scrollParents = [];
  35393. state.scrollElement = null;
  35394. state.eventsEnabled = false;
  35395. return state;
  35396. }
  35397. /**
  35398. * It will remove resize/scroll events and won't recalculate popper position
  35399. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35400. * unless you call `update` method manually.
  35401. * @method
  35402. * @memberof Popper
  35403. */
  35404. function disableEventListeners() {
  35405. if (this.state.eventsEnabled) {
  35406. cancelAnimationFrame(this.scheduleUpdate);
  35407. this.state = removeEventListeners(this.reference, this.state);
  35408. }
  35409. }
  35410. /**
  35411. * Tells if a given input is a number
  35412. * @method
  35413. * @memberof Popper.Utils
  35414. * @param {*} input to check
  35415. * @return {Boolean}
  35416. */
  35417. function isNumeric(n) {
  35418. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35419. }
  35420. /**
  35421. * Set the style to the given popper
  35422. * @method
  35423. * @memberof Popper.Utils
  35424. * @argument {Element} element - Element to apply the style to
  35425. * @argument {Object} styles
  35426. * Object with a list of properties and values which will be applied to the element
  35427. */
  35428. function setStyles(element, styles) {
  35429. Object.keys(styles).forEach(function (prop) {
  35430. var unit = '';
  35431. // add unit if the value is numeric and is one of the following
  35432. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35433. unit = 'px';
  35434. }
  35435. element.style[prop] = styles[prop] + unit;
  35436. });
  35437. }
  35438. /**
  35439. * Set the attributes to the given popper
  35440. * @method
  35441. * @memberof Popper.Utils
  35442. * @argument {Element} element - Element to apply the attributes to
  35443. * @argument {Object} styles
  35444. * Object with a list of properties and values which will be applied to the element
  35445. */
  35446. function setAttributes(element, attributes) {
  35447. Object.keys(attributes).forEach(function (prop) {
  35448. var value = attributes[prop];
  35449. if (value !== false) {
  35450. element.setAttribute(prop, attributes[prop]);
  35451. } else {
  35452. element.removeAttribute(prop);
  35453. }
  35454. });
  35455. }
  35456. /**
  35457. * @function
  35458. * @memberof Modifiers
  35459. * @argument {Object} data - The data object generated by `update` method
  35460. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35461. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35462. * @argument {Object} options - Modifiers configuration and options
  35463. * @returns {Object} The same data object
  35464. */
  35465. function applyStyle(data) {
  35466. // any property present in `data.styles` will be applied to the popper,
  35467. // in this way we can make the 3rd party modifiers add custom styles to it
  35468. // Be aware, modifiers could override the properties defined in the previous
  35469. // lines of this modifier!
  35470. setStyles(data.instance.popper, data.styles);
  35471. // any property present in `data.attributes` will be applied to the popper,
  35472. // they will be set as HTML attributes of the element
  35473. setAttributes(data.instance.popper, data.attributes);
  35474. // if arrowElement is defined and arrowStyles has some properties
  35475. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35476. setStyles(data.arrowElement, data.arrowStyles);
  35477. }
  35478. return data;
  35479. }
  35480. /**
  35481. * Set the x-placement attribute before everything else because it could be used
  35482. * to add margins to the popper margins needs to be calculated to get the
  35483. * correct popper offsets.
  35484. * @method
  35485. * @memberof Popper.modifiers
  35486. * @param {HTMLElement} reference - The reference element used to position the popper
  35487. * @param {HTMLElement} popper - The HTML element used as popper
  35488. * @param {Object} options - Popper.js options
  35489. */
  35490. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35491. // compute reference element offsets
  35492. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35493. // compute auto placement, store placement inside the data object,
  35494. // modifiers will be able to edit `placement` if needed
  35495. // and refer to originalPlacement to know the original value
  35496. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35497. popper.setAttribute('x-placement', placement);
  35498. // Apply `position` to popper before anything else because
  35499. // without the position applied we can't guarantee correct computations
  35500. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35501. return options;
  35502. }
  35503. /**
  35504. * @function
  35505. * @memberof Popper.Utils
  35506. * @argument {Object} data - The data object generated by `update` method
  35507. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35508. * @returns {Object} The popper's position offsets rounded
  35509. *
  35510. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35511. * good as it can be within reason.
  35512. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35513. *
  35514. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35515. * as well on High DPI screens).
  35516. *
  35517. * Firefox prefers no rounding for positioning and does not have blurriness on
  35518. * high DPI screens.
  35519. *
  35520. * Only horizontal placement and left/right values need to be considered.
  35521. */
  35522. function getRoundedOffsets(data, shouldRound) {
  35523. var _data$offsets = data.offsets,
  35524. popper = _data$offsets.popper,
  35525. reference = _data$offsets.reference;
  35526. var round = Math.round,
  35527. floor = Math.floor;
  35528. var noRound = function noRound(v) {
  35529. return v;
  35530. };
  35531. var referenceWidth = round(reference.width);
  35532. var popperWidth = round(popper.width);
  35533. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35534. var isVariation = data.placement.indexOf('-') !== -1;
  35535. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35536. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35537. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35538. var verticalToInteger = !shouldRound ? noRound : round;
  35539. return {
  35540. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35541. top: verticalToInteger(popper.top),
  35542. bottom: verticalToInteger(popper.bottom),
  35543. right: horizontalToInteger(popper.right)
  35544. };
  35545. }
  35546. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35547. /**
  35548. * @function
  35549. * @memberof Modifiers
  35550. * @argument {Object} data - The data object generated by `update` method
  35551. * @argument {Object} options - Modifiers configuration and options
  35552. * @returns {Object} The data object, properly modified
  35553. */
  35554. function computeStyle(data, options) {
  35555. var x = options.x,
  35556. y = options.y;
  35557. var popper = data.offsets.popper;
  35558. // Remove this legacy support in Popper.js v2
  35559. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35560. return modifier.name === 'applyStyle';
  35561. }).gpuAcceleration;
  35562. if (legacyGpuAccelerationOption !== undefined) {
  35563. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35564. }
  35565. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35566. var offsetParent = getOffsetParent(data.instance.popper);
  35567. var offsetParentRect = getBoundingClientRect(offsetParent);
  35568. // Styles
  35569. var styles = {
  35570. position: popper.position
  35571. };
  35572. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35573. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35574. var sideB = y === 'right' ? 'left' : 'right';
  35575. // if gpuAcceleration is set to `true` and transform is supported,
  35576. // we use `translate3d` to apply the position to the popper we
  35577. // automatically use the supported prefixed version if needed
  35578. var prefixedProperty = getSupportedPropertyName('transform');
  35579. // now, let's make a step back and look at this code closely (wtf?)
  35580. // If the content of the popper grows once it's been positioned, it
  35581. // may happen that the popper gets misplaced because of the new content
  35582. // overflowing its reference element
  35583. // To avoid this problem, we provide two options (x and y), which allow
  35584. // the consumer to define the offset origin.
  35585. // If we position a popper on top of a reference element, we can set
  35586. // `x` to `top` to make the popper grow towards its top instead of
  35587. // its bottom.
  35588. var left = void 0,
  35589. top = void 0;
  35590. if (sideA === 'bottom') {
  35591. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35592. // and not the bottom of the html element
  35593. if (offsetParent.nodeName === 'HTML') {
  35594. top = -offsetParent.clientHeight + offsets.bottom;
  35595. } else {
  35596. top = -offsetParentRect.height + offsets.bottom;
  35597. }
  35598. } else {
  35599. top = offsets.top;
  35600. }
  35601. if (sideB === 'right') {
  35602. if (offsetParent.nodeName === 'HTML') {
  35603. left = -offsetParent.clientWidth + offsets.right;
  35604. } else {
  35605. left = -offsetParentRect.width + offsets.right;
  35606. }
  35607. } else {
  35608. left = offsets.left;
  35609. }
  35610. if (gpuAcceleration && prefixedProperty) {
  35611. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35612. styles[sideA] = 0;
  35613. styles[sideB] = 0;
  35614. styles.willChange = 'transform';
  35615. } else {
  35616. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35617. var invertTop = sideA === 'bottom' ? -1 : 1;
  35618. var invertLeft = sideB === 'right' ? -1 : 1;
  35619. styles[sideA] = top * invertTop;
  35620. styles[sideB] = left * invertLeft;
  35621. styles.willChange = sideA + ', ' + sideB;
  35622. }
  35623. // Attributes
  35624. var attributes = {
  35625. 'x-placement': data.placement
  35626. };
  35627. // Update `data` attributes, styles and arrowStyles
  35628. data.attributes = _extends({}, attributes, data.attributes);
  35629. data.styles = _extends({}, styles, data.styles);
  35630. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35631. return data;
  35632. }
  35633. /**
  35634. * Helper used to know if the given modifier depends from another one.<br />
  35635. * It checks if the needed modifier is listed and enabled.
  35636. * @method
  35637. * @memberof Popper.Utils
  35638. * @param {Array} modifiers - list of modifiers
  35639. * @param {String} requestingName - name of requesting modifier
  35640. * @param {String} requestedName - name of requested modifier
  35641. * @returns {Boolean}
  35642. */
  35643. function isModifierRequired(modifiers, requestingName, requestedName) {
  35644. var requesting = find(modifiers, function (_ref) {
  35645. var name = _ref.name;
  35646. return name === requestingName;
  35647. });
  35648. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35649. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35650. });
  35651. if (!isRequired) {
  35652. var _requesting = '`' + requestingName + '`';
  35653. var requested = '`' + requestedName + '`';
  35654. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35655. }
  35656. return isRequired;
  35657. }
  35658. /**
  35659. * @function
  35660. * @memberof Modifiers
  35661. * @argument {Object} data - The data object generated by update method
  35662. * @argument {Object} options - Modifiers configuration and options
  35663. * @returns {Object} The data object, properly modified
  35664. */
  35665. function arrow(data, options) {
  35666. var _data$offsets$arrow;
  35667. // arrow depends on keepTogether in order to work
  35668. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35669. return data;
  35670. }
  35671. var arrowElement = options.element;
  35672. // if arrowElement is a string, suppose it's a CSS selector
  35673. if (typeof arrowElement === 'string') {
  35674. arrowElement = data.instance.popper.querySelector(arrowElement);
  35675. // if arrowElement is not found, don't run the modifier
  35676. if (!arrowElement) {
  35677. return data;
  35678. }
  35679. } else {
  35680. // if the arrowElement isn't a query selector we must check that the
  35681. // provided DOM node is child of its popper node
  35682. if (!data.instance.popper.contains(arrowElement)) {
  35683. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35684. return data;
  35685. }
  35686. }
  35687. var placement = data.placement.split('-')[0];
  35688. var _data$offsets = data.offsets,
  35689. popper = _data$offsets.popper,
  35690. reference = _data$offsets.reference;
  35691. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35692. var len = isVertical ? 'height' : 'width';
  35693. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35694. var side = sideCapitalized.toLowerCase();
  35695. var altSide = isVertical ? 'left' : 'top';
  35696. var opSide = isVertical ? 'bottom' : 'right';
  35697. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35698. //
  35699. // extends keepTogether behavior making sure the popper and its
  35700. // reference have enough pixels in conjunction
  35701. //
  35702. // top/left side
  35703. if (reference[opSide] - arrowElementSize < popper[side]) {
  35704. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35705. }
  35706. // bottom/right side
  35707. if (reference[side] + arrowElementSize > popper[opSide]) {
  35708. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35709. }
  35710. data.offsets.popper = getClientRect(data.offsets.popper);
  35711. // compute center of the popper
  35712. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35713. // Compute the sideValue using the updated popper offsets
  35714. // take popper margin in account because we don't have this info available
  35715. var css = getStyleComputedProperty(data.instance.popper);
  35716. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35717. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35718. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35719. // prevent arrowElement from being placed not contiguously to its popper
  35720. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35721. data.arrowElement = arrowElement;
  35722. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35723. return data;
  35724. }
  35725. /**
  35726. * Get the opposite placement variation of the given one
  35727. * @method
  35728. * @memberof Popper.Utils
  35729. * @argument {String} placement variation
  35730. * @returns {String} flipped placement variation
  35731. */
  35732. function getOppositeVariation(variation) {
  35733. if (variation === 'end') {
  35734. return 'start';
  35735. } else if (variation === 'start') {
  35736. return 'end';
  35737. }
  35738. return variation;
  35739. }
  35740. /**
  35741. * List of accepted placements to use as values of the `placement` option.<br />
  35742. * Valid placements are:
  35743. * - `auto`
  35744. * - `top`
  35745. * - `right`
  35746. * - `bottom`
  35747. * - `left`
  35748. *
  35749. * Each placement can have a variation from this list:
  35750. * - `-start`
  35751. * - `-end`
  35752. *
  35753. * Variations are interpreted easily if you think of them as the left to right
  35754. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35755. * is right.<br />
  35756. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35757. *
  35758. * Some valid examples are:
  35759. * - `top-end` (on top of reference, right aligned)
  35760. * - `right-start` (on right of reference, top aligned)
  35761. * - `bottom` (on bottom, centered)
  35762. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35763. *
  35764. * @static
  35765. * @type {Array}
  35766. * @enum {String}
  35767. * @readonly
  35768. * @method placements
  35769. * @memberof Popper
  35770. */
  35771. 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'];
  35772. // Get rid of `auto` `auto-start` and `auto-end`
  35773. var validPlacements = placements.slice(3);
  35774. /**
  35775. * Given an initial placement, returns all the subsequent placements
  35776. * clockwise (or counter-clockwise).
  35777. *
  35778. * @method
  35779. * @memberof Popper.Utils
  35780. * @argument {String} placement - A valid placement (it accepts variations)
  35781. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35782. * @returns {Array} placements including their variations
  35783. */
  35784. function clockwise(placement) {
  35785. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35786. var index = validPlacements.indexOf(placement);
  35787. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35788. return counter ? arr.reverse() : arr;
  35789. }
  35790. var BEHAVIORS = {
  35791. FLIP: 'flip',
  35792. CLOCKWISE: 'clockwise',
  35793. COUNTERCLOCKWISE: 'counterclockwise'
  35794. };
  35795. /**
  35796. * @function
  35797. * @memberof Modifiers
  35798. * @argument {Object} data - The data object generated by update method
  35799. * @argument {Object} options - Modifiers configuration and options
  35800. * @returns {Object} The data object, properly modified
  35801. */
  35802. function flip(data, options) {
  35803. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35804. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35805. return data;
  35806. }
  35807. if (data.flipped && data.placement === data.originalPlacement) {
  35808. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35809. return data;
  35810. }
  35811. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35812. var placement = data.placement.split('-')[0];
  35813. var placementOpposite = getOppositePlacement(placement);
  35814. var variation = data.placement.split('-')[1] || '';
  35815. var flipOrder = [];
  35816. switch (options.behavior) {
  35817. case BEHAVIORS.FLIP:
  35818. flipOrder = [placement, placementOpposite];
  35819. break;
  35820. case BEHAVIORS.CLOCKWISE:
  35821. flipOrder = clockwise(placement);
  35822. break;
  35823. case BEHAVIORS.COUNTERCLOCKWISE:
  35824. flipOrder = clockwise(placement, true);
  35825. break;
  35826. default:
  35827. flipOrder = options.behavior;
  35828. }
  35829. flipOrder.forEach(function (step, index) {
  35830. if (placement !== step || flipOrder.length === index + 1) {
  35831. return data;
  35832. }
  35833. placement = data.placement.split('-')[0];
  35834. placementOpposite = getOppositePlacement(placement);
  35835. var popperOffsets = data.offsets.popper;
  35836. var refOffsets = data.offsets.reference;
  35837. // using floor because the reference offsets may contain decimals we are not going to consider here
  35838. var floor = Math.floor;
  35839. 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);
  35840. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35841. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35842. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35843. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35844. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35845. // flip the variation if required
  35846. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35847. // flips variation if reference element overflows boundaries
  35848. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35849. // flips variation if popper content overflows boundaries
  35850. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35851. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35852. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35853. // this boolean to detect any flip loop
  35854. data.flipped = true;
  35855. if (overlapsRef || overflowsBoundaries) {
  35856. placement = flipOrder[index + 1];
  35857. }
  35858. if (flippedVariation) {
  35859. variation = getOppositeVariation(variation);
  35860. }
  35861. data.placement = placement + (variation ? '-' + variation : '');
  35862. // this object contains `position`, we want to preserve it along with
  35863. // any additional property we may add in the future
  35864. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35865. data = runModifiers(data.instance.modifiers, data, 'flip');
  35866. }
  35867. });
  35868. return data;
  35869. }
  35870. /**
  35871. * @function
  35872. * @memberof Modifiers
  35873. * @argument {Object} data - The data object generated by update method
  35874. * @argument {Object} options - Modifiers configuration and options
  35875. * @returns {Object} The data object, properly modified
  35876. */
  35877. function keepTogether(data) {
  35878. var _data$offsets = data.offsets,
  35879. popper = _data$offsets.popper,
  35880. reference = _data$offsets.reference;
  35881. var placement = data.placement.split('-')[0];
  35882. var floor = Math.floor;
  35883. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35884. var side = isVertical ? 'right' : 'bottom';
  35885. var opSide = isVertical ? 'left' : 'top';
  35886. var measurement = isVertical ? 'width' : 'height';
  35887. if (popper[side] < floor(reference[opSide])) {
  35888. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35889. }
  35890. if (popper[opSide] > floor(reference[side])) {
  35891. data.offsets.popper[opSide] = floor(reference[side]);
  35892. }
  35893. return data;
  35894. }
  35895. /**
  35896. * Converts a string containing value + unit into a px value number
  35897. * @function
  35898. * @memberof {modifiers~offset}
  35899. * @private
  35900. * @argument {String} str - Value + unit string
  35901. * @argument {String} measurement - `height` or `width`
  35902. * @argument {Object} popperOffsets
  35903. * @argument {Object} referenceOffsets
  35904. * @returns {Number|String}
  35905. * Value in pixels, or original string if no values were extracted
  35906. */
  35907. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35908. // separate value from unit
  35909. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35910. var value = +split[1];
  35911. var unit = split[2];
  35912. // If it's not a number it's an operator, I guess
  35913. if (!value) {
  35914. return str;
  35915. }
  35916. if (unit.indexOf('%') === 0) {
  35917. var element = void 0;
  35918. switch (unit) {
  35919. case '%p':
  35920. element = popperOffsets;
  35921. break;
  35922. case '%':
  35923. case '%r':
  35924. default:
  35925. element = referenceOffsets;
  35926. }
  35927. var rect = getClientRect(element);
  35928. return rect[measurement] / 100 * value;
  35929. } else if (unit === 'vh' || unit === 'vw') {
  35930. // if is a vh or vw, we calculate the size based on the viewport
  35931. var size = void 0;
  35932. if (unit === 'vh') {
  35933. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35934. } else {
  35935. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35936. }
  35937. return size / 100 * value;
  35938. } else {
  35939. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35940. // if is an implicit unit, it's px, and we return just the value
  35941. return value;
  35942. }
  35943. }
  35944. /**
  35945. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35946. * @function
  35947. * @memberof {modifiers~offset}
  35948. * @private
  35949. * @argument {String} offset
  35950. * @argument {Object} popperOffsets
  35951. * @argument {Object} referenceOffsets
  35952. * @argument {String} basePlacement
  35953. * @returns {Array} a two cells array with x and y offsets in numbers
  35954. */
  35955. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35956. var offsets = [0, 0];
  35957. // Use height if placement is left or right and index is 0 otherwise use width
  35958. // in this way the first offset will use an axis and the second one
  35959. // will use the other one
  35960. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35961. // Split the offset string to obtain a list of values and operands
  35962. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35963. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35964. return frag.trim();
  35965. });
  35966. // Detect if the offset string contains a pair of values or a single one
  35967. // they could be separated by comma or space
  35968. var divider = fragments.indexOf(find(fragments, function (frag) {
  35969. return frag.search(/,|\s/) !== -1;
  35970. }));
  35971. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35972. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35973. }
  35974. // If divider is found, we divide the list of values and operands to divide
  35975. // them by ofset X and Y.
  35976. var splitRegex = /\s*,\s*|\s+/;
  35977. 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];
  35978. // Convert the values with units to absolute pixels to allow our computations
  35979. ops = ops.map(function (op, index) {
  35980. // Most of the units rely on the orientation of the popper
  35981. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35982. var mergeWithPrevious = false;
  35983. return op
  35984. // This aggregates any `+` or `-` sign that aren't considered operators
  35985. // e.g.: 10 + +5 => [10, +, +5]
  35986. .reduce(function (a, b) {
  35987. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35988. a[a.length - 1] = b;
  35989. mergeWithPrevious = true;
  35990. return a;
  35991. } else if (mergeWithPrevious) {
  35992. a[a.length - 1] += b;
  35993. mergeWithPrevious = false;
  35994. return a;
  35995. } else {
  35996. return a.concat(b);
  35997. }
  35998. }, [])
  35999. // Here we convert the string values into number values (in px)
  36000. .map(function (str) {
  36001. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36002. });
  36003. });
  36004. // Loop trough the offsets arrays and execute the operations
  36005. ops.forEach(function (op, index) {
  36006. op.forEach(function (frag, index2) {
  36007. if (isNumeric(frag)) {
  36008. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36009. }
  36010. });
  36011. });
  36012. return offsets;
  36013. }
  36014. /**
  36015. * @function
  36016. * @memberof Modifiers
  36017. * @argument {Object} data - The data object generated by update method
  36018. * @argument {Object} options - Modifiers configuration and options
  36019. * @argument {Number|String} options.offset=0
  36020. * The offset value as described in the modifier description
  36021. * @returns {Object} The data object, properly modified
  36022. */
  36023. function offset(data, _ref) {
  36024. var offset = _ref.offset;
  36025. var placement = data.placement,
  36026. _data$offsets = data.offsets,
  36027. popper = _data$offsets.popper,
  36028. reference = _data$offsets.reference;
  36029. var basePlacement = placement.split('-')[0];
  36030. var offsets = void 0;
  36031. if (isNumeric(+offset)) {
  36032. offsets = [+offset, 0];
  36033. } else {
  36034. offsets = parseOffset(offset, popper, reference, basePlacement);
  36035. }
  36036. if (basePlacement === 'left') {
  36037. popper.top += offsets[0];
  36038. popper.left -= offsets[1];
  36039. } else if (basePlacement === 'right') {
  36040. popper.top += offsets[0];
  36041. popper.left += offsets[1];
  36042. } else if (basePlacement === 'top') {
  36043. popper.left += offsets[0];
  36044. popper.top -= offsets[1];
  36045. } else if (basePlacement === 'bottom') {
  36046. popper.left += offsets[0];
  36047. popper.top += offsets[1];
  36048. }
  36049. data.popper = popper;
  36050. return data;
  36051. }
  36052. /**
  36053. * @function
  36054. * @memberof Modifiers
  36055. * @argument {Object} data - The data object generated by `update` method
  36056. * @argument {Object} options - Modifiers configuration and options
  36057. * @returns {Object} The data object, properly modified
  36058. */
  36059. function preventOverflow(data, options) {
  36060. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36061. // If offsetParent is the reference element, we really want to
  36062. // go one step up and use the next offsetParent as reference to
  36063. // avoid to make this modifier completely useless and look like broken
  36064. if (data.instance.reference === boundariesElement) {
  36065. boundariesElement = getOffsetParent(boundariesElement);
  36066. }
  36067. // NOTE: DOM access here
  36068. // resets the popper's position so that the document size can be calculated excluding
  36069. // the size of the popper element itself
  36070. var transformProp = getSupportedPropertyName('transform');
  36071. var popperStyles = data.instance.popper.style; // assignment to help minification
  36072. var top = popperStyles.top,
  36073. left = popperStyles.left,
  36074. transform = popperStyles[transformProp];
  36075. popperStyles.top = '';
  36076. popperStyles.left = '';
  36077. popperStyles[transformProp] = '';
  36078. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36079. // NOTE: DOM access here
  36080. // restores the original style properties after the offsets have been computed
  36081. popperStyles.top = top;
  36082. popperStyles.left = left;
  36083. popperStyles[transformProp] = transform;
  36084. options.boundaries = boundaries;
  36085. var order = options.priority;
  36086. var popper = data.offsets.popper;
  36087. var check = {
  36088. primary: function primary(placement) {
  36089. var value = popper[placement];
  36090. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36091. value = Math.max(popper[placement], boundaries[placement]);
  36092. }
  36093. return defineProperty({}, placement, value);
  36094. },
  36095. secondary: function secondary(placement) {
  36096. var mainSide = placement === 'right' ? 'left' : 'top';
  36097. var value = popper[mainSide];
  36098. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36099. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36100. }
  36101. return defineProperty({}, mainSide, value);
  36102. }
  36103. };
  36104. order.forEach(function (placement) {
  36105. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36106. popper = _extends({}, popper, check[side](placement));
  36107. });
  36108. data.offsets.popper = popper;
  36109. return data;
  36110. }
  36111. /**
  36112. * @function
  36113. * @memberof Modifiers
  36114. * @argument {Object} data - The data object generated by `update` method
  36115. * @argument {Object} options - Modifiers configuration and options
  36116. * @returns {Object} The data object, properly modified
  36117. */
  36118. function shift(data) {
  36119. var placement = data.placement;
  36120. var basePlacement = placement.split('-')[0];
  36121. var shiftvariation = placement.split('-')[1];
  36122. // if shift shiftvariation is specified, run the modifier
  36123. if (shiftvariation) {
  36124. var _data$offsets = data.offsets,
  36125. reference = _data$offsets.reference,
  36126. popper = _data$offsets.popper;
  36127. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36128. var side = isVertical ? 'left' : 'top';
  36129. var measurement = isVertical ? 'width' : 'height';
  36130. var shiftOffsets = {
  36131. start: defineProperty({}, side, reference[side]),
  36132. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36133. };
  36134. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36135. }
  36136. return data;
  36137. }
  36138. /**
  36139. * @function
  36140. * @memberof Modifiers
  36141. * @argument {Object} data - The data object generated by update method
  36142. * @argument {Object} options - Modifiers configuration and options
  36143. * @returns {Object} The data object, properly modified
  36144. */
  36145. function hide(data) {
  36146. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36147. return data;
  36148. }
  36149. var refRect = data.offsets.reference;
  36150. var bound = find(data.instance.modifiers, function (modifier) {
  36151. return modifier.name === 'preventOverflow';
  36152. }).boundaries;
  36153. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36154. // Avoid unnecessary DOM access if visibility hasn't changed
  36155. if (data.hide === true) {
  36156. return data;
  36157. }
  36158. data.hide = true;
  36159. data.attributes['x-out-of-boundaries'] = '';
  36160. } else {
  36161. // Avoid unnecessary DOM access if visibility hasn't changed
  36162. if (data.hide === false) {
  36163. return data;
  36164. }
  36165. data.hide = false;
  36166. data.attributes['x-out-of-boundaries'] = false;
  36167. }
  36168. return data;
  36169. }
  36170. /**
  36171. * @function
  36172. * @memberof Modifiers
  36173. * @argument {Object} data - The data object generated by `update` method
  36174. * @argument {Object} options - Modifiers configuration and options
  36175. * @returns {Object} The data object, properly modified
  36176. */
  36177. function inner(data) {
  36178. var placement = data.placement;
  36179. var basePlacement = placement.split('-')[0];
  36180. var _data$offsets = data.offsets,
  36181. popper = _data$offsets.popper,
  36182. reference = _data$offsets.reference;
  36183. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36184. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36185. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36186. data.placement = getOppositePlacement(placement);
  36187. data.offsets.popper = getClientRect(popper);
  36188. return data;
  36189. }
  36190. /**
  36191. * Modifier function, each modifier can have a function of this type assigned
  36192. * to its `fn` property.<br />
  36193. * These functions will be called on each update, this means that you must
  36194. * make sure they are performant enough to avoid performance bottlenecks.
  36195. *
  36196. * @function ModifierFn
  36197. * @argument {dataObject} data - The data object generated by `update` method
  36198. * @argument {Object} options - Modifiers configuration and options
  36199. * @returns {dataObject} The data object, properly modified
  36200. */
  36201. /**
  36202. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36203. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36204. * needed by the library.
  36205. *
  36206. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36207. * All the other properties are configurations that could be tweaked.
  36208. * @namespace modifiers
  36209. */
  36210. var modifiers = {
  36211. /**
  36212. * Modifier used to shift the popper on the start or end of its reference
  36213. * element.<br />
  36214. * It will read the variation of the `placement` property.<br />
  36215. * It can be one either `-end` or `-start`.
  36216. * @memberof modifiers
  36217. * @inner
  36218. */
  36219. shift: {
  36220. /** @prop {number} order=100 - Index used to define the order of execution */
  36221. order: 100,
  36222. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36223. enabled: true,
  36224. /** @prop {ModifierFn} */
  36225. fn: shift
  36226. },
  36227. /**
  36228. * The `offset` modifier can shift your popper on both its axis.
  36229. *
  36230. * It accepts the following units:
  36231. * - `px` or unit-less, interpreted as pixels
  36232. * - `%` or `%r`, percentage relative to the length of the reference element
  36233. * - `%p`, percentage relative to the length of the popper element
  36234. * - `vw`, CSS viewport width unit
  36235. * - `vh`, CSS viewport height unit
  36236. *
  36237. * For length is intended the main axis relative to the placement of the popper.<br />
  36238. * This means that if the placement is `top` or `bottom`, the length will be the
  36239. * `width`. In case of `left` or `right`, it will be the `height`.
  36240. *
  36241. * You can provide a single value (as `Number` or `String`), or a pair of values
  36242. * as `String` divided by a comma or one (or more) white spaces.<br />
  36243. * The latter is a deprecated method because it leads to confusion and will be
  36244. * removed in v2.<br />
  36245. * Additionally, it accepts additions and subtractions between different units.
  36246. * Note that multiplications and divisions aren't supported.
  36247. *
  36248. * Valid examples are:
  36249. * ```
  36250. * 10
  36251. * '10%'
  36252. * '10, 10'
  36253. * '10%, 10'
  36254. * '10 + 10%'
  36255. * '10 - 5vh + 3%'
  36256. * '-10px + 5vh, 5px - 6%'
  36257. * ```
  36258. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36259. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36260. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36261. *
  36262. * @memberof modifiers
  36263. * @inner
  36264. */
  36265. offset: {
  36266. /** @prop {number} order=200 - Index used to define the order of execution */
  36267. order: 200,
  36268. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36269. enabled: true,
  36270. /** @prop {ModifierFn} */
  36271. fn: offset,
  36272. /** @prop {Number|String} offset=0
  36273. * The offset value as described in the modifier description
  36274. */
  36275. offset: 0
  36276. },
  36277. /**
  36278. * Modifier used to prevent the popper from being positioned outside the boundary.
  36279. *
  36280. * A scenario exists where the reference itself is not within the boundaries.<br />
  36281. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36282. * In this case we need to decide whether the popper should either:
  36283. *
  36284. * - detach from the reference and remain "trapped" in the boundaries, or
  36285. * - if it should ignore the boundary and "escape with its reference"
  36286. *
  36287. * When `escapeWithReference` is set to`true` and reference is completely
  36288. * outside its boundaries, the popper will overflow (or completely leave)
  36289. * the boundaries in order to remain attached to the edge of the reference.
  36290. *
  36291. * @memberof modifiers
  36292. * @inner
  36293. */
  36294. preventOverflow: {
  36295. /** @prop {number} order=300 - Index used to define the order of execution */
  36296. order: 300,
  36297. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36298. enabled: true,
  36299. /** @prop {ModifierFn} */
  36300. fn: preventOverflow,
  36301. /**
  36302. * @prop {Array} [priority=['left','right','top','bottom']]
  36303. * Popper will try to prevent overflow following these priorities by default,
  36304. * then, it could overflow on the left and on top of the `boundariesElement`
  36305. */
  36306. priority: ['left', 'right', 'top', 'bottom'],
  36307. /**
  36308. * @prop {number} padding=5
  36309. * Amount of pixel used to define a minimum distance between the boundaries
  36310. * and the popper. This makes sure the popper always has a little padding
  36311. * between the edges of its container
  36312. */
  36313. padding: 5,
  36314. /**
  36315. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36316. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36317. * `viewport` or any DOM element.
  36318. */
  36319. boundariesElement: 'scrollParent'
  36320. },
  36321. /**
  36322. * Modifier used to make sure the reference and its popper stay near each other
  36323. * without leaving any gap between the two. Especially useful when the arrow is
  36324. * enabled and you want to ensure that it points to its reference element.
  36325. * It cares only about the first axis. You can still have poppers with margin
  36326. * between the popper and its reference element.
  36327. * @memberof modifiers
  36328. * @inner
  36329. */
  36330. keepTogether: {
  36331. /** @prop {number} order=400 - Index used to define the order of execution */
  36332. order: 400,
  36333. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36334. enabled: true,
  36335. /** @prop {ModifierFn} */
  36336. fn: keepTogether
  36337. },
  36338. /**
  36339. * This modifier is used to move the `arrowElement` of the popper to make
  36340. * sure it is positioned between the reference element and its popper element.
  36341. * It will read the outer size of the `arrowElement` node to detect how many
  36342. * pixels of conjunction are needed.
  36343. *
  36344. * It has no effect if no `arrowElement` is provided.
  36345. * @memberof modifiers
  36346. * @inner
  36347. */
  36348. arrow: {
  36349. /** @prop {number} order=500 - Index used to define the order of execution */
  36350. order: 500,
  36351. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36352. enabled: true,
  36353. /** @prop {ModifierFn} */
  36354. fn: arrow,
  36355. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36356. element: '[x-arrow]'
  36357. },
  36358. /**
  36359. * Modifier used to flip the popper's placement when it starts to overlap its
  36360. * reference element.
  36361. *
  36362. * Requires the `preventOverflow` modifier before it in order to work.
  36363. *
  36364. * **NOTE:** this modifier will interrupt the current update cycle and will
  36365. * restart it if it detects the need to flip the placement.
  36366. * @memberof modifiers
  36367. * @inner
  36368. */
  36369. flip: {
  36370. /** @prop {number} order=600 - Index used to define the order of execution */
  36371. order: 600,
  36372. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36373. enabled: true,
  36374. /** @prop {ModifierFn} */
  36375. fn: flip,
  36376. /**
  36377. * @prop {String|Array} behavior='flip'
  36378. * The behavior used to change the popper's placement. It can be one of
  36379. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36380. * placements (with optional variations)
  36381. */
  36382. behavior: 'flip',
  36383. /**
  36384. * @prop {number} padding=5
  36385. * The popper will flip if it hits the edges of the `boundariesElement`
  36386. */
  36387. padding: 5,
  36388. /**
  36389. * @prop {String|HTMLElement} boundariesElement='viewport'
  36390. * The element which will define the boundaries of the popper position.
  36391. * The popper will never be placed outside of the defined boundaries
  36392. * (except if `keepTogether` is enabled)
  36393. */
  36394. boundariesElement: 'viewport',
  36395. /**
  36396. * @prop {Boolean} flipVariations=false
  36397. * The popper will switch placement variation between `-start` and `-end` when
  36398. * the reference element overlaps its boundaries.
  36399. *
  36400. * The original placement should have a set variation.
  36401. */
  36402. flipVariations: false,
  36403. /**
  36404. * @prop {Boolean} flipVariationsByContent=false
  36405. * The popper will switch placement variation between `-start` and `-end` when
  36406. * the popper element overlaps its reference boundaries.
  36407. *
  36408. * The original placement should have a set variation.
  36409. */
  36410. flipVariationsByContent: false
  36411. },
  36412. /**
  36413. * Modifier used to make the popper flow toward the inner of the reference element.
  36414. * By default, when this modifier is disabled, the popper will be placed outside
  36415. * the reference element.
  36416. * @memberof modifiers
  36417. * @inner
  36418. */
  36419. inner: {
  36420. /** @prop {number} order=700 - Index used to define the order of execution */
  36421. order: 700,
  36422. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36423. enabled: false,
  36424. /** @prop {ModifierFn} */
  36425. fn: inner
  36426. },
  36427. /**
  36428. * Modifier used to hide the popper when its reference element is outside of the
  36429. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36430. * be used to hide with a CSS selector the popper when its reference is
  36431. * out of boundaries.
  36432. *
  36433. * Requires the `preventOverflow` modifier before it in order to work.
  36434. * @memberof modifiers
  36435. * @inner
  36436. */
  36437. hide: {
  36438. /** @prop {number} order=800 - Index used to define the order of execution */
  36439. order: 800,
  36440. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36441. enabled: true,
  36442. /** @prop {ModifierFn} */
  36443. fn: hide
  36444. },
  36445. /**
  36446. * Computes the style that will be applied to the popper element to gets
  36447. * properly positioned.
  36448. *
  36449. * Note that this modifier will not touch the DOM, it just prepares the styles
  36450. * so that `applyStyle` modifier can apply it. This separation is useful
  36451. * in case you need to replace `applyStyle` with a custom implementation.
  36452. *
  36453. * This modifier has `850` as `order` value to maintain backward compatibility
  36454. * with previous versions of Popper.js. Expect the modifiers ordering method
  36455. * to change in future major versions of the library.
  36456. *
  36457. * @memberof modifiers
  36458. * @inner
  36459. */
  36460. computeStyle: {
  36461. /** @prop {number} order=850 - Index used to define the order of execution */
  36462. order: 850,
  36463. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36464. enabled: true,
  36465. /** @prop {ModifierFn} */
  36466. fn: computeStyle,
  36467. /**
  36468. * @prop {Boolean} gpuAcceleration=true
  36469. * If true, it uses the CSS 3D transformation to position the popper.
  36470. * Otherwise, it will use the `top` and `left` properties
  36471. */
  36472. gpuAcceleration: true,
  36473. /**
  36474. * @prop {string} [x='bottom']
  36475. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36476. * Change this if your popper should grow in a direction different from `bottom`
  36477. */
  36478. x: 'bottom',
  36479. /**
  36480. * @prop {string} [x='left']
  36481. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36482. * Change this if your popper should grow in a direction different from `right`
  36483. */
  36484. y: 'right'
  36485. },
  36486. /**
  36487. * Applies the computed styles to the popper element.
  36488. *
  36489. * All the DOM manipulations are limited to this modifier. This is useful in case
  36490. * you want to integrate Popper.js inside a framework or view library and you
  36491. * want to delegate all the DOM manipulations to it.
  36492. *
  36493. * Note that if you disable this modifier, you must make sure the popper element
  36494. * has its position set to `absolute` before Popper.js can do its work!
  36495. *
  36496. * Just disable this modifier and define your own to achieve the desired effect.
  36497. *
  36498. * @memberof modifiers
  36499. * @inner
  36500. */
  36501. applyStyle: {
  36502. /** @prop {number} order=900 - Index used to define the order of execution */
  36503. order: 900,
  36504. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36505. enabled: true,
  36506. /** @prop {ModifierFn} */
  36507. fn: applyStyle,
  36508. /** @prop {Function} */
  36509. onLoad: applyStyleOnLoad,
  36510. /**
  36511. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36512. * @prop {Boolean} gpuAcceleration=true
  36513. * If true, it uses the CSS 3D transformation to position the popper.
  36514. * Otherwise, it will use the `top` and `left` properties
  36515. */
  36516. gpuAcceleration: undefined
  36517. }
  36518. };
  36519. /**
  36520. * The `dataObject` is an object containing all the information used by Popper.js.
  36521. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36522. * @name dataObject
  36523. * @property {Object} data.instance The Popper.js instance
  36524. * @property {String} data.placement Placement applied to popper
  36525. * @property {String} data.originalPlacement Placement originally defined on init
  36526. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36527. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36528. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36529. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36530. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36531. * @property {Object} data.boundaries Offsets of the popper boundaries
  36532. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36533. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36534. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36535. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36536. */
  36537. /**
  36538. * Default options provided to Popper.js constructor.<br />
  36539. * These can be overridden using the `options` argument of Popper.js.<br />
  36540. * To override an option, simply pass an object with the same
  36541. * structure of the `options` object, as the 3rd argument. For example:
  36542. * ```
  36543. * new Popper(ref, pop, {
  36544. * modifiers: {
  36545. * preventOverflow: { enabled: false }
  36546. * }
  36547. * })
  36548. * ```
  36549. * @type {Object}
  36550. * @static
  36551. * @memberof Popper
  36552. */
  36553. var Defaults = {
  36554. /**
  36555. * Popper's placement.
  36556. * @prop {Popper.placements} placement='bottom'
  36557. */
  36558. placement: 'bottom',
  36559. /**
  36560. * Set this to true if you want popper to position it self in 'fixed' mode
  36561. * @prop {Boolean} positionFixed=false
  36562. */
  36563. positionFixed: false,
  36564. /**
  36565. * Whether events (resize, scroll) are initially enabled.
  36566. * @prop {Boolean} eventsEnabled=true
  36567. */
  36568. eventsEnabled: true,
  36569. /**
  36570. * Set to true if you want to automatically remove the popper when
  36571. * you call the `destroy` method.
  36572. * @prop {Boolean} removeOnDestroy=false
  36573. */
  36574. removeOnDestroy: false,
  36575. /**
  36576. * Callback called when the popper is created.<br />
  36577. * By default, it is set to no-op.<br />
  36578. * Access Popper.js instance with `data.instance`.
  36579. * @prop {onCreate}
  36580. */
  36581. onCreate: function onCreate() {},
  36582. /**
  36583. * Callback called when the popper is updated. This callback is not called
  36584. * on the initialization/creation of the popper, but only on subsequent
  36585. * updates.<br />
  36586. * By default, it is set to no-op.<br />
  36587. * Access Popper.js instance with `data.instance`.
  36588. * @prop {onUpdate}
  36589. */
  36590. onUpdate: function onUpdate() {},
  36591. /**
  36592. * List of modifiers used to modify the offsets before they are applied to the popper.
  36593. * They provide most of the functionalities of Popper.js.
  36594. * @prop {modifiers}
  36595. */
  36596. modifiers: modifiers
  36597. };
  36598. /**
  36599. * @callback onCreate
  36600. * @param {dataObject} data
  36601. */
  36602. /**
  36603. * @callback onUpdate
  36604. * @param {dataObject} data
  36605. */
  36606. // Utils
  36607. // Methods
  36608. var Popper = function () {
  36609. /**
  36610. * Creates a new Popper.js instance.
  36611. * @class Popper
  36612. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36613. * @param {Element} popper - The HTML / XML element used as the popper
  36614. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36615. * @return {Object} instance - The generated Popper.js instance
  36616. */
  36617. function Popper(reference, popper) {
  36618. var _this = this;
  36619. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36620. classCallCheck(this, Popper);
  36621. this.scheduleUpdate = function () {
  36622. return requestAnimationFrame(_this.update);
  36623. };
  36624. // make update() debounced, so that it only runs at most once-per-tick
  36625. this.update = debounce(this.update.bind(this));
  36626. // with {} we create a new object with the options inside it
  36627. this.options = _extends({}, Popper.Defaults, options);
  36628. // init state
  36629. this.state = {
  36630. isDestroyed: false,
  36631. isCreated: false,
  36632. scrollParents: []
  36633. };
  36634. // get reference and popper elements (allow jQuery wrappers)
  36635. this.reference = reference && reference.jquery ? reference[0] : reference;
  36636. this.popper = popper && popper.jquery ? popper[0] : popper;
  36637. // Deep merge modifiers options
  36638. this.options.modifiers = {};
  36639. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36640. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36641. });
  36642. // Refactoring modifiers' list (Object => Array)
  36643. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36644. return _extends({
  36645. name: name
  36646. }, _this.options.modifiers[name]);
  36647. })
  36648. // sort the modifiers by order
  36649. .sort(function (a, b) {
  36650. return a.order - b.order;
  36651. });
  36652. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36653. // such code is executed in the same order of its modifier
  36654. // they could add new properties to their options configuration
  36655. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36656. this.modifiers.forEach(function (modifierOptions) {
  36657. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36658. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36659. }
  36660. });
  36661. // fire the first update to position the popper in the right place
  36662. this.update();
  36663. var eventsEnabled = this.options.eventsEnabled;
  36664. if (eventsEnabled) {
  36665. // setup event listeners, they will take care of update the position in specific situations
  36666. this.enableEventListeners();
  36667. }
  36668. this.state.eventsEnabled = eventsEnabled;
  36669. }
  36670. // We can't use class properties because they don't get listed in the
  36671. // class prototype and break stuff like Sinon stubs
  36672. createClass(Popper, [{
  36673. key: 'update',
  36674. value: function update$$1() {
  36675. return update.call(this);
  36676. }
  36677. }, {
  36678. key: 'destroy',
  36679. value: function destroy$$1() {
  36680. return destroy.call(this);
  36681. }
  36682. }, {
  36683. key: 'enableEventListeners',
  36684. value: function enableEventListeners$$1() {
  36685. return enableEventListeners.call(this);
  36686. }
  36687. }, {
  36688. key: 'disableEventListeners',
  36689. value: function disableEventListeners$$1() {
  36690. return disableEventListeners.call(this);
  36691. }
  36692. /**
  36693. * Schedules an update. It will run on the next UI update available.
  36694. * @method scheduleUpdate
  36695. * @memberof Popper
  36696. */
  36697. /**
  36698. * Collection of utilities useful when writing custom modifiers.
  36699. * Starting from version 1.7, this method is available only if you
  36700. * include `popper-utils.js` before `popper.js`.
  36701. *
  36702. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36703. * and will be removed in v2! Use the PopperUtils module directly instead.
  36704. * Due to the high instability of the methods contained in Utils, we can't
  36705. * guarantee them to follow semver. Use them at your own risk!
  36706. * @static
  36707. * @private
  36708. * @type {Object}
  36709. * @deprecated since version 1.8
  36710. * @member Utils
  36711. * @memberof Popper
  36712. */
  36713. }]);
  36714. return Popper;
  36715. }();
  36716. /**
  36717. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36718. * and lets you use it as replacement of a real DOM node.<br />
  36719. * You can use this method to position a popper relatively to a set of coordinates
  36720. * in case you don't have a DOM node to use as reference.
  36721. *
  36722. * ```
  36723. * new Popper(referenceObject, popperNode);
  36724. * ```
  36725. *
  36726. * NB: This feature isn't supported in Internet Explorer 10.
  36727. * @name referenceObject
  36728. * @property {Function} data.getBoundingClientRect
  36729. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36730. * @property {number} data.clientWidth
  36731. * An ES6 getter that will return the width of the virtual reference element.
  36732. * @property {number} data.clientHeight
  36733. * An ES6 getter that will return the height of the virtual reference element.
  36734. */
  36735. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36736. Popper.placements = placements;
  36737. Popper.Defaults = Defaults;
  36738. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36739. //# sourceMappingURL=popper.js.map
  36740. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36741. /***/ }),
  36742. /***/ "./node_modules/process/browser.js":
  36743. /*!*****************************************!*\
  36744. !*** ./node_modules/process/browser.js ***!
  36745. \*****************************************/
  36746. /*! no static exports found */
  36747. /***/ (function(module, exports) {
  36748. // shim for using process in browser
  36749. var process = module.exports = {};
  36750. // cached from whatever global is present so that test runners that stub it
  36751. // don't break things. But we need to wrap it in a try catch in case it is
  36752. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36753. // function because try/catches deoptimize in certain engines.
  36754. var cachedSetTimeout;
  36755. var cachedClearTimeout;
  36756. function defaultSetTimout() {
  36757. throw new Error('setTimeout has not been defined');
  36758. }
  36759. function defaultClearTimeout () {
  36760. throw new Error('clearTimeout has not been defined');
  36761. }
  36762. (function () {
  36763. try {
  36764. if (typeof setTimeout === 'function') {
  36765. cachedSetTimeout = setTimeout;
  36766. } else {
  36767. cachedSetTimeout = defaultSetTimout;
  36768. }
  36769. } catch (e) {
  36770. cachedSetTimeout = defaultSetTimout;
  36771. }
  36772. try {
  36773. if (typeof clearTimeout === 'function') {
  36774. cachedClearTimeout = clearTimeout;
  36775. } else {
  36776. cachedClearTimeout = defaultClearTimeout;
  36777. }
  36778. } catch (e) {
  36779. cachedClearTimeout = defaultClearTimeout;
  36780. }
  36781. } ())
  36782. function runTimeout(fun) {
  36783. if (cachedSetTimeout === setTimeout) {
  36784. //normal enviroments in sane situations
  36785. return setTimeout(fun, 0);
  36786. }
  36787. // if setTimeout wasn't available but was latter defined
  36788. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36789. cachedSetTimeout = setTimeout;
  36790. return setTimeout(fun, 0);
  36791. }
  36792. try {
  36793. // when when somebody has screwed with setTimeout but no I.E. maddness
  36794. return cachedSetTimeout(fun, 0);
  36795. } catch(e){
  36796. try {
  36797. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36798. return cachedSetTimeout.call(null, fun, 0);
  36799. } catch(e){
  36800. // 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
  36801. return cachedSetTimeout.call(this, fun, 0);
  36802. }
  36803. }
  36804. }
  36805. function runClearTimeout(marker) {
  36806. if (cachedClearTimeout === clearTimeout) {
  36807. //normal enviroments in sane situations
  36808. return clearTimeout(marker);
  36809. }
  36810. // if clearTimeout wasn't available but was latter defined
  36811. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36812. cachedClearTimeout = clearTimeout;
  36813. return clearTimeout(marker);
  36814. }
  36815. try {
  36816. // when when somebody has screwed with setTimeout but no I.E. maddness
  36817. return cachedClearTimeout(marker);
  36818. } catch (e){
  36819. try {
  36820. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36821. return cachedClearTimeout.call(null, marker);
  36822. } catch (e){
  36823. // 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.
  36824. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36825. return cachedClearTimeout.call(this, marker);
  36826. }
  36827. }
  36828. }
  36829. var queue = [];
  36830. var draining = false;
  36831. var currentQueue;
  36832. var queueIndex = -1;
  36833. function cleanUpNextTick() {
  36834. if (!draining || !currentQueue) {
  36835. return;
  36836. }
  36837. draining = false;
  36838. if (currentQueue.length) {
  36839. queue = currentQueue.concat(queue);
  36840. } else {
  36841. queueIndex = -1;
  36842. }
  36843. if (queue.length) {
  36844. drainQueue();
  36845. }
  36846. }
  36847. function drainQueue() {
  36848. if (draining) {
  36849. return;
  36850. }
  36851. var timeout = runTimeout(cleanUpNextTick);
  36852. draining = true;
  36853. var len = queue.length;
  36854. while(len) {
  36855. currentQueue = queue;
  36856. queue = [];
  36857. while (++queueIndex < len) {
  36858. if (currentQueue) {
  36859. currentQueue[queueIndex].run();
  36860. }
  36861. }
  36862. queueIndex = -1;
  36863. len = queue.length;
  36864. }
  36865. currentQueue = null;
  36866. draining = false;
  36867. runClearTimeout(timeout);
  36868. }
  36869. process.nextTick = function (fun) {
  36870. var args = new Array(arguments.length - 1);
  36871. if (arguments.length > 1) {
  36872. for (var i = 1; i < arguments.length; i++) {
  36873. args[i - 1] = arguments[i];
  36874. }
  36875. }
  36876. queue.push(new Item(fun, args));
  36877. if (queue.length === 1 && !draining) {
  36878. runTimeout(drainQueue);
  36879. }
  36880. };
  36881. // v8 likes predictible objects
  36882. function Item(fun, array) {
  36883. this.fun = fun;
  36884. this.array = array;
  36885. }
  36886. Item.prototype.run = function () {
  36887. this.fun.apply(null, this.array);
  36888. };
  36889. process.title = 'browser';
  36890. process.browser = true;
  36891. process.env = {};
  36892. process.argv = [];
  36893. process.version = ''; // empty string to avoid regexp issues
  36894. process.versions = {};
  36895. function noop() {}
  36896. process.on = noop;
  36897. process.addListener = noop;
  36898. process.once = noop;
  36899. process.off = noop;
  36900. process.removeListener = noop;
  36901. process.removeAllListeners = noop;
  36902. process.emit = noop;
  36903. process.prependListener = noop;
  36904. process.prependOnceListener = noop;
  36905. process.listeners = function (name) { return [] }
  36906. process.binding = function (name) {
  36907. throw new Error('process.binding is not supported');
  36908. };
  36909. process.cwd = function () { return '/' };
  36910. process.chdir = function (dir) {
  36911. throw new Error('process.chdir is not supported');
  36912. };
  36913. process.umask = function() { return 0; };
  36914. /***/ }),
  36915. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36916. /*!***************************************************!*\
  36917. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36918. \***************************************************/
  36919. /*! no static exports found */
  36920. /***/ (function(module, exports, __webpack_require__) {
  36921. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36922. * Pusher JavaScript Library v5.0.3
  36923. * https://pusher.com/
  36924. *
  36925. * Copyright 2017, Pusher
  36926. * Released under the MIT licence.
  36927. */
  36928. (function webpackUniversalModuleDefinition(root, factory) {
  36929. if(true)
  36930. module.exports = factory();
  36931. else {}
  36932. })(window, function() {
  36933. return /******/ (function(modules) { // webpackBootstrap
  36934. /******/ // The module cache
  36935. /******/ var installedModules = {};
  36936. /******/
  36937. /******/ // The require function
  36938. /******/ function __webpack_require__(moduleId) {
  36939. /******/
  36940. /******/ // Check if module is in cache
  36941. /******/ if(installedModules[moduleId]) {
  36942. /******/ return installedModules[moduleId].exports;
  36943. /******/ }
  36944. /******/ // Create a new module (and put it into the cache)
  36945. /******/ var module = installedModules[moduleId] = {
  36946. /******/ i: moduleId,
  36947. /******/ l: false,
  36948. /******/ exports: {}
  36949. /******/ };
  36950. /******/
  36951. /******/ // Execute the module function
  36952. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36953. /******/
  36954. /******/ // Flag the module as loaded
  36955. /******/ module.l = true;
  36956. /******/
  36957. /******/ // Return the exports of the module
  36958. /******/ return module.exports;
  36959. /******/ }
  36960. /******/
  36961. /******/
  36962. /******/ // expose the modules object (__webpack_modules__)
  36963. /******/ __webpack_require__.m = modules;
  36964. /******/
  36965. /******/ // expose the module cache
  36966. /******/ __webpack_require__.c = installedModules;
  36967. /******/
  36968. /******/ // define getter function for harmony exports
  36969. /******/ __webpack_require__.d = function(exports, name, getter) {
  36970. /******/ if(!__webpack_require__.o(exports, name)) {
  36971. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36972. /******/ }
  36973. /******/ };
  36974. /******/
  36975. /******/ // define __esModule on exports
  36976. /******/ __webpack_require__.r = function(exports) {
  36977. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36978. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36979. /******/ }
  36980. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36981. /******/ };
  36982. /******/
  36983. /******/ // create a fake namespace object
  36984. /******/ // mode & 1: value is a module id, require it
  36985. /******/ // mode & 2: merge all properties of value into the ns
  36986. /******/ // mode & 4: return value when already ns object
  36987. /******/ // mode & 8|1: behave like require
  36988. /******/ __webpack_require__.t = function(value, mode) {
  36989. /******/ if(mode & 1) value = __webpack_require__(value);
  36990. /******/ if(mode & 8) return value;
  36991. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36992. /******/ var ns = Object.create(null);
  36993. /******/ __webpack_require__.r(ns);
  36994. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36995. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36996. /******/ return ns;
  36997. /******/ };
  36998. /******/
  36999. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37000. /******/ __webpack_require__.n = function(module) {
  37001. /******/ var getter = module && module.__esModule ?
  37002. /******/ function getDefault() { return module['default']; } :
  37003. /******/ function getModuleExports() { return module; };
  37004. /******/ __webpack_require__.d(getter, 'a', getter);
  37005. /******/ return getter;
  37006. /******/ };
  37007. /******/
  37008. /******/ // Object.prototype.hasOwnProperty.call
  37009. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37010. /******/
  37011. /******/ // __webpack_public_path__
  37012. /******/ __webpack_require__.p = "";
  37013. /******/
  37014. /******/
  37015. /******/ // Load entry module and return exports
  37016. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37017. /******/ })
  37018. /************************************************************************/
  37019. /******/ ([
  37020. /* 0 */
  37021. /***/ (function(module, exports, __webpack_require__) {
  37022. (function(nacl) {
  37023. 'use strict';
  37024. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37025. // Public domain.
  37026. //
  37027. // Implementation derived from TweetNaCl version 20140427.
  37028. // See for details: http://tweetnacl.cr.yp.to/
  37029. var gf = function(init) {
  37030. var i, r = new Float64Array(16);
  37031. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37032. return r;
  37033. };
  37034. // Pluggable, initialized in high-level API below.
  37035. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37036. var _0 = new Uint8Array(16);
  37037. var _9 = new Uint8Array(32); _9[0] = 9;
  37038. var gf0 = gf(),
  37039. gf1 = gf([1]),
  37040. _121665 = gf([0xdb41, 1]),
  37041. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37042. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37043. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37044. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37045. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37046. function ts64(x, i, h, l) {
  37047. x[i] = (h >> 24) & 0xff;
  37048. x[i+1] = (h >> 16) & 0xff;
  37049. x[i+2] = (h >> 8) & 0xff;
  37050. x[i+3] = h & 0xff;
  37051. x[i+4] = (l >> 24) & 0xff;
  37052. x[i+5] = (l >> 16) & 0xff;
  37053. x[i+6] = (l >> 8) & 0xff;
  37054. x[i+7] = l & 0xff;
  37055. }
  37056. function vn(x, xi, y, yi, n) {
  37057. var i,d = 0;
  37058. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37059. return (1 & ((d - 1) >>> 8)) - 1;
  37060. }
  37061. function crypto_verify_16(x, xi, y, yi) {
  37062. return vn(x,xi,y,yi,16);
  37063. }
  37064. function crypto_verify_32(x, xi, y, yi) {
  37065. return vn(x,xi,y,yi,32);
  37066. }
  37067. function core_salsa20(o, p, k, c) {
  37068. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37069. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37070. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37071. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37072. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37073. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37074. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37075. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37076. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37077. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37078. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37079. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37080. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37081. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37082. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37083. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37084. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37085. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37086. x15 = j15, u;
  37087. for (var i = 0; i < 20; i += 2) {
  37088. u = x0 + x12 | 0;
  37089. x4 ^= u<<7 | u>>>(32-7);
  37090. u = x4 + x0 | 0;
  37091. x8 ^= u<<9 | u>>>(32-9);
  37092. u = x8 + x4 | 0;
  37093. x12 ^= u<<13 | u>>>(32-13);
  37094. u = x12 + x8 | 0;
  37095. x0 ^= u<<18 | u>>>(32-18);
  37096. u = x5 + x1 | 0;
  37097. x9 ^= u<<7 | u>>>(32-7);
  37098. u = x9 + x5 | 0;
  37099. x13 ^= u<<9 | u>>>(32-9);
  37100. u = x13 + x9 | 0;
  37101. x1 ^= u<<13 | u>>>(32-13);
  37102. u = x1 + x13 | 0;
  37103. x5 ^= u<<18 | u>>>(32-18);
  37104. u = x10 + x6 | 0;
  37105. x14 ^= u<<7 | u>>>(32-7);
  37106. u = x14 + x10 | 0;
  37107. x2 ^= u<<9 | u>>>(32-9);
  37108. u = x2 + x14 | 0;
  37109. x6 ^= u<<13 | u>>>(32-13);
  37110. u = x6 + x2 | 0;
  37111. x10 ^= u<<18 | u>>>(32-18);
  37112. u = x15 + x11 | 0;
  37113. x3 ^= u<<7 | u>>>(32-7);
  37114. u = x3 + x15 | 0;
  37115. x7 ^= u<<9 | u>>>(32-9);
  37116. u = x7 + x3 | 0;
  37117. x11 ^= u<<13 | u>>>(32-13);
  37118. u = x11 + x7 | 0;
  37119. x15 ^= u<<18 | u>>>(32-18);
  37120. u = x0 + x3 | 0;
  37121. x1 ^= u<<7 | u>>>(32-7);
  37122. u = x1 + x0 | 0;
  37123. x2 ^= u<<9 | u>>>(32-9);
  37124. u = x2 + x1 | 0;
  37125. x3 ^= u<<13 | u>>>(32-13);
  37126. u = x3 + x2 | 0;
  37127. x0 ^= u<<18 | u>>>(32-18);
  37128. u = x5 + x4 | 0;
  37129. x6 ^= u<<7 | u>>>(32-7);
  37130. u = x6 + x5 | 0;
  37131. x7 ^= u<<9 | u>>>(32-9);
  37132. u = x7 + x6 | 0;
  37133. x4 ^= u<<13 | u>>>(32-13);
  37134. u = x4 + x7 | 0;
  37135. x5 ^= u<<18 | u>>>(32-18);
  37136. u = x10 + x9 | 0;
  37137. x11 ^= u<<7 | u>>>(32-7);
  37138. u = x11 + x10 | 0;
  37139. x8 ^= u<<9 | u>>>(32-9);
  37140. u = x8 + x11 | 0;
  37141. x9 ^= u<<13 | u>>>(32-13);
  37142. u = x9 + x8 | 0;
  37143. x10 ^= u<<18 | u>>>(32-18);
  37144. u = x15 + x14 | 0;
  37145. x12 ^= u<<7 | u>>>(32-7);
  37146. u = x12 + x15 | 0;
  37147. x13 ^= u<<9 | u>>>(32-9);
  37148. u = x13 + x12 | 0;
  37149. x14 ^= u<<13 | u>>>(32-13);
  37150. u = x14 + x13 | 0;
  37151. x15 ^= u<<18 | u>>>(32-18);
  37152. }
  37153. x0 = x0 + j0 | 0;
  37154. x1 = x1 + j1 | 0;
  37155. x2 = x2 + j2 | 0;
  37156. x3 = x3 + j3 | 0;
  37157. x4 = x4 + j4 | 0;
  37158. x5 = x5 + j5 | 0;
  37159. x6 = x6 + j6 | 0;
  37160. x7 = x7 + j7 | 0;
  37161. x8 = x8 + j8 | 0;
  37162. x9 = x9 + j9 | 0;
  37163. x10 = x10 + j10 | 0;
  37164. x11 = x11 + j11 | 0;
  37165. x12 = x12 + j12 | 0;
  37166. x13 = x13 + j13 | 0;
  37167. x14 = x14 + j14 | 0;
  37168. x15 = x15 + j15 | 0;
  37169. o[ 0] = x0 >>> 0 & 0xff;
  37170. o[ 1] = x0 >>> 8 & 0xff;
  37171. o[ 2] = x0 >>> 16 & 0xff;
  37172. o[ 3] = x0 >>> 24 & 0xff;
  37173. o[ 4] = x1 >>> 0 & 0xff;
  37174. o[ 5] = x1 >>> 8 & 0xff;
  37175. o[ 6] = x1 >>> 16 & 0xff;
  37176. o[ 7] = x1 >>> 24 & 0xff;
  37177. o[ 8] = x2 >>> 0 & 0xff;
  37178. o[ 9] = x2 >>> 8 & 0xff;
  37179. o[10] = x2 >>> 16 & 0xff;
  37180. o[11] = x2 >>> 24 & 0xff;
  37181. o[12] = x3 >>> 0 & 0xff;
  37182. o[13] = x3 >>> 8 & 0xff;
  37183. o[14] = x3 >>> 16 & 0xff;
  37184. o[15] = x3 >>> 24 & 0xff;
  37185. o[16] = x4 >>> 0 & 0xff;
  37186. o[17] = x4 >>> 8 & 0xff;
  37187. o[18] = x4 >>> 16 & 0xff;
  37188. o[19] = x4 >>> 24 & 0xff;
  37189. o[20] = x5 >>> 0 & 0xff;
  37190. o[21] = x5 >>> 8 & 0xff;
  37191. o[22] = x5 >>> 16 & 0xff;
  37192. o[23] = x5 >>> 24 & 0xff;
  37193. o[24] = x6 >>> 0 & 0xff;
  37194. o[25] = x6 >>> 8 & 0xff;
  37195. o[26] = x6 >>> 16 & 0xff;
  37196. o[27] = x6 >>> 24 & 0xff;
  37197. o[28] = x7 >>> 0 & 0xff;
  37198. o[29] = x7 >>> 8 & 0xff;
  37199. o[30] = x7 >>> 16 & 0xff;
  37200. o[31] = x7 >>> 24 & 0xff;
  37201. o[32] = x8 >>> 0 & 0xff;
  37202. o[33] = x8 >>> 8 & 0xff;
  37203. o[34] = x8 >>> 16 & 0xff;
  37204. o[35] = x8 >>> 24 & 0xff;
  37205. o[36] = x9 >>> 0 & 0xff;
  37206. o[37] = x9 >>> 8 & 0xff;
  37207. o[38] = x9 >>> 16 & 0xff;
  37208. o[39] = x9 >>> 24 & 0xff;
  37209. o[40] = x10 >>> 0 & 0xff;
  37210. o[41] = x10 >>> 8 & 0xff;
  37211. o[42] = x10 >>> 16 & 0xff;
  37212. o[43] = x10 >>> 24 & 0xff;
  37213. o[44] = x11 >>> 0 & 0xff;
  37214. o[45] = x11 >>> 8 & 0xff;
  37215. o[46] = x11 >>> 16 & 0xff;
  37216. o[47] = x11 >>> 24 & 0xff;
  37217. o[48] = x12 >>> 0 & 0xff;
  37218. o[49] = x12 >>> 8 & 0xff;
  37219. o[50] = x12 >>> 16 & 0xff;
  37220. o[51] = x12 >>> 24 & 0xff;
  37221. o[52] = x13 >>> 0 & 0xff;
  37222. o[53] = x13 >>> 8 & 0xff;
  37223. o[54] = x13 >>> 16 & 0xff;
  37224. o[55] = x13 >>> 24 & 0xff;
  37225. o[56] = x14 >>> 0 & 0xff;
  37226. o[57] = x14 >>> 8 & 0xff;
  37227. o[58] = x14 >>> 16 & 0xff;
  37228. o[59] = x14 >>> 24 & 0xff;
  37229. o[60] = x15 >>> 0 & 0xff;
  37230. o[61] = x15 >>> 8 & 0xff;
  37231. o[62] = x15 >>> 16 & 0xff;
  37232. o[63] = x15 >>> 24 & 0xff;
  37233. }
  37234. function core_hsalsa20(o,p,k,c) {
  37235. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37236. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37237. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37238. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37239. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37240. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37241. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37242. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37243. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37244. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37245. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37246. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37247. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37248. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37249. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37250. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37251. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37252. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37253. x15 = j15, u;
  37254. for (var i = 0; i < 20; i += 2) {
  37255. u = x0 + x12 | 0;
  37256. x4 ^= u<<7 | u>>>(32-7);
  37257. u = x4 + x0 | 0;
  37258. x8 ^= u<<9 | u>>>(32-9);
  37259. u = x8 + x4 | 0;
  37260. x12 ^= u<<13 | u>>>(32-13);
  37261. u = x12 + x8 | 0;
  37262. x0 ^= u<<18 | u>>>(32-18);
  37263. u = x5 + x1 | 0;
  37264. x9 ^= u<<7 | u>>>(32-7);
  37265. u = x9 + x5 | 0;
  37266. x13 ^= u<<9 | u>>>(32-9);
  37267. u = x13 + x9 | 0;
  37268. x1 ^= u<<13 | u>>>(32-13);
  37269. u = x1 + x13 | 0;
  37270. x5 ^= u<<18 | u>>>(32-18);
  37271. u = x10 + x6 | 0;
  37272. x14 ^= u<<7 | u>>>(32-7);
  37273. u = x14 + x10 | 0;
  37274. x2 ^= u<<9 | u>>>(32-9);
  37275. u = x2 + x14 | 0;
  37276. x6 ^= u<<13 | u>>>(32-13);
  37277. u = x6 + x2 | 0;
  37278. x10 ^= u<<18 | u>>>(32-18);
  37279. u = x15 + x11 | 0;
  37280. x3 ^= u<<7 | u>>>(32-7);
  37281. u = x3 + x15 | 0;
  37282. x7 ^= u<<9 | u>>>(32-9);
  37283. u = x7 + x3 | 0;
  37284. x11 ^= u<<13 | u>>>(32-13);
  37285. u = x11 + x7 | 0;
  37286. x15 ^= u<<18 | u>>>(32-18);
  37287. u = x0 + x3 | 0;
  37288. x1 ^= u<<7 | u>>>(32-7);
  37289. u = x1 + x0 | 0;
  37290. x2 ^= u<<9 | u>>>(32-9);
  37291. u = x2 + x1 | 0;
  37292. x3 ^= u<<13 | u>>>(32-13);
  37293. u = x3 + x2 | 0;
  37294. x0 ^= u<<18 | u>>>(32-18);
  37295. u = x5 + x4 | 0;
  37296. x6 ^= u<<7 | u>>>(32-7);
  37297. u = x6 + x5 | 0;
  37298. x7 ^= u<<9 | u>>>(32-9);
  37299. u = x7 + x6 | 0;
  37300. x4 ^= u<<13 | u>>>(32-13);
  37301. u = x4 + x7 | 0;
  37302. x5 ^= u<<18 | u>>>(32-18);
  37303. u = x10 + x9 | 0;
  37304. x11 ^= u<<7 | u>>>(32-7);
  37305. u = x11 + x10 | 0;
  37306. x8 ^= u<<9 | u>>>(32-9);
  37307. u = x8 + x11 | 0;
  37308. x9 ^= u<<13 | u>>>(32-13);
  37309. u = x9 + x8 | 0;
  37310. x10 ^= u<<18 | u>>>(32-18);
  37311. u = x15 + x14 | 0;
  37312. x12 ^= u<<7 | u>>>(32-7);
  37313. u = x12 + x15 | 0;
  37314. x13 ^= u<<9 | u>>>(32-9);
  37315. u = x13 + x12 | 0;
  37316. x14 ^= u<<13 | u>>>(32-13);
  37317. u = x14 + x13 | 0;
  37318. x15 ^= u<<18 | u>>>(32-18);
  37319. }
  37320. o[ 0] = x0 >>> 0 & 0xff;
  37321. o[ 1] = x0 >>> 8 & 0xff;
  37322. o[ 2] = x0 >>> 16 & 0xff;
  37323. o[ 3] = x0 >>> 24 & 0xff;
  37324. o[ 4] = x5 >>> 0 & 0xff;
  37325. o[ 5] = x5 >>> 8 & 0xff;
  37326. o[ 6] = x5 >>> 16 & 0xff;
  37327. o[ 7] = x5 >>> 24 & 0xff;
  37328. o[ 8] = x10 >>> 0 & 0xff;
  37329. o[ 9] = x10 >>> 8 & 0xff;
  37330. o[10] = x10 >>> 16 & 0xff;
  37331. o[11] = x10 >>> 24 & 0xff;
  37332. o[12] = x15 >>> 0 & 0xff;
  37333. o[13] = x15 >>> 8 & 0xff;
  37334. o[14] = x15 >>> 16 & 0xff;
  37335. o[15] = x15 >>> 24 & 0xff;
  37336. o[16] = x6 >>> 0 & 0xff;
  37337. o[17] = x6 >>> 8 & 0xff;
  37338. o[18] = x6 >>> 16 & 0xff;
  37339. o[19] = x6 >>> 24 & 0xff;
  37340. o[20] = x7 >>> 0 & 0xff;
  37341. o[21] = x7 >>> 8 & 0xff;
  37342. o[22] = x7 >>> 16 & 0xff;
  37343. o[23] = x7 >>> 24 & 0xff;
  37344. o[24] = x8 >>> 0 & 0xff;
  37345. o[25] = x8 >>> 8 & 0xff;
  37346. o[26] = x8 >>> 16 & 0xff;
  37347. o[27] = x8 >>> 24 & 0xff;
  37348. o[28] = x9 >>> 0 & 0xff;
  37349. o[29] = x9 >>> 8 & 0xff;
  37350. o[30] = x9 >>> 16 & 0xff;
  37351. o[31] = x9 >>> 24 & 0xff;
  37352. }
  37353. function crypto_core_salsa20(out,inp,k,c) {
  37354. core_salsa20(out,inp,k,c);
  37355. }
  37356. function crypto_core_hsalsa20(out,inp,k,c) {
  37357. core_hsalsa20(out,inp,k,c);
  37358. }
  37359. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37360. // "expand 32-byte k"
  37361. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37362. var z = new Uint8Array(16), x = new Uint8Array(64);
  37363. var u, i;
  37364. for (i = 0; i < 16; i++) z[i] = 0;
  37365. for (i = 0; i < 8; i++) z[i] = n[i];
  37366. while (b >= 64) {
  37367. crypto_core_salsa20(x,z,k,sigma);
  37368. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37369. u = 1;
  37370. for (i = 8; i < 16; i++) {
  37371. u = u + (z[i] & 0xff) | 0;
  37372. z[i] = u & 0xff;
  37373. u >>>= 8;
  37374. }
  37375. b -= 64;
  37376. cpos += 64;
  37377. mpos += 64;
  37378. }
  37379. if (b > 0) {
  37380. crypto_core_salsa20(x,z,k,sigma);
  37381. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37382. }
  37383. return 0;
  37384. }
  37385. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37386. var z = new Uint8Array(16), x = new Uint8Array(64);
  37387. var u, i;
  37388. for (i = 0; i < 16; i++) z[i] = 0;
  37389. for (i = 0; i < 8; i++) z[i] = n[i];
  37390. while (b >= 64) {
  37391. crypto_core_salsa20(x,z,k,sigma);
  37392. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37393. u = 1;
  37394. for (i = 8; i < 16; i++) {
  37395. u = u + (z[i] & 0xff) | 0;
  37396. z[i] = u & 0xff;
  37397. u >>>= 8;
  37398. }
  37399. b -= 64;
  37400. cpos += 64;
  37401. }
  37402. if (b > 0) {
  37403. crypto_core_salsa20(x,z,k,sigma);
  37404. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37405. }
  37406. return 0;
  37407. }
  37408. function crypto_stream(c,cpos,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(c,cpos,d,sn,s);
  37414. }
  37415. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37416. var s = new Uint8Array(32);
  37417. crypto_core_hsalsa20(s,n,k,sigma);
  37418. var sn = new Uint8Array(8);
  37419. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37420. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37421. }
  37422. /*
  37423. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37424. * https://github.com/floodyberry/poly1305-donna
  37425. */
  37426. var poly1305 = function(key) {
  37427. this.buffer = new Uint8Array(16);
  37428. this.r = new Uint16Array(10);
  37429. this.h = new Uint16Array(10);
  37430. this.pad = new Uint16Array(8);
  37431. this.leftover = 0;
  37432. this.fin = 0;
  37433. var t0, t1, t2, t3, t4, t5, t6, t7;
  37434. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37435. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37436. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37437. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37438. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37439. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37440. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37441. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37442. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37443. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37444. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37445. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37446. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37447. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37448. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37449. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37450. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37451. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37452. };
  37453. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37454. var hibit = this.fin ? 0 : (1 << 11);
  37455. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37456. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37457. var h0 = this.h[0],
  37458. h1 = this.h[1],
  37459. h2 = this.h[2],
  37460. h3 = this.h[3],
  37461. h4 = this.h[4],
  37462. h5 = this.h[5],
  37463. h6 = this.h[6],
  37464. h7 = this.h[7],
  37465. h8 = this.h[8],
  37466. h9 = this.h[9];
  37467. var r0 = this.r[0],
  37468. r1 = this.r[1],
  37469. r2 = this.r[2],
  37470. r3 = this.r[3],
  37471. r4 = this.r[4],
  37472. r5 = this.r[5],
  37473. r6 = this.r[6],
  37474. r7 = this.r[7],
  37475. r8 = this.r[8],
  37476. r9 = this.r[9];
  37477. while (bytes >= 16) {
  37478. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37479. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37480. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37481. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37482. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37483. h5 += ((t4 >>> 1)) & 0x1fff;
  37484. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37485. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37486. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37487. h9 += ((t7 >>> 5)) | hibit;
  37488. c = 0;
  37489. d0 = c;
  37490. d0 += h0 * r0;
  37491. d0 += h1 * (5 * r9);
  37492. d0 += h2 * (5 * r8);
  37493. d0 += h3 * (5 * r7);
  37494. d0 += h4 * (5 * r6);
  37495. c = (d0 >>> 13); d0 &= 0x1fff;
  37496. d0 += h5 * (5 * r5);
  37497. d0 += h6 * (5 * r4);
  37498. d0 += h7 * (5 * r3);
  37499. d0 += h8 * (5 * r2);
  37500. d0 += h9 * (5 * r1);
  37501. c += (d0 >>> 13); d0 &= 0x1fff;
  37502. d1 = c;
  37503. d1 += h0 * r1;
  37504. d1 += h1 * r0;
  37505. d1 += h2 * (5 * r9);
  37506. d1 += h3 * (5 * r8);
  37507. d1 += h4 * (5 * r7);
  37508. c = (d1 >>> 13); d1 &= 0x1fff;
  37509. d1 += h5 * (5 * r6);
  37510. d1 += h6 * (5 * r5);
  37511. d1 += h7 * (5 * r4);
  37512. d1 += h8 * (5 * r3);
  37513. d1 += h9 * (5 * r2);
  37514. c += (d1 >>> 13); d1 &= 0x1fff;
  37515. d2 = c;
  37516. d2 += h0 * r2;
  37517. d2 += h1 * r1;
  37518. d2 += h2 * r0;
  37519. d2 += h3 * (5 * r9);
  37520. d2 += h4 * (5 * r8);
  37521. c = (d2 >>> 13); d2 &= 0x1fff;
  37522. d2 += h5 * (5 * r7);
  37523. d2 += h6 * (5 * r6);
  37524. d2 += h7 * (5 * r5);
  37525. d2 += h8 * (5 * r4);
  37526. d2 += h9 * (5 * r3);
  37527. c += (d2 >>> 13); d2 &= 0x1fff;
  37528. d3 = c;
  37529. d3 += h0 * r3;
  37530. d3 += h1 * r2;
  37531. d3 += h2 * r1;
  37532. d3 += h3 * r0;
  37533. d3 += h4 * (5 * r9);
  37534. c = (d3 >>> 13); d3 &= 0x1fff;
  37535. d3 += h5 * (5 * r8);
  37536. d3 += h6 * (5 * r7);
  37537. d3 += h7 * (5 * r6);
  37538. d3 += h8 * (5 * r5);
  37539. d3 += h9 * (5 * r4);
  37540. c += (d3 >>> 13); d3 &= 0x1fff;
  37541. d4 = c;
  37542. d4 += h0 * r4;
  37543. d4 += h1 * r3;
  37544. d4 += h2 * r2;
  37545. d4 += h3 * r1;
  37546. d4 += h4 * r0;
  37547. c = (d4 >>> 13); d4 &= 0x1fff;
  37548. d4 += h5 * (5 * r9);
  37549. d4 += h6 * (5 * r8);
  37550. d4 += h7 * (5 * r7);
  37551. d4 += h8 * (5 * r6);
  37552. d4 += h9 * (5 * r5);
  37553. c += (d4 >>> 13); d4 &= 0x1fff;
  37554. d5 = c;
  37555. d5 += h0 * r5;
  37556. d5 += h1 * r4;
  37557. d5 += h2 * r3;
  37558. d5 += h3 * r2;
  37559. d5 += h4 * r1;
  37560. c = (d5 >>> 13); d5 &= 0x1fff;
  37561. d5 += h5 * r0;
  37562. d5 += h6 * (5 * r9);
  37563. d5 += h7 * (5 * r8);
  37564. d5 += h8 * (5 * r7);
  37565. d5 += h9 * (5 * r6);
  37566. c += (d5 >>> 13); d5 &= 0x1fff;
  37567. d6 = c;
  37568. d6 += h0 * r6;
  37569. d6 += h1 * r5;
  37570. d6 += h2 * r4;
  37571. d6 += h3 * r3;
  37572. d6 += h4 * r2;
  37573. c = (d6 >>> 13); d6 &= 0x1fff;
  37574. d6 += h5 * r1;
  37575. d6 += h6 * r0;
  37576. d6 += h7 * (5 * r9);
  37577. d6 += h8 * (5 * r8);
  37578. d6 += h9 * (5 * r7);
  37579. c += (d6 >>> 13); d6 &= 0x1fff;
  37580. d7 = c;
  37581. d7 += h0 * r7;
  37582. d7 += h1 * r6;
  37583. d7 += h2 * r5;
  37584. d7 += h3 * r4;
  37585. d7 += h4 * r3;
  37586. c = (d7 >>> 13); d7 &= 0x1fff;
  37587. d7 += h5 * r2;
  37588. d7 += h6 * r1;
  37589. d7 += h7 * r0;
  37590. d7 += h8 * (5 * r9);
  37591. d7 += h9 * (5 * r8);
  37592. c += (d7 >>> 13); d7 &= 0x1fff;
  37593. d8 = c;
  37594. d8 += h0 * r8;
  37595. d8 += h1 * r7;
  37596. d8 += h2 * r6;
  37597. d8 += h3 * r5;
  37598. d8 += h4 * r4;
  37599. c = (d8 >>> 13); d8 &= 0x1fff;
  37600. d8 += h5 * r3;
  37601. d8 += h6 * r2;
  37602. d8 += h7 * r1;
  37603. d8 += h8 * r0;
  37604. d8 += h9 * (5 * r9);
  37605. c += (d8 >>> 13); d8 &= 0x1fff;
  37606. d9 = c;
  37607. d9 += h0 * r9;
  37608. d9 += h1 * r8;
  37609. d9 += h2 * r7;
  37610. d9 += h3 * r6;
  37611. d9 += h4 * r5;
  37612. c = (d9 >>> 13); d9 &= 0x1fff;
  37613. d9 += h5 * r4;
  37614. d9 += h6 * r3;
  37615. d9 += h7 * r2;
  37616. d9 += h8 * r1;
  37617. d9 += h9 * r0;
  37618. c += (d9 >>> 13); d9 &= 0x1fff;
  37619. c = (((c << 2) + c)) | 0;
  37620. c = (c + d0) | 0;
  37621. d0 = c & 0x1fff;
  37622. c = (c >>> 13);
  37623. d1 += c;
  37624. h0 = d0;
  37625. h1 = d1;
  37626. h2 = d2;
  37627. h3 = d3;
  37628. h4 = d4;
  37629. h5 = d5;
  37630. h6 = d6;
  37631. h7 = d7;
  37632. h8 = d8;
  37633. h9 = d9;
  37634. mpos += 16;
  37635. bytes -= 16;
  37636. }
  37637. this.h[0] = h0;
  37638. this.h[1] = h1;
  37639. this.h[2] = h2;
  37640. this.h[3] = h3;
  37641. this.h[4] = h4;
  37642. this.h[5] = h5;
  37643. this.h[6] = h6;
  37644. this.h[7] = h7;
  37645. this.h[8] = h8;
  37646. this.h[9] = h9;
  37647. };
  37648. poly1305.prototype.finish = function(mac, macpos) {
  37649. var g = new Uint16Array(10);
  37650. var c, mask, f, i;
  37651. if (this.leftover) {
  37652. i = this.leftover;
  37653. this.buffer[i++] = 1;
  37654. for (; i < 16; i++) this.buffer[i] = 0;
  37655. this.fin = 1;
  37656. this.blocks(this.buffer, 0, 16);
  37657. }
  37658. c = this.h[1] >>> 13;
  37659. this.h[1] &= 0x1fff;
  37660. for (i = 2; i < 10; i++) {
  37661. this.h[i] += c;
  37662. c = this.h[i] >>> 13;
  37663. this.h[i] &= 0x1fff;
  37664. }
  37665. this.h[0] += (c * 5);
  37666. c = this.h[0] >>> 13;
  37667. this.h[0] &= 0x1fff;
  37668. this.h[1] += c;
  37669. c = this.h[1] >>> 13;
  37670. this.h[1] &= 0x1fff;
  37671. this.h[2] += c;
  37672. g[0] = this.h[0] + 5;
  37673. c = g[0] >>> 13;
  37674. g[0] &= 0x1fff;
  37675. for (i = 1; i < 10; i++) {
  37676. g[i] = this.h[i] + c;
  37677. c = g[i] >>> 13;
  37678. g[i] &= 0x1fff;
  37679. }
  37680. g[9] -= (1 << 13);
  37681. mask = (c ^ 1) - 1;
  37682. for (i = 0; i < 10; i++) g[i] &= mask;
  37683. mask = ~mask;
  37684. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37685. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37686. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37687. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37688. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37689. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37690. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37691. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37692. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37693. f = this.h[0] + this.pad[0];
  37694. this.h[0] = f & 0xffff;
  37695. for (i = 1; i < 8; i++) {
  37696. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37697. this.h[i] = f & 0xffff;
  37698. }
  37699. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37700. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37701. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37702. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37703. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37704. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37705. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37706. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37707. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37708. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37709. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37710. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37711. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37712. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37713. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37714. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37715. };
  37716. poly1305.prototype.update = function(m, mpos, bytes) {
  37717. var i, want;
  37718. if (this.leftover) {
  37719. want = (16 - this.leftover);
  37720. if (want > bytes)
  37721. want = bytes;
  37722. for (i = 0; i < want; i++)
  37723. this.buffer[this.leftover + i] = m[mpos+i];
  37724. bytes -= want;
  37725. mpos += want;
  37726. this.leftover += want;
  37727. if (this.leftover < 16)
  37728. return;
  37729. this.blocks(this.buffer, 0, 16);
  37730. this.leftover = 0;
  37731. }
  37732. if (bytes >= 16) {
  37733. want = bytes - (bytes % 16);
  37734. this.blocks(m, mpos, want);
  37735. mpos += want;
  37736. bytes -= want;
  37737. }
  37738. if (bytes) {
  37739. for (i = 0; i < bytes; i++)
  37740. this.buffer[this.leftover + i] = m[mpos+i];
  37741. this.leftover += bytes;
  37742. }
  37743. };
  37744. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37745. var s = new poly1305(k);
  37746. s.update(m, mpos, n);
  37747. s.finish(out, outpos);
  37748. return 0;
  37749. }
  37750. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37751. var x = new Uint8Array(16);
  37752. crypto_onetimeauth(x,0,m,mpos,n,k);
  37753. return crypto_verify_16(h,hpos,x,0);
  37754. }
  37755. function crypto_secretbox(c,m,d,n,k) {
  37756. var i;
  37757. if (d < 32) return -1;
  37758. crypto_stream_xor(c,0,m,0,d,n,k);
  37759. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37760. for (i = 0; i < 16; i++) c[i] = 0;
  37761. return 0;
  37762. }
  37763. function crypto_secretbox_open(m,c,d,n,k) {
  37764. var i;
  37765. var x = new Uint8Array(32);
  37766. if (d < 32) return -1;
  37767. crypto_stream(x,0,32,n,k);
  37768. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37769. crypto_stream_xor(m,0,c,0,d,n,k);
  37770. for (i = 0; i < 32; i++) m[i] = 0;
  37771. return 0;
  37772. }
  37773. function set25519(r, a) {
  37774. var i;
  37775. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37776. }
  37777. function car25519(o) {
  37778. var i, v, c = 1;
  37779. for (i = 0; i < 16; i++) {
  37780. v = o[i] + c + 65535;
  37781. c = Math.floor(v / 65536);
  37782. o[i] = v - c * 65536;
  37783. }
  37784. o[0] += c-1 + 37 * (c-1);
  37785. }
  37786. function sel25519(p, q, b) {
  37787. var t, c = ~(b-1);
  37788. for (var i = 0; i < 16; i++) {
  37789. t = c & (p[i] ^ q[i]);
  37790. p[i] ^= t;
  37791. q[i] ^= t;
  37792. }
  37793. }
  37794. function pack25519(o, n) {
  37795. var i, j, b;
  37796. var m = gf(), t = gf();
  37797. for (i = 0; i < 16; i++) t[i] = n[i];
  37798. car25519(t);
  37799. car25519(t);
  37800. car25519(t);
  37801. for (j = 0; j < 2; j++) {
  37802. m[0] = t[0] - 0xffed;
  37803. for (i = 1; i < 15; i++) {
  37804. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37805. m[i-1] &= 0xffff;
  37806. }
  37807. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37808. b = (m[15]>>16) & 1;
  37809. m[14] &= 0xffff;
  37810. sel25519(t, m, 1-b);
  37811. }
  37812. for (i = 0; i < 16; i++) {
  37813. o[2*i] = t[i] & 0xff;
  37814. o[2*i+1] = t[i]>>8;
  37815. }
  37816. }
  37817. function neq25519(a, b) {
  37818. var c = new Uint8Array(32), d = new Uint8Array(32);
  37819. pack25519(c, a);
  37820. pack25519(d, b);
  37821. return crypto_verify_32(c, 0, d, 0);
  37822. }
  37823. function par25519(a) {
  37824. var d = new Uint8Array(32);
  37825. pack25519(d, a);
  37826. return d[0] & 1;
  37827. }
  37828. function unpack25519(o, n) {
  37829. var i;
  37830. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37831. o[15] &= 0x7fff;
  37832. }
  37833. function A(o, a, b) {
  37834. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37835. }
  37836. function Z(o, a, b) {
  37837. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37838. }
  37839. function M(o, a, b) {
  37840. var v, c,
  37841. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37842. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37843. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37844. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37845. b0 = b[0],
  37846. b1 = b[1],
  37847. b2 = b[2],
  37848. b3 = b[3],
  37849. b4 = b[4],
  37850. b5 = b[5],
  37851. b6 = b[6],
  37852. b7 = b[7],
  37853. b8 = b[8],
  37854. b9 = b[9],
  37855. b10 = b[10],
  37856. b11 = b[11],
  37857. b12 = b[12],
  37858. b13 = b[13],
  37859. b14 = b[14],
  37860. b15 = b[15];
  37861. v = a[0];
  37862. t0 += v * b0;
  37863. t1 += v * b1;
  37864. t2 += v * b2;
  37865. t3 += v * b3;
  37866. t4 += v * b4;
  37867. t5 += v * b5;
  37868. t6 += v * b6;
  37869. t7 += v * b7;
  37870. t8 += v * b8;
  37871. t9 += v * b9;
  37872. t10 += v * b10;
  37873. t11 += v * b11;
  37874. t12 += v * b12;
  37875. t13 += v * b13;
  37876. t14 += v * b14;
  37877. t15 += v * b15;
  37878. v = a[1];
  37879. t1 += v * b0;
  37880. t2 += v * b1;
  37881. t3 += v * b2;
  37882. t4 += v * b3;
  37883. t5 += v * b4;
  37884. t6 += v * b5;
  37885. t7 += v * b6;
  37886. t8 += v * b7;
  37887. t9 += v * b8;
  37888. t10 += v * b9;
  37889. t11 += v * b10;
  37890. t12 += v * b11;
  37891. t13 += v * b12;
  37892. t14 += v * b13;
  37893. t15 += v * b14;
  37894. t16 += v * b15;
  37895. v = a[2];
  37896. t2 += v * b0;
  37897. t3 += v * b1;
  37898. t4 += v * b2;
  37899. t5 += v * b3;
  37900. t6 += v * b4;
  37901. t7 += v * b5;
  37902. t8 += v * b6;
  37903. t9 += v * b7;
  37904. t10 += v * b8;
  37905. t11 += v * b9;
  37906. t12 += v * b10;
  37907. t13 += v * b11;
  37908. t14 += v * b12;
  37909. t15 += v * b13;
  37910. t16 += v * b14;
  37911. t17 += v * b15;
  37912. v = a[3];
  37913. t3 += v * b0;
  37914. t4 += v * b1;
  37915. t5 += v * b2;
  37916. t6 += v * b3;
  37917. t7 += v * b4;
  37918. t8 += v * b5;
  37919. t9 += v * b6;
  37920. t10 += v * b7;
  37921. t11 += v * b8;
  37922. t12 += v * b9;
  37923. t13 += v * b10;
  37924. t14 += v * b11;
  37925. t15 += v * b12;
  37926. t16 += v * b13;
  37927. t17 += v * b14;
  37928. t18 += v * b15;
  37929. v = a[4];
  37930. t4 += v * b0;
  37931. t5 += v * b1;
  37932. t6 += v * b2;
  37933. t7 += v * b3;
  37934. t8 += v * b4;
  37935. t9 += v * b5;
  37936. t10 += v * b6;
  37937. t11 += v * b7;
  37938. t12 += v * b8;
  37939. t13 += v * b9;
  37940. t14 += v * b10;
  37941. t15 += v * b11;
  37942. t16 += v * b12;
  37943. t17 += v * b13;
  37944. t18 += v * b14;
  37945. t19 += v * b15;
  37946. v = a[5];
  37947. t5 += v * b0;
  37948. t6 += v * b1;
  37949. t7 += v * b2;
  37950. t8 += v * b3;
  37951. t9 += v * b4;
  37952. t10 += v * b5;
  37953. t11 += v * b6;
  37954. t12 += v * b7;
  37955. t13 += v * b8;
  37956. t14 += v * b9;
  37957. t15 += v * b10;
  37958. t16 += v * b11;
  37959. t17 += v * b12;
  37960. t18 += v * b13;
  37961. t19 += v * b14;
  37962. t20 += v * b15;
  37963. v = a[6];
  37964. t6 += v * b0;
  37965. t7 += v * b1;
  37966. t8 += v * b2;
  37967. t9 += v * b3;
  37968. t10 += v * b4;
  37969. t11 += v * b5;
  37970. t12 += v * b6;
  37971. t13 += v * b7;
  37972. t14 += v * b8;
  37973. t15 += v * b9;
  37974. t16 += v * b10;
  37975. t17 += v * b11;
  37976. t18 += v * b12;
  37977. t19 += v * b13;
  37978. t20 += v * b14;
  37979. t21 += v * b15;
  37980. v = a[7];
  37981. t7 += v * b0;
  37982. t8 += v * b1;
  37983. t9 += v * b2;
  37984. t10 += v * b3;
  37985. t11 += v * b4;
  37986. t12 += v * b5;
  37987. t13 += v * b6;
  37988. t14 += v * b7;
  37989. t15 += v * b8;
  37990. t16 += v * b9;
  37991. t17 += v * b10;
  37992. t18 += v * b11;
  37993. t19 += v * b12;
  37994. t20 += v * b13;
  37995. t21 += v * b14;
  37996. t22 += v * b15;
  37997. v = a[8];
  37998. t8 += v * b0;
  37999. t9 += v * b1;
  38000. t10 += v * b2;
  38001. t11 += v * b3;
  38002. t12 += v * b4;
  38003. t13 += v * b5;
  38004. t14 += v * b6;
  38005. t15 += v * b7;
  38006. t16 += v * b8;
  38007. t17 += v * b9;
  38008. t18 += v * b10;
  38009. t19 += v * b11;
  38010. t20 += v * b12;
  38011. t21 += v * b13;
  38012. t22 += v * b14;
  38013. t23 += v * b15;
  38014. v = a[9];
  38015. t9 += v * b0;
  38016. t10 += v * b1;
  38017. t11 += v * b2;
  38018. t12 += v * b3;
  38019. t13 += v * b4;
  38020. t14 += v * b5;
  38021. t15 += v * b6;
  38022. t16 += v * b7;
  38023. t17 += v * b8;
  38024. t18 += v * b9;
  38025. t19 += v * b10;
  38026. t20 += v * b11;
  38027. t21 += v * b12;
  38028. t22 += v * b13;
  38029. t23 += v * b14;
  38030. t24 += v * b15;
  38031. v = a[10];
  38032. t10 += v * b0;
  38033. t11 += v * b1;
  38034. t12 += v * b2;
  38035. t13 += v * b3;
  38036. t14 += v * b4;
  38037. t15 += v * b5;
  38038. t16 += v * b6;
  38039. t17 += v * b7;
  38040. t18 += v * b8;
  38041. t19 += v * b9;
  38042. t20 += v * b10;
  38043. t21 += v * b11;
  38044. t22 += v * b12;
  38045. t23 += v * b13;
  38046. t24 += v * b14;
  38047. t25 += v * b15;
  38048. v = a[11];
  38049. t11 += v * b0;
  38050. t12 += v * b1;
  38051. t13 += v * b2;
  38052. t14 += v * b3;
  38053. t15 += v * b4;
  38054. t16 += v * b5;
  38055. t17 += v * b6;
  38056. t18 += v * b7;
  38057. t19 += v * b8;
  38058. t20 += v * b9;
  38059. t21 += v * b10;
  38060. t22 += v * b11;
  38061. t23 += v * b12;
  38062. t24 += v * b13;
  38063. t25 += v * b14;
  38064. t26 += v * b15;
  38065. v = a[12];
  38066. t12 += v * b0;
  38067. t13 += v * b1;
  38068. t14 += v * b2;
  38069. t15 += v * b3;
  38070. t16 += v * b4;
  38071. t17 += v * b5;
  38072. t18 += v * b6;
  38073. t19 += v * b7;
  38074. t20 += v * b8;
  38075. t21 += v * b9;
  38076. t22 += v * b10;
  38077. t23 += v * b11;
  38078. t24 += v * b12;
  38079. t25 += v * b13;
  38080. t26 += v * b14;
  38081. t27 += v * b15;
  38082. v = a[13];
  38083. t13 += v * b0;
  38084. t14 += v * b1;
  38085. t15 += v * b2;
  38086. t16 += v * b3;
  38087. t17 += v * b4;
  38088. t18 += v * b5;
  38089. t19 += v * b6;
  38090. t20 += v * b7;
  38091. t21 += v * b8;
  38092. t22 += v * b9;
  38093. t23 += v * b10;
  38094. t24 += v * b11;
  38095. t25 += v * b12;
  38096. t26 += v * b13;
  38097. t27 += v * b14;
  38098. t28 += v * b15;
  38099. v = a[14];
  38100. t14 += v * b0;
  38101. t15 += v * b1;
  38102. t16 += v * b2;
  38103. t17 += v * b3;
  38104. t18 += v * b4;
  38105. t19 += v * b5;
  38106. t20 += v * b6;
  38107. t21 += v * b7;
  38108. t22 += v * b8;
  38109. t23 += v * b9;
  38110. t24 += v * b10;
  38111. t25 += v * b11;
  38112. t26 += v * b12;
  38113. t27 += v * b13;
  38114. t28 += v * b14;
  38115. t29 += v * b15;
  38116. v = a[15];
  38117. t15 += v * b0;
  38118. t16 += v * b1;
  38119. t17 += v * b2;
  38120. t18 += v * b3;
  38121. t19 += v * b4;
  38122. t20 += v * b5;
  38123. t21 += v * b6;
  38124. t22 += v * b7;
  38125. t23 += v * b8;
  38126. t24 += v * b9;
  38127. t25 += v * b10;
  38128. t26 += v * b11;
  38129. t27 += v * b12;
  38130. t28 += v * b13;
  38131. t29 += v * b14;
  38132. t30 += v * b15;
  38133. t0 += 38 * t16;
  38134. t1 += 38 * t17;
  38135. t2 += 38 * t18;
  38136. t3 += 38 * t19;
  38137. t4 += 38 * t20;
  38138. t5 += 38 * t21;
  38139. t6 += 38 * t22;
  38140. t7 += 38 * t23;
  38141. t8 += 38 * t24;
  38142. t9 += 38 * t25;
  38143. t10 += 38 * t26;
  38144. t11 += 38 * t27;
  38145. t12 += 38 * t28;
  38146. t13 += 38 * t29;
  38147. t14 += 38 * t30;
  38148. // t15 left as is
  38149. // first car
  38150. c = 1;
  38151. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38152. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38153. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38154. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38155. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38156. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38157. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38158. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38159. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38160. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38161. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38162. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38163. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38164. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38165. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38166. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38167. t0 += c-1 + 37 * (c-1);
  38168. // second car
  38169. c = 1;
  38170. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38171. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38172. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38173. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38174. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38175. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38176. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38177. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38178. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38179. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38180. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38181. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38182. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38183. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38184. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38185. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38186. t0 += c-1 + 37 * (c-1);
  38187. o[ 0] = t0;
  38188. o[ 1] = t1;
  38189. o[ 2] = t2;
  38190. o[ 3] = t3;
  38191. o[ 4] = t4;
  38192. o[ 5] = t5;
  38193. o[ 6] = t6;
  38194. o[ 7] = t7;
  38195. o[ 8] = t8;
  38196. o[ 9] = t9;
  38197. o[10] = t10;
  38198. o[11] = t11;
  38199. o[12] = t12;
  38200. o[13] = t13;
  38201. o[14] = t14;
  38202. o[15] = t15;
  38203. }
  38204. function S(o, a) {
  38205. M(o, a, a);
  38206. }
  38207. function inv25519(o, i) {
  38208. var c = gf();
  38209. var a;
  38210. for (a = 0; a < 16; a++) c[a] = i[a];
  38211. for (a = 253; a >= 0; a--) {
  38212. S(c, c);
  38213. if(a !== 2 && a !== 4) M(c, c, i);
  38214. }
  38215. for (a = 0; a < 16; a++) o[a] = c[a];
  38216. }
  38217. function pow2523(o, i) {
  38218. var c = gf();
  38219. var a;
  38220. for (a = 0; a < 16; a++) c[a] = i[a];
  38221. for (a = 250; a >= 0; a--) {
  38222. S(c, c);
  38223. if(a !== 1) M(c, c, i);
  38224. }
  38225. for (a = 0; a < 16; a++) o[a] = c[a];
  38226. }
  38227. function crypto_scalarmult(q, n, p) {
  38228. var z = new Uint8Array(32);
  38229. var x = new Float64Array(80), r, i;
  38230. var a = gf(), b = gf(), c = gf(),
  38231. d = gf(), e = gf(), f = gf();
  38232. for (i = 0; i < 31; i++) z[i] = n[i];
  38233. z[31]=(n[31]&127)|64;
  38234. z[0]&=248;
  38235. unpack25519(x,p);
  38236. for (i = 0; i < 16; i++) {
  38237. b[i]=x[i];
  38238. d[i]=a[i]=c[i]=0;
  38239. }
  38240. a[0]=d[0]=1;
  38241. for (i=254; i>=0; --i) {
  38242. r=(z[i>>>3]>>>(i&7))&1;
  38243. sel25519(a,b,r);
  38244. sel25519(c,d,r);
  38245. A(e,a,c);
  38246. Z(a,a,c);
  38247. A(c,b,d);
  38248. Z(b,b,d);
  38249. S(d,e);
  38250. S(f,a);
  38251. M(a,c,a);
  38252. M(c,b,e);
  38253. A(e,a,c);
  38254. Z(a,a,c);
  38255. S(b,a);
  38256. Z(c,d,f);
  38257. M(a,c,_121665);
  38258. A(a,a,d);
  38259. M(c,c,a);
  38260. M(a,d,f);
  38261. M(d,b,x);
  38262. S(b,e);
  38263. sel25519(a,b,r);
  38264. sel25519(c,d,r);
  38265. }
  38266. for (i = 0; i < 16; i++) {
  38267. x[i+16]=a[i];
  38268. x[i+32]=c[i];
  38269. x[i+48]=b[i];
  38270. x[i+64]=d[i];
  38271. }
  38272. var x32 = x.subarray(32);
  38273. var x16 = x.subarray(16);
  38274. inv25519(x32,x32);
  38275. M(x16,x16,x32);
  38276. pack25519(q,x16);
  38277. return 0;
  38278. }
  38279. function crypto_scalarmult_base(q, n) {
  38280. return crypto_scalarmult(q, n, _9);
  38281. }
  38282. function crypto_box_keypair(y, x) {
  38283. randombytes(x, 32);
  38284. return crypto_scalarmult_base(y, x);
  38285. }
  38286. function crypto_box_beforenm(k, y, x) {
  38287. var s = new Uint8Array(32);
  38288. crypto_scalarmult(s, x, y);
  38289. return crypto_core_hsalsa20(k, _0, s, sigma);
  38290. }
  38291. var crypto_box_afternm = crypto_secretbox;
  38292. var crypto_box_open_afternm = crypto_secretbox_open;
  38293. function crypto_box(c, m, d, n, y, x) {
  38294. var k = new Uint8Array(32);
  38295. crypto_box_beforenm(k, y, x);
  38296. return crypto_box_afternm(c, m, d, n, k);
  38297. }
  38298. function crypto_box_open(m, c, d, n, y, x) {
  38299. var k = new Uint8Array(32);
  38300. crypto_box_beforenm(k, y, x);
  38301. return crypto_box_open_afternm(m, c, d, n, k);
  38302. }
  38303. var K = [
  38304. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38305. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38306. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38307. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38308. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38309. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38310. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38311. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38312. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38313. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38314. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38315. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38316. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38317. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38318. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38319. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38320. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38321. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38322. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38323. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38324. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38325. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38326. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38327. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38328. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38329. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38330. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38331. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38332. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38333. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38334. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38335. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38336. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38337. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38338. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38339. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38340. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38341. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38342. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38343. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38344. ];
  38345. function crypto_hashblocks_hl(hh, hl, m, n) {
  38346. var wh = new Int32Array(16), wl = new Int32Array(16),
  38347. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38348. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38349. th, tl, i, j, h, l, a, b, c, d;
  38350. var ah0 = hh[0],
  38351. ah1 = hh[1],
  38352. ah2 = hh[2],
  38353. ah3 = hh[3],
  38354. ah4 = hh[4],
  38355. ah5 = hh[5],
  38356. ah6 = hh[6],
  38357. ah7 = hh[7],
  38358. al0 = hl[0],
  38359. al1 = hl[1],
  38360. al2 = hl[2],
  38361. al3 = hl[3],
  38362. al4 = hl[4],
  38363. al5 = hl[5],
  38364. al6 = hl[6],
  38365. al7 = hl[7];
  38366. var pos = 0;
  38367. while (n >= 128) {
  38368. for (i = 0; i < 16; i++) {
  38369. j = 8 * i + pos;
  38370. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38371. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38372. }
  38373. for (i = 0; i < 80; i++) {
  38374. bh0 = ah0;
  38375. bh1 = ah1;
  38376. bh2 = ah2;
  38377. bh3 = ah3;
  38378. bh4 = ah4;
  38379. bh5 = ah5;
  38380. bh6 = ah6;
  38381. bh7 = ah7;
  38382. bl0 = al0;
  38383. bl1 = al1;
  38384. bl2 = al2;
  38385. bl3 = al3;
  38386. bl4 = al4;
  38387. bl5 = al5;
  38388. bl6 = al6;
  38389. bl7 = al7;
  38390. // add
  38391. h = ah7;
  38392. l = al7;
  38393. a = l & 0xffff; b = l >>> 16;
  38394. c = h & 0xffff; d = h >>> 16;
  38395. // Sigma1
  38396. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38397. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38398. a += l & 0xffff; b += l >>> 16;
  38399. c += h & 0xffff; d += h >>> 16;
  38400. // Ch
  38401. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38402. l = (al4 & al5) ^ (~al4 & al6);
  38403. a += l & 0xffff; b += l >>> 16;
  38404. c += h & 0xffff; d += h >>> 16;
  38405. // K
  38406. h = K[i*2];
  38407. l = K[i*2+1];
  38408. a += l & 0xffff; b += l >>> 16;
  38409. c += h & 0xffff; d += h >>> 16;
  38410. // w
  38411. h = wh[i%16];
  38412. l = wl[i%16];
  38413. a += l & 0xffff; b += l >>> 16;
  38414. c += h & 0xffff; d += h >>> 16;
  38415. b += a >>> 16;
  38416. c += b >>> 16;
  38417. d += c >>> 16;
  38418. th = c & 0xffff | d << 16;
  38419. tl = a & 0xffff | b << 16;
  38420. // add
  38421. h = th;
  38422. l = tl;
  38423. a = l & 0xffff; b = l >>> 16;
  38424. c = h & 0xffff; d = h >>> 16;
  38425. // Sigma0
  38426. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38427. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38428. a += l & 0xffff; b += l >>> 16;
  38429. c += h & 0xffff; d += h >>> 16;
  38430. // Maj
  38431. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38432. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38433. a += l & 0xffff; b += l >>> 16;
  38434. c += h & 0xffff; d += h >>> 16;
  38435. b += a >>> 16;
  38436. c += b >>> 16;
  38437. d += c >>> 16;
  38438. bh7 = (c & 0xffff) | (d << 16);
  38439. bl7 = (a & 0xffff) | (b << 16);
  38440. // add
  38441. h = bh3;
  38442. l = bl3;
  38443. a = l & 0xffff; b = l >>> 16;
  38444. c = h & 0xffff; d = h >>> 16;
  38445. h = th;
  38446. l = tl;
  38447. a += l & 0xffff; b += l >>> 16;
  38448. c += h & 0xffff; d += h >>> 16;
  38449. b += a >>> 16;
  38450. c += b >>> 16;
  38451. d += c >>> 16;
  38452. bh3 = (c & 0xffff) | (d << 16);
  38453. bl3 = (a & 0xffff) | (b << 16);
  38454. ah1 = bh0;
  38455. ah2 = bh1;
  38456. ah3 = bh2;
  38457. ah4 = bh3;
  38458. ah5 = bh4;
  38459. ah6 = bh5;
  38460. ah7 = bh6;
  38461. ah0 = bh7;
  38462. al1 = bl0;
  38463. al2 = bl1;
  38464. al3 = bl2;
  38465. al4 = bl3;
  38466. al5 = bl4;
  38467. al6 = bl5;
  38468. al7 = bl6;
  38469. al0 = bl7;
  38470. if (i%16 === 15) {
  38471. for (j = 0; j < 16; j++) {
  38472. // add
  38473. h = wh[j];
  38474. l = wl[j];
  38475. a = l & 0xffff; b = l >>> 16;
  38476. c = h & 0xffff; d = h >>> 16;
  38477. h = wh[(j+9)%16];
  38478. l = wl[(j+9)%16];
  38479. a += l & 0xffff; b += l >>> 16;
  38480. c += h & 0xffff; d += h >>> 16;
  38481. // sigma0
  38482. th = wh[(j+1)%16];
  38483. tl = wl[(j+1)%16];
  38484. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38485. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38486. a += l & 0xffff; b += l >>> 16;
  38487. c += h & 0xffff; d += h >>> 16;
  38488. // sigma1
  38489. th = wh[(j+14)%16];
  38490. tl = wl[(j+14)%16];
  38491. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38492. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38493. a += l & 0xffff; b += l >>> 16;
  38494. c += h & 0xffff; d += h >>> 16;
  38495. b += a >>> 16;
  38496. c += b >>> 16;
  38497. d += c >>> 16;
  38498. wh[j] = (c & 0xffff) | (d << 16);
  38499. wl[j] = (a & 0xffff) | (b << 16);
  38500. }
  38501. }
  38502. }
  38503. // add
  38504. h = ah0;
  38505. l = al0;
  38506. a = l & 0xffff; b = l >>> 16;
  38507. c = h & 0xffff; d = h >>> 16;
  38508. h = hh[0];
  38509. l = hl[0];
  38510. a += l & 0xffff; b += l >>> 16;
  38511. c += h & 0xffff; d += h >>> 16;
  38512. b += a >>> 16;
  38513. c += b >>> 16;
  38514. d += c >>> 16;
  38515. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38516. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38517. h = ah1;
  38518. l = al1;
  38519. a = l & 0xffff; b = l >>> 16;
  38520. c = h & 0xffff; d = h >>> 16;
  38521. h = hh[1];
  38522. l = hl[1];
  38523. a += l & 0xffff; b += l >>> 16;
  38524. c += h & 0xffff; d += h >>> 16;
  38525. b += a >>> 16;
  38526. c += b >>> 16;
  38527. d += c >>> 16;
  38528. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38529. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38530. h = ah2;
  38531. l = al2;
  38532. a = l & 0xffff; b = l >>> 16;
  38533. c = h & 0xffff; d = h >>> 16;
  38534. h = hh[2];
  38535. l = hl[2];
  38536. a += l & 0xffff; b += l >>> 16;
  38537. c += h & 0xffff; d += h >>> 16;
  38538. b += a >>> 16;
  38539. c += b >>> 16;
  38540. d += c >>> 16;
  38541. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38542. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38543. h = ah3;
  38544. l = al3;
  38545. a = l & 0xffff; b = l >>> 16;
  38546. c = h & 0xffff; d = h >>> 16;
  38547. h = hh[3];
  38548. l = hl[3];
  38549. a += l & 0xffff; b += l >>> 16;
  38550. c += h & 0xffff; d += h >>> 16;
  38551. b += a >>> 16;
  38552. c += b >>> 16;
  38553. d += c >>> 16;
  38554. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38555. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38556. h = ah4;
  38557. l = al4;
  38558. a = l & 0xffff; b = l >>> 16;
  38559. c = h & 0xffff; d = h >>> 16;
  38560. h = hh[4];
  38561. l = hl[4];
  38562. a += l & 0xffff; b += l >>> 16;
  38563. c += h & 0xffff; d += h >>> 16;
  38564. b += a >>> 16;
  38565. c += b >>> 16;
  38566. d += c >>> 16;
  38567. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38568. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38569. h = ah5;
  38570. l = al5;
  38571. a = l & 0xffff; b = l >>> 16;
  38572. c = h & 0xffff; d = h >>> 16;
  38573. h = hh[5];
  38574. l = hl[5];
  38575. a += l & 0xffff; b += l >>> 16;
  38576. c += h & 0xffff; d += h >>> 16;
  38577. b += a >>> 16;
  38578. c += b >>> 16;
  38579. d += c >>> 16;
  38580. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38581. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38582. h = ah6;
  38583. l = al6;
  38584. a = l & 0xffff; b = l >>> 16;
  38585. c = h & 0xffff; d = h >>> 16;
  38586. h = hh[6];
  38587. l = hl[6];
  38588. a += l & 0xffff; b += l >>> 16;
  38589. c += h & 0xffff; d += h >>> 16;
  38590. b += a >>> 16;
  38591. c += b >>> 16;
  38592. d += c >>> 16;
  38593. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38594. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38595. h = ah7;
  38596. l = al7;
  38597. a = l & 0xffff; b = l >>> 16;
  38598. c = h & 0xffff; d = h >>> 16;
  38599. h = hh[7];
  38600. l = hl[7];
  38601. a += l & 0xffff; b += l >>> 16;
  38602. c += h & 0xffff; d += h >>> 16;
  38603. b += a >>> 16;
  38604. c += b >>> 16;
  38605. d += c >>> 16;
  38606. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38607. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38608. pos += 128;
  38609. n -= 128;
  38610. }
  38611. return n;
  38612. }
  38613. function crypto_hash(out, m, n) {
  38614. var hh = new Int32Array(8),
  38615. hl = new Int32Array(8),
  38616. x = new Uint8Array(256),
  38617. i, b = n;
  38618. hh[0] = 0x6a09e667;
  38619. hh[1] = 0xbb67ae85;
  38620. hh[2] = 0x3c6ef372;
  38621. hh[3] = 0xa54ff53a;
  38622. hh[4] = 0x510e527f;
  38623. hh[5] = 0x9b05688c;
  38624. hh[6] = 0x1f83d9ab;
  38625. hh[7] = 0x5be0cd19;
  38626. hl[0] = 0xf3bcc908;
  38627. hl[1] = 0x84caa73b;
  38628. hl[2] = 0xfe94f82b;
  38629. hl[3] = 0x5f1d36f1;
  38630. hl[4] = 0xade682d1;
  38631. hl[5] = 0x2b3e6c1f;
  38632. hl[6] = 0xfb41bd6b;
  38633. hl[7] = 0x137e2179;
  38634. crypto_hashblocks_hl(hh, hl, m, n);
  38635. n %= 128;
  38636. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38637. x[n] = 128;
  38638. n = 256-128*(n<112?1:0);
  38639. x[n-9] = 0;
  38640. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38641. crypto_hashblocks_hl(hh, hl, x, n);
  38642. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38643. return 0;
  38644. }
  38645. function add(p, q) {
  38646. var a = gf(), b = gf(), c = gf(),
  38647. d = gf(), e = gf(), f = gf(),
  38648. g = gf(), h = gf(), t = gf();
  38649. Z(a, p[1], p[0]);
  38650. Z(t, q[1], q[0]);
  38651. M(a, a, t);
  38652. A(b, p[0], p[1]);
  38653. A(t, q[0], q[1]);
  38654. M(b, b, t);
  38655. M(c, p[3], q[3]);
  38656. M(c, c, D2);
  38657. M(d, p[2], q[2]);
  38658. A(d, d, d);
  38659. Z(e, b, a);
  38660. Z(f, d, c);
  38661. A(g, d, c);
  38662. A(h, b, a);
  38663. M(p[0], e, f);
  38664. M(p[1], h, g);
  38665. M(p[2], g, f);
  38666. M(p[3], e, h);
  38667. }
  38668. function cswap(p, q, b) {
  38669. var i;
  38670. for (i = 0; i < 4; i++) {
  38671. sel25519(p[i], q[i], b);
  38672. }
  38673. }
  38674. function pack(r, p) {
  38675. var tx = gf(), ty = gf(), zi = gf();
  38676. inv25519(zi, p[2]);
  38677. M(tx, p[0], zi);
  38678. M(ty, p[1], zi);
  38679. pack25519(r, ty);
  38680. r[31] ^= par25519(tx) << 7;
  38681. }
  38682. function scalarmult(p, q, s) {
  38683. var b, i;
  38684. set25519(p[0], gf0);
  38685. set25519(p[1], gf1);
  38686. set25519(p[2], gf1);
  38687. set25519(p[3], gf0);
  38688. for (i = 255; i >= 0; --i) {
  38689. b = (s[(i/8)|0] >> (i&7)) & 1;
  38690. cswap(p, q, b);
  38691. add(q, p);
  38692. add(p, p);
  38693. cswap(p, q, b);
  38694. }
  38695. }
  38696. function scalarbase(p, s) {
  38697. var q = [gf(), gf(), gf(), gf()];
  38698. set25519(q[0], X);
  38699. set25519(q[1], Y);
  38700. set25519(q[2], gf1);
  38701. M(q[3], X, Y);
  38702. scalarmult(p, q, s);
  38703. }
  38704. function crypto_sign_keypair(pk, sk, seeded) {
  38705. var d = new Uint8Array(64);
  38706. var p = [gf(), gf(), gf(), gf()];
  38707. var i;
  38708. if (!seeded) randombytes(sk, 32);
  38709. crypto_hash(d, sk, 32);
  38710. d[0] &= 248;
  38711. d[31] &= 127;
  38712. d[31] |= 64;
  38713. scalarbase(p, d);
  38714. pack(pk, p);
  38715. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38716. return 0;
  38717. }
  38718. 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]);
  38719. function modL(r, x) {
  38720. var carry, i, j, k;
  38721. for (i = 63; i >= 32; --i) {
  38722. carry = 0;
  38723. for (j = i - 32, k = i - 12; j < k; ++j) {
  38724. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38725. carry = (x[j] + 128) >> 8;
  38726. x[j] -= carry * 256;
  38727. }
  38728. x[j] += carry;
  38729. x[i] = 0;
  38730. }
  38731. carry = 0;
  38732. for (j = 0; j < 32; j++) {
  38733. x[j] += carry - (x[31] >> 4) * L[j];
  38734. carry = x[j] >> 8;
  38735. x[j] &= 255;
  38736. }
  38737. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38738. for (i = 0; i < 32; i++) {
  38739. x[i+1] += x[i] >> 8;
  38740. r[i] = x[i] & 255;
  38741. }
  38742. }
  38743. function reduce(r) {
  38744. var x = new Float64Array(64), i;
  38745. for (i = 0; i < 64; i++) x[i] = r[i];
  38746. for (i = 0; i < 64; i++) r[i] = 0;
  38747. modL(r, x);
  38748. }
  38749. // Note: difference from C - smlen returned, not passed as argument.
  38750. function crypto_sign(sm, m, n, sk) {
  38751. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38752. var i, j, x = new Float64Array(64);
  38753. var p = [gf(), gf(), gf(), gf()];
  38754. crypto_hash(d, sk, 32);
  38755. d[0] &= 248;
  38756. d[31] &= 127;
  38757. d[31] |= 64;
  38758. var smlen = n + 64;
  38759. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38760. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38761. crypto_hash(r, sm.subarray(32), n+32);
  38762. reduce(r);
  38763. scalarbase(p, r);
  38764. pack(sm, p);
  38765. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38766. crypto_hash(h, sm, n + 64);
  38767. reduce(h);
  38768. for (i = 0; i < 64; i++) x[i] = 0;
  38769. for (i = 0; i < 32; i++) x[i] = r[i];
  38770. for (i = 0; i < 32; i++) {
  38771. for (j = 0; j < 32; j++) {
  38772. x[i+j] += h[i] * d[j];
  38773. }
  38774. }
  38775. modL(sm.subarray(32), x);
  38776. return smlen;
  38777. }
  38778. function unpackneg(r, p) {
  38779. var t = gf(), chk = gf(), num = gf(),
  38780. den = gf(), den2 = gf(), den4 = gf(),
  38781. den6 = gf();
  38782. set25519(r[2], gf1);
  38783. unpack25519(r[1], p);
  38784. S(num, r[1]);
  38785. M(den, num, D);
  38786. Z(num, num, r[2]);
  38787. A(den, r[2], den);
  38788. S(den2, den);
  38789. S(den4, den2);
  38790. M(den6, den4, den2);
  38791. M(t, den6, num);
  38792. M(t, t, den);
  38793. pow2523(t, t);
  38794. M(t, t, num);
  38795. M(t, t, den);
  38796. M(t, t, den);
  38797. M(r[0], t, den);
  38798. S(chk, r[0]);
  38799. M(chk, chk, den);
  38800. if (neq25519(chk, num)) M(r[0], r[0], I);
  38801. S(chk, r[0]);
  38802. M(chk, chk, den);
  38803. if (neq25519(chk, num)) return -1;
  38804. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38805. M(r[3], r[0], r[1]);
  38806. return 0;
  38807. }
  38808. function crypto_sign_open(m, sm, n, pk) {
  38809. var i, mlen;
  38810. var t = new Uint8Array(32), h = new Uint8Array(64);
  38811. var p = [gf(), gf(), gf(), gf()],
  38812. q = [gf(), gf(), gf(), gf()];
  38813. mlen = -1;
  38814. if (n < 64) return -1;
  38815. if (unpackneg(q, pk)) return -1;
  38816. for (i = 0; i < n; i++) m[i] = sm[i];
  38817. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38818. crypto_hash(h, m, n);
  38819. reduce(h);
  38820. scalarmult(p, q, h);
  38821. scalarbase(q, sm.subarray(32));
  38822. add(p, q);
  38823. pack(t, p);
  38824. n -= 64;
  38825. if (crypto_verify_32(sm, 0, t, 0)) {
  38826. for (i = 0; i < n; i++) m[i] = 0;
  38827. return -1;
  38828. }
  38829. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38830. mlen = n;
  38831. return mlen;
  38832. }
  38833. var crypto_secretbox_KEYBYTES = 32,
  38834. crypto_secretbox_NONCEBYTES = 24,
  38835. crypto_secretbox_ZEROBYTES = 32,
  38836. crypto_secretbox_BOXZEROBYTES = 16,
  38837. crypto_scalarmult_BYTES = 32,
  38838. crypto_scalarmult_SCALARBYTES = 32,
  38839. crypto_box_PUBLICKEYBYTES = 32,
  38840. crypto_box_SECRETKEYBYTES = 32,
  38841. crypto_box_BEFORENMBYTES = 32,
  38842. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38843. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38844. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38845. crypto_sign_BYTES = 64,
  38846. crypto_sign_PUBLICKEYBYTES = 32,
  38847. crypto_sign_SECRETKEYBYTES = 64,
  38848. crypto_sign_SEEDBYTES = 32,
  38849. crypto_hash_BYTES = 64;
  38850. nacl.lowlevel = {
  38851. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38852. crypto_stream_xor: crypto_stream_xor,
  38853. crypto_stream: crypto_stream,
  38854. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38855. crypto_stream_salsa20: crypto_stream_salsa20,
  38856. crypto_onetimeauth: crypto_onetimeauth,
  38857. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38858. crypto_verify_16: crypto_verify_16,
  38859. crypto_verify_32: crypto_verify_32,
  38860. crypto_secretbox: crypto_secretbox,
  38861. crypto_secretbox_open: crypto_secretbox_open,
  38862. crypto_scalarmult: crypto_scalarmult,
  38863. crypto_scalarmult_base: crypto_scalarmult_base,
  38864. crypto_box_beforenm: crypto_box_beforenm,
  38865. crypto_box_afternm: crypto_box_afternm,
  38866. crypto_box: crypto_box,
  38867. crypto_box_open: crypto_box_open,
  38868. crypto_box_keypair: crypto_box_keypair,
  38869. crypto_hash: crypto_hash,
  38870. crypto_sign: crypto_sign,
  38871. crypto_sign_keypair: crypto_sign_keypair,
  38872. crypto_sign_open: crypto_sign_open,
  38873. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38874. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38875. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38876. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38877. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38878. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38879. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38880. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38881. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38882. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38883. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38884. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38885. crypto_sign_BYTES: crypto_sign_BYTES,
  38886. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38887. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38888. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38889. crypto_hash_BYTES: crypto_hash_BYTES
  38890. };
  38891. /* High-level API */
  38892. function checkLengths(k, n) {
  38893. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38894. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38895. }
  38896. function checkBoxLengths(pk, sk) {
  38897. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38898. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38899. }
  38900. function checkArrayTypes() {
  38901. for (var i = 0; i < arguments.length; i++) {
  38902. if (!(arguments[i] instanceof Uint8Array))
  38903. throw new TypeError('unexpected type, use Uint8Array');
  38904. }
  38905. }
  38906. function cleanup(arr) {
  38907. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38908. }
  38909. nacl.randomBytes = function(n) {
  38910. var b = new Uint8Array(n);
  38911. randombytes(b, n);
  38912. return b;
  38913. };
  38914. nacl.secretbox = function(msg, nonce, key) {
  38915. checkArrayTypes(msg, nonce, key);
  38916. checkLengths(key, nonce);
  38917. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38918. var c = new Uint8Array(m.length);
  38919. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38920. crypto_secretbox(c, m, m.length, nonce, key);
  38921. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38922. };
  38923. nacl.secretbox.open = function(box, nonce, key) {
  38924. checkArrayTypes(box, nonce, key);
  38925. checkLengths(key, nonce);
  38926. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38927. var m = new Uint8Array(c.length);
  38928. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38929. if (c.length < 32) return null;
  38930. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38931. return m.subarray(crypto_secretbox_ZEROBYTES);
  38932. };
  38933. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38934. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38935. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38936. nacl.scalarMult = function(n, p) {
  38937. checkArrayTypes(n, p);
  38938. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38939. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38940. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38941. crypto_scalarmult(q, n, p);
  38942. return q;
  38943. };
  38944. nacl.scalarMult.base = function(n) {
  38945. checkArrayTypes(n);
  38946. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38947. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38948. crypto_scalarmult_base(q, n);
  38949. return q;
  38950. };
  38951. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38952. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38953. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38954. var k = nacl.box.before(publicKey, secretKey);
  38955. return nacl.secretbox(msg, nonce, k);
  38956. };
  38957. nacl.box.before = function(publicKey, secretKey) {
  38958. checkArrayTypes(publicKey, secretKey);
  38959. checkBoxLengths(publicKey, secretKey);
  38960. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38961. crypto_box_beforenm(k, publicKey, secretKey);
  38962. return k;
  38963. };
  38964. nacl.box.after = nacl.secretbox;
  38965. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38966. var k = nacl.box.before(publicKey, secretKey);
  38967. return nacl.secretbox.open(msg, nonce, k);
  38968. };
  38969. nacl.box.open.after = nacl.secretbox.open;
  38970. nacl.box.keyPair = function() {
  38971. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38972. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38973. crypto_box_keypair(pk, sk);
  38974. return {publicKey: pk, secretKey: sk};
  38975. };
  38976. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38977. checkArrayTypes(secretKey);
  38978. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38979. throw new Error('bad secret key size');
  38980. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38981. crypto_scalarmult_base(pk, secretKey);
  38982. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38983. };
  38984. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38985. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38986. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38987. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38988. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38989. nacl.sign = function(msg, secretKey) {
  38990. checkArrayTypes(msg, secretKey);
  38991. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38992. throw new Error('bad secret key size');
  38993. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38994. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38995. return signedMsg;
  38996. };
  38997. nacl.sign.open = function(signedMsg, publicKey) {
  38998. checkArrayTypes(signedMsg, publicKey);
  38999. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39000. throw new Error('bad public key size');
  39001. var tmp = new Uint8Array(signedMsg.length);
  39002. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39003. if (mlen < 0) return null;
  39004. var m = new Uint8Array(mlen);
  39005. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39006. return m;
  39007. };
  39008. nacl.sign.detached = function(msg, secretKey) {
  39009. var signedMsg = nacl.sign(msg, secretKey);
  39010. var sig = new Uint8Array(crypto_sign_BYTES);
  39011. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39012. return sig;
  39013. };
  39014. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39015. checkArrayTypes(msg, sig, publicKey);
  39016. if (sig.length !== crypto_sign_BYTES)
  39017. throw new Error('bad signature size');
  39018. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39019. throw new Error('bad public key size');
  39020. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39021. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39022. var i;
  39023. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39024. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39025. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39026. };
  39027. nacl.sign.keyPair = function() {
  39028. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39029. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39030. crypto_sign_keypair(pk, sk);
  39031. return {publicKey: pk, secretKey: sk};
  39032. };
  39033. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39034. checkArrayTypes(secretKey);
  39035. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39036. throw new Error('bad secret key size');
  39037. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39038. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39039. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39040. };
  39041. nacl.sign.keyPair.fromSeed = function(seed) {
  39042. checkArrayTypes(seed);
  39043. if (seed.length !== crypto_sign_SEEDBYTES)
  39044. throw new Error('bad seed size');
  39045. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39046. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39047. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39048. crypto_sign_keypair(pk, sk, true);
  39049. return {publicKey: pk, secretKey: sk};
  39050. };
  39051. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39052. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39053. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39054. nacl.sign.signatureLength = crypto_sign_BYTES;
  39055. nacl.hash = function(msg) {
  39056. checkArrayTypes(msg);
  39057. var h = new Uint8Array(crypto_hash_BYTES);
  39058. crypto_hash(h, msg, msg.length);
  39059. return h;
  39060. };
  39061. nacl.hash.hashLength = crypto_hash_BYTES;
  39062. nacl.verify = function(x, y) {
  39063. checkArrayTypes(x, y);
  39064. // Zero length arguments are considered not equal.
  39065. if (x.length === 0 || y.length === 0) return false;
  39066. if (x.length !== y.length) return false;
  39067. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39068. };
  39069. nacl.setPRNG = function(fn) {
  39070. randombytes = fn;
  39071. };
  39072. (function() {
  39073. // Initialize PRNG if environment provides CSPRNG.
  39074. // If not, methods calling randombytes will throw.
  39075. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39076. if (crypto && crypto.getRandomValues) {
  39077. // Browsers.
  39078. var QUOTA = 65536;
  39079. nacl.setPRNG(function(x, n) {
  39080. var i, v = new Uint8Array(n);
  39081. for (i = 0; i < n; i += QUOTA) {
  39082. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39083. }
  39084. for (i = 0; i < n; i++) x[i] = v[i];
  39085. cleanup(v);
  39086. });
  39087. } else if (true) {
  39088. // Node.js.
  39089. crypto = __webpack_require__(3);
  39090. if (crypto && crypto.randomBytes) {
  39091. nacl.setPRNG(function(x, n) {
  39092. var i, v = crypto.randomBytes(n);
  39093. for (i = 0; i < n; i++) x[i] = v[i];
  39094. cleanup(v);
  39095. });
  39096. }
  39097. }
  39098. })();
  39099. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39100. /***/ }),
  39101. /* 1 */
  39102. /***/ (function(module, exports, __webpack_require__) {
  39103. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39104. // Public domain.
  39105. (function(root, f) {
  39106. 'use strict';
  39107. if ( true && module.exports) module.exports = f();
  39108. else if (root.nacl) root.nacl.util = f();
  39109. else {
  39110. root.nacl = {};
  39111. root.nacl.util = f();
  39112. }
  39113. }(this, function() {
  39114. 'use strict';
  39115. var util = {};
  39116. function validateBase64(s) {
  39117. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39118. throw new TypeError('invalid encoding');
  39119. }
  39120. }
  39121. util.decodeUTF8 = function(s) {
  39122. if (typeof s !== 'string') throw new TypeError('expected string');
  39123. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39124. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39125. return b;
  39126. };
  39127. util.encodeUTF8 = function(arr) {
  39128. var i, s = [];
  39129. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39130. return decodeURIComponent(escape(s.join('')));
  39131. };
  39132. if (typeof atob === 'undefined') {
  39133. // Node.js
  39134. if (typeof Buffer.from !== 'undefined') {
  39135. // Node v6 and later
  39136. util.encodeBase64 = function (arr) { // v6 and later
  39137. return Buffer.from(arr).toString('base64');
  39138. };
  39139. util.decodeBase64 = function (s) {
  39140. validateBase64(s);
  39141. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39142. };
  39143. } else {
  39144. // Node earlier than v6
  39145. util.encodeBase64 = function (arr) { // v6 and later
  39146. return (new Buffer(arr)).toString('base64');
  39147. };
  39148. util.decodeBase64 = function(s) {
  39149. validateBase64(s);
  39150. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39151. };
  39152. }
  39153. } else {
  39154. // Browsers
  39155. util.encodeBase64 = function(arr) {
  39156. var i, s = [], len = arr.length;
  39157. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39158. return btoa(s.join(''));
  39159. };
  39160. util.decodeBase64 = function(s) {
  39161. validateBase64(s);
  39162. var i, d = atob(s), b = new Uint8Array(d.length);
  39163. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39164. return b;
  39165. };
  39166. }
  39167. return util;
  39168. }));
  39169. /***/ }),
  39170. /* 2 */
  39171. /***/ (function(module, exports, __webpack_require__) {
  39172. // required so we don't have to do require('pusher').default etc.
  39173. module.exports = __webpack_require__(4).default;
  39174. /***/ }),
  39175. /* 3 */
  39176. /***/ (function(module, exports) {
  39177. /* (ignored) */
  39178. /***/ }),
  39179. /* 4 */
  39180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39181. "use strict";
  39182. __webpack_require__.r(__webpack_exports__);
  39183. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39184. var ScriptReceiverFactory = (function () {
  39185. function ScriptReceiverFactory(prefix, name) {
  39186. this.lastId = 0;
  39187. this.prefix = prefix;
  39188. this.name = name;
  39189. }
  39190. ScriptReceiverFactory.prototype.create = function (callback) {
  39191. this.lastId++;
  39192. var number = this.lastId;
  39193. var id = this.prefix + number;
  39194. var name = this.name + "[" + number + "]";
  39195. var called = false;
  39196. var callbackWrapper = function () {
  39197. if (!called) {
  39198. callback.apply(null, arguments);
  39199. called = true;
  39200. }
  39201. };
  39202. this[number] = callbackWrapper;
  39203. return { number: number, id: id, name: name, callback: callbackWrapper };
  39204. };
  39205. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39206. delete this[receiver.number];
  39207. };
  39208. return ScriptReceiverFactory;
  39209. }());
  39210. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39211. // CONCATENATED MODULE: ./src/core/defaults.ts
  39212. var Defaults = {
  39213. VERSION: "5.0.3",
  39214. PROTOCOL: 7,
  39215. host: 'ws.pusherapp.com',
  39216. ws_port: 80,
  39217. wss_port: 443,
  39218. ws_path: '',
  39219. sockjs_host: 'sockjs.pusher.com',
  39220. sockjs_http_port: 80,
  39221. sockjs_https_port: 443,
  39222. sockjs_path: '/pusher',
  39223. stats_host: 'stats.pusher.com',
  39224. channel_auth_endpoint: '/pusher/auth',
  39225. channel_auth_transport: 'ajax',
  39226. activity_timeout: 120000,
  39227. pong_timeout: 30000,
  39228. unavailable_timeout: 10000,
  39229. cdn_http: "http://js.pusher.com",
  39230. cdn_https: "https://js.pusher.com",
  39231. dependency_suffix: ""
  39232. };
  39233. /* harmony default export */ var defaults = (Defaults);
  39234. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39235. var dependency_loader_DependencyLoader = (function () {
  39236. function DependencyLoader(options) {
  39237. this.options = options;
  39238. this.receivers = options.receivers || ScriptReceivers;
  39239. this.loading = {};
  39240. }
  39241. DependencyLoader.prototype.load = function (name, options, callback) {
  39242. var self = this;
  39243. if (self.loading[name] && self.loading[name].length > 0) {
  39244. self.loading[name].push(callback);
  39245. }
  39246. else {
  39247. self.loading[name] = [callback];
  39248. var request = runtime.createScriptRequest(self.getPath(name, options));
  39249. var receiver = self.receivers.create(function (error) {
  39250. self.receivers.remove(receiver);
  39251. if (self.loading[name]) {
  39252. var callbacks = self.loading[name];
  39253. delete self.loading[name];
  39254. var successCallback = function (wasSuccessful) {
  39255. if (!wasSuccessful) {
  39256. request.cleanup();
  39257. }
  39258. };
  39259. for (var i = 0; i < callbacks.length; i++) {
  39260. callbacks[i](error, successCallback);
  39261. }
  39262. }
  39263. });
  39264. request.send(receiver);
  39265. }
  39266. };
  39267. DependencyLoader.prototype.getRoot = function (options) {
  39268. var cdn;
  39269. var protocol = runtime.getDocument().location.protocol;
  39270. if ((options && options.useTLS) || protocol === "https:") {
  39271. cdn = this.options.cdn_https;
  39272. }
  39273. else {
  39274. cdn = this.options.cdn_http;
  39275. }
  39276. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39277. };
  39278. DependencyLoader.prototype.getPath = function (name, options) {
  39279. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39280. };
  39281. ;
  39282. return DependencyLoader;
  39283. }());
  39284. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39285. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39286. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39287. var Dependencies = new dependency_loader({
  39288. cdn_http: defaults.cdn_http,
  39289. cdn_https: defaults.cdn_https,
  39290. version: defaults.VERSION,
  39291. suffix: defaults.dependency_suffix,
  39292. receivers: DependenciesReceivers
  39293. });
  39294. // CONCATENATED MODULE: ./src/core/base64.ts
  39295. function encode(s) {
  39296. return btoa(utob(s));
  39297. }
  39298. var fromCharCode = String.fromCharCode;
  39299. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39300. var b64tab = {};
  39301. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39302. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39303. }
  39304. var cb_utob = function (c) {
  39305. var cc = c.charCodeAt(0);
  39306. return cc < 0x80
  39307. ? c
  39308. : cc < 0x800
  39309. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39310. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39311. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39312. fromCharCode(0x80 | (cc & 0x3f));
  39313. };
  39314. var utob = function (u) {
  39315. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39316. };
  39317. var cb_encode = function (ccc) {
  39318. var padlen = [0, 2, 1][ccc.length % 3];
  39319. var ord = (ccc.charCodeAt(0) << 16) |
  39320. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39321. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39322. var chars = [
  39323. b64chars.charAt(ord >>> 18),
  39324. b64chars.charAt((ord >>> 12) & 63),
  39325. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39326. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39327. ];
  39328. return chars.join('');
  39329. };
  39330. var btoa = window.btoa ||
  39331. function (b) {
  39332. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39333. };
  39334. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39335. var Timer = (function () {
  39336. function Timer(set, clear, delay, callback) {
  39337. var _this = this;
  39338. this.clear = clear;
  39339. this.timer = set(function () {
  39340. if (_this.timer) {
  39341. _this.timer = callback(_this.timer);
  39342. }
  39343. }, delay);
  39344. }
  39345. Timer.prototype.isRunning = function () {
  39346. return this.timer !== null;
  39347. };
  39348. Timer.prototype.ensureAborted = function () {
  39349. if (this.timer) {
  39350. this.clear(this.timer);
  39351. this.timer = null;
  39352. }
  39353. };
  39354. return Timer;
  39355. }());
  39356. /* harmony default export */ var abstract_timer = (Timer);
  39357. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39358. var __extends = (undefined && undefined.__extends) || (function () {
  39359. var extendStatics = function (d, b) {
  39360. extendStatics = Object.setPrototypeOf ||
  39361. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39362. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39363. return extendStatics(d, b);
  39364. };
  39365. return function (d, b) {
  39366. extendStatics(d, b);
  39367. function __() { this.constructor = d; }
  39368. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39369. };
  39370. })();
  39371. function timers_clearTimeout(timer) {
  39372. window.clearTimeout(timer);
  39373. }
  39374. function timers_clearInterval(timer) {
  39375. window.clearInterval(timer);
  39376. }
  39377. var OneOffTimer = (function (_super) {
  39378. __extends(OneOffTimer, _super);
  39379. function OneOffTimer(delay, callback) {
  39380. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39381. callback();
  39382. return null;
  39383. }) || this;
  39384. }
  39385. return OneOffTimer;
  39386. }(abstract_timer));
  39387. var PeriodicTimer = (function (_super) {
  39388. __extends(PeriodicTimer, _super);
  39389. function PeriodicTimer(delay, callback) {
  39390. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39391. callback();
  39392. return timer;
  39393. }) || this;
  39394. }
  39395. return PeriodicTimer;
  39396. }(abstract_timer));
  39397. // CONCATENATED MODULE: ./src/core/util.ts
  39398. var Util = {
  39399. now: function () {
  39400. if (Date.now) {
  39401. return Date.now();
  39402. }
  39403. else {
  39404. return new Date().valueOf();
  39405. }
  39406. },
  39407. defer: function (callback) {
  39408. return new OneOffTimer(0, callback);
  39409. },
  39410. method: function (name) {
  39411. var args = [];
  39412. for (var _i = 1; _i < arguments.length; _i++) {
  39413. args[_i - 1] = arguments[_i];
  39414. }
  39415. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39416. return function (object) {
  39417. return object[name].apply(object, boundArguments.concat(arguments));
  39418. };
  39419. }
  39420. };
  39421. /* harmony default export */ var util = (Util);
  39422. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39423. function extend(target) {
  39424. var sources = [];
  39425. for (var _i = 1; _i < arguments.length; _i++) {
  39426. sources[_i - 1] = arguments[_i];
  39427. }
  39428. for (var i = 0; i < sources.length; i++) {
  39429. var extensions = sources[i];
  39430. for (var property in extensions) {
  39431. if (extensions[property] && extensions[property].constructor &&
  39432. extensions[property].constructor === Object) {
  39433. target[property] = extend(target[property] || {}, extensions[property]);
  39434. }
  39435. else {
  39436. target[property] = extensions[property];
  39437. }
  39438. }
  39439. }
  39440. return target;
  39441. }
  39442. function stringify() {
  39443. var m = ["Pusher"];
  39444. for (var i = 0; i < arguments.length; i++) {
  39445. if (typeof arguments[i] === "string") {
  39446. m.push(arguments[i]);
  39447. }
  39448. else {
  39449. m.push(safeJSONStringify(arguments[i]));
  39450. }
  39451. }
  39452. return m.join(" : ");
  39453. }
  39454. function arrayIndexOf(array, item) {
  39455. var nativeIndexOf = Array.prototype.indexOf;
  39456. if (array === null) {
  39457. return -1;
  39458. }
  39459. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39460. return array.indexOf(item);
  39461. }
  39462. for (var i = 0, l = array.length; i < l; i++) {
  39463. if (array[i] === item) {
  39464. return i;
  39465. }
  39466. }
  39467. return -1;
  39468. }
  39469. function objectApply(object, f) {
  39470. for (var key in object) {
  39471. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39472. f(object[key], key, object);
  39473. }
  39474. }
  39475. }
  39476. function keys(object) {
  39477. var keys = [];
  39478. objectApply(object, function (_, key) {
  39479. keys.push(key);
  39480. });
  39481. return keys;
  39482. }
  39483. function values(object) {
  39484. var values = [];
  39485. objectApply(object, function (value) {
  39486. values.push(value);
  39487. });
  39488. return values;
  39489. }
  39490. function apply(array, f, context) {
  39491. for (var i = 0; i < array.length; i++) {
  39492. f.call(context || window, array[i], i, array);
  39493. }
  39494. }
  39495. function map(array, f) {
  39496. var result = [];
  39497. for (var i = 0; i < array.length; i++) {
  39498. result.push(f(array[i], i, array, result));
  39499. }
  39500. return result;
  39501. }
  39502. function mapObject(object, f) {
  39503. var result = {};
  39504. objectApply(object, function (value, key) {
  39505. result[key] = f(value);
  39506. });
  39507. return result;
  39508. }
  39509. function filter(array, test) {
  39510. test = test || function (value) { return !!value; };
  39511. var result = [];
  39512. for (var i = 0; i < array.length; i++) {
  39513. if (test(array[i], i, array, result)) {
  39514. result.push(array[i]);
  39515. }
  39516. }
  39517. return result;
  39518. }
  39519. function filterObject(object, test) {
  39520. var result = {};
  39521. objectApply(object, function (value, key) {
  39522. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39523. result[key] = value;
  39524. }
  39525. });
  39526. return result;
  39527. }
  39528. function flatten(object) {
  39529. var result = [];
  39530. objectApply(object, function (value, key) {
  39531. result.push([key, value]);
  39532. });
  39533. return result;
  39534. }
  39535. function any(array, test) {
  39536. for (var i = 0; i < array.length; i++) {
  39537. if (test(array[i], i, array)) {
  39538. return true;
  39539. }
  39540. }
  39541. return false;
  39542. }
  39543. function collections_all(array, test) {
  39544. for (var i = 0; i < array.length; i++) {
  39545. if (!test(array[i], i, array)) {
  39546. return false;
  39547. }
  39548. }
  39549. return true;
  39550. }
  39551. function encodeParamsObject(data) {
  39552. return mapObject(data, function (value) {
  39553. if (typeof value === "object") {
  39554. value = safeJSONStringify(value);
  39555. }
  39556. return encodeURIComponent(encode(value.toString()));
  39557. });
  39558. }
  39559. function buildQueryString(data) {
  39560. var params = filterObject(data, function (value) {
  39561. return value !== undefined;
  39562. });
  39563. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39564. return query;
  39565. }
  39566. function decycleObject(object) {
  39567. var objects = [], paths = [];
  39568. return (function derez(value, path) {
  39569. var i, name, nu;
  39570. switch (typeof value) {
  39571. case 'object':
  39572. if (!value) {
  39573. return null;
  39574. }
  39575. for (i = 0; i < objects.length; i += 1) {
  39576. if (objects[i] === value) {
  39577. return { $ref: paths[i] };
  39578. }
  39579. }
  39580. objects.push(value);
  39581. paths.push(path);
  39582. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39583. nu = [];
  39584. for (i = 0; i < value.length; i += 1) {
  39585. nu[i] = derez(value[i], path + '[' + i + ']');
  39586. }
  39587. }
  39588. else {
  39589. nu = {};
  39590. for (name in value) {
  39591. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39592. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39593. }
  39594. }
  39595. }
  39596. return nu;
  39597. case 'number':
  39598. case 'string':
  39599. case 'boolean':
  39600. return value;
  39601. }
  39602. }(object, '$'));
  39603. }
  39604. function safeJSONStringify(source) {
  39605. try {
  39606. return JSON.stringify(source);
  39607. }
  39608. catch (e) {
  39609. return JSON.stringify(decycleObject(source));
  39610. }
  39611. }
  39612. // CONCATENATED MODULE: ./src/core/logger.ts
  39613. var logger_Logger = (function () {
  39614. function Logger() {
  39615. this.globalLog = function (message) {
  39616. if (window.console && window.console.log) {
  39617. window.console.log(message);
  39618. }
  39619. };
  39620. }
  39621. Logger.prototype.debug = function () {
  39622. var args = [];
  39623. for (var _i = 0; _i < arguments.length; _i++) {
  39624. args[_i] = arguments[_i];
  39625. }
  39626. this.log(this.globalLog, args);
  39627. };
  39628. Logger.prototype.warn = function () {
  39629. var args = [];
  39630. for (var _i = 0; _i < arguments.length; _i++) {
  39631. args[_i] = arguments[_i];
  39632. }
  39633. this.log(this.globalLogWarn, args);
  39634. };
  39635. Logger.prototype.error = function () {
  39636. var args = [];
  39637. for (var _i = 0; _i < arguments.length; _i++) {
  39638. args[_i] = arguments[_i];
  39639. }
  39640. this.log(this.globalLogError, args);
  39641. };
  39642. Logger.prototype.globalLogWarn = function (message) {
  39643. if (window.console && window.console.warn) {
  39644. window.console.warn(message);
  39645. }
  39646. else {
  39647. this.globalLog(message);
  39648. }
  39649. };
  39650. Logger.prototype.globalLogError = function (message) {
  39651. if (window.console && window.console.error) {
  39652. window.console.error(message);
  39653. }
  39654. else {
  39655. this.globalLogWarn(message);
  39656. }
  39657. };
  39658. Logger.prototype.log = function (defaultLoggingFunction) {
  39659. var args = [];
  39660. for (var _i = 1; _i < arguments.length; _i++) {
  39661. args[_i - 1] = arguments[_i];
  39662. }
  39663. var message = stringify.apply(this, arguments);
  39664. if (core_pusher.log) {
  39665. core_pusher.log(message);
  39666. }
  39667. else if (core_pusher.logToConsole) {
  39668. var log = defaultLoggingFunction.bind(this);
  39669. log(message);
  39670. }
  39671. };
  39672. return Logger;
  39673. }());
  39674. /* harmony default export */ var logger = (new logger_Logger());
  39675. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39676. var urlStore = {
  39677. baseUrl: "https://pusher.com",
  39678. urls: {
  39679. authenticationEndpoint: {
  39680. path: "/docs/authenticating_users",
  39681. },
  39682. javascriptQuickStart: {
  39683. path: "/docs/javascript_quick_start"
  39684. },
  39685. triggeringClientEvents: {
  39686. path: "/docs/client_api_guide/client_events#trigger-events"
  39687. }
  39688. }
  39689. };
  39690. var buildLogSuffix = function (key) {
  39691. var urlPrefix = "See:";
  39692. var urlObj = urlStore.urls[key];
  39693. if (!urlObj)
  39694. return "";
  39695. var url;
  39696. if (urlObj.fullUrl) {
  39697. url = urlObj.fullUrl;
  39698. }
  39699. else if (urlObj.path) {
  39700. url = urlStore.baseUrl + urlObj.path;
  39701. }
  39702. if (!url)
  39703. return "";
  39704. return urlPrefix + " " + url;
  39705. };
  39706. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39707. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39708. var ajax = function (context, socketId, callback) {
  39709. var self = this, xhr;
  39710. xhr = runtime.createXHR();
  39711. xhr.open("POST", self.options.authEndpoint, true);
  39712. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39713. for (var headerName in this.authOptions.headers) {
  39714. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39715. }
  39716. xhr.onreadystatechange = function () {
  39717. if (xhr.readyState === 4) {
  39718. if (xhr.status === 200) {
  39719. var data, parsed = false;
  39720. try {
  39721. data = JSON.parse(xhr.responseText);
  39722. parsed = true;
  39723. }
  39724. catch (e) {
  39725. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39726. }
  39727. if (parsed) {
  39728. callback(false, data);
  39729. }
  39730. }
  39731. else {
  39732. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39733. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39734. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39735. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39736. callback(true, xhr.status);
  39737. }
  39738. }
  39739. };
  39740. xhr.send(this.composeQuery(socketId));
  39741. return xhr;
  39742. };
  39743. /* harmony default export */ var xhr_auth = (ajax);
  39744. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39745. var jsonp = function (context, socketId, callback) {
  39746. if (this.authOptions.headers !== undefined) {
  39747. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39748. }
  39749. var callbackName = context.nextAuthCallbackID.toString();
  39750. context.nextAuthCallbackID++;
  39751. var document = context.getDocument();
  39752. var script = document.createElement("script");
  39753. context.auth_callbacks[callbackName] = function (data) {
  39754. callback(false, data);
  39755. };
  39756. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39757. script.src = this.options.authEndpoint +
  39758. '?callback=' +
  39759. encodeURIComponent(callback_name) +
  39760. '&' +
  39761. this.composeQuery(socketId);
  39762. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39763. head.insertBefore(script, head.firstChild);
  39764. };
  39765. /* harmony default export */ var jsonp_auth = (jsonp);
  39766. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39767. var ScriptRequest = (function () {
  39768. function ScriptRequest(src) {
  39769. this.src = src;
  39770. }
  39771. ScriptRequest.prototype.send = function (receiver) {
  39772. var self = this;
  39773. var errorString = "Error loading " + self.src;
  39774. self.script = document.createElement("script");
  39775. self.script.id = receiver.id;
  39776. self.script.src = self.src;
  39777. self.script.type = "text/javascript";
  39778. self.script.charset = "UTF-8";
  39779. if (self.script.addEventListener) {
  39780. self.script.onerror = function () {
  39781. receiver.callback(errorString);
  39782. };
  39783. self.script.onload = function () {
  39784. receiver.callback(null);
  39785. };
  39786. }
  39787. else {
  39788. self.script.onreadystatechange = function () {
  39789. if (self.script.readyState === 'loaded' ||
  39790. self.script.readyState === 'complete') {
  39791. receiver.callback(null);
  39792. }
  39793. };
  39794. }
  39795. if (self.script.async === undefined && document.attachEvent &&
  39796. /opera/i.test(navigator.userAgent)) {
  39797. self.errorScript = document.createElement("script");
  39798. self.errorScript.id = receiver.id + "_error";
  39799. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39800. self.script.async = self.errorScript.async = false;
  39801. }
  39802. else {
  39803. self.script.async = true;
  39804. }
  39805. var head = document.getElementsByTagName('head')[0];
  39806. head.insertBefore(self.script, head.firstChild);
  39807. if (self.errorScript) {
  39808. head.insertBefore(self.errorScript, self.script.nextSibling);
  39809. }
  39810. };
  39811. ScriptRequest.prototype.cleanup = function () {
  39812. if (this.script) {
  39813. this.script.onload = this.script.onerror = null;
  39814. this.script.onreadystatechange = null;
  39815. }
  39816. if (this.script && this.script.parentNode) {
  39817. this.script.parentNode.removeChild(this.script);
  39818. }
  39819. if (this.errorScript && this.errorScript.parentNode) {
  39820. this.errorScript.parentNode.removeChild(this.errorScript);
  39821. }
  39822. this.script = null;
  39823. this.errorScript = null;
  39824. };
  39825. return ScriptRequest;
  39826. }());
  39827. /* harmony default export */ var script_request = (ScriptRequest);
  39828. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39829. var jsonp_request_JSONPRequest = (function () {
  39830. function JSONPRequest(url, data) {
  39831. this.url = url;
  39832. this.data = data;
  39833. }
  39834. JSONPRequest.prototype.send = function (receiver) {
  39835. if (this.request) {
  39836. return;
  39837. }
  39838. var query = buildQueryString(this.data);
  39839. var url = this.url + "/" + receiver.number + "?" + query;
  39840. this.request = runtime.createScriptRequest(url);
  39841. this.request.send(receiver);
  39842. };
  39843. JSONPRequest.prototype.cleanup = function () {
  39844. if (this.request) {
  39845. this.request.cleanup();
  39846. }
  39847. };
  39848. return JSONPRequest;
  39849. }());
  39850. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39851. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39852. var getAgent = function (sender, useTLS) {
  39853. return function (data, callback) {
  39854. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39855. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39856. var request = runtime.createJSONPRequest(url, data);
  39857. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39858. ScriptReceivers.remove(receiver);
  39859. request.cleanup();
  39860. if (result && result.host) {
  39861. sender.host = result.host;
  39862. }
  39863. if (callback) {
  39864. callback(error, result);
  39865. }
  39866. });
  39867. request.send(receiver);
  39868. };
  39869. };
  39870. var jsonp_timeline_jsonp = {
  39871. name: 'jsonp',
  39872. getAgent: getAgent
  39873. };
  39874. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39875. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39876. function getGenericURL(baseScheme, params, path) {
  39877. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39878. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39879. return scheme + "://" + host + path;
  39880. }
  39881. function getGenericPath(key, queryString) {
  39882. var path = "/app/" + key;
  39883. var query = "?protocol=" + defaults.PROTOCOL +
  39884. "&client=js" +
  39885. "&version=" + defaults.VERSION +
  39886. (queryString ? ("&" + queryString) : "");
  39887. return path + query;
  39888. }
  39889. var ws = {
  39890. getInitial: function (key, params) {
  39891. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39892. return getGenericURL("ws", params, path);
  39893. }
  39894. };
  39895. var http = {
  39896. getInitial: function (key, params) {
  39897. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39898. return getGenericURL("http", params, path);
  39899. }
  39900. };
  39901. var sockjs = {
  39902. getInitial: function (key, params) {
  39903. return getGenericURL("http", params, params.httpPath || "/pusher");
  39904. },
  39905. getPath: function (key, params) {
  39906. return getGenericPath(key);
  39907. }
  39908. };
  39909. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39910. var callback_registry_CallbackRegistry = (function () {
  39911. function CallbackRegistry() {
  39912. this._callbacks = {};
  39913. }
  39914. CallbackRegistry.prototype.get = function (name) {
  39915. return this._callbacks[prefix(name)];
  39916. };
  39917. CallbackRegistry.prototype.add = function (name, callback, context) {
  39918. var prefixedEventName = prefix(name);
  39919. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39920. this._callbacks[prefixedEventName].push({
  39921. fn: callback,
  39922. context: context
  39923. });
  39924. };
  39925. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39926. if (!name && !callback && !context) {
  39927. this._callbacks = {};
  39928. return;
  39929. }
  39930. var names = name ? [prefix(name)] : keys(this._callbacks);
  39931. if (callback || context) {
  39932. this.removeCallback(names, callback, context);
  39933. }
  39934. else {
  39935. this.removeAllCallbacks(names);
  39936. }
  39937. };
  39938. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39939. apply(names, function (name) {
  39940. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39941. return (callback && callback !== binding.fn) ||
  39942. (context && context !== binding.context);
  39943. });
  39944. if (this._callbacks[name].length === 0) {
  39945. delete this._callbacks[name];
  39946. }
  39947. }, this);
  39948. };
  39949. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39950. apply(names, function (name) {
  39951. delete this._callbacks[name];
  39952. }, this);
  39953. };
  39954. return CallbackRegistry;
  39955. }());
  39956. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39957. function prefix(name) {
  39958. return "_" + name;
  39959. }
  39960. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39961. var dispatcher_Dispatcher = (function () {
  39962. function Dispatcher(failThrough) {
  39963. this.callbacks = new callback_registry();
  39964. this.global_callbacks = [];
  39965. this.failThrough = failThrough;
  39966. }
  39967. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39968. this.callbacks.add(eventName, callback, context);
  39969. return this;
  39970. };
  39971. Dispatcher.prototype.bind_global = function (callback) {
  39972. this.global_callbacks.push(callback);
  39973. return this;
  39974. };
  39975. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39976. this.callbacks.remove(eventName, callback, context);
  39977. return this;
  39978. };
  39979. Dispatcher.prototype.unbind_global = function (callback) {
  39980. if (!callback) {
  39981. this.global_callbacks = [];
  39982. return this;
  39983. }
  39984. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39985. return this;
  39986. };
  39987. Dispatcher.prototype.unbind_all = function () {
  39988. this.unbind();
  39989. this.unbind_global();
  39990. return this;
  39991. };
  39992. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39993. for (var i = 0; i < this.global_callbacks.length; i++) {
  39994. this.global_callbacks[i](eventName, data);
  39995. }
  39996. var callbacks = this.callbacks.get(eventName);
  39997. var args = [];
  39998. if (metadata) {
  39999. args.push(data, metadata);
  40000. }
  40001. else if (data) {
  40002. args.push(data);
  40003. }
  40004. if (callbacks && callbacks.length > 0) {
  40005. for (var i = 0; i < callbacks.length; i++) {
  40006. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40007. }
  40008. }
  40009. else if (this.failThrough) {
  40010. this.failThrough(eventName, data);
  40011. }
  40012. return this;
  40013. };
  40014. return Dispatcher;
  40015. }());
  40016. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40017. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40018. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40019. var extendStatics = function (d, b) {
  40020. extendStatics = Object.setPrototypeOf ||
  40021. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40022. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40023. return extendStatics(d, b);
  40024. };
  40025. return function (d, b) {
  40026. extendStatics(d, b);
  40027. function __() { this.constructor = d; }
  40028. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40029. };
  40030. })();
  40031. var transport_connection_TransportConnection = (function (_super) {
  40032. transport_connection_extends(TransportConnection, _super);
  40033. function TransportConnection(hooks, name, priority, key, options) {
  40034. var _this = _super.call(this) || this;
  40035. _this.initialize = runtime.transportConnectionInitializer;
  40036. _this.hooks = hooks;
  40037. _this.name = name;
  40038. _this.priority = priority;
  40039. _this.key = key;
  40040. _this.options = options;
  40041. _this.state = "new";
  40042. _this.timeline = options.timeline;
  40043. _this.activityTimeout = options.activityTimeout;
  40044. _this.id = _this.timeline.generateUniqueID();
  40045. return _this;
  40046. }
  40047. TransportConnection.prototype.handlesActivityChecks = function () {
  40048. return Boolean(this.hooks.handlesActivityChecks);
  40049. };
  40050. TransportConnection.prototype.supportsPing = function () {
  40051. return Boolean(this.hooks.supportsPing);
  40052. };
  40053. TransportConnection.prototype.connect = function () {
  40054. var _this = this;
  40055. if (this.socket || this.state !== "initialized") {
  40056. return false;
  40057. }
  40058. var url = this.hooks.urls.getInitial(this.key, this.options);
  40059. try {
  40060. this.socket = this.hooks.getSocket(url, this.options);
  40061. }
  40062. catch (e) {
  40063. util.defer(function () {
  40064. _this.onError(e);
  40065. _this.changeState("closed");
  40066. });
  40067. return false;
  40068. }
  40069. this.bindListeners();
  40070. logger.debug("Connecting", { transport: this.name, url: url });
  40071. this.changeState("connecting");
  40072. return true;
  40073. };
  40074. TransportConnection.prototype.close = function () {
  40075. if (this.socket) {
  40076. this.socket.close();
  40077. return true;
  40078. }
  40079. else {
  40080. return false;
  40081. }
  40082. };
  40083. TransportConnection.prototype.send = function (data) {
  40084. var _this = this;
  40085. if (this.state === "open") {
  40086. util.defer(function () {
  40087. if (_this.socket) {
  40088. _this.socket.send(data);
  40089. }
  40090. });
  40091. return true;
  40092. }
  40093. else {
  40094. return false;
  40095. }
  40096. };
  40097. TransportConnection.prototype.ping = function () {
  40098. if (this.state === "open" && this.supportsPing()) {
  40099. this.socket.ping();
  40100. }
  40101. };
  40102. TransportConnection.prototype.onOpen = function () {
  40103. if (this.hooks.beforeOpen) {
  40104. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40105. }
  40106. this.changeState("open");
  40107. this.socket.onopen = undefined;
  40108. };
  40109. TransportConnection.prototype.onError = function (error) {
  40110. this.emit("error", { type: 'WebSocketError', error: error });
  40111. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40112. };
  40113. TransportConnection.prototype.onClose = function (closeEvent) {
  40114. if (closeEvent) {
  40115. this.changeState("closed", {
  40116. code: closeEvent.code,
  40117. reason: closeEvent.reason,
  40118. wasClean: closeEvent.wasClean
  40119. });
  40120. }
  40121. else {
  40122. this.changeState("closed");
  40123. }
  40124. this.unbindListeners();
  40125. this.socket = undefined;
  40126. };
  40127. TransportConnection.prototype.onMessage = function (message) {
  40128. this.emit("message", message);
  40129. };
  40130. TransportConnection.prototype.onActivity = function () {
  40131. this.emit("activity");
  40132. };
  40133. TransportConnection.prototype.bindListeners = function () {
  40134. var _this = this;
  40135. this.socket.onopen = function () {
  40136. _this.onOpen();
  40137. };
  40138. this.socket.onerror = function (error) {
  40139. _this.onError(error);
  40140. };
  40141. this.socket.onclose = function (closeEvent) {
  40142. _this.onClose(closeEvent);
  40143. };
  40144. this.socket.onmessage = function (message) {
  40145. _this.onMessage(message);
  40146. };
  40147. if (this.supportsPing()) {
  40148. this.socket.onactivity = function () { _this.onActivity(); };
  40149. }
  40150. };
  40151. TransportConnection.prototype.unbindListeners = function () {
  40152. if (this.socket) {
  40153. this.socket.onopen = undefined;
  40154. this.socket.onerror = undefined;
  40155. this.socket.onclose = undefined;
  40156. this.socket.onmessage = undefined;
  40157. if (this.supportsPing()) {
  40158. this.socket.onactivity = undefined;
  40159. }
  40160. }
  40161. };
  40162. TransportConnection.prototype.changeState = function (state, params) {
  40163. this.state = state;
  40164. this.timeline.info(this.buildTimelineMessage({
  40165. state: state,
  40166. params: params
  40167. }));
  40168. this.emit(state, params);
  40169. };
  40170. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40171. return extend({ cid: this.id }, message);
  40172. };
  40173. return TransportConnection;
  40174. }(dispatcher));
  40175. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40176. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40177. var transport_Transport = (function () {
  40178. function Transport(hooks) {
  40179. this.hooks = hooks;
  40180. }
  40181. Transport.prototype.isSupported = function (environment) {
  40182. return this.hooks.isSupported(environment);
  40183. };
  40184. Transport.prototype.createConnection = function (name, priority, key, options) {
  40185. return new transport_connection(this.hooks, name, priority, key, options);
  40186. };
  40187. return Transport;
  40188. }());
  40189. /* harmony default export */ var transports_transport = (transport_Transport);
  40190. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40191. var WSTransport = new transports_transport({
  40192. urls: ws,
  40193. handlesActivityChecks: false,
  40194. supportsPing: false,
  40195. isInitialized: function () {
  40196. return Boolean(runtime.getWebSocketAPI());
  40197. },
  40198. isSupported: function () {
  40199. return Boolean(runtime.getWebSocketAPI());
  40200. },
  40201. getSocket: function (url) {
  40202. return runtime.createWebSocket(url);
  40203. }
  40204. });
  40205. var httpConfiguration = {
  40206. urls: http,
  40207. handlesActivityChecks: false,
  40208. supportsPing: true,
  40209. isInitialized: function () {
  40210. return true;
  40211. }
  40212. };
  40213. var streamingConfiguration = extend({ getSocket: function (url) {
  40214. return runtime.HTTPFactory.createStreamingSocket(url);
  40215. }
  40216. }, httpConfiguration);
  40217. var pollingConfiguration = extend({ getSocket: function (url) {
  40218. return runtime.HTTPFactory.createPollingSocket(url);
  40219. }
  40220. }, httpConfiguration);
  40221. var xhrConfiguration = {
  40222. isSupported: function () {
  40223. return runtime.isXHRSupported();
  40224. }
  40225. };
  40226. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40227. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40228. var Transports = {
  40229. ws: WSTransport,
  40230. xhr_streaming: XHRStreamingTransport,
  40231. xhr_polling: XHRPollingTransport
  40232. };
  40233. /* harmony default export */ var transports = (Transports);
  40234. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40235. var SockJSTransport = new transports_transport({
  40236. file: "sockjs",
  40237. urls: sockjs,
  40238. handlesActivityChecks: true,
  40239. supportsPing: false,
  40240. isSupported: function () {
  40241. return true;
  40242. },
  40243. isInitialized: function () {
  40244. return window.SockJS !== undefined;
  40245. },
  40246. getSocket: function (url, options) {
  40247. return new window.SockJS(url, null, {
  40248. js_path: Dependencies.getPath("sockjs", {
  40249. useTLS: options.useTLS
  40250. }),
  40251. ignore_null_origin: options.ignoreNullOrigin
  40252. });
  40253. },
  40254. beforeOpen: function (socket, path) {
  40255. socket.send(JSON.stringify({
  40256. path: path
  40257. }));
  40258. }
  40259. });
  40260. var xdrConfiguration = {
  40261. isSupported: function (environment) {
  40262. var yes = runtime.isXDRSupported(environment.useTLS);
  40263. return yes;
  40264. }
  40265. };
  40266. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40267. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40268. transports.xdr_streaming = XDRStreamingTransport;
  40269. transports.xdr_polling = XDRPollingTransport;
  40270. transports.sockjs = SockJSTransport;
  40271. /* harmony default export */ var transports_transports = (transports);
  40272. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40273. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40274. var extendStatics = function (d, b) {
  40275. extendStatics = Object.setPrototypeOf ||
  40276. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40277. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40278. return extendStatics(d, b);
  40279. };
  40280. return function (d, b) {
  40281. extendStatics(d, b);
  40282. function __() { this.constructor = d; }
  40283. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40284. };
  40285. })();
  40286. var NetInfo = (function (_super) {
  40287. net_info_extends(NetInfo, _super);
  40288. function NetInfo() {
  40289. var _this = _super.call(this) || this;
  40290. var self = _this;
  40291. if (window.addEventListener !== undefined) {
  40292. window.addEventListener("online", function () {
  40293. self.emit('online');
  40294. }, false);
  40295. window.addEventListener("offline", function () {
  40296. self.emit('offline');
  40297. }, false);
  40298. }
  40299. return _this;
  40300. }
  40301. NetInfo.prototype.isOnline = function () {
  40302. if (window.navigator.onLine === undefined) {
  40303. return true;
  40304. }
  40305. else {
  40306. return window.navigator.onLine;
  40307. }
  40308. };
  40309. return NetInfo;
  40310. }(dispatcher));
  40311. var net_info_Network = new NetInfo();
  40312. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40313. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40314. function AssistantToTheTransportManager(manager, transport, options) {
  40315. this.manager = manager;
  40316. this.transport = transport;
  40317. this.minPingDelay = options.minPingDelay;
  40318. this.maxPingDelay = options.maxPingDelay;
  40319. this.pingDelay = undefined;
  40320. }
  40321. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40322. var _this = this;
  40323. options = extend({}, options, {
  40324. activityTimeout: this.pingDelay
  40325. });
  40326. var connection = this.transport.createConnection(name, priority, key, options);
  40327. var openTimestamp = null;
  40328. var onOpen = function () {
  40329. connection.unbind("open", onOpen);
  40330. connection.bind("closed", onClosed);
  40331. openTimestamp = util.now();
  40332. };
  40333. var onClosed = function (closeEvent) {
  40334. connection.unbind("closed", onClosed);
  40335. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40336. _this.manager.reportDeath();
  40337. }
  40338. else if (!closeEvent.wasClean && openTimestamp) {
  40339. var lifespan = util.now() - openTimestamp;
  40340. if (lifespan < 2 * _this.maxPingDelay) {
  40341. _this.manager.reportDeath();
  40342. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40343. }
  40344. }
  40345. };
  40346. connection.bind("open", onOpen);
  40347. return connection;
  40348. };
  40349. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40350. return this.manager.isAlive() && this.transport.isSupported(environment);
  40351. };
  40352. return AssistantToTheTransportManager;
  40353. }());
  40354. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40355. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40356. var Protocol = {
  40357. decodeMessage: function (messageEvent) {
  40358. try {
  40359. var messageData = JSON.parse(messageEvent.data);
  40360. var pusherEventData = messageData.data;
  40361. if (typeof pusherEventData === 'string') {
  40362. try {
  40363. pusherEventData = JSON.parse(messageData.data);
  40364. }
  40365. catch (e) { }
  40366. }
  40367. var pusherEvent = {
  40368. event: messageData.event,
  40369. channel: messageData.channel,
  40370. data: pusherEventData,
  40371. };
  40372. if (messageData.user_id) {
  40373. pusherEvent.user_id = messageData.user_id;
  40374. }
  40375. return pusherEvent;
  40376. }
  40377. catch (e) {
  40378. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40379. }
  40380. },
  40381. encodeMessage: function (event) {
  40382. return JSON.stringify(event);
  40383. },
  40384. processHandshake: function (messageEvent) {
  40385. var message = Protocol.decodeMessage(messageEvent);
  40386. if (message.event === "pusher:connection_established") {
  40387. if (!message.data.activity_timeout) {
  40388. throw "No activity timeout specified in handshake";
  40389. }
  40390. return {
  40391. action: "connected",
  40392. id: message.data.socket_id,
  40393. activityTimeout: message.data.activity_timeout * 1000
  40394. };
  40395. }
  40396. else if (message.event === "pusher:error") {
  40397. return {
  40398. action: this.getCloseAction(message.data),
  40399. error: this.getCloseError(message.data)
  40400. };
  40401. }
  40402. else {
  40403. throw "Invalid handshake";
  40404. }
  40405. },
  40406. getCloseAction: function (closeEvent) {
  40407. if (closeEvent.code < 4000) {
  40408. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40409. return "backoff";
  40410. }
  40411. else {
  40412. return null;
  40413. }
  40414. }
  40415. else if (closeEvent.code === 4000) {
  40416. return "tls_only";
  40417. }
  40418. else if (closeEvent.code < 4100) {
  40419. return "refused";
  40420. }
  40421. else if (closeEvent.code < 4200) {
  40422. return "backoff";
  40423. }
  40424. else if (closeEvent.code < 4300) {
  40425. return "retry";
  40426. }
  40427. else {
  40428. return "refused";
  40429. }
  40430. },
  40431. getCloseError: function (closeEvent) {
  40432. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40433. return {
  40434. type: 'PusherError',
  40435. data: {
  40436. code: closeEvent.code,
  40437. message: closeEvent.reason || closeEvent.message
  40438. }
  40439. };
  40440. }
  40441. else {
  40442. return null;
  40443. }
  40444. }
  40445. };
  40446. /* harmony default export */ var protocol_protocol = (Protocol);
  40447. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40448. var connection_extends = (undefined && undefined.__extends) || (function () {
  40449. var extendStatics = function (d, b) {
  40450. extendStatics = Object.setPrototypeOf ||
  40451. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40452. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40453. return extendStatics(d, b);
  40454. };
  40455. return function (d, b) {
  40456. extendStatics(d, b);
  40457. function __() { this.constructor = d; }
  40458. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40459. };
  40460. })();
  40461. var connection_Connection = (function (_super) {
  40462. connection_extends(Connection, _super);
  40463. function Connection(id, transport) {
  40464. var _this = _super.call(this) || this;
  40465. _this.id = id;
  40466. _this.transport = transport;
  40467. _this.activityTimeout = transport.activityTimeout;
  40468. _this.bindListeners();
  40469. return _this;
  40470. }
  40471. Connection.prototype.handlesActivityChecks = function () {
  40472. return this.transport.handlesActivityChecks();
  40473. };
  40474. Connection.prototype.send = function (data) {
  40475. return this.transport.send(data);
  40476. };
  40477. Connection.prototype.send_event = function (name, data, channel) {
  40478. var event = { event: name, data: data };
  40479. if (channel) {
  40480. event.channel = channel;
  40481. }
  40482. logger.debug('Event sent', event);
  40483. return this.send(protocol_protocol.encodeMessage(event));
  40484. };
  40485. Connection.prototype.ping = function () {
  40486. if (this.transport.supportsPing()) {
  40487. this.transport.ping();
  40488. }
  40489. else {
  40490. this.send_event('pusher:ping', {});
  40491. }
  40492. };
  40493. Connection.prototype.close = function () {
  40494. this.transport.close();
  40495. };
  40496. Connection.prototype.bindListeners = function () {
  40497. var _this = this;
  40498. var listeners = {
  40499. message: function (messageEvent) {
  40500. var pusherEvent;
  40501. try {
  40502. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40503. }
  40504. catch (e) {
  40505. _this.emit('error', {
  40506. type: 'MessageParseError',
  40507. error: e,
  40508. data: messageEvent.data
  40509. });
  40510. }
  40511. if (pusherEvent !== undefined) {
  40512. logger.debug('Event recd', pusherEvent);
  40513. switch (pusherEvent.event) {
  40514. case 'pusher:error':
  40515. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40516. break;
  40517. case 'pusher:ping':
  40518. _this.emit("ping");
  40519. break;
  40520. case 'pusher:pong':
  40521. _this.emit("pong");
  40522. break;
  40523. }
  40524. _this.emit('message', pusherEvent);
  40525. }
  40526. },
  40527. activity: function () {
  40528. _this.emit("activity");
  40529. },
  40530. error: function (error) {
  40531. _this.emit("error", { type: "WebSocketError", error: error });
  40532. },
  40533. closed: function (closeEvent) {
  40534. unbindListeners();
  40535. if (closeEvent && closeEvent.code) {
  40536. _this.handleCloseEvent(closeEvent);
  40537. }
  40538. _this.transport = null;
  40539. _this.emit("closed");
  40540. }
  40541. };
  40542. var unbindListeners = function () {
  40543. objectApply(listeners, function (listener, event) {
  40544. _this.transport.unbind(event, listener);
  40545. });
  40546. };
  40547. objectApply(listeners, function (listener, event) {
  40548. _this.transport.bind(event, listener);
  40549. });
  40550. };
  40551. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40552. var action = protocol_protocol.getCloseAction(closeEvent);
  40553. var error = protocol_protocol.getCloseError(closeEvent);
  40554. if (error) {
  40555. this.emit('error', error);
  40556. }
  40557. if (action) {
  40558. this.emit(action, { action: action, error: error });
  40559. }
  40560. };
  40561. return Connection;
  40562. }(dispatcher));
  40563. /* harmony default export */ var connection_connection = (connection_Connection);
  40564. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40565. var handshake_Handshake = (function () {
  40566. function Handshake(transport, callback) {
  40567. this.transport = transport;
  40568. this.callback = callback;
  40569. this.bindListeners();
  40570. }
  40571. Handshake.prototype.close = function () {
  40572. this.unbindListeners();
  40573. this.transport.close();
  40574. };
  40575. Handshake.prototype.bindListeners = function () {
  40576. var _this = this;
  40577. this.onMessage = function (m) {
  40578. _this.unbindListeners();
  40579. var result;
  40580. try {
  40581. result = protocol_protocol.processHandshake(m);
  40582. }
  40583. catch (e) {
  40584. _this.finish("error", { error: e });
  40585. _this.transport.close();
  40586. return;
  40587. }
  40588. if (result.action === "connected") {
  40589. _this.finish("connected", {
  40590. connection: new connection_connection(result.id, _this.transport),
  40591. activityTimeout: result.activityTimeout
  40592. });
  40593. }
  40594. else {
  40595. _this.finish(result.action, { error: result.error });
  40596. _this.transport.close();
  40597. }
  40598. };
  40599. this.onClosed = function (closeEvent) {
  40600. _this.unbindListeners();
  40601. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40602. var error = protocol_protocol.getCloseError(closeEvent);
  40603. _this.finish(action, { error: error });
  40604. };
  40605. this.transport.bind("message", this.onMessage);
  40606. this.transport.bind("closed", this.onClosed);
  40607. };
  40608. Handshake.prototype.unbindListeners = function () {
  40609. this.transport.unbind("message", this.onMessage);
  40610. this.transport.unbind("closed", this.onClosed);
  40611. };
  40612. Handshake.prototype.finish = function (action, params) {
  40613. this.callback(extend({ transport: this.transport, action: action }, params));
  40614. };
  40615. return Handshake;
  40616. }());
  40617. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40618. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40619. var pusher_authorizer_PusherAuthorizer = (function () {
  40620. function PusherAuthorizer(channel, options) {
  40621. this.channel = channel;
  40622. var authTransport = options.authTransport;
  40623. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40624. throw "'" + authTransport + "' is not a recognized auth transport";
  40625. }
  40626. this.type = authTransport;
  40627. this.options = options;
  40628. this.authOptions = (options || {}).auth || {};
  40629. }
  40630. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40631. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40632. '&channel_name=' + encodeURIComponent(this.channel.name);
  40633. for (var i in this.authOptions.params) {
  40634. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40635. }
  40636. return query;
  40637. };
  40638. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40639. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40640. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40641. };
  40642. return PusherAuthorizer;
  40643. }());
  40644. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40645. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40646. var timeline_sender_TimelineSender = (function () {
  40647. function TimelineSender(timeline, options) {
  40648. this.timeline = timeline;
  40649. this.options = options || {};
  40650. }
  40651. TimelineSender.prototype.send = function (useTLS, callback) {
  40652. if (this.timeline.isEmpty()) {
  40653. return;
  40654. }
  40655. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40656. };
  40657. return TimelineSender;
  40658. }());
  40659. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40660. // CONCATENATED MODULE: ./src/core/errors.ts
  40661. var errors_extends = (undefined && undefined.__extends) || (function () {
  40662. var extendStatics = function (d, b) {
  40663. extendStatics = Object.setPrototypeOf ||
  40664. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40665. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40666. return extendStatics(d, b);
  40667. };
  40668. return function (d, b) {
  40669. extendStatics(d, b);
  40670. function __() { this.constructor = d; }
  40671. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40672. };
  40673. })();
  40674. var BadEventName = (function (_super) {
  40675. errors_extends(BadEventName, _super);
  40676. function BadEventName(msg) {
  40677. var _newTarget = this.constructor;
  40678. var _this = _super.call(this, msg) || this;
  40679. Object.setPrototypeOf(_this, _newTarget.prototype);
  40680. return _this;
  40681. }
  40682. return BadEventName;
  40683. }(Error));
  40684. var RequestTimedOut = (function (_super) {
  40685. errors_extends(RequestTimedOut, _super);
  40686. function RequestTimedOut(msg) {
  40687. var _newTarget = this.constructor;
  40688. var _this = _super.call(this, msg) || this;
  40689. Object.setPrototypeOf(_this, _newTarget.prototype);
  40690. return _this;
  40691. }
  40692. return RequestTimedOut;
  40693. }(Error));
  40694. var TransportPriorityTooLow = (function (_super) {
  40695. errors_extends(TransportPriorityTooLow, _super);
  40696. function TransportPriorityTooLow(msg) {
  40697. var _newTarget = this.constructor;
  40698. var _this = _super.call(this, msg) || this;
  40699. Object.setPrototypeOf(_this, _newTarget.prototype);
  40700. return _this;
  40701. }
  40702. return TransportPriorityTooLow;
  40703. }(Error));
  40704. var TransportClosed = (function (_super) {
  40705. errors_extends(TransportClosed, _super);
  40706. function TransportClosed(msg) {
  40707. var _newTarget = this.constructor;
  40708. var _this = _super.call(this, msg) || this;
  40709. Object.setPrototypeOf(_this, _newTarget.prototype);
  40710. return _this;
  40711. }
  40712. return TransportClosed;
  40713. }(Error));
  40714. var UnsupportedFeature = (function (_super) {
  40715. errors_extends(UnsupportedFeature, _super);
  40716. function UnsupportedFeature(msg) {
  40717. var _newTarget = this.constructor;
  40718. var _this = _super.call(this, msg) || this;
  40719. Object.setPrototypeOf(_this, _newTarget.prototype);
  40720. return _this;
  40721. }
  40722. return UnsupportedFeature;
  40723. }(Error));
  40724. var UnsupportedTransport = (function (_super) {
  40725. errors_extends(UnsupportedTransport, _super);
  40726. function UnsupportedTransport(msg) {
  40727. var _newTarget = this.constructor;
  40728. var _this = _super.call(this, msg) || this;
  40729. Object.setPrototypeOf(_this, _newTarget.prototype);
  40730. return _this;
  40731. }
  40732. return UnsupportedTransport;
  40733. }(Error));
  40734. var UnsupportedStrategy = (function (_super) {
  40735. errors_extends(UnsupportedStrategy, _super);
  40736. function UnsupportedStrategy(msg) {
  40737. var _newTarget = this.constructor;
  40738. var _this = _super.call(this, msg) || this;
  40739. Object.setPrototypeOf(_this, _newTarget.prototype);
  40740. return _this;
  40741. }
  40742. return UnsupportedStrategy;
  40743. }(Error));
  40744. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40745. var channel_extends = (undefined && undefined.__extends) || (function () {
  40746. var extendStatics = function (d, b) {
  40747. extendStatics = Object.setPrototypeOf ||
  40748. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40749. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40750. return extendStatics(d, b);
  40751. };
  40752. return function (d, b) {
  40753. extendStatics(d, b);
  40754. function __() { this.constructor = d; }
  40755. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40756. };
  40757. })();
  40758. var channel_Channel = (function (_super) {
  40759. channel_extends(Channel, _super);
  40760. function Channel(name, pusher) {
  40761. var _this = _super.call(this, function (event, data) {
  40762. logger.debug('No callbacks on ' + name + ' for ' + event);
  40763. }) || this;
  40764. _this.name = name;
  40765. _this.pusher = pusher;
  40766. _this.subscribed = false;
  40767. _this.subscriptionPending = false;
  40768. _this.subscriptionCancelled = false;
  40769. return _this;
  40770. }
  40771. Channel.prototype.authorize = function (socketId, callback) {
  40772. return callback(false, {});
  40773. };
  40774. Channel.prototype.trigger = function (event, data) {
  40775. if (event.indexOf("client-") !== 0) {
  40776. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40777. }
  40778. if (!this.subscribed) {
  40779. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40780. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40781. }
  40782. return this.pusher.send_event(event, data, this.name);
  40783. };
  40784. Channel.prototype.disconnect = function () {
  40785. this.subscribed = false;
  40786. this.subscriptionPending = false;
  40787. };
  40788. Channel.prototype.handleEvent = function (event) {
  40789. var eventName = event.event;
  40790. var data = event.data;
  40791. if (eventName === "pusher_internal:subscription_succeeded") {
  40792. this.handleSubscriptionSucceededEvent(event);
  40793. }
  40794. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40795. var metadata = {};
  40796. this.emit(eventName, data, metadata);
  40797. }
  40798. };
  40799. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40800. this.subscriptionPending = false;
  40801. this.subscribed = true;
  40802. if (this.subscriptionCancelled) {
  40803. this.pusher.unsubscribe(this.name);
  40804. }
  40805. else {
  40806. this.emit("pusher:subscription_succeeded", event.data);
  40807. }
  40808. };
  40809. Channel.prototype.subscribe = function () {
  40810. var _this = this;
  40811. if (this.subscribed) {
  40812. return;
  40813. }
  40814. this.subscriptionPending = true;
  40815. this.subscriptionCancelled = false;
  40816. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40817. if (error) {
  40818. logger.error(data);
  40819. _this.emit('pusher:subscription_error', data);
  40820. }
  40821. else {
  40822. _this.pusher.send_event('pusher:subscribe', {
  40823. auth: data.auth,
  40824. channel_data: data.channel_data,
  40825. channel: _this.name
  40826. });
  40827. }
  40828. });
  40829. };
  40830. Channel.prototype.unsubscribe = function () {
  40831. this.subscribed = false;
  40832. this.pusher.send_event('pusher:unsubscribe', {
  40833. channel: this.name
  40834. });
  40835. };
  40836. Channel.prototype.cancelSubscription = function () {
  40837. this.subscriptionCancelled = true;
  40838. };
  40839. Channel.prototype.reinstateSubscription = function () {
  40840. this.subscriptionCancelled = false;
  40841. };
  40842. return Channel;
  40843. }(dispatcher));
  40844. /* harmony default export */ var channels_channel = (channel_Channel);
  40845. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40846. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40847. var extendStatics = function (d, b) {
  40848. extendStatics = Object.setPrototypeOf ||
  40849. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40850. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40851. return extendStatics(d, b);
  40852. };
  40853. return function (d, b) {
  40854. extendStatics(d, b);
  40855. function __() { this.constructor = d; }
  40856. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40857. };
  40858. })();
  40859. var private_channel_PrivateChannel = (function (_super) {
  40860. private_channel_extends(PrivateChannel, _super);
  40861. function PrivateChannel() {
  40862. return _super !== null && _super.apply(this, arguments) || this;
  40863. }
  40864. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40865. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40866. return authorizer.authorize(socketId, callback);
  40867. };
  40868. return PrivateChannel;
  40869. }(channels_channel));
  40870. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40871. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40872. var members_Members = (function () {
  40873. function Members() {
  40874. this.reset();
  40875. }
  40876. Members.prototype.get = function (id) {
  40877. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40878. return {
  40879. id: id,
  40880. info: this.members[id]
  40881. };
  40882. }
  40883. else {
  40884. return null;
  40885. }
  40886. };
  40887. Members.prototype.each = function (callback) {
  40888. var _this = this;
  40889. objectApply(this.members, function (member, id) {
  40890. callback(_this.get(id));
  40891. });
  40892. };
  40893. Members.prototype.setMyID = function (id) {
  40894. this.myID = id;
  40895. };
  40896. Members.prototype.onSubscription = function (subscriptionData) {
  40897. this.members = subscriptionData.presence.hash;
  40898. this.count = subscriptionData.presence.count;
  40899. this.me = this.get(this.myID);
  40900. };
  40901. Members.prototype.addMember = function (memberData) {
  40902. if (this.get(memberData.user_id) === null) {
  40903. this.count++;
  40904. }
  40905. this.members[memberData.user_id] = memberData.user_info;
  40906. return this.get(memberData.user_id);
  40907. };
  40908. Members.prototype.removeMember = function (memberData) {
  40909. var member = this.get(memberData.user_id);
  40910. if (member) {
  40911. delete this.members[memberData.user_id];
  40912. this.count--;
  40913. }
  40914. return member;
  40915. };
  40916. Members.prototype.reset = function () {
  40917. this.members = {};
  40918. this.count = 0;
  40919. this.myID = null;
  40920. this.me = null;
  40921. };
  40922. return Members;
  40923. }());
  40924. /* harmony default export */ var members = (members_Members);
  40925. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40926. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40927. var extendStatics = function (d, b) {
  40928. extendStatics = Object.setPrototypeOf ||
  40929. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40930. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40931. return extendStatics(d, b);
  40932. };
  40933. return function (d, b) {
  40934. extendStatics(d, b);
  40935. function __() { this.constructor = d; }
  40936. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40937. };
  40938. })();
  40939. var presence_channel_PresenceChannel = (function (_super) {
  40940. presence_channel_extends(PresenceChannel, _super);
  40941. function PresenceChannel(name, pusher) {
  40942. var _this = _super.call(this, name, pusher) || this;
  40943. _this.members = new members();
  40944. return _this;
  40945. }
  40946. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40947. var _this = this;
  40948. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40949. if (!error) {
  40950. if (authData.channel_data === undefined) {
  40951. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40952. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40953. ("expected 'channel_data' field. " + suffix));
  40954. callback("Invalid auth response");
  40955. return;
  40956. }
  40957. var channelData = JSON.parse(authData.channel_data);
  40958. _this.members.setMyID(channelData.user_id);
  40959. }
  40960. callback(error, authData);
  40961. });
  40962. };
  40963. PresenceChannel.prototype.handleEvent = function (event) {
  40964. var eventName = event.event;
  40965. if (eventName.indexOf("pusher_internal:") === 0) {
  40966. this.handleInternalEvent(event);
  40967. }
  40968. else {
  40969. var data = event.data;
  40970. var metadata = {};
  40971. if (event.user_id) {
  40972. metadata.user_id = event.user_id;
  40973. }
  40974. this.emit(eventName, data, metadata);
  40975. }
  40976. };
  40977. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40978. var eventName = event.event;
  40979. var data = event.data;
  40980. switch (eventName) {
  40981. case "pusher_internal:subscription_succeeded":
  40982. this.handleSubscriptionSucceededEvent(event);
  40983. break;
  40984. case "pusher_internal:member_added":
  40985. var addedMember = this.members.addMember(data);
  40986. this.emit('pusher:member_added', addedMember);
  40987. break;
  40988. case "pusher_internal:member_removed":
  40989. var removedMember = this.members.removeMember(data);
  40990. if (removedMember) {
  40991. this.emit('pusher:member_removed', removedMember);
  40992. }
  40993. break;
  40994. }
  40995. };
  40996. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40997. this.subscriptionPending = false;
  40998. this.subscribed = true;
  40999. if (this.subscriptionCancelled) {
  41000. this.pusher.unsubscribe(this.name);
  41001. }
  41002. else {
  41003. this.members.onSubscription(event.data);
  41004. this.emit("pusher:subscription_succeeded", this.members);
  41005. }
  41006. };
  41007. PresenceChannel.prototype.disconnect = function () {
  41008. this.members.reset();
  41009. _super.prototype.disconnect.call(this);
  41010. };
  41011. return PresenceChannel;
  41012. }(private_channel));
  41013. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41014. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41015. var nacl_fast = __webpack_require__(0);
  41016. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41017. var nacl_util = __webpack_require__(1);
  41018. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41019. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41020. var extendStatics = function (d, b) {
  41021. extendStatics = Object.setPrototypeOf ||
  41022. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41023. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41024. return extendStatics(d, b);
  41025. };
  41026. return function (d, b) {
  41027. extendStatics(d, b);
  41028. function __() { this.constructor = d; }
  41029. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41030. };
  41031. })();
  41032. var encrypted_channel_EncryptedChannel = (function (_super) {
  41033. encrypted_channel_extends(EncryptedChannel, _super);
  41034. function EncryptedChannel() {
  41035. var _this = _super !== null && _super.apply(this, arguments) || this;
  41036. _this.key = null;
  41037. return _this;
  41038. }
  41039. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41040. var _this = this;
  41041. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41042. if (error) {
  41043. callback(true, authData);
  41044. return;
  41045. }
  41046. var sharedSecret = authData["shared_secret"];
  41047. if (!sharedSecret) {
  41048. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41049. callback(true, errorMsg);
  41050. return;
  41051. }
  41052. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41053. delete authData["shared_secret"];
  41054. callback(false, authData);
  41055. });
  41056. };
  41057. EncryptedChannel.prototype.trigger = function (event, data) {
  41058. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41059. };
  41060. EncryptedChannel.prototype.handleEvent = function (event) {
  41061. var eventName = event.event;
  41062. var data = event.data;
  41063. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41064. _super.prototype.handleEvent.call(this, event);
  41065. return;
  41066. }
  41067. this.handleEncryptedEvent(eventName, data);
  41068. };
  41069. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41070. var _this = this;
  41071. if (!this.key) {
  41072. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41073. return;
  41074. }
  41075. if (!data.ciphertext || !data.nonce) {
  41076. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41077. return;
  41078. }
  41079. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41080. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41081. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41082. return;
  41083. }
  41084. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41085. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41086. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41087. return;
  41088. }
  41089. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41090. if (bytes === null) {
  41091. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41092. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41093. if (error) {
  41094. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41095. return;
  41096. }
  41097. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41098. if (bytes === null) {
  41099. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41100. return;
  41101. }
  41102. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41103. return;
  41104. });
  41105. return;
  41106. }
  41107. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41108. };
  41109. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41110. try {
  41111. this.emit(eventName, JSON.parse(data));
  41112. }
  41113. catch (e) {
  41114. this.emit(eventName, data);
  41115. }
  41116. return this;
  41117. };
  41118. return EncryptedChannel;
  41119. }(private_channel));
  41120. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41121. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41122. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41123. var extendStatics = function (d, b) {
  41124. extendStatics = Object.setPrototypeOf ||
  41125. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41126. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41127. return extendStatics(d, b);
  41128. };
  41129. return function (d, b) {
  41130. extendStatics(d, b);
  41131. function __() { this.constructor = d; }
  41132. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41133. };
  41134. })();
  41135. var connection_manager_ConnectionManager = (function (_super) {
  41136. connection_manager_extends(ConnectionManager, _super);
  41137. function ConnectionManager(key, options) {
  41138. var _this = _super.call(this) || this;
  41139. _this.key = key;
  41140. _this.options = options || {};
  41141. _this.state = "initialized";
  41142. _this.connection = null;
  41143. _this.usingTLS = !!options.useTLS;
  41144. _this.timeline = _this.options.timeline;
  41145. _this.errorCallbacks = _this.buildErrorCallbacks();
  41146. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41147. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41148. var Network = runtime.getNetwork();
  41149. Network.bind("online", function () {
  41150. _this.timeline.info({ netinfo: "online" });
  41151. if (_this.state === "connecting" || _this.state === "unavailable") {
  41152. _this.retryIn(0);
  41153. }
  41154. });
  41155. Network.bind("offline", function () {
  41156. _this.timeline.info({ netinfo: "offline" });
  41157. if (_this.connection) {
  41158. _this.sendActivityCheck();
  41159. }
  41160. });
  41161. _this.updateStrategy();
  41162. return _this;
  41163. }
  41164. ConnectionManager.prototype.connect = function () {
  41165. if (this.connection || this.runner) {
  41166. return;
  41167. }
  41168. if (!this.strategy.isSupported()) {
  41169. this.updateState("failed");
  41170. return;
  41171. }
  41172. this.updateState("connecting");
  41173. this.startConnecting();
  41174. this.setUnavailableTimer();
  41175. };
  41176. ;
  41177. ConnectionManager.prototype.send = function (data) {
  41178. if (this.connection) {
  41179. return this.connection.send(data);
  41180. }
  41181. else {
  41182. return false;
  41183. }
  41184. };
  41185. ;
  41186. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41187. if (this.connection) {
  41188. return this.connection.send_event(name, data, channel);
  41189. }
  41190. else {
  41191. return false;
  41192. }
  41193. };
  41194. ;
  41195. ConnectionManager.prototype.disconnect = function () {
  41196. this.disconnectInternally();
  41197. this.updateState("disconnected");
  41198. };
  41199. ;
  41200. ConnectionManager.prototype.isUsingTLS = function () {
  41201. return this.usingTLS;
  41202. };
  41203. ;
  41204. ConnectionManager.prototype.startConnecting = function () {
  41205. var _this = this;
  41206. var callback = function (error, handshake) {
  41207. if (error) {
  41208. _this.runner = _this.strategy.connect(0, callback);
  41209. }
  41210. else {
  41211. if (handshake.action === "error") {
  41212. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41213. _this.timeline.error({ handshakeError: handshake.error });
  41214. }
  41215. else {
  41216. _this.abortConnecting();
  41217. _this.handshakeCallbacks[handshake.action](handshake);
  41218. }
  41219. }
  41220. };
  41221. this.runner = this.strategy.connect(0, callback);
  41222. };
  41223. ;
  41224. ConnectionManager.prototype.abortConnecting = function () {
  41225. if (this.runner) {
  41226. this.runner.abort();
  41227. this.runner = null;
  41228. }
  41229. };
  41230. ;
  41231. ConnectionManager.prototype.disconnectInternally = function () {
  41232. this.abortConnecting();
  41233. this.clearRetryTimer();
  41234. this.clearUnavailableTimer();
  41235. if (this.connection) {
  41236. var connection = this.abandonConnection();
  41237. connection.close();
  41238. }
  41239. };
  41240. ;
  41241. ConnectionManager.prototype.updateStrategy = function () {
  41242. this.strategy = this.options.getStrategy({
  41243. key: this.key,
  41244. timeline: this.timeline,
  41245. useTLS: this.usingTLS
  41246. });
  41247. };
  41248. ;
  41249. ConnectionManager.prototype.retryIn = function (delay) {
  41250. var _this = this;
  41251. this.timeline.info({ action: "retry", delay: delay });
  41252. if (delay > 0) {
  41253. this.emit("connecting_in", Math.round(delay / 1000));
  41254. }
  41255. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41256. _this.disconnectInternally();
  41257. _this.connect();
  41258. });
  41259. };
  41260. ;
  41261. ConnectionManager.prototype.clearRetryTimer = function () {
  41262. if (this.retryTimer) {
  41263. this.retryTimer.ensureAborted();
  41264. this.retryTimer = null;
  41265. }
  41266. };
  41267. ;
  41268. ConnectionManager.prototype.setUnavailableTimer = function () {
  41269. var _this = this;
  41270. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41271. _this.updateState("unavailable");
  41272. });
  41273. };
  41274. ;
  41275. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41276. if (this.unavailableTimer) {
  41277. this.unavailableTimer.ensureAborted();
  41278. }
  41279. };
  41280. ;
  41281. ConnectionManager.prototype.sendActivityCheck = function () {
  41282. var _this = this;
  41283. this.stopActivityCheck();
  41284. this.connection.ping();
  41285. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41286. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41287. _this.retryIn(0);
  41288. });
  41289. };
  41290. ;
  41291. ConnectionManager.prototype.resetActivityCheck = function () {
  41292. var _this = this;
  41293. this.stopActivityCheck();
  41294. if (this.connection && !this.connection.handlesActivityChecks()) {
  41295. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41296. _this.sendActivityCheck();
  41297. });
  41298. }
  41299. };
  41300. ;
  41301. ConnectionManager.prototype.stopActivityCheck = function () {
  41302. if (this.activityTimer) {
  41303. this.activityTimer.ensureAborted();
  41304. }
  41305. };
  41306. ;
  41307. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41308. var _this = this;
  41309. return extend({}, errorCallbacks, {
  41310. message: function (message) {
  41311. _this.resetActivityCheck();
  41312. _this.emit('message', message);
  41313. },
  41314. ping: function () {
  41315. _this.send_event('pusher:pong', {});
  41316. },
  41317. activity: function () {
  41318. _this.resetActivityCheck();
  41319. },
  41320. error: function (error) {
  41321. _this.emit("error", { type: "WebSocketError", error: error });
  41322. },
  41323. closed: function () {
  41324. _this.abandonConnection();
  41325. if (_this.shouldRetry()) {
  41326. _this.retryIn(1000);
  41327. }
  41328. }
  41329. });
  41330. };
  41331. ;
  41332. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41333. var _this = this;
  41334. return extend({}, errorCallbacks, {
  41335. connected: function (handshake) {
  41336. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41337. _this.clearUnavailableTimer();
  41338. _this.setConnection(handshake.connection);
  41339. _this.socket_id = _this.connection.id;
  41340. _this.updateState("connected", { socket_id: _this.socket_id });
  41341. }
  41342. });
  41343. };
  41344. ;
  41345. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41346. var _this = this;
  41347. var withErrorEmitted = function (callback) {
  41348. return function (result) {
  41349. if (result.error) {
  41350. _this.emit("error", { type: "WebSocketError", error: result.error });
  41351. }
  41352. callback(result);
  41353. };
  41354. };
  41355. return {
  41356. tls_only: withErrorEmitted(function () {
  41357. _this.usingTLS = true;
  41358. _this.updateStrategy();
  41359. _this.retryIn(0);
  41360. }),
  41361. refused: withErrorEmitted(function () {
  41362. _this.disconnect();
  41363. }),
  41364. backoff: withErrorEmitted(function () {
  41365. _this.retryIn(1000);
  41366. }),
  41367. retry: withErrorEmitted(function () {
  41368. _this.retryIn(0);
  41369. })
  41370. };
  41371. };
  41372. ;
  41373. ConnectionManager.prototype.setConnection = function (connection) {
  41374. this.connection = connection;
  41375. for (var event in this.connectionCallbacks) {
  41376. this.connection.bind(event, this.connectionCallbacks[event]);
  41377. }
  41378. this.resetActivityCheck();
  41379. };
  41380. ;
  41381. ConnectionManager.prototype.abandonConnection = function () {
  41382. if (!this.connection) {
  41383. return;
  41384. }
  41385. this.stopActivityCheck();
  41386. for (var event in this.connectionCallbacks) {
  41387. this.connection.unbind(event, this.connectionCallbacks[event]);
  41388. }
  41389. var connection = this.connection;
  41390. this.connection = null;
  41391. return connection;
  41392. };
  41393. ConnectionManager.prototype.updateState = function (newState, data) {
  41394. var previousState = this.state;
  41395. this.state = newState;
  41396. if (previousState !== newState) {
  41397. var newStateDescription = newState;
  41398. if (newStateDescription === "connected") {
  41399. newStateDescription += " with new socket ID " + data.socket_id;
  41400. }
  41401. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41402. this.timeline.info({ state: newState, params: data });
  41403. this.emit('state_change', { previous: previousState, current: newState });
  41404. this.emit(newState, data);
  41405. }
  41406. };
  41407. ConnectionManager.prototype.shouldRetry = function () {
  41408. return this.state === "connecting" || this.state === "connected";
  41409. };
  41410. return ConnectionManager;
  41411. }(dispatcher));
  41412. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41413. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41414. var channels_Channels = (function () {
  41415. function Channels() {
  41416. this.channels = {};
  41417. }
  41418. Channels.prototype.add = function (name, pusher) {
  41419. if (!this.channels[name]) {
  41420. this.channels[name] = createChannel(name, pusher);
  41421. }
  41422. return this.channels[name];
  41423. };
  41424. Channels.prototype.all = function () {
  41425. return values(this.channels);
  41426. };
  41427. Channels.prototype.find = function (name) {
  41428. return this.channels[name];
  41429. };
  41430. Channels.prototype.remove = function (name) {
  41431. var channel = this.channels[name];
  41432. delete this.channels[name];
  41433. return channel;
  41434. };
  41435. Channels.prototype.disconnect = function () {
  41436. objectApply(this.channels, function (channel) {
  41437. channel.disconnect();
  41438. });
  41439. };
  41440. return Channels;
  41441. }());
  41442. /* harmony default export */ var channels = (channels_Channels);
  41443. function createChannel(name, pusher) {
  41444. if (name.indexOf('private-encrypted-') === 0) {
  41445. if (false) { var errorMsg; }
  41446. return factory.createEncryptedChannel(name, pusher);
  41447. }
  41448. else if (name.indexOf('private-') === 0) {
  41449. return factory.createPrivateChannel(name, pusher);
  41450. }
  41451. else if (name.indexOf('presence-') === 0) {
  41452. return factory.createPresenceChannel(name, pusher);
  41453. }
  41454. else {
  41455. return factory.createChannel(name, pusher);
  41456. }
  41457. }
  41458. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41459. var Factory = {
  41460. createChannels: function () {
  41461. return new channels();
  41462. },
  41463. createConnectionManager: function (key, options) {
  41464. return new connection_manager(key, options);
  41465. },
  41466. createChannel: function (name, pusher) {
  41467. return new channels_channel(name, pusher);
  41468. },
  41469. createPrivateChannel: function (name, pusher) {
  41470. return new private_channel(name, pusher);
  41471. },
  41472. createPresenceChannel: function (name, pusher) {
  41473. return new presence_channel(name, pusher);
  41474. },
  41475. createEncryptedChannel: function (name, pusher) {
  41476. return new encrypted_channel(name, pusher);
  41477. },
  41478. createTimelineSender: function (timeline, options) {
  41479. return new timeline_sender(timeline, options);
  41480. },
  41481. createAuthorizer: function (channel, options) {
  41482. if (options.authorizer) {
  41483. return options.authorizer(channel, options);
  41484. }
  41485. return new pusher_authorizer(channel, options);
  41486. },
  41487. createHandshake: function (transport, callback) {
  41488. return new connection_handshake(transport, callback);
  41489. },
  41490. createAssistantToTheTransportManager: function (manager, transport, options) {
  41491. return new assistant_to_the_transport_manager(manager, transport, options);
  41492. }
  41493. };
  41494. /* harmony default export */ var factory = (Factory);
  41495. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41496. var transport_manager_TransportManager = (function () {
  41497. function TransportManager(options) {
  41498. this.options = options || {};
  41499. this.livesLeft = this.options.lives || Infinity;
  41500. }
  41501. TransportManager.prototype.getAssistant = function (transport) {
  41502. return factory.createAssistantToTheTransportManager(this, transport, {
  41503. minPingDelay: this.options.minPingDelay,
  41504. maxPingDelay: this.options.maxPingDelay
  41505. });
  41506. };
  41507. TransportManager.prototype.isAlive = function () {
  41508. return this.livesLeft > 0;
  41509. };
  41510. TransportManager.prototype.reportDeath = function () {
  41511. this.livesLeft -= 1;
  41512. };
  41513. return TransportManager;
  41514. }());
  41515. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41516. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41517. var sequential_strategy_SequentialStrategy = (function () {
  41518. function SequentialStrategy(strategies, options) {
  41519. this.strategies = strategies;
  41520. this.loop = Boolean(options.loop);
  41521. this.failFast = Boolean(options.failFast);
  41522. this.timeout = options.timeout;
  41523. this.timeoutLimit = options.timeoutLimit;
  41524. }
  41525. SequentialStrategy.prototype.isSupported = function () {
  41526. return any(this.strategies, util.method("isSupported"));
  41527. };
  41528. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41529. var _this = this;
  41530. var strategies = this.strategies;
  41531. var current = 0;
  41532. var timeout = this.timeout;
  41533. var runner = null;
  41534. var tryNextStrategy = function (error, handshake) {
  41535. if (handshake) {
  41536. callback(null, handshake);
  41537. }
  41538. else {
  41539. current = current + 1;
  41540. if (_this.loop) {
  41541. current = current % strategies.length;
  41542. }
  41543. if (current < strategies.length) {
  41544. if (timeout) {
  41545. timeout = timeout * 2;
  41546. if (_this.timeoutLimit) {
  41547. timeout = Math.min(timeout, _this.timeoutLimit);
  41548. }
  41549. }
  41550. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41551. }
  41552. else {
  41553. callback(true);
  41554. }
  41555. }
  41556. };
  41557. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41558. return {
  41559. abort: function () {
  41560. runner.abort();
  41561. },
  41562. forceMinPriority: function (p) {
  41563. minPriority = p;
  41564. if (runner) {
  41565. runner.forceMinPriority(p);
  41566. }
  41567. }
  41568. };
  41569. };
  41570. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41571. var timer = null;
  41572. var runner = null;
  41573. if (options.timeout > 0) {
  41574. timer = new OneOffTimer(options.timeout, function () {
  41575. runner.abort();
  41576. callback(true);
  41577. });
  41578. }
  41579. runner = strategy.connect(minPriority, function (error, handshake) {
  41580. if (error && timer && timer.isRunning() && !options.failFast) {
  41581. return;
  41582. }
  41583. if (timer) {
  41584. timer.ensureAborted();
  41585. }
  41586. callback(error, handshake);
  41587. });
  41588. return {
  41589. abort: function () {
  41590. if (timer) {
  41591. timer.ensureAborted();
  41592. }
  41593. runner.abort();
  41594. },
  41595. forceMinPriority: function (p) {
  41596. runner.forceMinPriority(p);
  41597. }
  41598. };
  41599. };
  41600. return SequentialStrategy;
  41601. }());
  41602. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41603. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41604. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41605. function BestConnectedEverStrategy(strategies) {
  41606. this.strategies = strategies;
  41607. }
  41608. BestConnectedEverStrategy.prototype.isSupported = function () {
  41609. return any(this.strategies, util.method("isSupported"));
  41610. };
  41611. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41612. return connect(this.strategies, minPriority, function (i, runners) {
  41613. return function (error, handshake) {
  41614. runners[i].error = error;
  41615. if (error) {
  41616. if (allRunnersFailed(runners)) {
  41617. callback(true);
  41618. }
  41619. return;
  41620. }
  41621. apply(runners, function (runner) {
  41622. runner.forceMinPriority(handshake.transport.priority);
  41623. });
  41624. callback(null, handshake);
  41625. };
  41626. });
  41627. };
  41628. return BestConnectedEverStrategy;
  41629. }());
  41630. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41631. function connect(strategies, minPriority, callbackBuilder) {
  41632. var runners = map(strategies, function (strategy, i, _, rs) {
  41633. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41634. });
  41635. return {
  41636. abort: function () {
  41637. apply(runners, abortRunner);
  41638. },
  41639. forceMinPriority: function (p) {
  41640. apply(runners, function (runner) {
  41641. runner.forceMinPriority(p);
  41642. });
  41643. }
  41644. };
  41645. }
  41646. function allRunnersFailed(runners) {
  41647. return collections_all(runners, function (runner) {
  41648. return Boolean(runner.error);
  41649. });
  41650. }
  41651. function abortRunner(runner) {
  41652. if (!runner.error && !runner.aborted) {
  41653. runner.abort();
  41654. runner.aborted = true;
  41655. }
  41656. }
  41657. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41658. var cached_strategy_CachedStrategy = (function () {
  41659. function CachedStrategy(strategy, transports, options) {
  41660. this.strategy = strategy;
  41661. this.transports = transports;
  41662. this.ttl = options.ttl || 1800 * 1000;
  41663. this.usingTLS = options.useTLS;
  41664. this.timeline = options.timeline;
  41665. }
  41666. CachedStrategy.prototype.isSupported = function () {
  41667. return this.strategy.isSupported();
  41668. };
  41669. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41670. var usingTLS = this.usingTLS;
  41671. var info = fetchTransportCache(usingTLS);
  41672. var strategies = [this.strategy];
  41673. if (info && info.timestamp + this.ttl >= util.now()) {
  41674. var transport = this.transports[info.transport];
  41675. if (transport) {
  41676. this.timeline.info({
  41677. cached: true,
  41678. transport: info.transport,
  41679. latency: info.latency
  41680. });
  41681. strategies.push(new sequential_strategy([transport], {
  41682. timeout: info.latency * 2 + 1000,
  41683. failFast: true
  41684. }));
  41685. }
  41686. }
  41687. var startTimestamp = util.now();
  41688. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41689. if (error) {
  41690. flushTransportCache(usingTLS);
  41691. if (strategies.length > 0) {
  41692. startTimestamp = util.now();
  41693. runner = strategies.pop().connect(minPriority, cb);
  41694. }
  41695. else {
  41696. callback(error);
  41697. }
  41698. }
  41699. else {
  41700. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41701. callback(null, handshake);
  41702. }
  41703. });
  41704. return {
  41705. abort: function () {
  41706. runner.abort();
  41707. },
  41708. forceMinPriority: function (p) {
  41709. minPriority = p;
  41710. if (runner) {
  41711. runner.forceMinPriority(p);
  41712. }
  41713. }
  41714. };
  41715. };
  41716. return CachedStrategy;
  41717. }());
  41718. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41719. function getTransportCacheKey(usingTLS) {
  41720. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41721. }
  41722. function fetchTransportCache(usingTLS) {
  41723. var storage = runtime.getLocalStorage();
  41724. if (storage) {
  41725. try {
  41726. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41727. if (serializedCache) {
  41728. return JSON.parse(serializedCache);
  41729. }
  41730. }
  41731. catch (e) {
  41732. flushTransportCache(usingTLS);
  41733. }
  41734. }
  41735. return null;
  41736. }
  41737. function storeTransportCache(usingTLS, transport, latency) {
  41738. var storage = runtime.getLocalStorage();
  41739. if (storage) {
  41740. try {
  41741. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41742. timestamp: util.now(),
  41743. transport: transport,
  41744. latency: latency
  41745. });
  41746. }
  41747. catch (e) {
  41748. }
  41749. }
  41750. }
  41751. function flushTransportCache(usingTLS) {
  41752. var storage = runtime.getLocalStorage();
  41753. if (storage) {
  41754. try {
  41755. delete storage[getTransportCacheKey(usingTLS)];
  41756. }
  41757. catch (e) {
  41758. }
  41759. }
  41760. }
  41761. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41762. var delayed_strategy_DelayedStrategy = (function () {
  41763. function DelayedStrategy(strategy, _a) {
  41764. var number = _a.delay;
  41765. this.strategy = strategy;
  41766. this.options = { delay: number };
  41767. }
  41768. DelayedStrategy.prototype.isSupported = function () {
  41769. return this.strategy.isSupported();
  41770. };
  41771. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41772. var strategy = this.strategy;
  41773. var runner;
  41774. var timer = new OneOffTimer(this.options.delay, function () {
  41775. runner = strategy.connect(minPriority, callback);
  41776. });
  41777. return {
  41778. abort: function () {
  41779. timer.ensureAborted();
  41780. if (runner) {
  41781. runner.abort();
  41782. }
  41783. },
  41784. forceMinPriority: function (p) {
  41785. minPriority = p;
  41786. if (runner) {
  41787. runner.forceMinPriority(p);
  41788. }
  41789. }
  41790. };
  41791. };
  41792. return DelayedStrategy;
  41793. }());
  41794. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41795. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41796. var IfStrategy = (function () {
  41797. function IfStrategy(test, trueBranch, falseBranch) {
  41798. this.test = test;
  41799. this.trueBranch = trueBranch;
  41800. this.falseBranch = falseBranch;
  41801. }
  41802. IfStrategy.prototype.isSupported = function () {
  41803. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41804. return branch.isSupported();
  41805. };
  41806. IfStrategy.prototype.connect = function (minPriority, callback) {
  41807. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41808. return branch.connect(minPriority, callback);
  41809. };
  41810. return IfStrategy;
  41811. }());
  41812. /* harmony default export */ var if_strategy = (IfStrategy);
  41813. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41814. var FirstConnectedStrategy = (function () {
  41815. function FirstConnectedStrategy(strategy) {
  41816. this.strategy = strategy;
  41817. }
  41818. FirstConnectedStrategy.prototype.isSupported = function () {
  41819. return this.strategy.isSupported();
  41820. };
  41821. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41822. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41823. if (handshake) {
  41824. runner.abort();
  41825. }
  41826. callback(error, handshake);
  41827. });
  41828. return runner;
  41829. };
  41830. return FirstConnectedStrategy;
  41831. }());
  41832. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41833. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41834. function testSupportsStrategy(strategy) {
  41835. return function () {
  41836. return strategy.isSupported();
  41837. };
  41838. }
  41839. var getDefaultStrategy = function (config, defineTransport) {
  41840. var definedTransports = {};
  41841. function defineTransportStrategy(name, type, priority, options, manager) {
  41842. var transport = defineTransport(config, name, type, priority, options, manager);
  41843. definedTransports[name] = transport;
  41844. return transport;
  41845. }
  41846. var ws_options = {
  41847. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41848. hostTLS: config.wsHost + ":" + config.wssPort,
  41849. httpPath: config.wsPath
  41850. };
  41851. var wss_options = extend({}, ws_options, {
  41852. useTLS: true
  41853. });
  41854. var sockjs_options = {
  41855. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41856. hostTLS: config.httpHost + ":" + config.httpsPort,
  41857. httpPath: config.httpPath
  41858. };
  41859. var timeouts = {
  41860. loop: true,
  41861. timeout: 15000,
  41862. timeoutLimit: 60000
  41863. };
  41864. var ws_manager = new transport_manager({
  41865. lives: 2,
  41866. minPingDelay: 10000,
  41867. maxPingDelay: config.activity_timeout
  41868. });
  41869. var streaming_manager = new transport_manager({
  41870. lives: 2,
  41871. minPingDelay: 10000,
  41872. maxPingDelay: config.activity_timeout
  41873. });
  41874. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41875. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41876. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41877. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41878. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41879. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41880. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41881. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41882. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41883. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41884. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41885. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41886. 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);
  41887. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41888. var wsStrategy;
  41889. if (config.useTLS) {
  41890. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41891. }
  41892. else {
  41893. wsStrategy = new best_connected_ever_strategy([
  41894. ws_loop,
  41895. new delayed_strategy(wss_loop, { delay: 2000 }),
  41896. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41897. ]);
  41898. }
  41899. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41900. ttl: 1800000,
  41901. timeline: config.timeline,
  41902. useTLS: config.useTLS
  41903. });
  41904. };
  41905. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41906. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41907. /* harmony default export */ var transport_connection_initializer = (function () {
  41908. var self = this;
  41909. self.timeline.info(self.buildTimelineMessage({
  41910. transport: self.name + (self.options.useTLS ? "s" : "")
  41911. }));
  41912. if (self.hooks.isInitialized()) {
  41913. self.changeState("initialized");
  41914. }
  41915. else if (self.hooks.file) {
  41916. self.changeState("initializing");
  41917. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41918. if (self.hooks.isInitialized()) {
  41919. self.changeState("initialized");
  41920. callback(true);
  41921. }
  41922. else {
  41923. if (error) {
  41924. self.onError(error);
  41925. }
  41926. self.onClose();
  41927. callback(false);
  41928. }
  41929. });
  41930. }
  41931. else {
  41932. self.onClose();
  41933. }
  41934. });
  41935. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41936. var http_xdomain_request_hooks = {
  41937. getRequest: function (socket) {
  41938. var xdr = new window.XDomainRequest();
  41939. xdr.ontimeout = function () {
  41940. socket.emit("error", new RequestTimedOut());
  41941. socket.close();
  41942. };
  41943. xdr.onerror = function (e) {
  41944. socket.emit("error", e);
  41945. socket.close();
  41946. };
  41947. xdr.onprogress = function () {
  41948. if (xdr.responseText && xdr.responseText.length > 0) {
  41949. socket.onChunk(200, xdr.responseText);
  41950. }
  41951. };
  41952. xdr.onload = function () {
  41953. if (xdr.responseText && xdr.responseText.length > 0) {
  41954. socket.onChunk(200, xdr.responseText);
  41955. }
  41956. socket.emit("finished", 200);
  41957. socket.close();
  41958. };
  41959. return xdr;
  41960. },
  41961. abortRequest: function (xdr) {
  41962. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41963. xdr.abort();
  41964. }
  41965. };
  41966. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41967. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41968. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41969. var extendStatics = function (d, b) {
  41970. extendStatics = Object.setPrototypeOf ||
  41971. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41972. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41973. return extendStatics(d, b);
  41974. };
  41975. return function (d, b) {
  41976. extendStatics(d, b);
  41977. function __() { this.constructor = d; }
  41978. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41979. };
  41980. })();
  41981. var MAX_BUFFER_LENGTH = 256 * 1024;
  41982. var http_request_HTTPRequest = (function (_super) {
  41983. http_request_extends(HTTPRequest, _super);
  41984. function HTTPRequest(hooks, method, url) {
  41985. var _this = _super.call(this) || this;
  41986. _this.hooks = hooks;
  41987. _this.method = method;
  41988. _this.url = url;
  41989. return _this;
  41990. }
  41991. HTTPRequest.prototype.start = function (payload) {
  41992. var _this = this;
  41993. this.position = 0;
  41994. this.xhr = this.hooks.getRequest(this);
  41995. this.unloader = function () {
  41996. _this.close();
  41997. };
  41998. runtime.addUnloadListener(this.unloader);
  41999. this.xhr.open(this.method, this.url, true);
  42000. if (this.xhr.setRequestHeader) {
  42001. this.xhr.setRequestHeader("Content-Type", "application/json");
  42002. }
  42003. this.xhr.send(payload);
  42004. };
  42005. HTTPRequest.prototype.close = function () {
  42006. if (this.unloader) {
  42007. runtime.removeUnloadListener(this.unloader);
  42008. this.unloader = null;
  42009. }
  42010. if (this.xhr) {
  42011. this.hooks.abortRequest(this.xhr);
  42012. this.xhr = null;
  42013. }
  42014. };
  42015. HTTPRequest.prototype.onChunk = function (status, data) {
  42016. while (true) {
  42017. var chunk = this.advanceBuffer(data);
  42018. if (chunk) {
  42019. this.emit("chunk", { status: status, data: chunk });
  42020. }
  42021. else {
  42022. break;
  42023. }
  42024. }
  42025. if (this.isBufferTooLong(data)) {
  42026. this.emit("buffer_too_long");
  42027. }
  42028. };
  42029. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42030. var unreadData = buffer.slice(this.position);
  42031. var endOfLinePosition = unreadData.indexOf("\n");
  42032. if (endOfLinePosition !== -1) {
  42033. this.position += endOfLinePosition + 1;
  42034. return unreadData.slice(0, endOfLinePosition);
  42035. }
  42036. else {
  42037. return null;
  42038. }
  42039. };
  42040. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42041. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42042. };
  42043. return HTTPRequest;
  42044. }(dispatcher));
  42045. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42046. // CONCATENATED MODULE: ./src/core/http/state.ts
  42047. var State;
  42048. (function (State) {
  42049. State[State["CONNECTING"] = 0] = "CONNECTING";
  42050. State[State["OPEN"] = 1] = "OPEN";
  42051. State[State["CLOSED"] = 3] = "CLOSED";
  42052. })(State || (State = {}));
  42053. /* harmony default export */ var state = (State);
  42054. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42055. var autoIncrement = 1;
  42056. var http_socket_HTTPSocket = (function () {
  42057. function HTTPSocket(hooks, url) {
  42058. this.hooks = hooks;
  42059. this.session = randomNumber(1000) + "/" + randomString(8);
  42060. this.location = getLocation(url);
  42061. this.readyState = state.CONNECTING;
  42062. this.openStream();
  42063. }
  42064. HTTPSocket.prototype.send = function (payload) {
  42065. return this.sendRaw(JSON.stringify([payload]));
  42066. };
  42067. HTTPSocket.prototype.ping = function () {
  42068. this.hooks.sendHeartbeat(this);
  42069. };
  42070. HTTPSocket.prototype.close = function (code, reason) {
  42071. this.onClose(code, reason, true);
  42072. };
  42073. HTTPSocket.prototype.sendRaw = function (payload) {
  42074. if (this.readyState === state.OPEN) {
  42075. try {
  42076. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42077. return true;
  42078. }
  42079. catch (e) {
  42080. return false;
  42081. }
  42082. }
  42083. else {
  42084. return false;
  42085. }
  42086. };
  42087. HTTPSocket.prototype.reconnect = function () {
  42088. this.closeStream();
  42089. this.openStream();
  42090. };
  42091. ;
  42092. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42093. this.closeStream();
  42094. this.readyState = state.CLOSED;
  42095. if (this.onclose) {
  42096. this.onclose({
  42097. code: code,
  42098. reason: reason,
  42099. wasClean: wasClean
  42100. });
  42101. }
  42102. };
  42103. HTTPSocket.prototype.onChunk = function (chunk) {
  42104. if (chunk.status !== 200) {
  42105. return;
  42106. }
  42107. if (this.readyState === state.OPEN) {
  42108. this.onActivity();
  42109. }
  42110. var payload;
  42111. var type = chunk.data.slice(0, 1);
  42112. switch (type) {
  42113. case 'o':
  42114. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42115. this.onOpen(payload);
  42116. break;
  42117. case 'a':
  42118. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42119. for (var i = 0; i < payload.length; i++) {
  42120. this.onEvent(payload[i]);
  42121. }
  42122. break;
  42123. case 'm':
  42124. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42125. this.onEvent(payload);
  42126. break;
  42127. case 'h':
  42128. this.hooks.onHeartbeat(this);
  42129. break;
  42130. case 'c':
  42131. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42132. this.onClose(payload[0], payload[1], true);
  42133. break;
  42134. }
  42135. };
  42136. HTTPSocket.prototype.onOpen = function (options) {
  42137. if (this.readyState === state.CONNECTING) {
  42138. if (options && options.hostname) {
  42139. this.location.base = replaceHost(this.location.base, options.hostname);
  42140. }
  42141. this.readyState = state.OPEN;
  42142. if (this.onopen) {
  42143. this.onopen();
  42144. }
  42145. }
  42146. else {
  42147. this.onClose(1006, "Server lost session", true);
  42148. }
  42149. };
  42150. HTTPSocket.prototype.onEvent = function (event) {
  42151. if (this.readyState === state.OPEN && this.onmessage) {
  42152. this.onmessage({ data: event });
  42153. }
  42154. };
  42155. HTTPSocket.prototype.onActivity = function () {
  42156. if (this.onactivity) {
  42157. this.onactivity();
  42158. }
  42159. };
  42160. HTTPSocket.prototype.onError = function (error) {
  42161. if (this.onerror) {
  42162. this.onerror(error);
  42163. }
  42164. };
  42165. HTTPSocket.prototype.openStream = function () {
  42166. var _this = this;
  42167. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42168. this.stream.bind("chunk", function (chunk) {
  42169. _this.onChunk(chunk);
  42170. });
  42171. this.stream.bind("finished", function (status) {
  42172. _this.hooks.onFinished(_this, status);
  42173. });
  42174. this.stream.bind("buffer_too_long", function () {
  42175. _this.reconnect();
  42176. });
  42177. try {
  42178. this.stream.start();
  42179. }
  42180. catch (error) {
  42181. util.defer(function () {
  42182. _this.onError(error);
  42183. _this.onClose(1006, "Could not start streaming", false);
  42184. });
  42185. }
  42186. };
  42187. HTTPSocket.prototype.closeStream = function () {
  42188. if (this.stream) {
  42189. this.stream.unbind_all();
  42190. this.stream.close();
  42191. this.stream = null;
  42192. }
  42193. };
  42194. return HTTPSocket;
  42195. }());
  42196. function getLocation(url) {
  42197. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42198. return {
  42199. base: parts[1],
  42200. queryString: parts[2]
  42201. };
  42202. }
  42203. function getSendURL(url, session) {
  42204. return url.base + "/" + session + "/xhr_send";
  42205. }
  42206. function getUniqueURL(url) {
  42207. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42208. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42209. }
  42210. function replaceHost(url, hostname) {
  42211. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42212. return urlParts[1] + hostname + urlParts[3];
  42213. }
  42214. function randomNumber(max) {
  42215. return Math.floor(Math.random() * max);
  42216. }
  42217. function randomString(length) {
  42218. var result = [];
  42219. for (var i = 0; i < length; i++) {
  42220. result.push(randomNumber(32).toString(32));
  42221. }
  42222. return result.join('');
  42223. }
  42224. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42225. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42226. var http_streaming_socket_hooks = {
  42227. getReceiveURL: function (url, session) {
  42228. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42229. },
  42230. onHeartbeat: function (socket) {
  42231. socket.sendRaw("[]");
  42232. },
  42233. sendHeartbeat: function (socket) {
  42234. socket.sendRaw("[]");
  42235. },
  42236. onFinished: function (socket, status) {
  42237. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42238. }
  42239. };
  42240. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42241. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42242. var http_polling_socket_hooks = {
  42243. getReceiveURL: function (url, session) {
  42244. return url.base + "/" + session + "/xhr" + url.queryString;
  42245. },
  42246. onHeartbeat: function () {
  42247. },
  42248. sendHeartbeat: function (socket) {
  42249. socket.sendRaw("[]");
  42250. },
  42251. onFinished: function (socket, status) {
  42252. if (status === 200) {
  42253. socket.reconnect();
  42254. }
  42255. else {
  42256. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42257. }
  42258. }
  42259. };
  42260. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42261. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42262. var http_xhr_request_hooks = {
  42263. getRequest: function (socket) {
  42264. var Constructor = runtime.getXHRAPI();
  42265. var xhr = new Constructor();
  42266. xhr.onreadystatechange = xhr.onprogress = function () {
  42267. switch (xhr.readyState) {
  42268. case 3:
  42269. if (xhr.responseText && xhr.responseText.length > 0) {
  42270. socket.onChunk(xhr.status, xhr.responseText);
  42271. }
  42272. break;
  42273. case 4:
  42274. if (xhr.responseText && xhr.responseText.length > 0) {
  42275. socket.onChunk(xhr.status, xhr.responseText);
  42276. }
  42277. socket.emit("finished", xhr.status);
  42278. socket.close();
  42279. break;
  42280. }
  42281. };
  42282. return xhr;
  42283. },
  42284. abortRequest: function (xhr) {
  42285. xhr.onreadystatechange = null;
  42286. xhr.abort();
  42287. }
  42288. };
  42289. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42290. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42291. var HTTP = {
  42292. createStreamingSocket: function (url) {
  42293. return this.createSocket(http_streaming_socket, url);
  42294. },
  42295. createPollingSocket: function (url) {
  42296. return this.createSocket(http_polling_socket, url);
  42297. },
  42298. createSocket: function (hooks, url) {
  42299. return new http_socket(hooks, url);
  42300. },
  42301. createXHR: function (method, url) {
  42302. return this.createRequest(http_xhr_request, method, url);
  42303. },
  42304. createRequest: function (hooks, method, url) {
  42305. return new http_request(hooks, method, url);
  42306. }
  42307. };
  42308. /* harmony default export */ var http_http = (HTTP);
  42309. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42310. http_http.createXDR = function (method, url) {
  42311. return this.createRequest(http_xdomain_request, method, url);
  42312. };
  42313. /* harmony default export */ var web_http_http = (http_http);
  42314. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42315. var Runtime = {
  42316. nextAuthCallbackID: 1,
  42317. auth_callbacks: {},
  42318. ScriptReceivers: ScriptReceivers,
  42319. DependenciesReceivers: DependenciesReceivers,
  42320. getDefaultStrategy: default_strategy,
  42321. Transports: transports_transports,
  42322. transportConnectionInitializer: transport_connection_initializer,
  42323. HTTPFactory: web_http_http,
  42324. TimelineTransport: jsonp_timeline,
  42325. getXHRAPI: function () {
  42326. return window.XMLHttpRequest;
  42327. },
  42328. getWebSocketAPI: function () {
  42329. return window.WebSocket || window.MozWebSocket;
  42330. },
  42331. setup: function (PusherClass) {
  42332. var _this = this;
  42333. window.Pusher = PusherClass;
  42334. var initializeOnDocumentBody = function () {
  42335. _this.onDocumentBody(PusherClass.ready);
  42336. };
  42337. if (!window.JSON) {
  42338. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42339. }
  42340. else {
  42341. initializeOnDocumentBody();
  42342. }
  42343. },
  42344. getDocument: function () {
  42345. return document;
  42346. },
  42347. getProtocol: function () {
  42348. return this.getDocument().location.protocol;
  42349. },
  42350. getAuthorizers: function () {
  42351. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42352. },
  42353. onDocumentBody: function (callback) {
  42354. var _this = this;
  42355. if (document.body) {
  42356. callback();
  42357. }
  42358. else {
  42359. setTimeout(function () {
  42360. _this.onDocumentBody(callback);
  42361. }, 0);
  42362. }
  42363. },
  42364. createJSONPRequest: function (url, data) {
  42365. return new jsonp_request(url, data);
  42366. },
  42367. createScriptRequest: function (src) {
  42368. return new script_request(src);
  42369. },
  42370. getLocalStorage: function () {
  42371. try {
  42372. return window.localStorage;
  42373. }
  42374. catch (e) {
  42375. return undefined;
  42376. }
  42377. },
  42378. createXHR: function () {
  42379. if (this.getXHRAPI()) {
  42380. return this.createXMLHttpRequest();
  42381. }
  42382. else {
  42383. return this.createMicrosoftXHR();
  42384. }
  42385. },
  42386. createXMLHttpRequest: function () {
  42387. var Constructor = this.getXHRAPI();
  42388. return new Constructor();
  42389. },
  42390. createMicrosoftXHR: function () {
  42391. return new ActiveXObject("Microsoft.XMLHTTP");
  42392. },
  42393. getNetwork: function () {
  42394. return net_info_Network;
  42395. },
  42396. createWebSocket: function (url) {
  42397. var Constructor = this.getWebSocketAPI();
  42398. return new Constructor(url);
  42399. },
  42400. createSocketRequest: function (method, url) {
  42401. if (this.isXHRSupported()) {
  42402. return this.HTTPFactory.createXHR(method, url);
  42403. }
  42404. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42405. return this.HTTPFactory.createXDR(method, url);
  42406. }
  42407. else {
  42408. throw "Cross-origin HTTP requests are not supported";
  42409. }
  42410. },
  42411. isXHRSupported: function () {
  42412. var Constructor = this.getXHRAPI();
  42413. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42414. },
  42415. isXDRSupported: function (useTLS) {
  42416. var protocol = useTLS ? "https:" : "http:";
  42417. var documentProtocol = this.getProtocol();
  42418. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42419. },
  42420. addUnloadListener: function (listener) {
  42421. if (window.addEventListener !== undefined) {
  42422. window.addEventListener("unload", listener, false);
  42423. }
  42424. else if (window.attachEvent !== undefined) {
  42425. window.attachEvent("onunload", listener);
  42426. }
  42427. },
  42428. removeUnloadListener: function (listener) {
  42429. if (window.addEventListener !== undefined) {
  42430. window.removeEventListener("unload", listener, false);
  42431. }
  42432. else if (window.detachEvent !== undefined) {
  42433. window.detachEvent("onunload", listener);
  42434. }
  42435. }
  42436. };
  42437. /* harmony default export */ var runtime = (Runtime);
  42438. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42439. var TimelineLevel;
  42440. (function (TimelineLevel) {
  42441. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42442. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42443. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42444. })(TimelineLevel || (TimelineLevel = {}));
  42445. /* harmony default export */ var timeline_level = (TimelineLevel);
  42446. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42447. var timeline_Timeline = (function () {
  42448. function Timeline(key, session, options) {
  42449. this.key = key;
  42450. this.session = session;
  42451. this.events = [];
  42452. this.options = options || {};
  42453. this.sent = 0;
  42454. this.uniqueID = 0;
  42455. }
  42456. Timeline.prototype.log = function (level, event) {
  42457. if (level <= this.options.level) {
  42458. this.events.push(extend({}, event, { timestamp: util.now() }));
  42459. if (this.options.limit && this.events.length > this.options.limit) {
  42460. this.events.shift();
  42461. }
  42462. }
  42463. };
  42464. Timeline.prototype.error = function (event) {
  42465. this.log(timeline_level.ERROR, event);
  42466. };
  42467. Timeline.prototype.info = function (event) {
  42468. this.log(timeline_level.INFO, event);
  42469. };
  42470. Timeline.prototype.debug = function (event) {
  42471. this.log(timeline_level.DEBUG, event);
  42472. };
  42473. Timeline.prototype.isEmpty = function () {
  42474. return this.events.length === 0;
  42475. };
  42476. Timeline.prototype.send = function (sendfn, callback) {
  42477. var _this = this;
  42478. var data = extend({
  42479. session: this.session,
  42480. bundle: this.sent + 1,
  42481. key: this.key,
  42482. lib: "js",
  42483. version: this.options.version,
  42484. cluster: this.options.cluster,
  42485. features: this.options.features,
  42486. timeline: this.events
  42487. }, this.options.params);
  42488. this.events = [];
  42489. sendfn(data, function (error, result) {
  42490. if (!error) {
  42491. _this.sent++;
  42492. }
  42493. if (callback) {
  42494. callback(error, result);
  42495. }
  42496. });
  42497. return true;
  42498. };
  42499. Timeline.prototype.generateUniqueID = function () {
  42500. this.uniqueID++;
  42501. return this.uniqueID;
  42502. };
  42503. return Timeline;
  42504. }());
  42505. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42506. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42507. var transport_strategy_TransportStrategy = (function () {
  42508. function TransportStrategy(name, priority, transport, options) {
  42509. this.name = name;
  42510. this.priority = priority;
  42511. this.transport = transport;
  42512. this.options = options || {};
  42513. }
  42514. TransportStrategy.prototype.isSupported = function () {
  42515. return this.transport.isSupported({
  42516. useTLS: this.options.useTLS
  42517. });
  42518. };
  42519. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42520. var _this = this;
  42521. if (!this.isSupported()) {
  42522. return failAttempt(new UnsupportedStrategy(), callback);
  42523. }
  42524. else if (this.priority < minPriority) {
  42525. return failAttempt(new TransportPriorityTooLow(), callback);
  42526. }
  42527. var connected = false;
  42528. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42529. var handshake = null;
  42530. var onInitialized = function () {
  42531. transport.unbind("initialized", onInitialized);
  42532. transport.connect();
  42533. };
  42534. var onOpen = function () {
  42535. handshake = factory.createHandshake(transport, function (result) {
  42536. connected = true;
  42537. unbindListeners();
  42538. callback(null, result);
  42539. });
  42540. };
  42541. var onError = function (error) {
  42542. unbindListeners();
  42543. callback(error);
  42544. };
  42545. var onClosed = function () {
  42546. unbindListeners();
  42547. var serializedTransport;
  42548. serializedTransport = safeJSONStringify(transport);
  42549. callback(new TransportClosed(serializedTransport));
  42550. };
  42551. var unbindListeners = function () {
  42552. transport.unbind("initialized", onInitialized);
  42553. transport.unbind("open", onOpen);
  42554. transport.unbind("error", onError);
  42555. transport.unbind("closed", onClosed);
  42556. };
  42557. transport.bind("initialized", onInitialized);
  42558. transport.bind("open", onOpen);
  42559. transport.bind("error", onError);
  42560. transport.bind("closed", onClosed);
  42561. transport.initialize();
  42562. return {
  42563. abort: function () {
  42564. if (connected) {
  42565. return;
  42566. }
  42567. unbindListeners();
  42568. if (handshake) {
  42569. handshake.close();
  42570. }
  42571. else {
  42572. transport.close();
  42573. }
  42574. },
  42575. forceMinPriority: function (p) {
  42576. if (connected) {
  42577. return;
  42578. }
  42579. if (_this.priority < p) {
  42580. if (handshake) {
  42581. handshake.close();
  42582. }
  42583. else {
  42584. transport.close();
  42585. }
  42586. }
  42587. }
  42588. };
  42589. };
  42590. return TransportStrategy;
  42591. }());
  42592. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42593. function failAttempt(error, callback) {
  42594. util.defer(function () {
  42595. callback(error);
  42596. });
  42597. return {
  42598. abort: function () { },
  42599. forceMinPriority: function () { }
  42600. };
  42601. }
  42602. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42603. var strategy_builder_Transports = runtime.Transports;
  42604. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42605. var transportClass = strategy_builder_Transports[type];
  42606. if (!transportClass) {
  42607. throw new UnsupportedTransport(type);
  42608. }
  42609. var enabled = (!config.enabledTransports ||
  42610. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42611. (!config.disabledTransports ||
  42612. arrayIndexOf(config.disabledTransports, name) === -1);
  42613. var transport;
  42614. if (enabled) {
  42615. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42616. key: config.key,
  42617. useTLS: config.useTLS,
  42618. timeline: config.timeline,
  42619. ignoreNullOrigin: config.ignoreNullOrigin
  42620. }, options));
  42621. }
  42622. else {
  42623. transport = strategy_builder_UnsupportedStrategy;
  42624. }
  42625. return transport;
  42626. };
  42627. var strategy_builder_UnsupportedStrategy = {
  42628. isSupported: function () {
  42629. return false;
  42630. },
  42631. connect: function (_, callback) {
  42632. var deferred = util.defer(function () {
  42633. callback(new UnsupportedStrategy());
  42634. });
  42635. return {
  42636. abort: function () {
  42637. deferred.ensureAborted();
  42638. },
  42639. forceMinPriority: function () { }
  42640. };
  42641. }
  42642. };
  42643. // CONCATENATED MODULE: ./src/core/config.ts
  42644. var getGlobalConfig = function () {
  42645. return {
  42646. wsHost: defaults.host,
  42647. wsPort: defaults.ws_port,
  42648. wssPort: defaults.wss_port,
  42649. wsPath: defaults.ws_path,
  42650. httpHost: defaults.sockjs_host,
  42651. httpPort: defaults.sockjs_http_port,
  42652. httpsPort: defaults.sockjs_https_port,
  42653. httpPath: defaults.sockjs_path,
  42654. statsHost: defaults.stats_host,
  42655. authEndpoint: defaults.channel_auth_endpoint,
  42656. authTransport: defaults.channel_auth_transport,
  42657. activity_timeout: defaults.activity_timeout,
  42658. pong_timeout: defaults.pong_timeout,
  42659. unavailable_timeout: defaults.unavailable_timeout
  42660. };
  42661. };
  42662. var getClusterConfig = function (clusterName) {
  42663. return {
  42664. wsHost: 'ws-' + clusterName + '.pusher.com',
  42665. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42666. };
  42667. };
  42668. // CONCATENATED MODULE: ./src/core/pusher.ts
  42669. var pusher_Pusher = (function () {
  42670. function Pusher(app_key, options) {
  42671. var _this = this;
  42672. checkAppKey(app_key);
  42673. options = options || {};
  42674. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42675. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42676. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42677. }
  42678. this.key = app_key;
  42679. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42680. this.channels = factory.createChannels();
  42681. this.global_emitter = new dispatcher();
  42682. this.sessionID = Math.floor(Math.random() * 1000000000);
  42683. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42684. cluster: this.config.cluster,
  42685. features: Pusher.getClientFeatures(),
  42686. params: this.config.timelineParams || {},
  42687. limit: 50,
  42688. level: timeline_level.INFO,
  42689. version: defaults.VERSION
  42690. });
  42691. if (!this.config.disableStats) {
  42692. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42693. host: this.config.statsHost,
  42694. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42695. });
  42696. }
  42697. var getStrategy = function (options) {
  42698. var config = extend({}, _this.config, options);
  42699. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42700. };
  42701. this.connection = factory.createConnectionManager(this.key, extend({
  42702. getStrategy: getStrategy,
  42703. timeline: this.timeline,
  42704. activityTimeout: this.config.activity_timeout,
  42705. pongTimeout: this.config.pong_timeout,
  42706. unavailableTimeout: this.config.unavailable_timeout
  42707. }, this.config, { useTLS: this.shouldUseTLS() }));
  42708. this.connection.bind('connected', function () {
  42709. _this.subscribeAll();
  42710. if (_this.timelineSender) {
  42711. _this.timelineSender.send(_this.connection.isUsingTLS());
  42712. }
  42713. });
  42714. this.connection.bind('message', function (event) {
  42715. var eventName = event.event;
  42716. var internal = eventName.indexOf('pusher_internal:') === 0;
  42717. if (event.channel) {
  42718. var channel = _this.channel(event.channel);
  42719. if (channel) {
  42720. channel.handleEvent(event);
  42721. }
  42722. }
  42723. if (!internal) {
  42724. _this.global_emitter.emit(event.event, event.data);
  42725. }
  42726. });
  42727. this.connection.bind('connecting', function () {
  42728. _this.channels.disconnect();
  42729. });
  42730. this.connection.bind('disconnected', function () {
  42731. _this.channels.disconnect();
  42732. });
  42733. this.connection.bind('error', function (err) {
  42734. logger.warn(err);
  42735. });
  42736. Pusher.instances.push(this);
  42737. this.timeline.info({ instances: Pusher.instances.length });
  42738. if (Pusher.isReady) {
  42739. this.connect();
  42740. }
  42741. }
  42742. Pusher.ready = function () {
  42743. Pusher.isReady = true;
  42744. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42745. Pusher.instances[i].connect();
  42746. }
  42747. };
  42748. Pusher.getClientFeatures = function () {
  42749. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42750. return t.isSupported({});
  42751. }));
  42752. };
  42753. Pusher.prototype.channel = function (name) {
  42754. return this.channels.find(name);
  42755. };
  42756. Pusher.prototype.allChannels = function () {
  42757. return this.channels.all();
  42758. };
  42759. Pusher.prototype.connect = function () {
  42760. this.connection.connect();
  42761. if (this.timelineSender) {
  42762. if (!this.timelineSenderTimer) {
  42763. var usingTLS = this.connection.isUsingTLS();
  42764. var timelineSender = this.timelineSender;
  42765. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42766. timelineSender.send(usingTLS);
  42767. });
  42768. }
  42769. }
  42770. };
  42771. Pusher.prototype.disconnect = function () {
  42772. this.connection.disconnect();
  42773. if (this.timelineSenderTimer) {
  42774. this.timelineSenderTimer.ensureAborted();
  42775. this.timelineSenderTimer = null;
  42776. }
  42777. };
  42778. Pusher.prototype.bind = function (event_name, callback, context) {
  42779. this.global_emitter.bind(event_name, callback, context);
  42780. return this;
  42781. };
  42782. Pusher.prototype.unbind = function (event_name, callback, context) {
  42783. this.global_emitter.unbind(event_name, callback, context);
  42784. return this;
  42785. };
  42786. Pusher.prototype.bind_global = function (callback) {
  42787. this.global_emitter.bind_global(callback);
  42788. return this;
  42789. };
  42790. Pusher.prototype.unbind_global = function (callback) {
  42791. this.global_emitter.unbind_global(callback);
  42792. return this;
  42793. };
  42794. Pusher.prototype.unbind_all = function (callback) {
  42795. this.global_emitter.unbind_all();
  42796. return this;
  42797. };
  42798. Pusher.prototype.subscribeAll = function () {
  42799. var channelName;
  42800. for (channelName in this.channels.channels) {
  42801. if (this.channels.channels.hasOwnProperty(channelName)) {
  42802. this.subscribe(channelName);
  42803. }
  42804. }
  42805. };
  42806. Pusher.prototype.subscribe = function (channel_name) {
  42807. var channel = this.channels.add(channel_name, this);
  42808. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42809. channel.reinstateSubscription();
  42810. }
  42811. else if (!channel.subscriptionPending &&
  42812. this.connection.state === 'connected') {
  42813. channel.subscribe();
  42814. }
  42815. return channel;
  42816. };
  42817. Pusher.prototype.unsubscribe = function (channel_name) {
  42818. var channel = this.channels.find(channel_name);
  42819. if (channel && channel.subscriptionPending) {
  42820. channel.cancelSubscription();
  42821. }
  42822. else {
  42823. channel = this.channels.remove(channel_name);
  42824. if (channel && this.connection.state === 'connected') {
  42825. channel.unsubscribe();
  42826. }
  42827. }
  42828. };
  42829. Pusher.prototype.send_event = function (event_name, data, channel) {
  42830. return this.connection.send_event(event_name, data, channel);
  42831. };
  42832. Pusher.prototype.shouldUseTLS = function () {
  42833. if (runtime.getProtocol() === 'https:') {
  42834. return true;
  42835. }
  42836. else if (this.config.forceTLS === true) {
  42837. return true;
  42838. }
  42839. else {
  42840. return Boolean(this.config.encrypted);
  42841. }
  42842. };
  42843. Pusher.instances = [];
  42844. Pusher.isReady = false;
  42845. Pusher.logToConsole = false;
  42846. Pusher.Runtime = runtime;
  42847. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42848. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42849. Pusher.auth_callbacks = runtime.auth_callbacks;
  42850. return Pusher;
  42851. }());
  42852. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42853. function checkAppKey(key) {
  42854. if (key === null || key === undefined) {
  42855. throw 'You must pass your app key when you instantiate Pusher.';
  42856. }
  42857. }
  42858. runtime.setup(pusher_Pusher);
  42859. /***/ })
  42860. /******/ ]);
  42861. });
  42862. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42863. /***/ }),
  42864. /***/ "./node_modules/setimmediate/setImmediate.js":
  42865. /*!***************************************************!*\
  42866. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42867. \***************************************************/
  42868. /*! no static exports found */
  42869. /***/ (function(module, exports, __webpack_require__) {
  42870. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42871. "use strict";
  42872. if (global.setImmediate) {
  42873. return;
  42874. }
  42875. var nextHandle = 1; // Spec says greater than zero
  42876. var tasksByHandle = {};
  42877. var currentlyRunningATask = false;
  42878. var doc = global.document;
  42879. var registerImmediate;
  42880. function setImmediate(callback) {
  42881. // Callback can either be a function or a string
  42882. if (typeof callback !== "function") {
  42883. callback = new Function("" + callback);
  42884. }
  42885. // Copy function arguments
  42886. var args = new Array(arguments.length - 1);
  42887. for (var i = 0; i < args.length; i++) {
  42888. args[i] = arguments[i + 1];
  42889. }
  42890. // Store and register the task
  42891. var task = { callback: callback, args: args };
  42892. tasksByHandle[nextHandle] = task;
  42893. registerImmediate(nextHandle);
  42894. return nextHandle++;
  42895. }
  42896. function clearImmediate(handle) {
  42897. delete tasksByHandle[handle];
  42898. }
  42899. function run(task) {
  42900. var callback = task.callback;
  42901. var args = task.args;
  42902. switch (args.length) {
  42903. case 0:
  42904. callback();
  42905. break;
  42906. case 1:
  42907. callback(args[0]);
  42908. break;
  42909. case 2:
  42910. callback(args[0], args[1]);
  42911. break;
  42912. case 3:
  42913. callback(args[0], args[1], args[2]);
  42914. break;
  42915. default:
  42916. callback.apply(undefined, args);
  42917. break;
  42918. }
  42919. }
  42920. function runIfPresent(handle) {
  42921. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42922. // So if we're currently running a task, we'll need to delay this invocation.
  42923. if (currentlyRunningATask) {
  42924. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42925. // "too much recursion" error.
  42926. setTimeout(runIfPresent, 0, handle);
  42927. } else {
  42928. var task = tasksByHandle[handle];
  42929. if (task) {
  42930. currentlyRunningATask = true;
  42931. try {
  42932. run(task);
  42933. } finally {
  42934. clearImmediate(handle);
  42935. currentlyRunningATask = false;
  42936. }
  42937. }
  42938. }
  42939. }
  42940. function installNextTickImplementation() {
  42941. registerImmediate = function(handle) {
  42942. process.nextTick(function () { runIfPresent(handle); });
  42943. };
  42944. }
  42945. function canUsePostMessage() {
  42946. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42947. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42948. if (global.postMessage && !global.importScripts) {
  42949. var postMessageIsAsynchronous = true;
  42950. var oldOnMessage = global.onmessage;
  42951. global.onmessage = function() {
  42952. postMessageIsAsynchronous = false;
  42953. };
  42954. global.postMessage("", "*");
  42955. global.onmessage = oldOnMessage;
  42956. return postMessageIsAsynchronous;
  42957. }
  42958. }
  42959. function installPostMessageImplementation() {
  42960. // Installs an event handler on `global` for the `message` event: see
  42961. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42962. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42963. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42964. var onGlobalMessage = function(event) {
  42965. if (event.source === global &&
  42966. typeof event.data === "string" &&
  42967. event.data.indexOf(messagePrefix) === 0) {
  42968. runIfPresent(+event.data.slice(messagePrefix.length));
  42969. }
  42970. };
  42971. if (global.addEventListener) {
  42972. global.addEventListener("message", onGlobalMessage, false);
  42973. } else {
  42974. global.attachEvent("onmessage", onGlobalMessage);
  42975. }
  42976. registerImmediate = function(handle) {
  42977. global.postMessage(messagePrefix + handle, "*");
  42978. };
  42979. }
  42980. function installMessageChannelImplementation() {
  42981. var channel = new MessageChannel();
  42982. channel.port1.onmessage = function(event) {
  42983. var handle = event.data;
  42984. runIfPresent(handle);
  42985. };
  42986. registerImmediate = function(handle) {
  42987. channel.port2.postMessage(handle);
  42988. };
  42989. }
  42990. function installReadyStateChangeImplementation() {
  42991. var html = doc.documentElement;
  42992. registerImmediate = function(handle) {
  42993. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42994. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42995. var script = doc.createElement("script");
  42996. script.onreadystatechange = function () {
  42997. runIfPresent(handle);
  42998. script.onreadystatechange = null;
  42999. html.removeChild(script);
  43000. script = null;
  43001. };
  43002. html.appendChild(script);
  43003. };
  43004. }
  43005. function installSetTimeoutImplementation() {
  43006. registerImmediate = function(handle) {
  43007. setTimeout(runIfPresent, 0, handle);
  43008. };
  43009. }
  43010. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43011. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43012. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43013. // Don't get fooled by e.g. browserify environments.
  43014. if ({}.toString.call(global.process) === "[object process]") {
  43015. // For Node.js before 0.9
  43016. installNextTickImplementation();
  43017. } else if (canUsePostMessage()) {
  43018. // For non-IE10 modern browsers
  43019. installPostMessageImplementation();
  43020. } else if (global.MessageChannel) {
  43021. // For web workers, where supported
  43022. installMessageChannelImplementation();
  43023. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43024. // For IE 6–8
  43025. installReadyStateChangeImplementation();
  43026. } else {
  43027. // For older browsers
  43028. installSetTimeoutImplementation();
  43029. }
  43030. attachTo.setImmediate = setImmediate;
  43031. attachTo.clearImmediate = clearImmediate;
  43032. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43033. /* 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")))
  43034. /***/ }),
  43035. /***/ "./node_modules/timers-browserify/main.js":
  43036. /*!************************************************!*\
  43037. !*** ./node_modules/timers-browserify/main.js ***!
  43038. \************************************************/
  43039. /*! no static exports found */
  43040. /***/ (function(module, exports, __webpack_require__) {
  43041. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43042. (typeof self !== "undefined" && self) ||
  43043. window;
  43044. var apply = Function.prototype.apply;
  43045. // DOM APIs, for completeness
  43046. exports.setTimeout = function() {
  43047. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43048. };
  43049. exports.setInterval = function() {
  43050. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43051. };
  43052. exports.clearTimeout =
  43053. exports.clearInterval = function(timeout) {
  43054. if (timeout) {
  43055. timeout.close();
  43056. }
  43057. };
  43058. function Timeout(id, clearFn) {
  43059. this._id = id;
  43060. this._clearFn = clearFn;
  43061. }
  43062. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43063. Timeout.prototype.close = function() {
  43064. this._clearFn.call(scope, this._id);
  43065. };
  43066. // Does not start the time, just sets up the members needed.
  43067. exports.enroll = function(item, msecs) {
  43068. clearTimeout(item._idleTimeoutId);
  43069. item._idleTimeout = msecs;
  43070. };
  43071. exports.unenroll = function(item) {
  43072. clearTimeout(item._idleTimeoutId);
  43073. item._idleTimeout = -1;
  43074. };
  43075. exports._unrefActive = exports.active = function(item) {
  43076. clearTimeout(item._idleTimeoutId);
  43077. var msecs = item._idleTimeout;
  43078. if (msecs >= 0) {
  43079. item._idleTimeoutId = setTimeout(function onTimeout() {
  43080. if (item._onTimeout)
  43081. item._onTimeout();
  43082. }, msecs);
  43083. }
  43084. };
  43085. // setimmediate attaches itself to the global object
  43086. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43087. // On some exotic environments, it's not clear which object `setimmediate` was
  43088. // able to install onto. Search each possibility in the same order as the
  43089. // `setimmediate` library.
  43090. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43091. (typeof global !== "undefined" && global.setImmediate) ||
  43092. (this && this.setImmediate);
  43093. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43094. (typeof global !== "undefined" && global.clearImmediate) ||
  43095. (this && this.clearImmediate);
  43096. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43097. /***/ }),
  43098. /***/ "./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&":
  43099. /*!*******************************************************************************************************************************************************************************************************************!*\
  43100. !*** ./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& ***!
  43101. \*******************************************************************************************************************************************************************************************************************/
  43102. /*! exports provided: render, staticRenderFns */
  43103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43104. "use strict";
  43105. __webpack_require__.r(__webpack_exports__);
  43106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43108. var render = function() {
  43109. var _vm = this
  43110. var _h = _vm.$createElement
  43111. var _c = _vm._self._c || _h
  43112. return _vm._m(0)
  43113. }
  43114. var staticRenderFns = [
  43115. function() {
  43116. var _vm = this
  43117. var _h = _vm.$createElement
  43118. var _c = _vm._self._c || _h
  43119. return _c("div", { staticClass: "container" }, [
  43120. _c("div", { staticClass: "row justify-content-center" }, [
  43121. _c("div", { staticClass: "col-md-8" }, [
  43122. _c("div", { staticClass: "card" }, [
  43123. _c("div", { staticClass: "card-header" }, [
  43124. _vm._v("Example Component")
  43125. ]),
  43126. _vm._v(" "),
  43127. _c("div", { staticClass: "card-body" }, [
  43128. _vm._v(
  43129. "\n I'm an example component.\n "
  43130. )
  43131. ])
  43132. ])
  43133. ])
  43134. ])
  43135. ])
  43136. }
  43137. ]
  43138. render._withStripped = true
  43139. /***/ }),
  43140. /***/ "./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&":
  43141. /*!************************************************************************************************************************************************************************************************************!*\
  43142. !*** ./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& ***!
  43143. \************************************************************************************************************************************************************************************************************/
  43144. /*! exports provided: render, staticRenderFns */
  43145. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43146. "use strict";
  43147. __webpack_require__.r(__webpack_exports__);
  43148. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43150. var render = function() {
  43151. var _vm = this
  43152. var _h = _vm.$createElement
  43153. var _c = _vm._self._c || _h
  43154. return _c(
  43155. "div",
  43156. [
  43157. _c(
  43158. "modal",
  43159. {
  43160. attrs: {
  43161. id: "asseteditModal",
  43162. tabindex: "-1",
  43163. role: "dialog",
  43164. "aria-labelledby": "asseteditModalLabel"
  43165. }
  43166. },
  43167. [
  43168. _c(
  43169. "h5",
  43170. {
  43171. staticClass: "modal-title",
  43172. attrs: { slot: "header", id: "asseteditModalLabel" },
  43173. slot: "header"
  43174. },
  43175. [_vm._v("\n Edit Work Order Information\n ")]
  43176. ),
  43177. _vm._v(" "),
  43178. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43179. _c("div", { staticClass: "form-group" }, [
  43180. _c("label", { attrs: { for: "manufacturer" } }, [
  43181. _vm._v("Manufacturer")
  43182. ]),
  43183. _vm._v(" "),
  43184. _c("input", {
  43185. directives: [
  43186. {
  43187. name: "model",
  43188. rawName: "v-model.lazy",
  43189. value: _vm.data.pcmanu,
  43190. expression: "data.pcmanu",
  43191. modifiers: { lazy: true }
  43192. }
  43193. ],
  43194. staticClass: "form-control",
  43195. attrs: {
  43196. type: "text",
  43197. name: "manufacturer",
  43198. id: "manufacturer"
  43199. },
  43200. domProps: { value: _vm.data.pcmanu },
  43201. on: {
  43202. change: function($event) {
  43203. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43204. }
  43205. }
  43206. })
  43207. ]),
  43208. _vm._v(" "),
  43209. _c("div", { staticClass: "form-group" }, [
  43210. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43211. _vm._v(" "),
  43212. _c("input", {
  43213. directives: [
  43214. {
  43215. name: "model",
  43216. rawName: "v-model.lazy",
  43217. value: _vm.data.pcmake,
  43218. expression: "data.pcmake",
  43219. modifiers: { lazy: true }
  43220. }
  43221. ],
  43222. staticClass: "form-control",
  43223. attrs: { type: "text", name: "make", id: "make" },
  43224. domProps: { value: _vm.data.pcmake },
  43225. on: {
  43226. change: function($event) {
  43227. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43228. }
  43229. }
  43230. })
  43231. ]),
  43232. _vm._v(" "),
  43233. _c("div", { staticClass: "form-group" }, [
  43234. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43235. _vm._v(" "),
  43236. _c("input", {
  43237. directives: [
  43238. {
  43239. name: "model",
  43240. rawName: "v-model.lazy",
  43241. value: _vm.data.pcnickname,
  43242. expression: "data.pcnickname",
  43243. modifiers: { lazy: true }
  43244. }
  43245. ],
  43246. staticClass: "form-control",
  43247. attrs: { type: "text", name: "nickname", id: "nickname" },
  43248. domProps: { value: _vm.data.pcnickname },
  43249. on: {
  43250. change: function($event) {
  43251. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43252. }
  43253. }
  43254. })
  43255. ]),
  43256. _vm._v(" "),
  43257. _c("div", { staticClass: "form-group" }, [
  43258. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43259. _vm._v(" "),
  43260. _c("input", {
  43261. directives: [
  43262. {
  43263. name: "model",
  43264. rawName: "v-model.lazy",
  43265. value: _vm.pcextra[2],
  43266. expression: "pcextra[2]",
  43267. modifiers: { lazy: true }
  43268. }
  43269. ],
  43270. staticClass: "form-control",
  43271. attrs: { type: "text", name: "os", id: "os" },
  43272. domProps: { value: _vm.pcextra[2] },
  43273. on: {
  43274. change: function($event) {
  43275. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43276. }
  43277. }
  43278. })
  43279. ]),
  43280. _vm._v(" "),
  43281. _c("div", { staticClass: "form-group" }, [
  43282. _c("label", { attrs: { for: "serial" } }, [
  43283. _vm._v("Serial Number")
  43284. ]),
  43285. _vm._v(" "),
  43286. _c("input", {
  43287. directives: [
  43288. {
  43289. name: "model",
  43290. rawName: "v-model.lazy",
  43291. value: _vm.pcextra[104],
  43292. expression: "pcextra[104]",
  43293. modifiers: { lazy: true }
  43294. }
  43295. ],
  43296. staticClass: "form-control",
  43297. attrs: { type: "text", id: "serial", name: "serial" },
  43298. domProps: { value: _vm.pcextra[104] },
  43299. on: {
  43300. change: function($event) {
  43301. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43302. }
  43303. }
  43304. })
  43305. ]),
  43306. _vm._v(" "),
  43307. _c("div", { staticClass: "form-group" }, [
  43308. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43309. _vm._v(" "),
  43310. _c("input", {
  43311. directives: [
  43312. {
  43313. name: "model",
  43314. rawName: "v-model.lazy",
  43315. value: _vm.pcextra[101],
  43316. expression: "pcextra[101]",
  43317. modifiers: { lazy: true }
  43318. }
  43319. ],
  43320. staticClass: "form-control",
  43321. attrs: { type: "text", id: "cpu", name: "cpu" },
  43322. domProps: { value: _vm.pcextra[101] },
  43323. on: {
  43324. change: function($event) {
  43325. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43326. }
  43327. }
  43328. })
  43329. ]),
  43330. _vm._v(" "),
  43331. _c("div", { staticClass: "form-group" }, [
  43332. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43333. _vm._v(" "),
  43334. _c("input", {
  43335. directives: [
  43336. {
  43337. name: "model",
  43338. rawName: "v-model.lazy",
  43339. value: _vm.pcextra[100],
  43340. expression: "pcextra[100]",
  43341. modifiers: { lazy: true }
  43342. }
  43343. ],
  43344. staticClass: "form-control",
  43345. attrs: { type: "text", name: "ram", id: "ram" },
  43346. domProps: { value: _vm.pcextra[100] },
  43347. on: {
  43348. change: function($event) {
  43349. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43350. }
  43351. }
  43352. })
  43353. ]),
  43354. _vm._v(" "),
  43355. _c("div", { staticClass: "form-group" }, [
  43356. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43357. _vm._v(" "),
  43358. _c("input", {
  43359. directives: [
  43360. {
  43361. name: "model",
  43362. rawName: "v-model.lazy",
  43363. value: _vm.pcextra[4],
  43364. expression: "pcextra[4]",
  43365. modifiers: { lazy: true }
  43366. }
  43367. ],
  43368. staticClass: "form-control",
  43369. attrs: { type: "text", name: "graphics", id: "grapics" },
  43370. domProps: { value: _vm.pcextra[4] },
  43371. on: {
  43372. change: function($event) {
  43373. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43374. }
  43375. }
  43376. })
  43377. ])
  43378. ]),
  43379. _vm._v(" "),
  43380. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43381. _c(
  43382. "button",
  43383. {
  43384. staticClass: "btn btn-secondary",
  43385. attrs: { type: "button", "data-dismiss": "modal" }
  43386. },
  43387. [_vm._v("Close")]
  43388. ),
  43389. _vm._v(" "),
  43390. _c(
  43391. "button",
  43392. {
  43393. staticClass: "btn btn-primary",
  43394. attrs: { type: "button" },
  43395. on: {
  43396. click: function($event) {
  43397. return _vm.updateAsset()
  43398. }
  43399. }
  43400. },
  43401. [_vm._v("Save")]
  43402. )
  43403. ])
  43404. ]
  43405. ),
  43406. _vm._v(" "),
  43407. _c("h4", { staticClass: "text-center" }, [
  43408. _vm._v(
  43409. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43410. ),
  43411. _c("small", { staticClass: "text-muted" }, [
  43412. _vm._v(_vm._s(this.data.pcnickname))
  43413. ])
  43414. ]),
  43415. _vm._v(" "),
  43416. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43417. _vm._v(" "),
  43418. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43419. _vm._v(" "),
  43420. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43421. _vm._v(" "),
  43422. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43423. _vm._v(" "),
  43424. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43425. _vm._v(" "),
  43426. _c(
  43427. "button",
  43428. {
  43429. staticClass: "btn btn-primary",
  43430. attrs: {
  43431. type: "button",
  43432. "data-toggle": "modal",
  43433. "data-target": "#asseteditModal"
  43434. }
  43435. },
  43436. [_vm._v("Edit")]
  43437. )
  43438. ],
  43439. 1
  43440. )
  43441. }
  43442. var staticRenderFns = []
  43443. render._withStripped = true
  43444. /***/ }),
  43445. /***/ "./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&":
  43446. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43447. !*** ./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& ***!
  43448. \*******************************************************************************************************************************************************************************************************************************/
  43449. /*! exports provided: render, staticRenderFns */
  43450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43451. "use strict";
  43452. __webpack_require__.r(__webpack_exports__);
  43453. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43454. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43455. var render = function() {
  43456. var _vm = this
  43457. var _h = _vm.$createElement
  43458. var _c = _vm._self._c || _h
  43459. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43460. _c("div", { staticClass: "input-group" }, [
  43461. _c("input", {
  43462. directives: [
  43463. {
  43464. name: "model",
  43465. rawName: "v-model",
  43466. value: _vm.searchText,
  43467. expression: "searchText"
  43468. }
  43469. ],
  43470. staticClass: "form-control",
  43471. attrs: { type: "text" },
  43472. domProps: { value: _vm.searchText },
  43473. on: {
  43474. input: [
  43475. function($event) {
  43476. if ($event.target.composing) {
  43477. return
  43478. }
  43479. _vm.searchText = $event.target.value
  43480. },
  43481. _vm.searchChanged
  43482. ]
  43483. }
  43484. }),
  43485. _vm._v(" "),
  43486. _c("div", { staticClass: "form-group-append" }, [
  43487. _c(
  43488. "a",
  43489. {
  43490. staticClass: "toggle input-group-text bg-primary text-light",
  43491. on: {
  43492. mousedown: function($event) {
  43493. $event.preventDefault()
  43494. },
  43495. click: function($event) {
  43496. return _vm.setOpen(!_vm.open)
  43497. }
  43498. }
  43499. },
  43500. [
  43501. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43502. _vm._v(" "),
  43503. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43504. ]
  43505. )
  43506. ])
  43507. ]),
  43508. _vm._v(" "),
  43509. _c(
  43510. "ul",
  43511. { staticClass: "suggestion-list list-unstyled" },
  43512. _vm._l(_vm.matches, function(suggestion, index) {
  43513. return _c(
  43514. "li",
  43515. {
  43516. key: index,
  43517. on: {
  43518. mousedown: function($event) {
  43519. $event.preventDefault()
  43520. },
  43521. click: function($event) {
  43522. return _vm.suggestionSelected(suggestion)
  43523. }
  43524. }
  43525. },
  43526. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43527. )
  43528. }),
  43529. 0
  43530. )
  43531. ])
  43532. }
  43533. var staticRenderFns = []
  43534. render._withStripped = true
  43535. /***/ }),
  43536. /***/ "./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&":
  43537. /*!************************************************************************************************************************************************************************************************************************!*\
  43538. !*** ./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& ***!
  43539. \************************************************************************************************************************************************************************************************************************/
  43540. /*! exports provided: render, staticRenderFns */
  43541. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43542. "use strict";
  43543. __webpack_require__.r(__webpack_exports__);
  43544. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43545. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43546. var render = function() {
  43547. var _vm = this
  43548. var _h = _vm.$createElement
  43549. var _c = _vm._self._c || _h
  43550. return _c(
  43551. "modal",
  43552. {
  43553. attrs: {
  43554. id: _vm.id,
  43555. tabindex: "-1",
  43556. role: "dialog",
  43557. "aria-labelledby": _vm.id + "Label"
  43558. }
  43559. },
  43560. [
  43561. _c(
  43562. "h5",
  43563. {
  43564. staticClass: "modal-title",
  43565. attrs: { slot: "header", id: _vm.id + "Label" },
  43566. slot: "header"
  43567. },
  43568. [_vm._v("\n Edit Credential\n ")]
  43569. ),
  43570. _vm._v(" "),
  43571. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43572. _c(
  43573. "div",
  43574. { staticClass: "form" },
  43575. [
  43576. _c("autocomplete-custom-dropdown", {
  43577. attrs: {
  43578. options: _vm.descriptions,
  43579. value: _vm.creddesc,
  43580. "allow-custom": true
  43581. },
  43582. model: {
  43583. value: _vm.creddesc,
  43584. callback: function($$v) {
  43585. _vm.creddesc = $$v
  43586. },
  43587. expression: "creddesc"
  43588. }
  43589. })
  43590. ],
  43591. 1
  43592. ),
  43593. _vm._v(" "),
  43594. _c("div", { staticClass: "form-group" }, [
  43595. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43596. _vm._v(" "),
  43597. _c("input", {
  43598. directives: [
  43599. {
  43600. name: "model",
  43601. rawName: "v-model",
  43602. value: _vm.data.creduser,
  43603. expression: "data.creduser"
  43604. }
  43605. ],
  43606. staticClass: "form-control credential",
  43607. attrs: {
  43608. type: "text",
  43609. name: "newusername" + _vm.data.credid,
  43610. id: "newusername" + _vm.data.credid
  43611. },
  43612. domProps: { value: _vm.data.creduser },
  43613. on: {
  43614. input: function($event) {
  43615. if ($event.target.composing) {
  43616. return
  43617. }
  43618. _vm.$set(_vm.data, "creduser", $event.target.value)
  43619. }
  43620. }
  43621. })
  43622. ]),
  43623. _vm._v(" "),
  43624. _c("div", { staticClass: "form-group" }, [
  43625. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43626. _vm._v(" "),
  43627. _c("input", {
  43628. directives: [
  43629. {
  43630. name: "model",
  43631. rawName: "v-model",
  43632. value: _vm.data.credpass,
  43633. expression: "data.credpass"
  43634. }
  43635. ],
  43636. staticClass: "form-control credential",
  43637. attrs: {
  43638. type: "text",
  43639. name: "newpassword" + _vm.data.credid,
  43640. id: "newpassword" + _vm.data.credid
  43641. },
  43642. domProps: { value: _vm.data.credpass },
  43643. on: {
  43644. input: function($event) {
  43645. if ($event.target.composing) {
  43646. return
  43647. }
  43648. _vm.$set(_vm.data, "credpass", $event.target.value)
  43649. }
  43650. }
  43651. }),
  43652. _vm._v(" "),
  43653. _c(
  43654. "button",
  43655. {
  43656. staticClass: "btn btn-secondary",
  43657. attrs: { type: "button" },
  43658. on: {
  43659. click: function($event) {
  43660. return _vm.getRandomPassword(_vm.data.credid)
  43661. }
  43662. }
  43663. },
  43664. [_vm._v("Generate Random")]
  43665. )
  43666. ]),
  43667. _vm._v(" "),
  43668. _c("div", { staticClass: "form-group" })
  43669. ]),
  43670. _vm._v(" "),
  43671. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43672. _c(
  43673. "button",
  43674. {
  43675. staticClass: "btn btn-secondary",
  43676. attrs: { type: "button", "data-dismiss": "modal" }
  43677. },
  43678. [_vm._v("Close")]
  43679. ),
  43680. _vm._v(" "),
  43681. _c(
  43682. "button",
  43683. {
  43684. staticClass: "btn btn-primary",
  43685. attrs: { type: "button" },
  43686. on: {
  43687. click: function($event) {
  43688. return _vm.updateCredential()
  43689. }
  43690. }
  43691. },
  43692. [_vm._v("Save")]
  43693. )
  43694. ])
  43695. ]
  43696. )
  43697. }
  43698. var staticRenderFns = []
  43699. render._withStripped = true
  43700. /***/ }),
  43701. /***/ "./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&":
  43702. /*!******************************************************************************************************************************************************************************************************************!*\
  43703. !*** ./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& ***!
  43704. \******************************************************************************************************************************************************************************************************************/
  43705. /*! exports provided: render, staticRenderFns */
  43706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43707. "use strict";
  43708. __webpack_require__.r(__webpack_exports__);
  43709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43710. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43711. var render = function() {
  43712. var _vm = this
  43713. var _h = _vm.$createElement
  43714. var _c = _vm._self._c || _h
  43715. return _c(
  43716. "div",
  43717. [
  43718. _c("credential-form-modal", {
  43719. attrs: {
  43720. "modal-id": "newCredentialModal",
  43721. descriptions: _vm.creddescList,
  43722. create: true,
  43723. pcid: _vm.pcid
  43724. }
  43725. }),
  43726. _vm._v(" "),
  43727. _c(
  43728. "button",
  43729. {
  43730. staticClass: "btn btn-primary",
  43731. attrs: {
  43732. type: "button",
  43733. "data-toggle": "modal",
  43734. "data-target": "#newCredentialModal"
  43735. }
  43736. },
  43737. [_vm._v("New Credential")]
  43738. ),
  43739. _vm._v(" "),
  43740. _vm._l(_vm.credentials, function(credential) {
  43741. return _c(
  43742. "div",
  43743. { key: credential.credid },
  43744. [
  43745. _c("credential", {
  43746. attrs: { credential: credential, descriptions: _vm.creddescList }
  43747. })
  43748. ],
  43749. 1
  43750. )
  43751. })
  43752. ],
  43753. 2
  43754. )
  43755. }
  43756. var staticRenderFns = []
  43757. render._withStripped = true
  43758. /***/ }),
  43759. /***/ "./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&":
  43760. /*!*************************************************************************************************************************************************************************************************************!*\
  43761. !*** ./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& ***!
  43762. \*************************************************************************************************************************************************************************************************************/
  43763. /*! exports provided: render, staticRenderFns */
  43764. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43765. "use strict";
  43766. __webpack_require__.r(__webpack_exports__);
  43767. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43768. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43769. var render = function() {
  43770. var _vm = this
  43771. var _h = _vm.$createElement
  43772. var _c = _vm._self._c || _h
  43773. return _c(
  43774. "div",
  43775. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43776. [
  43777. _c("credential-form-modal", {
  43778. attrs: {
  43779. descriptions: _vm.creddescList,
  43780. "modal-id": "credential" + this.data.credid + "editModal",
  43781. populateWith: this.data
  43782. }
  43783. }),
  43784. _vm._v(" "),
  43785. _c(
  43786. "modal",
  43787. {
  43788. attrs: {
  43789. id: "credential" + this.data.credid + "deleteModal",
  43790. tabindex: "-1"
  43791. }
  43792. },
  43793. [
  43794. _c(
  43795. "h5",
  43796. {
  43797. staticClass: "modal-title",
  43798. attrs: {
  43799. slot: "header",
  43800. id: "credential" + this.data.credid + "deleteModalLabel"
  43801. },
  43802. slot: "header"
  43803. },
  43804. [_vm._v("\r\n Delete Credential\r\n ")]
  43805. ),
  43806. _vm._v(" "),
  43807. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43808. _vm._v("\r\n Are you sure?\r\n ")
  43809. ]),
  43810. _vm._v(" "),
  43811. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43812. _c(
  43813. "button",
  43814. {
  43815. staticClass: "btn btn-secondary",
  43816. attrs: { type: "button", "data-dismiss": "modal" }
  43817. },
  43818. [_vm._v("Cancel")]
  43819. ),
  43820. _vm._v(" "),
  43821. _c(
  43822. "button",
  43823. {
  43824. staticClass: "btn btn-danger",
  43825. attrs: { type: "button" },
  43826. on: {
  43827. click: function($event) {
  43828. return _vm.deleteCredential()
  43829. }
  43830. }
  43831. },
  43832. [_vm._v("Confirm")]
  43833. )
  43834. ])
  43835. ]
  43836. ),
  43837. _vm._v(" "),
  43838. _c("div", { staticClass: "row no-gutters" }, [
  43839. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43840. _vm._v(_vm._s(this.data.creddesc))
  43841. ]),
  43842. _vm._v(" "),
  43843. _c("div", { staticClass: "col-9 text-right" }, [
  43844. _vm._v(_vm._s(this.data.creddate))
  43845. ])
  43846. ]),
  43847. _vm._v(" "),
  43848. _c("div", { staticClass: "row" }, [
  43849. _c("div", { staticClass: "col-lg-9" }, [
  43850. _c("div", [
  43851. _vm._m(0),
  43852. _vm._v(" "),
  43853. _c("input", {
  43854. staticClass: "border-0 credential",
  43855. attrs: {
  43856. type: "text",
  43857. id: "username" + this.data.credid,
  43858. readonly: ""
  43859. },
  43860. domProps: { value: this.data.creduser }
  43861. }),
  43862. _vm._v(" "),
  43863. _c(
  43864. "button",
  43865. {
  43866. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43867. attrs: {
  43868. id: "btn-username" + this.data.credid,
  43869. "data-clipboard-target": "#username" + this.data.credid
  43870. }
  43871. },
  43872. [_c("i", { staticClass: "far fa-clone" })]
  43873. )
  43874. ]),
  43875. _vm._v(" "),
  43876. _c("div", [
  43877. _vm._m(1),
  43878. _vm._v(" "),
  43879. _c("input", {
  43880. staticClass: "border-0 credential",
  43881. attrs: {
  43882. type: "text",
  43883. id: "password" + this.data.credid,
  43884. readonly: ""
  43885. },
  43886. domProps: { value: this.data.credpass }
  43887. }),
  43888. _vm._v(" "),
  43889. _c(
  43890. "button",
  43891. {
  43892. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43893. attrs: {
  43894. id: "btn-password" + this.data.credid,
  43895. "data-clipboard-target": "#password" + this.data.credid
  43896. }
  43897. },
  43898. [_c("i", { staticClass: "far fa-clone" })]
  43899. )
  43900. ])
  43901. ]),
  43902. _vm._v(" "),
  43903. _c(
  43904. "div",
  43905. {
  43906. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43907. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43908. },
  43909. [
  43910. _c(
  43911. "button",
  43912. {
  43913. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43914. attrs: {
  43915. type: "button",
  43916. "data-toggle": "modal",
  43917. "data-target": "#credential" + this.data.credid + "editModal"
  43918. }
  43919. },
  43920. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43921. ),
  43922. _vm._v(" "),
  43923. _c(
  43924. "button",
  43925. {
  43926. staticClass: "btn btn-sm btn-danger p-lg-1",
  43927. attrs: {
  43928. type: "button",
  43929. "data-toggle": "modal",
  43930. "data-target":
  43931. "#credential" + this.data.credid + "deleteModal"
  43932. }
  43933. },
  43934. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43935. )
  43936. ]
  43937. )
  43938. ])
  43939. ],
  43940. 1
  43941. )
  43942. }
  43943. var staticRenderFns = [
  43944. function() {
  43945. var _vm = this
  43946. var _h = _vm.$createElement
  43947. var _c = _vm._self._c || _h
  43948. return _c("label", { attrs: { for: "username" } }, [
  43949. _c("i", { staticClass: "fas fa-fw fa-user" })
  43950. ])
  43951. },
  43952. function() {
  43953. var _vm = this
  43954. var _h = _vm.$createElement
  43955. var _c = _vm._self._c || _h
  43956. return _c("label", { attrs: { for: "password" } }, [
  43957. _c("i", { staticClass: "fas fa-fw fa-key" })
  43958. ])
  43959. }
  43960. ]
  43961. render._withStripped = true
  43962. /***/ }),
  43963. /***/ "./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&":
  43964. /*!************************************************************************************************************************************************************************************************************!*\
  43965. !*** ./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& ***!
  43966. \************************************************************************************************************************************************************************************************************/
  43967. /*! exports provided: render, staticRenderFns */
  43968. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43969. "use strict";
  43970. __webpack_require__.r(__webpack_exports__);
  43971. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43972. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43973. var render = function() {
  43974. var _vm = this
  43975. var _h = _vm.$createElement
  43976. var _c = _vm._self._c || _h
  43977. return _c(
  43978. "ul",
  43979. { staticClass: "list-unstyled" },
  43980. _vm._l(_vm.errorList, function(error) {
  43981. return _c("li", { key: error, staticClass: "text-danger" }, [
  43982. _vm._v(" " + _vm._s(error) + " ")
  43983. ])
  43984. }),
  43985. 0
  43986. )
  43987. }
  43988. var staticRenderFns = []
  43989. render._withStripped = true
  43990. /***/ }),
  43991. /***/ "./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&":
  43992. /*!********************************************************************************************************************************************************************************************************!*\
  43993. !*** ./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& ***!
  43994. \********************************************************************************************************************************************************************************************************/
  43995. /*! exports provided: render, staticRenderFns */
  43996. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43997. "use strict";
  43998. __webpack_require__.r(__webpack_exports__);
  43999. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44000. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44001. var render = function() {
  44002. var _vm = this
  44003. var _h = _vm.$createElement
  44004. var _c = _vm._self._c || _h
  44005. return _c("div", { staticClass: "modal fade" }, [
  44006. _c(
  44007. "div",
  44008. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44009. [
  44010. _c("div", { staticClass: "modal-content" }, [
  44011. _c(
  44012. "div",
  44013. { staticClass: "modal-header" },
  44014. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44015. 2
  44016. ),
  44017. _vm._v(" "),
  44018. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44019. _vm._v(" "),
  44020. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44021. ])
  44022. ]
  44023. )
  44024. ])
  44025. }
  44026. var staticRenderFns = [
  44027. function() {
  44028. var _vm = this
  44029. var _h = _vm.$createElement
  44030. var _c = _vm._self._c || _h
  44031. return _c(
  44032. "button",
  44033. {
  44034. staticClass: "close",
  44035. attrs: {
  44036. type: "button",
  44037. "data-dismiss": "modal",
  44038. "aria-label": "Close"
  44039. }
  44040. },
  44041. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44042. )
  44043. }
  44044. ]
  44045. render._withStripped = true
  44046. /***/ }),
  44047. /***/ "./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&":
  44048. /*!******************************************************************************************************************************************************************************************************************!*\
  44049. !*** ./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& ***!
  44050. \******************************************************************************************************************************************************************************************************************/
  44051. /*! exports provided: render, staticRenderFns */
  44052. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44053. "use strict";
  44054. __webpack_require__.r(__webpack_exports__);
  44055. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44056. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44057. var render = function() {
  44058. var _vm = this
  44059. var _h = _vm.$createElement
  44060. var _c = _vm._self._c || _h
  44061. return _c(
  44062. "modal",
  44063. {
  44064. attrs: {
  44065. id: _vm.modalId,
  44066. tabindex: "-1",
  44067. role: "dialog",
  44068. "aria-labelledby": _vm.modalId + "Label"
  44069. }
  44070. },
  44071. [
  44072. _c(
  44073. "h5",
  44074. {
  44075. staticClass: "modal-title",
  44076. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44077. slot: "header"
  44078. },
  44079. [_vm._v("\n Edit Note\n ")]
  44080. ),
  44081. _vm._v(" "),
  44082. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44083. _c("div", { staticClass: "form-group" }, [
  44084. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44085. _vm._v(" "),
  44086. _c("textarea", {
  44087. directives: [
  44088. {
  44089. name: "model",
  44090. rawName: "v-model",
  44091. value: _vm.note.thenote,
  44092. expression: "note.thenote"
  44093. }
  44094. ],
  44095. staticClass: "form-control",
  44096. attrs: {
  44097. name: "content" + _vm.note.noteid,
  44098. id: "content" + _vm.note.noteid
  44099. },
  44100. domProps: { value: _vm.note.thenote },
  44101. on: {
  44102. input: function($event) {
  44103. if ($event.target.composing) {
  44104. return
  44105. }
  44106. _vm.$set(_vm.note, "thenote", $event.target.value)
  44107. }
  44108. }
  44109. })
  44110. ])
  44111. ]),
  44112. _vm._v(" "),
  44113. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44114. _c(
  44115. "button",
  44116. {
  44117. staticClass: "btn btn-secondary",
  44118. attrs: { type: "button", "data-dismiss": "modal" }
  44119. },
  44120. [_vm._v("Close")]
  44121. ),
  44122. _vm._v(" "),
  44123. _c(
  44124. "button",
  44125. {
  44126. staticClass: "btn btn-primary",
  44127. attrs: { type: "button" },
  44128. on: {
  44129. click: function($event) {
  44130. return _vm.updateNote(_vm.note)
  44131. }
  44132. }
  44133. },
  44134. [_vm._v("Save")]
  44135. )
  44136. ])
  44137. ]
  44138. )
  44139. }
  44140. var staticRenderFns = []
  44141. render._withStripped = true
  44142. /***/ }),
  44143. /***/ "./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&":
  44144. /*!********************************************************************************************************************************************************************************************************!*\
  44145. !*** ./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& ***!
  44146. \********************************************************************************************************************************************************************************************************/
  44147. /*! exports provided: render, staticRenderFns */
  44148. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44149. "use strict";
  44150. __webpack_require__.r(__webpack_exports__);
  44151. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44152. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44153. var render = function() {
  44154. var _vm = this
  44155. var _h = _vm.$createElement
  44156. var _c = _vm._self._c || _h
  44157. return _c(
  44158. "ul",
  44159. { staticClass: "list-unstyled" },
  44160. [
  44161. _c("div", { staticClass: "row" }, [
  44162. _c(
  44163. "div",
  44164. {
  44165. staticClass:
  44166. "col-md-2 d-flex justify-content-center justify-content-md-start"
  44167. },
  44168. [
  44169. _c(
  44170. "button",
  44171. {
  44172. staticClass: "btn btn-primary m-2",
  44173. attrs: {
  44174. type: "button",
  44175. "data-toggle": "collapse",
  44176. "data-target": "#note" + _vm.noteType + "add"
  44177. }
  44178. },
  44179. [
  44180. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  44181. _vm._v(" Add New Note")
  44182. ]
  44183. )
  44184. ]
  44185. ),
  44186. _vm._v(" "),
  44187. _c("div", { staticClass: "col-md-10" }, [
  44188. _c(
  44189. "div",
  44190. {
  44191. staticClass: "collapse",
  44192. attrs: { id: "note" + _vm.noteType + "add" }
  44193. },
  44194. [
  44195. _c(
  44196. "div",
  44197. {
  44198. staticClass:
  44199. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  44200. },
  44201. [
  44202. _c("textarea", {
  44203. directives: [
  44204. {
  44205. name: "model",
  44206. rawName: "v-model",
  44207. value: _vm.newNote.thenote,
  44208. expression: "newNote.thenote"
  44209. }
  44210. ],
  44211. staticClass: "form-control",
  44212. attrs: {
  44213. name: "newnote" + _vm.noteType,
  44214. id: "newnote" + _vm.noteType
  44215. },
  44216. domProps: { value: _vm.newNote.thenote },
  44217. on: {
  44218. input: function($event) {
  44219. if ($event.target.composing) {
  44220. return
  44221. }
  44222. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  44223. }
  44224. }
  44225. }),
  44226. _vm._v(" "),
  44227. _c(
  44228. "button",
  44229. {
  44230. staticClass: "btn btn-secondary m-2",
  44231. attrs: { type: "button" },
  44232. on: {
  44233. click: function($event) {
  44234. return _vm.createNote()
  44235. }
  44236. }
  44237. },
  44238. [_vm._v("Save")]
  44239. )
  44240. ]
  44241. )
  44242. ]
  44243. )
  44244. ])
  44245. ]),
  44246. _vm._v(" "),
  44247. _vm._l(this.notes, function(note, index) {
  44248. return _c(
  44249. "li",
  44250. { key: index, staticClass: "row no-gutters mb-2" },
  44251. [
  44252. _c("note-form-modal", {
  44253. attrs: {
  44254. "modal-id": "note" + note.noteid + "editModal",
  44255. "populate-with": note
  44256. }
  44257. }),
  44258. _vm._v(" "),
  44259. _c(
  44260. "div",
  44261. {
  44262. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44263. class: _vm.setOrder(index)
  44264. },
  44265. [
  44266. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44267. _vm._v(_vm._s(note.noteuser))
  44268. ]),
  44269. _vm._v(" "),
  44270. _c(
  44271. "div",
  44272. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44273. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44274. ),
  44275. _vm._v(" "),
  44276. _c(
  44277. "div",
  44278. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44279. [
  44280. _vm.authusername === note.noteuser ||
  44281. _vm.authusername === "admin"
  44282. ? [
  44283. _c(
  44284. "button",
  44285. {
  44286. staticClass: "btn btn-sm btn-primary m-1",
  44287. attrs: {
  44288. "data-toggle": "modal",
  44289. "data-target":
  44290. "#note" + note.noteid + "editModal"
  44291. }
  44292. },
  44293. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44294. ),
  44295. _vm._v(" "),
  44296. _vm._m(0, true),
  44297. _vm._v(" "),
  44298. _vm._m(1, true)
  44299. ]
  44300. : _vm._e()
  44301. ],
  44302. 2
  44303. )
  44304. ]
  44305. ),
  44306. _vm._v(" "),
  44307. _c("div", { staticClass: "col-md-10" }, [
  44308. _c("div", { staticClass: "card m-2" }, [
  44309. _c("div", { staticClass: "card-body p-2" }, [
  44310. _vm._v(
  44311. "\n " +
  44312. _vm._s(note.thenote) +
  44313. "\n "
  44314. )
  44315. ])
  44316. ])
  44317. ])
  44318. ],
  44319. 1
  44320. )
  44321. })
  44322. ],
  44323. 2
  44324. )
  44325. }
  44326. var staticRenderFns = [
  44327. function() {
  44328. var _vm = this
  44329. var _h = _vm.$createElement
  44330. var _c = _vm._self._c || _h
  44331. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44332. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44333. ])
  44334. },
  44335. function() {
  44336. var _vm = this
  44337. var _h = _vm.$createElement
  44338. var _c = _vm._self._c || _h
  44339. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44340. _c("i", { staticClass: "fa fa-fw fa-random" })
  44341. ])
  44342. }
  44343. ]
  44344. render._withStripped = true
  44345. /***/ }),
  44346. /***/ "./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&":
  44347. /*!********************************************************************************************************************************************************************************************************************!*\
  44348. !*** ./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& ***!
  44349. \********************************************************************************************************************************************************************************************************************/
  44350. /*! exports provided: render, staticRenderFns */
  44351. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44352. "use strict";
  44353. __webpack_require__.r(__webpack_exports__);
  44354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44355. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44356. var render = function() {
  44357. var _vm = this
  44358. var _h = _vm.$createElement
  44359. var _c = _vm._self._c || _h
  44360. return _c(
  44361. "modal",
  44362. {
  44363. attrs: {
  44364. id: _vm.id,
  44365. tabindex: "-1",
  44366. role: "dialog",
  44367. "aria-labelledby": _vm.id + "Label"
  44368. }
  44369. },
  44370. [
  44371. _c(
  44372. "h5",
  44373. {
  44374. staticClass: "modal-title",
  44375. attrs: { slot: "header", id: _vm.id + "Label" },
  44376. slot: "header"
  44377. },
  44378. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44379. ),
  44380. _vm._v(" "),
  44381. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44382. _c(
  44383. "div",
  44384. { staticClass: "form-group" },
  44385. [
  44386. _c("label", { attrs: { for: "probdesc" } }, [
  44387. _vm._v("Problem Description")
  44388. ]),
  44389. _vm._v(" "),
  44390. _c("textarea", {
  44391. directives: [
  44392. {
  44393. name: "model",
  44394. rawName: "v-model",
  44395. value: _vm.data.probdesc,
  44396. expression: "data.probdesc"
  44397. }
  44398. ],
  44399. class: {
  44400. "form-control": true,
  44401. "is-invalid": _vm.errors.probdesc
  44402. },
  44403. attrs: { id: "probdesc", name: "probdesc" },
  44404. domProps: { value: _vm.data.probdesc },
  44405. on: {
  44406. input: function($event) {
  44407. if ($event.target.composing) {
  44408. return
  44409. }
  44410. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44411. }
  44412. }
  44413. }),
  44414. _vm._v(" "),
  44415. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44416. ],
  44417. 1
  44418. ),
  44419. _vm._v(" "),
  44420. _c(
  44421. "div",
  44422. { staticClass: "form-group" },
  44423. [
  44424. _c("label", { attrs: { for: "suggested" } }, [
  44425. _vm._v("Suggested Solution")
  44426. ]),
  44427. _vm._v(" "),
  44428. _c("textarea", {
  44429. directives: [
  44430. {
  44431. name: "model",
  44432. rawName: "v-model",
  44433. value: _vm.data.suggested,
  44434. expression: "data.suggested"
  44435. }
  44436. ],
  44437. class: {
  44438. "form-control": true,
  44439. "is-invalid": _vm.errors.suggested
  44440. },
  44441. attrs: { id: "suggested", name: "suggested" },
  44442. domProps: { value: _vm.data.suggested },
  44443. on: {
  44444. input: function($event) {
  44445. if ($event.target.composing) {
  44446. return
  44447. }
  44448. _vm.$set(_vm.data, "suggested", $event.target.value)
  44449. }
  44450. }
  44451. }),
  44452. _vm._v(" "),
  44453. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44454. ],
  44455. 1
  44456. ),
  44457. _vm._v(" "),
  44458. _c(
  44459. "div",
  44460. { staticClass: "form-group" },
  44461. [
  44462. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44463. _vm._v(" "),
  44464. _c("autocomplete-custom-dropdown", {
  44465. attrs: { options: _vm.storeList, value: this.store },
  44466. model: {
  44467. value: _vm.store,
  44468. callback: function($$v) {
  44469. _vm.store = $$v
  44470. },
  44471. expression: "store"
  44472. }
  44473. })
  44474. ],
  44475. 1
  44476. )
  44477. ]),
  44478. _vm._v(" "),
  44479. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44480. _c(
  44481. "button",
  44482. {
  44483. staticClass: "btn btn-secondary",
  44484. attrs: { type: "button", "data-dismiss": "modal" }
  44485. },
  44486. [_vm._v("Close")]
  44487. ),
  44488. _vm._v(" "),
  44489. _c(
  44490. "button",
  44491. {
  44492. staticClass: "btn btn-primary",
  44493. attrs: { type: "button" },
  44494. on: {
  44495. click: function($event) {
  44496. return _vm.updateWorkOrder()
  44497. }
  44498. }
  44499. },
  44500. [_vm._v("Save")]
  44501. )
  44502. ])
  44503. ]
  44504. )
  44505. }
  44506. var staticRenderFns = []
  44507. render._withStripped = true
  44508. /***/ }),
  44509. /***/ "./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&":
  44510. /*!*********************************************************************************************************************************************************************************************************!*\
  44511. !*** ./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& ***!
  44512. \*********************************************************************************************************************************************************************************************************/
  44513. /*! exports provided: render, staticRenderFns */
  44514. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44515. "use strict";
  44516. __webpack_require__.r(__webpack_exports__);
  44517. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44518. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44519. var render = function() {
  44520. var _vm = this
  44521. var _h = _vm.$createElement
  44522. var _c = _vm._self._c || _h
  44523. return _c(
  44524. "div",
  44525. [
  44526. _c("woinfo-edit-modal", {
  44527. attrs: {
  44528. "modal-id": "workordereditModal",
  44529. "populate-with": this.data,
  44530. "store-list": this.storeList
  44531. }
  44532. }),
  44533. _vm._v(" "),
  44534. _c("p", [
  44535. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44536. _vm._v(" "),
  44537. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44538. ]),
  44539. _vm._v(" "),
  44540. _c("p", [
  44541. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44542. _vm._v(" "),
  44543. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44544. ]),
  44545. _vm._v(" "),
  44546. _c("p", [
  44547. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44548. _vm._v(" "),
  44549. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44550. ]),
  44551. _vm._v(" "),
  44552. _c("p", [
  44553. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44554. _vm._v(" "),
  44555. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44556. ]),
  44557. _vm._v(" "),
  44558. _c("p", [
  44559. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44560. _vm._v(" "),
  44561. _c(
  44562. "span",
  44563. {
  44564. staticClass: "dashed-underline",
  44565. attrs: {
  44566. "data-toggle": "tooltip",
  44567. "data-placement": "bottom",
  44568. title: this.getHRDate(this.data.dropdate)
  44569. }
  44570. },
  44571. [
  44572. _vm._v(
  44573. "\n " +
  44574. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44575. " days ago\n "
  44576. )
  44577. ]
  44578. )
  44579. ]),
  44580. _vm._v(" "),
  44581. _c("p", [
  44582. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44583. _vm._v(" "),
  44584. !this.isZero(this.data.pickupdate)
  44585. ? _c(
  44586. "span",
  44587. {
  44588. staticClass: "dashed-underline",
  44589. attrs: {
  44590. "data-toggle": "tooltip",
  44591. "data-placement": "bottom",
  44592. title: this.getHRDate(this.data.pickupdate)
  44593. }
  44594. },
  44595. [
  44596. _vm._v(
  44597. "\n " +
  44598. _vm._s(
  44599. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44600. ) +
  44601. " days ago\n "
  44602. )
  44603. ]
  44604. )
  44605. : _vm._e()
  44606. ]),
  44607. _vm._v(" "),
  44608. _c(
  44609. "button",
  44610. {
  44611. staticClass: "btn btn-primary",
  44612. attrs: {
  44613. type: "button",
  44614. "data-toggle": "modal",
  44615. "data-target": "#workordereditModal"
  44616. }
  44617. },
  44618. [_vm._v("Edit")]
  44619. )
  44620. ],
  44621. 1
  44622. )
  44623. }
  44624. var staticRenderFns = []
  44625. render._withStripped = true
  44626. /***/ }),
  44627. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44628. /*!********************************************************************!*\
  44629. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44630. \********************************************************************/
  44631. /*! exports provided: default */
  44632. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44633. "use strict";
  44634. __webpack_require__.r(__webpack_exports__);
  44635. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44636. /* globals __VUE_SSR_CONTEXT__ */
  44637. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44638. // This module is a runtime utility for cleaner component module output and will
  44639. // be included in the final webpack user bundle.
  44640. function normalizeComponent (
  44641. scriptExports,
  44642. render,
  44643. staticRenderFns,
  44644. functionalTemplate,
  44645. injectStyles,
  44646. scopeId,
  44647. moduleIdentifier, /* server only */
  44648. shadowMode /* vue-cli only */
  44649. ) {
  44650. // Vue.extend constructor export interop
  44651. var options = typeof scriptExports === 'function'
  44652. ? scriptExports.options
  44653. : scriptExports
  44654. // render functions
  44655. if (render) {
  44656. options.render = render
  44657. options.staticRenderFns = staticRenderFns
  44658. options._compiled = true
  44659. }
  44660. // functional template
  44661. if (functionalTemplate) {
  44662. options.functional = true
  44663. }
  44664. // scopedId
  44665. if (scopeId) {
  44666. options._scopeId = 'data-v-' + scopeId
  44667. }
  44668. var hook
  44669. if (moduleIdentifier) { // server build
  44670. hook = function (context) {
  44671. // 2.3 injection
  44672. context =
  44673. context || // cached call
  44674. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44675. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44676. // 2.2 with runInNewContext: true
  44677. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44678. context = __VUE_SSR_CONTEXT__
  44679. }
  44680. // inject component styles
  44681. if (injectStyles) {
  44682. injectStyles.call(this, context)
  44683. }
  44684. // register component module identifier for async chunk inferrence
  44685. if (context && context._registeredComponents) {
  44686. context._registeredComponents.add(moduleIdentifier)
  44687. }
  44688. }
  44689. // used by ssr in case component is cached and beforeCreate
  44690. // never gets called
  44691. options._ssrRegister = hook
  44692. } else if (injectStyles) {
  44693. hook = shadowMode
  44694. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44695. : injectStyles
  44696. }
  44697. if (hook) {
  44698. if (options.functional) {
  44699. // for template-only hot-reload because in that case the render fn doesn't
  44700. // go through the normalizer
  44701. options._injectStyles = hook
  44702. // register for functioal component in vue file
  44703. var originalRender = options.render
  44704. options.render = function renderWithStyleInjection (h, context) {
  44705. hook.call(context)
  44706. return originalRender(h, context)
  44707. }
  44708. } else {
  44709. // inject component registration as beforeCreate hook
  44710. var existing = options.beforeCreate
  44711. options.beforeCreate = existing
  44712. ? [].concat(existing, hook)
  44713. : [hook]
  44714. }
  44715. }
  44716. return {
  44717. exports: scriptExports,
  44718. options: options
  44719. }
  44720. }
  44721. /***/ }),
  44722. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44723. /*!*************************************************!*\
  44724. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44725. \*************************************************/
  44726. /*! no static exports found */
  44727. /***/ (function(module, exports, __webpack_require__) {
  44728. "use strict";
  44729. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44730. * Vue.js v2.6.11
  44731. * (c) 2014-2019 Evan You
  44732. * Released under the MIT License.
  44733. */
  44734. /* */
  44735. var emptyObject = Object.freeze({});
  44736. // These helpers produce better VM code in JS engines due to their
  44737. // explicitness and function inlining.
  44738. function isUndef (v) {
  44739. return v === undefined || v === null
  44740. }
  44741. function isDef (v) {
  44742. return v !== undefined && v !== null
  44743. }
  44744. function isTrue (v) {
  44745. return v === true
  44746. }
  44747. function isFalse (v) {
  44748. return v === false
  44749. }
  44750. /**
  44751. * Check if value is primitive.
  44752. */
  44753. function isPrimitive (value) {
  44754. return (
  44755. typeof value === 'string' ||
  44756. typeof value === 'number' ||
  44757. // $flow-disable-line
  44758. typeof value === 'symbol' ||
  44759. typeof value === 'boolean'
  44760. )
  44761. }
  44762. /**
  44763. * Quick object check - this is primarily used to tell
  44764. * Objects from primitive values when we know the value
  44765. * is a JSON-compliant type.
  44766. */
  44767. function isObject (obj) {
  44768. return obj !== null && typeof obj === 'object'
  44769. }
  44770. /**
  44771. * Get the raw type string of a value, e.g., [object Object].
  44772. */
  44773. var _toString = Object.prototype.toString;
  44774. function toRawType (value) {
  44775. return _toString.call(value).slice(8, -1)
  44776. }
  44777. /**
  44778. * Strict object type check. Only returns true
  44779. * for plain JavaScript objects.
  44780. */
  44781. function isPlainObject (obj) {
  44782. return _toString.call(obj) === '[object Object]'
  44783. }
  44784. function isRegExp (v) {
  44785. return _toString.call(v) === '[object RegExp]'
  44786. }
  44787. /**
  44788. * Check if val is a valid array index.
  44789. */
  44790. function isValidArrayIndex (val) {
  44791. var n = parseFloat(String(val));
  44792. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44793. }
  44794. function isPromise (val) {
  44795. return (
  44796. isDef(val) &&
  44797. typeof val.then === 'function' &&
  44798. typeof val.catch === 'function'
  44799. )
  44800. }
  44801. /**
  44802. * Convert a value to a string that is actually rendered.
  44803. */
  44804. function toString (val) {
  44805. return val == null
  44806. ? ''
  44807. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44808. ? JSON.stringify(val, null, 2)
  44809. : String(val)
  44810. }
  44811. /**
  44812. * Convert an input value to a number for persistence.
  44813. * If the conversion fails, return original string.
  44814. */
  44815. function toNumber (val) {
  44816. var n = parseFloat(val);
  44817. return isNaN(n) ? val : n
  44818. }
  44819. /**
  44820. * Make a map and return a function for checking if a key
  44821. * is in that map.
  44822. */
  44823. function makeMap (
  44824. str,
  44825. expectsLowerCase
  44826. ) {
  44827. var map = Object.create(null);
  44828. var list = str.split(',');
  44829. for (var i = 0; i < list.length; i++) {
  44830. map[list[i]] = true;
  44831. }
  44832. return expectsLowerCase
  44833. ? function (val) { return map[val.toLowerCase()]; }
  44834. : function (val) { return map[val]; }
  44835. }
  44836. /**
  44837. * Check if a tag is a built-in tag.
  44838. */
  44839. var isBuiltInTag = makeMap('slot,component', true);
  44840. /**
  44841. * Check if an attribute is a reserved attribute.
  44842. */
  44843. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44844. /**
  44845. * Remove an item from an array.
  44846. */
  44847. function remove (arr, item) {
  44848. if (arr.length) {
  44849. var index = arr.indexOf(item);
  44850. if (index > -1) {
  44851. return arr.splice(index, 1)
  44852. }
  44853. }
  44854. }
  44855. /**
  44856. * Check whether an object has the property.
  44857. */
  44858. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44859. function hasOwn (obj, key) {
  44860. return hasOwnProperty.call(obj, key)
  44861. }
  44862. /**
  44863. * Create a cached version of a pure function.
  44864. */
  44865. function cached (fn) {
  44866. var cache = Object.create(null);
  44867. return (function cachedFn (str) {
  44868. var hit = cache[str];
  44869. return hit || (cache[str] = fn(str))
  44870. })
  44871. }
  44872. /**
  44873. * Camelize a hyphen-delimited string.
  44874. */
  44875. var camelizeRE = /-(\w)/g;
  44876. var camelize = cached(function (str) {
  44877. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44878. });
  44879. /**
  44880. * Capitalize a string.
  44881. */
  44882. var capitalize = cached(function (str) {
  44883. return str.charAt(0).toUpperCase() + str.slice(1)
  44884. });
  44885. /**
  44886. * Hyphenate a camelCase string.
  44887. */
  44888. var hyphenateRE = /\B([A-Z])/g;
  44889. var hyphenate = cached(function (str) {
  44890. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44891. });
  44892. /**
  44893. * Simple bind polyfill for environments that do not support it,
  44894. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44895. * since native bind is now performant enough in most browsers.
  44896. * But removing it would mean breaking code that was able to run in
  44897. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44898. */
  44899. /* istanbul ignore next */
  44900. function polyfillBind (fn, ctx) {
  44901. function boundFn (a) {
  44902. var l = arguments.length;
  44903. return l
  44904. ? l > 1
  44905. ? fn.apply(ctx, arguments)
  44906. : fn.call(ctx, a)
  44907. : fn.call(ctx)
  44908. }
  44909. boundFn._length = fn.length;
  44910. return boundFn
  44911. }
  44912. function nativeBind (fn, ctx) {
  44913. return fn.bind(ctx)
  44914. }
  44915. var bind = Function.prototype.bind
  44916. ? nativeBind
  44917. : polyfillBind;
  44918. /**
  44919. * Convert an Array-like object to a real Array.
  44920. */
  44921. function toArray (list, start) {
  44922. start = start || 0;
  44923. var i = list.length - start;
  44924. var ret = new Array(i);
  44925. while (i--) {
  44926. ret[i] = list[i + start];
  44927. }
  44928. return ret
  44929. }
  44930. /**
  44931. * Mix properties into target object.
  44932. */
  44933. function extend (to, _from) {
  44934. for (var key in _from) {
  44935. to[key] = _from[key];
  44936. }
  44937. return to
  44938. }
  44939. /**
  44940. * Merge an Array of Objects into a single Object.
  44941. */
  44942. function toObject (arr) {
  44943. var res = {};
  44944. for (var i = 0; i < arr.length; i++) {
  44945. if (arr[i]) {
  44946. extend(res, arr[i]);
  44947. }
  44948. }
  44949. return res
  44950. }
  44951. /* eslint-disable no-unused-vars */
  44952. /**
  44953. * Perform no operation.
  44954. * Stubbing args to make Flow happy without leaving useless transpiled code
  44955. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44956. */
  44957. function noop (a, b, c) {}
  44958. /**
  44959. * Always return false.
  44960. */
  44961. var no = function (a, b, c) { return false; };
  44962. /* eslint-enable no-unused-vars */
  44963. /**
  44964. * Return the same value.
  44965. */
  44966. var identity = function (_) { return _; };
  44967. /**
  44968. * Generate a string containing static keys from compiler modules.
  44969. */
  44970. function genStaticKeys (modules) {
  44971. return modules.reduce(function (keys, m) {
  44972. return keys.concat(m.staticKeys || [])
  44973. }, []).join(',')
  44974. }
  44975. /**
  44976. * Check if two values are loosely equal - that is,
  44977. * if they are plain objects, do they have the same shape?
  44978. */
  44979. function looseEqual (a, b) {
  44980. if (a === b) { return true }
  44981. var isObjectA = isObject(a);
  44982. var isObjectB = isObject(b);
  44983. if (isObjectA && isObjectB) {
  44984. try {
  44985. var isArrayA = Array.isArray(a);
  44986. var isArrayB = Array.isArray(b);
  44987. if (isArrayA && isArrayB) {
  44988. return a.length === b.length && a.every(function (e, i) {
  44989. return looseEqual(e, b[i])
  44990. })
  44991. } else if (a instanceof Date && b instanceof Date) {
  44992. return a.getTime() === b.getTime()
  44993. } else if (!isArrayA && !isArrayB) {
  44994. var keysA = Object.keys(a);
  44995. var keysB = Object.keys(b);
  44996. return keysA.length === keysB.length && keysA.every(function (key) {
  44997. return looseEqual(a[key], b[key])
  44998. })
  44999. } else {
  45000. /* istanbul ignore next */
  45001. return false
  45002. }
  45003. } catch (e) {
  45004. /* istanbul ignore next */
  45005. return false
  45006. }
  45007. } else if (!isObjectA && !isObjectB) {
  45008. return String(a) === String(b)
  45009. } else {
  45010. return false
  45011. }
  45012. }
  45013. /**
  45014. * Return the first index at which a loosely equal value can be
  45015. * found in the array (if value is a plain object, the array must
  45016. * contain an object of the same shape), or -1 if it is not present.
  45017. */
  45018. function looseIndexOf (arr, val) {
  45019. for (var i = 0; i < arr.length; i++) {
  45020. if (looseEqual(arr[i], val)) { return i }
  45021. }
  45022. return -1
  45023. }
  45024. /**
  45025. * Ensure a function is called only once.
  45026. */
  45027. function once (fn) {
  45028. var called = false;
  45029. return function () {
  45030. if (!called) {
  45031. called = true;
  45032. fn.apply(this, arguments);
  45033. }
  45034. }
  45035. }
  45036. var SSR_ATTR = 'data-server-rendered';
  45037. var ASSET_TYPES = [
  45038. 'component',
  45039. 'directive',
  45040. 'filter'
  45041. ];
  45042. var LIFECYCLE_HOOKS = [
  45043. 'beforeCreate',
  45044. 'created',
  45045. 'beforeMount',
  45046. 'mounted',
  45047. 'beforeUpdate',
  45048. 'updated',
  45049. 'beforeDestroy',
  45050. 'destroyed',
  45051. 'activated',
  45052. 'deactivated',
  45053. 'errorCaptured',
  45054. 'serverPrefetch'
  45055. ];
  45056. /* */
  45057. var config = ({
  45058. /**
  45059. * Option merge strategies (used in core/util/options)
  45060. */
  45061. // $flow-disable-line
  45062. optionMergeStrategies: Object.create(null),
  45063. /**
  45064. * Whether to suppress warnings.
  45065. */
  45066. silent: false,
  45067. /**
  45068. * Show production mode tip message on boot?
  45069. */
  45070. productionTip: "development" !== 'production',
  45071. /**
  45072. * Whether to enable devtools
  45073. */
  45074. devtools: "development" !== 'production',
  45075. /**
  45076. * Whether to record perf
  45077. */
  45078. performance: false,
  45079. /**
  45080. * Error handler for watcher errors
  45081. */
  45082. errorHandler: null,
  45083. /**
  45084. * Warn handler for watcher warns
  45085. */
  45086. warnHandler: null,
  45087. /**
  45088. * Ignore certain custom elements
  45089. */
  45090. ignoredElements: [],
  45091. /**
  45092. * Custom user key aliases for v-on
  45093. */
  45094. // $flow-disable-line
  45095. keyCodes: Object.create(null),
  45096. /**
  45097. * Check if a tag is reserved so that it cannot be registered as a
  45098. * component. This is platform-dependent and may be overwritten.
  45099. */
  45100. isReservedTag: no,
  45101. /**
  45102. * Check if an attribute is reserved so that it cannot be used as a component
  45103. * prop. This is platform-dependent and may be overwritten.
  45104. */
  45105. isReservedAttr: no,
  45106. /**
  45107. * Check if a tag is an unknown element.
  45108. * Platform-dependent.
  45109. */
  45110. isUnknownElement: no,
  45111. /**
  45112. * Get the namespace of an element
  45113. */
  45114. getTagNamespace: noop,
  45115. /**
  45116. * Parse the real tag name for the specific platform.
  45117. */
  45118. parsePlatformTagName: identity,
  45119. /**
  45120. * Check if an attribute must be bound using property, e.g. value
  45121. * Platform-dependent.
  45122. */
  45123. mustUseProp: no,
  45124. /**
  45125. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45126. * This will significantly reduce performance if set to false.
  45127. */
  45128. async: true,
  45129. /**
  45130. * Exposed for legacy reasons
  45131. */
  45132. _lifecycleHooks: LIFECYCLE_HOOKS
  45133. });
  45134. /* */
  45135. /**
  45136. * unicode letters used for parsing html tags, component names and property paths.
  45137. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45138. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45139. */
  45140. 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/;
  45141. /**
  45142. * Check if a string starts with $ or _
  45143. */
  45144. function isReserved (str) {
  45145. var c = (str + '').charCodeAt(0);
  45146. return c === 0x24 || c === 0x5F
  45147. }
  45148. /**
  45149. * Define a property.
  45150. */
  45151. function def (obj, key, val, enumerable) {
  45152. Object.defineProperty(obj, key, {
  45153. value: val,
  45154. enumerable: !!enumerable,
  45155. writable: true,
  45156. configurable: true
  45157. });
  45158. }
  45159. /**
  45160. * Parse simple path.
  45161. */
  45162. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45163. function parsePath (path) {
  45164. if (bailRE.test(path)) {
  45165. return
  45166. }
  45167. var segments = path.split('.');
  45168. return function (obj) {
  45169. for (var i = 0; i < segments.length; i++) {
  45170. if (!obj) { return }
  45171. obj = obj[segments[i]];
  45172. }
  45173. return obj
  45174. }
  45175. }
  45176. /* */
  45177. // can we use __proto__?
  45178. var hasProto = '__proto__' in {};
  45179. // Browser environment sniffing
  45180. var inBrowser = typeof window !== 'undefined';
  45181. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45182. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45183. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45184. var isIE = UA && /msie|trident/.test(UA);
  45185. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45186. var isEdge = UA && UA.indexOf('edge/') > 0;
  45187. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45188. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45189. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45190. var isPhantomJS = UA && /phantomjs/.test(UA);
  45191. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45192. // Firefox has a "watch" function on Object.prototype...
  45193. var nativeWatch = ({}).watch;
  45194. var supportsPassive = false;
  45195. if (inBrowser) {
  45196. try {
  45197. var opts = {};
  45198. Object.defineProperty(opts, 'passive', ({
  45199. get: function get () {
  45200. /* istanbul ignore next */
  45201. supportsPassive = true;
  45202. }
  45203. })); // https://github.com/facebook/flow/issues/285
  45204. window.addEventListener('test-passive', null, opts);
  45205. } catch (e) {}
  45206. }
  45207. // this needs to be lazy-evaled because vue may be required before
  45208. // vue-server-renderer can set VUE_ENV
  45209. var _isServer;
  45210. var isServerRendering = function () {
  45211. if (_isServer === undefined) {
  45212. /* istanbul ignore if */
  45213. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45214. // detect presence of vue-server-renderer and avoid
  45215. // Webpack shimming the process
  45216. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45217. } else {
  45218. _isServer = false;
  45219. }
  45220. }
  45221. return _isServer
  45222. };
  45223. // detect devtools
  45224. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45225. /* istanbul ignore next */
  45226. function isNative (Ctor) {
  45227. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45228. }
  45229. var hasSymbol =
  45230. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45231. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45232. var _Set;
  45233. /* istanbul ignore if */ // $flow-disable-line
  45234. if (typeof Set !== 'undefined' && isNative(Set)) {
  45235. // use native Set when available.
  45236. _Set = Set;
  45237. } else {
  45238. // a non-standard Set polyfill that only works with primitive keys.
  45239. _Set = /*@__PURE__*/(function () {
  45240. function Set () {
  45241. this.set = Object.create(null);
  45242. }
  45243. Set.prototype.has = function has (key) {
  45244. return this.set[key] === true
  45245. };
  45246. Set.prototype.add = function add (key) {
  45247. this.set[key] = true;
  45248. };
  45249. Set.prototype.clear = function clear () {
  45250. this.set = Object.create(null);
  45251. };
  45252. return Set;
  45253. }());
  45254. }
  45255. /* */
  45256. var warn = noop;
  45257. var tip = noop;
  45258. var generateComponentTrace = (noop); // work around flow check
  45259. var formatComponentName = (noop);
  45260. {
  45261. var hasConsole = typeof console !== 'undefined';
  45262. var classifyRE = /(?:^|[-_])(\w)/g;
  45263. var classify = function (str) { return str
  45264. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45265. .replace(/[-_]/g, ''); };
  45266. warn = function (msg, vm) {
  45267. var trace = vm ? generateComponentTrace(vm) : '';
  45268. if (config.warnHandler) {
  45269. config.warnHandler.call(null, msg, vm, trace);
  45270. } else if (hasConsole && (!config.silent)) {
  45271. console.error(("[Vue warn]: " + msg + trace));
  45272. }
  45273. };
  45274. tip = function (msg, vm) {
  45275. if (hasConsole && (!config.silent)) {
  45276. console.warn("[Vue tip]: " + msg + (
  45277. vm ? generateComponentTrace(vm) : ''
  45278. ));
  45279. }
  45280. };
  45281. formatComponentName = function (vm, includeFile) {
  45282. if (vm.$root === vm) {
  45283. return '<Root>'
  45284. }
  45285. var options = typeof vm === 'function' && vm.cid != null
  45286. ? vm.options
  45287. : vm._isVue
  45288. ? vm.$options || vm.constructor.options
  45289. : vm;
  45290. var name = options.name || options._componentTag;
  45291. var file = options.__file;
  45292. if (!name && file) {
  45293. var match = file.match(/([^/\\]+)\.vue$/);
  45294. name = match && match[1];
  45295. }
  45296. return (
  45297. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45298. (file && includeFile !== false ? (" at " + file) : '')
  45299. )
  45300. };
  45301. var repeat = function (str, n) {
  45302. var res = '';
  45303. while (n) {
  45304. if (n % 2 === 1) { res += str; }
  45305. if (n > 1) { str += str; }
  45306. n >>= 1;
  45307. }
  45308. return res
  45309. };
  45310. generateComponentTrace = function (vm) {
  45311. if (vm._isVue && vm.$parent) {
  45312. var tree = [];
  45313. var currentRecursiveSequence = 0;
  45314. while (vm) {
  45315. if (tree.length > 0) {
  45316. var last = tree[tree.length - 1];
  45317. if (last.constructor === vm.constructor) {
  45318. currentRecursiveSequence++;
  45319. vm = vm.$parent;
  45320. continue
  45321. } else if (currentRecursiveSequence > 0) {
  45322. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45323. currentRecursiveSequence = 0;
  45324. }
  45325. }
  45326. tree.push(vm);
  45327. vm = vm.$parent;
  45328. }
  45329. return '\n\nfound in\n\n' + tree
  45330. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45331. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45332. : formatComponentName(vm))); })
  45333. .join('\n')
  45334. } else {
  45335. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45336. }
  45337. };
  45338. }
  45339. /* */
  45340. var uid = 0;
  45341. /**
  45342. * A dep is an observable that can have multiple
  45343. * directives subscribing to it.
  45344. */
  45345. var Dep = function Dep () {
  45346. this.id = uid++;
  45347. this.subs = [];
  45348. };
  45349. Dep.prototype.addSub = function addSub (sub) {
  45350. this.subs.push(sub);
  45351. };
  45352. Dep.prototype.removeSub = function removeSub (sub) {
  45353. remove(this.subs, sub);
  45354. };
  45355. Dep.prototype.depend = function depend () {
  45356. if (Dep.target) {
  45357. Dep.target.addDep(this);
  45358. }
  45359. };
  45360. Dep.prototype.notify = function notify () {
  45361. // stabilize the subscriber list first
  45362. var subs = this.subs.slice();
  45363. if (!config.async) {
  45364. // subs aren't sorted in scheduler if not running async
  45365. // we need to sort them now to make sure they fire in correct
  45366. // order
  45367. subs.sort(function (a, b) { return a.id - b.id; });
  45368. }
  45369. for (var i = 0, l = subs.length; i < l; i++) {
  45370. subs[i].update();
  45371. }
  45372. };
  45373. // The current target watcher being evaluated.
  45374. // This is globally unique because only one watcher
  45375. // can be evaluated at a time.
  45376. Dep.target = null;
  45377. var targetStack = [];
  45378. function pushTarget (target) {
  45379. targetStack.push(target);
  45380. Dep.target = target;
  45381. }
  45382. function popTarget () {
  45383. targetStack.pop();
  45384. Dep.target = targetStack[targetStack.length - 1];
  45385. }
  45386. /* */
  45387. var VNode = function VNode (
  45388. tag,
  45389. data,
  45390. children,
  45391. text,
  45392. elm,
  45393. context,
  45394. componentOptions,
  45395. asyncFactory
  45396. ) {
  45397. this.tag = tag;
  45398. this.data = data;
  45399. this.children = children;
  45400. this.text = text;
  45401. this.elm = elm;
  45402. this.ns = undefined;
  45403. this.context = context;
  45404. this.fnContext = undefined;
  45405. this.fnOptions = undefined;
  45406. this.fnScopeId = undefined;
  45407. this.key = data && data.key;
  45408. this.componentOptions = componentOptions;
  45409. this.componentInstance = undefined;
  45410. this.parent = undefined;
  45411. this.raw = false;
  45412. this.isStatic = false;
  45413. this.isRootInsert = true;
  45414. this.isComment = false;
  45415. this.isCloned = false;
  45416. this.isOnce = false;
  45417. this.asyncFactory = asyncFactory;
  45418. this.asyncMeta = undefined;
  45419. this.isAsyncPlaceholder = false;
  45420. };
  45421. var prototypeAccessors = { child: { configurable: true } };
  45422. // DEPRECATED: alias for componentInstance for backwards compat.
  45423. /* istanbul ignore next */
  45424. prototypeAccessors.child.get = function () {
  45425. return this.componentInstance
  45426. };
  45427. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45428. var createEmptyVNode = function (text) {
  45429. if ( text === void 0 ) text = '';
  45430. var node = new VNode();
  45431. node.text = text;
  45432. node.isComment = true;
  45433. return node
  45434. };
  45435. function createTextVNode (val) {
  45436. return new VNode(undefined, undefined, undefined, String(val))
  45437. }
  45438. // optimized shallow clone
  45439. // used for static nodes and slot nodes because they may be reused across
  45440. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45441. // on their elm reference.
  45442. function cloneVNode (vnode) {
  45443. var cloned = new VNode(
  45444. vnode.tag,
  45445. vnode.data,
  45446. // #7975
  45447. // clone children array to avoid mutating original in case of cloning
  45448. // a child.
  45449. vnode.children && vnode.children.slice(),
  45450. vnode.text,
  45451. vnode.elm,
  45452. vnode.context,
  45453. vnode.componentOptions,
  45454. vnode.asyncFactory
  45455. );
  45456. cloned.ns = vnode.ns;
  45457. cloned.isStatic = vnode.isStatic;
  45458. cloned.key = vnode.key;
  45459. cloned.isComment = vnode.isComment;
  45460. cloned.fnContext = vnode.fnContext;
  45461. cloned.fnOptions = vnode.fnOptions;
  45462. cloned.fnScopeId = vnode.fnScopeId;
  45463. cloned.asyncMeta = vnode.asyncMeta;
  45464. cloned.isCloned = true;
  45465. return cloned
  45466. }
  45467. /*
  45468. * not type checking this file because flow doesn't play well with
  45469. * dynamically accessing methods on Array prototype
  45470. */
  45471. var arrayProto = Array.prototype;
  45472. var arrayMethods = Object.create(arrayProto);
  45473. var methodsToPatch = [
  45474. 'push',
  45475. 'pop',
  45476. 'shift',
  45477. 'unshift',
  45478. 'splice',
  45479. 'sort',
  45480. 'reverse'
  45481. ];
  45482. /**
  45483. * Intercept mutating methods and emit events
  45484. */
  45485. methodsToPatch.forEach(function (method) {
  45486. // cache original method
  45487. var original = arrayProto[method];
  45488. def(arrayMethods, method, function mutator () {
  45489. var args = [], len = arguments.length;
  45490. while ( len-- ) args[ len ] = arguments[ len ];
  45491. var result = original.apply(this, args);
  45492. var ob = this.__ob__;
  45493. var inserted;
  45494. switch (method) {
  45495. case 'push':
  45496. case 'unshift':
  45497. inserted = args;
  45498. break
  45499. case 'splice':
  45500. inserted = args.slice(2);
  45501. break
  45502. }
  45503. if (inserted) { ob.observeArray(inserted); }
  45504. // notify change
  45505. ob.dep.notify();
  45506. return result
  45507. });
  45508. });
  45509. /* */
  45510. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45511. /**
  45512. * In some cases we may want to disable observation inside a component's
  45513. * update computation.
  45514. */
  45515. var shouldObserve = true;
  45516. function toggleObserving (value) {
  45517. shouldObserve = value;
  45518. }
  45519. /**
  45520. * Observer class that is attached to each observed
  45521. * object. Once attached, the observer converts the target
  45522. * object's property keys into getter/setters that
  45523. * collect dependencies and dispatch updates.
  45524. */
  45525. var Observer = function Observer (value) {
  45526. this.value = value;
  45527. this.dep = new Dep();
  45528. this.vmCount = 0;
  45529. def(value, '__ob__', this);
  45530. if (Array.isArray(value)) {
  45531. if (hasProto) {
  45532. protoAugment(value, arrayMethods);
  45533. } else {
  45534. copyAugment(value, arrayMethods, arrayKeys);
  45535. }
  45536. this.observeArray(value);
  45537. } else {
  45538. this.walk(value);
  45539. }
  45540. };
  45541. /**
  45542. * Walk through all properties and convert them into
  45543. * getter/setters. This method should only be called when
  45544. * value type is Object.
  45545. */
  45546. Observer.prototype.walk = function walk (obj) {
  45547. var keys = Object.keys(obj);
  45548. for (var i = 0; i < keys.length; i++) {
  45549. defineReactive$$1(obj, keys[i]);
  45550. }
  45551. };
  45552. /**
  45553. * Observe a list of Array items.
  45554. */
  45555. Observer.prototype.observeArray = function observeArray (items) {
  45556. for (var i = 0, l = items.length; i < l; i++) {
  45557. observe(items[i]);
  45558. }
  45559. };
  45560. // helpers
  45561. /**
  45562. * Augment a target Object or Array by intercepting
  45563. * the prototype chain using __proto__
  45564. */
  45565. function protoAugment (target, src) {
  45566. /* eslint-disable no-proto */
  45567. target.__proto__ = src;
  45568. /* eslint-enable no-proto */
  45569. }
  45570. /**
  45571. * Augment a target Object or Array by defining
  45572. * hidden properties.
  45573. */
  45574. /* istanbul ignore next */
  45575. function copyAugment (target, src, keys) {
  45576. for (var i = 0, l = keys.length; i < l; i++) {
  45577. var key = keys[i];
  45578. def(target, key, src[key]);
  45579. }
  45580. }
  45581. /**
  45582. * Attempt to create an observer instance for a value,
  45583. * returns the new observer if successfully observed,
  45584. * or the existing observer if the value already has one.
  45585. */
  45586. function observe (value, asRootData) {
  45587. if (!isObject(value) || value instanceof VNode) {
  45588. return
  45589. }
  45590. var ob;
  45591. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45592. ob = value.__ob__;
  45593. } else if (
  45594. shouldObserve &&
  45595. !isServerRendering() &&
  45596. (Array.isArray(value) || isPlainObject(value)) &&
  45597. Object.isExtensible(value) &&
  45598. !value._isVue
  45599. ) {
  45600. ob = new Observer(value);
  45601. }
  45602. if (asRootData && ob) {
  45603. ob.vmCount++;
  45604. }
  45605. return ob
  45606. }
  45607. /**
  45608. * Define a reactive property on an Object.
  45609. */
  45610. function defineReactive$$1 (
  45611. obj,
  45612. key,
  45613. val,
  45614. customSetter,
  45615. shallow
  45616. ) {
  45617. var dep = new Dep();
  45618. var property = Object.getOwnPropertyDescriptor(obj, key);
  45619. if (property && property.configurable === false) {
  45620. return
  45621. }
  45622. // cater for pre-defined getter/setters
  45623. var getter = property && property.get;
  45624. var setter = property && property.set;
  45625. if ((!getter || setter) && arguments.length === 2) {
  45626. val = obj[key];
  45627. }
  45628. var childOb = !shallow && observe(val);
  45629. Object.defineProperty(obj, key, {
  45630. enumerable: true,
  45631. configurable: true,
  45632. get: function reactiveGetter () {
  45633. var value = getter ? getter.call(obj) : val;
  45634. if (Dep.target) {
  45635. dep.depend();
  45636. if (childOb) {
  45637. childOb.dep.depend();
  45638. if (Array.isArray(value)) {
  45639. dependArray(value);
  45640. }
  45641. }
  45642. }
  45643. return value
  45644. },
  45645. set: function reactiveSetter (newVal) {
  45646. var value = getter ? getter.call(obj) : val;
  45647. /* eslint-disable no-self-compare */
  45648. if (newVal === value || (newVal !== newVal && value !== value)) {
  45649. return
  45650. }
  45651. /* eslint-enable no-self-compare */
  45652. if (customSetter) {
  45653. customSetter();
  45654. }
  45655. // #7981: for accessor properties without setter
  45656. if (getter && !setter) { return }
  45657. if (setter) {
  45658. setter.call(obj, newVal);
  45659. } else {
  45660. val = newVal;
  45661. }
  45662. childOb = !shallow && observe(newVal);
  45663. dep.notify();
  45664. }
  45665. });
  45666. }
  45667. /**
  45668. * Set a property on an object. Adds the new property and
  45669. * triggers change notification if the property doesn't
  45670. * already exist.
  45671. */
  45672. function set (target, key, val) {
  45673. if (isUndef(target) || isPrimitive(target)
  45674. ) {
  45675. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45676. }
  45677. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45678. target.length = Math.max(target.length, key);
  45679. target.splice(key, 1, val);
  45680. return val
  45681. }
  45682. if (key in target && !(key in Object.prototype)) {
  45683. target[key] = val;
  45684. return val
  45685. }
  45686. var ob = (target).__ob__;
  45687. if (target._isVue || (ob && ob.vmCount)) {
  45688. warn(
  45689. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45690. 'at runtime - declare it upfront in the data option.'
  45691. );
  45692. return val
  45693. }
  45694. if (!ob) {
  45695. target[key] = val;
  45696. return val
  45697. }
  45698. defineReactive$$1(ob.value, key, val);
  45699. ob.dep.notify();
  45700. return val
  45701. }
  45702. /**
  45703. * Delete a property and trigger change if necessary.
  45704. */
  45705. function del (target, key) {
  45706. if (isUndef(target) || isPrimitive(target)
  45707. ) {
  45708. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45709. }
  45710. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45711. target.splice(key, 1);
  45712. return
  45713. }
  45714. var ob = (target).__ob__;
  45715. if (target._isVue || (ob && ob.vmCount)) {
  45716. warn(
  45717. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45718. '- just set it to null.'
  45719. );
  45720. return
  45721. }
  45722. if (!hasOwn(target, key)) {
  45723. return
  45724. }
  45725. delete target[key];
  45726. if (!ob) {
  45727. return
  45728. }
  45729. ob.dep.notify();
  45730. }
  45731. /**
  45732. * Collect dependencies on array elements when the array is touched, since
  45733. * we cannot intercept array element access like property getters.
  45734. */
  45735. function dependArray (value) {
  45736. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45737. e = value[i];
  45738. e && e.__ob__ && e.__ob__.dep.depend();
  45739. if (Array.isArray(e)) {
  45740. dependArray(e);
  45741. }
  45742. }
  45743. }
  45744. /* */
  45745. /**
  45746. * Option overwriting strategies are functions that handle
  45747. * how to merge a parent option value and a child option
  45748. * value into the final value.
  45749. */
  45750. var strats = config.optionMergeStrategies;
  45751. /**
  45752. * Options with restrictions
  45753. */
  45754. {
  45755. strats.el = strats.propsData = function (parent, child, vm, key) {
  45756. if (!vm) {
  45757. warn(
  45758. "option \"" + key + "\" can only be used during instance " +
  45759. 'creation with the `new` keyword.'
  45760. );
  45761. }
  45762. return defaultStrat(parent, child)
  45763. };
  45764. }
  45765. /**
  45766. * Helper that recursively merges two data objects together.
  45767. */
  45768. function mergeData (to, from) {
  45769. if (!from) { return to }
  45770. var key, toVal, fromVal;
  45771. var keys = hasSymbol
  45772. ? Reflect.ownKeys(from)
  45773. : Object.keys(from);
  45774. for (var i = 0; i < keys.length; i++) {
  45775. key = keys[i];
  45776. // in case the object is already observed...
  45777. if (key === '__ob__') { continue }
  45778. toVal = to[key];
  45779. fromVal = from[key];
  45780. if (!hasOwn(to, key)) {
  45781. set(to, key, fromVal);
  45782. } else if (
  45783. toVal !== fromVal &&
  45784. isPlainObject(toVal) &&
  45785. isPlainObject(fromVal)
  45786. ) {
  45787. mergeData(toVal, fromVal);
  45788. }
  45789. }
  45790. return to
  45791. }
  45792. /**
  45793. * Data
  45794. */
  45795. function mergeDataOrFn (
  45796. parentVal,
  45797. childVal,
  45798. vm
  45799. ) {
  45800. if (!vm) {
  45801. // in a Vue.extend merge, both should be functions
  45802. if (!childVal) {
  45803. return parentVal
  45804. }
  45805. if (!parentVal) {
  45806. return childVal
  45807. }
  45808. // when parentVal & childVal are both present,
  45809. // we need to return a function that returns the
  45810. // merged result of both functions... no need to
  45811. // check if parentVal is a function here because
  45812. // it has to be a function to pass previous merges.
  45813. return function mergedDataFn () {
  45814. return mergeData(
  45815. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45816. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45817. )
  45818. }
  45819. } else {
  45820. return function mergedInstanceDataFn () {
  45821. // instance merge
  45822. var instanceData = typeof childVal === 'function'
  45823. ? childVal.call(vm, vm)
  45824. : childVal;
  45825. var defaultData = typeof parentVal === 'function'
  45826. ? parentVal.call(vm, vm)
  45827. : parentVal;
  45828. if (instanceData) {
  45829. return mergeData(instanceData, defaultData)
  45830. } else {
  45831. return defaultData
  45832. }
  45833. }
  45834. }
  45835. }
  45836. strats.data = function (
  45837. parentVal,
  45838. childVal,
  45839. vm
  45840. ) {
  45841. if (!vm) {
  45842. if (childVal && typeof childVal !== 'function') {
  45843. warn(
  45844. 'The "data" option should be a function ' +
  45845. 'that returns a per-instance value in component ' +
  45846. 'definitions.',
  45847. vm
  45848. );
  45849. return parentVal
  45850. }
  45851. return mergeDataOrFn(parentVal, childVal)
  45852. }
  45853. return mergeDataOrFn(parentVal, childVal, vm)
  45854. };
  45855. /**
  45856. * Hooks and props are merged as arrays.
  45857. */
  45858. function mergeHook (
  45859. parentVal,
  45860. childVal
  45861. ) {
  45862. var res = childVal
  45863. ? parentVal
  45864. ? parentVal.concat(childVal)
  45865. : Array.isArray(childVal)
  45866. ? childVal
  45867. : [childVal]
  45868. : parentVal;
  45869. return res
  45870. ? dedupeHooks(res)
  45871. : res
  45872. }
  45873. function dedupeHooks (hooks) {
  45874. var res = [];
  45875. for (var i = 0; i < hooks.length; i++) {
  45876. if (res.indexOf(hooks[i]) === -1) {
  45877. res.push(hooks[i]);
  45878. }
  45879. }
  45880. return res
  45881. }
  45882. LIFECYCLE_HOOKS.forEach(function (hook) {
  45883. strats[hook] = mergeHook;
  45884. });
  45885. /**
  45886. * Assets
  45887. *
  45888. * When a vm is present (instance creation), we need to do
  45889. * a three-way merge between constructor options, instance
  45890. * options and parent options.
  45891. */
  45892. function mergeAssets (
  45893. parentVal,
  45894. childVal,
  45895. vm,
  45896. key
  45897. ) {
  45898. var res = Object.create(parentVal || null);
  45899. if (childVal) {
  45900. assertObjectType(key, childVal, vm);
  45901. return extend(res, childVal)
  45902. } else {
  45903. return res
  45904. }
  45905. }
  45906. ASSET_TYPES.forEach(function (type) {
  45907. strats[type + 's'] = mergeAssets;
  45908. });
  45909. /**
  45910. * Watchers.
  45911. *
  45912. * Watchers hashes should not overwrite one
  45913. * another, so we merge them as arrays.
  45914. */
  45915. strats.watch = function (
  45916. parentVal,
  45917. childVal,
  45918. vm,
  45919. key
  45920. ) {
  45921. // work around Firefox's Object.prototype.watch...
  45922. if (parentVal === nativeWatch) { parentVal = undefined; }
  45923. if (childVal === nativeWatch) { childVal = undefined; }
  45924. /* istanbul ignore if */
  45925. if (!childVal) { return Object.create(parentVal || null) }
  45926. {
  45927. assertObjectType(key, childVal, vm);
  45928. }
  45929. if (!parentVal) { return childVal }
  45930. var ret = {};
  45931. extend(ret, parentVal);
  45932. for (var key$1 in childVal) {
  45933. var parent = ret[key$1];
  45934. var child = childVal[key$1];
  45935. if (parent && !Array.isArray(parent)) {
  45936. parent = [parent];
  45937. }
  45938. ret[key$1] = parent
  45939. ? parent.concat(child)
  45940. : Array.isArray(child) ? child : [child];
  45941. }
  45942. return ret
  45943. };
  45944. /**
  45945. * Other object hashes.
  45946. */
  45947. strats.props =
  45948. strats.methods =
  45949. strats.inject =
  45950. strats.computed = function (
  45951. parentVal,
  45952. childVal,
  45953. vm,
  45954. key
  45955. ) {
  45956. if (childVal && "development" !== 'production') {
  45957. assertObjectType(key, childVal, vm);
  45958. }
  45959. if (!parentVal) { return childVal }
  45960. var ret = Object.create(null);
  45961. extend(ret, parentVal);
  45962. if (childVal) { extend(ret, childVal); }
  45963. return ret
  45964. };
  45965. strats.provide = mergeDataOrFn;
  45966. /**
  45967. * Default strategy.
  45968. */
  45969. var defaultStrat = function (parentVal, childVal) {
  45970. return childVal === undefined
  45971. ? parentVal
  45972. : childVal
  45973. };
  45974. /**
  45975. * Validate component names
  45976. */
  45977. function checkComponents (options) {
  45978. for (var key in options.components) {
  45979. validateComponentName(key);
  45980. }
  45981. }
  45982. function validateComponentName (name) {
  45983. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45984. warn(
  45985. 'Invalid component name: "' + name + '". Component names ' +
  45986. 'should conform to valid custom element name in html5 specification.'
  45987. );
  45988. }
  45989. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45990. warn(
  45991. 'Do not use built-in or reserved HTML elements as component ' +
  45992. 'id: ' + name
  45993. );
  45994. }
  45995. }
  45996. /**
  45997. * Ensure all props option syntax are normalized into the
  45998. * Object-based format.
  45999. */
  46000. function normalizeProps (options, vm) {
  46001. var props = options.props;
  46002. if (!props) { return }
  46003. var res = {};
  46004. var i, val, name;
  46005. if (Array.isArray(props)) {
  46006. i = props.length;
  46007. while (i--) {
  46008. val = props[i];
  46009. if (typeof val === 'string') {
  46010. name = camelize(val);
  46011. res[name] = { type: null };
  46012. } else {
  46013. warn('props must be strings when using array syntax.');
  46014. }
  46015. }
  46016. } else if (isPlainObject(props)) {
  46017. for (var key in props) {
  46018. val = props[key];
  46019. name = camelize(key);
  46020. res[name] = isPlainObject(val)
  46021. ? val
  46022. : { type: val };
  46023. }
  46024. } else {
  46025. warn(
  46026. "Invalid value for option \"props\": expected an Array or an Object, " +
  46027. "but got " + (toRawType(props)) + ".",
  46028. vm
  46029. );
  46030. }
  46031. options.props = res;
  46032. }
  46033. /**
  46034. * Normalize all injections into Object-based format
  46035. */
  46036. function normalizeInject (options, vm) {
  46037. var inject = options.inject;
  46038. if (!inject) { return }
  46039. var normalized = options.inject = {};
  46040. if (Array.isArray(inject)) {
  46041. for (var i = 0; i < inject.length; i++) {
  46042. normalized[inject[i]] = { from: inject[i] };
  46043. }
  46044. } else if (isPlainObject(inject)) {
  46045. for (var key in inject) {
  46046. var val = inject[key];
  46047. normalized[key] = isPlainObject(val)
  46048. ? extend({ from: key }, val)
  46049. : { from: val };
  46050. }
  46051. } else {
  46052. warn(
  46053. "Invalid value for option \"inject\": expected an Array or an Object, " +
  46054. "but got " + (toRawType(inject)) + ".",
  46055. vm
  46056. );
  46057. }
  46058. }
  46059. /**
  46060. * Normalize raw function directives into object format.
  46061. */
  46062. function normalizeDirectives (options) {
  46063. var dirs = options.directives;
  46064. if (dirs) {
  46065. for (var key in dirs) {
  46066. var def$$1 = dirs[key];
  46067. if (typeof def$$1 === 'function') {
  46068. dirs[key] = { bind: def$$1, update: def$$1 };
  46069. }
  46070. }
  46071. }
  46072. }
  46073. function assertObjectType (name, value, vm) {
  46074. if (!isPlainObject(value)) {
  46075. warn(
  46076. "Invalid value for option \"" + name + "\": expected an Object, " +
  46077. "but got " + (toRawType(value)) + ".",
  46078. vm
  46079. );
  46080. }
  46081. }
  46082. /**
  46083. * Merge two option objects into a new one.
  46084. * Core utility used in both instantiation and inheritance.
  46085. */
  46086. function mergeOptions (
  46087. parent,
  46088. child,
  46089. vm
  46090. ) {
  46091. {
  46092. checkComponents(child);
  46093. }
  46094. if (typeof child === 'function') {
  46095. child = child.options;
  46096. }
  46097. normalizeProps(child, vm);
  46098. normalizeInject(child, vm);
  46099. normalizeDirectives(child);
  46100. // Apply extends and mixins on the child options,
  46101. // but only if it is a raw options object that isn't
  46102. // the result of another mergeOptions call.
  46103. // Only merged options has the _base property.
  46104. if (!child._base) {
  46105. if (child.extends) {
  46106. parent = mergeOptions(parent, child.extends, vm);
  46107. }
  46108. if (child.mixins) {
  46109. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46110. parent = mergeOptions(parent, child.mixins[i], vm);
  46111. }
  46112. }
  46113. }
  46114. var options = {};
  46115. var key;
  46116. for (key in parent) {
  46117. mergeField(key);
  46118. }
  46119. for (key in child) {
  46120. if (!hasOwn(parent, key)) {
  46121. mergeField(key);
  46122. }
  46123. }
  46124. function mergeField (key) {
  46125. var strat = strats[key] || defaultStrat;
  46126. options[key] = strat(parent[key], child[key], vm, key);
  46127. }
  46128. return options
  46129. }
  46130. /**
  46131. * Resolve an asset.
  46132. * This function is used because child instances need access
  46133. * to assets defined in its ancestor chain.
  46134. */
  46135. function resolveAsset (
  46136. options,
  46137. type,
  46138. id,
  46139. warnMissing
  46140. ) {
  46141. /* istanbul ignore if */
  46142. if (typeof id !== 'string') {
  46143. return
  46144. }
  46145. var assets = options[type];
  46146. // check local registration variations first
  46147. if (hasOwn(assets, id)) { return assets[id] }
  46148. var camelizedId = camelize(id);
  46149. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46150. var PascalCaseId = capitalize(camelizedId);
  46151. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46152. // fallback to prototype chain
  46153. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46154. if (warnMissing && !res) {
  46155. warn(
  46156. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46157. options
  46158. );
  46159. }
  46160. return res
  46161. }
  46162. /* */
  46163. function validateProp (
  46164. key,
  46165. propOptions,
  46166. propsData,
  46167. vm
  46168. ) {
  46169. var prop = propOptions[key];
  46170. var absent = !hasOwn(propsData, key);
  46171. var value = propsData[key];
  46172. // boolean casting
  46173. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46174. if (booleanIndex > -1) {
  46175. if (absent && !hasOwn(prop, 'default')) {
  46176. value = false;
  46177. } else if (value === '' || value === hyphenate(key)) {
  46178. // only cast empty string / same name to boolean if
  46179. // boolean has higher priority
  46180. var stringIndex = getTypeIndex(String, prop.type);
  46181. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46182. value = true;
  46183. }
  46184. }
  46185. }
  46186. // check default value
  46187. if (value === undefined) {
  46188. value = getPropDefaultValue(vm, prop, key);
  46189. // since the default value is a fresh copy,
  46190. // make sure to observe it.
  46191. var prevShouldObserve = shouldObserve;
  46192. toggleObserving(true);
  46193. observe(value);
  46194. toggleObserving(prevShouldObserve);
  46195. }
  46196. {
  46197. assertProp(prop, key, value, vm, absent);
  46198. }
  46199. return value
  46200. }
  46201. /**
  46202. * Get the default value of a prop.
  46203. */
  46204. function getPropDefaultValue (vm, prop, key) {
  46205. // no default, return undefined
  46206. if (!hasOwn(prop, 'default')) {
  46207. return undefined
  46208. }
  46209. var def = prop.default;
  46210. // warn against non-factory defaults for Object & Array
  46211. if (isObject(def)) {
  46212. warn(
  46213. 'Invalid default value for prop "' + key + '": ' +
  46214. 'Props with type Object/Array must use a factory function ' +
  46215. 'to return the default value.',
  46216. vm
  46217. );
  46218. }
  46219. // the raw prop value was also undefined from previous render,
  46220. // return previous default value to avoid unnecessary watcher trigger
  46221. if (vm && vm.$options.propsData &&
  46222. vm.$options.propsData[key] === undefined &&
  46223. vm._props[key] !== undefined
  46224. ) {
  46225. return vm._props[key]
  46226. }
  46227. // call factory function for non-Function types
  46228. // a value is Function if its prototype is function even across different execution context
  46229. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46230. ? def.call(vm)
  46231. : def
  46232. }
  46233. /**
  46234. * Assert whether a prop is valid.
  46235. */
  46236. function assertProp (
  46237. prop,
  46238. name,
  46239. value,
  46240. vm,
  46241. absent
  46242. ) {
  46243. if (prop.required && absent) {
  46244. warn(
  46245. 'Missing required prop: "' + name + '"',
  46246. vm
  46247. );
  46248. return
  46249. }
  46250. if (value == null && !prop.required) {
  46251. return
  46252. }
  46253. var type = prop.type;
  46254. var valid = !type || type === true;
  46255. var expectedTypes = [];
  46256. if (type) {
  46257. if (!Array.isArray(type)) {
  46258. type = [type];
  46259. }
  46260. for (var i = 0; i < type.length && !valid; i++) {
  46261. var assertedType = assertType(value, type[i]);
  46262. expectedTypes.push(assertedType.expectedType || '');
  46263. valid = assertedType.valid;
  46264. }
  46265. }
  46266. if (!valid) {
  46267. warn(
  46268. getInvalidTypeMessage(name, value, expectedTypes),
  46269. vm
  46270. );
  46271. return
  46272. }
  46273. var validator = prop.validator;
  46274. if (validator) {
  46275. if (!validator(value)) {
  46276. warn(
  46277. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46278. vm
  46279. );
  46280. }
  46281. }
  46282. }
  46283. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46284. function assertType (value, type) {
  46285. var valid;
  46286. var expectedType = getType(type);
  46287. if (simpleCheckRE.test(expectedType)) {
  46288. var t = typeof value;
  46289. valid = t === expectedType.toLowerCase();
  46290. // for primitive wrapper objects
  46291. if (!valid && t === 'object') {
  46292. valid = value instanceof type;
  46293. }
  46294. } else if (expectedType === 'Object') {
  46295. valid = isPlainObject(value);
  46296. } else if (expectedType === 'Array') {
  46297. valid = Array.isArray(value);
  46298. } else {
  46299. valid = value instanceof type;
  46300. }
  46301. return {
  46302. valid: valid,
  46303. expectedType: expectedType
  46304. }
  46305. }
  46306. /**
  46307. * Use function string name to check built-in types,
  46308. * because a simple equality check will fail when running
  46309. * across different vms / iframes.
  46310. */
  46311. function getType (fn) {
  46312. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46313. return match ? match[1] : ''
  46314. }
  46315. function isSameType (a, b) {
  46316. return getType(a) === getType(b)
  46317. }
  46318. function getTypeIndex (type, expectedTypes) {
  46319. if (!Array.isArray(expectedTypes)) {
  46320. return isSameType(expectedTypes, type) ? 0 : -1
  46321. }
  46322. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46323. if (isSameType(expectedTypes[i], type)) {
  46324. return i
  46325. }
  46326. }
  46327. return -1
  46328. }
  46329. function getInvalidTypeMessage (name, value, expectedTypes) {
  46330. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46331. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46332. var expectedType = expectedTypes[0];
  46333. var receivedType = toRawType(value);
  46334. var expectedValue = styleValue(value, expectedType);
  46335. var receivedValue = styleValue(value, receivedType);
  46336. // check if we need to specify expected value
  46337. if (expectedTypes.length === 1 &&
  46338. isExplicable(expectedType) &&
  46339. !isBoolean(expectedType, receivedType)) {
  46340. message += " with value " + expectedValue;
  46341. }
  46342. message += ", got " + receivedType + " ";
  46343. // check if we need to specify received value
  46344. if (isExplicable(receivedType)) {
  46345. message += "with value " + receivedValue + ".";
  46346. }
  46347. return message
  46348. }
  46349. function styleValue (value, type) {
  46350. if (type === 'String') {
  46351. return ("\"" + value + "\"")
  46352. } else if (type === 'Number') {
  46353. return ("" + (Number(value)))
  46354. } else {
  46355. return ("" + value)
  46356. }
  46357. }
  46358. function isExplicable (value) {
  46359. var explicitTypes = ['string', 'number', 'boolean'];
  46360. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46361. }
  46362. function isBoolean () {
  46363. var args = [], len = arguments.length;
  46364. while ( len-- ) args[ len ] = arguments[ len ];
  46365. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46366. }
  46367. /* */
  46368. function handleError (err, vm, info) {
  46369. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46370. // See: https://github.com/vuejs/vuex/issues/1505
  46371. pushTarget();
  46372. try {
  46373. if (vm) {
  46374. var cur = vm;
  46375. while ((cur = cur.$parent)) {
  46376. var hooks = cur.$options.errorCaptured;
  46377. if (hooks) {
  46378. for (var i = 0; i < hooks.length; i++) {
  46379. try {
  46380. var capture = hooks[i].call(cur, err, vm, info) === false;
  46381. if (capture) { return }
  46382. } catch (e) {
  46383. globalHandleError(e, cur, 'errorCaptured hook');
  46384. }
  46385. }
  46386. }
  46387. }
  46388. }
  46389. globalHandleError(err, vm, info);
  46390. } finally {
  46391. popTarget();
  46392. }
  46393. }
  46394. function invokeWithErrorHandling (
  46395. handler,
  46396. context,
  46397. args,
  46398. vm,
  46399. info
  46400. ) {
  46401. var res;
  46402. try {
  46403. res = args ? handler.apply(context, args) : handler.call(context);
  46404. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46405. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46406. // issue #9511
  46407. // avoid catch triggering multiple times when nested calls
  46408. res._handled = true;
  46409. }
  46410. } catch (e) {
  46411. handleError(e, vm, info);
  46412. }
  46413. return res
  46414. }
  46415. function globalHandleError (err, vm, info) {
  46416. if (config.errorHandler) {
  46417. try {
  46418. return config.errorHandler.call(null, err, vm, info)
  46419. } catch (e) {
  46420. // if the user intentionally throws the original error in the handler,
  46421. // do not log it twice
  46422. if (e !== err) {
  46423. logError(e, null, 'config.errorHandler');
  46424. }
  46425. }
  46426. }
  46427. logError(err, vm, info);
  46428. }
  46429. function logError (err, vm, info) {
  46430. {
  46431. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46432. }
  46433. /* istanbul ignore else */
  46434. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46435. console.error(err);
  46436. } else {
  46437. throw err
  46438. }
  46439. }
  46440. /* */
  46441. var isUsingMicroTask = false;
  46442. var callbacks = [];
  46443. var pending = false;
  46444. function flushCallbacks () {
  46445. pending = false;
  46446. var copies = callbacks.slice(0);
  46447. callbacks.length = 0;
  46448. for (var i = 0; i < copies.length; i++) {
  46449. copies[i]();
  46450. }
  46451. }
  46452. // Here we have async deferring wrappers using microtasks.
  46453. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46454. // However, it has subtle problems when state is changed right before repaint
  46455. // (e.g. #6813, out-in transitions).
  46456. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46457. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46458. // So we now use microtasks everywhere, again.
  46459. // A major drawback of this tradeoff is that there are some scenarios
  46460. // where microtasks have too high a priority and fire in between supposedly
  46461. // sequential events (e.g. #4521, #6690, which have workarounds)
  46462. // or even between bubbling of the same event (#6566).
  46463. var timerFunc;
  46464. // The nextTick behavior leverages the microtask queue, which can be accessed
  46465. // via either native Promise.then or MutationObserver.
  46466. // MutationObserver has wider support, however it is seriously bugged in
  46467. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46468. // completely stops working after triggering a few times... so, if native
  46469. // Promise is available, we will use it:
  46470. /* istanbul ignore next, $flow-disable-line */
  46471. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46472. var p = Promise.resolve();
  46473. timerFunc = function () {
  46474. p.then(flushCallbacks);
  46475. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46476. // it can get stuck in a weird state where callbacks are pushed into the
  46477. // microtask queue but the queue isn't being flushed, until the browser
  46478. // needs to do some other work, e.g. handle a timer. Therefore we can
  46479. // "force" the microtask queue to be flushed by adding an empty timer.
  46480. if (isIOS) { setTimeout(noop); }
  46481. };
  46482. isUsingMicroTask = true;
  46483. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46484. isNative(MutationObserver) ||
  46485. // PhantomJS and iOS 7.x
  46486. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46487. )) {
  46488. // Use MutationObserver where native Promise is not available,
  46489. // e.g. PhantomJS, iOS7, Android 4.4
  46490. // (#6466 MutationObserver is unreliable in IE11)
  46491. var counter = 1;
  46492. var observer = new MutationObserver(flushCallbacks);
  46493. var textNode = document.createTextNode(String(counter));
  46494. observer.observe(textNode, {
  46495. characterData: true
  46496. });
  46497. timerFunc = function () {
  46498. counter = (counter + 1) % 2;
  46499. textNode.data = String(counter);
  46500. };
  46501. isUsingMicroTask = true;
  46502. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46503. // Fallback to setImmediate.
  46504. // Technically it leverages the (macro) task queue,
  46505. // but it is still a better choice than setTimeout.
  46506. timerFunc = function () {
  46507. setImmediate(flushCallbacks);
  46508. };
  46509. } else {
  46510. // Fallback to setTimeout.
  46511. timerFunc = function () {
  46512. setTimeout(flushCallbacks, 0);
  46513. };
  46514. }
  46515. function nextTick (cb, ctx) {
  46516. var _resolve;
  46517. callbacks.push(function () {
  46518. if (cb) {
  46519. try {
  46520. cb.call(ctx);
  46521. } catch (e) {
  46522. handleError(e, ctx, 'nextTick');
  46523. }
  46524. } else if (_resolve) {
  46525. _resolve(ctx);
  46526. }
  46527. });
  46528. if (!pending) {
  46529. pending = true;
  46530. timerFunc();
  46531. }
  46532. // $flow-disable-line
  46533. if (!cb && typeof Promise !== 'undefined') {
  46534. return new Promise(function (resolve) {
  46535. _resolve = resolve;
  46536. })
  46537. }
  46538. }
  46539. /* */
  46540. var mark;
  46541. var measure;
  46542. {
  46543. var perf = inBrowser && window.performance;
  46544. /* istanbul ignore if */
  46545. if (
  46546. perf &&
  46547. perf.mark &&
  46548. perf.measure &&
  46549. perf.clearMarks &&
  46550. perf.clearMeasures
  46551. ) {
  46552. mark = function (tag) { return perf.mark(tag); };
  46553. measure = function (name, startTag, endTag) {
  46554. perf.measure(name, startTag, endTag);
  46555. perf.clearMarks(startTag);
  46556. perf.clearMarks(endTag);
  46557. // perf.clearMeasures(name)
  46558. };
  46559. }
  46560. }
  46561. /* not type checking this file because flow doesn't play well with Proxy */
  46562. var initProxy;
  46563. {
  46564. var allowedGlobals = makeMap(
  46565. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46566. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46567. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46568. 'require' // for Webpack/Browserify
  46569. );
  46570. var warnNonPresent = function (target, key) {
  46571. warn(
  46572. "Property or method \"" + key + "\" is not defined on the instance but " +
  46573. 'referenced during render. Make sure that this property is reactive, ' +
  46574. 'either in the data option, or for class-based components, by ' +
  46575. 'initializing the property. ' +
  46576. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46577. target
  46578. );
  46579. };
  46580. var warnReservedPrefix = function (target, key) {
  46581. warn(
  46582. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46583. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46584. 'prevent conflicts with Vue internals. ' +
  46585. 'See: https://vuejs.org/v2/api/#data',
  46586. target
  46587. );
  46588. };
  46589. var hasProxy =
  46590. typeof Proxy !== 'undefined' && isNative(Proxy);
  46591. if (hasProxy) {
  46592. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46593. config.keyCodes = new Proxy(config.keyCodes, {
  46594. set: function set (target, key, value) {
  46595. if (isBuiltInModifier(key)) {
  46596. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46597. return false
  46598. } else {
  46599. target[key] = value;
  46600. return true
  46601. }
  46602. }
  46603. });
  46604. }
  46605. var hasHandler = {
  46606. has: function has (target, key) {
  46607. var has = key in target;
  46608. var isAllowed = allowedGlobals(key) ||
  46609. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46610. if (!has && !isAllowed) {
  46611. if (key in target.$data) { warnReservedPrefix(target, key); }
  46612. else { warnNonPresent(target, key); }
  46613. }
  46614. return has || !isAllowed
  46615. }
  46616. };
  46617. var getHandler = {
  46618. get: function get (target, key) {
  46619. if (typeof key === 'string' && !(key in target)) {
  46620. if (key in target.$data) { warnReservedPrefix(target, key); }
  46621. else { warnNonPresent(target, key); }
  46622. }
  46623. return target[key]
  46624. }
  46625. };
  46626. initProxy = function initProxy (vm) {
  46627. if (hasProxy) {
  46628. // determine which proxy handler to use
  46629. var options = vm.$options;
  46630. var handlers = options.render && options.render._withStripped
  46631. ? getHandler
  46632. : hasHandler;
  46633. vm._renderProxy = new Proxy(vm, handlers);
  46634. } else {
  46635. vm._renderProxy = vm;
  46636. }
  46637. };
  46638. }
  46639. /* */
  46640. var seenObjects = new _Set();
  46641. /**
  46642. * Recursively traverse an object to evoke all converted
  46643. * getters, so that every nested property inside the object
  46644. * is collected as a "deep" dependency.
  46645. */
  46646. function traverse (val) {
  46647. _traverse(val, seenObjects);
  46648. seenObjects.clear();
  46649. }
  46650. function _traverse (val, seen) {
  46651. var i, keys;
  46652. var isA = Array.isArray(val);
  46653. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46654. return
  46655. }
  46656. if (val.__ob__) {
  46657. var depId = val.__ob__.dep.id;
  46658. if (seen.has(depId)) {
  46659. return
  46660. }
  46661. seen.add(depId);
  46662. }
  46663. if (isA) {
  46664. i = val.length;
  46665. while (i--) { _traverse(val[i], seen); }
  46666. } else {
  46667. keys = Object.keys(val);
  46668. i = keys.length;
  46669. while (i--) { _traverse(val[keys[i]], seen); }
  46670. }
  46671. }
  46672. /* */
  46673. var normalizeEvent = cached(function (name) {
  46674. var passive = name.charAt(0) === '&';
  46675. name = passive ? name.slice(1) : name;
  46676. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46677. name = once$$1 ? name.slice(1) : name;
  46678. var capture = name.charAt(0) === '!';
  46679. name = capture ? name.slice(1) : name;
  46680. return {
  46681. name: name,
  46682. once: once$$1,
  46683. capture: capture,
  46684. passive: passive
  46685. }
  46686. });
  46687. function createFnInvoker (fns, vm) {
  46688. function invoker () {
  46689. var arguments$1 = arguments;
  46690. var fns = invoker.fns;
  46691. if (Array.isArray(fns)) {
  46692. var cloned = fns.slice();
  46693. for (var i = 0; i < cloned.length; i++) {
  46694. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46695. }
  46696. } else {
  46697. // return handler return value for single handlers
  46698. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46699. }
  46700. }
  46701. invoker.fns = fns;
  46702. return invoker
  46703. }
  46704. function updateListeners (
  46705. on,
  46706. oldOn,
  46707. add,
  46708. remove$$1,
  46709. createOnceHandler,
  46710. vm
  46711. ) {
  46712. var name, def$$1, cur, old, event;
  46713. for (name in on) {
  46714. def$$1 = cur = on[name];
  46715. old = oldOn[name];
  46716. event = normalizeEvent(name);
  46717. if (isUndef(cur)) {
  46718. warn(
  46719. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46720. vm
  46721. );
  46722. } else if (isUndef(old)) {
  46723. if (isUndef(cur.fns)) {
  46724. cur = on[name] = createFnInvoker(cur, vm);
  46725. }
  46726. if (isTrue(event.once)) {
  46727. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46728. }
  46729. add(event.name, cur, event.capture, event.passive, event.params);
  46730. } else if (cur !== old) {
  46731. old.fns = cur;
  46732. on[name] = old;
  46733. }
  46734. }
  46735. for (name in oldOn) {
  46736. if (isUndef(on[name])) {
  46737. event = normalizeEvent(name);
  46738. remove$$1(event.name, oldOn[name], event.capture);
  46739. }
  46740. }
  46741. }
  46742. /* */
  46743. function mergeVNodeHook (def, hookKey, hook) {
  46744. if (def instanceof VNode) {
  46745. def = def.data.hook || (def.data.hook = {});
  46746. }
  46747. var invoker;
  46748. var oldHook = def[hookKey];
  46749. function wrappedHook () {
  46750. hook.apply(this, arguments);
  46751. // important: remove merged hook to ensure it's called only once
  46752. // and prevent memory leak
  46753. remove(invoker.fns, wrappedHook);
  46754. }
  46755. if (isUndef(oldHook)) {
  46756. // no existing hook
  46757. invoker = createFnInvoker([wrappedHook]);
  46758. } else {
  46759. /* istanbul ignore if */
  46760. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46761. // already a merged invoker
  46762. invoker = oldHook;
  46763. invoker.fns.push(wrappedHook);
  46764. } else {
  46765. // existing plain hook
  46766. invoker = createFnInvoker([oldHook, wrappedHook]);
  46767. }
  46768. }
  46769. invoker.merged = true;
  46770. def[hookKey] = invoker;
  46771. }
  46772. /* */
  46773. function extractPropsFromVNodeData (
  46774. data,
  46775. Ctor,
  46776. tag
  46777. ) {
  46778. // we are only extracting raw values here.
  46779. // validation and default values are handled in the child
  46780. // component itself.
  46781. var propOptions = Ctor.options.props;
  46782. if (isUndef(propOptions)) {
  46783. return
  46784. }
  46785. var res = {};
  46786. var attrs = data.attrs;
  46787. var props = data.props;
  46788. if (isDef(attrs) || isDef(props)) {
  46789. for (var key in propOptions) {
  46790. var altKey = hyphenate(key);
  46791. {
  46792. var keyInLowerCase = key.toLowerCase();
  46793. if (
  46794. key !== keyInLowerCase &&
  46795. attrs && hasOwn(attrs, keyInLowerCase)
  46796. ) {
  46797. tip(
  46798. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46799. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46800. " \"" + key + "\". " +
  46801. "Note that HTML attributes are case-insensitive and camelCased " +
  46802. "props need to use their kebab-case equivalents when using in-DOM " +
  46803. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46804. );
  46805. }
  46806. }
  46807. checkProp(res, props, key, altKey, true) ||
  46808. checkProp(res, attrs, key, altKey, false);
  46809. }
  46810. }
  46811. return res
  46812. }
  46813. function checkProp (
  46814. res,
  46815. hash,
  46816. key,
  46817. altKey,
  46818. preserve
  46819. ) {
  46820. if (isDef(hash)) {
  46821. if (hasOwn(hash, key)) {
  46822. res[key] = hash[key];
  46823. if (!preserve) {
  46824. delete hash[key];
  46825. }
  46826. return true
  46827. } else if (hasOwn(hash, altKey)) {
  46828. res[key] = hash[altKey];
  46829. if (!preserve) {
  46830. delete hash[altKey];
  46831. }
  46832. return true
  46833. }
  46834. }
  46835. return false
  46836. }
  46837. /* */
  46838. // The template compiler attempts to minimize the need for normalization by
  46839. // statically analyzing the template at compile time.
  46840. //
  46841. // For plain HTML markup, normalization can be completely skipped because the
  46842. // generated render function is guaranteed to return Array<VNode>. There are
  46843. // two cases where extra normalization is needed:
  46844. // 1. When the children contains components - because a functional component
  46845. // may return an Array instead of a single root. In this case, just a simple
  46846. // normalization is needed - if any child is an Array, we flatten the whole
  46847. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46848. // because functional components already normalize their own children.
  46849. function simpleNormalizeChildren (children) {
  46850. for (var i = 0; i < children.length; i++) {
  46851. if (Array.isArray(children[i])) {
  46852. return Array.prototype.concat.apply([], children)
  46853. }
  46854. }
  46855. return children
  46856. }
  46857. // 2. When the children contains constructs that always generated nested Arrays,
  46858. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46859. // with hand-written render functions / JSX. In such cases a full normalization
  46860. // is needed to cater to all possible types of children values.
  46861. function normalizeChildren (children) {
  46862. return isPrimitive(children)
  46863. ? [createTextVNode(children)]
  46864. : Array.isArray(children)
  46865. ? normalizeArrayChildren(children)
  46866. : undefined
  46867. }
  46868. function isTextNode (node) {
  46869. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46870. }
  46871. function normalizeArrayChildren (children, nestedIndex) {
  46872. var res = [];
  46873. var i, c, lastIndex, last;
  46874. for (i = 0; i < children.length; i++) {
  46875. c = children[i];
  46876. if (isUndef(c) || typeof c === 'boolean') { continue }
  46877. lastIndex = res.length - 1;
  46878. last = res[lastIndex];
  46879. // nested
  46880. if (Array.isArray(c)) {
  46881. if (c.length > 0) {
  46882. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46883. // merge adjacent text nodes
  46884. if (isTextNode(c[0]) && isTextNode(last)) {
  46885. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46886. c.shift();
  46887. }
  46888. res.push.apply(res, c);
  46889. }
  46890. } else if (isPrimitive(c)) {
  46891. if (isTextNode(last)) {
  46892. // merge adjacent text nodes
  46893. // this is necessary for SSR hydration because text nodes are
  46894. // essentially merged when rendered to HTML strings
  46895. res[lastIndex] = createTextVNode(last.text + c);
  46896. } else if (c !== '') {
  46897. // convert primitive to vnode
  46898. res.push(createTextVNode(c));
  46899. }
  46900. } else {
  46901. if (isTextNode(c) && isTextNode(last)) {
  46902. // merge adjacent text nodes
  46903. res[lastIndex] = createTextVNode(last.text + c.text);
  46904. } else {
  46905. // default key for nested array children (likely generated by v-for)
  46906. if (isTrue(children._isVList) &&
  46907. isDef(c.tag) &&
  46908. isUndef(c.key) &&
  46909. isDef(nestedIndex)) {
  46910. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46911. }
  46912. res.push(c);
  46913. }
  46914. }
  46915. }
  46916. return res
  46917. }
  46918. /* */
  46919. function initProvide (vm) {
  46920. var provide = vm.$options.provide;
  46921. if (provide) {
  46922. vm._provided = typeof provide === 'function'
  46923. ? provide.call(vm)
  46924. : provide;
  46925. }
  46926. }
  46927. function initInjections (vm) {
  46928. var result = resolveInject(vm.$options.inject, vm);
  46929. if (result) {
  46930. toggleObserving(false);
  46931. Object.keys(result).forEach(function (key) {
  46932. /* istanbul ignore else */
  46933. {
  46934. defineReactive$$1(vm, key, result[key], function () {
  46935. warn(
  46936. "Avoid mutating an injected value directly since the changes will be " +
  46937. "overwritten whenever the provided component re-renders. " +
  46938. "injection being mutated: \"" + key + "\"",
  46939. vm
  46940. );
  46941. });
  46942. }
  46943. });
  46944. toggleObserving(true);
  46945. }
  46946. }
  46947. function resolveInject (inject, vm) {
  46948. if (inject) {
  46949. // inject is :any because flow is not smart enough to figure out cached
  46950. var result = Object.create(null);
  46951. var keys = hasSymbol
  46952. ? Reflect.ownKeys(inject)
  46953. : Object.keys(inject);
  46954. for (var i = 0; i < keys.length; i++) {
  46955. var key = keys[i];
  46956. // #6574 in case the inject object is observed...
  46957. if (key === '__ob__') { continue }
  46958. var provideKey = inject[key].from;
  46959. var source = vm;
  46960. while (source) {
  46961. if (source._provided && hasOwn(source._provided, provideKey)) {
  46962. result[key] = source._provided[provideKey];
  46963. break
  46964. }
  46965. source = source.$parent;
  46966. }
  46967. if (!source) {
  46968. if ('default' in inject[key]) {
  46969. var provideDefault = inject[key].default;
  46970. result[key] = typeof provideDefault === 'function'
  46971. ? provideDefault.call(vm)
  46972. : provideDefault;
  46973. } else {
  46974. warn(("Injection \"" + key + "\" not found"), vm);
  46975. }
  46976. }
  46977. }
  46978. return result
  46979. }
  46980. }
  46981. /* */
  46982. /**
  46983. * Runtime helper for resolving raw children VNodes into a slot object.
  46984. */
  46985. function resolveSlots (
  46986. children,
  46987. context
  46988. ) {
  46989. if (!children || !children.length) {
  46990. return {}
  46991. }
  46992. var slots = {};
  46993. for (var i = 0, l = children.length; i < l; i++) {
  46994. var child = children[i];
  46995. var data = child.data;
  46996. // remove slot attribute if the node is resolved as a Vue slot node
  46997. if (data && data.attrs && data.attrs.slot) {
  46998. delete data.attrs.slot;
  46999. }
  47000. // named slots should only be respected if the vnode was rendered in the
  47001. // same context.
  47002. if ((child.context === context || child.fnContext === context) &&
  47003. data && data.slot != null
  47004. ) {
  47005. var name = data.slot;
  47006. var slot = (slots[name] || (slots[name] = []));
  47007. if (child.tag === 'template') {
  47008. slot.push.apply(slot, child.children || []);
  47009. } else {
  47010. slot.push(child);
  47011. }
  47012. } else {
  47013. (slots.default || (slots.default = [])).push(child);
  47014. }
  47015. }
  47016. // ignore slots that contains only whitespace
  47017. for (var name$1 in slots) {
  47018. if (slots[name$1].every(isWhitespace)) {
  47019. delete slots[name$1];
  47020. }
  47021. }
  47022. return slots
  47023. }
  47024. function isWhitespace (node) {
  47025. return (node.isComment && !node.asyncFactory) || node.text === ' '
  47026. }
  47027. /* */
  47028. function normalizeScopedSlots (
  47029. slots,
  47030. normalSlots,
  47031. prevSlots
  47032. ) {
  47033. var res;
  47034. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  47035. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  47036. var key = slots && slots.$key;
  47037. if (!slots) {
  47038. res = {};
  47039. } else if (slots._normalized) {
  47040. // fast path 1: child component re-render only, parent did not change
  47041. return slots._normalized
  47042. } else if (
  47043. isStable &&
  47044. prevSlots &&
  47045. prevSlots !== emptyObject &&
  47046. key === prevSlots.$key &&
  47047. !hasNormalSlots &&
  47048. !prevSlots.$hasNormal
  47049. ) {
  47050. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  47051. // only need to normalize once
  47052. return prevSlots
  47053. } else {
  47054. res = {};
  47055. for (var key$1 in slots) {
  47056. if (slots[key$1] && key$1[0] !== '$') {
  47057. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  47058. }
  47059. }
  47060. }
  47061. // expose normal slots on scopedSlots
  47062. for (var key$2 in normalSlots) {
  47063. if (!(key$2 in res)) {
  47064. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  47065. }
  47066. }
  47067. // avoriaz seems to mock a non-extensible $scopedSlots object
  47068. // and when that is passed down this would cause an error
  47069. if (slots && Object.isExtensible(slots)) {
  47070. (slots)._normalized = res;
  47071. }
  47072. def(res, '$stable', isStable);
  47073. def(res, '$key', key);
  47074. def(res, '$hasNormal', hasNormalSlots);
  47075. return res
  47076. }
  47077. function normalizeScopedSlot(normalSlots, key, fn) {
  47078. var normalized = function () {
  47079. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47080. res = res && typeof res === 'object' && !Array.isArray(res)
  47081. ? [res] // single vnode
  47082. : normalizeChildren(res);
  47083. return res && (
  47084. res.length === 0 ||
  47085. (res.length === 1 && res[0].isComment) // #9658
  47086. ) ? undefined
  47087. : res
  47088. };
  47089. // this is a slot using the new v-slot syntax without scope. although it is
  47090. // compiled as a scoped slot, render fn users would expect it to be present
  47091. // on this.$slots because the usage is semantically a normal slot.
  47092. if (fn.proxy) {
  47093. Object.defineProperty(normalSlots, key, {
  47094. get: normalized,
  47095. enumerable: true,
  47096. configurable: true
  47097. });
  47098. }
  47099. return normalized
  47100. }
  47101. function proxyNormalSlot(slots, key) {
  47102. return function () { return slots[key]; }
  47103. }
  47104. /* */
  47105. /**
  47106. * Runtime helper for rendering v-for lists.
  47107. */
  47108. function renderList (
  47109. val,
  47110. render
  47111. ) {
  47112. var ret, i, l, keys, key;
  47113. if (Array.isArray(val) || typeof val === 'string') {
  47114. ret = new Array(val.length);
  47115. for (i = 0, l = val.length; i < l; i++) {
  47116. ret[i] = render(val[i], i);
  47117. }
  47118. } else if (typeof val === 'number') {
  47119. ret = new Array(val);
  47120. for (i = 0; i < val; i++) {
  47121. ret[i] = render(i + 1, i);
  47122. }
  47123. } else if (isObject(val)) {
  47124. if (hasSymbol && val[Symbol.iterator]) {
  47125. ret = [];
  47126. var iterator = val[Symbol.iterator]();
  47127. var result = iterator.next();
  47128. while (!result.done) {
  47129. ret.push(render(result.value, ret.length));
  47130. result = iterator.next();
  47131. }
  47132. } else {
  47133. keys = Object.keys(val);
  47134. ret = new Array(keys.length);
  47135. for (i = 0, l = keys.length; i < l; i++) {
  47136. key = keys[i];
  47137. ret[i] = render(val[key], key, i);
  47138. }
  47139. }
  47140. }
  47141. if (!isDef(ret)) {
  47142. ret = [];
  47143. }
  47144. (ret)._isVList = true;
  47145. return ret
  47146. }
  47147. /* */
  47148. /**
  47149. * Runtime helper for rendering <slot>
  47150. */
  47151. function renderSlot (
  47152. name,
  47153. fallback,
  47154. props,
  47155. bindObject
  47156. ) {
  47157. var scopedSlotFn = this.$scopedSlots[name];
  47158. var nodes;
  47159. if (scopedSlotFn) { // scoped slot
  47160. props = props || {};
  47161. if (bindObject) {
  47162. if (!isObject(bindObject)) {
  47163. warn(
  47164. 'slot v-bind without argument expects an Object',
  47165. this
  47166. );
  47167. }
  47168. props = extend(extend({}, bindObject), props);
  47169. }
  47170. nodes = scopedSlotFn(props) || fallback;
  47171. } else {
  47172. nodes = this.$slots[name] || fallback;
  47173. }
  47174. var target = props && props.slot;
  47175. if (target) {
  47176. return this.$createElement('template', { slot: target }, nodes)
  47177. } else {
  47178. return nodes
  47179. }
  47180. }
  47181. /* */
  47182. /**
  47183. * Runtime helper for resolving filters
  47184. */
  47185. function resolveFilter (id) {
  47186. return resolveAsset(this.$options, 'filters', id, true) || identity
  47187. }
  47188. /* */
  47189. function isKeyNotMatch (expect, actual) {
  47190. if (Array.isArray(expect)) {
  47191. return expect.indexOf(actual) === -1
  47192. } else {
  47193. return expect !== actual
  47194. }
  47195. }
  47196. /**
  47197. * Runtime helper for checking keyCodes from config.
  47198. * exposed as Vue.prototype._k
  47199. * passing in eventKeyName as last argument separately for backwards compat
  47200. */
  47201. function checkKeyCodes (
  47202. eventKeyCode,
  47203. key,
  47204. builtInKeyCode,
  47205. eventKeyName,
  47206. builtInKeyName
  47207. ) {
  47208. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47209. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47210. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47211. } else if (mappedKeyCode) {
  47212. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47213. } else if (eventKeyName) {
  47214. return hyphenate(eventKeyName) !== key
  47215. }
  47216. }
  47217. /* */
  47218. /**
  47219. * Runtime helper for merging v-bind="object" into a VNode's data.
  47220. */
  47221. function bindObjectProps (
  47222. data,
  47223. tag,
  47224. value,
  47225. asProp,
  47226. isSync
  47227. ) {
  47228. if (value) {
  47229. if (!isObject(value)) {
  47230. warn(
  47231. 'v-bind without argument expects an Object or Array value',
  47232. this
  47233. );
  47234. } else {
  47235. if (Array.isArray(value)) {
  47236. value = toObject(value);
  47237. }
  47238. var hash;
  47239. var loop = function ( key ) {
  47240. if (
  47241. key === 'class' ||
  47242. key === 'style' ||
  47243. isReservedAttribute(key)
  47244. ) {
  47245. hash = data;
  47246. } else {
  47247. var type = data.attrs && data.attrs.type;
  47248. hash = asProp || config.mustUseProp(tag, type, key)
  47249. ? data.domProps || (data.domProps = {})
  47250. : data.attrs || (data.attrs = {});
  47251. }
  47252. var camelizedKey = camelize(key);
  47253. var hyphenatedKey = hyphenate(key);
  47254. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47255. hash[key] = value[key];
  47256. if (isSync) {
  47257. var on = data.on || (data.on = {});
  47258. on[("update:" + key)] = function ($event) {
  47259. value[key] = $event;
  47260. };
  47261. }
  47262. }
  47263. };
  47264. for (var key in value) loop( key );
  47265. }
  47266. }
  47267. return data
  47268. }
  47269. /* */
  47270. /**
  47271. * Runtime helper for rendering static trees.
  47272. */
  47273. function renderStatic (
  47274. index,
  47275. isInFor
  47276. ) {
  47277. var cached = this._staticTrees || (this._staticTrees = []);
  47278. var tree = cached[index];
  47279. // if has already-rendered static tree and not inside v-for,
  47280. // we can reuse the same tree.
  47281. if (tree && !isInFor) {
  47282. return tree
  47283. }
  47284. // otherwise, render a fresh tree.
  47285. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47286. this._renderProxy,
  47287. null,
  47288. this // for render fns generated for functional component templates
  47289. );
  47290. markStatic(tree, ("__static__" + index), false);
  47291. return tree
  47292. }
  47293. /**
  47294. * Runtime helper for v-once.
  47295. * Effectively it means marking the node as static with a unique key.
  47296. */
  47297. function markOnce (
  47298. tree,
  47299. index,
  47300. key
  47301. ) {
  47302. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47303. return tree
  47304. }
  47305. function markStatic (
  47306. tree,
  47307. key,
  47308. isOnce
  47309. ) {
  47310. if (Array.isArray(tree)) {
  47311. for (var i = 0; i < tree.length; i++) {
  47312. if (tree[i] && typeof tree[i] !== 'string') {
  47313. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47314. }
  47315. }
  47316. } else {
  47317. markStaticNode(tree, key, isOnce);
  47318. }
  47319. }
  47320. function markStaticNode (node, key, isOnce) {
  47321. node.isStatic = true;
  47322. node.key = key;
  47323. node.isOnce = isOnce;
  47324. }
  47325. /* */
  47326. function bindObjectListeners (data, value) {
  47327. if (value) {
  47328. if (!isPlainObject(value)) {
  47329. warn(
  47330. 'v-on without argument expects an Object value',
  47331. this
  47332. );
  47333. } else {
  47334. var on = data.on = data.on ? extend({}, data.on) : {};
  47335. for (var key in value) {
  47336. var existing = on[key];
  47337. var ours = value[key];
  47338. on[key] = existing ? [].concat(existing, ours) : ours;
  47339. }
  47340. }
  47341. }
  47342. return data
  47343. }
  47344. /* */
  47345. function resolveScopedSlots (
  47346. fns, // see flow/vnode
  47347. res,
  47348. // the following are added in 2.6
  47349. hasDynamicKeys,
  47350. contentHashKey
  47351. ) {
  47352. res = res || { $stable: !hasDynamicKeys };
  47353. for (var i = 0; i < fns.length; i++) {
  47354. var slot = fns[i];
  47355. if (Array.isArray(slot)) {
  47356. resolveScopedSlots(slot, res, hasDynamicKeys);
  47357. } else if (slot) {
  47358. // marker for reverse proxying v-slot without scope on this.$slots
  47359. if (slot.proxy) {
  47360. slot.fn.proxy = true;
  47361. }
  47362. res[slot.key] = slot.fn;
  47363. }
  47364. }
  47365. if (contentHashKey) {
  47366. (res).$key = contentHashKey;
  47367. }
  47368. return res
  47369. }
  47370. /* */
  47371. function bindDynamicKeys (baseObj, values) {
  47372. for (var i = 0; i < values.length; i += 2) {
  47373. var key = values[i];
  47374. if (typeof key === 'string' && key) {
  47375. baseObj[values[i]] = values[i + 1];
  47376. } else if (key !== '' && key !== null) {
  47377. // null is a special value for explicitly removing a binding
  47378. warn(
  47379. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47380. this
  47381. );
  47382. }
  47383. }
  47384. return baseObj
  47385. }
  47386. // helper to dynamically append modifier runtime markers to event names.
  47387. // ensure only append when value is already string, otherwise it will be cast
  47388. // to string and cause the type check to miss.
  47389. function prependModifier (value, symbol) {
  47390. return typeof value === 'string' ? symbol + value : value
  47391. }
  47392. /* */
  47393. function installRenderHelpers (target) {
  47394. target._o = markOnce;
  47395. target._n = toNumber;
  47396. target._s = toString;
  47397. target._l = renderList;
  47398. target._t = renderSlot;
  47399. target._q = looseEqual;
  47400. target._i = looseIndexOf;
  47401. target._m = renderStatic;
  47402. target._f = resolveFilter;
  47403. target._k = checkKeyCodes;
  47404. target._b = bindObjectProps;
  47405. target._v = createTextVNode;
  47406. target._e = createEmptyVNode;
  47407. target._u = resolveScopedSlots;
  47408. target._g = bindObjectListeners;
  47409. target._d = bindDynamicKeys;
  47410. target._p = prependModifier;
  47411. }
  47412. /* */
  47413. function FunctionalRenderContext (
  47414. data,
  47415. props,
  47416. children,
  47417. parent,
  47418. Ctor
  47419. ) {
  47420. var this$1 = this;
  47421. var options = Ctor.options;
  47422. // ensure the createElement function in functional components
  47423. // gets a unique context - this is necessary for correct named slot check
  47424. var contextVm;
  47425. if (hasOwn(parent, '_uid')) {
  47426. contextVm = Object.create(parent);
  47427. // $flow-disable-line
  47428. contextVm._original = parent;
  47429. } else {
  47430. // the context vm passed in is a functional context as well.
  47431. // in this case we want to make sure we are able to get a hold to the
  47432. // real context instance.
  47433. contextVm = parent;
  47434. // $flow-disable-line
  47435. parent = parent._original;
  47436. }
  47437. var isCompiled = isTrue(options._compiled);
  47438. var needNormalization = !isCompiled;
  47439. this.data = data;
  47440. this.props = props;
  47441. this.children = children;
  47442. this.parent = parent;
  47443. this.listeners = data.on || emptyObject;
  47444. this.injections = resolveInject(options.inject, parent);
  47445. this.slots = function () {
  47446. if (!this$1.$slots) {
  47447. normalizeScopedSlots(
  47448. data.scopedSlots,
  47449. this$1.$slots = resolveSlots(children, parent)
  47450. );
  47451. }
  47452. return this$1.$slots
  47453. };
  47454. Object.defineProperty(this, 'scopedSlots', ({
  47455. enumerable: true,
  47456. get: function get () {
  47457. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47458. }
  47459. }));
  47460. // support for compiled functional template
  47461. if (isCompiled) {
  47462. // exposing $options for renderStatic()
  47463. this.$options = options;
  47464. // pre-resolve slots for renderSlot()
  47465. this.$slots = this.slots();
  47466. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47467. }
  47468. if (options._scopeId) {
  47469. this._c = function (a, b, c, d) {
  47470. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47471. if (vnode && !Array.isArray(vnode)) {
  47472. vnode.fnScopeId = options._scopeId;
  47473. vnode.fnContext = parent;
  47474. }
  47475. return vnode
  47476. };
  47477. } else {
  47478. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47479. }
  47480. }
  47481. installRenderHelpers(FunctionalRenderContext.prototype);
  47482. function createFunctionalComponent (
  47483. Ctor,
  47484. propsData,
  47485. data,
  47486. contextVm,
  47487. children
  47488. ) {
  47489. var options = Ctor.options;
  47490. var props = {};
  47491. var propOptions = options.props;
  47492. if (isDef(propOptions)) {
  47493. for (var key in propOptions) {
  47494. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47495. }
  47496. } else {
  47497. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47498. if (isDef(data.props)) { mergeProps(props, data.props); }
  47499. }
  47500. var renderContext = new FunctionalRenderContext(
  47501. data,
  47502. props,
  47503. children,
  47504. contextVm,
  47505. Ctor
  47506. );
  47507. var vnode = options.render.call(null, renderContext._c, renderContext);
  47508. if (vnode instanceof VNode) {
  47509. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47510. } else if (Array.isArray(vnode)) {
  47511. var vnodes = normalizeChildren(vnode) || [];
  47512. var res = new Array(vnodes.length);
  47513. for (var i = 0; i < vnodes.length; i++) {
  47514. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47515. }
  47516. return res
  47517. }
  47518. }
  47519. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47520. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47521. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47522. // that should not be matched to match.
  47523. var clone = cloneVNode(vnode);
  47524. clone.fnContext = contextVm;
  47525. clone.fnOptions = options;
  47526. {
  47527. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47528. }
  47529. if (data.slot) {
  47530. (clone.data || (clone.data = {})).slot = data.slot;
  47531. }
  47532. return clone
  47533. }
  47534. function mergeProps (to, from) {
  47535. for (var key in from) {
  47536. to[camelize(key)] = from[key];
  47537. }
  47538. }
  47539. /* */
  47540. /* */
  47541. /* */
  47542. /* */
  47543. // inline hooks to be invoked on component VNodes during patch
  47544. var componentVNodeHooks = {
  47545. init: function init (vnode, hydrating) {
  47546. if (
  47547. vnode.componentInstance &&
  47548. !vnode.componentInstance._isDestroyed &&
  47549. vnode.data.keepAlive
  47550. ) {
  47551. // kept-alive components, treat as a patch
  47552. var mountedNode = vnode; // work around flow
  47553. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47554. } else {
  47555. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47556. vnode,
  47557. activeInstance
  47558. );
  47559. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47560. }
  47561. },
  47562. prepatch: function prepatch (oldVnode, vnode) {
  47563. var options = vnode.componentOptions;
  47564. var child = vnode.componentInstance = oldVnode.componentInstance;
  47565. updateChildComponent(
  47566. child,
  47567. options.propsData, // updated props
  47568. options.listeners, // updated listeners
  47569. vnode, // new parent vnode
  47570. options.children // new children
  47571. );
  47572. },
  47573. insert: function insert (vnode) {
  47574. var context = vnode.context;
  47575. var componentInstance = vnode.componentInstance;
  47576. if (!componentInstance._isMounted) {
  47577. componentInstance._isMounted = true;
  47578. callHook(componentInstance, 'mounted');
  47579. }
  47580. if (vnode.data.keepAlive) {
  47581. if (context._isMounted) {
  47582. // vue-router#1212
  47583. // During updates, a kept-alive component's child components may
  47584. // change, so directly walking the tree here may call activated hooks
  47585. // on incorrect children. Instead we push them into a queue which will
  47586. // be processed after the whole patch process ended.
  47587. queueActivatedComponent(componentInstance);
  47588. } else {
  47589. activateChildComponent(componentInstance, true /* direct */);
  47590. }
  47591. }
  47592. },
  47593. destroy: function destroy (vnode) {
  47594. var componentInstance = vnode.componentInstance;
  47595. if (!componentInstance._isDestroyed) {
  47596. if (!vnode.data.keepAlive) {
  47597. componentInstance.$destroy();
  47598. } else {
  47599. deactivateChildComponent(componentInstance, true /* direct */);
  47600. }
  47601. }
  47602. }
  47603. };
  47604. var hooksToMerge = Object.keys(componentVNodeHooks);
  47605. function createComponent (
  47606. Ctor,
  47607. data,
  47608. context,
  47609. children,
  47610. tag
  47611. ) {
  47612. if (isUndef(Ctor)) {
  47613. return
  47614. }
  47615. var baseCtor = context.$options._base;
  47616. // plain options object: turn it into a constructor
  47617. if (isObject(Ctor)) {
  47618. Ctor = baseCtor.extend(Ctor);
  47619. }
  47620. // if at this stage it's not a constructor or an async component factory,
  47621. // reject.
  47622. if (typeof Ctor !== 'function') {
  47623. {
  47624. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47625. }
  47626. return
  47627. }
  47628. // async component
  47629. var asyncFactory;
  47630. if (isUndef(Ctor.cid)) {
  47631. asyncFactory = Ctor;
  47632. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47633. if (Ctor === undefined) {
  47634. // return a placeholder node for async component, which is rendered
  47635. // as a comment node but preserves all the raw information for the node.
  47636. // the information will be used for async server-rendering and hydration.
  47637. return createAsyncPlaceholder(
  47638. asyncFactory,
  47639. data,
  47640. context,
  47641. children,
  47642. tag
  47643. )
  47644. }
  47645. }
  47646. data = data || {};
  47647. // resolve constructor options in case global mixins are applied after
  47648. // component constructor creation
  47649. resolveConstructorOptions(Ctor);
  47650. // transform component v-model data into props & events
  47651. if (isDef(data.model)) {
  47652. transformModel(Ctor.options, data);
  47653. }
  47654. // extract props
  47655. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47656. // functional component
  47657. if (isTrue(Ctor.options.functional)) {
  47658. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47659. }
  47660. // extract listeners, since these needs to be treated as
  47661. // child component listeners instead of DOM listeners
  47662. var listeners = data.on;
  47663. // replace with listeners with .native modifier
  47664. // so it gets processed during parent component patch.
  47665. data.on = data.nativeOn;
  47666. if (isTrue(Ctor.options.abstract)) {
  47667. // abstract components do not keep anything
  47668. // other than props & listeners & slot
  47669. // work around flow
  47670. var slot = data.slot;
  47671. data = {};
  47672. if (slot) {
  47673. data.slot = slot;
  47674. }
  47675. }
  47676. // install component management hooks onto the placeholder node
  47677. installComponentHooks(data);
  47678. // return a placeholder vnode
  47679. var name = Ctor.options.name || tag;
  47680. var vnode = new VNode(
  47681. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47682. data, undefined, undefined, undefined, context,
  47683. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47684. asyncFactory
  47685. );
  47686. return vnode
  47687. }
  47688. function createComponentInstanceForVnode (
  47689. vnode, // we know it's MountedComponentVNode but flow doesn't
  47690. parent // activeInstance in lifecycle state
  47691. ) {
  47692. var options = {
  47693. _isComponent: true,
  47694. _parentVnode: vnode,
  47695. parent: parent
  47696. };
  47697. // check inline-template render functions
  47698. var inlineTemplate = vnode.data.inlineTemplate;
  47699. if (isDef(inlineTemplate)) {
  47700. options.render = inlineTemplate.render;
  47701. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47702. }
  47703. return new vnode.componentOptions.Ctor(options)
  47704. }
  47705. function installComponentHooks (data) {
  47706. var hooks = data.hook || (data.hook = {});
  47707. for (var i = 0; i < hooksToMerge.length; i++) {
  47708. var key = hooksToMerge[i];
  47709. var existing = hooks[key];
  47710. var toMerge = componentVNodeHooks[key];
  47711. if (existing !== toMerge && !(existing && existing._merged)) {
  47712. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47713. }
  47714. }
  47715. }
  47716. function mergeHook$1 (f1, f2) {
  47717. var merged = function (a, b) {
  47718. // flow complains about extra args which is why we use any
  47719. f1(a, b);
  47720. f2(a, b);
  47721. };
  47722. merged._merged = true;
  47723. return merged
  47724. }
  47725. // transform component v-model info (value and callback) into
  47726. // prop and event handler respectively.
  47727. function transformModel (options, data) {
  47728. var prop = (options.model && options.model.prop) || 'value';
  47729. var event = (options.model && options.model.event) || 'input'
  47730. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47731. var on = data.on || (data.on = {});
  47732. var existing = on[event];
  47733. var callback = data.model.callback;
  47734. if (isDef(existing)) {
  47735. if (
  47736. Array.isArray(existing)
  47737. ? existing.indexOf(callback) === -1
  47738. : existing !== callback
  47739. ) {
  47740. on[event] = [callback].concat(existing);
  47741. }
  47742. } else {
  47743. on[event] = callback;
  47744. }
  47745. }
  47746. /* */
  47747. var SIMPLE_NORMALIZE = 1;
  47748. var ALWAYS_NORMALIZE = 2;
  47749. // wrapper function for providing a more flexible interface
  47750. // without getting yelled at by flow
  47751. function createElement (
  47752. context,
  47753. tag,
  47754. data,
  47755. children,
  47756. normalizationType,
  47757. alwaysNormalize
  47758. ) {
  47759. if (Array.isArray(data) || isPrimitive(data)) {
  47760. normalizationType = children;
  47761. children = data;
  47762. data = undefined;
  47763. }
  47764. if (isTrue(alwaysNormalize)) {
  47765. normalizationType = ALWAYS_NORMALIZE;
  47766. }
  47767. return _createElement(context, tag, data, children, normalizationType)
  47768. }
  47769. function _createElement (
  47770. context,
  47771. tag,
  47772. data,
  47773. children,
  47774. normalizationType
  47775. ) {
  47776. if (isDef(data) && isDef((data).__ob__)) {
  47777. warn(
  47778. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47779. 'Always create fresh vnode data objects in each render!',
  47780. context
  47781. );
  47782. return createEmptyVNode()
  47783. }
  47784. // object syntax in v-bind
  47785. if (isDef(data) && isDef(data.is)) {
  47786. tag = data.is;
  47787. }
  47788. if (!tag) {
  47789. // in case of component :is set to falsy value
  47790. return createEmptyVNode()
  47791. }
  47792. // warn against non-primitive key
  47793. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47794. ) {
  47795. {
  47796. warn(
  47797. 'Avoid using non-primitive value as key, ' +
  47798. 'use string/number value instead.',
  47799. context
  47800. );
  47801. }
  47802. }
  47803. // support single function children as default scoped slot
  47804. if (Array.isArray(children) &&
  47805. typeof children[0] === 'function'
  47806. ) {
  47807. data = data || {};
  47808. data.scopedSlots = { default: children[0] };
  47809. children.length = 0;
  47810. }
  47811. if (normalizationType === ALWAYS_NORMALIZE) {
  47812. children = normalizeChildren(children);
  47813. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47814. children = simpleNormalizeChildren(children);
  47815. }
  47816. var vnode, ns;
  47817. if (typeof tag === 'string') {
  47818. var Ctor;
  47819. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47820. if (config.isReservedTag(tag)) {
  47821. // platform built-in elements
  47822. if (isDef(data) && isDef(data.nativeOn)) {
  47823. warn(
  47824. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47825. context
  47826. );
  47827. }
  47828. vnode = new VNode(
  47829. config.parsePlatformTagName(tag), data, children,
  47830. undefined, undefined, context
  47831. );
  47832. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47833. // component
  47834. vnode = createComponent(Ctor, data, context, children, tag);
  47835. } else {
  47836. // unknown or unlisted namespaced elements
  47837. // check at runtime because it may get assigned a namespace when its
  47838. // parent normalizes children
  47839. vnode = new VNode(
  47840. tag, data, children,
  47841. undefined, undefined, context
  47842. );
  47843. }
  47844. } else {
  47845. // direct component options / constructor
  47846. vnode = createComponent(tag, data, context, children);
  47847. }
  47848. if (Array.isArray(vnode)) {
  47849. return vnode
  47850. } else if (isDef(vnode)) {
  47851. if (isDef(ns)) { applyNS(vnode, ns); }
  47852. if (isDef(data)) { registerDeepBindings(data); }
  47853. return vnode
  47854. } else {
  47855. return createEmptyVNode()
  47856. }
  47857. }
  47858. function applyNS (vnode, ns, force) {
  47859. vnode.ns = ns;
  47860. if (vnode.tag === 'foreignObject') {
  47861. // use default namespace inside foreignObject
  47862. ns = undefined;
  47863. force = true;
  47864. }
  47865. if (isDef(vnode.children)) {
  47866. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47867. var child = vnode.children[i];
  47868. if (isDef(child.tag) && (
  47869. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47870. applyNS(child, ns, force);
  47871. }
  47872. }
  47873. }
  47874. }
  47875. // ref #5318
  47876. // necessary to ensure parent re-render when deep bindings like :style and
  47877. // :class are used on slot nodes
  47878. function registerDeepBindings (data) {
  47879. if (isObject(data.style)) {
  47880. traverse(data.style);
  47881. }
  47882. if (isObject(data.class)) {
  47883. traverse(data.class);
  47884. }
  47885. }
  47886. /* */
  47887. function initRender (vm) {
  47888. vm._vnode = null; // the root of the child tree
  47889. vm._staticTrees = null; // v-once cached trees
  47890. var options = vm.$options;
  47891. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47892. var renderContext = parentVnode && parentVnode.context;
  47893. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47894. vm.$scopedSlots = emptyObject;
  47895. // bind the createElement fn to this instance
  47896. // so that we get proper render context inside it.
  47897. // args order: tag, data, children, normalizationType, alwaysNormalize
  47898. // internal version is used by render functions compiled from templates
  47899. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47900. // normalization is always applied for the public version, used in
  47901. // user-written render functions.
  47902. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47903. // $attrs & $listeners are exposed for easier HOC creation.
  47904. // they need to be reactive so that HOCs using them are always updated
  47905. var parentData = parentVnode && parentVnode.data;
  47906. /* istanbul ignore else */
  47907. {
  47908. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47909. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47910. }, true);
  47911. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47912. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47913. }, true);
  47914. }
  47915. }
  47916. var currentRenderingInstance = null;
  47917. function renderMixin (Vue) {
  47918. // install runtime convenience helpers
  47919. installRenderHelpers(Vue.prototype);
  47920. Vue.prototype.$nextTick = function (fn) {
  47921. return nextTick(fn, this)
  47922. };
  47923. Vue.prototype._render = function () {
  47924. var vm = this;
  47925. var ref = vm.$options;
  47926. var render = ref.render;
  47927. var _parentVnode = ref._parentVnode;
  47928. if (_parentVnode) {
  47929. vm.$scopedSlots = normalizeScopedSlots(
  47930. _parentVnode.data.scopedSlots,
  47931. vm.$slots,
  47932. vm.$scopedSlots
  47933. );
  47934. }
  47935. // set parent vnode. this allows render functions to have access
  47936. // to the data on the placeholder node.
  47937. vm.$vnode = _parentVnode;
  47938. // render self
  47939. var vnode;
  47940. try {
  47941. // There's no need to maintain a stack because all render fns are called
  47942. // separately from one another. Nested component's render fns are called
  47943. // when parent component is patched.
  47944. currentRenderingInstance = vm;
  47945. vnode = render.call(vm._renderProxy, vm.$createElement);
  47946. } catch (e) {
  47947. handleError(e, vm, "render");
  47948. // return error render result,
  47949. // or previous vnode to prevent render error causing blank component
  47950. /* istanbul ignore else */
  47951. if (vm.$options.renderError) {
  47952. try {
  47953. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47954. } catch (e) {
  47955. handleError(e, vm, "renderError");
  47956. vnode = vm._vnode;
  47957. }
  47958. } else {
  47959. vnode = vm._vnode;
  47960. }
  47961. } finally {
  47962. currentRenderingInstance = null;
  47963. }
  47964. // if the returned array contains only a single node, allow it
  47965. if (Array.isArray(vnode) && vnode.length === 1) {
  47966. vnode = vnode[0];
  47967. }
  47968. // return empty vnode in case the render function errored out
  47969. if (!(vnode instanceof VNode)) {
  47970. if (Array.isArray(vnode)) {
  47971. warn(
  47972. 'Multiple root nodes returned from render function. Render function ' +
  47973. 'should return a single root node.',
  47974. vm
  47975. );
  47976. }
  47977. vnode = createEmptyVNode();
  47978. }
  47979. // set parent
  47980. vnode.parent = _parentVnode;
  47981. return vnode
  47982. };
  47983. }
  47984. /* */
  47985. function ensureCtor (comp, base) {
  47986. if (
  47987. comp.__esModule ||
  47988. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47989. ) {
  47990. comp = comp.default;
  47991. }
  47992. return isObject(comp)
  47993. ? base.extend(comp)
  47994. : comp
  47995. }
  47996. function createAsyncPlaceholder (
  47997. factory,
  47998. data,
  47999. context,
  48000. children,
  48001. tag
  48002. ) {
  48003. var node = createEmptyVNode();
  48004. node.asyncFactory = factory;
  48005. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  48006. return node
  48007. }
  48008. function resolveAsyncComponent (
  48009. factory,
  48010. baseCtor
  48011. ) {
  48012. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  48013. return factory.errorComp
  48014. }
  48015. if (isDef(factory.resolved)) {
  48016. return factory.resolved
  48017. }
  48018. var owner = currentRenderingInstance;
  48019. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  48020. // already pending
  48021. factory.owners.push(owner);
  48022. }
  48023. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  48024. return factory.loadingComp
  48025. }
  48026. if (owner && !isDef(factory.owners)) {
  48027. var owners = factory.owners = [owner];
  48028. var sync = true;
  48029. var timerLoading = null;
  48030. var timerTimeout = null
  48031. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  48032. var forceRender = function (renderCompleted) {
  48033. for (var i = 0, l = owners.length; i < l; i++) {
  48034. (owners[i]).$forceUpdate();
  48035. }
  48036. if (renderCompleted) {
  48037. owners.length = 0;
  48038. if (timerLoading !== null) {
  48039. clearTimeout(timerLoading);
  48040. timerLoading = null;
  48041. }
  48042. if (timerTimeout !== null) {
  48043. clearTimeout(timerTimeout);
  48044. timerTimeout = null;
  48045. }
  48046. }
  48047. };
  48048. var resolve = once(function (res) {
  48049. // cache resolved
  48050. factory.resolved = ensureCtor(res, baseCtor);
  48051. // invoke callbacks only if this is not a synchronous resolve
  48052. // (async resolves are shimmed as synchronous during SSR)
  48053. if (!sync) {
  48054. forceRender(true);
  48055. } else {
  48056. owners.length = 0;
  48057. }
  48058. });
  48059. var reject = once(function (reason) {
  48060. warn(
  48061. "Failed to resolve async component: " + (String(factory)) +
  48062. (reason ? ("\nReason: " + reason) : '')
  48063. );
  48064. if (isDef(factory.errorComp)) {
  48065. factory.error = true;
  48066. forceRender(true);
  48067. }
  48068. });
  48069. var res = factory(resolve, reject);
  48070. if (isObject(res)) {
  48071. if (isPromise(res)) {
  48072. // () => Promise
  48073. if (isUndef(factory.resolved)) {
  48074. res.then(resolve, reject);
  48075. }
  48076. } else if (isPromise(res.component)) {
  48077. res.component.then(resolve, reject);
  48078. if (isDef(res.error)) {
  48079. factory.errorComp = ensureCtor(res.error, baseCtor);
  48080. }
  48081. if (isDef(res.loading)) {
  48082. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48083. if (res.delay === 0) {
  48084. factory.loading = true;
  48085. } else {
  48086. timerLoading = setTimeout(function () {
  48087. timerLoading = null;
  48088. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48089. factory.loading = true;
  48090. forceRender(false);
  48091. }
  48092. }, res.delay || 200);
  48093. }
  48094. }
  48095. if (isDef(res.timeout)) {
  48096. timerTimeout = setTimeout(function () {
  48097. timerTimeout = null;
  48098. if (isUndef(factory.resolved)) {
  48099. reject(
  48100. "timeout (" + (res.timeout) + "ms)"
  48101. );
  48102. }
  48103. }, res.timeout);
  48104. }
  48105. }
  48106. }
  48107. sync = false;
  48108. // return in case resolved synchronously
  48109. return factory.loading
  48110. ? factory.loadingComp
  48111. : factory.resolved
  48112. }
  48113. }
  48114. /* */
  48115. function isAsyncPlaceholder (node) {
  48116. return node.isComment && node.asyncFactory
  48117. }
  48118. /* */
  48119. function getFirstComponentChild (children) {
  48120. if (Array.isArray(children)) {
  48121. for (var i = 0; i < children.length; i++) {
  48122. var c = children[i];
  48123. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48124. return c
  48125. }
  48126. }
  48127. }
  48128. }
  48129. /* */
  48130. /* */
  48131. function initEvents (vm) {
  48132. vm._events = Object.create(null);
  48133. vm._hasHookEvent = false;
  48134. // init parent attached events
  48135. var listeners = vm.$options._parentListeners;
  48136. if (listeners) {
  48137. updateComponentListeners(vm, listeners);
  48138. }
  48139. }
  48140. var target;
  48141. function add (event, fn) {
  48142. target.$on(event, fn);
  48143. }
  48144. function remove$1 (event, fn) {
  48145. target.$off(event, fn);
  48146. }
  48147. function createOnceHandler (event, fn) {
  48148. var _target = target;
  48149. return function onceHandler () {
  48150. var res = fn.apply(null, arguments);
  48151. if (res !== null) {
  48152. _target.$off(event, onceHandler);
  48153. }
  48154. }
  48155. }
  48156. function updateComponentListeners (
  48157. vm,
  48158. listeners,
  48159. oldListeners
  48160. ) {
  48161. target = vm;
  48162. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48163. target = undefined;
  48164. }
  48165. function eventsMixin (Vue) {
  48166. var hookRE = /^hook:/;
  48167. Vue.prototype.$on = function (event, fn) {
  48168. var vm = this;
  48169. if (Array.isArray(event)) {
  48170. for (var i = 0, l = event.length; i < l; i++) {
  48171. vm.$on(event[i], fn);
  48172. }
  48173. } else {
  48174. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48175. // optimize hook:event cost by using a boolean flag marked at registration
  48176. // instead of a hash lookup
  48177. if (hookRE.test(event)) {
  48178. vm._hasHookEvent = true;
  48179. }
  48180. }
  48181. return vm
  48182. };
  48183. Vue.prototype.$once = function (event, fn) {
  48184. var vm = this;
  48185. function on () {
  48186. vm.$off(event, on);
  48187. fn.apply(vm, arguments);
  48188. }
  48189. on.fn = fn;
  48190. vm.$on(event, on);
  48191. return vm
  48192. };
  48193. Vue.prototype.$off = function (event, fn) {
  48194. var vm = this;
  48195. // all
  48196. if (!arguments.length) {
  48197. vm._events = Object.create(null);
  48198. return vm
  48199. }
  48200. // array of events
  48201. if (Array.isArray(event)) {
  48202. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48203. vm.$off(event[i$1], fn);
  48204. }
  48205. return vm
  48206. }
  48207. // specific event
  48208. var cbs = vm._events[event];
  48209. if (!cbs) {
  48210. return vm
  48211. }
  48212. if (!fn) {
  48213. vm._events[event] = null;
  48214. return vm
  48215. }
  48216. // specific handler
  48217. var cb;
  48218. var i = cbs.length;
  48219. while (i--) {
  48220. cb = cbs[i];
  48221. if (cb === fn || cb.fn === fn) {
  48222. cbs.splice(i, 1);
  48223. break
  48224. }
  48225. }
  48226. return vm
  48227. };
  48228. Vue.prototype.$emit = function (event) {
  48229. var vm = this;
  48230. {
  48231. var lowerCaseEvent = event.toLowerCase();
  48232. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48233. tip(
  48234. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48235. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48236. "Note that HTML attributes are case-insensitive and you cannot use " +
  48237. "v-on to listen to camelCase events when using in-DOM templates. " +
  48238. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48239. );
  48240. }
  48241. }
  48242. var cbs = vm._events[event];
  48243. if (cbs) {
  48244. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48245. var args = toArray(arguments, 1);
  48246. var info = "event handler for \"" + event + "\"";
  48247. for (var i = 0, l = cbs.length; i < l; i++) {
  48248. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48249. }
  48250. }
  48251. return vm
  48252. };
  48253. }
  48254. /* */
  48255. var activeInstance = null;
  48256. var isUpdatingChildComponent = false;
  48257. function setActiveInstance(vm) {
  48258. var prevActiveInstance = activeInstance;
  48259. activeInstance = vm;
  48260. return function () {
  48261. activeInstance = prevActiveInstance;
  48262. }
  48263. }
  48264. function initLifecycle (vm) {
  48265. var options = vm.$options;
  48266. // locate first non-abstract parent
  48267. var parent = options.parent;
  48268. if (parent && !options.abstract) {
  48269. while (parent.$options.abstract && parent.$parent) {
  48270. parent = parent.$parent;
  48271. }
  48272. parent.$children.push(vm);
  48273. }
  48274. vm.$parent = parent;
  48275. vm.$root = parent ? parent.$root : vm;
  48276. vm.$children = [];
  48277. vm.$refs = {};
  48278. vm._watcher = null;
  48279. vm._inactive = null;
  48280. vm._directInactive = false;
  48281. vm._isMounted = false;
  48282. vm._isDestroyed = false;
  48283. vm._isBeingDestroyed = false;
  48284. }
  48285. function lifecycleMixin (Vue) {
  48286. Vue.prototype._update = function (vnode, hydrating) {
  48287. var vm = this;
  48288. var prevEl = vm.$el;
  48289. var prevVnode = vm._vnode;
  48290. var restoreActiveInstance = setActiveInstance(vm);
  48291. vm._vnode = vnode;
  48292. // Vue.prototype.__patch__ is injected in entry points
  48293. // based on the rendering backend used.
  48294. if (!prevVnode) {
  48295. // initial render
  48296. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48297. } else {
  48298. // updates
  48299. vm.$el = vm.__patch__(prevVnode, vnode);
  48300. }
  48301. restoreActiveInstance();
  48302. // update __vue__ reference
  48303. if (prevEl) {
  48304. prevEl.__vue__ = null;
  48305. }
  48306. if (vm.$el) {
  48307. vm.$el.__vue__ = vm;
  48308. }
  48309. // if parent is an HOC, update its $el as well
  48310. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48311. vm.$parent.$el = vm.$el;
  48312. }
  48313. // updated hook is called by the scheduler to ensure that children are
  48314. // updated in a parent's updated hook.
  48315. };
  48316. Vue.prototype.$forceUpdate = function () {
  48317. var vm = this;
  48318. if (vm._watcher) {
  48319. vm._watcher.update();
  48320. }
  48321. };
  48322. Vue.prototype.$destroy = function () {
  48323. var vm = this;
  48324. if (vm._isBeingDestroyed) {
  48325. return
  48326. }
  48327. callHook(vm, 'beforeDestroy');
  48328. vm._isBeingDestroyed = true;
  48329. // remove self from parent
  48330. var parent = vm.$parent;
  48331. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48332. remove(parent.$children, vm);
  48333. }
  48334. // teardown watchers
  48335. if (vm._watcher) {
  48336. vm._watcher.teardown();
  48337. }
  48338. var i = vm._watchers.length;
  48339. while (i--) {
  48340. vm._watchers[i].teardown();
  48341. }
  48342. // remove reference from data ob
  48343. // frozen object may not have observer.
  48344. if (vm._data.__ob__) {
  48345. vm._data.__ob__.vmCount--;
  48346. }
  48347. // call the last hook...
  48348. vm._isDestroyed = true;
  48349. // invoke destroy hooks on current rendered tree
  48350. vm.__patch__(vm._vnode, null);
  48351. // fire destroyed hook
  48352. callHook(vm, 'destroyed');
  48353. // turn off all instance listeners.
  48354. vm.$off();
  48355. // remove __vue__ reference
  48356. if (vm.$el) {
  48357. vm.$el.__vue__ = null;
  48358. }
  48359. // release circular reference (#6759)
  48360. if (vm.$vnode) {
  48361. vm.$vnode.parent = null;
  48362. }
  48363. };
  48364. }
  48365. function mountComponent (
  48366. vm,
  48367. el,
  48368. hydrating
  48369. ) {
  48370. vm.$el = el;
  48371. if (!vm.$options.render) {
  48372. vm.$options.render = createEmptyVNode;
  48373. {
  48374. /* istanbul ignore if */
  48375. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48376. vm.$options.el || el) {
  48377. warn(
  48378. 'You are using the runtime-only build of Vue where the template ' +
  48379. 'compiler is not available. Either pre-compile the templates into ' +
  48380. 'render functions, or use the compiler-included build.',
  48381. vm
  48382. );
  48383. } else {
  48384. warn(
  48385. 'Failed to mount component: template or render function not defined.',
  48386. vm
  48387. );
  48388. }
  48389. }
  48390. }
  48391. callHook(vm, 'beforeMount');
  48392. var updateComponent;
  48393. /* istanbul ignore if */
  48394. if (config.performance && mark) {
  48395. updateComponent = function () {
  48396. var name = vm._name;
  48397. var id = vm._uid;
  48398. var startTag = "vue-perf-start:" + id;
  48399. var endTag = "vue-perf-end:" + id;
  48400. mark(startTag);
  48401. var vnode = vm._render();
  48402. mark(endTag);
  48403. measure(("vue " + name + " render"), startTag, endTag);
  48404. mark(startTag);
  48405. vm._update(vnode, hydrating);
  48406. mark(endTag);
  48407. measure(("vue " + name + " patch"), startTag, endTag);
  48408. };
  48409. } else {
  48410. updateComponent = function () {
  48411. vm._update(vm._render(), hydrating);
  48412. };
  48413. }
  48414. // we set this to vm._watcher inside the watcher's constructor
  48415. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48416. // component's mounted hook), which relies on vm._watcher being already defined
  48417. new Watcher(vm, updateComponent, noop, {
  48418. before: function before () {
  48419. if (vm._isMounted && !vm._isDestroyed) {
  48420. callHook(vm, 'beforeUpdate');
  48421. }
  48422. }
  48423. }, true /* isRenderWatcher */);
  48424. hydrating = false;
  48425. // manually mounted instance, call mounted on self
  48426. // mounted is called for render-created child components in its inserted hook
  48427. if (vm.$vnode == null) {
  48428. vm._isMounted = true;
  48429. callHook(vm, 'mounted');
  48430. }
  48431. return vm
  48432. }
  48433. function updateChildComponent (
  48434. vm,
  48435. propsData,
  48436. listeners,
  48437. parentVnode,
  48438. renderChildren
  48439. ) {
  48440. {
  48441. isUpdatingChildComponent = true;
  48442. }
  48443. // determine whether component has slot children
  48444. // we need to do this before overwriting $options._renderChildren.
  48445. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48446. // dynamic slot names). Static scoped slots compiled from template has the
  48447. // "$stable" marker.
  48448. var newScopedSlots = parentVnode.data.scopedSlots;
  48449. var oldScopedSlots = vm.$scopedSlots;
  48450. var hasDynamicScopedSlot = !!(
  48451. (newScopedSlots && !newScopedSlots.$stable) ||
  48452. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48453. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48454. );
  48455. // Any static slot children from the parent may have changed during parent's
  48456. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48457. // update is necessary to ensure correctness.
  48458. var needsForceUpdate = !!(
  48459. renderChildren || // has new static slots
  48460. vm.$options._renderChildren || // has old static slots
  48461. hasDynamicScopedSlot
  48462. );
  48463. vm.$options._parentVnode = parentVnode;
  48464. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48465. if (vm._vnode) { // update child tree's parent
  48466. vm._vnode.parent = parentVnode;
  48467. }
  48468. vm.$options._renderChildren = renderChildren;
  48469. // update $attrs and $listeners hash
  48470. // these are also reactive so they may trigger child update if the child
  48471. // used them during render
  48472. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48473. vm.$listeners = listeners || emptyObject;
  48474. // update props
  48475. if (propsData && vm.$options.props) {
  48476. toggleObserving(false);
  48477. var props = vm._props;
  48478. var propKeys = vm.$options._propKeys || [];
  48479. for (var i = 0; i < propKeys.length; i++) {
  48480. var key = propKeys[i];
  48481. var propOptions = vm.$options.props; // wtf flow?
  48482. props[key] = validateProp(key, propOptions, propsData, vm);
  48483. }
  48484. toggleObserving(true);
  48485. // keep a copy of raw propsData
  48486. vm.$options.propsData = propsData;
  48487. }
  48488. // update listeners
  48489. listeners = listeners || emptyObject;
  48490. var oldListeners = vm.$options._parentListeners;
  48491. vm.$options._parentListeners = listeners;
  48492. updateComponentListeners(vm, listeners, oldListeners);
  48493. // resolve slots + force update if has children
  48494. if (needsForceUpdate) {
  48495. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48496. vm.$forceUpdate();
  48497. }
  48498. {
  48499. isUpdatingChildComponent = false;
  48500. }
  48501. }
  48502. function isInInactiveTree (vm) {
  48503. while (vm && (vm = vm.$parent)) {
  48504. if (vm._inactive) { return true }
  48505. }
  48506. return false
  48507. }
  48508. function activateChildComponent (vm, direct) {
  48509. if (direct) {
  48510. vm._directInactive = false;
  48511. if (isInInactiveTree(vm)) {
  48512. return
  48513. }
  48514. } else if (vm._directInactive) {
  48515. return
  48516. }
  48517. if (vm._inactive || vm._inactive === null) {
  48518. vm._inactive = false;
  48519. for (var i = 0; i < vm.$children.length; i++) {
  48520. activateChildComponent(vm.$children[i]);
  48521. }
  48522. callHook(vm, 'activated');
  48523. }
  48524. }
  48525. function deactivateChildComponent (vm, direct) {
  48526. if (direct) {
  48527. vm._directInactive = true;
  48528. if (isInInactiveTree(vm)) {
  48529. return
  48530. }
  48531. }
  48532. if (!vm._inactive) {
  48533. vm._inactive = true;
  48534. for (var i = 0; i < vm.$children.length; i++) {
  48535. deactivateChildComponent(vm.$children[i]);
  48536. }
  48537. callHook(vm, 'deactivated');
  48538. }
  48539. }
  48540. function callHook (vm, hook) {
  48541. // #7573 disable dep collection when invoking lifecycle hooks
  48542. pushTarget();
  48543. var handlers = vm.$options[hook];
  48544. var info = hook + " hook";
  48545. if (handlers) {
  48546. for (var i = 0, j = handlers.length; i < j; i++) {
  48547. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48548. }
  48549. }
  48550. if (vm._hasHookEvent) {
  48551. vm.$emit('hook:' + hook);
  48552. }
  48553. popTarget();
  48554. }
  48555. /* */
  48556. var MAX_UPDATE_COUNT = 100;
  48557. var queue = [];
  48558. var activatedChildren = [];
  48559. var has = {};
  48560. var circular = {};
  48561. var waiting = false;
  48562. var flushing = false;
  48563. var index = 0;
  48564. /**
  48565. * Reset the scheduler's state.
  48566. */
  48567. function resetSchedulerState () {
  48568. index = queue.length = activatedChildren.length = 0;
  48569. has = {};
  48570. {
  48571. circular = {};
  48572. }
  48573. waiting = flushing = false;
  48574. }
  48575. // Async edge case #6566 requires saving the timestamp when event listeners are
  48576. // attached. However, calling performance.now() has a perf overhead especially
  48577. // if the page has thousands of event listeners. Instead, we take a timestamp
  48578. // every time the scheduler flushes and use that for all event listeners
  48579. // attached during that flush.
  48580. var currentFlushTimestamp = 0;
  48581. // Async edge case fix requires storing an event listener's attach timestamp.
  48582. var getNow = Date.now;
  48583. // Determine what event timestamp the browser is using. Annoyingly, the
  48584. // timestamp can either be hi-res (relative to page load) or low-res
  48585. // (relative to UNIX epoch), so in order to compare time we have to use the
  48586. // same timestamp type when saving the flush timestamp.
  48587. // All IE versions use low-res event timestamps, and have problematic clock
  48588. // implementations (#9632)
  48589. if (inBrowser && !isIE) {
  48590. var performance = window.performance;
  48591. if (
  48592. performance &&
  48593. typeof performance.now === 'function' &&
  48594. getNow() > document.createEvent('Event').timeStamp
  48595. ) {
  48596. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48597. // smaller than it, it means the event is using a hi-res timestamp,
  48598. // and we need to use the hi-res version for event listener timestamps as
  48599. // well.
  48600. getNow = function () { return performance.now(); };
  48601. }
  48602. }
  48603. /**
  48604. * Flush both queues and run the watchers.
  48605. */
  48606. function flushSchedulerQueue () {
  48607. currentFlushTimestamp = getNow();
  48608. flushing = true;
  48609. var watcher, id;
  48610. // Sort queue before flush.
  48611. // This ensures that:
  48612. // 1. Components are updated from parent to child. (because parent is always
  48613. // created before the child)
  48614. // 2. A component's user watchers are run before its render watcher (because
  48615. // user watchers are created before the render watcher)
  48616. // 3. If a component is destroyed during a parent component's watcher run,
  48617. // its watchers can be skipped.
  48618. queue.sort(function (a, b) { return a.id - b.id; });
  48619. // do not cache length because more watchers might be pushed
  48620. // as we run existing watchers
  48621. for (index = 0; index < queue.length; index++) {
  48622. watcher = queue[index];
  48623. if (watcher.before) {
  48624. watcher.before();
  48625. }
  48626. id = watcher.id;
  48627. has[id] = null;
  48628. watcher.run();
  48629. // in dev build, check and stop circular updates.
  48630. if (has[id] != null) {
  48631. circular[id] = (circular[id] || 0) + 1;
  48632. if (circular[id] > MAX_UPDATE_COUNT) {
  48633. warn(
  48634. 'You may have an infinite update loop ' + (
  48635. watcher.user
  48636. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48637. : "in a component render function."
  48638. ),
  48639. watcher.vm
  48640. );
  48641. break
  48642. }
  48643. }
  48644. }
  48645. // keep copies of post queues before resetting state
  48646. var activatedQueue = activatedChildren.slice();
  48647. var updatedQueue = queue.slice();
  48648. resetSchedulerState();
  48649. // call component updated and activated hooks
  48650. callActivatedHooks(activatedQueue);
  48651. callUpdatedHooks(updatedQueue);
  48652. // devtool hook
  48653. /* istanbul ignore if */
  48654. if (devtools && config.devtools) {
  48655. devtools.emit('flush');
  48656. }
  48657. }
  48658. function callUpdatedHooks (queue) {
  48659. var i = queue.length;
  48660. while (i--) {
  48661. var watcher = queue[i];
  48662. var vm = watcher.vm;
  48663. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48664. callHook(vm, 'updated');
  48665. }
  48666. }
  48667. }
  48668. /**
  48669. * Queue a kept-alive component that was activated during patch.
  48670. * The queue will be processed after the entire tree has been patched.
  48671. */
  48672. function queueActivatedComponent (vm) {
  48673. // setting _inactive to false here so that a render function can
  48674. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48675. vm._inactive = false;
  48676. activatedChildren.push(vm);
  48677. }
  48678. function callActivatedHooks (queue) {
  48679. for (var i = 0; i < queue.length; i++) {
  48680. queue[i]._inactive = true;
  48681. activateChildComponent(queue[i], true /* true */);
  48682. }
  48683. }
  48684. /**
  48685. * Push a watcher into the watcher queue.
  48686. * Jobs with duplicate IDs will be skipped unless it's
  48687. * pushed when the queue is being flushed.
  48688. */
  48689. function queueWatcher (watcher) {
  48690. var id = watcher.id;
  48691. if (has[id] == null) {
  48692. has[id] = true;
  48693. if (!flushing) {
  48694. queue.push(watcher);
  48695. } else {
  48696. // if already flushing, splice the watcher based on its id
  48697. // if already past its id, it will be run next immediately.
  48698. var i = queue.length - 1;
  48699. while (i > index && queue[i].id > watcher.id) {
  48700. i--;
  48701. }
  48702. queue.splice(i + 1, 0, watcher);
  48703. }
  48704. // queue the flush
  48705. if (!waiting) {
  48706. waiting = true;
  48707. if (!config.async) {
  48708. flushSchedulerQueue();
  48709. return
  48710. }
  48711. nextTick(flushSchedulerQueue);
  48712. }
  48713. }
  48714. }
  48715. /* */
  48716. var uid$2 = 0;
  48717. /**
  48718. * A watcher parses an expression, collects dependencies,
  48719. * and fires callback when the expression value changes.
  48720. * This is used for both the $watch() api and directives.
  48721. */
  48722. var Watcher = function Watcher (
  48723. vm,
  48724. expOrFn,
  48725. cb,
  48726. options,
  48727. isRenderWatcher
  48728. ) {
  48729. this.vm = vm;
  48730. if (isRenderWatcher) {
  48731. vm._watcher = this;
  48732. }
  48733. vm._watchers.push(this);
  48734. // options
  48735. if (options) {
  48736. this.deep = !!options.deep;
  48737. this.user = !!options.user;
  48738. this.lazy = !!options.lazy;
  48739. this.sync = !!options.sync;
  48740. this.before = options.before;
  48741. } else {
  48742. this.deep = this.user = this.lazy = this.sync = false;
  48743. }
  48744. this.cb = cb;
  48745. this.id = ++uid$2; // uid for batching
  48746. this.active = true;
  48747. this.dirty = this.lazy; // for lazy watchers
  48748. this.deps = [];
  48749. this.newDeps = [];
  48750. this.depIds = new _Set();
  48751. this.newDepIds = new _Set();
  48752. this.expression = expOrFn.toString();
  48753. // parse expression for getter
  48754. if (typeof expOrFn === 'function') {
  48755. this.getter = expOrFn;
  48756. } else {
  48757. this.getter = parsePath(expOrFn);
  48758. if (!this.getter) {
  48759. this.getter = noop;
  48760. warn(
  48761. "Failed watching path: \"" + expOrFn + "\" " +
  48762. 'Watcher only accepts simple dot-delimited paths. ' +
  48763. 'For full control, use a function instead.',
  48764. vm
  48765. );
  48766. }
  48767. }
  48768. this.value = this.lazy
  48769. ? undefined
  48770. : this.get();
  48771. };
  48772. /**
  48773. * Evaluate the getter, and re-collect dependencies.
  48774. */
  48775. Watcher.prototype.get = function get () {
  48776. pushTarget(this);
  48777. var value;
  48778. var vm = this.vm;
  48779. try {
  48780. value = this.getter.call(vm, vm);
  48781. } catch (e) {
  48782. if (this.user) {
  48783. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48784. } else {
  48785. throw e
  48786. }
  48787. } finally {
  48788. // "touch" every property so they are all tracked as
  48789. // dependencies for deep watching
  48790. if (this.deep) {
  48791. traverse(value);
  48792. }
  48793. popTarget();
  48794. this.cleanupDeps();
  48795. }
  48796. return value
  48797. };
  48798. /**
  48799. * Add a dependency to this directive.
  48800. */
  48801. Watcher.prototype.addDep = function addDep (dep) {
  48802. var id = dep.id;
  48803. if (!this.newDepIds.has(id)) {
  48804. this.newDepIds.add(id);
  48805. this.newDeps.push(dep);
  48806. if (!this.depIds.has(id)) {
  48807. dep.addSub(this);
  48808. }
  48809. }
  48810. };
  48811. /**
  48812. * Clean up for dependency collection.
  48813. */
  48814. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48815. var i = this.deps.length;
  48816. while (i--) {
  48817. var dep = this.deps[i];
  48818. if (!this.newDepIds.has(dep.id)) {
  48819. dep.removeSub(this);
  48820. }
  48821. }
  48822. var tmp = this.depIds;
  48823. this.depIds = this.newDepIds;
  48824. this.newDepIds = tmp;
  48825. this.newDepIds.clear();
  48826. tmp = this.deps;
  48827. this.deps = this.newDeps;
  48828. this.newDeps = tmp;
  48829. this.newDeps.length = 0;
  48830. };
  48831. /**
  48832. * Subscriber interface.
  48833. * Will be called when a dependency changes.
  48834. */
  48835. Watcher.prototype.update = function update () {
  48836. /* istanbul ignore else */
  48837. if (this.lazy) {
  48838. this.dirty = true;
  48839. } else if (this.sync) {
  48840. this.run();
  48841. } else {
  48842. queueWatcher(this);
  48843. }
  48844. };
  48845. /**
  48846. * Scheduler job interface.
  48847. * Will be called by the scheduler.
  48848. */
  48849. Watcher.prototype.run = function run () {
  48850. if (this.active) {
  48851. var value = this.get();
  48852. if (
  48853. value !== this.value ||
  48854. // Deep watchers and watchers on Object/Arrays should fire even
  48855. // when the value is the same, because the value may
  48856. // have mutated.
  48857. isObject(value) ||
  48858. this.deep
  48859. ) {
  48860. // set new value
  48861. var oldValue = this.value;
  48862. this.value = value;
  48863. if (this.user) {
  48864. try {
  48865. this.cb.call(this.vm, value, oldValue);
  48866. } catch (e) {
  48867. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48868. }
  48869. } else {
  48870. this.cb.call(this.vm, value, oldValue);
  48871. }
  48872. }
  48873. }
  48874. };
  48875. /**
  48876. * Evaluate the value of the watcher.
  48877. * This only gets called for lazy watchers.
  48878. */
  48879. Watcher.prototype.evaluate = function evaluate () {
  48880. this.value = this.get();
  48881. this.dirty = false;
  48882. };
  48883. /**
  48884. * Depend on all deps collected by this watcher.
  48885. */
  48886. Watcher.prototype.depend = function depend () {
  48887. var i = this.deps.length;
  48888. while (i--) {
  48889. this.deps[i].depend();
  48890. }
  48891. };
  48892. /**
  48893. * Remove self from all dependencies' subscriber list.
  48894. */
  48895. Watcher.prototype.teardown = function teardown () {
  48896. if (this.active) {
  48897. // remove self from vm's watcher list
  48898. // this is a somewhat expensive operation so we skip it
  48899. // if the vm is being destroyed.
  48900. if (!this.vm._isBeingDestroyed) {
  48901. remove(this.vm._watchers, this);
  48902. }
  48903. var i = this.deps.length;
  48904. while (i--) {
  48905. this.deps[i].removeSub(this);
  48906. }
  48907. this.active = false;
  48908. }
  48909. };
  48910. /* */
  48911. var sharedPropertyDefinition = {
  48912. enumerable: true,
  48913. configurable: true,
  48914. get: noop,
  48915. set: noop
  48916. };
  48917. function proxy (target, sourceKey, key) {
  48918. sharedPropertyDefinition.get = function proxyGetter () {
  48919. return this[sourceKey][key]
  48920. };
  48921. sharedPropertyDefinition.set = function proxySetter (val) {
  48922. this[sourceKey][key] = val;
  48923. };
  48924. Object.defineProperty(target, key, sharedPropertyDefinition);
  48925. }
  48926. function initState (vm) {
  48927. vm._watchers = [];
  48928. var opts = vm.$options;
  48929. if (opts.props) { initProps(vm, opts.props); }
  48930. if (opts.methods) { initMethods(vm, opts.methods); }
  48931. if (opts.data) {
  48932. initData(vm);
  48933. } else {
  48934. observe(vm._data = {}, true /* asRootData */);
  48935. }
  48936. if (opts.computed) { initComputed(vm, opts.computed); }
  48937. if (opts.watch && opts.watch !== nativeWatch) {
  48938. initWatch(vm, opts.watch);
  48939. }
  48940. }
  48941. function initProps (vm, propsOptions) {
  48942. var propsData = vm.$options.propsData || {};
  48943. var props = vm._props = {};
  48944. // cache prop keys so that future props updates can iterate using Array
  48945. // instead of dynamic object key enumeration.
  48946. var keys = vm.$options._propKeys = [];
  48947. var isRoot = !vm.$parent;
  48948. // root instance props should be converted
  48949. if (!isRoot) {
  48950. toggleObserving(false);
  48951. }
  48952. var loop = function ( key ) {
  48953. keys.push(key);
  48954. var value = validateProp(key, propsOptions, propsData, vm);
  48955. /* istanbul ignore else */
  48956. {
  48957. var hyphenatedKey = hyphenate(key);
  48958. if (isReservedAttribute(hyphenatedKey) ||
  48959. config.isReservedAttr(hyphenatedKey)) {
  48960. warn(
  48961. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48962. vm
  48963. );
  48964. }
  48965. defineReactive$$1(props, key, value, function () {
  48966. if (!isRoot && !isUpdatingChildComponent) {
  48967. warn(
  48968. "Avoid mutating a prop directly since the value will be " +
  48969. "overwritten whenever the parent component re-renders. " +
  48970. "Instead, use a data or computed property based on the prop's " +
  48971. "value. Prop being mutated: \"" + key + "\"",
  48972. vm
  48973. );
  48974. }
  48975. });
  48976. }
  48977. // static props are already proxied on the component's prototype
  48978. // during Vue.extend(). We only need to proxy props defined at
  48979. // instantiation here.
  48980. if (!(key in vm)) {
  48981. proxy(vm, "_props", key);
  48982. }
  48983. };
  48984. for (var key in propsOptions) loop( key );
  48985. toggleObserving(true);
  48986. }
  48987. function initData (vm) {
  48988. var data = vm.$options.data;
  48989. data = vm._data = typeof data === 'function'
  48990. ? getData(data, vm)
  48991. : data || {};
  48992. if (!isPlainObject(data)) {
  48993. data = {};
  48994. warn(
  48995. 'data functions should return an object:\n' +
  48996. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48997. vm
  48998. );
  48999. }
  49000. // proxy data on instance
  49001. var keys = Object.keys(data);
  49002. var props = vm.$options.props;
  49003. var methods = vm.$options.methods;
  49004. var i = keys.length;
  49005. while (i--) {
  49006. var key = keys[i];
  49007. {
  49008. if (methods && hasOwn(methods, key)) {
  49009. warn(
  49010. ("Method \"" + key + "\" has already been defined as a data property."),
  49011. vm
  49012. );
  49013. }
  49014. }
  49015. if (props && hasOwn(props, key)) {
  49016. warn(
  49017. "The data property \"" + key + "\" is already declared as a prop. " +
  49018. "Use prop default value instead.",
  49019. vm
  49020. );
  49021. } else if (!isReserved(key)) {
  49022. proxy(vm, "_data", key);
  49023. }
  49024. }
  49025. // observe data
  49026. observe(data, true /* asRootData */);
  49027. }
  49028. function getData (data, vm) {
  49029. // #7573 disable dep collection when invoking data getters
  49030. pushTarget();
  49031. try {
  49032. return data.call(vm, vm)
  49033. } catch (e) {
  49034. handleError(e, vm, "data()");
  49035. return {}
  49036. } finally {
  49037. popTarget();
  49038. }
  49039. }
  49040. var computedWatcherOptions = { lazy: true };
  49041. function initComputed (vm, computed) {
  49042. // $flow-disable-line
  49043. var watchers = vm._computedWatchers = Object.create(null);
  49044. // computed properties are just getters during SSR
  49045. var isSSR = isServerRendering();
  49046. for (var key in computed) {
  49047. var userDef = computed[key];
  49048. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  49049. if (getter == null) {
  49050. warn(
  49051. ("Getter is missing for computed property \"" + key + "\"."),
  49052. vm
  49053. );
  49054. }
  49055. if (!isSSR) {
  49056. // create internal watcher for the computed property.
  49057. watchers[key] = new Watcher(
  49058. vm,
  49059. getter || noop,
  49060. noop,
  49061. computedWatcherOptions
  49062. );
  49063. }
  49064. // component-defined computed properties are already defined on the
  49065. // component prototype. We only need to define computed properties defined
  49066. // at instantiation here.
  49067. if (!(key in vm)) {
  49068. defineComputed(vm, key, userDef);
  49069. } else {
  49070. if (key in vm.$data) {
  49071. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49072. } else if (vm.$options.props && key in vm.$options.props) {
  49073. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49074. }
  49075. }
  49076. }
  49077. }
  49078. function defineComputed (
  49079. target,
  49080. key,
  49081. userDef
  49082. ) {
  49083. var shouldCache = !isServerRendering();
  49084. if (typeof userDef === 'function') {
  49085. sharedPropertyDefinition.get = shouldCache
  49086. ? createComputedGetter(key)
  49087. : createGetterInvoker(userDef);
  49088. sharedPropertyDefinition.set = noop;
  49089. } else {
  49090. sharedPropertyDefinition.get = userDef.get
  49091. ? shouldCache && userDef.cache !== false
  49092. ? createComputedGetter(key)
  49093. : createGetterInvoker(userDef.get)
  49094. : noop;
  49095. sharedPropertyDefinition.set = userDef.set || noop;
  49096. }
  49097. if (sharedPropertyDefinition.set === noop) {
  49098. sharedPropertyDefinition.set = function () {
  49099. warn(
  49100. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49101. this
  49102. );
  49103. };
  49104. }
  49105. Object.defineProperty(target, key, sharedPropertyDefinition);
  49106. }
  49107. function createComputedGetter (key) {
  49108. return function computedGetter () {
  49109. var watcher = this._computedWatchers && this._computedWatchers[key];
  49110. if (watcher) {
  49111. if (watcher.dirty) {
  49112. watcher.evaluate();
  49113. }
  49114. if (Dep.target) {
  49115. watcher.depend();
  49116. }
  49117. return watcher.value
  49118. }
  49119. }
  49120. }
  49121. function createGetterInvoker(fn) {
  49122. return function computedGetter () {
  49123. return fn.call(this, this)
  49124. }
  49125. }
  49126. function initMethods (vm, methods) {
  49127. var props = vm.$options.props;
  49128. for (var key in methods) {
  49129. {
  49130. if (typeof methods[key] !== 'function') {
  49131. warn(
  49132. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49133. "Did you reference the function correctly?",
  49134. vm
  49135. );
  49136. }
  49137. if (props && hasOwn(props, key)) {
  49138. warn(
  49139. ("Method \"" + key + "\" has already been defined as a prop."),
  49140. vm
  49141. );
  49142. }
  49143. if ((key in vm) && isReserved(key)) {
  49144. warn(
  49145. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49146. "Avoid defining component methods that start with _ or $."
  49147. );
  49148. }
  49149. }
  49150. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49151. }
  49152. }
  49153. function initWatch (vm, watch) {
  49154. for (var key in watch) {
  49155. var handler = watch[key];
  49156. if (Array.isArray(handler)) {
  49157. for (var i = 0; i < handler.length; i++) {
  49158. createWatcher(vm, key, handler[i]);
  49159. }
  49160. } else {
  49161. createWatcher(vm, key, handler);
  49162. }
  49163. }
  49164. }
  49165. function createWatcher (
  49166. vm,
  49167. expOrFn,
  49168. handler,
  49169. options
  49170. ) {
  49171. if (isPlainObject(handler)) {
  49172. options = handler;
  49173. handler = handler.handler;
  49174. }
  49175. if (typeof handler === 'string') {
  49176. handler = vm[handler];
  49177. }
  49178. return vm.$watch(expOrFn, handler, options)
  49179. }
  49180. function stateMixin (Vue) {
  49181. // flow somehow has problems with directly declared definition object
  49182. // when using Object.defineProperty, so we have to procedurally build up
  49183. // the object here.
  49184. var dataDef = {};
  49185. dataDef.get = function () { return this._data };
  49186. var propsDef = {};
  49187. propsDef.get = function () { return this._props };
  49188. {
  49189. dataDef.set = function () {
  49190. warn(
  49191. 'Avoid replacing instance root $data. ' +
  49192. 'Use nested data properties instead.',
  49193. this
  49194. );
  49195. };
  49196. propsDef.set = function () {
  49197. warn("$props is readonly.", this);
  49198. };
  49199. }
  49200. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49201. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49202. Vue.prototype.$set = set;
  49203. Vue.prototype.$delete = del;
  49204. Vue.prototype.$watch = function (
  49205. expOrFn,
  49206. cb,
  49207. options
  49208. ) {
  49209. var vm = this;
  49210. if (isPlainObject(cb)) {
  49211. return createWatcher(vm, expOrFn, cb, options)
  49212. }
  49213. options = options || {};
  49214. options.user = true;
  49215. var watcher = new Watcher(vm, expOrFn, cb, options);
  49216. if (options.immediate) {
  49217. try {
  49218. cb.call(vm, watcher.value);
  49219. } catch (error) {
  49220. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49221. }
  49222. }
  49223. return function unwatchFn () {
  49224. watcher.teardown();
  49225. }
  49226. };
  49227. }
  49228. /* */
  49229. var uid$3 = 0;
  49230. function initMixin (Vue) {
  49231. Vue.prototype._init = function (options) {
  49232. var vm = this;
  49233. // a uid
  49234. vm._uid = uid$3++;
  49235. var startTag, endTag;
  49236. /* istanbul ignore if */
  49237. if (config.performance && mark) {
  49238. startTag = "vue-perf-start:" + (vm._uid);
  49239. endTag = "vue-perf-end:" + (vm._uid);
  49240. mark(startTag);
  49241. }
  49242. // a flag to avoid this being observed
  49243. vm._isVue = true;
  49244. // merge options
  49245. if (options && options._isComponent) {
  49246. // optimize internal component instantiation
  49247. // since dynamic options merging is pretty slow, and none of the
  49248. // internal component options needs special treatment.
  49249. initInternalComponent(vm, options);
  49250. } else {
  49251. vm.$options = mergeOptions(
  49252. resolveConstructorOptions(vm.constructor),
  49253. options || {},
  49254. vm
  49255. );
  49256. }
  49257. /* istanbul ignore else */
  49258. {
  49259. initProxy(vm);
  49260. }
  49261. // expose real self
  49262. vm._self = vm;
  49263. initLifecycle(vm);
  49264. initEvents(vm);
  49265. initRender(vm);
  49266. callHook(vm, 'beforeCreate');
  49267. initInjections(vm); // resolve injections before data/props
  49268. initState(vm);
  49269. initProvide(vm); // resolve provide after data/props
  49270. callHook(vm, 'created');
  49271. /* istanbul ignore if */
  49272. if (config.performance && mark) {
  49273. vm._name = formatComponentName(vm, false);
  49274. mark(endTag);
  49275. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49276. }
  49277. if (vm.$options.el) {
  49278. vm.$mount(vm.$options.el);
  49279. }
  49280. };
  49281. }
  49282. function initInternalComponent (vm, options) {
  49283. var opts = vm.$options = Object.create(vm.constructor.options);
  49284. // doing this because it's faster than dynamic enumeration.
  49285. var parentVnode = options._parentVnode;
  49286. opts.parent = options.parent;
  49287. opts._parentVnode = parentVnode;
  49288. var vnodeComponentOptions = parentVnode.componentOptions;
  49289. opts.propsData = vnodeComponentOptions.propsData;
  49290. opts._parentListeners = vnodeComponentOptions.listeners;
  49291. opts._renderChildren = vnodeComponentOptions.children;
  49292. opts._componentTag = vnodeComponentOptions.tag;
  49293. if (options.render) {
  49294. opts.render = options.render;
  49295. opts.staticRenderFns = options.staticRenderFns;
  49296. }
  49297. }
  49298. function resolveConstructorOptions (Ctor) {
  49299. var options = Ctor.options;
  49300. if (Ctor.super) {
  49301. var superOptions = resolveConstructorOptions(Ctor.super);
  49302. var cachedSuperOptions = Ctor.superOptions;
  49303. if (superOptions !== cachedSuperOptions) {
  49304. // super option changed,
  49305. // need to resolve new options.
  49306. Ctor.superOptions = superOptions;
  49307. // check if there are any late-modified/attached options (#4976)
  49308. var modifiedOptions = resolveModifiedOptions(Ctor);
  49309. // update base extend options
  49310. if (modifiedOptions) {
  49311. extend(Ctor.extendOptions, modifiedOptions);
  49312. }
  49313. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49314. if (options.name) {
  49315. options.components[options.name] = Ctor;
  49316. }
  49317. }
  49318. }
  49319. return options
  49320. }
  49321. function resolveModifiedOptions (Ctor) {
  49322. var modified;
  49323. var latest = Ctor.options;
  49324. var sealed = Ctor.sealedOptions;
  49325. for (var key in latest) {
  49326. if (latest[key] !== sealed[key]) {
  49327. if (!modified) { modified = {}; }
  49328. modified[key] = latest[key];
  49329. }
  49330. }
  49331. return modified
  49332. }
  49333. function Vue (options) {
  49334. if (!(this instanceof Vue)
  49335. ) {
  49336. warn('Vue is a constructor and should be called with the `new` keyword');
  49337. }
  49338. this._init(options);
  49339. }
  49340. initMixin(Vue);
  49341. stateMixin(Vue);
  49342. eventsMixin(Vue);
  49343. lifecycleMixin(Vue);
  49344. renderMixin(Vue);
  49345. /* */
  49346. function initUse (Vue) {
  49347. Vue.use = function (plugin) {
  49348. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49349. if (installedPlugins.indexOf(plugin) > -1) {
  49350. return this
  49351. }
  49352. // additional parameters
  49353. var args = toArray(arguments, 1);
  49354. args.unshift(this);
  49355. if (typeof plugin.install === 'function') {
  49356. plugin.install.apply(plugin, args);
  49357. } else if (typeof plugin === 'function') {
  49358. plugin.apply(null, args);
  49359. }
  49360. installedPlugins.push(plugin);
  49361. return this
  49362. };
  49363. }
  49364. /* */
  49365. function initMixin$1 (Vue) {
  49366. Vue.mixin = function (mixin) {
  49367. this.options = mergeOptions(this.options, mixin);
  49368. return this
  49369. };
  49370. }
  49371. /* */
  49372. function initExtend (Vue) {
  49373. /**
  49374. * Each instance constructor, including Vue, has a unique
  49375. * cid. This enables us to create wrapped "child
  49376. * constructors" for prototypal inheritance and cache them.
  49377. */
  49378. Vue.cid = 0;
  49379. var cid = 1;
  49380. /**
  49381. * Class inheritance
  49382. */
  49383. Vue.extend = function (extendOptions) {
  49384. extendOptions = extendOptions || {};
  49385. var Super = this;
  49386. var SuperId = Super.cid;
  49387. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49388. if (cachedCtors[SuperId]) {
  49389. return cachedCtors[SuperId]
  49390. }
  49391. var name = extendOptions.name || Super.options.name;
  49392. if (name) {
  49393. validateComponentName(name);
  49394. }
  49395. var Sub = function VueComponent (options) {
  49396. this._init(options);
  49397. };
  49398. Sub.prototype = Object.create(Super.prototype);
  49399. Sub.prototype.constructor = Sub;
  49400. Sub.cid = cid++;
  49401. Sub.options = mergeOptions(
  49402. Super.options,
  49403. extendOptions
  49404. );
  49405. Sub['super'] = Super;
  49406. // For props and computed properties, we define the proxy getters on
  49407. // the Vue instances at extension time, on the extended prototype. This
  49408. // avoids Object.defineProperty calls for each instance created.
  49409. if (Sub.options.props) {
  49410. initProps$1(Sub);
  49411. }
  49412. if (Sub.options.computed) {
  49413. initComputed$1(Sub);
  49414. }
  49415. // allow further extension/mixin/plugin usage
  49416. Sub.extend = Super.extend;
  49417. Sub.mixin = Super.mixin;
  49418. Sub.use = Super.use;
  49419. // create asset registers, so extended classes
  49420. // can have their private assets too.
  49421. ASSET_TYPES.forEach(function (type) {
  49422. Sub[type] = Super[type];
  49423. });
  49424. // enable recursive self-lookup
  49425. if (name) {
  49426. Sub.options.components[name] = Sub;
  49427. }
  49428. // keep a reference to the super options at extension time.
  49429. // later at instantiation we can check if Super's options have
  49430. // been updated.
  49431. Sub.superOptions = Super.options;
  49432. Sub.extendOptions = extendOptions;
  49433. Sub.sealedOptions = extend({}, Sub.options);
  49434. // cache constructor
  49435. cachedCtors[SuperId] = Sub;
  49436. return Sub
  49437. };
  49438. }
  49439. function initProps$1 (Comp) {
  49440. var props = Comp.options.props;
  49441. for (var key in props) {
  49442. proxy(Comp.prototype, "_props", key);
  49443. }
  49444. }
  49445. function initComputed$1 (Comp) {
  49446. var computed = Comp.options.computed;
  49447. for (var key in computed) {
  49448. defineComputed(Comp.prototype, key, computed[key]);
  49449. }
  49450. }
  49451. /* */
  49452. function initAssetRegisters (Vue) {
  49453. /**
  49454. * Create asset registration methods.
  49455. */
  49456. ASSET_TYPES.forEach(function (type) {
  49457. Vue[type] = function (
  49458. id,
  49459. definition
  49460. ) {
  49461. if (!definition) {
  49462. return this.options[type + 's'][id]
  49463. } else {
  49464. /* istanbul ignore if */
  49465. if (type === 'component') {
  49466. validateComponentName(id);
  49467. }
  49468. if (type === 'component' && isPlainObject(definition)) {
  49469. definition.name = definition.name || id;
  49470. definition = this.options._base.extend(definition);
  49471. }
  49472. if (type === 'directive' && typeof definition === 'function') {
  49473. definition = { bind: definition, update: definition };
  49474. }
  49475. this.options[type + 's'][id] = definition;
  49476. return definition
  49477. }
  49478. };
  49479. });
  49480. }
  49481. /* */
  49482. function getComponentName (opts) {
  49483. return opts && (opts.Ctor.options.name || opts.tag)
  49484. }
  49485. function matches (pattern, name) {
  49486. if (Array.isArray(pattern)) {
  49487. return pattern.indexOf(name) > -1
  49488. } else if (typeof pattern === 'string') {
  49489. return pattern.split(',').indexOf(name) > -1
  49490. } else if (isRegExp(pattern)) {
  49491. return pattern.test(name)
  49492. }
  49493. /* istanbul ignore next */
  49494. return false
  49495. }
  49496. function pruneCache (keepAliveInstance, filter) {
  49497. var cache = keepAliveInstance.cache;
  49498. var keys = keepAliveInstance.keys;
  49499. var _vnode = keepAliveInstance._vnode;
  49500. for (var key in cache) {
  49501. var cachedNode = cache[key];
  49502. if (cachedNode) {
  49503. var name = getComponentName(cachedNode.componentOptions);
  49504. if (name && !filter(name)) {
  49505. pruneCacheEntry(cache, key, keys, _vnode);
  49506. }
  49507. }
  49508. }
  49509. }
  49510. function pruneCacheEntry (
  49511. cache,
  49512. key,
  49513. keys,
  49514. current
  49515. ) {
  49516. var cached$$1 = cache[key];
  49517. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49518. cached$$1.componentInstance.$destroy();
  49519. }
  49520. cache[key] = null;
  49521. remove(keys, key);
  49522. }
  49523. var patternTypes = [String, RegExp, Array];
  49524. var KeepAlive = {
  49525. name: 'keep-alive',
  49526. abstract: true,
  49527. props: {
  49528. include: patternTypes,
  49529. exclude: patternTypes,
  49530. max: [String, Number]
  49531. },
  49532. created: function created () {
  49533. this.cache = Object.create(null);
  49534. this.keys = [];
  49535. },
  49536. destroyed: function destroyed () {
  49537. for (var key in this.cache) {
  49538. pruneCacheEntry(this.cache, key, this.keys);
  49539. }
  49540. },
  49541. mounted: function mounted () {
  49542. var this$1 = this;
  49543. this.$watch('include', function (val) {
  49544. pruneCache(this$1, function (name) { return matches(val, name); });
  49545. });
  49546. this.$watch('exclude', function (val) {
  49547. pruneCache(this$1, function (name) { return !matches(val, name); });
  49548. });
  49549. },
  49550. render: function render () {
  49551. var slot = this.$slots.default;
  49552. var vnode = getFirstComponentChild(slot);
  49553. var componentOptions = vnode && vnode.componentOptions;
  49554. if (componentOptions) {
  49555. // check pattern
  49556. var name = getComponentName(componentOptions);
  49557. var ref = this;
  49558. var include = ref.include;
  49559. var exclude = ref.exclude;
  49560. if (
  49561. // not included
  49562. (include && (!name || !matches(include, name))) ||
  49563. // excluded
  49564. (exclude && name && matches(exclude, name))
  49565. ) {
  49566. return vnode
  49567. }
  49568. var ref$1 = this;
  49569. var cache = ref$1.cache;
  49570. var keys = ref$1.keys;
  49571. var key = vnode.key == null
  49572. // same constructor may get registered as different local components
  49573. // so cid alone is not enough (#3269)
  49574. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49575. : vnode.key;
  49576. if (cache[key]) {
  49577. vnode.componentInstance = cache[key].componentInstance;
  49578. // make current key freshest
  49579. remove(keys, key);
  49580. keys.push(key);
  49581. } else {
  49582. cache[key] = vnode;
  49583. keys.push(key);
  49584. // prune oldest entry
  49585. if (this.max && keys.length > parseInt(this.max)) {
  49586. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49587. }
  49588. }
  49589. vnode.data.keepAlive = true;
  49590. }
  49591. return vnode || (slot && slot[0])
  49592. }
  49593. };
  49594. var builtInComponents = {
  49595. KeepAlive: KeepAlive
  49596. };
  49597. /* */
  49598. function initGlobalAPI (Vue) {
  49599. // config
  49600. var configDef = {};
  49601. configDef.get = function () { return config; };
  49602. {
  49603. configDef.set = function () {
  49604. warn(
  49605. 'Do not replace the Vue.config object, set individual fields instead.'
  49606. );
  49607. };
  49608. }
  49609. Object.defineProperty(Vue, 'config', configDef);
  49610. // exposed util methods.
  49611. // NOTE: these are not considered part of the public API - avoid relying on
  49612. // them unless you are aware of the risk.
  49613. Vue.util = {
  49614. warn: warn,
  49615. extend: extend,
  49616. mergeOptions: mergeOptions,
  49617. defineReactive: defineReactive$$1
  49618. };
  49619. Vue.set = set;
  49620. Vue.delete = del;
  49621. Vue.nextTick = nextTick;
  49622. // 2.6 explicit observable API
  49623. Vue.observable = function (obj) {
  49624. observe(obj);
  49625. return obj
  49626. };
  49627. Vue.options = Object.create(null);
  49628. ASSET_TYPES.forEach(function (type) {
  49629. Vue.options[type + 's'] = Object.create(null);
  49630. });
  49631. // this is used to identify the "base" constructor to extend all plain-object
  49632. // components with in Weex's multi-instance scenarios.
  49633. Vue.options._base = Vue;
  49634. extend(Vue.options.components, builtInComponents);
  49635. initUse(Vue);
  49636. initMixin$1(Vue);
  49637. initExtend(Vue);
  49638. initAssetRegisters(Vue);
  49639. }
  49640. initGlobalAPI(Vue);
  49641. Object.defineProperty(Vue.prototype, '$isServer', {
  49642. get: isServerRendering
  49643. });
  49644. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49645. get: function get () {
  49646. /* istanbul ignore next */
  49647. return this.$vnode && this.$vnode.ssrContext
  49648. }
  49649. });
  49650. // expose FunctionalRenderContext for ssr runtime helper installation
  49651. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49652. value: FunctionalRenderContext
  49653. });
  49654. Vue.version = '2.6.11';
  49655. /* */
  49656. // these are reserved for web because they are directly compiled away
  49657. // during template compilation
  49658. var isReservedAttr = makeMap('style,class');
  49659. // attributes that should be using props for binding
  49660. var acceptValue = makeMap('input,textarea,option,select,progress');
  49661. var mustUseProp = function (tag, type, attr) {
  49662. return (
  49663. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49664. (attr === 'selected' && tag === 'option') ||
  49665. (attr === 'checked' && tag === 'input') ||
  49666. (attr === 'muted' && tag === 'video')
  49667. )
  49668. };
  49669. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49670. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49671. var convertEnumeratedValue = function (key, value) {
  49672. return isFalsyAttrValue(value) || value === 'false'
  49673. ? 'false'
  49674. // allow arbitrary string value for contenteditable
  49675. : key === 'contenteditable' && isValidContentEditableValue(value)
  49676. ? value
  49677. : 'true'
  49678. };
  49679. var isBooleanAttr = makeMap(
  49680. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49681. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49682. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49683. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49684. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49685. 'truespeed,typemustmatch,visible'
  49686. );
  49687. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49688. var isXlink = function (name) {
  49689. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49690. };
  49691. var getXlinkProp = function (name) {
  49692. return isXlink(name) ? name.slice(6, name.length) : ''
  49693. };
  49694. var isFalsyAttrValue = function (val) {
  49695. return val == null || val === false
  49696. };
  49697. /* */
  49698. function genClassForVnode (vnode) {
  49699. var data = vnode.data;
  49700. var parentNode = vnode;
  49701. var childNode = vnode;
  49702. while (isDef(childNode.componentInstance)) {
  49703. childNode = childNode.componentInstance._vnode;
  49704. if (childNode && childNode.data) {
  49705. data = mergeClassData(childNode.data, data);
  49706. }
  49707. }
  49708. while (isDef(parentNode = parentNode.parent)) {
  49709. if (parentNode && parentNode.data) {
  49710. data = mergeClassData(data, parentNode.data);
  49711. }
  49712. }
  49713. return renderClass(data.staticClass, data.class)
  49714. }
  49715. function mergeClassData (child, parent) {
  49716. return {
  49717. staticClass: concat(child.staticClass, parent.staticClass),
  49718. class: isDef(child.class)
  49719. ? [child.class, parent.class]
  49720. : parent.class
  49721. }
  49722. }
  49723. function renderClass (
  49724. staticClass,
  49725. dynamicClass
  49726. ) {
  49727. if (isDef(staticClass) || isDef(dynamicClass)) {
  49728. return concat(staticClass, stringifyClass(dynamicClass))
  49729. }
  49730. /* istanbul ignore next */
  49731. return ''
  49732. }
  49733. function concat (a, b) {
  49734. return a ? b ? (a + ' ' + b) : a : (b || '')
  49735. }
  49736. function stringifyClass (value) {
  49737. if (Array.isArray(value)) {
  49738. return stringifyArray(value)
  49739. }
  49740. if (isObject(value)) {
  49741. return stringifyObject(value)
  49742. }
  49743. if (typeof value === 'string') {
  49744. return value
  49745. }
  49746. /* istanbul ignore next */
  49747. return ''
  49748. }
  49749. function stringifyArray (value) {
  49750. var res = '';
  49751. var stringified;
  49752. for (var i = 0, l = value.length; i < l; i++) {
  49753. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49754. if (res) { res += ' '; }
  49755. res += stringified;
  49756. }
  49757. }
  49758. return res
  49759. }
  49760. function stringifyObject (value) {
  49761. var res = '';
  49762. for (var key in value) {
  49763. if (value[key]) {
  49764. if (res) { res += ' '; }
  49765. res += key;
  49766. }
  49767. }
  49768. return res
  49769. }
  49770. /* */
  49771. var namespaceMap = {
  49772. svg: 'http://www.w3.org/2000/svg',
  49773. math: 'http://www.w3.org/1998/Math/MathML'
  49774. };
  49775. var isHTMLTag = makeMap(
  49776. 'html,body,base,head,link,meta,style,title,' +
  49777. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49778. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49779. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49780. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49781. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49782. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49783. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49784. 'output,progress,select,textarea,' +
  49785. 'details,dialog,menu,menuitem,summary,' +
  49786. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49787. );
  49788. // this map is intentionally selective, only covering SVG elements that may
  49789. // contain child elements.
  49790. var isSVG = makeMap(
  49791. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49792. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49793. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49794. true
  49795. );
  49796. var isPreTag = function (tag) { return tag === 'pre'; };
  49797. var isReservedTag = function (tag) {
  49798. return isHTMLTag(tag) || isSVG(tag)
  49799. };
  49800. function getTagNamespace (tag) {
  49801. if (isSVG(tag)) {
  49802. return 'svg'
  49803. }
  49804. // basic support for MathML
  49805. // note it doesn't support other MathML elements being component roots
  49806. if (tag === 'math') {
  49807. return 'math'
  49808. }
  49809. }
  49810. var unknownElementCache = Object.create(null);
  49811. function isUnknownElement (tag) {
  49812. /* istanbul ignore if */
  49813. if (!inBrowser) {
  49814. return true
  49815. }
  49816. if (isReservedTag(tag)) {
  49817. return false
  49818. }
  49819. tag = tag.toLowerCase();
  49820. /* istanbul ignore if */
  49821. if (unknownElementCache[tag] != null) {
  49822. return unknownElementCache[tag]
  49823. }
  49824. var el = document.createElement(tag);
  49825. if (tag.indexOf('-') > -1) {
  49826. // http://stackoverflow.com/a/28210364/1070244
  49827. return (unknownElementCache[tag] = (
  49828. el.constructor === window.HTMLUnknownElement ||
  49829. el.constructor === window.HTMLElement
  49830. ))
  49831. } else {
  49832. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49833. }
  49834. }
  49835. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49836. /* */
  49837. /**
  49838. * Query an element selector if it's not an element already.
  49839. */
  49840. function query (el) {
  49841. if (typeof el === 'string') {
  49842. var selected = document.querySelector(el);
  49843. if (!selected) {
  49844. warn(
  49845. 'Cannot find element: ' + el
  49846. );
  49847. return document.createElement('div')
  49848. }
  49849. return selected
  49850. } else {
  49851. return el
  49852. }
  49853. }
  49854. /* */
  49855. function createElement$1 (tagName, vnode) {
  49856. var elm = document.createElement(tagName);
  49857. if (tagName !== 'select') {
  49858. return elm
  49859. }
  49860. // false or null will remove the attribute but undefined will not
  49861. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49862. elm.setAttribute('multiple', 'multiple');
  49863. }
  49864. return elm
  49865. }
  49866. function createElementNS (namespace, tagName) {
  49867. return document.createElementNS(namespaceMap[namespace], tagName)
  49868. }
  49869. function createTextNode (text) {
  49870. return document.createTextNode(text)
  49871. }
  49872. function createComment (text) {
  49873. return document.createComment(text)
  49874. }
  49875. function insertBefore (parentNode, newNode, referenceNode) {
  49876. parentNode.insertBefore(newNode, referenceNode);
  49877. }
  49878. function removeChild (node, child) {
  49879. node.removeChild(child);
  49880. }
  49881. function appendChild (node, child) {
  49882. node.appendChild(child);
  49883. }
  49884. function parentNode (node) {
  49885. return node.parentNode
  49886. }
  49887. function nextSibling (node) {
  49888. return node.nextSibling
  49889. }
  49890. function tagName (node) {
  49891. return node.tagName
  49892. }
  49893. function setTextContent (node, text) {
  49894. node.textContent = text;
  49895. }
  49896. function setStyleScope (node, scopeId) {
  49897. node.setAttribute(scopeId, '');
  49898. }
  49899. var nodeOps = /*#__PURE__*/Object.freeze({
  49900. createElement: createElement$1,
  49901. createElementNS: createElementNS,
  49902. createTextNode: createTextNode,
  49903. createComment: createComment,
  49904. insertBefore: insertBefore,
  49905. removeChild: removeChild,
  49906. appendChild: appendChild,
  49907. parentNode: parentNode,
  49908. nextSibling: nextSibling,
  49909. tagName: tagName,
  49910. setTextContent: setTextContent,
  49911. setStyleScope: setStyleScope
  49912. });
  49913. /* */
  49914. var ref = {
  49915. create: function create (_, vnode) {
  49916. registerRef(vnode);
  49917. },
  49918. update: function update (oldVnode, vnode) {
  49919. if (oldVnode.data.ref !== vnode.data.ref) {
  49920. registerRef(oldVnode, true);
  49921. registerRef(vnode);
  49922. }
  49923. },
  49924. destroy: function destroy (vnode) {
  49925. registerRef(vnode, true);
  49926. }
  49927. };
  49928. function registerRef (vnode, isRemoval) {
  49929. var key = vnode.data.ref;
  49930. if (!isDef(key)) { return }
  49931. var vm = vnode.context;
  49932. var ref = vnode.componentInstance || vnode.elm;
  49933. var refs = vm.$refs;
  49934. if (isRemoval) {
  49935. if (Array.isArray(refs[key])) {
  49936. remove(refs[key], ref);
  49937. } else if (refs[key] === ref) {
  49938. refs[key] = undefined;
  49939. }
  49940. } else {
  49941. if (vnode.data.refInFor) {
  49942. if (!Array.isArray(refs[key])) {
  49943. refs[key] = [ref];
  49944. } else if (refs[key].indexOf(ref) < 0) {
  49945. // $flow-disable-line
  49946. refs[key].push(ref);
  49947. }
  49948. } else {
  49949. refs[key] = ref;
  49950. }
  49951. }
  49952. }
  49953. /**
  49954. * Virtual DOM patching algorithm based on Snabbdom by
  49955. * Simon Friis Vindum (@paldepind)
  49956. * Licensed under the MIT License
  49957. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49958. *
  49959. * modified by Evan You (@yyx990803)
  49960. *
  49961. * Not type-checking this because this file is perf-critical and the cost
  49962. * of making flow understand it is not worth it.
  49963. */
  49964. var emptyNode = new VNode('', {}, []);
  49965. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49966. function sameVnode (a, b) {
  49967. return (
  49968. a.key === b.key && (
  49969. (
  49970. a.tag === b.tag &&
  49971. a.isComment === b.isComment &&
  49972. isDef(a.data) === isDef(b.data) &&
  49973. sameInputType(a, b)
  49974. ) || (
  49975. isTrue(a.isAsyncPlaceholder) &&
  49976. a.asyncFactory === b.asyncFactory &&
  49977. isUndef(b.asyncFactory.error)
  49978. )
  49979. )
  49980. )
  49981. }
  49982. function sameInputType (a, b) {
  49983. if (a.tag !== 'input') { return true }
  49984. var i;
  49985. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49986. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49987. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49988. }
  49989. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49990. var i, key;
  49991. var map = {};
  49992. for (i = beginIdx; i <= endIdx; ++i) {
  49993. key = children[i].key;
  49994. if (isDef(key)) { map[key] = i; }
  49995. }
  49996. return map
  49997. }
  49998. function createPatchFunction (backend) {
  49999. var i, j;
  50000. var cbs = {};
  50001. var modules = backend.modules;
  50002. var nodeOps = backend.nodeOps;
  50003. for (i = 0; i < hooks.length; ++i) {
  50004. cbs[hooks[i]] = [];
  50005. for (j = 0; j < modules.length; ++j) {
  50006. if (isDef(modules[j][hooks[i]])) {
  50007. cbs[hooks[i]].push(modules[j][hooks[i]]);
  50008. }
  50009. }
  50010. }
  50011. function emptyNodeAt (elm) {
  50012. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  50013. }
  50014. function createRmCb (childElm, listeners) {
  50015. function remove$$1 () {
  50016. if (--remove$$1.listeners === 0) {
  50017. removeNode(childElm);
  50018. }
  50019. }
  50020. remove$$1.listeners = listeners;
  50021. return remove$$1
  50022. }
  50023. function removeNode (el) {
  50024. var parent = nodeOps.parentNode(el);
  50025. // element may have already been removed due to v-html / v-text
  50026. if (isDef(parent)) {
  50027. nodeOps.removeChild(parent, el);
  50028. }
  50029. }
  50030. function isUnknownElement$$1 (vnode, inVPre) {
  50031. return (
  50032. !inVPre &&
  50033. !vnode.ns &&
  50034. !(
  50035. config.ignoredElements.length &&
  50036. config.ignoredElements.some(function (ignore) {
  50037. return isRegExp(ignore)
  50038. ? ignore.test(vnode.tag)
  50039. : ignore === vnode.tag
  50040. })
  50041. ) &&
  50042. config.isUnknownElement(vnode.tag)
  50043. )
  50044. }
  50045. var creatingElmInVPre = 0;
  50046. function createElm (
  50047. vnode,
  50048. insertedVnodeQueue,
  50049. parentElm,
  50050. refElm,
  50051. nested,
  50052. ownerArray,
  50053. index
  50054. ) {
  50055. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50056. // This vnode was used in a previous render!
  50057. // now it's used as a new node, overwriting its elm would cause
  50058. // potential patch errors down the road when it's used as an insertion
  50059. // reference node. Instead, we clone the node on-demand before creating
  50060. // associated DOM element for it.
  50061. vnode = ownerArray[index] = cloneVNode(vnode);
  50062. }
  50063. vnode.isRootInsert = !nested; // for transition enter check
  50064. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  50065. return
  50066. }
  50067. var data = vnode.data;
  50068. var children = vnode.children;
  50069. var tag = vnode.tag;
  50070. if (isDef(tag)) {
  50071. {
  50072. if (data && data.pre) {
  50073. creatingElmInVPre++;
  50074. }
  50075. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50076. warn(
  50077. 'Unknown custom element: <' + tag + '> - did you ' +
  50078. 'register the component correctly? For recursive components, ' +
  50079. 'make sure to provide the "name" option.',
  50080. vnode.context
  50081. );
  50082. }
  50083. }
  50084. vnode.elm = vnode.ns
  50085. ? nodeOps.createElementNS(vnode.ns, tag)
  50086. : nodeOps.createElement(tag, vnode);
  50087. setScope(vnode);
  50088. /* istanbul ignore if */
  50089. {
  50090. createChildren(vnode, children, insertedVnodeQueue);
  50091. if (isDef(data)) {
  50092. invokeCreateHooks(vnode, insertedVnodeQueue);
  50093. }
  50094. insert(parentElm, vnode.elm, refElm);
  50095. }
  50096. if (data && data.pre) {
  50097. creatingElmInVPre--;
  50098. }
  50099. } else if (isTrue(vnode.isComment)) {
  50100. vnode.elm = nodeOps.createComment(vnode.text);
  50101. insert(parentElm, vnode.elm, refElm);
  50102. } else {
  50103. vnode.elm = nodeOps.createTextNode(vnode.text);
  50104. insert(parentElm, vnode.elm, refElm);
  50105. }
  50106. }
  50107. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50108. var i = vnode.data;
  50109. if (isDef(i)) {
  50110. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50111. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50112. i(vnode, false /* hydrating */);
  50113. }
  50114. // after calling the init hook, if the vnode is a child component
  50115. // it should've created a child instance and mounted it. the child
  50116. // component also has set the placeholder vnode's elm.
  50117. // in that case we can just return the element and be done.
  50118. if (isDef(vnode.componentInstance)) {
  50119. initComponent(vnode, insertedVnodeQueue);
  50120. insert(parentElm, vnode.elm, refElm);
  50121. if (isTrue(isReactivated)) {
  50122. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50123. }
  50124. return true
  50125. }
  50126. }
  50127. }
  50128. function initComponent (vnode, insertedVnodeQueue) {
  50129. if (isDef(vnode.data.pendingInsert)) {
  50130. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50131. vnode.data.pendingInsert = null;
  50132. }
  50133. vnode.elm = vnode.componentInstance.$el;
  50134. if (isPatchable(vnode)) {
  50135. invokeCreateHooks(vnode, insertedVnodeQueue);
  50136. setScope(vnode);
  50137. } else {
  50138. // empty component root.
  50139. // skip all element-related modules except for ref (#3455)
  50140. registerRef(vnode);
  50141. // make sure to invoke the insert hook
  50142. insertedVnodeQueue.push(vnode);
  50143. }
  50144. }
  50145. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50146. var i;
  50147. // hack for #4339: a reactivated component with inner transition
  50148. // does not trigger because the inner node's created hooks are not called
  50149. // again. It's not ideal to involve module-specific logic in here but
  50150. // there doesn't seem to be a better way to do it.
  50151. var innerNode = vnode;
  50152. while (innerNode.componentInstance) {
  50153. innerNode = innerNode.componentInstance._vnode;
  50154. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50155. for (i = 0; i < cbs.activate.length; ++i) {
  50156. cbs.activate[i](emptyNode, innerNode);
  50157. }
  50158. insertedVnodeQueue.push(innerNode);
  50159. break
  50160. }
  50161. }
  50162. // unlike a newly created component,
  50163. // a reactivated keep-alive component doesn't insert itself
  50164. insert(parentElm, vnode.elm, refElm);
  50165. }
  50166. function insert (parent, elm, ref$$1) {
  50167. if (isDef(parent)) {
  50168. if (isDef(ref$$1)) {
  50169. if (nodeOps.parentNode(ref$$1) === parent) {
  50170. nodeOps.insertBefore(parent, elm, ref$$1);
  50171. }
  50172. } else {
  50173. nodeOps.appendChild(parent, elm);
  50174. }
  50175. }
  50176. }
  50177. function createChildren (vnode, children, insertedVnodeQueue) {
  50178. if (Array.isArray(children)) {
  50179. {
  50180. checkDuplicateKeys(children);
  50181. }
  50182. for (var i = 0; i < children.length; ++i) {
  50183. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50184. }
  50185. } else if (isPrimitive(vnode.text)) {
  50186. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50187. }
  50188. }
  50189. function isPatchable (vnode) {
  50190. while (vnode.componentInstance) {
  50191. vnode = vnode.componentInstance._vnode;
  50192. }
  50193. return isDef(vnode.tag)
  50194. }
  50195. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50196. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50197. cbs.create[i$1](emptyNode, vnode);
  50198. }
  50199. i = vnode.data.hook; // Reuse variable
  50200. if (isDef(i)) {
  50201. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50202. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50203. }
  50204. }
  50205. // set scope id attribute for scoped CSS.
  50206. // this is implemented as a special case to avoid the overhead
  50207. // of going through the normal attribute patching process.
  50208. function setScope (vnode) {
  50209. var i;
  50210. if (isDef(i = vnode.fnScopeId)) {
  50211. nodeOps.setStyleScope(vnode.elm, i);
  50212. } else {
  50213. var ancestor = vnode;
  50214. while (ancestor) {
  50215. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50216. nodeOps.setStyleScope(vnode.elm, i);
  50217. }
  50218. ancestor = ancestor.parent;
  50219. }
  50220. }
  50221. // for slot content they should also get the scopeId from the host instance.
  50222. if (isDef(i = activeInstance) &&
  50223. i !== vnode.context &&
  50224. i !== vnode.fnContext &&
  50225. isDef(i = i.$options._scopeId)
  50226. ) {
  50227. nodeOps.setStyleScope(vnode.elm, i);
  50228. }
  50229. }
  50230. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50231. for (; startIdx <= endIdx; ++startIdx) {
  50232. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50233. }
  50234. }
  50235. function invokeDestroyHook (vnode) {
  50236. var i, j;
  50237. var data = vnode.data;
  50238. if (isDef(data)) {
  50239. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50240. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50241. }
  50242. if (isDef(i = vnode.children)) {
  50243. for (j = 0; j < vnode.children.length; ++j) {
  50244. invokeDestroyHook(vnode.children[j]);
  50245. }
  50246. }
  50247. }
  50248. function removeVnodes (vnodes, startIdx, endIdx) {
  50249. for (; startIdx <= endIdx; ++startIdx) {
  50250. var ch = vnodes[startIdx];
  50251. if (isDef(ch)) {
  50252. if (isDef(ch.tag)) {
  50253. removeAndInvokeRemoveHook(ch);
  50254. invokeDestroyHook(ch);
  50255. } else { // Text node
  50256. removeNode(ch.elm);
  50257. }
  50258. }
  50259. }
  50260. }
  50261. function removeAndInvokeRemoveHook (vnode, rm) {
  50262. if (isDef(rm) || isDef(vnode.data)) {
  50263. var i;
  50264. var listeners = cbs.remove.length + 1;
  50265. if (isDef(rm)) {
  50266. // we have a recursively passed down rm callback
  50267. // increase the listeners count
  50268. rm.listeners += listeners;
  50269. } else {
  50270. // directly removing
  50271. rm = createRmCb(vnode.elm, listeners);
  50272. }
  50273. // recursively invoke hooks on child component root node
  50274. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50275. removeAndInvokeRemoveHook(i, rm);
  50276. }
  50277. for (i = 0; i < cbs.remove.length; ++i) {
  50278. cbs.remove[i](vnode, rm);
  50279. }
  50280. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50281. i(vnode, rm);
  50282. } else {
  50283. rm();
  50284. }
  50285. } else {
  50286. removeNode(vnode.elm);
  50287. }
  50288. }
  50289. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50290. var oldStartIdx = 0;
  50291. var newStartIdx = 0;
  50292. var oldEndIdx = oldCh.length - 1;
  50293. var oldStartVnode = oldCh[0];
  50294. var oldEndVnode = oldCh[oldEndIdx];
  50295. var newEndIdx = newCh.length - 1;
  50296. var newStartVnode = newCh[0];
  50297. var newEndVnode = newCh[newEndIdx];
  50298. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50299. // removeOnly is a special flag used only by <transition-group>
  50300. // to ensure removed elements stay in correct relative positions
  50301. // during leaving transitions
  50302. var canMove = !removeOnly;
  50303. {
  50304. checkDuplicateKeys(newCh);
  50305. }
  50306. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50307. if (isUndef(oldStartVnode)) {
  50308. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50309. } else if (isUndef(oldEndVnode)) {
  50310. oldEndVnode = oldCh[--oldEndIdx];
  50311. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50312. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50313. oldStartVnode = oldCh[++oldStartIdx];
  50314. newStartVnode = newCh[++newStartIdx];
  50315. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50316. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50317. oldEndVnode = oldCh[--oldEndIdx];
  50318. newEndVnode = newCh[--newEndIdx];
  50319. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50320. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50321. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50322. oldStartVnode = oldCh[++oldStartIdx];
  50323. newEndVnode = newCh[--newEndIdx];
  50324. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50325. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50326. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50327. oldEndVnode = oldCh[--oldEndIdx];
  50328. newStartVnode = newCh[++newStartIdx];
  50329. } else {
  50330. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50331. idxInOld = isDef(newStartVnode.key)
  50332. ? oldKeyToIdx[newStartVnode.key]
  50333. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50334. if (isUndef(idxInOld)) { // New element
  50335. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50336. } else {
  50337. vnodeToMove = oldCh[idxInOld];
  50338. if (sameVnode(vnodeToMove, newStartVnode)) {
  50339. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50340. oldCh[idxInOld] = undefined;
  50341. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50342. } else {
  50343. // same key but different element. treat as new element
  50344. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50345. }
  50346. }
  50347. newStartVnode = newCh[++newStartIdx];
  50348. }
  50349. }
  50350. if (oldStartIdx > oldEndIdx) {
  50351. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50352. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50353. } else if (newStartIdx > newEndIdx) {
  50354. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50355. }
  50356. }
  50357. function checkDuplicateKeys (children) {
  50358. var seenKeys = {};
  50359. for (var i = 0; i < children.length; i++) {
  50360. var vnode = children[i];
  50361. var key = vnode.key;
  50362. if (isDef(key)) {
  50363. if (seenKeys[key]) {
  50364. warn(
  50365. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50366. vnode.context
  50367. );
  50368. } else {
  50369. seenKeys[key] = true;
  50370. }
  50371. }
  50372. }
  50373. }
  50374. function findIdxInOld (node, oldCh, start, end) {
  50375. for (var i = start; i < end; i++) {
  50376. var c = oldCh[i];
  50377. if (isDef(c) && sameVnode(node, c)) { return i }
  50378. }
  50379. }
  50380. function patchVnode (
  50381. oldVnode,
  50382. vnode,
  50383. insertedVnodeQueue,
  50384. ownerArray,
  50385. index,
  50386. removeOnly
  50387. ) {
  50388. if (oldVnode === vnode) {
  50389. return
  50390. }
  50391. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50392. // clone reused vnode
  50393. vnode = ownerArray[index] = cloneVNode(vnode);
  50394. }
  50395. var elm = vnode.elm = oldVnode.elm;
  50396. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50397. if (isDef(vnode.asyncFactory.resolved)) {
  50398. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50399. } else {
  50400. vnode.isAsyncPlaceholder = true;
  50401. }
  50402. return
  50403. }
  50404. // reuse element for static trees.
  50405. // note we only do this if the vnode is cloned -
  50406. // if the new node is not cloned it means the render functions have been
  50407. // reset by the hot-reload-api and we need to do a proper re-render.
  50408. if (isTrue(vnode.isStatic) &&
  50409. isTrue(oldVnode.isStatic) &&
  50410. vnode.key === oldVnode.key &&
  50411. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50412. ) {
  50413. vnode.componentInstance = oldVnode.componentInstance;
  50414. return
  50415. }
  50416. var i;
  50417. var data = vnode.data;
  50418. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50419. i(oldVnode, vnode);
  50420. }
  50421. var oldCh = oldVnode.children;
  50422. var ch = vnode.children;
  50423. if (isDef(data) && isPatchable(vnode)) {
  50424. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50425. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50426. }
  50427. if (isUndef(vnode.text)) {
  50428. if (isDef(oldCh) && isDef(ch)) {
  50429. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50430. } else if (isDef(ch)) {
  50431. {
  50432. checkDuplicateKeys(ch);
  50433. }
  50434. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50435. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50436. } else if (isDef(oldCh)) {
  50437. removeVnodes(oldCh, 0, oldCh.length - 1);
  50438. } else if (isDef(oldVnode.text)) {
  50439. nodeOps.setTextContent(elm, '');
  50440. }
  50441. } else if (oldVnode.text !== vnode.text) {
  50442. nodeOps.setTextContent(elm, vnode.text);
  50443. }
  50444. if (isDef(data)) {
  50445. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50446. }
  50447. }
  50448. function invokeInsertHook (vnode, queue, initial) {
  50449. // delay insert hooks for component root nodes, invoke them after the
  50450. // element is really inserted
  50451. if (isTrue(initial) && isDef(vnode.parent)) {
  50452. vnode.parent.data.pendingInsert = queue;
  50453. } else {
  50454. for (var i = 0; i < queue.length; ++i) {
  50455. queue[i].data.hook.insert(queue[i]);
  50456. }
  50457. }
  50458. }
  50459. var hydrationBailed = false;
  50460. // list of modules that can skip create hook during hydration because they
  50461. // are already rendered on the client or has no need for initialization
  50462. // Note: style is excluded because it relies on initial clone for future
  50463. // deep updates (#7063).
  50464. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50465. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50466. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50467. var i;
  50468. var tag = vnode.tag;
  50469. var data = vnode.data;
  50470. var children = vnode.children;
  50471. inVPre = inVPre || (data && data.pre);
  50472. vnode.elm = elm;
  50473. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50474. vnode.isAsyncPlaceholder = true;
  50475. return true
  50476. }
  50477. // assert node match
  50478. {
  50479. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50480. return false
  50481. }
  50482. }
  50483. if (isDef(data)) {
  50484. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50485. if (isDef(i = vnode.componentInstance)) {
  50486. // child component. it should have hydrated its own tree.
  50487. initComponent(vnode, insertedVnodeQueue);
  50488. return true
  50489. }
  50490. }
  50491. if (isDef(tag)) {
  50492. if (isDef(children)) {
  50493. // empty element, allow client to pick up and populate children
  50494. if (!elm.hasChildNodes()) {
  50495. createChildren(vnode, children, insertedVnodeQueue);
  50496. } else {
  50497. // v-html and domProps: innerHTML
  50498. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50499. if (i !== elm.innerHTML) {
  50500. /* istanbul ignore if */
  50501. if (typeof console !== 'undefined' &&
  50502. !hydrationBailed
  50503. ) {
  50504. hydrationBailed = true;
  50505. console.warn('Parent: ', elm);
  50506. console.warn('server innerHTML: ', i);
  50507. console.warn('client innerHTML: ', elm.innerHTML);
  50508. }
  50509. return false
  50510. }
  50511. } else {
  50512. // iterate and compare children lists
  50513. var childrenMatch = true;
  50514. var childNode = elm.firstChild;
  50515. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50516. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50517. childrenMatch = false;
  50518. break
  50519. }
  50520. childNode = childNode.nextSibling;
  50521. }
  50522. // if childNode is not null, it means the actual childNodes list is
  50523. // longer than the virtual children list.
  50524. if (!childrenMatch || childNode) {
  50525. /* istanbul ignore if */
  50526. if (typeof console !== 'undefined' &&
  50527. !hydrationBailed
  50528. ) {
  50529. hydrationBailed = true;
  50530. console.warn('Parent: ', elm);
  50531. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50532. }
  50533. return false
  50534. }
  50535. }
  50536. }
  50537. }
  50538. if (isDef(data)) {
  50539. var fullInvoke = false;
  50540. for (var key in data) {
  50541. if (!isRenderedModule(key)) {
  50542. fullInvoke = true;
  50543. invokeCreateHooks(vnode, insertedVnodeQueue);
  50544. break
  50545. }
  50546. }
  50547. if (!fullInvoke && data['class']) {
  50548. // ensure collecting deps for deep class bindings for future updates
  50549. traverse(data['class']);
  50550. }
  50551. }
  50552. } else if (elm.data !== vnode.text) {
  50553. elm.data = vnode.text;
  50554. }
  50555. return true
  50556. }
  50557. function assertNodeMatch (node, vnode, inVPre) {
  50558. if (isDef(vnode.tag)) {
  50559. return vnode.tag.indexOf('vue-component') === 0 || (
  50560. !isUnknownElement$$1(vnode, inVPre) &&
  50561. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50562. )
  50563. } else {
  50564. return node.nodeType === (vnode.isComment ? 8 : 3)
  50565. }
  50566. }
  50567. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50568. if (isUndef(vnode)) {
  50569. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50570. return
  50571. }
  50572. var isInitialPatch = false;
  50573. var insertedVnodeQueue = [];
  50574. if (isUndef(oldVnode)) {
  50575. // empty mount (likely as component), create new root element
  50576. isInitialPatch = true;
  50577. createElm(vnode, insertedVnodeQueue);
  50578. } else {
  50579. var isRealElement = isDef(oldVnode.nodeType);
  50580. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50581. // patch existing root node
  50582. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50583. } else {
  50584. if (isRealElement) {
  50585. // mounting to a real element
  50586. // check if this is server-rendered content and if we can perform
  50587. // a successful hydration.
  50588. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50589. oldVnode.removeAttribute(SSR_ATTR);
  50590. hydrating = true;
  50591. }
  50592. if (isTrue(hydrating)) {
  50593. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50594. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50595. return oldVnode
  50596. } else {
  50597. warn(
  50598. 'The client-side rendered virtual DOM tree is not matching ' +
  50599. 'server-rendered content. This is likely caused by incorrect ' +
  50600. 'HTML markup, for example nesting block-level elements inside ' +
  50601. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50602. 'full client-side render.'
  50603. );
  50604. }
  50605. }
  50606. // either not server-rendered, or hydration failed.
  50607. // create an empty node and replace it
  50608. oldVnode = emptyNodeAt(oldVnode);
  50609. }
  50610. // replacing existing element
  50611. var oldElm = oldVnode.elm;
  50612. var parentElm = nodeOps.parentNode(oldElm);
  50613. // create new node
  50614. createElm(
  50615. vnode,
  50616. insertedVnodeQueue,
  50617. // extremely rare edge case: do not insert if old element is in a
  50618. // leaving transition. Only happens when combining transition +
  50619. // keep-alive + HOCs. (#4590)
  50620. oldElm._leaveCb ? null : parentElm,
  50621. nodeOps.nextSibling(oldElm)
  50622. );
  50623. // update parent placeholder node element, recursively
  50624. if (isDef(vnode.parent)) {
  50625. var ancestor = vnode.parent;
  50626. var patchable = isPatchable(vnode);
  50627. while (ancestor) {
  50628. for (var i = 0; i < cbs.destroy.length; ++i) {
  50629. cbs.destroy[i](ancestor);
  50630. }
  50631. ancestor.elm = vnode.elm;
  50632. if (patchable) {
  50633. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50634. cbs.create[i$1](emptyNode, ancestor);
  50635. }
  50636. // #6513
  50637. // invoke insert hooks that may have been merged by create hooks.
  50638. // e.g. for directives that uses the "inserted" hook.
  50639. var insert = ancestor.data.hook.insert;
  50640. if (insert.merged) {
  50641. // start at index 1 to avoid re-invoking component mounted hook
  50642. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50643. insert.fns[i$2]();
  50644. }
  50645. }
  50646. } else {
  50647. registerRef(ancestor);
  50648. }
  50649. ancestor = ancestor.parent;
  50650. }
  50651. }
  50652. // destroy old node
  50653. if (isDef(parentElm)) {
  50654. removeVnodes([oldVnode], 0, 0);
  50655. } else if (isDef(oldVnode.tag)) {
  50656. invokeDestroyHook(oldVnode);
  50657. }
  50658. }
  50659. }
  50660. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50661. return vnode.elm
  50662. }
  50663. }
  50664. /* */
  50665. var directives = {
  50666. create: updateDirectives,
  50667. update: updateDirectives,
  50668. destroy: function unbindDirectives (vnode) {
  50669. updateDirectives(vnode, emptyNode);
  50670. }
  50671. };
  50672. function updateDirectives (oldVnode, vnode) {
  50673. if (oldVnode.data.directives || vnode.data.directives) {
  50674. _update(oldVnode, vnode);
  50675. }
  50676. }
  50677. function _update (oldVnode, vnode) {
  50678. var isCreate = oldVnode === emptyNode;
  50679. var isDestroy = vnode === emptyNode;
  50680. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50681. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50682. var dirsWithInsert = [];
  50683. var dirsWithPostpatch = [];
  50684. var key, oldDir, dir;
  50685. for (key in newDirs) {
  50686. oldDir = oldDirs[key];
  50687. dir = newDirs[key];
  50688. if (!oldDir) {
  50689. // new directive, bind
  50690. callHook$1(dir, 'bind', vnode, oldVnode);
  50691. if (dir.def && dir.def.inserted) {
  50692. dirsWithInsert.push(dir);
  50693. }
  50694. } else {
  50695. // existing directive, update
  50696. dir.oldValue = oldDir.value;
  50697. dir.oldArg = oldDir.arg;
  50698. callHook$1(dir, 'update', vnode, oldVnode);
  50699. if (dir.def && dir.def.componentUpdated) {
  50700. dirsWithPostpatch.push(dir);
  50701. }
  50702. }
  50703. }
  50704. if (dirsWithInsert.length) {
  50705. var callInsert = function () {
  50706. for (var i = 0; i < dirsWithInsert.length; i++) {
  50707. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50708. }
  50709. };
  50710. if (isCreate) {
  50711. mergeVNodeHook(vnode, 'insert', callInsert);
  50712. } else {
  50713. callInsert();
  50714. }
  50715. }
  50716. if (dirsWithPostpatch.length) {
  50717. mergeVNodeHook(vnode, 'postpatch', function () {
  50718. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50719. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50720. }
  50721. });
  50722. }
  50723. if (!isCreate) {
  50724. for (key in oldDirs) {
  50725. if (!newDirs[key]) {
  50726. // no longer present, unbind
  50727. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50728. }
  50729. }
  50730. }
  50731. }
  50732. var emptyModifiers = Object.create(null);
  50733. function normalizeDirectives$1 (
  50734. dirs,
  50735. vm
  50736. ) {
  50737. var res = Object.create(null);
  50738. if (!dirs) {
  50739. // $flow-disable-line
  50740. return res
  50741. }
  50742. var i, dir;
  50743. for (i = 0; i < dirs.length; i++) {
  50744. dir = dirs[i];
  50745. if (!dir.modifiers) {
  50746. // $flow-disable-line
  50747. dir.modifiers = emptyModifiers;
  50748. }
  50749. res[getRawDirName(dir)] = dir;
  50750. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50751. }
  50752. // $flow-disable-line
  50753. return res
  50754. }
  50755. function getRawDirName (dir) {
  50756. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50757. }
  50758. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50759. var fn = dir.def && dir.def[hook];
  50760. if (fn) {
  50761. try {
  50762. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50763. } catch (e) {
  50764. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50765. }
  50766. }
  50767. }
  50768. var baseModules = [
  50769. ref,
  50770. directives
  50771. ];
  50772. /* */
  50773. function updateAttrs (oldVnode, vnode) {
  50774. var opts = vnode.componentOptions;
  50775. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50776. return
  50777. }
  50778. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50779. return
  50780. }
  50781. var key, cur, old;
  50782. var elm = vnode.elm;
  50783. var oldAttrs = oldVnode.data.attrs || {};
  50784. var attrs = vnode.data.attrs || {};
  50785. // clone observed objects, as the user probably wants to mutate it
  50786. if (isDef(attrs.__ob__)) {
  50787. attrs = vnode.data.attrs = extend({}, attrs);
  50788. }
  50789. for (key in attrs) {
  50790. cur = attrs[key];
  50791. old = oldAttrs[key];
  50792. if (old !== cur) {
  50793. setAttr(elm, key, cur);
  50794. }
  50795. }
  50796. // #4391: in IE9, setting type can reset value for input[type=radio]
  50797. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50798. /* istanbul ignore if */
  50799. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50800. setAttr(elm, 'value', attrs.value);
  50801. }
  50802. for (key in oldAttrs) {
  50803. if (isUndef(attrs[key])) {
  50804. if (isXlink(key)) {
  50805. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50806. } else if (!isEnumeratedAttr(key)) {
  50807. elm.removeAttribute(key);
  50808. }
  50809. }
  50810. }
  50811. }
  50812. function setAttr (el, key, value) {
  50813. if (el.tagName.indexOf('-') > -1) {
  50814. baseSetAttr(el, key, value);
  50815. } else if (isBooleanAttr(key)) {
  50816. // set attribute for blank value
  50817. // e.g. <option disabled>Select one</option>
  50818. if (isFalsyAttrValue(value)) {
  50819. el.removeAttribute(key);
  50820. } else {
  50821. // technically allowfullscreen is a boolean attribute for <iframe>,
  50822. // but Flash expects a value of "true" when used on <embed> tag
  50823. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50824. ? 'true'
  50825. : key;
  50826. el.setAttribute(key, value);
  50827. }
  50828. } else if (isEnumeratedAttr(key)) {
  50829. el.setAttribute(key, convertEnumeratedValue(key, value));
  50830. } else if (isXlink(key)) {
  50831. if (isFalsyAttrValue(value)) {
  50832. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50833. } else {
  50834. el.setAttributeNS(xlinkNS, key, value);
  50835. }
  50836. } else {
  50837. baseSetAttr(el, key, value);
  50838. }
  50839. }
  50840. function baseSetAttr (el, key, value) {
  50841. if (isFalsyAttrValue(value)) {
  50842. el.removeAttribute(key);
  50843. } else {
  50844. // #7138: IE10 & 11 fires input event when setting placeholder on
  50845. // <textarea>... block the first input event and remove the blocker
  50846. // immediately.
  50847. /* istanbul ignore if */
  50848. if (
  50849. isIE && !isIE9 &&
  50850. el.tagName === 'TEXTAREA' &&
  50851. key === 'placeholder' && value !== '' && !el.__ieph
  50852. ) {
  50853. var blocker = function (e) {
  50854. e.stopImmediatePropagation();
  50855. el.removeEventListener('input', blocker);
  50856. };
  50857. el.addEventListener('input', blocker);
  50858. // $flow-disable-line
  50859. el.__ieph = true; /* IE placeholder patched */
  50860. }
  50861. el.setAttribute(key, value);
  50862. }
  50863. }
  50864. var attrs = {
  50865. create: updateAttrs,
  50866. update: updateAttrs
  50867. };
  50868. /* */
  50869. function updateClass (oldVnode, vnode) {
  50870. var el = vnode.elm;
  50871. var data = vnode.data;
  50872. var oldData = oldVnode.data;
  50873. if (
  50874. isUndef(data.staticClass) &&
  50875. isUndef(data.class) && (
  50876. isUndef(oldData) || (
  50877. isUndef(oldData.staticClass) &&
  50878. isUndef(oldData.class)
  50879. )
  50880. )
  50881. ) {
  50882. return
  50883. }
  50884. var cls = genClassForVnode(vnode);
  50885. // handle transition classes
  50886. var transitionClass = el._transitionClasses;
  50887. if (isDef(transitionClass)) {
  50888. cls = concat(cls, stringifyClass(transitionClass));
  50889. }
  50890. // set the class
  50891. if (cls !== el._prevClass) {
  50892. el.setAttribute('class', cls);
  50893. el._prevClass = cls;
  50894. }
  50895. }
  50896. var klass = {
  50897. create: updateClass,
  50898. update: updateClass
  50899. };
  50900. /* */
  50901. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50902. function parseFilters (exp) {
  50903. var inSingle = false;
  50904. var inDouble = false;
  50905. var inTemplateString = false;
  50906. var inRegex = false;
  50907. var curly = 0;
  50908. var square = 0;
  50909. var paren = 0;
  50910. var lastFilterIndex = 0;
  50911. var c, prev, i, expression, filters;
  50912. for (i = 0; i < exp.length; i++) {
  50913. prev = c;
  50914. c = exp.charCodeAt(i);
  50915. if (inSingle) {
  50916. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50917. } else if (inDouble) {
  50918. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50919. } else if (inTemplateString) {
  50920. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50921. } else if (inRegex) {
  50922. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50923. } else if (
  50924. c === 0x7C && // pipe
  50925. exp.charCodeAt(i + 1) !== 0x7C &&
  50926. exp.charCodeAt(i - 1) !== 0x7C &&
  50927. !curly && !square && !paren
  50928. ) {
  50929. if (expression === undefined) {
  50930. // first filter, end of expression
  50931. lastFilterIndex = i + 1;
  50932. expression = exp.slice(0, i).trim();
  50933. } else {
  50934. pushFilter();
  50935. }
  50936. } else {
  50937. switch (c) {
  50938. case 0x22: inDouble = true; break // "
  50939. case 0x27: inSingle = true; break // '
  50940. case 0x60: inTemplateString = true; break // `
  50941. case 0x28: paren++; break // (
  50942. case 0x29: paren--; break // )
  50943. case 0x5B: square++; break // [
  50944. case 0x5D: square--; break // ]
  50945. case 0x7B: curly++; break // {
  50946. case 0x7D: curly--; break // }
  50947. }
  50948. if (c === 0x2f) { // /
  50949. var j = i - 1;
  50950. var p = (void 0);
  50951. // find first non-whitespace prev char
  50952. for (; j >= 0; j--) {
  50953. p = exp.charAt(j);
  50954. if (p !== ' ') { break }
  50955. }
  50956. if (!p || !validDivisionCharRE.test(p)) {
  50957. inRegex = true;
  50958. }
  50959. }
  50960. }
  50961. }
  50962. if (expression === undefined) {
  50963. expression = exp.slice(0, i).trim();
  50964. } else if (lastFilterIndex !== 0) {
  50965. pushFilter();
  50966. }
  50967. function pushFilter () {
  50968. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50969. lastFilterIndex = i + 1;
  50970. }
  50971. if (filters) {
  50972. for (i = 0; i < filters.length; i++) {
  50973. expression = wrapFilter(expression, filters[i]);
  50974. }
  50975. }
  50976. return expression
  50977. }
  50978. function wrapFilter (exp, filter) {
  50979. var i = filter.indexOf('(');
  50980. if (i < 0) {
  50981. // _f: resolveFilter
  50982. return ("_f(\"" + filter + "\")(" + exp + ")")
  50983. } else {
  50984. var name = filter.slice(0, i);
  50985. var args = filter.slice(i + 1);
  50986. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50987. }
  50988. }
  50989. /* */
  50990. /* eslint-disable no-unused-vars */
  50991. function baseWarn (msg, range) {
  50992. console.error(("[Vue compiler]: " + msg));
  50993. }
  50994. /* eslint-enable no-unused-vars */
  50995. function pluckModuleFunction (
  50996. modules,
  50997. key
  50998. ) {
  50999. return modules
  51000. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  51001. : []
  51002. }
  51003. function addProp (el, name, value, range, dynamic) {
  51004. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51005. el.plain = false;
  51006. }
  51007. function addAttr (el, name, value, range, dynamic) {
  51008. var attrs = dynamic
  51009. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  51010. : (el.attrs || (el.attrs = []));
  51011. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51012. el.plain = false;
  51013. }
  51014. // add a raw attr (use this in preTransforms)
  51015. function addRawAttr (el, name, value, range) {
  51016. el.attrsMap[name] = value;
  51017. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  51018. }
  51019. function addDirective (
  51020. el,
  51021. name,
  51022. rawName,
  51023. value,
  51024. arg,
  51025. isDynamicArg,
  51026. modifiers,
  51027. range
  51028. ) {
  51029. (el.directives || (el.directives = [])).push(rangeSetItem({
  51030. name: name,
  51031. rawName: rawName,
  51032. value: value,
  51033. arg: arg,
  51034. isDynamicArg: isDynamicArg,
  51035. modifiers: modifiers
  51036. }, range));
  51037. el.plain = false;
  51038. }
  51039. function prependModifierMarker (symbol, name, dynamic) {
  51040. return dynamic
  51041. ? ("_p(" + name + ",\"" + symbol + "\")")
  51042. : symbol + name // mark the event as captured
  51043. }
  51044. function addHandler (
  51045. el,
  51046. name,
  51047. value,
  51048. modifiers,
  51049. important,
  51050. warn,
  51051. range,
  51052. dynamic
  51053. ) {
  51054. modifiers = modifiers || emptyObject;
  51055. // warn prevent and passive modifier
  51056. /* istanbul ignore if */
  51057. if (
  51058. warn &&
  51059. modifiers.prevent && modifiers.passive
  51060. ) {
  51061. warn(
  51062. 'passive and prevent can\'t be used together. ' +
  51063. 'Passive handler can\'t prevent default event.',
  51064. range
  51065. );
  51066. }
  51067. // normalize click.right and click.middle since they don't actually fire
  51068. // this is technically browser-specific, but at least for now browsers are
  51069. // the only target envs that have right/middle clicks.
  51070. if (modifiers.right) {
  51071. if (dynamic) {
  51072. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51073. } else if (name === 'click') {
  51074. name = 'contextmenu';
  51075. delete modifiers.right;
  51076. }
  51077. } else if (modifiers.middle) {
  51078. if (dynamic) {
  51079. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51080. } else if (name === 'click') {
  51081. name = 'mouseup';
  51082. }
  51083. }
  51084. // check capture modifier
  51085. if (modifiers.capture) {
  51086. delete modifiers.capture;
  51087. name = prependModifierMarker('!', name, dynamic);
  51088. }
  51089. if (modifiers.once) {
  51090. delete modifiers.once;
  51091. name = prependModifierMarker('~', name, dynamic);
  51092. }
  51093. /* istanbul ignore if */
  51094. if (modifiers.passive) {
  51095. delete modifiers.passive;
  51096. name = prependModifierMarker('&', name, dynamic);
  51097. }
  51098. var events;
  51099. if (modifiers.native) {
  51100. delete modifiers.native;
  51101. events = el.nativeEvents || (el.nativeEvents = {});
  51102. } else {
  51103. events = el.events || (el.events = {});
  51104. }
  51105. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51106. if (modifiers !== emptyObject) {
  51107. newHandler.modifiers = modifiers;
  51108. }
  51109. var handlers = events[name];
  51110. /* istanbul ignore if */
  51111. if (Array.isArray(handlers)) {
  51112. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51113. } else if (handlers) {
  51114. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51115. } else {
  51116. events[name] = newHandler;
  51117. }
  51118. el.plain = false;
  51119. }
  51120. function getRawBindingAttr (
  51121. el,
  51122. name
  51123. ) {
  51124. return el.rawAttrsMap[':' + name] ||
  51125. el.rawAttrsMap['v-bind:' + name] ||
  51126. el.rawAttrsMap[name]
  51127. }
  51128. function getBindingAttr (
  51129. el,
  51130. name,
  51131. getStatic
  51132. ) {
  51133. var dynamicValue =
  51134. getAndRemoveAttr(el, ':' + name) ||
  51135. getAndRemoveAttr(el, 'v-bind:' + name);
  51136. if (dynamicValue != null) {
  51137. return parseFilters(dynamicValue)
  51138. } else if (getStatic !== false) {
  51139. var staticValue = getAndRemoveAttr(el, name);
  51140. if (staticValue != null) {
  51141. return JSON.stringify(staticValue)
  51142. }
  51143. }
  51144. }
  51145. // note: this only removes the attr from the Array (attrsList) so that it
  51146. // doesn't get processed by processAttrs.
  51147. // By default it does NOT remove it from the map (attrsMap) because the map is
  51148. // needed during codegen.
  51149. function getAndRemoveAttr (
  51150. el,
  51151. name,
  51152. removeFromMap
  51153. ) {
  51154. var val;
  51155. if ((val = el.attrsMap[name]) != null) {
  51156. var list = el.attrsList;
  51157. for (var i = 0, l = list.length; i < l; i++) {
  51158. if (list[i].name === name) {
  51159. list.splice(i, 1);
  51160. break
  51161. }
  51162. }
  51163. }
  51164. if (removeFromMap) {
  51165. delete el.attrsMap[name];
  51166. }
  51167. return val
  51168. }
  51169. function getAndRemoveAttrByRegex (
  51170. el,
  51171. name
  51172. ) {
  51173. var list = el.attrsList;
  51174. for (var i = 0, l = list.length; i < l; i++) {
  51175. var attr = list[i];
  51176. if (name.test(attr.name)) {
  51177. list.splice(i, 1);
  51178. return attr
  51179. }
  51180. }
  51181. }
  51182. function rangeSetItem (
  51183. item,
  51184. range
  51185. ) {
  51186. if (range) {
  51187. if (range.start != null) {
  51188. item.start = range.start;
  51189. }
  51190. if (range.end != null) {
  51191. item.end = range.end;
  51192. }
  51193. }
  51194. return item
  51195. }
  51196. /* */
  51197. /**
  51198. * Cross-platform code generation for component v-model
  51199. */
  51200. function genComponentModel (
  51201. el,
  51202. value,
  51203. modifiers
  51204. ) {
  51205. var ref = modifiers || {};
  51206. var number = ref.number;
  51207. var trim = ref.trim;
  51208. var baseValueExpression = '$$v';
  51209. var valueExpression = baseValueExpression;
  51210. if (trim) {
  51211. valueExpression =
  51212. "(typeof " + baseValueExpression + " === 'string'" +
  51213. "? " + baseValueExpression + ".trim()" +
  51214. ": " + baseValueExpression + ")";
  51215. }
  51216. if (number) {
  51217. valueExpression = "_n(" + valueExpression + ")";
  51218. }
  51219. var assignment = genAssignmentCode(value, valueExpression);
  51220. el.model = {
  51221. value: ("(" + value + ")"),
  51222. expression: JSON.stringify(value),
  51223. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51224. };
  51225. }
  51226. /**
  51227. * Cross-platform codegen helper for generating v-model value assignment code.
  51228. */
  51229. function genAssignmentCode (
  51230. value,
  51231. assignment
  51232. ) {
  51233. var res = parseModel(value);
  51234. if (res.key === null) {
  51235. return (value + "=" + assignment)
  51236. } else {
  51237. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51238. }
  51239. }
  51240. /**
  51241. * Parse a v-model expression into a base path and a final key segment.
  51242. * Handles both dot-path and possible square brackets.
  51243. *
  51244. * Possible cases:
  51245. *
  51246. * - test
  51247. * - test[key]
  51248. * - test[test1[key]]
  51249. * - test["a"][key]
  51250. * - xxx.test[a[a].test1[key]]
  51251. * - test.xxx.a["asa"][test1[key]]
  51252. *
  51253. */
  51254. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51255. function parseModel (val) {
  51256. // Fix https://github.com/vuejs/vue/pull/7730
  51257. // allow v-model="obj.val " (trailing whitespace)
  51258. val = val.trim();
  51259. len = val.length;
  51260. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51261. index$1 = val.lastIndexOf('.');
  51262. if (index$1 > -1) {
  51263. return {
  51264. exp: val.slice(0, index$1),
  51265. key: '"' + val.slice(index$1 + 1) + '"'
  51266. }
  51267. } else {
  51268. return {
  51269. exp: val,
  51270. key: null
  51271. }
  51272. }
  51273. }
  51274. str = val;
  51275. index$1 = expressionPos = expressionEndPos = 0;
  51276. while (!eof()) {
  51277. chr = next();
  51278. /* istanbul ignore if */
  51279. if (isStringStart(chr)) {
  51280. parseString(chr);
  51281. } else if (chr === 0x5B) {
  51282. parseBracket(chr);
  51283. }
  51284. }
  51285. return {
  51286. exp: val.slice(0, expressionPos),
  51287. key: val.slice(expressionPos + 1, expressionEndPos)
  51288. }
  51289. }
  51290. function next () {
  51291. return str.charCodeAt(++index$1)
  51292. }
  51293. function eof () {
  51294. return index$1 >= len
  51295. }
  51296. function isStringStart (chr) {
  51297. return chr === 0x22 || chr === 0x27
  51298. }
  51299. function parseBracket (chr) {
  51300. var inBracket = 1;
  51301. expressionPos = index$1;
  51302. while (!eof()) {
  51303. chr = next();
  51304. if (isStringStart(chr)) {
  51305. parseString(chr);
  51306. continue
  51307. }
  51308. if (chr === 0x5B) { inBracket++; }
  51309. if (chr === 0x5D) { inBracket--; }
  51310. if (inBracket === 0) {
  51311. expressionEndPos = index$1;
  51312. break
  51313. }
  51314. }
  51315. }
  51316. function parseString (chr) {
  51317. var stringQuote = chr;
  51318. while (!eof()) {
  51319. chr = next();
  51320. if (chr === stringQuote) {
  51321. break
  51322. }
  51323. }
  51324. }
  51325. /* */
  51326. var warn$1;
  51327. // in some cases, the event used has to be determined at runtime
  51328. // so we used some reserved tokens during compile.
  51329. var RANGE_TOKEN = '__r';
  51330. var CHECKBOX_RADIO_TOKEN = '__c';
  51331. function model (
  51332. el,
  51333. dir,
  51334. _warn
  51335. ) {
  51336. warn$1 = _warn;
  51337. var value = dir.value;
  51338. var modifiers = dir.modifiers;
  51339. var tag = el.tag;
  51340. var type = el.attrsMap.type;
  51341. {
  51342. // inputs with type="file" are read only and setting the input's
  51343. // value will throw an error.
  51344. if (tag === 'input' && type === 'file') {
  51345. warn$1(
  51346. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51347. "File inputs are read only. Use a v-on:change listener instead.",
  51348. el.rawAttrsMap['v-model']
  51349. );
  51350. }
  51351. }
  51352. if (el.component) {
  51353. genComponentModel(el, value, modifiers);
  51354. // component v-model doesn't need extra runtime
  51355. return false
  51356. } else if (tag === 'select') {
  51357. genSelect(el, value, modifiers);
  51358. } else if (tag === 'input' && type === 'checkbox') {
  51359. genCheckboxModel(el, value, modifiers);
  51360. } else if (tag === 'input' && type === 'radio') {
  51361. genRadioModel(el, value, modifiers);
  51362. } else if (tag === 'input' || tag === 'textarea') {
  51363. genDefaultModel(el, value, modifiers);
  51364. } else if (!config.isReservedTag(tag)) {
  51365. genComponentModel(el, value, modifiers);
  51366. // component v-model doesn't need extra runtime
  51367. return false
  51368. } else {
  51369. warn$1(
  51370. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51371. "v-model is not supported on this element type. " +
  51372. 'If you are working with contenteditable, it\'s recommended to ' +
  51373. 'wrap a library dedicated for that purpose inside a custom component.',
  51374. el.rawAttrsMap['v-model']
  51375. );
  51376. }
  51377. // ensure runtime directive metadata
  51378. return true
  51379. }
  51380. function genCheckboxModel (
  51381. el,
  51382. value,
  51383. modifiers
  51384. ) {
  51385. var number = modifiers && modifiers.number;
  51386. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51387. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51388. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51389. addProp(el, 'checked',
  51390. "Array.isArray(" + value + ")" +
  51391. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51392. trueValueBinding === 'true'
  51393. ? (":(" + value + ")")
  51394. : (":_q(" + value + "," + trueValueBinding + ")")
  51395. )
  51396. );
  51397. addHandler(el, 'change',
  51398. "var $$a=" + value + "," +
  51399. '$$el=$event.target,' +
  51400. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51401. 'if(Array.isArray($$a)){' +
  51402. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51403. '$$i=_i($$a,$$v);' +
  51404. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51405. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51406. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51407. null, true
  51408. );
  51409. }
  51410. function genRadioModel (
  51411. el,
  51412. value,
  51413. modifiers
  51414. ) {
  51415. var number = modifiers && modifiers.number;
  51416. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51417. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51418. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51419. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51420. }
  51421. function genSelect (
  51422. el,
  51423. value,
  51424. modifiers
  51425. ) {
  51426. var number = modifiers && modifiers.number;
  51427. var selectedVal = "Array.prototype.filter" +
  51428. ".call($event.target.options,function(o){return o.selected})" +
  51429. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51430. "return " + (number ? '_n(val)' : 'val') + "})";
  51431. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51432. var code = "var $$selectedVal = " + selectedVal + ";";
  51433. code = code + " " + (genAssignmentCode(value, assignment));
  51434. addHandler(el, 'change', code, null, true);
  51435. }
  51436. function genDefaultModel (
  51437. el,
  51438. value,
  51439. modifiers
  51440. ) {
  51441. var type = el.attrsMap.type;
  51442. // warn if v-bind:value conflicts with v-model
  51443. // except for inputs with v-bind:type
  51444. {
  51445. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51446. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51447. if (value$1 && !typeBinding) {
  51448. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51449. warn$1(
  51450. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51451. 'because the latter already expands to a value binding internally',
  51452. el.rawAttrsMap[binding]
  51453. );
  51454. }
  51455. }
  51456. var ref = modifiers || {};
  51457. var lazy = ref.lazy;
  51458. var number = ref.number;
  51459. var trim = ref.trim;
  51460. var needCompositionGuard = !lazy && type !== 'range';
  51461. var event = lazy
  51462. ? 'change'
  51463. : type === 'range'
  51464. ? RANGE_TOKEN
  51465. : 'input';
  51466. var valueExpression = '$event.target.value';
  51467. if (trim) {
  51468. valueExpression = "$event.target.value.trim()";
  51469. }
  51470. if (number) {
  51471. valueExpression = "_n(" + valueExpression + ")";
  51472. }
  51473. var code = genAssignmentCode(value, valueExpression);
  51474. if (needCompositionGuard) {
  51475. code = "if($event.target.composing)return;" + code;
  51476. }
  51477. addProp(el, 'value', ("(" + value + ")"));
  51478. addHandler(el, event, code, null, true);
  51479. if (trim || number) {
  51480. addHandler(el, 'blur', '$forceUpdate()');
  51481. }
  51482. }
  51483. /* */
  51484. // normalize v-model event tokens that can only be determined at runtime.
  51485. // it's important to place the event as the first in the array because
  51486. // the whole point is ensuring the v-model callback gets called before
  51487. // user-attached handlers.
  51488. function normalizeEvents (on) {
  51489. /* istanbul ignore if */
  51490. if (isDef(on[RANGE_TOKEN])) {
  51491. // IE input[type=range] only supports `change` event
  51492. var event = isIE ? 'change' : 'input';
  51493. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51494. delete on[RANGE_TOKEN];
  51495. }
  51496. // This was originally intended to fix #4521 but no longer necessary
  51497. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51498. /* istanbul ignore if */
  51499. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51500. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51501. delete on[CHECKBOX_RADIO_TOKEN];
  51502. }
  51503. }
  51504. var target$1;
  51505. function createOnceHandler$1 (event, handler, capture) {
  51506. var _target = target$1; // save current target element in closure
  51507. return function onceHandler () {
  51508. var res = handler.apply(null, arguments);
  51509. if (res !== null) {
  51510. remove$2(event, onceHandler, capture, _target);
  51511. }
  51512. }
  51513. }
  51514. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51515. // implementation and does not fire microtasks in between event propagation, so
  51516. // safe to exclude.
  51517. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51518. function add$1 (
  51519. name,
  51520. handler,
  51521. capture,
  51522. passive
  51523. ) {
  51524. // async edge case #6566: inner click event triggers patch, event handler
  51525. // attached to outer element during patch, and triggered again. This
  51526. // happens because browsers fire microtask ticks between event propagation.
  51527. // the solution is simple: we save the timestamp when a handler is attached,
  51528. // and the handler would only fire if the event passed to it was fired
  51529. // AFTER it was attached.
  51530. if (useMicrotaskFix) {
  51531. var attachedTimestamp = currentFlushTimestamp;
  51532. var original = handler;
  51533. handler = original._wrapper = function (e) {
  51534. if (
  51535. // no bubbling, should always fire.
  51536. // this is just a safety net in case event.timeStamp is unreliable in
  51537. // certain weird environments...
  51538. e.target === e.currentTarget ||
  51539. // event is fired after handler attachment
  51540. e.timeStamp >= attachedTimestamp ||
  51541. // bail for environments that have buggy event.timeStamp implementations
  51542. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51543. // #9681 QtWebEngine event.timeStamp is negative value
  51544. e.timeStamp <= 0 ||
  51545. // #9448 bail if event is fired in another document in a multi-page
  51546. // electron/nw.js app, since event.timeStamp will be using a different
  51547. // starting reference
  51548. e.target.ownerDocument !== document
  51549. ) {
  51550. return original.apply(this, arguments)
  51551. }
  51552. };
  51553. }
  51554. target$1.addEventListener(
  51555. name,
  51556. handler,
  51557. supportsPassive
  51558. ? { capture: capture, passive: passive }
  51559. : capture
  51560. );
  51561. }
  51562. function remove$2 (
  51563. name,
  51564. handler,
  51565. capture,
  51566. _target
  51567. ) {
  51568. (_target || target$1).removeEventListener(
  51569. name,
  51570. handler._wrapper || handler,
  51571. capture
  51572. );
  51573. }
  51574. function updateDOMListeners (oldVnode, vnode) {
  51575. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51576. return
  51577. }
  51578. var on = vnode.data.on || {};
  51579. var oldOn = oldVnode.data.on || {};
  51580. target$1 = vnode.elm;
  51581. normalizeEvents(on);
  51582. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51583. target$1 = undefined;
  51584. }
  51585. var events = {
  51586. create: updateDOMListeners,
  51587. update: updateDOMListeners
  51588. };
  51589. /* */
  51590. var svgContainer;
  51591. function updateDOMProps (oldVnode, vnode) {
  51592. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51593. return
  51594. }
  51595. var key, cur;
  51596. var elm = vnode.elm;
  51597. var oldProps = oldVnode.data.domProps || {};
  51598. var props = vnode.data.domProps || {};
  51599. // clone observed objects, as the user probably wants to mutate it
  51600. if (isDef(props.__ob__)) {
  51601. props = vnode.data.domProps = extend({}, props);
  51602. }
  51603. for (key in oldProps) {
  51604. if (!(key in props)) {
  51605. elm[key] = '';
  51606. }
  51607. }
  51608. for (key in props) {
  51609. cur = props[key];
  51610. // ignore children if the node has textContent or innerHTML,
  51611. // as these will throw away existing DOM nodes and cause removal errors
  51612. // on subsequent patches (#3360)
  51613. if (key === 'textContent' || key === 'innerHTML') {
  51614. if (vnode.children) { vnode.children.length = 0; }
  51615. if (cur === oldProps[key]) { continue }
  51616. // #6601 work around Chrome version <= 55 bug where single textNode
  51617. // replaced by innerHTML/textContent retains its parentNode property
  51618. if (elm.childNodes.length === 1) {
  51619. elm.removeChild(elm.childNodes[0]);
  51620. }
  51621. }
  51622. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51623. // store value as _value as well since
  51624. // non-string values will be stringified
  51625. elm._value = cur;
  51626. // avoid resetting cursor position when value is the same
  51627. var strCur = isUndef(cur) ? '' : String(cur);
  51628. if (shouldUpdateValue(elm, strCur)) {
  51629. elm.value = strCur;
  51630. }
  51631. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51632. // IE doesn't support innerHTML for SVG elements
  51633. svgContainer = svgContainer || document.createElement('div');
  51634. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51635. var svg = svgContainer.firstChild;
  51636. while (elm.firstChild) {
  51637. elm.removeChild(elm.firstChild);
  51638. }
  51639. while (svg.firstChild) {
  51640. elm.appendChild(svg.firstChild);
  51641. }
  51642. } else if (
  51643. // skip the update if old and new VDOM state is the same.
  51644. // `value` is handled separately because the DOM value may be temporarily
  51645. // out of sync with VDOM state due to focus, composition and modifiers.
  51646. // This #4521 by skipping the unnecesarry `checked` update.
  51647. cur !== oldProps[key]
  51648. ) {
  51649. // some property updates can throw
  51650. // e.g. `value` on <progress> w/ non-finite value
  51651. try {
  51652. elm[key] = cur;
  51653. } catch (e) {}
  51654. }
  51655. }
  51656. }
  51657. // check platforms/web/util/attrs.js acceptValue
  51658. function shouldUpdateValue (elm, checkVal) {
  51659. return (!elm.composing && (
  51660. elm.tagName === 'OPTION' ||
  51661. isNotInFocusAndDirty(elm, checkVal) ||
  51662. isDirtyWithModifiers(elm, checkVal)
  51663. ))
  51664. }
  51665. function isNotInFocusAndDirty (elm, checkVal) {
  51666. // return true when textbox (.number and .trim) loses focus and its value is
  51667. // not equal to the updated value
  51668. var notInFocus = true;
  51669. // #6157
  51670. // work around IE bug when accessing document.activeElement in an iframe
  51671. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51672. return notInFocus && elm.value !== checkVal
  51673. }
  51674. function isDirtyWithModifiers (elm, newVal) {
  51675. var value = elm.value;
  51676. var modifiers = elm._vModifiers; // injected by v-model runtime
  51677. if (isDef(modifiers)) {
  51678. if (modifiers.number) {
  51679. return toNumber(value) !== toNumber(newVal)
  51680. }
  51681. if (modifiers.trim) {
  51682. return value.trim() !== newVal.trim()
  51683. }
  51684. }
  51685. return value !== newVal
  51686. }
  51687. var domProps = {
  51688. create: updateDOMProps,
  51689. update: updateDOMProps
  51690. };
  51691. /* */
  51692. var parseStyleText = cached(function (cssText) {
  51693. var res = {};
  51694. var listDelimiter = /;(?![^(]*\))/g;
  51695. var propertyDelimiter = /:(.+)/;
  51696. cssText.split(listDelimiter).forEach(function (item) {
  51697. if (item) {
  51698. var tmp = item.split(propertyDelimiter);
  51699. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51700. }
  51701. });
  51702. return res
  51703. });
  51704. // merge static and dynamic style data on the same vnode
  51705. function normalizeStyleData (data) {
  51706. var style = normalizeStyleBinding(data.style);
  51707. // static style is pre-processed into an object during compilation
  51708. // and is always a fresh object, so it's safe to merge into it
  51709. return data.staticStyle
  51710. ? extend(data.staticStyle, style)
  51711. : style
  51712. }
  51713. // normalize possible array / string values into Object
  51714. function normalizeStyleBinding (bindingStyle) {
  51715. if (Array.isArray(bindingStyle)) {
  51716. return toObject(bindingStyle)
  51717. }
  51718. if (typeof bindingStyle === 'string') {
  51719. return parseStyleText(bindingStyle)
  51720. }
  51721. return bindingStyle
  51722. }
  51723. /**
  51724. * parent component style should be after child's
  51725. * so that parent component's style could override it
  51726. */
  51727. function getStyle (vnode, checkChild) {
  51728. var res = {};
  51729. var styleData;
  51730. if (checkChild) {
  51731. var childNode = vnode;
  51732. while (childNode.componentInstance) {
  51733. childNode = childNode.componentInstance._vnode;
  51734. if (
  51735. childNode && childNode.data &&
  51736. (styleData = normalizeStyleData(childNode.data))
  51737. ) {
  51738. extend(res, styleData);
  51739. }
  51740. }
  51741. }
  51742. if ((styleData = normalizeStyleData(vnode.data))) {
  51743. extend(res, styleData);
  51744. }
  51745. var parentNode = vnode;
  51746. while ((parentNode = parentNode.parent)) {
  51747. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51748. extend(res, styleData);
  51749. }
  51750. }
  51751. return res
  51752. }
  51753. /* */
  51754. var cssVarRE = /^--/;
  51755. var importantRE = /\s*!important$/;
  51756. var setProp = function (el, name, val) {
  51757. /* istanbul ignore if */
  51758. if (cssVarRE.test(name)) {
  51759. el.style.setProperty(name, val);
  51760. } else if (importantRE.test(val)) {
  51761. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51762. } else {
  51763. var normalizedName = normalize(name);
  51764. if (Array.isArray(val)) {
  51765. // Support values array created by autoprefixer, e.g.
  51766. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51767. // Set them one by one, and the browser will only set those it can recognize
  51768. for (var i = 0, len = val.length; i < len; i++) {
  51769. el.style[normalizedName] = val[i];
  51770. }
  51771. } else {
  51772. el.style[normalizedName] = val;
  51773. }
  51774. }
  51775. };
  51776. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51777. var emptyStyle;
  51778. var normalize = cached(function (prop) {
  51779. emptyStyle = emptyStyle || document.createElement('div').style;
  51780. prop = camelize(prop);
  51781. if (prop !== 'filter' && (prop in emptyStyle)) {
  51782. return prop
  51783. }
  51784. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51785. for (var i = 0; i < vendorNames.length; i++) {
  51786. var name = vendorNames[i] + capName;
  51787. if (name in emptyStyle) {
  51788. return name
  51789. }
  51790. }
  51791. });
  51792. function updateStyle (oldVnode, vnode) {
  51793. var data = vnode.data;
  51794. var oldData = oldVnode.data;
  51795. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51796. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51797. ) {
  51798. return
  51799. }
  51800. var cur, name;
  51801. var el = vnode.elm;
  51802. var oldStaticStyle = oldData.staticStyle;
  51803. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51804. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51805. var oldStyle = oldStaticStyle || oldStyleBinding;
  51806. var style = normalizeStyleBinding(vnode.data.style) || {};
  51807. // store normalized style under a different key for next diff
  51808. // make sure to clone it if it's reactive, since the user likely wants
  51809. // to mutate it.
  51810. vnode.data.normalizedStyle = isDef(style.__ob__)
  51811. ? extend({}, style)
  51812. : style;
  51813. var newStyle = getStyle(vnode, true);
  51814. for (name in oldStyle) {
  51815. if (isUndef(newStyle[name])) {
  51816. setProp(el, name, '');
  51817. }
  51818. }
  51819. for (name in newStyle) {
  51820. cur = newStyle[name];
  51821. if (cur !== oldStyle[name]) {
  51822. // ie9 setting to null has no effect, must use empty string
  51823. setProp(el, name, cur == null ? '' : cur);
  51824. }
  51825. }
  51826. }
  51827. var style = {
  51828. create: updateStyle,
  51829. update: updateStyle
  51830. };
  51831. /* */
  51832. var whitespaceRE = /\s+/;
  51833. /**
  51834. * Add class with compatibility for SVG since classList is not supported on
  51835. * SVG elements in IE
  51836. */
  51837. function addClass (el, cls) {
  51838. /* istanbul ignore if */
  51839. if (!cls || !(cls = cls.trim())) {
  51840. return
  51841. }
  51842. /* istanbul ignore else */
  51843. if (el.classList) {
  51844. if (cls.indexOf(' ') > -1) {
  51845. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51846. } else {
  51847. el.classList.add(cls);
  51848. }
  51849. } else {
  51850. var cur = " " + (el.getAttribute('class') || '') + " ";
  51851. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51852. el.setAttribute('class', (cur + cls).trim());
  51853. }
  51854. }
  51855. }
  51856. /**
  51857. * Remove class with compatibility for SVG since classList is not supported on
  51858. * SVG elements in IE
  51859. */
  51860. function removeClass (el, cls) {
  51861. /* istanbul ignore if */
  51862. if (!cls || !(cls = cls.trim())) {
  51863. return
  51864. }
  51865. /* istanbul ignore else */
  51866. if (el.classList) {
  51867. if (cls.indexOf(' ') > -1) {
  51868. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51869. } else {
  51870. el.classList.remove(cls);
  51871. }
  51872. if (!el.classList.length) {
  51873. el.removeAttribute('class');
  51874. }
  51875. } else {
  51876. var cur = " " + (el.getAttribute('class') || '') + " ";
  51877. var tar = ' ' + cls + ' ';
  51878. while (cur.indexOf(tar) >= 0) {
  51879. cur = cur.replace(tar, ' ');
  51880. }
  51881. cur = cur.trim();
  51882. if (cur) {
  51883. el.setAttribute('class', cur);
  51884. } else {
  51885. el.removeAttribute('class');
  51886. }
  51887. }
  51888. }
  51889. /* */
  51890. function resolveTransition (def$$1) {
  51891. if (!def$$1) {
  51892. return
  51893. }
  51894. /* istanbul ignore else */
  51895. if (typeof def$$1 === 'object') {
  51896. var res = {};
  51897. if (def$$1.css !== false) {
  51898. extend(res, autoCssTransition(def$$1.name || 'v'));
  51899. }
  51900. extend(res, def$$1);
  51901. return res
  51902. } else if (typeof def$$1 === 'string') {
  51903. return autoCssTransition(def$$1)
  51904. }
  51905. }
  51906. var autoCssTransition = cached(function (name) {
  51907. return {
  51908. enterClass: (name + "-enter"),
  51909. enterToClass: (name + "-enter-to"),
  51910. enterActiveClass: (name + "-enter-active"),
  51911. leaveClass: (name + "-leave"),
  51912. leaveToClass: (name + "-leave-to"),
  51913. leaveActiveClass: (name + "-leave-active")
  51914. }
  51915. });
  51916. var hasTransition = inBrowser && !isIE9;
  51917. var TRANSITION = 'transition';
  51918. var ANIMATION = 'animation';
  51919. // Transition property/event sniffing
  51920. var transitionProp = 'transition';
  51921. var transitionEndEvent = 'transitionend';
  51922. var animationProp = 'animation';
  51923. var animationEndEvent = 'animationend';
  51924. if (hasTransition) {
  51925. /* istanbul ignore if */
  51926. if (window.ontransitionend === undefined &&
  51927. window.onwebkittransitionend !== undefined
  51928. ) {
  51929. transitionProp = 'WebkitTransition';
  51930. transitionEndEvent = 'webkitTransitionEnd';
  51931. }
  51932. if (window.onanimationend === undefined &&
  51933. window.onwebkitanimationend !== undefined
  51934. ) {
  51935. animationProp = 'WebkitAnimation';
  51936. animationEndEvent = 'webkitAnimationEnd';
  51937. }
  51938. }
  51939. // binding to window is necessary to make hot reload work in IE in strict mode
  51940. var raf = inBrowser
  51941. ? window.requestAnimationFrame
  51942. ? window.requestAnimationFrame.bind(window)
  51943. : setTimeout
  51944. : /* istanbul ignore next */ function (fn) { return fn(); };
  51945. function nextFrame (fn) {
  51946. raf(function () {
  51947. raf(fn);
  51948. });
  51949. }
  51950. function addTransitionClass (el, cls) {
  51951. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51952. if (transitionClasses.indexOf(cls) < 0) {
  51953. transitionClasses.push(cls);
  51954. addClass(el, cls);
  51955. }
  51956. }
  51957. function removeTransitionClass (el, cls) {
  51958. if (el._transitionClasses) {
  51959. remove(el._transitionClasses, cls);
  51960. }
  51961. removeClass(el, cls);
  51962. }
  51963. function whenTransitionEnds (
  51964. el,
  51965. expectedType,
  51966. cb
  51967. ) {
  51968. var ref = getTransitionInfo(el, expectedType);
  51969. var type = ref.type;
  51970. var timeout = ref.timeout;
  51971. var propCount = ref.propCount;
  51972. if (!type) { return cb() }
  51973. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51974. var ended = 0;
  51975. var end = function () {
  51976. el.removeEventListener(event, onEnd);
  51977. cb();
  51978. };
  51979. var onEnd = function (e) {
  51980. if (e.target === el) {
  51981. if (++ended >= propCount) {
  51982. end();
  51983. }
  51984. }
  51985. };
  51986. setTimeout(function () {
  51987. if (ended < propCount) {
  51988. end();
  51989. }
  51990. }, timeout + 1);
  51991. el.addEventListener(event, onEnd);
  51992. }
  51993. var transformRE = /\b(transform|all)(,|$)/;
  51994. function getTransitionInfo (el, expectedType) {
  51995. var styles = window.getComputedStyle(el);
  51996. // JSDOM may return undefined for transition properties
  51997. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51998. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51999. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  52000. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  52001. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  52002. var animationTimeout = getTimeout(animationDelays, animationDurations);
  52003. var type;
  52004. var timeout = 0;
  52005. var propCount = 0;
  52006. /* istanbul ignore if */
  52007. if (expectedType === TRANSITION) {
  52008. if (transitionTimeout > 0) {
  52009. type = TRANSITION;
  52010. timeout = transitionTimeout;
  52011. propCount = transitionDurations.length;
  52012. }
  52013. } else if (expectedType === ANIMATION) {
  52014. if (animationTimeout > 0) {
  52015. type = ANIMATION;
  52016. timeout = animationTimeout;
  52017. propCount = animationDurations.length;
  52018. }
  52019. } else {
  52020. timeout = Math.max(transitionTimeout, animationTimeout);
  52021. type = timeout > 0
  52022. ? transitionTimeout > animationTimeout
  52023. ? TRANSITION
  52024. : ANIMATION
  52025. : null;
  52026. propCount = type
  52027. ? type === TRANSITION
  52028. ? transitionDurations.length
  52029. : animationDurations.length
  52030. : 0;
  52031. }
  52032. var hasTransform =
  52033. type === TRANSITION &&
  52034. transformRE.test(styles[transitionProp + 'Property']);
  52035. return {
  52036. type: type,
  52037. timeout: timeout,
  52038. propCount: propCount,
  52039. hasTransform: hasTransform
  52040. }
  52041. }
  52042. function getTimeout (delays, durations) {
  52043. /* istanbul ignore next */
  52044. while (delays.length < durations.length) {
  52045. delays = delays.concat(delays);
  52046. }
  52047. return Math.max.apply(null, durations.map(function (d, i) {
  52048. return toMs(d) + toMs(delays[i])
  52049. }))
  52050. }
  52051. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  52052. // in a locale-dependent way, using a comma instead of a dot.
  52053. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  52054. // as a floor function) causing unexpected behaviors
  52055. function toMs (s) {
  52056. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  52057. }
  52058. /* */
  52059. function enter (vnode, toggleDisplay) {
  52060. var el = vnode.elm;
  52061. // call leave callback now
  52062. if (isDef(el._leaveCb)) {
  52063. el._leaveCb.cancelled = true;
  52064. el._leaveCb();
  52065. }
  52066. var data = resolveTransition(vnode.data.transition);
  52067. if (isUndef(data)) {
  52068. return
  52069. }
  52070. /* istanbul ignore if */
  52071. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52072. return
  52073. }
  52074. var css = data.css;
  52075. var type = data.type;
  52076. var enterClass = data.enterClass;
  52077. var enterToClass = data.enterToClass;
  52078. var enterActiveClass = data.enterActiveClass;
  52079. var appearClass = data.appearClass;
  52080. var appearToClass = data.appearToClass;
  52081. var appearActiveClass = data.appearActiveClass;
  52082. var beforeEnter = data.beforeEnter;
  52083. var enter = data.enter;
  52084. var afterEnter = data.afterEnter;
  52085. var enterCancelled = data.enterCancelled;
  52086. var beforeAppear = data.beforeAppear;
  52087. var appear = data.appear;
  52088. var afterAppear = data.afterAppear;
  52089. var appearCancelled = data.appearCancelled;
  52090. var duration = data.duration;
  52091. // activeInstance will always be the <transition> component managing this
  52092. // transition. One edge case to check is when the <transition> is placed
  52093. // as the root node of a child component. In that case we need to check
  52094. // <transition>'s parent for appear check.
  52095. var context = activeInstance;
  52096. var transitionNode = activeInstance.$vnode;
  52097. while (transitionNode && transitionNode.parent) {
  52098. context = transitionNode.context;
  52099. transitionNode = transitionNode.parent;
  52100. }
  52101. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52102. if (isAppear && !appear && appear !== '') {
  52103. return
  52104. }
  52105. var startClass = isAppear && appearClass
  52106. ? appearClass
  52107. : enterClass;
  52108. var activeClass = isAppear && appearActiveClass
  52109. ? appearActiveClass
  52110. : enterActiveClass;
  52111. var toClass = isAppear && appearToClass
  52112. ? appearToClass
  52113. : enterToClass;
  52114. var beforeEnterHook = isAppear
  52115. ? (beforeAppear || beforeEnter)
  52116. : beforeEnter;
  52117. var enterHook = isAppear
  52118. ? (typeof appear === 'function' ? appear : enter)
  52119. : enter;
  52120. var afterEnterHook = isAppear
  52121. ? (afterAppear || afterEnter)
  52122. : afterEnter;
  52123. var enterCancelledHook = isAppear
  52124. ? (appearCancelled || enterCancelled)
  52125. : enterCancelled;
  52126. var explicitEnterDuration = toNumber(
  52127. isObject(duration)
  52128. ? duration.enter
  52129. : duration
  52130. );
  52131. if (explicitEnterDuration != null) {
  52132. checkDuration(explicitEnterDuration, 'enter', vnode);
  52133. }
  52134. var expectsCSS = css !== false && !isIE9;
  52135. var userWantsControl = getHookArgumentsLength(enterHook);
  52136. var cb = el._enterCb = once(function () {
  52137. if (expectsCSS) {
  52138. removeTransitionClass(el, toClass);
  52139. removeTransitionClass(el, activeClass);
  52140. }
  52141. if (cb.cancelled) {
  52142. if (expectsCSS) {
  52143. removeTransitionClass(el, startClass);
  52144. }
  52145. enterCancelledHook && enterCancelledHook(el);
  52146. } else {
  52147. afterEnterHook && afterEnterHook(el);
  52148. }
  52149. el._enterCb = null;
  52150. });
  52151. if (!vnode.data.show) {
  52152. // remove pending leave element on enter by injecting an insert hook
  52153. mergeVNodeHook(vnode, 'insert', function () {
  52154. var parent = el.parentNode;
  52155. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52156. if (pendingNode &&
  52157. pendingNode.tag === vnode.tag &&
  52158. pendingNode.elm._leaveCb
  52159. ) {
  52160. pendingNode.elm._leaveCb();
  52161. }
  52162. enterHook && enterHook(el, cb);
  52163. });
  52164. }
  52165. // start enter transition
  52166. beforeEnterHook && beforeEnterHook(el);
  52167. if (expectsCSS) {
  52168. addTransitionClass(el, startClass);
  52169. addTransitionClass(el, activeClass);
  52170. nextFrame(function () {
  52171. removeTransitionClass(el, startClass);
  52172. if (!cb.cancelled) {
  52173. addTransitionClass(el, toClass);
  52174. if (!userWantsControl) {
  52175. if (isValidDuration(explicitEnterDuration)) {
  52176. setTimeout(cb, explicitEnterDuration);
  52177. } else {
  52178. whenTransitionEnds(el, type, cb);
  52179. }
  52180. }
  52181. }
  52182. });
  52183. }
  52184. if (vnode.data.show) {
  52185. toggleDisplay && toggleDisplay();
  52186. enterHook && enterHook(el, cb);
  52187. }
  52188. if (!expectsCSS && !userWantsControl) {
  52189. cb();
  52190. }
  52191. }
  52192. function leave (vnode, rm) {
  52193. var el = vnode.elm;
  52194. // call enter callback now
  52195. if (isDef(el._enterCb)) {
  52196. el._enterCb.cancelled = true;
  52197. el._enterCb();
  52198. }
  52199. var data = resolveTransition(vnode.data.transition);
  52200. if (isUndef(data) || el.nodeType !== 1) {
  52201. return rm()
  52202. }
  52203. /* istanbul ignore if */
  52204. if (isDef(el._leaveCb)) {
  52205. return
  52206. }
  52207. var css = data.css;
  52208. var type = data.type;
  52209. var leaveClass = data.leaveClass;
  52210. var leaveToClass = data.leaveToClass;
  52211. var leaveActiveClass = data.leaveActiveClass;
  52212. var beforeLeave = data.beforeLeave;
  52213. var leave = data.leave;
  52214. var afterLeave = data.afterLeave;
  52215. var leaveCancelled = data.leaveCancelled;
  52216. var delayLeave = data.delayLeave;
  52217. var duration = data.duration;
  52218. var expectsCSS = css !== false && !isIE9;
  52219. var userWantsControl = getHookArgumentsLength(leave);
  52220. var explicitLeaveDuration = toNumber(
  52221. isObject(duration)
  52222. ? duration.leave
  52223. : duration
  52224. );
  52225. if (isDef(explicitLeaveDuration)) {
  52226. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52227. }
  52228. var cb = el._leaveCb = once(function () {
  52229. if (el.parentNode && el.parentNode._pending) {
  52230. el.parentNode._pending[vnode.key] = null;
  52231. }
  52232. if (expectsCSS) {
  52233. removeTransitionClass(el, leaveToClass);
  52234. removeTransitionClass(el, leaveActiveClass);
  52235. }
  52236. if (cb.cancelled) {
  52237. if (expectsCSS) {
  52238. removeTransitionClass(el, leaveClass);
  52239. }
  52240. leaveCancelled && leaveCancelled(el);
  52241. } else {
  52242. rm();
  52243. afterLeave && afterLeave(el);
  52244. }
  52245. el._leaveCb = null;
  52246. });
  52247. if (delayLeave) {
  52248. delayLeave(performLeave);
  52249. } else {
  52250. performLeave();
  52251. }
  52252. function performLeave () {
  52253. // the delayed leave may have already been cancelled
  52254. if (cb.cancelled) {
  52255. return
  52256. }
  52257. // record leaving element
  52258. if (!vnode.data.show && el.parentNode) {
  52259. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52260. }
  52261. beforeLeave && beforeLeave(el);
  52262. if (expectsCSS) {
  52263. addTransitionClass(el, leaveClass);
  52264. addTransitionClass(el, leaveActiveClass);
  52265. nextFrame(function () {
  52266. removeTransitionClass(el, leaveClass);
  52267. if (!cb.cancelled) {
  52268. addTransitionClass(el, leaveToClass);
  52269. if (!userWantsControl) {
  52270. if (isValidDuration(explicitLeaveDuration)) {
  52271. setTimeout(cb, explicitLeaveDuration);
  52272. } else {
  52273. whenTransitionEnds(el, type, cb);
  52274. }
  52275. }
  52276. }
  52277. });
  52278. }
  52279. leave && leave(el, cb);
  52280. if (!expectsCSS && !userWantsControl) {
  52281. cb();
  52282. }
  52283. }
  52284. }
  52285. // only used in dev mode
  52286. function checkDuration (val, name, vnode) {
  52287. if (typeof val !== 'number') {
  52288. warn(
  52289. "<transition> explicit " + name + " duration is not a valid number - " +
  52290. "got " + (JSON.stringify(val)) + ".",
  52291. vnode.context
  52292. );
  52293. } else if (isNaN(val)) {
  52294. warn(
  52295. "<transition> explicit " + name + " duration is NaN - " +
  52296. 'the duration expression might be incorrect.',
  52297. vnode.context
  52298. );
  52299. }
  52300. }
  52301. function isValidDuration (val) {
  52302. return typeof val === 'number' && !isNaN(val)
  52303. }
  52304. /**
  52305. * Normalize a transition hook's argument length. The hook may be:
  52306. * - a merged hook (invoker) with the original in .fns
  52307. * - a wrapped component method (check ._length)
  52308. * - a plain function (.length)
  52309. */
  52310. function getHookArgumentsLength (fn) {
  52311. if (isUndef(fn)) {
  52312. return false
  52313. }
  52314. var invokerFns = fn.fns;
  52315. if (isDef(invokerFns)) {
  52316. // invoker
  52317. return getHookArgumentsLength(
  52318. Array.isArray(invokerFns)
  52319. ? invokerFns[0]
  52320. : invokerFns
  52321. )
  52322. } else {
  52323. return (fn._length || fn.length) > 1
  52324. }
  52325. }
  52326. function _enter (_, vnode) {
  52327. if (vnode.data.show !== true) {
  52328. enter(vnode);
  52329. }
  52330. }
  52331. var transition = inBrowser ? {
  52332. create: _enter,
  52333. activate: _enter,
  52334. remove: function remove$$1 (vnode, rm) {
  52335. /* istanbul ignore else */
  52336. if (vnode.data.show !== true) {
  52337. leave(vnode, rm);
  52338. } else {
  52339. rm();
  52340. }
  52341. }
  52342. } : {};
  52343. var platformModules = [
  52344. attrs,
  52345. klass,
  52346. events,
  52347. domProps,
  52348. style,
  52349. transition
  52350. ];
  52351. /* */
  52352. // the directive module should be applied last, after all
  52353. // built-in modules have been applied.
  52354. var modules = platformModules.concat(baseModules);
  52355. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52356. /**
  52357. * Not type checking this file because flow doesn't like attaching
  52358. * properties to Elements.
  52359. */
  52360. /* istanbul ignore if */
  52361. if (isIE9) {
  52362. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52363. document.addEventListener('selectionchange', function () {
  52364. var el = document.activeElement;
  52365. if (el && el.vmodel) {
  52366. trigger(el, 'input');
  52367. }
  52368. });
  52369. }
  52370. var directive = {
  52371. inserted: function inserted (el, binding, vnode, oldVnode) {
  52372. if (vnode.tag === 'select') {
  52373. // #6903
  52374. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52375. mergeVNodeHook(vnode, 'postpatch', function () {
  52376. directive.componentUpdated(el, binding, vnode);
  52377. });
  52378. } else {
  52379. setSelected(el, binding, vnode.context);
  52380. }
  52381. el._vOptions = [].map.call(el.options, getValue);
  52382. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52383. el._vModifiers = binding.modifiers;
  52384. if (!binding.modifiers.lazy) {
  52385. el.addEventListener('compositionstart', onCompositionStart);
  52386. el.addEventListener('compositionend', onCompositionEnd);
  52387. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52388. // switching focus before confirming composition choice
  52389. // this also fixes the issue where some browsers e.g. iOS Chrome
  52390. // fires "change" instead of "input" on autocomplete.
  52391. el.addEventListener('change', onCompositionEnd);
  52392. /* istanbul ignore if */
  52393. if (isIE9) {
  52394. el.vmodel = true;
  52395. }
  52396. }
  52397. }
  52398. },
  52399. componentUpdated: function componentUpdated (el, binding, vnode) {
  52400. if (vnode.tag === 'select') {
  52401. setSelected(el, binding, vnode.context);
  52402. // in case the options rendered by v-for have changed,
  52403. // it's possible that the value is out-of-sync with the rendered options.
  52404. // detect such cases and filter out values that no longer has a matching
  52405. // option in the DOM.
  52406. var prevOptions = el._vOptions;
  52407. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52408. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52409. // trigger change event if
  52410. // no matching option found for at least one value
  52411. var needReset = el.multiple
  52412. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52413. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52414. if (needReset) {
  52415. trigger(el, 'change');
  52416. }
  52417. }
  52418. }
  52419. }
  52420. };
  52421. function setSelected (el, binding, vm) {
  52422. actuallySetSelected(el, binding, vm);
  52423. /* istanbul ignore if */
  52424. if (isIE || isEdge) {
  52425. setTimeout(function () {
  52426. actuallySetSelected(el, binding, vm);
  52427. }, 0);
  52428. }
  52429. }
  52430. function actuallySetSelected (el, binding, vm) {
  52431. var value = binding.value;
  52432. var isMultiple = el.multiple;
  52433. if (isMultiple && !Array.isArray(value)) {
  52434. warn(
  52435. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52436. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52437. vm
  52438. );
  52439. return
  52440. }
  52441. var selected, option;
  52442. for (var i = 0, l = el.options.length; i < l; i++) {
  52443. option = el.options[i];
  52444. if (isMultiple) {
  52445. selected = looseIndexOf(value, getValue(option)) > -1;
  52446. if (option.selected !== selected) {
  52447. option.selected = selected;
  52448. }
  52449. } else {
  52450. if (looseEqual(getValue(option), value)) {
  52451. if (el.selectedIndex !== i) {
  52452. el.selectedIndex = i;
  52453. }
  52454. return
  52455. }
  52456. }
  52457. }
  52458. if (!isMultiple) {
  52459. el.selectedIndex = -1;
  52460. }
  52461. }
  52462. function hasNoMatchingOption (value, options) {
  52463. return options.every(function (o) { return !looseEqual(o, value); })
  52464. }
  52465. function getValue (option) {
  52466. return '_value' in option
  52467. ? option._value
  52468. : option.value
  52469. }
  52470. function onCompositionStart (e) {
  52471. e.target.composing = true;
  52472. }
  52473. function onCompositionEnd (e) {
  52474. // prevent triggering an input event for no reason
  52475. if (!e.target.composing) { return }
  52476. e.target.composing = false;
  52477. trigger(e.target, 'input');
  52478. }
  52479. function trigger (el, type) {
  52480. var e = document.createEvent('HTMLEvents');
  52481. e.initEvent(type, true, true);
  52482. el.dispatchEvent(e);
  52483. }
  52484. /* */
  52485. // recursively search for possible transition defined inside the component root
  52486. function locateNode (vnode) {
  52487. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52488. ? locateNode(vnode.componentInstance._vnode)
  52489. : vnode
  52490. }
  52491. var show = {
  52492. bind: function bind (el, ref, vnode) {
  52493. var value = ref.value;
  52494. vnode = locateNode(vnode);
  52495. var transition$$1 = vnode.data && vnode.data.transition;
  52496. var originalDisplay = el.__vOriginalDisplay =
  52497. el.style.display === 'none' ? '' : el.style.display;
  52498. if (value && transition$$1) {
  52499. vnode.data.show = true;
  52500. enter(vnode, function () {
  52501. el.style.display = originalDisplay;
  52502. });
  52503. } else {
  52504. el.style.display = value ? originalDisplay : 'none';
  52505. }
  52506. },
  52507. update: function update (el, ref, vnode) {
  52508. var value = ref.value;
  52509. var oldValue = ref.oldValue;
  52510. /* istanbul ignore if */
  52511. if (!value === !oldValue) { return }
  52512. vnode = locateNode(vnode);
  52513. var transition$$1 = vnode.data && vnode.data.transition;
  52514. if (transition$$1) {
  52515. vnode.data.show = true;
  52516. if (value) {
  52517. enter(vnode, function () {
  52518. el.style.display = el.__vOriginalDisplay;
  52519. });
  52520. } else {
  52521. leave(vnode, function () {
  52522. el.style.display = 'none';
  52523. });
  52524. }
  52525. } else {
  52526. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52527. }
  52528. },
  52529. unbind: function unbind (
  52530. el,
  52531. binding,
  52532. vnode,
  52533. oldVnode,
  52534. isDestroy
  52535. ) {
  52536. if (!isDestroy) {
  52537. el.style.display = el.__vOriginalDisplay;
  52538. }
  52539. }
  52540. };
  52541. var platformDirectives = {
  52542. model: directive,
  52543. show: show
  52544. };
  52545. /* */
  52546. var transitionProps = {
  52547. name: String,
  52548. appear: Boolean,
  52549. css: Boolean,
  52550. mode: String,
  52551. type: String,
  52552. enterClass: String,
  52553. leaveClass: String,
  52554. enterToClass: String,
  52555. leaveToClass: String,
  52556. enterActiveClass: String,
  52557. leaveActiveClass: String,
  52558. appearClass: String,
  52559. appearActiveClass: String,
  52560. appearToClass: String,
  52561. duration: [Number, String, Object]
  52562. };
  52563. // in case the child is also an abstract component, e.g. <keep-alive>
  52564. // we want to recursively retrieve the real component to be rendered
  52565. function getRealChild (vnode) {
  52566. var compOptions = vnode && vnode.componentOptions;
  52567. if (compOptions && compOptions.Ctor.options.abstract) {
  52568. return getRealChild(getFirstComponentChild(compOptions.children))
  52569. } else {
  52570. return vnode
  52571. }
  52572. }
  52573. function extractTransitionData (comp) {
  52574. var data = {};
  52575. var options = comp.$options;
  52576. // props
  52577. for (var key in options.propsData) {
  52578. data[key] = comp[key];
  52579. }
  52580. // events.
  52581. // extract listeners and pass them directly to the transition methods
  52582. var listeners = options._parentListeners;
  52583. for (var key$1 in listeners) {
  52584. data[camelize(key$1)] = listeners[key$1];
  52585. }
  52586. return data
  52587. }
  52588. function placeholder (h, rawChild) {
  52589. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52590. return h('keep-alive', {
  52591. props: rawChild.componentOptions.propsData
  52592. })
  52593. }
  52594. }
  52595. function hasParentTransition (vnode) {
  52596. while ((vnode = vnode.parent)) {
  52597. if (vnode.data.transition) {
  52598. return true
  52599. }
  52600. }
  52601. }
  52602. function isSameChild (child, oldChild) {
  52603. return oldChild.key === child.key && oldChild.tag === child.tag
  52604. }
  52605. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52606. var isVShowDirective = function (d) { return d.name === 'show'; };
  52607. var Transition = {
  52608. name: 'transition',
  52609. props: transitionProps,
  52610. abstract: true,
  52611. render: function render (h) {
  52612. var this$1 = this;
  52613. var children = this.$slots.default;
  52614. if (!children) {
  52615. return
  52616. }
  52617. // filter out text nodes (possible whitespaces)
  52618. children = children.filter(isNotTextNode);
  52619. /* istanbul ignore if */
  52620. if (!children.length) {
  52621. return
  52622. }
  52623. // warn multiple elements
  52624. if (children.length > 1) {
  52625. warn(
  52626. '<transition> can only be used on a single element. Use ' +
  52627. '<transition-group> for lists.',
  52628. this.$parent
  52629. );
  52630. }
  52631. var mode = this.mode;
  52632. // warn invalid mode
  52633. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52634. ) {
  52635. warn(
  52636. 'invalid <transition> mode: ' + mode,
  52637. this.$parent
  52638. );
  52639. }
  52640. var rawChild = children[0];
  52641. // if this is a component root node and the component's
  52642. // parent container node also has transition, skip.
  52643. if (hasParentTransition(this.$vnode)) {
  52644. return rawChild
  52645. }
  52646. // apply transition data to child
  52647. // use getRealChild() to ignore abstract components e.g. keep-alive
  52648. var child = getRealChild(rawChild);
  52649. /* istanbul ignore if */
  52650. if (!child) {
  52651. return rawChild
  52652. }
  52653. if (this._leaving) {
  52654. return placeholder(h, rawChild)
  52655. }
  52656. // ensure a key that is unique to the vnode type and to this transition
  52657. // component instance. This key will be used to remove pending leaving nodes
  52658. // during entering.
  52659. var id = "__transition-" + (this._uid) + "-";
  52660. child.key = child.key == null
  52661. ? child.isComment
  52662. ? id + 'comment'
  52663. : id + child.tag
  52664. : isPrimitive(child.key)
  52665. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52666. : child.key;
  52667. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52668. var oldRawChild = this._vnode;
  52669. var oldChild = getRealChild(oldRawChild);
  52670. // mark v-show
  52671. // so that the transition module can hand over the control to the directive
  52672. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52673. child.data.show = true;
  52674. }
  52675. if (
  52676. oldChild &&
  52677. oldChild.data &&
  52678. !isSameChild(child, oldChild) &&
  52679. !isAsyncPlaceholder(oldChild) &&
  52680. // #6687 component root is a comment node
  52681. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52682. ) {
  52683. // replace old child transition data with fresh one
  52684. // important for dynamic transitions!
  52685. var oldData = oldChild.data.transition = extend({}, data);
  52686. // handle transition mode
  52687. if (mode === 'out-in') {
  52688. // return placeholder node and queue update when leave finishes
  52689. this._leaving = true;
  52690. mergeVNodeHook(oldData, 'afterLeave', function () {
  52691. this$1._leaving = false;
  52692. this$1.$forceUpdate();
  52693. });
  52694. return placeholder(h, rawChild)
  52695. } else if (mode === 'in-out') {
  52696. if (isAsyncPlaceholder(child)) {
  52697. return oldRawChild
  52698. }
  52699. var delayedLeave;
  52700. var performLeave = function () { delayedLeave(); };
  52701. mergeVNodeHook(data, 'afterEnter', performLeave);
  52702. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52703. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52704. }
  52705. }
  52706. return rawChild
  52707. }
  52708. };
  52709. /* */
  52710. var props = extend({
  52711. tag: String,
  52712. moveClass: String
  52713. }, transitionProps);
  52714. delete props.mode;
  52715. var TransitionGroup = {
  52716. props: props,
  52717. beforeMount: function beforeMount () {
  52718. var this$1 = this;
  52719. var update = this._update;
  52720. this._update = function (vnode, hydrating) {
  52721. var restoreActiveInstance = setActiveInstance(this$1);
  52722. // force removing pass
  52723. this$1.__patch__(
  52724. this$1._vnode,
  52725. this$1.kept,
  52726. false, // hydrating
  52727. true // removeOnly (!important, avoids unnecessary moves)
  52728. );
  52729. this$1._vnode = this$1.kept;
  52730. restoreActiveInstance();
  52731. update.call(this$1, vnode, hydrating);
  52732. };
  52733. },
  52734. render: function render (h) {
  52735. var tag = this.tag || this.$vnode.data.tag || 'span';
  52736. var map = Object.create(null);
  52737. var prevChildren = this.prevChildren = this.children;
  52738. var rawChildren = this.$slots.default || [];
  52739. var children = this.children = [];
  52740. var transitionData = extractTransitionData(this);
  52741. for (var i = 0; i < rawChildren.length; i++) {
  52742. var c = rawChildren[i];
  52743. if (c.tag) {
  52744. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52745. children.push(c);
  52746. map[c.key] = c
  52747. ;(c.data || (c.data = {})).transition = transitionData;
  52748. } else {
  52749. var opts = c.componentOptions;
  52750. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52751. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52752. }
  52753. }
  52754. }
  52755. if (prevChildren) {
  52756. var kept = [];
  52757. var removed = [];
  52758. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52759. var c$1 = prevChildren[i$1];
  52760. c$1.data.transition = transitionData;
  52761. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52762. if (map[c$1.key]) {
  52763. kept.push(c$1);
  52764. } else {
  52765. removed.push(c$1);
  52766. }
  52767. }
  52768. this.kept = h(tag, null, kept);
  52769. this.removed = removed;
  52770. }
  52771. return h(tag, null, children)
  52772. },
  52773. updated: function updated () {
  52774. var children = this.prevChildren;
  52775. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52776. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52777. return
  52778. }
  52779. // we divide the work into three loops to avoid mixing DOM reads and writes
  52780. // in each iteration - which helps prevent layout thrashing.
  52781. children.forEach(callPendingCbs);
  52782. children.forEach(recordPosition);
  52783. children.forEach(applyTranslation);
  52784. // force reflow to put everything in position
  52785. // assign to this to avoid being removed in tree-shaking
  52786. // $flow-disable-line
  52787. this._reflow = document.body.offsetHeight;
  52788. children.forEach(function (c) {
  52789. if (c.data.moved) {
  52790. var el = c.elm;
  52791. var s = el.style;
  52792. addTransitionClass(el, moveClass);
  52793. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52794. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52795. if (e && e.target !== el) {
  52796. return
  52797. }
  52798. if (!e || /transform$/.test(e.propertyName)) {
  52799. el.removeEventListener(transitionEndEvent, cb);
  52800. el._moveCb = null;
  52801. removeTransitionClass(el, moveClass);
  52802. }
  52803. });
  52804. }
  52805. });
  52806. },
  52807. methods: {
  52808. hasMove: function hasMove (el, moveClass) {
  52809. /* istanbul ignore if */
  52810. if (!hasTransition) {
  52811. return false
  52812. }
  52813. /* istanbul ignore if */
  52814. if (this._hasMove) {
  52815. return this._hasMove
  52816. }
  52817. // Detect whether an element with the move class applied has
  52818. // CSS transitions. Since the element may be inside an entering
  52819. // transition at this very moment, we make a clone of it and remove
  52820. // all other transition classes applied to ensure only the move class
  52821. // is applied.
  52822. var clone = el.cloneNode();
  52823. if (el._transitionClasses) {
  52824. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52825. }
  52826. addClass(clone, moveClass);
  52827. clone.style.display = 'none';
  52828. this.$el.appendChild(clone);
  52829. var info = getTransitionInfo(clone);
  52830. this.$el.removeChild(clone);
  52831. return (this._hasMove = info.hasTransform)
  52832. }
  52833. }
  52834. };
  52835. function callPendingCbs (c) {
  52836. /* istanbul ignore if */
  52837. if (c.elm._moveCb) {
  52838. c.elm._moveCb();
  52839. }
  52840. /* istanbul ignore if */
  52841. if (c.elm._enterCb) {
  52842. c.elm._enterCb();
  52843. }
  52844. }
  52845. function recordPosition (c) {
  52846. c.data.newPos = c.elm.getBoundingClientRect();
  52847. }
  52848. function applyTranslation (c) {
  52849. var oldPos = c.data.pos;
  52850. var newPos = c.data.newPos;
  52851. var dx = oldPos.left - newPos.left;
  52852. var dy = oldPos.top - newPos.top;
  52853. if (dx || dy) {
  52854. c.data.moved = true;
  52855. var s = c.elm.style;
  52856. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52857. s.transitionDuration = '0s';
  52858. }
  52859. }
  52860. var platformComponents = {
  52861. Transition: Transition,
  52862. TransitionGroup: TransitionGroup
  52863. };
  52864. /* */
  52865. // install platform specific utils
  52866. Vue.config.mustUseProp = mustUseProp;
  52867. Vue.config.isReservedTag = isReservedTag;
  52868. Vue.config.isReservedAttr = isReservedAttr;
  52869. Vue.config.getTagNamespace = getTagNamespace;
  52870. Vue.config.isUnknownElement = isUnknownElement;
  52871. // install platform runtime directives & components
  52872. extend(Vue.options.directives, platformDirectives);
  52873. extend(Vue.options.components, platformComponents);
  52874. // install platform patch function
  52875. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52876. // public mount method
  52877. Vue.prototype.$mount = function (
  52878. el,
  52879. hydrating
  52880. ) {
  52881. el = el && inBrowser ? query(el) : undefined;
  52882. return mountComponent(this, el, hydrating)
  52883. };
  52884. // devtools global hook
  52885. /* istanbul ignore next */
  52886. if (inBrowser) {
  52887. setTimeout(function () {
  52888. if (config.devtools) {
  52889. if (devtools) {
  52890. devtools.emit('init', Vue);
  52891. } else {
  52892. console[console.info ? 'info' : 'log'](
  52893. 'Download the Vue Devtools extension for a better development experience:\n' +
  52894. 'https://github.com/vuejs/vue-devtools'
  52895. );
  52896. }
  52897. }
  52898. if (config.productionTip !== false &&
  52899. typeof console !== 'undefined'
  52900. ) {
  52901. console[console.info ? 'info' : 'log'](
  52902. "You are running Vue in development mode.\n" +
  52903. "Make sure to turn on production mode when deploying for production.\n" +
  52904. "See more tips at https://vuejs.org/guide/deployment.html"
  52905. );
  52906. }
  52907. }, 0);
  52908. }
  52909. /* */
  52910. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52911. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52912. var buildRegex = cached(function (delimiters) {
  52913. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52914. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52915. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52916. });
  52917. function parseText (
  52918. text,
  52919. delimiters
  52920. ) {
  52921. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52922. if (!tagRE.test(text)) {
  52923. return
  52924. }
  52925. var tokens = [];
  52926. var rawTokens = [];
  52927. var lastIndex = tagRE.lastIndex = 0;
  52928. var match, index, tokenValue;
  52929. while ((match = tagRE.exec(text))) {
  52930. index = match.index;
  52931. // push text token
  52932. if (index > lastIndex) {
  52933. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52934. tokens.push(JSON.stringify(tokenValue));
  52935. }
  52936. // tag token
  52937. var exp = parseFilters(match[1].trim());
  52938. tokens.push(("_s(" + exp + ")"));
  52939. rawTokens.push({ '@binding': exp });
  52940. lastIndex = index + match[0].length;
  52941. }
  52942. if (lastIndex < text.length) {
  52943. rawTokens.push(tokenValue = text.slice(lastIndex));
  52944. tokens.push(JSON.stringify(tokenValue));
  52945. }
  52946. return {
  52947. expression: tokens.join('+'),
  52948. tokens: rawTokens
  52949. }
  52950. }
  52951. /* */
  52952. function transformNode (el, options) {
  52953. var warn = options.warn || baseWarn;
  52954. var staticClass = getAndRemoveAttr(el, 'class');
  52955. if (staticClass) {
  52956. var res = parseText(staticClass, options.delimiters);
  52957. if (res) {
  52958. warn(
  52959. "class=\"" + staticClass + "\": " +
  52960. 'Interpolation inside attributes has been removed. ' +
  52961. 'Use v-bind or the colon shorthand instead. For example, ' +
  52962. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52963. el.rawAttrsMap['class']
  52964. );
  52965. }
  52966. }
  52967. if (staticClass) {
  52968. el.staticClass = JSON.stringify(staticClass);
  52969. }
  52970. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52971. if (classBinding) {
  52972. el.classBinding = classBinding;
  52973. }
  52974. }
  52975. function genData (el) {
  52976. var data = '';
  52977. if (el.staticClass) {
  52978. data += "staticClass:" + (el.staticClass) + ",";
  52979. }
  52980. if (el.classBinding) {
  52981. data += "class:" + (el.classBinding) + ",";
  52982. }
  52983. return data
  52984. }
  52985. var klass$1 = {
  52986. staticKeys: ['staticClass'],
  52987. transformNode: transformNode,
  52988. genData: genData
  52989. };
  52990. /* */
  52991. function transformNode$1 (el, options) {
  52992. var warn = options.warn || baseWarn;
  52993. var staticStyle = getAndRemoveAttr(el, 'style');
  52994. if (staticStyle) {
  52995. /* istanbul ignore if */
  52996. {
  52997. var res = parseText(staticStyle, options.delimiters);
  52998. if (res) {
  52999. warn(
  53000. "style=\"" + staticStyle + "\": " +
  53001. 'Interpolation inside attributes has been removed. ' +
  53002. 'Use v-bind or the colon shorthand instead. For example, ' +
  53003. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  53004. el.rawAttrsMap['style']
  53005. );
  53006. }
  53007. }
  53008. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  53009. }
  53010. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  53011. if (styleBinding) {
  53012. el.styleBinding = styleBinding;
  53013. }
  53014. }
  53015. function genData$1 (el) {
  53016. var data = '';
  53017. if (el.staticStyle) {
  53018. data += "staticStyle:" + (el.staticStyle) + ",";
  53019. }
  53020. if (el.styleBinding) {
  53021. data += "style:(" + (el.styleBinding) + "),";
  53022. }
  53023. return data
  53024. }
  53025. var style$1 = {
  53026. staticKeys: ['staticStyle'],
  53027. transformNode: transformNode$1,
  53028. genData: genData$1
  53029. };
  53030. /* */
  53031. var decoder;
  53032. var he = {
  53033. decode: function decode (html) {
  53034. decoder = decoder || document.createElement('div');
  53035. decoder.innerHTML = html;
  53036. return decoder.textContent
  53037. }
  53038. };
  53039. /* */
  53040. var isUnaryTag = makeMap(
  53041. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  53042. 'link,meta,param,source,track,wbr'
  53043. );
  53044. // Elements that you can, intentionally, leave open
  53045. // (and which close themselves)
  53046. var canBeLeftOpenTag = makeMap(
  53047. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  53048. );
  53049. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  53050. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  53051. var isNonPhrasingTag = makeMap(
  53052. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  53053. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  53054. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  53055. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  53056. 'title,tr,track'
  53057. );
  53058. /**
  53059. * Not type-checking this file because it's mostly vendor code.
  53060. */
  53061. // Regular Expressions for parsing tags and attributes
  53062. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53063. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53064. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  53065. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  53066. var startTagOpen = new RegExp(("^<" + qnameCapture));
  53067. var startTagClose = /^\s*(\/?)>/;
  53068. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  53069. var doctype = /^<!DOCTYPE [^>]+>/i;
  53070. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53071. var comment = /^<!\--/;
  53072. var conditionalComment = /^<!\[/;
  53073. // Special Elements (can contain anything)
  53074. var isPlainTextElement = makeMap('script,style,textarea', true);
  53075. var reCache = {};
  53076. var decodingMap = {
  53077. '&lt;': '<',
  53078. '&gt;': '>',
  53079. '&quot;': '"',
  53080. '&amp;': '&',
  53081. '&#10;': '\n',
  53082. '&#9;': '\t',
  53083. '&#39;': "'"
  53084. };
  53085. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53086. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53087. // #5992
  53088. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53089. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53090. function decodeAttr (value, shouldDecodeNewlines) {
  53091. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53092. return value.replace(re, function (match) { return decodingMap[match]; })
  53093. }
  53094. function parseHTML (html, options) {
  53095. var stack = [];
  53096. var expectHTML = options.expectHTML;
  53097. var isUnaryTag$$1 = options.isUnaryTag || no;
  53098. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53099. var index = 0;
  53100. var last, lastTag;
  53101. while (html) {
  53102. last = html;
  53103. // Make sure we're not in a plaintext content element like script/style
  53104. if (!lastTag || !isPlainTextElement(lastTag)) {
  53105. var textEnd = html.indexOf('<');
  53106. if (textEnd === 0) {
  53107. // Comment:
  53108. if (comment.test(html)) {
  53109. var commentEnd = html.indexOf('-->');
  53110. if (commentEnd >= 0) {
  53111. if (options.shouldKeepComment) {
  53112. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53113. }
  53114. advance(commentEnd + 3);
  53115. continue
  53116. }
  53117. }
  53118. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53119. if (conditionalComment.test(html)) {
  53120. var conditionalEnd = html.indexOf(']>');
  53121. if (conditionalEnd >= 0) {
  53122. advance(conditionalEnd + 2);
  53123. continue
  53124. }
  53125. }
  53126. // Doctype:
  53127. var doctypeMatch = html.match(doctype);
  53128. if (doctypeMatch) {
  53129. advance(doctypeMatch[0].length);
  53130. continue
  53131. }
  53132. // End tag:
  53133. var endTagMatch = html.match(endTag);
  53134. if (endTagMatch) {
  53135. var curIndex = index;
  53136. advance(endTagMatch[0].length);
  53137. parseEndTag(endTagMatch[1], curIndex, index);
  53138. continue
  53139. }
  53140. // Start tag:
  53141. var startTagMatch = parseStartTag();
  53142. if (startTagMatch) {
  53143. handleStartTag(startTagMatch);
  53144. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53145. advance(1);
  53146. }
  53147. continue
  53148. }
  53149. }
  53150. var text = (void 0), rest = (void 0), next = (void 0);
  53151. if (textEnd >= 0) {
  53152. rest = html.slice(textEnd);
  53153. while (
  53154. !endTag.test(rest) &&
  53155. !startTagOpen.test(rest) &&
  53156. !comment.test(rest) &&
  53157. !conditionalComment.test(rest)
  53158. ) {
  53159. // < in plain text, be forgiving and treat it as text
  53160. next = rest.indexOf('<', 1);
  53161. if (next < 0) { break }
  53162. textEnd += next;
  53163. rest = html.slice(textEnd);
  53164. }
  53165. text = html.substring(0, textEnd);
  53166. }
  53167. if (textEnd < 0) {
  53168. text = html;
  53169. }
  53170. if (text) {
  53171. advance(text.length);
  53172. }
  53173. if (options.chars && text) {
  53174. options.chars(text, index - text.length, index);
  53175. }
  53176. } else {
  53177. var endTagLength = 0;
  53178. var stackedTag = lastTag.toLowerCase();
  53179. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53180. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53181. endTagLength = endTag.length;
  53182. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53183. text = text
  53184. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53185. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53186. }
  53187. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53188. text = text.slice(1);
  53189. }
  53190. if (options.chars) {
  53191. options.chars(text);
  53192. }
  53193. return ''
  53194. });
  53195. index += html.length - rest$1.length;
  53196. html = rest$1;
  53197. parseEndTag(stackedTag, index - endTagLength, index);
  53198. }
  53199. if (html === last) {
  53200. options.chars && options.chars(html);
  53201. if (!stack.length && options.warn) {
  53202. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53203. }
  53204. break
  53205. }
  53206. }
  53207. // Clean up any remaining tags
  53208. parseEndTag();
  53209. function advance (n) {
  53210. index += n;
  53211. html = html.substring(n);
  53212. }
  53213. function parseStartTag () {
  53214. var start = html.match(startTagOpen);
  53215. if (start) {
  53216. var match = {
  53217. tagName: start[1],
  53218. attrs: [],
  53219. start: index
  53220. };
  53221. advance(start[0].length);
  53222. var end, attr;
  53223. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53224. attr.start = index;
  53225. advance(attr[0].length);
  53226. attr.end = index;
  53227. match.attrs.push(attr);
  53228. }
  53229. if (end) {
  53230. match.unarySlash = end[1];
  53231. advance(end[0].length);
  53232. match.end = index;
  53233. return match
  53234. }
  53235. }
  53236. }
  53237. function handleStartTag (match) {
  53238. var tagName = match.tagName;
  53239. var unarySlash = match.unarySlash;
  53240. if (expectHTML) {
  53241. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53242. parseEndTag(lastTag);
  53243. }
  53244. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53245. parseEndTag(tagName);
  53246. }
  53247. }
  53248. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53249. var l = match.attrs.length;
  53250. var attrs = new Array(l);
  53251. for (var i = 0; i < l; i++) {
  53252. var args = match.attrs[i];
  53253. var value = args[3] || args[4] || args[5] || '';
  53254. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53255. ? options.shouldDecodeNewlinesForHref
  53256. : options.shouldDecodeNewlines;
  53257. attrs[i] = {
  53258. name: args[1],
  53259. value: decodeAttr(value, shouldDecodeNewlines)
  53260. };
  53261. if (options.outputSourceRange) {
  53262. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53263. attrs[i].end = args.end;
  53264. }
  53265. }
  53266. if (!unary) {
  53267. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53268. lastTag = tagName;
  53269. }
  53270. if (options.start) {
  53271. options.start(tagName, attrs, unary, match.start, match.end);
  53272. }
  53273. }
  53274. function parseEndTag (tagName, start, end) {
  53275. var pos, lowerCasedTagName;
  53276. if (start == null) { start = index; }
  53277. if (end == null) { end = index; }
  53278. // Find the closest opened tag of the same type
  53279. if (tagName) {
  53280. lowerCasedTagName = tagName.toLowerCase();
  53281. for (pos = stack.length - 1; pos >= 0; pos--) {
  53282. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53283. break
  53284. }
  53285. }
  53286. } else {
  53287. // If no tag name is provided, clean shop
  53288. pos = 0;
  53289. }
  53290. if (pos >= 0) {
  53291. // Close all the open elements, up the stack
  53292. for (var i = stack.length - 1; i >= pos; i--) {
  53293. if (i > pos || !tagName &&
  53294. options.warn
  53295. ) {
  53296. options.warn(
  53297. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53298. { start: stack[i].start, end: stack[i].end }
  53299. );
  53300. }
  53301. if (options.end) {
  53302. options.end(stack[i].tag, start, end);
  53303. }
  53304. }
  53305. // Remove the open elements from the stack
  53306. stack.length = pos;
  53307. lastTag = pos && stack[pos - 1].tag;
  53308. } else if (lowerCasedTagName === 'br') {
  53309. if (options.start) {
  53310. options.start(tagName, [], true, start, end);
  53311. }
  53312. } else if (lowerCasedTagName === 'p') {
  53313. if (options.start) {
  53314. options.start(tagName, [], false, start, end);
  53315. }
  53316. if (options.end) {
  53317. options.end(tagName, start, end);
  53318. }
  53319. }
  53320. }
  53321. }
  53322. /* */
  53323. var onRE = /^@|^v-on:/;
  53324. var dirRE = /^v-|^@|^:|^#/;
  53325. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53326. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53327. var stripParensRE = /^\(|\)$/g;
  53328. var dynamicArgRE = /^\[.*\]$/;
  53329. var argRE = /:(.*)$/;
  53330. var bindRE = /^:|^\.|^v-bind:/;
  53331. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53332. var slotRE = /^v-slot(:|$)|^#/;
  53333. var lineBreakRE = /[\r\n]/;
  53334. var whitespaceRE$1 = /\s+/g;
  53335. var invalidAttributeRE = /[\s"'<>\/=]/;
  53336. var decodeHTMLCached = cached(he.decode);
  53337. var emptySlotScopeToken = "_empty_";
  53338. // configurable state
  53339. var warn$2;
  53340. var delimiters;
  53341. var transforms;
  53342. var preTransforms;
  53343. var postTransforms;
  53344. var platformIsPreTag;
  53345. var platformMustUseProp;
  53346. var platformGetTagNamespace;
  53347. var maybeComponent;
  53348. function createASTElement (
  53349. tag,
  53350. attrs,
  53351. parent
  53352. ) {
  53353. return {
  53354. type: 1,
  53355. tag: tag,
  53356. attrsList: attrs,
  53357. attrsMap: makeAttrsMap(attrs),
  53358. rawAttrsMap: {},
  53359. parent: parent,
  53360. children: []
  53361. }
  53362. }
  53363. /**
  53364. * Convert HTML string to AST.
  53365. */
  53366. function parse (
  53367. template,
  53368. options
  53369. ) {
  53370. warn$2 = options.warn || baseWarn;
  53371. platformIsPreTag = options.isPreTag || no;
  53372. platformMustUseProp = options.mustUseProp || no;
  53373. platformGetTagNamespace = options.getTagNamespace || no;
  53374. var isReservedTag = options.isReservedTag || no;
  53375. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53376. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53377. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53378. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53379. delimiters = options.delimiters;
  53380. var stack = [];
  53381. var preserveWhitespace = options.preserveWhitespace !== false;
  53382. var whitespaceOption = options.whitespace;
  53383. var root;
  53384. var currentParent;
  53385. var inVPre = false;
  53386. var inPre = false;
  53387. var warned = false;
  53388. function warnOnce (msg, range) {
  53389. if (!warned) {
  53390. warned = true;
  53391. warn$2(msg, range);
  53392. }
  53393. }
  53394. function closeElement (element) {
  53395. trimEndingWhitespace(element);
  53396. if (!inVPre && !element.processed) {
  53397. element = processElement(element, options);
  53398. }
  53399. // tree management
  53400. if (!stack.length && element !== root) {
  53401. // allow root elements with v-if, v-else-if and v-else
  53402. if (root.if && (element.elseif || element.else)) {
  53403. {
  53404. checkRootConstraints(element);
  53405. }
  53406. addIfCondition(root, {
  53407. exp: element.elseif,
  53408. block: element
  53409. });
  53410. } else {
  53411. warnOnce(
  53412. "Component template should contain exactly one root element. " +
  53413. "If you are using v-if on multiple elements, " +
  53414. "use v-else-if to chain them instead.",
  53415. { start: element.start }
  53416. );
  53417. }
  53418. }
  53419. if (currentParent && !element.forbidden) {
  53420. if (element.elseif || element.else) {
  53421. processIfConditions(element, currentParent);
  53422. } else {
  53423. if (element.slotScope) {
  53424. // scoped slot
  53425. // keep it in the children list so that v-else(-if) conditions can
  53426. // find it as the prev node.
  53427. var name = element.slotTarget || '"default"'
  53428. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53429. }
  53430. currentParent.children.push(element);
  53431. element.parent = currentParent;
  53432. }
  53433. }
  53434. // final children cleanup
  53435. // filter out scoped slots
  53436. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53437. // remove trailing whitespace node again
  53438. trimEndingWhitespace(element);
  53439. // check pre state
  53440. if (element.pre) {
  53441. inVPre = false;
  53442. }
  53443. if (platformIsPreTag(element.tag)) {
  53444. inPre = false;
  53445. }
  53446. // apply post-transforms
  53447. for (var i = 0; i < postTransforms.length; i++) {
  53448. postTransforms[i](element, options);
  53449. }
  53450. }
  53451. function trimEndingWhitespace (el) {
  53452. // remove trailing whitespace node
  53453. if (!inPre) {
  53454. var lastNode;
  53455. while (
  53456. (lastNode = el.children[el.children.length - 1]) &&
  53457. lastNode.type === 3 &&
  53458. lastNode.text === ' '
  53459. ) {
  53460. el.children.pop();
  53461. }
  53462. }
  53463. }
  53464. function checkRootConstraints (el) {
  53465. if (el.tag === 'slot' || el.tag === 'template') {
  53466. warnOnce(
  53467. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53468. 'contain multiple nodes.',
  53469. { start: el.start }
  53470. );
  53471. }
  53472. if (el.attrsMap.hasOwnProperty('v-for')) {
  53473. warnOnce(
  53474. 'Cannot use v-for on stateful component root element because ' +
  53475. 'it renders multiple elements.',
  53476. el.rawAttrsMap['v-for']
  53477. );
  53478. }
  53479. }
  53480. parseHTML(template, {
  53481. warn: warn$2,
  53482. expectHTML: options.expectHTML,
  53483. isUnaryTag: options.isUnaryTag,
  53484. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53485. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53486. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53487. shouldKeepComment: options.comments,
  53488. outputSourceRange: options.outputSourceRange,
  53489. start: function start (tag, attrs, unary, start$1, end) {
  53490. // check namespace.
  53491. // inherit parent ns if there is one
  53492. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53493. // handle IE svg bug
  53494. /* istanbul ignore if */
  53495. if (isIE && ns === 'svg') {
  53496. attrs = guardIESVGBug(attrs);
  53497. }
  53498. var element = createASTElement(tag, attrs, currentParent);
  53499. if (ns) {
  53500. element.ns = ns;
  53501. }
  53502. {
  53503. if (options.outputSourceRange) {
  53504. element.start = start$1;
  53505. element.end = end;
  53506. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53507. cumulated[attr.name] = attr;
  53508. return cumulated
  53509. }, {});
  53510. }
  53511. attrs.forEach(function (attr) {
  53512. if (invalidAttributeRE.test(attr.name)) {
  53513. warn$2(
  53514. "Invalid dynamic argument expression: attribute names cannot contain " +
  53515. "spaces, quotes, <, >, / or =.",
  53516. {
  53517. start: attr.start + attr.name.indexOf("["),
  53518. end: attr.start + attr.name.length
  53519. }
  53520. );
  53521. }
  53522. });
  53523. }
  53524. if (isForbiddenTag(element) && !isServerRendering()) {
  53525. element.forbidden = true;
  53526. warn$2(
  53527. 'Templates should only be responsible for mapping the state to the ' +
  53528. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53529. "<" + tag + ">" + ', as they will not be parsed.',
  53530. { start: element.start }
  53531. );
  53532. }
  53533. // apply pre-transforms
  53534. for (var i = 0; i < preTransforms.length; i++) {
  53535. element = preTransforms[i](element, options) || element;
  53536. }
  53537. if (!inVPre) {
  53538. processPre(element);
  53539. if (element.pre) {
  53540. inVPre = true;
  53541. }
  53542. }
  53543. if (platformIsPreTag(element.tag)) {
  53544. inPre = true;
  53545. }
  53546. if (inVPre) {
  53547. processRawAttrs(element);
  53548. } else if (!element.processed) {
  53549. // structural directives
  53550. processFor(element);
  53551. processIf(element);
  53552. processOnce(element);
  53553. }
  53554. if (!root) {
  53555. root = element;
  53556. {
  53557. checkRootConstraints(root);
  53558. }
  53559. }
  53560. if (!unary) {
  53561. currentParent = element;
  53562. stack.push(element);
  53563. } else {
  53564. closeElement(element);
  53565. }
  53566. },
  53567. end: function end (tag, start, end$1) {
  53568. var element = stack[stack.length - 1];
  53569. // pop stack
  53570. stack.length -= 1;
  53571. currentParent = stack[stack.length - 1];
  53572. if (options.outputSourceRange) {
  53573. element.end = end$1;
  53574. }
  53575. closeElement(element);
  53576. },
  53577. chars: function chars (text, start, end) {
  53578. if (!currentParent) {
  53579. {
  53580. if (text === template) {
  53581. warnOnce(
  53582. 'Component template requires a root element, rather than just text.',
  53583. { start: start }
  53584. );
  53585. } else if ((text = text.trim())) {
  53586. warnOnce(
  53587. ("text \"" + text + "\" outside root element will be ignored."),
  53588. { start: start }
  53589. );
  53590. }
  53591. }
  53592. return
  53593. }
  53594. // IE textarea placeholder bug
  53595. /* istanbul ignore if */
  53596. if (isIE &&
  53597. currentParent.tag === 'textarea' &&
  53598. currentParent.attrsMap.placeholder === text
  53599. ) {
  53600. return
  53601. }
  53602. var children = currentParent.children;
  53603. if (inPre || text.trim()) {
  53604. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53605. } else if (!children.length) {
  53606. // remove the whitespace-only node right after an opening tag
  53607. text = '';
  53608. } else if (whitespaceOption) {
  53609. if (whitespaceOption === 'condense') {
  53610. // in condense mode, remove the whitespace node if it contains
  53611. // line break, otherwise condense to a single space
  53612. text = lineBreakRE.test(text) ? '' : ' ';
  53613. } else {
  53614. text = ' ';
  53615. }
  53616. } else {
  53617. text = preserveWhitespace ? ' ' : '';
  53618. }
  53619. if (text) {
  53620. if (!inPre && whitespaceOption === 'condense') {
  53621. // condense consecutive whitespaces into single space
  53622. text = text.replace(whitespaceRE$1, ' ');
  53623. }
  53624. var res;
  53625. var child;
  53626. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53627. child = {
  53628. type: 2,
  53629. expression: res.expression,
  53630. tokens: res.tokens,
  53631. text: text
  53632. };
  53633. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53634. child = {
  53635. type: 3,
  53636. text: text
  53637. };
  53638. }
  53639. if (child) {
  53640. if (options.outputSourceRange) {
  53641. child.start = start;
  53642. child.end = end;
  53643. }
  53644. children.push(child);
  53645. }
  53646. }
  53647. },
  53648. comment: function comment (text, start, end) {
  53649. // adding anyting as a sibling to the root node is forbidden
  53650. // comments should still be allowed, but ignored
  53651. if (currentParent) {
  53652. var child = {
  53653. type: 3,
  53654. text: text,
  53655. isComment: true
  53656. };
  53657. if (options.outputSourceRange) {
  53658. child.start = start;
  53659. child.end = end;
  53660. }
  53661. currentParent.children.push(child);
  53662. }
  53663. }
  53664. });
  53665. return root
  53666. }
  53667. function processPre (el) {
  53668. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53669. el.pre = true;
  53670. }
  53671. }
  53672. function processRawAttrs (el) {
  53673. var list = el.attrsList;
  53674. var len = list.length;
  53675. if (len) {
  53676. var attrs = el.attrs = new Array(len);
  53677. for (var i = 0; i < len; i++) {
  53678. attrs[i] = {
  53679. name: list[i].name,
  53680. value: JSON.stringify(list[i].value)
  53681. };
  53682. if (list[i].start != null) {
  53683. attrs[i].start = list[i].start;
  53684. attrs[i].end = list[i].end;
  53685. }
  53686. }
  53687. } else if (!el.pre) {
  53688. // non root node in pre blocks with no attributes
  53689. el.plain = true;
  53690. }
  53691. }
  53692. function processElement (
  53693. element,
  53694. options
  53695. ) {
  53696. processKey(element);
  53697. // determine whether this is a plain element after
  53698. // removing structural attributes
  53699. element.plain = (
  53700. !element.key &&
  53701. !element.scopedSlots &&
  53702. !element.attrsList.length
  53703. );
  53704. processRef(element);
  53705. processSlotContent(element);
  53706. processSlotOutlet(element);
  53707. processComponent(element);
  53708. for (var i = 0; i < transforms.length; i++) {
  53709. element = transforms[i](element, options) || element;
  53710. }
  53711. processAttrs(element);
  53712. return element
  53713. }
  53714. function processKey (el) {
  53715. var exp = getBindingAttr(el, 'key');
  53716. if (exp) {
  53717. {
  53718. if (el.tag === 'template') {
  53719. warn$2(
  53720. "<template> cannot be keyed. Place the key on real elements instead.",
  53721. getRawBindingAttr(el, 'key')
  53722. );
  53723. }
  53724. if (el.for) {
  53725. var iterator = el.iterator2 || el.iterator1;
  53726. var parent = el.parent;
  53727. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53728. warn$2(
  53729. "Do not use v-for index as key on <transition-group> children, " +
  53730. "this is the same as not using keys.",
  53731. getRawBindingAttr(el, 'key'),
  53732. true /* tip */
  53733. );
  53734. }
  53735. }
  53736. }
  53737. el.key = exp;
  53738. }
  53739. }
  53740. function processRef (el) {
  53741. var ref = getBindingAttr(el, 'ref');
  53742. if (ref) {
  53743. el.ref = ref;
  53744. el.refInFor = checkInFor(el);
  53745. }
  53746. }
  53747. function processFor (el) {
  53748. var exp;
  53749. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53750. var res = parseFor(exp);
  53751. if (res) {
  53752. extend(el, res);
  53753. } else {
  53754. warn$2(
  53755. ("Invalid v-for expression: " + exp),
  53756. el.rawAttrsMap['v-for']
  53757. );
  53758. }
  53759. }
  53760. }
  53761. function parseFor (exp) {
  53762. var inMatch = exp.match(forAliasRE);
  53763. if (!inMatch) { return }
  53764. var res = {};
  53765. res.for = inMatch[2].trim();
  53766. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53767. var iteratorMatch = alias.match(forIteratorRE);
  53768. if (iteratorMatch) {
  53769. res.alias = alias.replace(forIteratorRE, '').trim();
  53770. res.iterator1 = iteratorMatch[1].trim();
  53771. if (iteratorMatch[2]) {
  53772. res.iterator2 = iteratorMatch[2].trim();
  53773. }
  53774. } else {
  53775. res.alias = alias;
  53776. }
  53777. return res
  53778. }
  53779. function processIf (el) {
  53780. var exp = getAndRemoveAttr(el, 'v-if');
  53781. if (exp) {
  53782. el.if = exp;
  53783. addIfCondition(el, {
  53784. exp: exp,
  53785. block: el
  53786. });
  53787. } else {
  53788. if (getAndRemoveAttr(el, 'v-else') != null) {
  53789. el.else = true;
  53790. }
  53791. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53792. if (elseif) {
  53793. el.elseif = elseif;
  53794. }
  53795. }
  53796. }
  53797. function processIfConditions (el, parent) {
  53798. var prev = findPrevElement(parent.children);
  53799. if (prev && prev.if) {
  53800. addIfCondition(prev, {
  53801. exp: el.elseif,
  53802. block: el
  53803. });
  53804. } else {
  53805. warn$2(
  53806. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53807. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53808. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53809. );
  53810. }
  53811. }
  53812. function findPrevElement (children) {
  53813. var i = children.length;
  53814. while (i--) {
  53815. if (children[i].type === 1) {
  53816. return children[i]
  53817. } else {
  53818. if (children[i].text !== ' ') {
  53819. warn$2(
  53820. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53821. "will be ignored.",
  53822. children[i]
  53823. );
  53824. }
  53825. children.pop();
  53826. }
  53827. }
  53828. }
  53829. function addIfCondition (el, condition) {
  53830. if (!el.ifConditions) {
  53831. el.ifConditions = [];
  53832. }
  53833. el.ifConditions.push(condition);
  53834. }
  53835. function processOnce (el) {
  53836. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53837. if (once$$1 != null) {
  53838. el.once = true;
  53839. }
  53840. }
  53841. // handle content being passed to a component as slot,
  53842. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53843. function processSlotContent (el) {
  53844. var slotScope;
  53845. if (el.tag === 'template') {
  53846. slotScope = getAndRemoveAttr(el, 'scope');
  53847. /* istanbul ignore if */
  53848. if (slotScope) {
  53849. warn$2(
  53850. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53851. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53852. "can also be used on plain elements in addition to <template> to " +
  53853. "denote scoped slots.",
  53854. el.rawAttrsMap['scope'],
  53855. true
  53856. );
  53857. }
  53858. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53859. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53860. /* istanbul ignore if */
  53861. if (el.attrsMap['v-for']) {
  53862. warn$2(
  53863. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53864. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53865. "scoped slot to make it clearer.",
  53866. el.rawAttrsMap['slot-scope'],
  53867. true
  53868. );
  53869. }
  53870. el.slotScope = slotScope;
  53871. }
  53872. // slot="xxx"
  53873. var slotTarget = getBindingAttr(el, 'slot');
  53874. if (slotTarget) {
  53875. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53876. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53877. // preserve slot as an attribute for native shadow DOM compat
  53878. // only for non-scoped slots.
  53879. if (el.tag !== 'template' && !el.slotScope) {
  53880. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53881. }
  53882. }
  53883. // 2.6 v-slot syntax
  53884. {
  53885. if (el.tag === 'template') {
  53886. // v-slot on <template>
  53887. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53888. if (slotBinding) {
  53889. {
  53890. if (el.slotTarget || el.slotScope) {
  53891. warn$2(
  53892. "Unexpected mixed usage of different slot syntaxes.",
  53893. el
  53894. );
  53895. }
  53896. if (el.parent && !maybeComponent(el.parent)) {
  53897. warn$2(
  53898. "<template v-slot> can only appear at the root level inside " +
  53899. "the receiving component",
  53900. el
  53901. );
  53902. }
  53903. }
  53904. var ref = getSlotName(slotBinding);
  53905. var name = ref.name;
  53906. var dynamic = ref.dynamic;
  53907. el.slotTarget = name;
  53908. el.slotTargetDynamic = dynamic;
  53909. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53910. }
  53911. } else {
  53912. // v-slot on component, denotes default slot
  53913. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53914. if (slotBinding$1) {
  53915. {
  53916. if (!maybeComponent(el)) {
  53917. warn$2(
  53918. "v-slot can only be used on components or <template>.",
  53919. slotBinding$1
  53920. );
  53921. }
  53922. if (el.slotScope || el.slotTarget) {
  53923. warn$2(
  53924. "Unexpected mixed usage of different slot syntaxes.",
  53925. el
  53926. );
  53927. }
  53928. if (el.scopedSlots) {
  53929. warn$2(
  53930. "To avoid scope ambiguity, the default slot should also use " +
  53931. "<template> syntax when there are other named slots.",
  53932. slotBinding$1
  53933. );
  53934. }
  53935. }
  53936. // add the component's children to its default slot
  53937. var slots = el.scopedSlots || (el.scopedSlots = {});
  53938. var ref$1 = getSlotName(slotBinding$1);
  53939. var name$1 = ref$1.name;
  53940. var dynamic$1 = ref$1.dynamic;
  53941. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53942. slotContainer.slotTarget = name$1;
  53943. slotContainer.slotTargetDynamic = dynamic$1;
  53944. slotContainer.children = el.children.filter(function (c) {
  53945. if (!c.slotScope) {
  53946. c.parent = slotContainer;
  53947. return true
  53948. }
  53949. });
  53950. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53951. // remove children as they are returned from scopedSlots now
  53952. el.children = [];
  53953. // mark el non-plain so data gets generated
  53954. el.plain = false;
  53955. }
  53956. }
  53957. }
  53958. }
  53959. function getSlotName (binding) {
  53960. var name = binding.name.replace(slotRE, '');
  53961. if (!name) {
  53962. if (binding.name[0] !== '#') {
  53963. name = 'default';
  53964. } else {
  53965. warn$2(
  53966. "v-slot shorthand syntax requires a slot name.",
  53967. binding
  53968. );
  53969. }
  53970. }
  53971. return dynamicArgRE.test(name)
  53972. // dynamic [name]
  53973. ? { name: name.slice(1, -1), dynamic: true }
  53974. // static name
  53975. : { name: ("\"" + name + "\""), dynamic: false }
  53976. }
  53977. // handle <slot/> outlets
  53978. function processSlotOutlet (el) {
  53979. if (el.tag === 'slot') {
  53980. el.slotName = getBindingAttr(el, 'name');
  53981. if (el.key) {
  53982. warn$2(
  53983. "`key` does not work on <slot> because slots are abstract outlets " +
  53984. "and can possibly expand into multiple elements. " +
  53985. "Use the key on a wrapping element instead.",
  53986. getRawBindingAttr(el, 'key')
  53987. );
  53988. }
  53989. }
  53990. }
  53991. function processComponent (el) {
  53992. var binding;
  53993. if ((binding = getBindingAttr(el, 'is'))) {
  53994. el.component = binding;
  53995. }
  53996. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53997. el.inlineTemplate = true;
  53998. }
  53999. }
  54000. function processAttrs (el) {
  54001. var list = el.attrsList;
  54002. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  54003. for (i = 0, l = list.length; i < l; i++) {
  54004. name = rawName = list[i].name;
  54005. value = list[i].value;
  54006. if (dirRE.test(name)) {
  54007. // mark element as dynamic
  54008. el.hasBindings = true;
  54009. // modifiers
  54010. modifiers = parseModifiers(name.replace(dirRE, ''));
  54011. // support .foo shorthand syntax for the .prop modifier
  54012. if (modifiers) {
  54013. name = name.replace(modifierRE, '');
  54014. }
  54015. if (bindRE.test(name)) { // v-bind
  54016. name = name.replace(bindRE, '');
  54017. value = parseFilters(value);
  54018. isDynamic = dynamicArgRE.test(name);
  54019. if (isDynamic) {
  54020. name = name.slice(1, -1);
  54021. }
  54022. if (
  54023. value.trim().length === 0
  54024. ) {
  54025. warn$2(
  54026. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  54027. );
  54028. }
  54029. if (modifiers) {
  54030. if (modifiers.prop && !isDynamic) {
  54031. name = camelize(name);
  54032. if (name === 'innerHtml') { name = 'innerHTML'; }
  54033. }
  54034. if (modifiers.camel && !isDynamic) {
  54035. name = camelize(name);
  54036. }
  54037. if (modifiers.sync) {
  54038. syncGen = genAssignmentCode(value, "$event");
  54039. if (!isDynamic) {
  54040. addHandler(
  54041. el,
  54042. ("update:" + (camelize(name))),
  54043. syncGen,
  54044. null,
  54045. false,
  54046. warn$2,
  54047. list[i]
  54048. );
  54049. if (hyphenate(name) !== camelize(name)) {
  54050. addHandler(
  54051. el,
  54052. ("update:" + (hyphenate(name))),
  54053. syncGen,
  54054. null,
  54055. false,
  54056. warn$2,
  54057. list[i]
  54058. );
  54059. }
  54060. } else {
  54061. // handler w/ dynamic event name
  54062. addHandler(
  54063. el,
  54064. ("\"update:\"+(" + name + ")"),
  54065. syncGen,
  54066. null,
  54067. false,
  54068. warn$2,
  54069. list[i],
  54070. true // dynamic
  54071. );
  54072. }
  54073. }
  54074. }
  54075. if ((modifiers && modifiers.prop) || (
  54076. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54077. )) {
  54078. addProp(el, name, value, list[i], isDynamic);
  54079. } else {
  54080. addAttr(el, name, value, list[i], isDynamic);
  54081. }
  54082. } else if (onRE.test(name)) { // v-on
  54083. name = name.replace(onRE, '');
  54084. isDynamic = dynamicArgRE.test(name);
  54085. if (isDynamic) {
  54086. name = name.slice(1, -1);
  54087. }
  54088. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54089. } else { // normal directives
  54090. name = name.replace(dirRE, '');
  54091. // parse arg
  54092. var argMatch = name.match(argRE);
  54093. var arg = argMatch && argMatch[1];
  54094. isDynamic = false;
  54095. if (arg) {
  54096. name = name.slice(0, -(arg.length + 1));
  54097. if (dynamicArgRE.test(arg)) {
  54098. arg = arg.slice(1, -1);
  54099. isDynamic = true;
  54100. }
  54101. }
  54102. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54103. if (name === 'model') {
  54104. checkForAliasModel(el, value);
  54105. }
  54106. }
  54107. } else {
  54108. // literal attribute
  54109. {
  54110. var res = parseText(value, delimiters);
  54111. if (res) {
  54112. warn$2(
  54113. name + "=\"" + value + "\": " +
  54114. 'Interpolation inside attributes has been removed. ' +
  54115. 'Use v-bind or the colon shorthand instead. For example, ' +
  54116. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54117. list[i]
  54118. );
  54119. }
  54120. }
  54121. addAttr(el, name, JSON.stringify(value), list[i]);
  54122. // #6887 firefox doesn't update muted state if set via attribute
  54123. // even immediately after element creation
  54124. if (!el.component &&
  54125. name === 'muted' &&
  54126. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54127. addProp(el, name, 'true', list[i]);
  54128. }
  54129. }
  54130. }
  54131. }
  54132. function checkInFor (el) {
  54133. var parent = el;
  54134. while (parent) {
  54135. if (parent.for !== undefined) {
  54136. return true
  54137. }
  54138. parent = parent.parent;
  54139. }
  54140. return false
  54141. }
  54142. function parseModifiers (name) {
  54143. var match = name.match(modifierRE);
  54144. if (match) {
  54145. var ret = {};
  54146. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54147. return ret
  54148. }
  54149. }
  54150. function makeAttrsMap (attrs) {
  54151. var map = {};
  54152. for (var i = 0, l = attrs.length; i < l; i++) {
  54153. if (
  54154. map[attrs[i].name] && !isIE && !isEdge
  54155. ) {
  54156. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54157. }
  54158. map[attrs[i].name] = attrs[i].value;
  54159. }
  54160. return map
  54161. }
  54162. // for script (e.g. type="x/template") or style, do not decode content
  54163. function isTextTag (el) {
  54164. return el.tag === 'script' || el.tag === 'style'
  54165. }
  54166. function isForbiddenTag (el) {
  54167. return (
  54168. el.tag === 'style' ||
  54169. (el.tag === 'script' && (
  54170. !el.attrsMap.type ||
  54171. el.attrsMap.type === 'text/javascript'
  54172. ))
  54173. )
  54174. }
  54175. var ieNSBug = /^xmlns:NS\d+/;
  54176. var ieNSPrefix = /^NS\d+:/;
  54177. /* istanbul ignore next */
  54178. function guardIESVGBug (attrs) {
  54179. var res = [];
  54180. for (var i = 0; i < attrs.length; i++) {
  54181. var attr = attrs[i];
  54182. if (!ieNSBug.test(attr.name)) {
  54183. attr.name = attr.name.replace(ieNSPrefix, '');
  54184. res.push(attr);
  54185. }
  54186. }
  54187. return res
  54188. }
  54189. function checkForAliasModel (el, value) {
  54190. var _el = el;
  54191. while (_el) {
  54192. if (_el.for && _el.alias === value) {
  54193. warn$2(
  54194. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54195. "You are binding v-model directly to a v-for iteration alias. " +
  54196. "This will not be able to modify the v-for source array because " +
  54197. "writing to the alias is like modifying a function local variable. " +
  54198. "Consider using an array of objects and use v-model on an object property instead.",
  54199. el.rawAttrsMap['v-model']
  54200. );
  54201. }
  54202. _el = _el.parent;
  54203. }
  54204. }
  54205. /* */
  54206. function preTransformNode (el, options) {
  54207. if (el.tag === 'input') {
  54208. var map = el.attrsMap;
  54209. if (!map['v-model']) {
  54210. return
  54211. }
  54212. var typeBinding;
  54213. if (map[':type'] || map['v-bind:type']) {
  54214. typeBinding = getBindingAttr(el, 'type');
  54215. }
  54216. if (!map.type && !typeBinding && map['v-bind']) {
  54217. typeBinding = "(" + (map['v-bind']) + ").type";
  54218. }
  54219. if (typeBinding) {
  54220. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54221. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54222. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54223. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54224. // 1. checkbox
  54225. var branch0 = cloneASTElement(el);
  54226. // process for on the main node
  54227. processFor(branch0);
  54228. addRawAttr(branch0, 'type', 'checkbox');
  54229. processElement(branch0, options);
  54230. branch0.processed = true; // prevent it from double-processed
  54231. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54232. addIfCondition(branch0, {
  54233. exp: branch0.if,
  54234. block: branch0
  54235. });
  54236. // 2. add radio else-if condition
  54237. var branch1 = cloneASTElement(el);
  54238. getAndRemoveAttr(branch1, 'v-for', true);
  54239. addRawAttr(branch1, 'type', 'radio');
  54240. processElement(branch1, options);
  54241. addIfCondition(branch0, {
  54242. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54243. block: branch1
  54244. });
  54245. // 3. other
  54246. var branch2 = cloneASTElement(el);
  54247. getAndRemoveAttr(branch2, 'v-for', true);
  54248. addRawAttr(branch2, ':type', typeBinding);
  54249. processElement(branch2, options);
  54250. addIfCondition(branch0, {
  54251. exp: ifCondition,
  54252. block: branch2
  54253. });
  54254. if (hasElse) {
  54255. branch0.else = true;
  54256. } else if (elseIfCondition) {
  54257. branch0.elseif = elseIfCondition;
  54258. }
  54259. return branch0
  54260. }
  54261. }
  54262. }
  54263. function cloneASTElement (el) {
  54264. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54265. }
  54266. var model$1 = {
  54267. preTransformNode: preTransformNode
  54268. };
  54269. var modules$1 = [
  54270. klass$1,
  54271. style$1,
  54272. model$1
  54273. ];
  54274. /* */
  54275. function text (el, dir) {
  54276. if (dir.value) {
  54277. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54278. }
  54279. }
  54280. /* */
  54281. function html (el, dir) {
  54282. if (dir.value) {
  54283. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54284. }
  54285. }
  54286. var directives$1 = {
  54287. model: model,
  54288. text: text,
  54289. html: html
  54290. };
  54291. /* */
  54292. var baseOptions = {
  54293. expectHTML: true,
  54294. modules: modules$1,
  54295. directives: directives$1,
  54296. isPreTag: isPreTag,
  54297. isUnaryTag: isUnaryTag,
  54298. mustUseProp: mustUseProp,
  54299. canBeLeftOpenTag: canBeLeftOpenTag,
  54300. isReservedTag: isReservedTag,
  54301. getTagNamespace: getTagNamespace,
  54302. staticKeys: genStaticKeys(modules$1)
  54303. };
  54304. /* */
  54305. var isStaticKey;
  54306. var isPlatformReservedTag;
  54307. var genStaticKeysCached = cached(genStaticKeys$1);
  54308. /**
  54309. * Goal of the optimizer: walk the generated template AST tree
  54310. * and detect sub-trees that are purely static, i.e. parts of
  54311. * the DOM that never needs to change.
  54312. *
  54313. * Once we detect these sub-trees, we can:
  54314. *
  54315. * 1. Hoist them into constants, so that we no longer need to
  54316. * create fresh nodes for them on each re-render;
  54317. * 2. Completely skip them in the patching process.
  54318. */
  54319. function optimize (root, options) {
  54320. if (!root) { return }
  54321. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54322. isPlatformReservedTag = options.isReservedTag || no;
  54323. // first pass: mark all non-static nodes.
  54324. markStatic$1(root);
  54325. // second pass: mark static roots.
  54326. markStaticRoots(root, false);
  54327. }
  54328. function genStaticKeys$1 (keys) {
  54329. return makeMap(
  54330. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54331. (keys ? ',' + keys : '')
  54332. )
  54333. }
  54334. function markStatic$1 (node) {
  54335. node.static = isStatic(node);
  54336. if (node.type === 1) {
  54337. // do not make component slot content static. this avoids
  54338. // 1. components not able to mutate slot nodes
  54339. // 2. static slot content fails for hot-reloading
  54340. if (
  54341. !isPlatformReservedTag(node.tag) &&
  54342. node.tag !== 'slot' &&
  54343. node.attrsMap['inline-template'] == null
  54344. ) {
  54345. return
  54346. }
  54347. for (var i = 0, l = node.children.length; i < l; i++) {
  54348. var child = node.children[i];
  54349. markStatic$1(child);
  54350. if (!child.static) {
  54351. node.static = false;
  54352. }
  54353. }
  54354. if (node.ifConditions) {
  54355. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54356. var block = node.ifConditions[i$1].block;
  54357. markStatic$1(block);
  54358. if (!block.static) {
  54359. node.static = false;
  54360. }
  54361. }
  54362. }
  54363. }
  54364. }
  54365. function markStaticRoots (node, isInFor) {
  54366. if (node.type === 1) {
  54367. if (node.static || node.once) {
  54368. node.staticInFor = isInFor;
  54369. }
  54370. // For a node to qualify as a static root, it should have children that
  54371. // are not just static text. Otherwise the cost of hoisting out will
  54372. // outweigh the benefits and it's better off to just always render it fresh.
  54373. if (node.static && node.children.length && !(
  54374. node.children.length === 1 &&
  54375. node.children[0].type === 3
  54376. )) {
  54377. node.staticRoot = true;
  54378. return
  54379. } else {
  54380. node.staticRoot = false;
  54381. }
  54382. if (node.children) {
  54383. for (var i = 0, l = node.children.length; i < l; i++) {
  54384. markStaticRoots(node.children[i], isInFor || !!node.for);
  54385. }
  54386. }
  54387. if (node.ifConditions) {
  54388. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54389. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54390. }
  54391. }
  54392. }
  54393. }
  54394. function isStatic (node) {
  54395. if (node.type === 2) { // expression
  54396. return false
  54397. }
  54398. if (node.type === 3) { // text
  54399. return true
  54400. }
  54401. return !!(node.pre || (
  54402. !node.hasBindings && // no dynamic bindings
  54403. !node.if && !node.for && // not v-if or v-for or v-else
  54404. !isBuiltInTag(node.tag) && // not a built-in
  54405. isPlatformReservedTag(node.tag) && // not a component
  54406. !isDirectChildOfTemplateFor(node) &&
  54407. Object.keys(node).every(isStaticKey)
  54408. ))
  54409. }
  54410. function isDirectChildOfTemplateFor (node) {
  54411. while (node.parent) {
  54412. node = node.parent;
  54413. if (node.tag !== 'template') {
  54414. return false
  54415. }
  54416. if (node.for) {
  54417. return true
  54418. }
  54419. }
  54420. return false
  54421. }
  54422. /* */
  54423. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54424. var fnInvokeRE = /\([^)]*?\);*$/;
  54425. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54426. // KeyboardEvent.keyCode aliases
  54427. var keyCodes = {
  54428. esc: 27,
  54429. tab: 9,
  54430. enter: 13,
  54431. space: 32,
  54432. up: 38,
  54433. left: 37,
  54434. right: 39,
  54435. down: 40,
  54436. 'delete': [8, 46]
  54437. };
  54438. // KeyboardEvent.key aliases
  54439. var keyNames = {
  54440. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54441. esc: ['Esc', 'Escape'],
  54442. tab: 'Tab',
  54443. enter: 'Enter',
  54444. // #9112: IE11 uses `Spacebar` for Space key name.
  54445. space: [' ', 'Spacebar'],
  54446. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54447. up: ['Up', 'ArrowUp'],
  54448. left: ['Left', 'ArrowLeft'],
  54449. right: ['Right', 'ArrowRight'],
  54450. down: ['Down', 'ArrowDown'],
  54451. // #9112: IE11 uses `Del` for Delete key name.
  54452. 'delete': ['Backspace', 'Delete', 'Del']
  54453. };
  54454. // #4868: modifiers that prevent the execution of the listener
  54455. // need to explicitly return null so that we can determine whether to remove
  54456. // the listener for .once
  54457. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54458. var modifierCode = {
  54459. stop: '$event.stopPropagation();',
  54460. prevent: '$event.preventDefault();',
  54461. self: genGuard("$event.target !== $event.currentTarget"),
  54462. ctrl: genGuard("!$event.ctrlKey"),
  54463. shift: genGuard("!$event.shiftKey"),
  54464. alt: genGuard("!$event.altKey"),
  54465. meta: genGuard("!$event.metaKey"),
  54466. left: genGuard("'button' in $event && $event.button !== 0"),
  54467. middle: genGuard("'button' in $event && $event.button !== 1"),
  54468. right: genGuard("'button' in $event && $event.button !== 2")
  54469. };
  54470. function genHandlers (
  54471. events,
  54472. isNative
  54473. ) {
  54474. var prefix = isNative ? 'nativeOn:' : 'on:';
  54475. var staticHandlers = "";
  54476. var dynamicHandlers = "";
  54477. for (var name in events) {
  54478. var handlerCode = genHandler(events[name]);
  54479. if (events[name] && events[name].dynamic) {
  54480. dynamicHandlers += name + "," + handlerCode + ",";
  54481. } else {
  54482. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54483. }
  54484. }
  54485. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54486. if (dynamicHandlers) {
  54487. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54488. } else {
  54489. return prefix + staticHandlers
  54490. }
  54491. }
  54492. function genHandler (handler) {
  54493. if (!handler) {
  54494. return 'function(){}'
  54495. }
  54496. if (Array.isArray(handler)) {
  54497. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54498. }
  54499. var isMethodPath = simplePathRE.test(handler.value);
  54500. var isFunctionExpression = fnExpRE.test(handler.value);
  54501. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54502. if (!handler.modifiers) {
  54503. if (isMethodPath || isFunctionExpression) {
  54504. return handler.value
  54505. }
  54506. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54507. } else {
  54508. var code = '';
  54509. var genModifierCode = '';
  54510. var keys = [];
  54511. for (var key in handler.modifiers) {
  54512. if (modifierCode[key]) {
  54513. genModifierCode += modifierCode[key];
  54514. // left/right
  54515. if (keyCodes[key]) {
  54516. keys.push(key);
  54517. }
  54518. } else if (key === 'exact') {
  54519. var modifiers = (handler.modifiers);
  54520. genModifierCode += genGuard(
  54521. ['ctrl', 'shift', 'alt', 'meta']
  54522. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54523. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54524. .join('||')
  54525. );
  54526. } else {
  54527. keys.push(key);
  54528. }
  54529. }
  54530. if (keys.length) {
  54531. code += genKeyFilter(keys);
  54532. }
  54533. // Make sure modifiers like prevent and stop get executed after key filtering
  54534. if (genModifierCode) {
  54535. code += genModifierCode;
  54536. }
  54537. var handlerCode = isMethodPath
  54538. ? ("return " + (handler.value) + "($event)")
  54539. : isFunctionExpression
  54540. ? ("return (" + (handler.value) + ")($event)")
  54541. : isFunctionInvocation
  54542. ? ("return " + (handler.value))
  54543. : handler.value;
  54544. return ("function($event){" + code + handlerCode + "}")
  54545. }
  54546. }
  54547. function genKeyFilter (keys) {
  54548. return (
  54549. // make sure the key filters only apply to KeyboardEvents
  54550. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54551. // key events that do not have keyCode property...
  54552. "if(!$event.type.indexOf('key')&&" +
  54553. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54554. )
  54555. }
  54556. function genFilterCode (key) {
  54557. var keyVal = parseInt(key, 10);
  54558. if (keyVal) {
  54559. return ("$event.keyCode!==" + keyVal)
  54560. }
  54561. var keyCode = keyCodes[key];
  54562. var keyName = keyNames[key];
  54563. return (
  54564. "_k($event.keyCode," +
  54565. (JSON.stringify(key)) + "," +
  54566. (JSON.stringify(keyCode)) + "," +
  54567. "$event.key," +
  54568. "" + (JSON.stringify(keyName)) +
  54569. ")"
  54570. )
  54571. }
  54572. /* */
  54573. function on (el, dir) {
  54574. if (dir.modifiers) {
  54575. warn("v-on without argument does not support modifiers.");
  54576. }
  54577. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54578. }
  54579. /* */
  54580. function bind$1 (el, dir) {
  54581. el.wrapData = function (code) {
  54582. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54583. };
  54584. }
  54585. /* */
  54586. var baseDirectives = {
  54587. on: on,
  54588. bind: bind$1,
  54589. cloak: noop
  54590. };
  54591. /* */
  54592. var CodegenState = function CodegenState (options) {
  54593. this.options = options;
  54594. this.warn = options.warn || baseWarn;
  54595. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54596. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54597. this.directives = extend(extend({}, baseDirectives), options.directives);
  54598. var isReservedTag = options.isReservedTag || no;
  54599. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54600. this.onceId = 0;
  54601. this.staticRenderFns = [];
  54602. this.pre = false;
  54603. };
  54604. function generate (
  54605. ast,
  54606. options
  54607. ) {
  54608. var state = new CodegenState(options);
  54609. var code = ast ? genElement(ast, state) : '_c("div")';
  54610. return {
  54611. render: ("with(this){return " + code + "}"),
  54612. staticRenderFns: state.staticRenderFns
  54613. }
  54614. }
  54615. function genElement (el, state) {
  54616. if (el.parent) {
  54617. el.pre = el.pre || el.parent.pre;
  54618. }
  54619. if (el.staticRoot && !el.staticProcessed) {
  54620. return genStatic(el, state)
  54621. } else if (el.once && !el.onceProcessed) {
  54622. return genOnce(el, state)
  54623. } else if (el.for && !el.forProcessed) {
  54624. return genFor(el, state)
  54625. } else if (el.if && !el.ifProcessed) {
  54626. return genIf(el, state)
  54627. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54628. return genChildren(el, state) || 'void 0'
  54629. } else if (el.tag === 'slot') {
  54630. return genSlot(el, state)
  54631. } else {
  54632. // component or element
  54633. var code;
  54634. if (el.component) {
  54635. code = genComponent(el.component, el, state);
  54636. } else {
  54637. var data;
  54638. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54639. data = genData$2(el, state);
  54640. }
  54641. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54642. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54643. }
  54644. // module transforms
  54645. for (var i = 0; i < state.transforms.length; i++) {
  54646. code = state.transforms[i](el, code);
  54647. }
  54648. return code
  54649. }
  54650. }
  54651. // hoist static sub-trees out
  54652. function genStatic (el, state) {
  54653. el.staticProcessed = true;
  54654. // Some elements (templates) need to behave differently inside of a v-pre
  54655. // node. All pre nodes are static roots, so we can use this as a location to
  54656. // wrap a state change and reset it upon exiting the pre node.
  54657. var originalPreState = state.pre;
  54658. if (el.pre) {
  54659. state.pre = el.pre;
  54660. }
  54661. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54662. state.pre = originalPreState;
  54663. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54664. }
  54665. // v-once
  54666. function genOnce (el, state) {
  54667. el.onceProcessed = true;
  54668. if (el.if && !el.ifProcessed) {
  54669. return genIf(el, state)
  54670. } else if (el.staticInFor) {
  54671. var key = '';
  54672. var parent = el.parent;
  54673. while (parent) {
  54674. if (parent.for) {
  54675. key = parent.key;
  54676. break
  54677. }
  54678. parent = parent.parent;
  54679. }
  54680. if (!key) {
  54681. state.warn(
  54682. "v-once can only be used inside v-for that is keyed. ",
  54683. el.rawAttrsMap['v-once']
  54684. );
  54685. return genElement(el, state)
  54686. }
  54687. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54688. } else {
  54689. return genStatic(el, state)
  54690. }
  54691. }
  54692. function genIf (
  54693. el,
  54694. state,
  54695. altGen,
  54696. altEmpty
  54697. ) {
  54698. el.ifProcessed = true; // avoid recursion
  54699. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54700. }
  54701. function genIfConditions (
  54702. conditions,
  54703. state,
  54704. altGen,
  54705. altEmpty
  54706. ) {
  54707. if (!conditions.length) {
  54708. return altEmpty || '_e()'
  54709. }
  54710. var condition = conditions.shift();
  54711. if (condition.exp) {
  54712. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54713. } else {
  54714. return ("" + (genTernaryExp(condition.block)))
  54715. }
  54716. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54717. function genTernaryExp (el) {
  54718. return altGen
  54719. ? altGen(el, state)
  54720. : el.once
  54721. ? genOnce(el, state)
  54722. : genElement(el, state)
  54723. }
  54724. }
  54725. function genFor (
  54726. el,
  54727. state,
  54728. altGen,
  54729. altHelper
  54730. ) {
  54731. var exp = el.for;
  54732. var alias = el.alias;
  54733. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54734. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54735. if (state.maybeComponent(el) &&
  54736. el.tag !== 'slot' &&
  54737. el.tag !== 'template' &&
  54738. !el.key
  54739. ) {
  54740. state.warn(
  54741. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54742. "v-for should have explicit keys. " +
  54743. "See https://vuejs.org/guide/list.html#key for more info.",
  54744. el.rawAttrsMap['v-for'],
  54745. true /* tip */
  54746. );
  54747. }
  54748. el.forProcessed = true; // avoid recursion
  54749. return (altHelper || '_l') + "((" + exp + ")," +
  54750. "function(" + alias + iterator1 + iterator2 + "){" +
  54751. "return " + ((altGen || genElement)(el, state)) +
  54752. '})'
  54753. }
  54754. function genData$2 (el, state) {
  54755. var data = '{';
  54756. // directives first.
  54757. // directives may mutate the el's other properties before they are generated.
  54758. var dirs = genDirectives(el, state);
  54759. if (dirs) { data += dirs + ','; }
  54760. // key
  54761. if (el.key) {
  54762. data += "key:" + (el.key) + ",";
  54763. }
  54764. // ref
  54765. if (el.ref) {
  54766. data += "ref:" + (el.ref) + ",";
  54767. }
  54768. if (el.refInFor) {
  54769. data += "refInFor:true,";
  54770. }
  54771. // pre
  54772. if (el.pre) {
  54773. data += "pre:true,";
  54774. }
  54775. // record original tag name for components using "is" attribute
  54776. if (el.component) {
  54777. data += "tag:\"" + (el.tag) + "\",";
  54778. }
  54779. // module data generation functions
  54780. for (var i = 0; i < state.dataGenFns.length; i++) {
  54781. data += state.dataGenFns[i](el);
  54782. }
  54783. // attributes
  54784. if (el.attrs) {
  54785. data += "attrs:" + (genProps(el.attrs)) + ",";
  54786. }
  54787. // DOM props
  54788. if (el.props) {
  54789. data += "domProps:" + (genProps(el.props)) + ",";
  54790. }
  54791. // event handlers
  54792. if (el.events) {
  54793. data += (genHandlers(el.events, false)) + ",";
  54794. }
  54795. if (el.nativeEvents) {
  54796. data += (genHandlers(el.nativeEvents, true)) + ",";
  54797. }
  54798. // slot target
  54799. // only for non-scoped slots
  54800. if (el.slotTarget && !el.slotScope) {
  54801. data += "slot:" + (el.slotTarget) + ",";
  54802. }
  54803. // scoped slots
  54804. if (el.scopedSlots) {
  54805. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54806. }
  54807. // component v-model
  54808. if (el.model) {
  54809. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54810. }
  54811. // inline-template
  54812. if (el.inlineTemplate) {
  54813. var inlineTemplate = genInlineTemplate(el, state);
  54814. if (inlineTemplate) {
  54815. data += inlineTemplate + ",";
  54816. }
  54817. }
  54818. data = data.replace(/,$/, '') + '}';
  54819. // v-bind dynamic argument wrap
  54820. // v-bind with dynamic arguments must be applied using the same v-bind object
  54821. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54822. if (el.dynamicAttrs) {
  54823. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54824. }
  54825. // v-bind data wrap
  54826. if (el.wrapData) {
  54827. data = el.wrapData(data);
  54828. }
  54829. // v-on data wrap
  54830. if (el.wrapListeners) {
  54831. data = el.wrapListeners(data);
  54832. }
  54833. return data
  54834. }
  54835. function genDirectives (el, state) {
  54836. var dirs = el.directives;
  54837. if (!dirs) { return }
  54838. var res = 'directives:[';
  54839. var hasRuntime = false;
  54840. var i, l, dir, needRuntime;
  54841. for (i = 0, l = dirs.length; i < l; i++) {
  54842. dir = dirs[i];
  54843. needRuntime = true;
  54844. var gen = state.directives[dir.name];
  54845. if (gen) {
  54846. // compile-time directive that manipulates AST.
  54847. // returns true if it also needs a runtime counterpart.
  54848. needRuntime = !!gen(el, dir, state.warn);
  54849. }
  54850. if (needRuntime) {
  54851. hasRuntime = true;
  54852. 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))) : '') + "},";
  54853. }
  54854. }
  54855. if (hasRuntime) {
  54856. return res.slice(0, -1) + ']'
  54857. }
  54858. }
  54859. function genInlineTemplate (el, state) {
  54860. var ast = el.children[0];
  54861. if (el.children.length !== 1 || ast.type !== 1) {
  54862. state.warn(
  54863. 'Inline-template components must have exactly one child element.',
  54864. { start: el.start }
  54865. );
  54866. }
  54867. if (ast && ast.type === 1) {
  54868. var inlineRenderFns = generate(ast, state.options);
  54869. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54870. }
  54871. }
  54872. function genScopedSlots (
  54873. el,
  54874. slots,
  54875. state
  54876. ) {
  54877. // by default scoped slots are considered "stable", this allows child
  54878. // components with only scoped slots to skip forced updates from parent.
  54879. // but in some cases we have to bail-out of this optimization
  54880. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54881. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54882. var slot = slots[key];
  54883. return (
  54884. slot.slotTargetDynamic ||
  54885. slot.if ||
  54886. slot.for ||
  54887. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54888. )
  54889. });
  54890. // #9534: if a component with scoped slots is inside a conditional branch,
  54891. // it's possible for the same component to be reused but with different
  54892. // compiled slot content. To avoid that, we generate a unique key based on
  54893. // the generated code of all the slot contents.
  54894. var needsKey = !!el.if;
  54895. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54896. // disconnected due to the intermediate scope variable)
  54897. // #9438, #9506
  54898. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54899. // and skip force updating ones that do not actually use scope variables.
  54900. if (!needsForceUpdate) {
  54901. var parent = el.parent;
  54902. while (parent) {
  54903. if (
  54904. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54905. parent.for
  54906. ) {
  54907. needsForceUpdate = true;
  54908. break
  54909. }
  54910. if (parent.if) {
  54911. needsKey = true;
  54912. }
  54913. parent = parent.parent;
  54914. }
  54915. }
  54916. var generatedSlots = Object.keys(slots)
  54917. .map(function (key) { return genScopedSlot(slots[key], state); })
  54918. .join(',');
  54919. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54920. }
  54921. function hash(str) {
  54922. var hash = 5381;
  54923. var i = str.length;
  54924. while(i) {
  54925. hash = (hash * 33) ^ str.charCodeAt(--i);
  54926. }
  54927. return hash >>> 0
  54928. }
  54929. function containsSlotChild (el) {
  54930. if (el.type === 1) {
  54931. if (el.tag === 'slot') {
  54932. return true
  54933. }
  54934. return el.children.some(containsSlotChild)
  54935. }
  54936. return false
  54937. }
  54938. function genScopedSlot (
  54939. el,
  54940. state
  54941. ) {
  54942. var isLegacySyntax = el.attrsMap['slot-scope'];
  54943. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54944. return genIf(el, state, genScopedSlot, "null")
  54945. }
  54946. if (el.for && !el.forProcessed) {
  54947. return genFor(el, state, genScopedSlot)
  54948. }
  54949. var slotScope = el.slotScope === emptySlotScopeToken
  54950. ? ""
  54951. : String(el.slotScope);
  54952. var fn = "function(" + slotScope + "){" +
  54953. "return " + (el.tag === 'template'
  54954. ? el.if && isLegacySyntax
  54955. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54956. : genChildren(el, state) || 'undefined'
  54957. : genElement(el, state)) + "}";
  54958. // reverse proxy v-slot without scope on this.$slots
  54959. var reverseProxy = slotScope ? "" : ",proxy:true";
  54960. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54961. }
  54962. function genChildren (
  54963. el,
  54964. state,
  54965. checkSkip,
  54966. altGenElement,
  54967. altGenNode
  54968. ) {
  54969. var children = el.children;
  54970. if (children.length) {
  54971. var el$1 = children[0];
  54972. // optimize single v-for
  54973. if (children.length === 1 &&
  54974. el$1.for &&
  54975. el$1.tag !== 'template' &&
  54976. el$1.tag !== 'slot'
  54977. ) {
  54978. var normalizationType = checkSkip
  54979. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54980. : "";
  54981. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54982. }
  54983. var normalizationType$1 = checkSkip
  54984. ? getNormalizationType(children, state.maybeComponent)
  54985. : 0;
  54986. var gen = altGenNode || genNode;
  54987. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54988. }
  54989. }
  54990. // determine the normalization needed for the children array.
  54991. // 0: no normalization needed
  54992. // 1: simple normalization needed (possible 1-level deep nested array)
  54993. // 2: full normalization needed
  54994. function getNormalizationType (
  54995. children,
  54996. maybeComponent
  54997. ) {
  54998. var res = 0;
  54999. for (var i = 0; i < children.length; i++) {
  55000. var el = children[i];
  55001. if (el.type !== 1) {
  55002. continue
  55003. }
  55004. if (needsNormalization(el) ||
  55005. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  55006. res = 2;
  55007. break
  55008. }
  55009. if (maybeComponent(el) ||
  55010. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  55011. res = 1;
  55012. }
  55013. }
  55014. return res
  55015. }
  55016. function needsNormalization (el) {
  55017. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  55018. }
  55019. function genNode (node, state) {
  55020. if (node.type === 1) {
  55021. return genElement(node, state)
  55022. } else if (node.type === 3 && node.isComment) {
  55023. return genComment(node)
  55024. } else {
  55025. return genText(node)
  55026. }
  55027. }
  55028. function genText (text) {
  55029. return ("_v(" + (text.type === 2
  55030. ? text.expression // no need for () because already wrapped in _s()
  55031. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  55032. }
  55033. function genComment (comment) {
  55034. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  55035. }
  55036. function genSlot (el, state) {
  55037. var slotName = el.slotName || '"default"';
  55038. var children = genChildren(el, state);
  55039. var res = "_t(" + slotName + (children ? ("," + children) : '');
  55040. var attrs = el.attrs || el.dynamicAttrs
  55041. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  55042. // slot props are camelized
  55043. name: camelize(attr.name),
  55044. value: attr.value,
  55045. dynamic: attr.dynamic
  55046. }); }))
  55047. : null;
  55048. var bind$$1 = el.attrsMap['v-bind'];
  55049. if ((attrs || bind$$1) && !children) {
  55050. res += ",null";
  55051. }
  55052. if (attrs) {
  55053. res += "," + attrs;
  55054. }
  55055. if (bind$$1) {
  55056. res += (attrs ? '' : ',null') + "," + bind$$1;
  55057. }
  55058. return res + ')'
  55059. }
  55060. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  55061. function genComponent (
  55062. componentName,
  55063. el,
  55064. state
  55065. ) {
  55066. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  55067. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  55068. }
  55069. function genProps (props) {
  55070. var staticProps = "";
  55071. var dynamicProps = "";
  55072. for (var i = 0; i < props.length; i++) {
  55073. var prop = props[i];
  55074. var value = transformSpecialNewlines(prop.value);
  55075. if (prop.dynamic) {
  55076. dynamicProps += (prop.name) + "," + value + ",";
  55077. } else {
  55078. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55079. }
  55080. }
  55081. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55082. if (dynamicProps) {
  55083. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55084. } else {
  55085. return staticProps
  55086. }
  55087. }
  55088. // #3895, #4268
  55089. function transformSpecialNewlines (text) {
  55090. return text
  55091. .replace(/\u2028/g, '\\u2028')
  55092. .replace(/\u2029/g, '\\u2029')
  55093. }
  55094. /* */
  55095. // these keywords should not appear inside expressions, but operators like
  55096. // typeof, instanceof and in are allowed
  55097. var prohibitedKeywordRE = new RegExp('\\b' + (
  55098. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55099. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55100. 'extends,finally,continue,debugger,function,arguments'
  55101. ).split(',').join('\\b|\\b') + '\\b');
  55102. // these unary operators should not be used as property/method names
  55103. var unaryOperatorsRE = new RegExp('\\b' + (
  55104. 'delete,typeof,void'
  55105. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55106. // strip strings in expressions
  55107. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55108. // detect problematic expressions in a template
  55109. function detectErrors (ast, warn) {
  55110. if (ast) {
  55111. checkNode(ast, warn);
  55112. }
  55113. }
  55114. function checkNode (node, warn) {
  55115. if (node.type === 1) {
  55116. for (var name in node.attrsMap) {
  55117. if (dirRE.test(name)) {
  55118. var value = node.attrsMap[name];
  55119. if (value) {
  55120. var range = node.rawAttrsMap[name];
  55121. if (name === 'v-for') {
  55122. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55123. } else if (name === 'v-slot' || name[0] === '#') {
  55124. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55125. } else if (onRE.test(name)) {
  55126. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55127. } else {
  55128. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55129. }
  55130. }
  55131. }
  55132. }
  55133. if (node.children) {
  55134. for (var i = 0; i < node.children.length; i++) {
  55135. checkNode(node.children[i], warn);
  55136. }
  55137. }
  55138. } else if (node.type === 2) {
  55139. checkExpression(node.expression, node.text, warn, node);
  55140. }
  55141. }
  55142. function checkEvent (exp, text, warn, range) {
  55143. var stripped = exp.replace(stripStringRE, '');
  55144. var keywordMatch = stripped.match(unaryOperatorsRE);
  55145. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55146. warn(
  55147. "avoid using JavaScript unary operator as property name: " +
  55148. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55149. range
  55150. );
  55151. }
  55152. checkExpression(exp, text, warn, range);
  55153. }
  55154. function checkFor (node, text, warn, range) {
  55155. checkExpression(node.for || '', text, warn, range);
  55156. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55157. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55158. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55159. }
  55160. function checkIdentifier (
  55161. ident,
  55162. type,
  55163. text,
  55164. warn,
  55165. range
  55166. ) {
  55167. if (typeof ident === 'string') {
  55168. try {
  55169. new Function(("var " + ident + "=_"));
  55170. } catch (e) {
  55171. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55172. }
  55173. }
  55174. }
  55175. function checkExpression (exp, text, warn, range) {
  55176. try {
  55177. new Function(("return " + exp));
  55178. } catch (e) {
  55179. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55180. if (keywordMatch) {
  55181. warn(
  55182. "avoid using JavaScript keyword as property name: " +
  55183. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55184. range
  55185. );
  55186. } else {
  55187. warn(
  55188. "invalid expression: " + (e.message) + " in\n\n" +
  55189. " " + exp + "\n\n" +
  55190. " Raw expression: " + (text.trim()) + "\n",
  55191. range
  55192. );
  55193. }
  55194. }
  55195. }
  55196. function checkFunctionParameterExpression (exp, text, warn, range) {
  55197. try {
  55198. new Function(exp, '');
  55199. } catch (e) {
  55200. warn(
  55201. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55202. " " + exp + "\n\n" +
  55203. " Raw expression: " + (text.trim()) + "\n",
  55204. range
  55205. );
  55206. }
  55207. }
  55208. /* */
  55209. var range = 2;
  55210. function generateCodeFrame (
  55211. source,
  55212. start,
  55213. end
  55214. ) {
  55215. if ( start === void 0 ) start = 0;
  55216. if ( end === void 0 ) end = source.length;
  55217. var lines = source.split(/\r?\n/);
  55218. var count = 0;
  55219. var res = [];
  55220. for (var i = 0; i < lines.length; i++) {
  55221. count += lines[i].length + 1;
  55222. if (count >= start) {
  55223. for (var j = i - range; j <= i + range || end > count; j++) {
  55224. if (j < 0 || j >= lines.length) { continue }
  55225. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55226. var lineLength = lines[j].length;
  55227. if (j === i) {
  55228. // push underline
  55229. var pad = start - (count - lineLength) + 1;
  55230. var length = end > count ? lineLength - pad : end - start;
  55231. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55232. } else if (j > i) {
  55233. if (end > count) {
  55234. var length$1 = Math.min(end - count, lineLength);
  55235. res.push(" | " + repeat$1("^", length$1));
  55236. }
  55237. count += lineLength + 1;
  55238. }
  55239. }
  55240. break
  55241. }
  55242. }
  55243. return res.join('\n')
  55244. }
  55245. function repeat$1 (str, n) {
  55246. var result = '';
  55247. if (n > 0) {
  55248. while (true) { // eslint-disable-line
  55249. if (n & 1) { result += str; }
  55250. n >>>= 1;
  55251. if (n <= 0) { break }
  55252. str += str;
  55253. }
  55254. }
  55255. return result
  55256. }
  55257. /* */
  55258. function createFunction (code, errors) {
  55259. try {
  55260. return new Function(code)
  55261. } catch (err) {
  55262. errors.push({ err: err, code: code });
  55263. return noop
  55264. }
  55265. }
  55266. function createCompileToFunctionFn (compile) {
  55267. var cache = Object.create(null);
  55268. return function compileToFunctions (
  55269. template,
  55270. options,
  55271. vm
  55272. ) {
  55273. options = extend({}, options);
  55274. var warn$$1 = options.warn || warn;
  55275. delete options.warn;
  55276. /* istanbul ignore if */
  55277. {
  55278. // detect possible CSP restriction
  55279. try {
  55280. new Function('return 1');
  55281. } catch (e) {
  55282. if (e.toString().match(/unsafe-eval|CSP/)) {
  55283. warn$$1(
  55284. 'It seems you are using the standalone build of Vue.js in an ' +
  55285. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55286. 'The template compiler cannot work in this environment. Consider ' +
  55287. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55288. 'templates into render functions.'
  55289. );
  55290. }
  55291. }
  55292. }
  55293. // check cache
  55294. var key = options.delimiters
  55295. ? String(options.delimiters) + template
  55296. : template;
  55297. if (cache[key]) {
  55298. return cache[key]
  55299. }
  55300. // compile
  55301. var compiled = compile(template, options);
  55302. // check compilation errors/tips
  55303. {
  55304. if (compiled.errors && compiled.errors.length) {
  55305. if (options.outputSourceRange) {
  55306. compiled.errors.forEach(function (e) {
  55307. warn$$1(
  55308. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55309. generateCodeFrame(template, e.start, e.end),
  55310. vm
  55311. );
  55312. });
  55313. } else {
  55314. warn$$1(
  55315. "Error compiling template:\n\n" + template + "\n\n" +
  55316. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55317. vm
  55318. );
  55319. }
  55320. }
  55321. if (compiled.tips && compiled.tips.length) {
  55322. if (options.outputSourceRange) {
  55323. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55324. } else {
  55325. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55326. }
  55327. }
  55328. }
  55329. // turn code into functions
  55330. var res = {};
  55331. var fnGenErrors = [];
  55332. res.render = createFunction(compiled.render, fnGenErrors);
  55333. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55334. return createFunction(code, fnGenErrors)
  55335. });
  55336. // check function generation errors.
  55337. // this should only happen if there is a bug in the compiler itself.
  55338. // mostly for codegen development use
  55339. /* istanbul ignore if */
  55340. {
  55341. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55342. warn$$1(
  55343. "Failed to generate render function:\n\n" +
  55344. fnGenErrors.map(function (ref) {
  55345. var err = ref.err;
  55346. var code = ref.code;
  55347. return ((err.toString()) + " in\n\n" + code + "\n");
  55348. }).join('\n'),
  55349. vm
  55350. );
  55351. }
  55352. }
  55353. return (cache[key] = res)
  55354. }
  55355. }
  55356. /* */
  55357. function createCompilerCreator (baseCompile) {
  55358. return function createCompiler (baseOptions) {
  55359. function compile (
  55360. template,
  55361. options
  55362. ) {
  55363. var finalOptions = Object.create(baseOptions);
  55364. var errors = [];
  55365. var tips = [];
  55366. var warn = function (msg, range, tip) {
  55367. (tip ? tips : errors).push(msg);
  55368. };
  55369. if (options) {
  55370. if (options.outputSourceRange) {
  55371. // $flow-disable-line
  55372. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55373. warn = function (msg, range, tip) {
  55374. var data = { msg: msg };
  55375. if (range) {
  55376. if (range.start != null) {
  55377. data.start = range.start + leadingSpaceLength;
  55378. }
  55379. if (range.end != null) {
  55380. data.end = range.end + leadingSpaceLength;
  55381. }
  55382. }
  55383. (tip ? tips : errors).push(data);
  55384. };
  55385. }
  55386. // merge custom modules
  55387. if (options.modules) {
  55388. finalOptions.modules =
  55389. (baseOptions.modules || []).concat(options.modules);
  55390. }
  55391. // merge custom directives
  55392. if (options.directives) {
  55393. finalOptions.directives = extend(
  55394. Object.create(baseOptions.directives || null),
  55395. options.directives
  55396. );
  55397. }
  55398. // copy other options
  55399. for (var key in options) {
  55400. if (key !== 'modules' && key !== 'directives') {
  55401. finalOptions[key] = options[key];
  55402. }
  55403. }
  55404. }
  55405. finalOptions.warn = warn;
  55406. var compiled = baseCompile(template.trim(), finalOptions);
  55407. {
  55408. detectErrors(compiled.ast, warn);
  55409. }
  55410. compiled.errors = errors;
  55411. compiled.tips = tips;
  55412. return compiled
  55413. }
  55414. return {
  55415. compile: compile,
  55416. compileToFunctions: createCompileToFunctionFn(compile)
  55417. }
  55418. }
  55419. }
  55420. /* */
  55421. // `createCompilerCreator` allows creating compilers that use alternative
  55422. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55423. // Here we just export a default compiler using the default parts.
  55424. var createCompiler = createCompilerCreator(function baseCompile (
  55425. template,
  55426. options
  55427. ) {
  55428. var ast = parse(template.trim(), options);
  55429. if (options.optimize !== false) {
  55430. optimize(ast, options);
  55431. }
  55432. var code = generate(ast, options);
  55433. return {
  55434. ast: ast,
  55435. render: code.render,
  55436. staticRenderFns: code.staticRenderFns
  55437. }
  55438. });
  55439. /* */
  55440. var ref$1 = createCompiler(baseOptions);
  55441. var compile = ref$1.compile;
  55442. var compileToFunctions = ref$1.compileToFunctions;
  55443. /* */
  55444. // check whether current browser encodes a char inside attribute values
  55445. var div;
  55446. function getShouldDecode (href) {
  55447. div = div || document.createElement('div');
  55448. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55449. return div.innerHTML.indexOf('&#10;') > 0
  55450. }
  55451. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55452. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55453. // #6828: chrome encodes content in a[href]
  55454. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55455. /* */
  55456. var idToTemplate = cached(function (id) {
  55457. var el = query(id);
  55458. return el && el.innerHTML
  55459. });
  55460. var mount = Vue.prototype.$mount;
  55461. Vue.prototype.$mount = function (
  55462. el,
  55463. hydrating
  55464. ) {
  55465. el = el && query(el);
  55466. /* istanbul ignore if */
  55467. if (el === document.body || el === document.documentElement) {
  55468. warn(
  55469. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55470. );
  55471. return this
  55472. }
  55473. var options = this.$options;
  55474. // resolve template/el and convert to render function
  55475. if (!options.render) {
  55476. var template = options.template;
  55477. if (template) {
  55478. if (typeof template === 'string') {
  55479. if (template.charAt(0) === '#') {
  55480. template = idToTemplate(template);
  55481. /* istanbul ignore if */
  55482. if (!template) {
  55483. warn(
  55484. ("Template element not found or is empty: " + (options.template)),
  55485. this
  55486. );
  55487. }
  55488. }
  55489. } else if (template.nodeType) {
  55490. template = template.innerHTML;
  55491. } else {
  55492. {
  55493. warn('invalid template option:' + template, this);
  55494. }
  55495. return this
  55496. }
  55497. } else if (el) {
  55498. template = getOuterHTML(el);
  55499. }
  55500. if (template) {
  55501. /* istanbul ignore if */
  55502. if (config.performance && mark) {
  55503. mark('compile');
  55504. }
  55505. var ref = compileToFunctions(template, {
  55506. outputSourceRange: "development" !== 'production',
  55507. shouldDecodeNewlines: shouldDecodeNewlines,
  55508. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55509. delimiters: options.delimiters,
  55510. comments: options.comments
  55511. }, this);
  55512. var render = ref.render;
  55513. var staticRenderFns = ref.staticRenderFns;
  55514. options.render = render;
  55515. options.staticRenderFns = staticRenderFns;
  55516. /* istanbul ignore if */
  55517. if (config.performance && mark) {
  55518. mark('compile end');
  55519. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55520. }
  55521. }
  55522. }
  55523. return mount.call(this, el, hydrating)
  55524. };
  55525. /**
  55526. * Get outerHTML of elements, taking care
  55527. * of SVG elements in IE as well.
  55528. */
  55529. function getOuterHTML (el) {
  55530. if (el.outerHTML) {
  55531. return el.outerHTML
  55532. } else {
  55533. var container = document.createElement('div');
  55534. container.appendChild(el.cloneNode(true));
  55535. return container.innerHTML
  55536. }
  55537. }
  55538. Vue.compile = compileToFunctions;
  55539. module.exports = Vue;
  55540. /* 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))
  55541. /***/ }),
  55542. /***/ "./node_modules/vue/dist/vue.common.js":
  55543. /*!*********************************************!*\
  55544. !*** ./node_modules/vue/dist/vue.common.js ***!
  55545. \*********************************************/
  55546. /*! no static exports found */
  55547. /***/ (function(module, exports, __webpack_require__) {
  55548. if (false) {} else {
  55549. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55550. }
  55551. /***/ }),
  55552. /***/ "./node_modules/webpack/buildin/global.js":
  55553. /*!***********************************!*\
  55554. !*** (webpack)/buildin/global.js ***!
  55555. \***********************************/
  55556. /*! no static exports found */
  55557. /***/ (function(module, exports) {
  55558. var g;
  55559. // This works in non-strict mode
  55560. g = (function() {
  55561. return this;
  55562. })();
  55563. try {
  55564. // This works if eval is allowed (see CSP)
  55565. g = g || new Function("return this")();
  55566. } catch (e) {
  55567. // This works if the window reference is available
  55568. if (typeof window === "object") g = window;
  55569. }
  55570. // g can still be undefined, but nothing to do about it...
  55571. // We return undefined, instead of nothing here, so it's
  55572. // easier to handle this case. if(!global) { ...}
  55573. module.exports = g;
  55574. /***/ }),
  55575. /***/ "./node_modules/webpack/buildin/module.js":
  55576. /*!***********************************!*\
  55577. !*** (webpack)/buildin/module.js ***!
  55578. \***********************************/
  55579. /*! no static exports found */
  55580. /***/ (function(module, exports) {
  55581. module.exports = function(module) {
  55582. if (!module.webpackPolyfill) {
  55583. module.deprecate = function() {};
  55584. module.paths = [];
  55585. // module.parent = undefined by default
  55586. if (!module.children) module.children = [];
  55587. Object.defineProperty(module, "loaded", {
  55588. enumerable: true,
  55589. get: function() {
  55590. return module.l;
  55591. }
  55592. });
  55593. Object.defineProperty(module, "id", {
  55594. enumerable: true,
  55595. get: function() {
  55596. return module.i;
  55597. }
  55598. });
  55599. module.webpackPolyfill = 1;
  55600. }
  55601. return module;
  55602. };
  55603. /***/ }),
  55604. /***/ "./resources/js/app.js":
  55605. /*!*****************************!*\
  55606. !*** ./resources/js/app.js ***!
  55607. \*****************************/
  55608. /*! no static exports found */
  55609. /***/ (function(module, exports, __webpack_require__) {
  55610. /**
  55611. * First we will load all of this project's JavaScript dependencies which
  55612. * includes Vue and other libraries. It is a great starting point when
  55613. * building robust, powerful web applications using Vue and Laravel.
  55614. */
  55615. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55616. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55617. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55618. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55619. /**
  55620. * The following block of code may be used to automatically register your
  55621. * Vue components. It will recursively scan this directory for the Vue
  55622. * components and automatically register them with their "basename".
  55623. *
  55624. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55625. */
  55626. // const files = require.context('./', true, /\.vue$/i)
  55627. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55628. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55629. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55630. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55631. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55632. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55633. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55634. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55635. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55636. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55637. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55638. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55639. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55640. /**
  55641. * Next, we will create a fresh Vue application instance and attach it to
  55642. * the page. Then, you may begin adding components to this application
  55643. * or customize the JavaScript scaffolding to fit your unique needs.
  55644. */
  55645. var app = new Vue({
  55646. el: '#app'
  55647. });
  55648. $(function () {
  55649. $('[data-toggle="tooltip"]').tooltip();
  55650. });
  55651. var clipboard = new Clipboard('.btn-clip');
  55652. clipboard.on('success', function (e) {
  55653. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55654. position: "right",
  55655. className: 'success'
  55656. });
  55657. e.clearSelection();
  55658. });
  55659. /***/ }),
  55660. /***/ "./resources/js/bootstrap.js":
  55661. /*!***********************************!*\
  55662. !*** ./resources/js/bootstrap.js ***!
  55663. \***********************************/
  55664. /*! no exports provided */
  55665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55666. "use strict";
  55667. __webpack_require__.r(__webpack_exports__);
  55668. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55669. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55670. /**
  55671. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55672. * for JavaScript based Bootstrap features such as modals and tabs. This
  55673. * code may be modified to fit the specific needs of your application.
  55674. */
  55675. try {
  55676. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55677. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55678. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55679. } catch (e) {}
  55680. /**
  55681. * We'll load the axios HTTP library which allows us to easily issue requests
  55682. * to our Laravel back-end. This library automatically handles sending the
  55683. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55684. */
  55685. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55686. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55687. /**
  55688. * Echo exposes an expressive API for subscribing to channels and listening
  55689. * for events that are broadcast by Laravel. Echo and event broadcasting
  55690. * allows your team to easily build robust real-time web applications.
  55691. */
  55692. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55693. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55694. broadcaster: 'pusher',
  55695. key: "upccrt",
  55696. authEndpoint: '/broadcasting/auth',
  55697. wsHost: window.location.hostname,
  55698. wsPort: 6001,
  55699. disableStats: true
  55700. });
  55701. /***/ }),
  55702. /***/ "./resources/js/components/ExampleComponent.vue":
  55703. /*!******************************************************!*\
  55704. !*** ./resources/js/components/ExampleComponent.vue ***!
  55705. \******************************************************/
  55706. /*! exports provided: default */
  55707. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55708. "use strict";
  55709. __webpack_require__.r(__webpack_exports__);
  55710. /* 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&");
  55711. /* 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&");
  55712. /* 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");
  55713. /* normalize component */
  55714. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55715. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55716. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55717. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55718. false,
  55719. null,
  55720. null,
  55721. null
  55722. )
  55723. /* hot reload */
  55724. if (false) { var api; }
  55725. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55726. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55727. /***/ }),
  55728. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55729. /*!*******************************************************************************!*\
  55730. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55731. \*******************************************************************************/
  55732. /*! exports provided: default */
  55733. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55734. "use strict";
  55735. __webpack_require__.r(__webpack_exports__);
  55736. /* 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&");
  55737. /* 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"]);
  55738. /***/ }),
  55739. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55740. /*!*************************************************************************************!*\
  55741. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55742. \*************************************************************************************/
  55743. /*! exports provided: render, staticRenderFns */
  55744. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55745. "use strict";
  55746. __webpack_require__.r(__webpack_exports__);
  55747. /* 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&");
  55748. /* 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"]; });
  55749. /* 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"]; });
  55750. /***/ }),
  55751. /***/ "./resources/js/components/assetinfo.vue":
  55752. /*!***********************************************!*\
  55753. !*** ./resources/js/components/assetinfo.vue ***!
  55754. \***********************************************/
  55755. /*! exports provided: default */
  55756. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55757. "use strict";
  55758. __webpack_require__.r(__webpack_exports__);
  55759. /* 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&");
  55760. /* 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&");
  55761. /* 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");
  55762. /* normalize component */
  55763. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55764. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55765. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55766. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55767. false,
  55768. null,
  55769. null,
  55770. null
  55771. )
  55772. /* hot reload */
  55773. if (false) { var api; }
  55774. component.options.__file = "resources/js/components/assetinfo.vue"
  55775. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55776. /***/ }),
  55777. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55778. /*!************************************************************************!*\
  55779. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55780. \************************************************************************/
  55781. /*! exports provided: default */
  55782. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55783. "use strict";
  55784. __webpack_require__.r(__webpack_exports__);
  55785. /* 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&");
  55786. /* 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"]);
  55787. /***/ }),
  55788. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55789. /*!******************************************************************************!*\
  55790. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55791. \******************************************************************************/
  55792. /*! exports provided: render, staticRenderFns */
  55793. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55794. "use strict";
  55795. __webpack_require__.r(__webpack_exports__);
  55796. /* 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&");
  55797. /* 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"]; });
  55798. /* 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"]; });
  55799. /***/ }),
  55800. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55801. /*!******************************************************************!*\
  55802. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55803. \******************************************************************/
  55804. /*! exports provided: default */
  55805. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55806. "use strict";
  55807. __webpack_require__.r(__webpack_exports__);
  55808. /* 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&");
  55809. /* 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&");
  55810. /* 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");
  55811. /* normalize component */
  55812. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55813. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55814. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55815. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55816. false,
  55817. null,
  55818. null,
  55819. null
  55820. )
  55821. /* hot reload */
  55822. if (false) { var api; }
  55823. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55824. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55825. /***/ }),
  55826. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55827. /*!*******************************************************************************************!*\
  55828. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55829. \*******************************************************************************************/
  55830. /*! exports provided: default */
  55831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55832. "use strict";
  55833. __webpack_require__.r(__webpack_exports__);
  55834. /* 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&");
  55835. /* 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"]);
  55836. /***/ }),
  55837. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55838. /*!*************************************************************************************************!*\
  55839. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55840. \*************************************************************************************************/
  55841. /*! exports provided: render, staticRenderFns */
  55842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55843. "use strict";
  55844. __webpack_require__.r(__webpack_exports__);
  55845. /* 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&");
  55846. /* 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"]; });
  55847. /* 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"]; });
  55848. /***/ }),
  55849. /***/ "./resources/js/components/credential-form-modal.vue":
  55850. /*!***********************************************************!*\
  55851. !*** ./resources/js/components/credential-form-modal.vue ***!
  55852. \***********************************************************/
  55853. /*! exports provided: default */
  55854. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55855. "use strict";
  55856. __webpack_require__.r(__webpack_exports__);
  55857. /* 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&");
  55858. /* 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&");
  55859. /* 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");
  55860. /* normalize component */
  55861. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55862. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55863. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55864. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55865. false,
  55866. null,
  55867. null,
  55868. null
  55869. )
  55870. /* hot reload */
  55871. if (false) { var api; }
  55872. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55873. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55874. /***/ }),
  55875. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55876. /*!************************************************************************************!*\
  55877. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55878. \************************************************************************************/
  55879. /*! exports provided: default */
  55880. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55881. "use strict";
  55882. __webpack_require__.r(__webpack_exports__);
  55883. /* 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&");
  55884. /* 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"]);
  55885. /***/ }),
  55886. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55887. /*!******************************************************************************************!*\
  55888. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55889. \******************************************************************************************/
  55890. /*! exports provided: render, staticRenderFns */
  55891. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55892. "use strict";
  55893. __webpack_require__.r(__webpack_exports__);
  55894. /* 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&");
  55895. /* 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"]; });
  55896. /* 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"]; });
  55897. /***/ }),
  55898. /***/ "./resources/js/components/credential-list.vue":
  55899. /*!*****************************************************!*\
  55900. !*** ./resources/js/components/credential-list.vue ***!
  55901. \*****************************************************/
  55902. /*! exports provided: default */
  55903. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55904. "use strict";
  55905. __webpack_require__.r(__webpack_exports__);
  55906. /* 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&");
  55907. /* 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&");
  55908. /* 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");
  55909. /* normalize component */
  55910. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55911. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55912. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55913. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55914. false,
  55915. null,
  55916. null,
  55917. null
  55918. )
  55919. /* hot reload */
  55920. if (false) { var api; }
  55921. component.options.__file = "resources/js/components/credential-list.vue"
  55922. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55923. /***/ }),
  55924. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55925. /*!******************************************************************************!*\
  55926. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55927. \******************************************************************************/
  55928. /*! exports provided: default */
  55929. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55930. "use strict";
  55931. __webpack_require__.r(__webpack_exports__);
  55932. /* 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&");
  55933. /* 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"]);
  55934. /***/ }),
  55935. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55936. /*!************************************************************************************!*\
  55937. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55938. \************************************************************************************/
  55939. /*! exports provided: render, staticRenderFns */
  55940. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55941. "use strict";
  55942. __webpack_require__.r(__webpack_exports__);
  55943. /* 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&");
  55944. /* 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"]; });
  55945. /* 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"]; });
  55946. /***/ }),
  55947. /***/ "./resources/js/components/credential.vue":
  55948. /*!************************************************!*\
  55949. !*** ./resources/js/components/credential.vue ***!
  55950. \************************************************/
  55951. /*! exports provided: default */
  55952. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55953. "use strict";
  55954. __webpack_require__.r(__webpack_exports__);
  55955. /* 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&");
  55956. /* 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&");
  55957. /* 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");
  55958. /* normalize component */
  55959. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55960. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55961. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55962. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55963. false,
  55964. null,
  55965. null,
  55966. null
  55967. )
  55968. /* hot reload */
  55969. if (false) { var api; }
  55970. component.options.__file = "resources/js/components/credential.vue"
  55971. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55972. /***/ }),
  55973. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55974. /*!*************************************************************************!*\
  55975. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55976. \*************************************************************************/
  55977. /*! exports provided: default */
  55978. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55979. "use strict";
  55980. __webpack_require__.r(__webpack_exports__);
  55981. /* 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&");
  55982. /* 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"]);
  55983. /***/ }),
  55984. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55985. /*!*******************************************************************************!*\
  55986. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55987. \*******************************************************************************/
  55988. /*! exports provided: render, staticRenderFns */
  55989. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55990. "use strict";
  55991. __webpack_require__.r(__webpack_exports__);
  55992. /* 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&");
  55993. /* 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"]; });
  55994. /* 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"]; });
  55995. /***/ }),
  55996. /***/ "./resources/js/components/errorlist.vue":
  55997. /*!***********************************************!*\
  55998. !*** ./resources/js/components/errorlist.vue ***!
  55999. \***********************************************/
  56000. /*! exports provided: default */
  56001. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56002. "use strict";
  56003. __webpack_require__.r(__webpack_exports__);
  56004. /* 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&");
  56005. /* 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&");
  56006. /* 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");
  56007. /* normalize component */
  56008. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56009. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56010. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  56011. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56012. false,
  56013. null,
  56014. null,
  56015. null
  56016. )
  56017. /* hot reload */
  56018. if (false) { var api; }
  56019. component.options.__file = "resources/js/components/errorlist.vue"
  56020. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56021. /***/ }),
  56022. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  56023. /*!************************************************************************!*\
  56024. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  56025. \************************************************************************/
  56026. /*! exports provided: default */
  56027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56028. "use strict";
  56029. __webpack_require__.r(__webpack_exports__);
  56030. /* 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&");
  56031. /* 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"]);
  56032. /***/ }),
  56033. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  56034. /*!******************************************************************************!*\
  56035. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  56036. \******************************************************************************/
  56037. /*! exports provided: render, staticRenderFns */
  56038. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56039. "use strict";
  56040. __webpack_require__.r(__webpack_exports__);
  56041. /* 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&");
  56042. /* 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"]; });
  56043. /* 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"]; });
  56044. /***/ }),
  56045. /***/ "./resources/js/components/modal.vue":
  56046. /*!*******************************************!*\
  56047. !*** ./resources/js/components/modal.vue ***!
  56048. \*******************************************/
  56049. /*! exports provided: default */
  56050. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56051. "use strict";
  56052. __webpack_require__.r(__webpack_exports__);
  56053. /* 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&");
  56054. /* 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");
  56055. var script = {}
  56056. /* normalize component */
  56057. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  56058. script,
  56059. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  56060. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56061. false,
  56062. null,
  56063. null,
  56064. null
  56065. )
  56066. /* hot reload */
  56067. if (false) { var api; }
  56068. component.options.__file = "resources/js/components/modal.vue"
  56069. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56070. /***/ }),
  56071. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56072. /*!**************************************************************************!*\
  56073. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56074. \**************************************************************************/
  56075. /*! exports provided: render, staticRenderFns */
  56076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56077. "use strict";
  56078. __webpack_require__.r(__webpack_exports__);
  56079. /* 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&");
  56080. /* 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"]; });
  56081. /* 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"]; });
  56082. /***/ }),
  56083. /***/ "./resources/js/components/note-form-modal.vue":
  56084. /*!*****************************************************!*\
  56085. !*** ./resources/js/components/note-form-modal.vue ***!
  56086. \*****************************************************/
  56087. /*! exports provided: default */
  56088. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56089. "use strict";
  56090. __webpack_require__.r(__webpack_exports__);
  56091. /* 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&");
  56092. /* 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&");
  56093. /* 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");
  56094. /* normalize component */
  56095. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56096. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56097. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56098. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56099. false,
  56100. null,
  56101. null,
  56102. null
  56103. )
  56104. /* hot reload */
  56105. if (false) { var api; }
  56106. component.options.__file = "resources/js/components/note-form-modal.vue"
  56107. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56108. /***/ }),
  56109. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56110. /*!******************************************************************************!*\
  56111. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56112. \******************************************************************************/
  56113. /*! exports provided: default */
  56114. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56115. "use strict";
  56116. __webpack_require__.r(__webpack_exports__);
  56117. /* 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&");
  56118. /* 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"]);
  56119. /***/ }),
  56120. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56121. /*!************************************************************************************!*\
  56122. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56123. \************************************************************************************/
  56124. /*! exports provided: render, staticRenderFns */
  56125. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56126. "use strict";
  56127. __webpack_require__.r(__webpack_exports__);
  56128. /* 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&");
  56129. /* 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"]; });
  56130. /* 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"]; });
  56131. /***/ }),
  56132. /***/ "./resources/js/components/notes.vue":
  56133. /*!*******************************************!*\
  56134. !*** ./resources/js/components/notes.vue ***!
  56135. \*******************************************/
  56136. /*! exports provided: default */
  56137. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56138. "use strict";
  56139. __webpack_require__.r(__webpack_exports__);
  56140. /* 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&");
  56141. /* 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&");
  56142. /* 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");
  56143. /* normalize component */
  56144. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56145. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56146. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56147. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56148. false,
  56149. null,
  56150. null,
  56151. null
  56152. )
  56153. /* hot reload */
  56154. if (false) { var api; }
  56155. component.options.__file = "resources/js/components/notes.vue"
  56156. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56157. /***/ }),
  56158. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56159. /*!********************************************************************!*\
  56160. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56161. \********************************************************************/
  56162. /*! exports provided: default */
  56163. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56164. "use strict";
  56165. __webpack_require__.r(__webpack_exports__);
  56166. /* 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&");
  56167. /* 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"]);
  56168. /***/ }),
  56169. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56170. /*!**************************************************************************!*\
  56171. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56172. \**************************************************************************/
  56173. /*! exports provided: render, staticRenderFns */
  56174. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56175. "use strict";
  56176. __webpack_require__.r(__webpack_exports__);
  56177. /* 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&");
  56178. /* 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"]; });
  56179. /* 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"]; });
  56180. /***/ }),
  56181. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56182. /*!*******************************************************!*\
  56183. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56184. \*******************************************************/
  56185. /*! exports provided: default */
  56186. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56187. "use strict";
  56188. __webpack_require__.r(__webpack_exports__);
  56189. /* 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&");
  56190. /* 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&");
  56191. /* 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");
  56192. /* normalize component */
  56193. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56194. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56195. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56196. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56197. false,
  56198. null,
  56199. null,
  56200. null
  56201. )
  56202. /* hot reload */
  56203. if (false) { var api; }
  56204. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56205. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56206. /***/ }),
  56207. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56208. /*!********************************************************************************!*\
  56209. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56210. \********************************************************************************/
  56211. /*! exports provided: default */
  56212. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56213. "use strict";
  56214. __webpack_require__.r(__webpack_exports__);
  56215. /* 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&");
  56216. /* 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"]);
  56217. /***/ }),
  56218. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56219. /*!**************************************************************************************!*\
  56220. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56221. \**************************************************************************************/
  56222. /*! exports provided: render, staticRenderFns */
  56223. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56224. "use strict";
  56225. __webpack_require__.r(__webpack_exports__);
  56226. /* 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&");
  56227. /* 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"]; });
  56228. /* 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"]; });
  56229. /***/ }),
  56230. /***/ "./resources/js/components/woinfo.vue":
  56231. /*!********************************************!*\
  56232. !*** ./resources/js/components/woinfo.vue ***!
  56233. \********************************************/
  56234. /*! exports provided: default */
  56235. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56236. "use strict";
  56237. __webpack_require__.r(__webpack_exports__);
  56238. /* 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&");
  56239. /* 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&");
  56240. /* 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");
  56241. /* normalize component */
  56242. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56243. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56244. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56245. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56246. false,
  56247. null,
  56248. null,
  56249. null
  56250. )
  56251. /* hot reload */
  56252. if (false) { var api; }
  56253. component.options.__file = "resources/js/components/woinfo.vue"
  56254. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56255. /***/ }),
  56256. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56257. /*!*********************************************************************!*\
  56258. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56259. \*********************************************************************/
  56260. /*! exports provided: default */
  56261. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56262. "use strict";
  56263. __webpack_require__.r(__webpack_exports__);
  56264. /* 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&");
  56265. /* 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"]);
  56266. /***/ }),
  56267. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56268. /*!***************************************************************************!*\
  56269. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56270. \***************************************************************************/
  56271. /*! exports provided: render, staticRenderFns */
  56272. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56273. "use strict";
  56274. __webpack_require__.r(__webpack_exports__);
  56275. /* 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&");
  56276. /* 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"]; });
  56277. /* 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"]; });
  56278. /***/ }),
  56279. /***/ "./resources/js/mixins/dateMixin.js":
  56280. /*!******************************************!*\
  56281. !*** ./resources/js/mixins/dateMixin.js ***!
  56282. \******************************************/
  56283. /*! exports provided: default */
  56284. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56285. "use strict";
  56286. __webpack_require__.r(__webpack_exports__);
  56287. /* harmony default export */ __webpack_exports__["default"] = ({
  56288. methods: {
  56289. treatAsUTC: function treatAsUTC(date) {
  56290. var result = new Date(date);
  56291. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56292. return result;
  56293. },
  56294. daysSinceToday: function daysSinceToday(date) {
  56295. var currentDate = new Date();
  56296. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56297. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56298. },
  56299. getHRDate: function getHRDate(dateString) {
  56300. var date = new Date(dateString);
  56301. return date.toLocaleString('default', {
  56302. month: 'short',
  56303. day: 'numeric',
  56304. year: 'numeric',
  56305. hour: 'numeric',
  56306. minute: 'numeric'
  56307. });
  56308. },
  56309. isZero: function isZero(dateString) {
  56310. return dateString === '0000-00-00 00:00:00';
  56311. }
  56312. }
  56313. });
  56314. /***/ }),
  56315. /***/ "./resources/js/notify.min.js":
  56316. /*!************************************!*\
  56317. !*** ./resources/js/notify.min.js ***!
  56318. \************************************/
  56319. /*! no static exports found */
  56320. /***/ (function(module, exports, __webpack_require__) {
  56321. 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); }
  56322. (function (e) {
  56323. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56324. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56325. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56326. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56327. })(function (e) {
  56328. function A(t, n, i) {
  56329. typeof i == "string" && (i = {
  56330. className: i
  56331. }), 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);
  56332. }
  56333. var t = [].indexOf || function (e) {
  56334. for (var t = 0, n = this.length; t < n; t++) {
  56335. if (t in this && this[t] === e) return t;
  56336. }
  56337. return -1;
  56338. },
  56339. n = "notify",
  56340. r = n + "js",
  56341. i = n + "!blank",
  56342. s = {
  56343. t: "top",
  56344. m: "middle",
  56345. b: "bottom",
  56346. l: "left",
  56347. c: "center",
  56348. r: "right"
  56349. },
  56350. o = ["l", "c", "r"],
  56351. u = ["t", "m", "b"],
  56352. a = ["t", "b", "l", "r"],
  56353. f = {
  56354. t: "b",
  56355. m: null,
  56356. b: "t",
  56357. l: "r",
  56358. c: null,
  56359. r: "l"
  56360. },
  56361. l = function l(t) {
  56362. var n;
  56363. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56364. var r;
  56365. r = t.toLowerCase().charAt(0);
  56366. if (s[r]) return n.push(r);
  56367. }), n;
  56368. },
  56369. c = {},
  56370. h = {
  56371. name: "core",
  56372. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56373. 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}"
  56374. },
  56375. p = {
  56376. "border-radius": ["-webkit-", "-moz-"]
  56377. },
  56378. d = function d(e) {
  56379. return c[e];
  56380. },
  56381. v = function v(e) {
  56382. if (!e) throw "Missing Style name";
  56383. c[e] && delete c[e];
  56384. },
  56385. m = function m(t, i) {
  56386. if (!t) throw "Missing Style name";
  56387. if (!i) throw "Missing Style definition";
  56388. if (!i.html) throw "Missing Style HTML";
  56389. var s = c[t];
  56390. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56391. var o = "";
  56392. i.classes && e.each(i.classes, function (t, n) {
  56393. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56394. return p[t] && e.each(p[t], function (e, r) {
  56395. return o += " " + r + t + ": " + n + ";\n";
  56396. }), o += " " + t + ": " + n + ";\n";
  56397. }), o += "}\n";
  56398. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56399. var u = {},
  56400. a = e(i.html);
  56401. y("html", a, u), y("text", a, u), i.fields = u;
  56402. },
  56403. g = function g(t) {
  56404. var n, r, i;
  56405. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56406. try {
  56407. r.html(t);
  56408. } catch (s) {
  56409. r[0].styleSheet.cssText = t;
  56410. }
  56411. return r;
  56412. },
  56413. y = function y(t, n, r) {
  56414. var s;
  56415. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56416. var n;
  56417. n = e(this).attr(s), n || (n = i), r[n] = t;
  56418. });
  56419. },
  56420. b = function b(e, t) {
  56421. return e.is(t) ? e : e.find(t);
  56422. },
  56423. w = {
  56424. clickToHide: !0,
  56425. autoHide: !0,
  56426. autoHideDelay: 5e3,
  56427. arrowShow: !0,
  56428. arrowSize: 5,
  56429. breakNewLines: !0,
  56430. elementPosition: "bottom",
  56431. globalPosition: "top right",
  56432. style: "bootstrap",
  56433. className: "error",
  56434. showAnimation: "slideDown",
  56435. showDuration: 400,
  56436. hideAnimation: "slideUp",
  56437. hideDuration: 200,
  56438. gap: 5
  56439. },
  56440. E = function E(t, n) {
  56441. var r;
  56442. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56443. },
  56444. S = function S(t) {
  56445. return e.extend(w, t);
  56446. },
  56447. x = function x(t) {
  56448. return e("<" + t + "></" + t + ">");
  56449. },
  56450. T = {},
  56451. N = function N(t) {
  56452. var n;
  56453. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56454. return e(r).attr("name") === t.attr("name");
  56455. }), t = n.first()), t;
  56456. },
  56457. C = function C(e, t, n) {
  56458. var r, i;
  56459. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56460. if (isNaN(n)) return;
  56461. 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;
  56462. },
  56463. k = function k(e, t, n) {
  56464. if (e === "l" || e === "t") return 0;
  56465. if (e === "c" || e === "m") return n / 2 - t / 2;
  56466. if (e === "r" || e === "b") return n - t;
  56467. throw "Invalid alignment";
  56468. },
  56469. L = function L(e) {
  56470. return L.e = L.e || x("div"), L.e.text(e).html();
  56471. };
  56472. A.prototype.loadHTML = function () {
  56473. var t;
  56474. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56475. }, A.prototype.show = function (e, t) {
  56476. var n, r, i, s, o;
  56477. r = function (n) {
  56478. return function () {
  56479. !e && !n.elem && n.destroy();
  56480. if (t) return t();
  56481. };
  56482. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56483. 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 {
  56484. if (!!o || !!e) return r();
  56485. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56486. }
  56487. return n.push(r), i[s].apply(i, n);
  56488. }, A.prototype.setGlobalPosition = function () {
  56489. var t = this.getPosition(),
  56490. n = t[0],
  56491. i = t[1],
  56492. o = s[n],
  56493. u = s[i],
  56494. a = n + "|" + i,
  56495. f = T[a];
  56496. if (!f || !document.body.contains(f[0])) {
  56497. f = T[a] = x("div");
  56498. var l = {};
  56499. 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);
  56500. }
  56501. return f.prepend(this.wrapper);
  56502. }, A.prototype.setElementPosition = function () {
  56503. 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;
  56504. 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"];
  56505. for (w = 0, S = B.length; w < S; w++) {
  56506. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56507. }
  56508. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56509. if (!this.options.arrowShow) this.arrow.hide();else {
  56510. 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";
  56511. for (E = 0, x = a.length; E < x; E++) {
  56512. D = a[E], P = s[D];
  56513. if (D === L) continue;
  56514. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56515. }
  56516. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56517. }
  56518. 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);
  56519. if (r) return this.arrow.removeAttr("style").css(r);
  56520. }, A.prototype.getPosition = function () {
  56521. var e, n, r, i, s, f, c, h;
  56522. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56523. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56524. 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";
  56525. return e.length === 2 && (e[2] = e[1]), e;
  56526. }, A.prototype.getStyle = function (e) {
  56527. var t;
  56528. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56529. if (!t) throw "Missing style: " + e;
  56530. return t;
  56531. }, A.prototype.updateClasses = function () {
  56532. var t, n;
  56533. 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) {
  56534. return r + "-" + n.name + "-" + e;
  56535. }).join(" "), this.userContainer.attr("class", t);
  56536. }, A.prototype.run = function (t, n) {
  56537. var r, s, o, u, a;
  56538. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56539. if (this.container && !t) {
  56540. this.show(!1);
  56541. return;
  56542. }
  56543. if (!this.container && !t) return;
  56544. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56545. for (o in s) {
  56546. r = s[o], u = this.userFields[o];
  56547. if (!u) continue;
  56548. 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);
  56549. }
  56550. 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));
  56551. }, A.prototype.destroy = function () {
  56552. this.wrapper.data(r, null), this.wrapper.remove();
  56553. }, e[n] = function (t, r, i) {
  56554. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56555. }, e.fn[n] = function (t, n) {
  56556. return e(this).each(function () {
  56557. var i = N(e(this)).data(r);
  56558. i && i.destroy();
  56559. var s = new A(e(this), t, n);
  56560. }), this;
  56561. }, e.extend(e[n], {
  56562. defaults: S,
  56563. addStyle: m,
  56564. removeStyle: v,
  56565. pluginOptions: w,
  56566. getStyle: d,
  56567. insertCSS: g
  56568. }), m("bootstrap", {
  56569. html: "<div>\n<span data-notify-text></span>\n</div>",
  56570. classes: {
  56571. base: {
  56572. "font-weight": "bold",
  56573. padding: "8px 15px 8px 14px",
  56574. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56575. "background-color": "#fcf8e3",
  56576. border: "1px solid #fbeed5",
  56577. "border-radius": "4px",
  56578. "white-space": "nowrap",
  56579. "padding-left": "25px",
  56580. "background-repeat": "no-repeat",
  56581. "background-position": "3px 7px"
  56582. },
  56583. error: {
  56584. color: "#B94A48",
  56585. "background-color": "#F2DEDE",
  56586. "border-color": "#EED3D7",
  56587. "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=)"
  56588. },
  56589. success: {
  56590. color: "#468847",
  56591. "background-color": "#DFF0D8",
  56592. "border-color": "#D6E9C6",
  56593. "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==)"
  56594. },
  56595. info: {
  56596. color: "#3A87AD",
  56597. "background-color": "#D9EDF7",
  56598. "border-color": "#BCE8F1",
  56599. "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=)"
  56600. },
  56601. warn: {
  56602. color: "#C09853",
  56603. "background-color": "#FCF8E3",
  56604. "border-color": "#FBEED5",
  56605. "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)"
  56606. }
  56607. }
  56608. }), e(function () {
  56609. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56610. e(this).trigger("notify-hide");
  56611. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56612. var n = e(this).data(r);
  56613. n && n.show(!1);
  56614. });
  56615. });
  56616. });
  56617. /***/ }),
  56618. /***/ "./resources/sass/app.scss":
  56619. /*!*********************************!*\
  56620. !*** ./resources/sass/app.scss ***!
  56621. \*********************************/
  56622. /*! no static exports found */
  56623. /***/ (function(module, exports) {
  56624. // removed by extract-text-webpack-plugin
  56625. /***/ }),
  56626. /***/ 0:
  56627. /*!*************************************************************!*\
  56628. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56629. \*************************************************************/
  56630. /*! no static exports found */
  56631. /***/ (function(module, exports, __webpack_require__) {
  56632. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56633. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56634. /***/ })
  56635. /******/ });