app.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053
  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/AutocompleteCustomDropdown.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/AutocompleteCustomDropdown.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. //
  1598. //
  1599. //
  1600. //
  1601. //
  1602. /* harmony default export */ __webpack_exports__["default"] = ({
  1603. props: {
  1604. value: null,
  1605. // An object with the following format
  1606. // {
  1607. // key: value,
  1608. // key: value,
  1609. // }
  1610. options: {
  1611. type: Object,
  1612. required: true
  1613. },
  1614. allowCustom: {
  1615. type: Boolean,
  1616. "default": false
  1617. }
  1618. },
  1619. data: function data() {
  1620. return {
  1621. searchText: '',
  1622. selectedOption: null,
  1623. open: false,
  1624. // allows for checking whether button was clicked or text was typed.
  1625. // If button was clicked, we show all options without having to clear
  1626. // out any searchText that was autofilled when page loaded.
  1627. isSearching: false
  1628. };
  1629. },
  1630. computed: {
  1631. matches: function matches() {
  1632. var _this = this;
  1633. // If button was clicked, show all options, if typing, filter
  1634. // options based on searchText
  1635. return Object.entries(this.options).filter(function (option) {
  1636. var optionText = option[1].toUpperCase();
  1637. if (_this.isSearching) {
  1638. return optionText.match(_this.searchText.toUpperCase());
  1639. } else {
  1640. return optionText.match('');
  1641. }
  1642. });
  1643. }
  1644. },
  1645. methods: {
  1646. // if button is clicked, show all options
  1647. setOpen: function setOpen(isOpen) {
  1648. this.open = isOpen;
  1649. this.isSearching = false;
  1650. },
  1651. // if typing in the box, start filtering options
  1652. searchChanged: function searchChanged() {
  1653. if (!this.open) {
  1654. this.open = true;
  1655. }
  1656. if (!this.isSearching) {
  1657. this.isSearching = true;
  1658. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1659. if (this.allowCustom) {
  1660. this.$emit('input', {
  1661. 'id': 'custom',
  1662. 'name': this.searchText
  1663. });
  1664. }
  1665. },
  1666. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1667. // a suggestion is selected
  1668. suggestionSelected: function suggestionSelected(suggestion) {
  1669. this.open = false;
  1670. this.searchText = suggestion[1];
  1671. this.$emit('input', {
  1672. 'id': suggestion[0],
  1673. 'name': suggestion[1]
  1674. });
  1675. },
  1676. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1677. if (this.allowCustom) {
  1678. this.searchText = this.value.name;
  1679. } else {
  1680. if (newValue.id > -1) {
  1681. // Find the matching text for the supplied option value
  1682. for (var id in this.options) {
  1683. if (this.options.hasOwnProperty(id)) {
  1684. if (this.options[id] === this.options[newValue.id]) {
  1685. this.searchText = this.options[id];
  1686. }
  1687. }
  1688. }
  1689. }
  1690. }
  1691. }
  1692. },
  1693. mounted: function mounted() {
  1694. this.updateComponentWithValue(this.value);
  1695. },
  1696. watch: {
  1697. value: function value(newValue) {
  1698. this.updateComponentWithValue(newValue);
  1699. }
  1700. }
  1701. });
  1702. /***/ }),
  1703. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  1704. /*!************************************************************************************************************************************************************************!*\
  1705. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  1706. \************************************************************************************************************************************************************************/
  1707. /*! exports provided: default */
  1708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1709. "use strict";
  1710. __webpack_require__.r(__webpack_exports__);
  1711. //
  1712. //
  1713. //
  1714. //
  1715. /* harmony default export */ __webpack_exports__["default"] = ({
  1716. name: 'IntersectingCirclesSpinner',
  1717. props: {
  1718. color: {
  1719. type: String,
  1720. "default": '#fff'
  1721. }
  1722. }
  1723. });
  1724. /***/ }),
  1725. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  1726. /*!**************************************************************************************************************************************************************************!*\
  1727. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  1728. \**************************************************************************************************************************************************************************/
  1729. /*! exports provided: default */
  1730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1731. "use strict";
  1732. __webpack_require__.r(__webpack_exports__);
  1733. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  1734. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1735. //
  1736. //
  1737. //
  1738. //
  1739. //
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. //
  1751. //
  1752. //
  1753. //
  1754. //
  1755. //
  1756. //
  1757. //
  1758. //
  1759. //
  1760. //
  1761. //
  1762. //
  1763. //
  1764. //
  1765. //
  1766. //
  1767. //
  1768. /* harmony default export */ __webpack_exports__["default"] = ({
  1769. components: {
  1770. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  1771. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  1772. },
  1773. props: ['populateWith', 'storeList', 'modalId'],
  1774. data: function data() {
  1775. return {
  1776. // Copies object from prop, so it doesn't mutate the object
  1777. // from the parent component. Parent component will be updated via
  1778. // Websocket if updateWorkOrder is successful.
  1779. data: JSON.parse(JSON.stringify(this.populateWith)),
  1780. id: this.modalId,
  1781. store: {},
  1782. errors: []
  1783. };
  1784. },
  1785. methods: {
  1786. updateWorkOrder: function updateWorkOrder() {
  1787. var _this = this;
  1788. this.data.storeid = this.store.id;
  1789. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1790. $('#workordereditModal').modal('hide');
  1791. })["catch"](function (error) {
  1792. _this.errors = JSON.parse(error.response.request.response).errors;
  1793. });
  1794. }
  1795. },
  1796. mounted: function mounted() {
  1797. this.store = {
  1798. 'id': this.data.storeid,
  1799. 'name': this.storeList[this.data.storeid]
  1800. };
  1801. },
  1802. // This was originally here because the populateWith info would originally
  1803. // not necessarily be loaded when this component was mounted. That is no
  1804. // longer the case as I now don't render the parent component until the
  1805. // ajax request is finised. The watch statements are still here to cover
  1806. // the case where someone else updates the populateWith values while
  1807. // someone is editing, although it probably should be edited so it doesn't
  1808. // immediately overwrite the unsaved edits of the current user.
  1809. watch: {
  1810. populateWith: function populateWith(value) {
  1811. this.data = JSON.parse(JSON.stringify(this.populateWith));
  1812. this.store = {
  1813. 'id': this.data.storeid,
  1814. 'name': this.storeList[this.data.storeid]
  1815. };
  1816. },
  1817. storeList: function storeList(value) {
  1818. this.store = {
  1819. 'id': this.data.storeid,
  1820. 'name': this.storeList[this.data.storeid]
  1821. };
  1822. }
  1823. }
  1824. });
  1825. /***/ }),
  1826. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  1827. /*!************************************************************************************************************************************************************************!*\
  1828. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  1829. \************************************************************************************************************************************************************************/
  1830. /*! exports provided: default */
  1831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1832. "use strict";
  1833. __webpack_require__.r(__webpack_exports__);
  1834. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1835. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. //
  1856. /* harmony default export */ __webpack_exports__["default"] = ({
  1857. components: {
  1858. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  1859. },
  1860. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1861. props: ['workOrder', 'stores'],
  1862. computed: {
  1863. storeList: function storeList() {
  1864. var list = {};
  1865. Object.values(this.stores).map(function (val) {
  1866. list[val.storeid] = val.storesname;
  1867. });
  1868. return list;
  1869. }
  1870. }
  1871. });
  1872. /***/ }),
  1873. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  1874. /*!*********************************************************************************************************************************************************!*\
  1875. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  1876. \*********************************************************************************************************************************************************/
  1877. /*! exports provided: default */
  1878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1879. "use strict";
  1880. __webpack_require__.r(__webpack_exports__);
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. //
  1896. //
  1897. //
  1898. //
  1899. //
  1900. //
  1901. //
  1902. //
  1903. //
  1904. //
  1905. //
  1906. //
  1907. //
  1908. //
  1909. //
  1910. //
  1911. //
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. //
  1919. //
  1920. //
  1921. //
  1922. //
  1923. //
  1924. //
  1925. //
  1926. //
  1927. //
  1928. //
  1929. //
  1930. //
  1931. //
  1932. //
  1933. //
  1934. //
  1935. //
  1936. //
  1937. //
  1938. //
  1939. //
  1940. //
  1941. //
  1942. //
  1943. //
  1944. //
  1945. //
  1946. //
  1947. //
  1948. //
  1949. //
  1950. //
  1951. //
  1952. /* harmony default export */ __webpack_exports__["default"] = ({
  1953. data: function data() {
  1954. return {
  1955. isLoggedIn: null,
  1956. username: null
  1957. };
  1958. },
  1959. mounted: function mounted() {
  1960. this.isLoggedIn = localStorage.getItem('jwt');
  1961. this.username = localStorage.getItem('user');
  1962. }
  1963. });
  1964. /***/ }),
  1965. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  1966. /*!***************************************************************************************************************************************************************!*\
  1967. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  1968. \***************************************************************************************************************************************************************/
  1969. /*! exports provided: default */
  1970. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1971. "use strict";
  1972. __webpack_require__.r(__webpack_exports__);
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. /* harmony default export */ __webpack_exports__["default"] = ({
  1997. data: function data() {
  1998. return {
  1999. workOrders: []
  2000. };
  2001. },
  2002. mounted: function mounted() {
  2003. var _this = this;
  2004. var token = localStorage.getItem('jwt');
  2005. var user = localStorage.getItem('user');
  2006. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2007. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2008. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2009. _this.workOrders = response.data;
  2010. })["catch"](function (error) {
  2011. console.log(error);
  2012. });
  2013. },
  2014. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2015. if (!localStorage.getItem('jwt')) {
  2016. return next('login');
  2017. }
  2018. next();
  2019. }
  2020. });
  2021. /***/ }),
  2022. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2023. /*!***********************************************************************************************************************************************************!*\
  2024. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  2025. \***********************************************************************************************************************************************************/
  2026. /*! exports provided: default */
  2027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2028. "use strict";
  2029. __webpack_require__.r(__webpack_exports__);
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2070. data: function data() {
  2071. return {
  2072. username: "",
  2073. password: ""
  2074. };
  2075. },
  2076. methods: {
  2077. handleSubmit: function handleSubmit(e) {
  2078. var _this = this;
  2079. e.preventDefault();
  2080. if (this.password.length > 0) {
  2081. axios.post('api/login', {
  2082. username: this.username,
  2083. password: this.password
  2084. }).then(function (response) {
  2085. localStorage.setItem('user', response.data.success.username);
  2086. localStorage.setItem('jwt', response.data.success.token);
  2087. if (localStorage.getItem('jwt') != null) {
  2088. _this.$router.go('/dashboard');
  2089. }
  2090. })["catch"](function (error) {
  2091. console.error(error);
  2092. });
  2093. }
  2094. }
  2095. },
  2096. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2097. if (localStorage.getItem('jwt')) {
  2098. return next('dashboard');
  2099. }
  2100. next();
  2101. }
  2102. });
  2103. /***/ }),
  2104. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.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/views/Welcome.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. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. /* harmony default export */ __webpack_exports__["default"] = ({});
  2164. /***/ }),
  2165. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2166. /*!***************************************************************************************************************************************************************!*\
  2167. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  2168. \***************************************************************************************************************************************************************/
  2169. /*! exports provided: default */
  2170. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2171. "use strict";
  2172. __webpack_require__.r(__webpack_exports__);
  2173. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2174. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  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. //
  2241. //
  2242. //
  2243. //
  2244. //
  2245. //
  2246. //
  2247. //
  2248. //
  2249. //
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. //
  2266. //
  2267. //
  2268. //
  2269. //
  2270. //
  2271. //
  2272. /* harmony default export */ __webpack_exports__["default"] = ({
  2273. components: {
  2274. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2275. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2276. },
  2277. props: ['id'],
  2278. data: function data() {
  2279. return {
  2280. workOrder: {},
  2281. stores: {},
  2282. woLoading: true,
  2283. storesLoading: true
  2284. };
  2285. },
  2286. mounted: function mounted() {
  2287. var _this = this;
  2288. var token = localStorage.getItem('jwt');
  2289. var user = localStorage.getItem('user');
  2290. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2291. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2292. axios.get('/api/workorders/' + this.id).then(function (response) {
  2293. _this.workOrder = response.data;
  2294. _this.woLoading = false;
  2295. })["catch"](function (error) {
  2296. console.log(error);
  2297. });
  2298. axios.get('/api/stores/').then(function (response) {
  2299. _this.stores = response.data;
  2300. _this.storesLoading = false;
  2301. })["catch"](function (error) {
  2302. console.log(error);
  2303. });
  2304. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2305. _this.workOrder = e.data;
  2306. });
  2307. }
  2308. });
  2309. /***/ }),
  2310. /***/ "./node_modules/base64-js/index.js":
  2311. /*!*****************************************!*\
  2312. !*** ./node_modules/base64-js/index.js ***!
  2313. \*****************************************/
  2314. /*! no static exports found */
  2315. /***/ (function(module, exports, __webpack_require__) {
  2316. "use strict";
  2317. exports.byteLength = byteLength
  2318. exports.toByteArray = toByteArray
  2319. exports.fromByteArray = fromByteArray
  2320. var lookup = []
  2321. var revLookup = []
  2322. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2323. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2324. for (var i = 0, len = code.length; i < len; ++i) {
  2325. lookup[i] = code[i]
  2326. revLookup[code.charCodeAt(i)] = i
  2327. }
  2328. // Support decoding URL-safe base64 strings, as Node.js does.
  2329. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2330. revLookup['-'.charCodeAt(0)] = 62
  2331. revLookup['_'.charCodeAt(0)] = 63
  2332. function getLens (b64) {
  2333. var len = b64.length
  2334. if (len % 4 > 0) {
  2335. throw new Error('Invalid string. Length must be a multiple of 4')
  2336. }
  2337. // Trim off extra bytes after placeholder bytes are found
  2338. // See: https://github.com/beatgammit/base64-js/issues/42
  2339. var validLen = b64.indexOf('=')
  2340. if (validLen === -1) validLen = len
  2341. var placeHoldersLen = validLen === len
  2342. ? 0
  2343. : 4 - (validLen % 4)
  2344. return [validLen, placeHoldersLen]
  2345. }
  2346. // base64 is 4/3 + up to two characters of the original data
  2347. function byteLength (b64) {
  2348. var lens = getLens(b64)
  2349. var validLen = lens[0]
  2350. var placeHoldersLen = lens[1]
  2351. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2352. }
  2353. function _byteLength (b64, validLen, placeHoldersLen) {
  2354. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2355. }
  2356. function toByteArray (b64) {
  2357. var tmp
  2358. var lens = getLens(b64)
  2359. var validLen = lens[0]
  2360. var placeHoldersLen = lens[1]
  2361. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2362. var curByte = 0
  2363. // if there are placeholders, only get up to the last complete 4 chars
  2364. var len = placeHoldersLen > 0
  2365. ? validLen - 4
  2366. : validLen
  2367. var i
  2368. for (i = 0; i < len; i += 4) {
  2369. tmp =
  2370. (revLookup[b64.charCodeAt(i)] << 18) |
  2371. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2372. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2373. revLookup[b64.charCodeAt(i + 3)]
  2374. arr[curByte++] = (tmp >> 16) & 0xFF
  2375. arr[curByte++] = (tmp >> 8) & 0xFF
  2376. arr[curByte++] = tmp & 0xFF
  2377. }
  2378. if (placeHoldersLen === 2) {
  2379. tmp =
  2380. (revLookup[b64.charCodeAt(i)] << 2) |
  2381. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2382. arr[curByte++] = tmp & 0xFF
  2383. }
  2384. if (placeHoldersLen === 1) {
  2385. tmp =
  2386. (revLookup[b64.charCodeAt(i)] << 10) |
  2387. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2388. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2389. arr[curByte++] = (tmp >> 8) & 0xFF
  2390. arr[curByte++] = tmp & 0xFF
  2391. }
  2392. return arr
  2393. }
  2394. function tripletToBase64 (num) {
  2395. return lookup[num >> 18 & 0x3F] +
  2396. lookup[num >> 12 & 0x3F] +
  2397. lookup[num >> 6 & 0x3F] +
  2398. lookup[num & 0x3F]
  2399. }
  2400. function encodeChunk (uint8, start, end) {
  2401. var tmp
  2402. var output = []
  2403. for (var i = start; i < end; i += 3) {
  2404. tmp =
  2405. ((uint8[i] << 16) & 0xFF0000) +
  2406. ((uint8[i + 1] << 8) & 0xFF00) +
  2407. (uint8[i + 2] & 0xFF)
  2408. output.push(tripletToBase64(tmp))
  2409. }
  2410. return output.join('')
  2411. }
  2412. function fromByteArray (uint8) {
  2413. var tmp
  2414. var len = uint8.length
  2415. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2416. var parts = []
  2417. var maxChunkLength = 16383 // must be multiple of 3
  2418. // go through the array every three bytes, we'll deal with trailing stuff later
  2419. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2420. parts.push(encodeChunk(
  2421. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2422. ))
  2423. }
  2424. // pad the end with zeros, but make sure to not forget the extra bytes
  2425. if (extraBytes === 1) {
  2426. tmp = uint8[len - 1]
  2427. parts.push(
  2428. lookup[tmp >> 2] +
  2429. lookup[(tmp << 4) & 0x3F] +
  2430. '=='
  2431. )
  2432. } else if (extraBytes === 2) {
  2433. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2434. parts.push(
  2435. lookup[tmp >> 10] +
  2436. lookup[(tmp >> 4) & 0x3F] +
  2437. lookup[(tmp << 2) & 0x3F] +
  2438. '='
  2439. )
  2440. }
  2441. return parts.join('')
  2442. }
  2443. /***/ }),
  2444. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2445. /*!*****************************************************!*\
  2446. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2447. \*****************************************************/
  2448. /*! no static exports found */
  2449. /***/ (function(module, exports, __webpack_require__) {
  2450. /*!
  2451. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2452. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2453. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2454. */
  2455. (function (global, factory) {
  2456. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2457. undefined;
  2458. }(this, (function (exports, $, Popper) { 'use strict';
  2459. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2460. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2461. function _defineProperties(target, props) {
  2462. for (var i = 0; i < props.length; i++) {
  2463. var descriptor = props[i];
  2464. descriptor.enumerable = descriptor.enumerable || false;
  2465. descriptor.configurable = true;
  2466. if ("value" in descriptor) descriptor.writable = true;
  2467. Object.defineProperty(target, descriptor.key, descriptor);
  2468. }
  2469. }
  2470. function _createClass(Constructor, protoProps, staticProps) {
  2471. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2472. if (staticProps) _defineProperties(Constructor, staticProps);
  2473. return Constructor;
  2474. }
  2475. function _defineProperty(obj, key, value) {
  2476. if (key in obj) {
  2477. Object.defineProperty(obj, key, {
  2478. value: value,
  2479. enumerable: true,
  2480. configurable: true,
  2481. writable: true
  2482. });
  2483. } else {
  2484. obj[key] = value;
  2485. }
  2486. return obj;
  2487. }
  2488. function ownKeys(object, enumerableOnly) {
  2489. var keys = Object.keys(object);
  2490. if (Object.getOwnPropertySymbols) {
  2491. var symbols = Object.getOwnPropertySymbols(object);
  2492. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2493. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2494. });
  2495. keys.push.apply(keys, symbols);
  2496. }
  2497. return keys;
  2498. }
  2499. function _objectSpread2(target) {
  2500. for (var i = 1; i < arguments.length; i++) {
  2501. var source = arguments[i] != null ? arguments[i] : {};
  2502. if (i % 2) {
  2503. ownKeys(Object(source), true).forEach(function (key) {
  2504. _defineProperty(target, key, source[key]);
  2505. });
  2506. } else if (Object.getOwnPropertyDescriptors) {
  2507. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2508. } else {
  2509. ownKeys(Object(source)).forEach(function (key) {
  2510. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2511. });
  2512. }
  2513. }
  2514. return target;
  2515. }
  2516. function _inheritsLoose(subClass, superClass) {
  2517. subClass.prototype = Object.create(superClass.prototype);
  2518. subClass.prototype.constructor = subClass;
  2519. subClass.__proto__ = superClass;
  2520. }
  2521. /**
  2522. * --------------------------------------------------------------------------
  2523. * Bootstrap (v4.4.1): util.js
  2524. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2525. * --------------------------------------------------------------------------
  2526. */
  2527. /**
  2528. * ------------------------------------------------------------------------
  2529. * Private TransitionEnd Helpers
  2530. * ------------------------------------------------------------------------
  2531. */
  2532. var TRANSITION_END = 'transitionend';
  2533. var MAX_UID = 1000000;
  2534. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2535. function toType(obj) {
  2536. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2537. }
  2538. function getSpecialTransitionEndEvent() {
  2539. return {
  2540. bindType: TRANSITION_END,
  2541. delegateType: TRANSITION_END,
  2542. handle: function handle(event) {
  2543. if ($(event.target).is(this)) {
  2544. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2545. }
  2546. return undefined; // eslint-disable-line no-undefined
  2547. }
  2548. };
  2549. }
  2550. function transitionEndEmulator(duration) {
  2551. var _this = this;
  2552. var called = false;
  2553. $(this).one(Util.TRANSITION_END, function () {
  2554. called = true;
  2555. });
  2556. setTimeout(function () {
  2557. if (!called) {
  2558. Util.triggerTransitionEnd(_this);
  2559. }
  2560. }, duration);
  2561. return this;
  2562. }
  2563. function setTransitionEndSupport() {
  2564. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2565. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2566. }
  2567. /**
  2568. * --------------------------------------------------------------------------
  2569. * Public Util Api
  2570. * --------------------------------------------------------------------------
  2571. */
  2572. var Util = {
  2573. TRANSITION_END: 'bsTransitionEnd',
  2574. getUID: function getUID(prefix) {
  2575. do {
  2576. // eslint-disable-next-line no-bitwise
  2577. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2578. } while (document.getElementById(prefix));
  2579. return prefix;
  2580. },
  2581. getSelectorFromElement: function getSelectorFromElement(element) {
  2582. var selector = element.getAttribute('data-target');
  2583. if (!selector || selector === '#') {
  2584. var hrefAttr = element.getAttribute('href');
  2585. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2586. }
  2587. try {
  2588. return document.querySelector(selector) ? selector : null;
  2589. } catch (err) {
  2590. return null;
  2591. }
  2592. },
  2593. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2594. if (!element) {
  2595. return 0;
  2596. } // Get transition-duration of the element
  2597. var transitionDuration = $(element).css('transition-duration');
  2598. var transitionDelay = $(element).css('transition-delay');
  2599. var floatTransitionDuration = parseFloat(transitionDuration);
  2600. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2601. if (!floatTransitionDuration && !floatTransitionDelay) {
  2602. return 0;
  2603. } // If multiple durations are defined, take the first
  2604. transitionDuration = transitionDuration.split(',')[0];
  2605. transitionDelay = transitionDelay.split(',')[0];
  2606. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2607. },
  2608. reflow: function reflow(element) {
  2609. return element.offsetHeight;
  2610. },
  2611. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2612. $(element).trigger(TRANSITION_END);
  2613. },
  2614. // TODO: Remove in v5
  2615. supportsTransitionEnd: function supportsTransitionEnd() {
  2616. return Boolean(TRANSITION_END);
  2617. },
  2618. isElement: function isElement(obj) {
  2619. return (obj[0] || obj).nodeType;
  2620. },
  2621. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2622. for (var property in configTypes) {
  2623. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2624. var expectedTypes = configTypes[property];
  2625. var value = config[property];
  2626. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2627. if (!new RegExp(expectedTypes).test(valueType)) {
  2628. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2629. }
  2630. }
  2631. }
  2632. },
  2633. findShadowRoot: function findShadowRoot(element) {
  2634. if (!document.documentElement.attachShadow) {
  2635. return null;
  2636. } // Can find the shadow root otherwise it'll return the document
  2637. if (typeof element.getRootNode === 'function') {
  2638. var root = element.getRootNode();
  2639. return root instanceof ShadowRoot ? root : null;
  2640. }
  2641. if (element instanceof ShadowRoot) {
  2642. return element;
  2643. } // when we don't find a shadow root
  2644. if (!element.parentNode) {
  2645. return null;
  2646. }
  2647. return Util.findShadowRoot(element.parentNode);
  2648. },
  2649. jQueryDetection: function jQueryDetection() {
  2650. if (typeof $ === 'undefined') {
  2651. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2652. }
  2653. var version = $.fn.jquery.split(' ')[0].split('.');
  2654. var minMajor = 1;
  2655. var ltMajor = 2;
  2656. var minMinor = 9;
  2657. var minPatch = 1;
  2658. var maxMajor = 4;
  2659. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2660. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2661. }
  2662. }
  2663. };
  2664. Util.jQueryDetection();
  2665. setTransitionEndSupport();
  2666. /**
  2667. * ------------------------------------------------------------------------
  2668. * Constants
  2669. * ------------------------------------------------------------------------
  2670. */
  2671. var NAME = 'alert';
  2672. var VERSION = '4.4.1';
  2673. var DATA_KEY = 'bs.alert';
  2674. var EVENT_KEY = "." + DATA_KEY;
  2675. var DATA_API_KEY = '.data-api';
  2676. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2677. var Selector = {
  2678. DISMISS: '[data-dismiss="alert"]'
  2679. };
  2680. var Event = {
  2681. CLOSE: "close" + EVENT_KEY,
  2682. CLOSED: "closed" + EVENT_KEY,
  2683. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2684. };
  2685. var ClassName = {
  2686. ALERT: 'alert',
  2687. FADE: 'fade',
  2688. SHOW: 'show'
  2689. };
  2690. /**
  2691. * ------------------------------------------------------------------------
  2692. * Class Definition
  2693. * ------------------------------------------------------------------------
  2694. */
  2695. var Alert =
  2696. /*#__PURE__*/
  2697. function () {
  2698. function Alert(element) {
  2699. this._element = element;
  2700. } // Getters
  2701. var _proto = Alert.prototype;
  2702. // Public
  2703. _proto.close = function close(element) {
  2704. var rootElement = this._element;
  2705. if (element) {
  2706. rootElement = this._getRootElement(element);
  2707. }
  2708. var customEvent = this._triggerCloseEvent(rootElement);
  2709. if (customEvent.isDefaultPrevented()) {
  2710. return;
  2711. }
  2712. this._removeElement(rootElement);
  2713. };
  2714. _proto.dispose = function dispose() {
  2715. $.removeData(this._element, DATA_KEY);
  2716. this._element = null;
  2717. } // Private
  2718. ;
  2719. _proto._getRootElement = function _getRootElement(element) {
  2720. var selector = Util.getSelectorFromElement(element);
  2721. var parent = false;
  2722. if (selector) {
  2723. parent = document.querySelector(selector);
  2724. }
  2725. if (!parent) {
  2726. parent = $(element).closest("." + ClassName.ALERT)[0];
  2727. }
  2728. return parent;
  2729. };
  2730. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2731. var closeEvent = $.Event(Event.CLOSE);
  2732. $(element).trigger(closeEvent);
  2733. return closeEvent;
  2734. };
  2735. _proto._removeElement = function _removeElement(element) {
  2736. var _this = this;
  2737. $(element).removeClass(ClassName.SHOW);
  2738. if (!$(element).hasClass(ClassName.FADE)) {
  2739. this._destroyElement(element);
  2740. return;
  2741. }
  2742. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2743. $(element).one(Util.TRANSITION_END, function (event) {
  2744. return _this._destroyElement(element, event);
  2745. }).emulateTransitionEnd(transitionDuration);
  2746. };
  2747. _proto._destroyElement = function _destroyElement(element) {
  2748. $(element).detach().trigger(Event.CLOSED).remove();
  2749. } // Static
  2750. ;
  2751. Alert._jQueryInterface = function _jQueryInterface(config) {
  2752. return this.each(function () {
  2753. var $element = $(this);
  2754. var data = $element.data(DATA_KEY);
  2755. if (!data) {
  2756. data = new Alert(this);
  2757. $element.data(DATA_KEY, data);
  2758. }
  2759. if (config === 'close') {
  2760. data[config](this);
  2761. }
  2762. });
  2763. };
  2764. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2765. return function (event) {
  2766. if (event) {
  2767. event.preventDefault();
  2768. }
  2769. alertInstance.close(this);
  2770. };
  2771. };
  2772. _createClass(Alert, null, [{
  2773. key: "VERSION",
  2774. get: function get() {
  2775. return VERSION;
  2776. }
  2777. }]);
  2778. return Alert;
  2779. }();
  2780. /**
  2781. * ------------------------------------------------------------------------
  2782. * Data Api implementation
  2783. * ------------------------------------------------------------------------
  2784. */
  2785. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2786. /**
  2787. * ------------------------------------------------------------------------
  2788. * jQuery
  2789. * ------------------------------------------------------------------------
  2790. */
  2791. $.fn[NAME] = Alert._jQueryInterface;
  2792. $.fn[NAME].Constructor = Alert;
  2793. $.fn[NAME].noConflict = function () {
  2794. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2795. return Alert._jQueryInterface;
  2796. };
  2797. /**
  2798. * ------------------------------------------------------------------------
  2799. * Constants
  2800. * ------------------------------------------------------------------------
  2801. */
  2802. var NAME$1 = 'button';
  2803. var VERSION$1 = '4.4.1';
  2804. var DATA_KEY$1 = 'bs.button';
  2805. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2806. var DATA_API_KEY$1 = '.data-api';
  2807. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2808. var ClassName$1 = {
  2809. ACTIVE: 'active',
  2810. BUTTON: 'btn',
  2811. FOCUS: 'focus'
  2812. };
  2813. var Selector$1 = {
  2814. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2815. DATA_TOGGLES: '[data-toggle="buttons"]',
  2816. DATA_TOGGLE: '[data-toggle="button"]',
  2817. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2818. INPUT: 'input:not([type="hidden"])',
  2819. ACTIVE: '.active',
  2820. BUTTON: '.btn'
  2821. };
  2822. var Event$1 = {
  2823. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2824. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2825. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2826. };
  2827. /**
  2828. * ------------------------------------------------------------------------
  2829. * Class Definition
  2830. * ------------------------------------------------------------------------
  2831. */
  2832. var Button =
  2833. /*#__PURE__*/
  2834. function () {
  2835. function Button(element) {
  2836. this._element = element;
  2837. } // Getters
  2838. var _proto = Button.prototype;
  2839. // Public
  2840. _proto.toggle = function toggle() {
  2841. var triggerChangeEvent = true;
  2842. var addAriaPressed = true;
  2843. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2844. if (rootElement) {
  2845. var input = this._element.querySelector(Selector$1.INPUT);
  2846. if (input) {
  2847. if (input.type === 'radio') {
  2848. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2849. triggerChangeEvent = false;
  2850. } else {
  2851. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2852. if (activeElement) {
  2853. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2854. }
  2855. }
  2856. } else if (input.type === 'checkbox') {
  2857. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2858. triggerChangeEvent = false;
  2859. }
  2860. } else {
  2861. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2862. triggerChangeEvent = false;
  2863. }
  2864. if (triggerChangeEvent) {
  2865. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2866. $(input).trigger('change');
  2867. }
  2868. input.focus();
  2869. addAriaPressed = false;
  2870. }
  2871. }
  2872. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2873. if (addAriaPressed) {
  2874. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2875. }
  2876. if (triggerChangeEvent) {
  2877. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2878. }
  2879. }
  2880. };
  2881. _proto.dispose = function dispose() {
  2882. $.removeData(this._element, DATA_KEY$1);
  2883. this._element = null;
  2884. } // Static
  2885. ;
  2886. Button._jQueryInterface = function _jQueryInterface(config) {
  2887. return this.each(function () {
  2888. var data = $(this).data(DATA_KEY$1);
  2889. if (!data) {
  2890. data = new Button(this);
  2891. $(this).data(DATA_KEY$1, data);
  2892. }
  2893. if (config === 'toggle') {
  2894. data[config]();
  2895. }
  2896. });
  2897. };
  2898. _createClass(Button, null, [{
  2899. key: "VERSION",
  2900. get: function get() {
  2901. return VERSION$1;
  2902. }
  2903. }]);
  2904. return Button;
  2905. }();
  2906. /**
  2907. * ------------------------------------------------------------------------
  2908. * Data Api implementation
  2909. * ------------------------------------------------------------------------
  2910. */
  2911. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2912. var button = event.target;
  2913. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2914. button = $(button).closest(Selector$1.BUTTON)[0];
  2915. }
  2916. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2917. event.preventDefault(); // work around Firefox bug #1540995
  2918. } else {
  2919. var inputBtn = button.querySelector(Selector$1.INPUT);
  2920. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2921. event.preventDefault(); // work around Firefox bug #1540995
  2922. return;
  2923. }
  2924. Button._jQueryInterface.call($(button), 'toggle');
  2925. }
  2926. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2927. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2928. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2929. });
  2930. $(window).on(Event$1.LOAD_DATA_API, function () {
  2931. // ensure correct active class is set to match the controls' actual values/states
  2932. // find all checkboxes/readio buttons inside data-toggle groups
  2933. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2934. for (var i = 0, len = buttons.length; i < len; i++) {
  2935. var button = buttons[i];
  2936. var input = button.querySelector(Selector$1.INPUT);
  2937. if (input.checked || input.hasAttribute('checked')) {
  2938. button.classList.add(ClassName$1.ACTIVE);
  2939. } else {
  2940. button.classList.remove(ClassName$1.ACTIVE);
  2941. }
  2942. } // find all button toggles
  2943. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2944. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2945. var _button = buttons[_i];
  2946. if (_button.getAttribute('aria-pressed') === 'true') {
  2947. _button.classList.add(ClassName$1.ACTIVE);
  2948. } else {
  2949. _button.classList.remove(ClassName$1.ACTIVE);
  2950. }
  2951. }
  2952. });
  2953. /**
  2954. * ------------------------------------------------------------------------
  2955. * jQuery
  2956. * ------------------------------------------------------------------------
  2957. */
  2958. $.fn[NAME$1] = Button._jQueryInterface;
  2959. $.fn[NAME$1].Constructor = Button;
  2960. $.fn[NAME$1].noConflict = function () {
  2961. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2962. return Button._jQueryInterface;
  2963. };
  2964. /**
  2965. * ------------------------------------------------------------------------
  2966. * Constants
  2967. * ------------------------------------------------------------------------
  2968. */
  2969. var NAME$2 = 'carousel';
  2970. var VERSION$2 = '4.4.1';
  2971. var DATA_KEY$2 = 'bs.carousel';
  2972. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2973. var DATA_API_KEY$2 = '.data-api';
  2974. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2975. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2976. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2977. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2978. var SWIPE_THRESHOLD = 40;
  2979. var Default = {
  2980. interval: 5000,
  2981. keyboard: true,
  2982. slide: false,
  2983. pause: 'hover',
  2984. wrap: true,
  2985. touch: true
  2986. };
  2987. var DefaultType = {
  2988. interval: '(number|boolean)',
  2989. keyboard: 'boolean',
  2990. slide: '(boolean|string)',
  2991. pause: '(string|boolean)',
  2992. wrap: 'boolean',
  2993. touch: 'boolean'
  2994. };
  2995. var Direction = {
  2996. NEXT: 'next',
  2997. PREV: 'prev',
  2998. LEFT: 'left',
  2999. RIGHT: 'right'
  3000. };
  3001. var Event$2 = {
  3002. SLIDE: "slide" + EVENT_KEY$2,
  3003. SLID: "slid" + EVENT_KEY$2,
  3004. KEYDOWN: "keydown" + EVENT_KEY$2,
  3005. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3006. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3007. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3008. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3009. TOUCHEND: "touchend" + EVENT_KEY$2,
  3010. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3011. POINTERUP: "pointerup" + EVENT_KEY$2,
  3012. DRAG_START: "dragstart" + EVENT_KEY$2,
  3013. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3014. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3015. };
  3016. var ClassName$2 = {
  3017. CAROUSEL: 'carousel',
  3018. ACTIVE: 'active',
  3019. SLIDE: 'slide',
  3020. RIGHT: 'carousel-item-right',
  3021. LEFT: 'carousel-item-left',
  3022. NEXT: 'carousel-item-next',
  3023. PREV: 'carousel-item-prev',
  3024. ITEM: 'carousel-item',
  3025. POINTER_EVENT: 'pointer-event'
  3026. };
  3027. var Selector$2 = {
  3028. ACTIVE: '.active',
  3029. ACTIVE_ITEM: '.active.carousel-item',
  3030. ITEM: '.carousel-item',
  3031. ITEM_IMG: '.carousel-item img',
  3032. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3033. INDICATORS: '.carousel-indicators',
  3034. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3035. DATA_RIDE: '[data-ride="carousel"]'
  3036. };
  3037. var PointerType = {
  3038. TOUCH: 'touch',
  3039. PEN: 'pen'
  3040. };
  3041. /**
  3042. * ------------------------------------------------------------------------
  3043. * Class Definition
  3044. * ------------------------------------------------------------------------
  3045. */
  3046. var Carousel =
  3047. /*#__PURE__*/
  3048. function () {
  3049. function Carousel(element, config) {
  3050. this._items = null;
  3051. this._interval = null;
  3052. this._activeElement = null;
  3053. this._isPaused = false;
  3054. this._isSliding = false;
  3055. this.touchTimeout = null;
  3056. this.touchStartX = 0;
  3057. this.touchDeltaX = 0;
  3058. this._config = this._getConfig(config);
  3059. this._element = element;
  3060. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3061. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3062. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3063. this._addEventListeners();
  3064. } // Getters
  3065. var _proto = Carousel.prototype;
  3066. // Public
  3067. _proto.next = function next() {
  3068. if (!this._isSliding) {
  3069. this._slide(Direction.NEXT);
  3070. }
  3071. };
  3072. _proto.nextWhenVisible = function nextWhenVisible() {
  3073. // Don't call next when the page isn't visible
  3074. // or the carousel or its parent isn't visible
  3075. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3076. this.next();
  3077. }
  3078. };
  3079. _proto.prev = function prev() {
  3080. if (!this._isSliding) {
  3081. this._slide(Direction.PREV);
  3082. }
  3083. };
  3084. _proto.pause = function pause(event) {
  3085. if (!event) {
  3086. this._isPaused = true;
  3087. }
  3088. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3089. Util.triggerTransitionEnd(this._element);
  3090. this.cycle(true);
  3091. }
  3092. clearInterval(this._interval);
  3093. this._interval = null;
  3094. };
  3095. _proto.cycle = function cycle(event) {
  3096. if (!event) {
  3097. this._isPaused = false;
  3098. }
  3099. if (this._interval) {
  3100. clearInterval(this._interval);
  3101. this._interval = null;
  3102. }
  3103. if (this._config.interval && !this._isPaused) {
  3104. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3105. }
  3106. };
  3107. _proto.to = function to(index) {
  3108. var _this = this;
  3109. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3110. var activeIndex = this._getItemIndex(this._activeElement);
  3111. if (index > this._items.length - 1 || index < 0) {
  3112. return;
  3113. }
  3114. if (this._isSliding) {
  3115. $(this._element).one(Event$2.SLID, function () {
  3116. return _this.to(index);
  3117. });
  3118. return;
  3119. }
  3120. if (activeIndex === index) {
  3121. this.pause();
  3122. this.cycle();
  3123. return;
  3124. }
  3125. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3126. this._slide(direction, this._items[index]);
  3127. };
  3128. _proto.dispose = function dispose() {
  3129. $(this._element).off(EVENT_KEY$2);
  3130. $.removeData(this._element, DATA_KEY$2);
  3131. this._items = null;
  3132. this._config = null;
  3133. this._element = null;
  3134. this._interval = null;
  3135. this._isPaused = null;
  3136. this._isSliding = null;
  3137. this._activeElement = null;
  3138. this._indicatorsElement = null;
  3139. } // Private
  3140. ;
  3141. _proto._getConfig = function _getConfig(config) {
  3142. config = _objectSpread2({}, Default, {}, config);
  3143. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3144. return config;
  3145. };
  3146. _proto._handleSwipe = function _handleSwipe() {
  3147. var absDeltax = Math.abs(this.touchDeltaX);
  3148. if (absDeltax <= SWIPE_THRESHOLD) {
  3149. return;
  3150. }
  3151. var direction = absDeltax / this.touchDeltaX;
  3152. this.touchDeltaX = 0; // swipe left
  3153. if (direction > 0) {
  3154. this.prev();
  3155. } // swipe right
  3156. if (direction < 0) {
  3157. this.next();
  3158. }
  3159. };
  3160. _proto._addEventListeners = function _addEventListeners() {
  3161. var _this2 = this;
  3162. if (this._config.keyboard) {
  3163. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3164. return _this2._keydown(event);
  3165. });
  3166. }
  3167. if (this._config.pause === 'hover') {
  3168. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3169. return _this2.pause(event);
  3170. }).on(Event$2.MOUSELEAVE, function (event) {
  3171. return _this2.cycle(event);
  3172. });
  3173. }
  3174. if (this._config.touch) {
  3175. this._addTouchEventListeners();
  3176. }
  3177. };
  3178. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3179. var _this3 = this;
  3180. if (!this._touchSupported) {
  3181. return;
  3182. }
  3183. var start = function start(event) {
  3184. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3185. _this3.touchStartX = event.originalEvent.clientX;
  3186. } else if (!_this3._pointerEvent) {
  3187. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3188. }
  3189. };
  3190. var move = function move(event) {
  3191. // ensure swiping with one touch and not pinching
  3192. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3193. _this3.touchDeltaX = 0;
  3194. } else {
  3195. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3196. }
  3197. };
  3198. var end = function end(event) {
  3199. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3200. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3201. }
  3202. _this3._handleSwipe();
  3203. if (_this3._config.pause === 'hover') {
  3204. // If it's a touch-enabled device, mouseenter/leave are fired as
  3205. // part of the mouse compatibility events on first tap - the carousel
  3206. // would stop cycling until user tapped out of it;
  3207. // here, we listen for touchend, explicitly pause the carousel
  3208. // (as if it's the second time we tap on it, mouseenter compat event
  3209. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3210. // events to fire) we explicitly restart cycling
  3211. _this3.pause();
  3212. if (_this3.touchTimeout) {
  3213. clearTimeout(_this3.touchTimeout);
  3214. }
  3215. _this3.touchTimeout = setTimeout(function (event) {
  3216. return _this3.cycle(event);
  3217. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3218. }
  3219. };
  3220. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3221. return e.preventDefault();
  3222. });
  3223. if (this._pointerEvent) {
  3224. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3225. return start(event);
  3226. });
  3227. $(this._element).on(Event$2.POINTERUP, function (event) {
  3228. return end(event);
  3229. });
  3230. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3231. } else {
  3232. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3233. return start(event);
  3234. });
  3235. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3236. return move(event);
  3237. });
  3238. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3239. return end(event);
  3240. });
  3241. }
  3242. };
  3243. _proto._keydown = function _keydown(event) {
  3244. if (/input|textarea/i.test(event.target.tagName)) {
  3245. return;
  3246. }
  3247. switch (event.which) {
  3248. case ARROW_LEFT_KEYCODE:
  3249. event.preventDefault();
  3250. this.prev();
  3251. break;
  3252. case ARROW_RIGHT_KEYCODE:
  3253. event.preventDefault();
  3254. this.next();
  3255. break;
  3256. }
  3257. };
  3258. _proto._getItemIndex = function _getItemIndex(element) {
  3259. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3260. return this._items.indexOf(element);
  3261. };
  3262. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3263. var isNextDirection = direction === Direction.NEXT;
  3264. var isPrevDirection = direction === Direction.PREV;
  3265. var activeIndex = this._getItemIndex(activeElement);
  3266. var lastItemIndex = this._items.length - 1;
  3267. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3268. if (isGoingToWrap && !this._config.wrap) {
  3269. return activeElement;
  3270. }
  3271. var delta = direction === Direction.PREV ? -1 : 1;
  3272. var itemIndex = (activeIndex + delta) % this._items.length;
  3273. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3274. };
  3275. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3276. var targetIndex = this._getItemIndex(relatedTarget);
  3277. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3278. var slideEvent = $.Event(Event$2.SLIDE, {
  3279. relatedTarget: relatedTarget,
  3280. direction: eventDirectionName,
  3281. from: fromIndex,
  3282. to: targetIndex
  3283. });
  3284. $(this._element).trigger(slideEvent);
  3285. return slideEvent;
  3286. };
  3287. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3288. if (this._indicatorsElement) {
  3289. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3290. $(indicators).removeClass(ClassName$2.ACTIVE);
  3291. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3292. if (nextIndicator) {
  3293. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3294. }
  3295. }
  3296. };
  3297. _proto._slide = function _slide(direction, element) {
  3298. var _this4 = this;
  3299. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3300. var activeElementIndex = this._getItemIndex(activeElement);
  3301. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3302. var nextElementIndex = this._getItemIndex(nextElement);
  3303. var isCycling = Boolean(this._interval);
  3304. var directionalClassName;
  3305. var orderClassName;
  3306. var eventDirectionName;
  3307. if (direction === Direction.NEXT) {
  3308. directionalClassName = ClassName$2.LEFT;
  3309. orderClassName = ClassName$2.NEXT;
  3310. eventDirectionName = Direction.LEFT;
  3311. } else {
  3312. directionalClassName = ClassName$2.RIGHT;
  3313. orderClassName = ClassName$2.PREV;
  3314. eventDirectionName = Direction.RIGHT;
  3315. }
  3316. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3317. this._isSliding = false;
  3318. return;
  3319. }
  3320. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3321. if (slideEvent.isDefaultPrevented()) {
  3322. return;
  3323. }
  3324. if (!activeElement || !nextElement) {
  3325. // Some weirdness is happening, so we bail
  3326. return;
  3327. }
  3328. this._isSliding = true;
  3329. if (isCycling) {
  3330. this.pause();
  3331. }
  3332. this._setActiveIndicatorElement(nextElement);
  3333. var slidEvent = $.Event(Event$2.SLID, {
  3334. relatedTarget: nextElement,
  3335. direction: eventDirectionName,
  3336. from: activeElementIndex,
  3337. to: nextElementIndex
  3338. });
  3339. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3340. $(nextElement).addClass(orderClassName);
  3341. Util.reflow(nextElement);
  3342. $(activeElement).addClass(directionalClassName);
  3343. $(nextElement).addClass(directionalClassName);
  3344. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3345. if (nextElementInterval) {
  3346. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3347. this._config.interval = nextElementInterval;
  3348. } else {
  3349. this._config.interval = this._config.defaultInterval || this._config.interval;
  3350. }
  3351. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3352. $(activeElement).one(Util.TRANSITION_END, function () {
  3353. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3354. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3355. _this4._isSliding = false;
  3356. setTimeout(function () {
  3357. return $(_this4._element).trigger(slidEvent);
  3358. }, 0);
  3359. }).emulateTransitionEnd(transitionDuration);
  3360. } else {
  3361. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3362. $(nextElement).addClass(ClassName$2.ACTIVE);
  3363. this._isSliding = false;
  3364. $(this._element).trigger(slidEvent);
  3365. }
  3366. if (isCycling) {
  3367. this.cycle();
  3368. }
  3369. } // Static
  3370. ;
  3371. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3372. return this.each(function () {
  3373. var data = $(this).data(DATA_KEY$2);
  3374. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3375. if (typeof config === 'object') {
  3376. _config = _objectSpread2({}, _config, {}, config);
  3377. }
  3378. var action = typeof config === 'string' ? config : _config.slide;
  3379. if (!data) {
  3380. data = new Carousel(this, _config);
  3381. $(this).data(DATA_KEY$2, data);
  3382. }
  3383. if (typeof config === 'number') {
  3384. data.to(config);
  3385. } else if (typeof action === 'string') {
  3386. if (typeof data[action] === 'undefined') {
  3387. throw new TypeError("No method named \"" + action + "\"");
  3388. }
  3389. data[action]();
  3390. } else if (_config.interval && _config.ride) {
  3391. data.pause();
  3392. data.cycle();
  3393. }
  3394. });
  3395. };
  3396. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3397. var selector = Util.getSelectorFromElement(this);
  3398. if (!selector) {
  3399. return;
  3400. }
  3401. var target = $(selector)[0];
  3402. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3403. return;
  3404. }
  3405. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3406. var slideIndex = this.getAttribute('data-slide-to');
  3407. if (slideIndex) {
  3408. config.interval = false;
  3409. }
  3410. Carousel._jQueryInterface.call($(target), config);
  3411. if (slideIndex) {
  3412. $(target).data(DATA_KEY$2).to(slideIndex);
  3413. }
  3414. event.preventDefault();
  3415. };
  3416. _createClass(Carousel, null, [{
  3417. key: "VERSION",
  3418. get: function get() {
  3419. return VERSION$2;
  3420. }
  3421. }, {
  3422. key: "Default",
  3423. get: function get() {
  3424. return Default;
  3425. }
  3426. }]);
  3427. return Carousel;
  3428. }();
  3429. /**
  3430. * ------------------------------------------------------------------------
  3431. * Data Api implementation
  3432. * ------------------------------------------------------------------------
  3433. */
  3434. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3435. $(window).on(Event$2.LOAD_DATA_API, function () {
  3436. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3437. for (var i = 0, len = carousels.length; i < len; i++) {
  3438. var $carousel = $(carousels[i]);
  3439. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3440. }
  3441. });
  3442. /**
  3443. * ------------------------------------------------------------------------
  3444. * jQuery
  3445. * ------------------------------------------------------------------------
  3446. */
  3447. $.fn[NAME$2] = Carousel._jQueryInterface;
  3448. $.fn[NAME$2].Constructor = Carousel;
  3449. $.fn[NAME$2].noConflict = function () {
  3450. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3451. return Carousel._jQueryInterface;
  3452. };
  3453. /**
  3454. * ------------------------------------------------------------------------
  3455. * Constants
  3456. * ------------------------------------------------------------------------
  3457. */
  3458. var NAME$3 = 'collapse';
  3459. var VERSION$3 = '4.4.1';
  3460. var DATA_KEY$3 = 'bs.collapse';
  3461. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3462. var DATA_API_KEY$3 = '.data-api';
  3463. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3464. var Default$1 = {
  3465. toggle: true,
  3466. parent: ''
  3467. };
  3468. var DefaultType$1 = {
  3469. toggle: 'boolean',
  3470. parent: '(string|element)'
  3471. };
  3472. var Event$3 = {
  3473. SHOW: "show" + EVENT_KEY$3,
  3474. SHOWN: "shown" + EVENT_KEY$3,
  3475. HIDE: "hide" + EVENT_KEY$3,
  3476. HIDDEN: "hidden" + EVENT_KEY$3,
  3477. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3478. };
  3479. var ClassName$3 = {
  3480. SHOW: 'show',
  3481. COLLAPSE: 'collapse',
  3482. COLLAPSING: 'collapsing',
  3483. COLLAPSED: 'collapsed'
  3484. };
  3485. var Dimension = {
  3486. WIDTH: 'width',
  3487. HEIGHT: 'height'
  3488. };
  3489. var Selector$3 = {
  3490. ACTIVES: '.show, .collapsing',
  3491. DATA_TOGGLE: '[data-toggle="collapse"]'
  3492. };
  3493. /**
  3494. * ------------------------------------------------------------------------
  3495. * Class Definition
  3496. * ------------------------------------------------------------------------
  3497. */
  3498. var Collapse =
  3499. /*#__PURE__*/
  3500. function () {
  3501. function Collapse(element, config) {
  3502. this._isTransitioning = false;
  3503. this._element = element;
  3504. this._config = this._getConfig(config);
  3505. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3506. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3507. for (var i = 0, len = toggleList.length; i < len; i++) {
  3508. var elem = toggleList[i];
  3509. var selector = Util.getSelectorFromElement(elem);
  3510. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3511. return foundElem === element;
  3512. });
  3513. if (selector !== null && filterElement.length > 0) {
  3514. this._selector = selector;
  3515. this._triggerArray.push(elem);
  3516. }
  3517. }
  3518. this._parent = this._config.parent ? this._getParent() : null;
  3519. if (!this._config.parent) {
  3520. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3521. }
  3522. if (this._config.toggle) {
  3523. this.toggle();
  3524. }
  3525. } // Getters
  3526. var _proto = Collapse.prototype;
  3527. // Public
  3528. _proto.toggle = function toggle() {
  3529. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3530. this.hide();
  3531. } else {
  3532. this.show();
  3533. }
  3534. };
  3535. _proto.show = function show() {
  3536. var _this = this;
  3537. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3538. return;
  3539. }
  3540. var actives;
  3541. var activesData;
  3542. if (this._parent) {
  3543. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3544. if (typeof _this._config.parent === 'string') {
  3545. return elem.getAttribute('data-parent') === _this._config.parent;
  3546. }
  3547. return elem.classList.contains(ClassName$3.COLLAPSE);
  3548. });
  3549. if (actives.length === 0) {
  3550. actives = null;
  3551. }
  3552. }
  3553. if (actives) {
  3554. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3555. if (activesData && activesData._isTransitioning) {
  3556. return;
  3557. }
  3558. }
  3559. var startEvent = $.Event(Event$3.SHOW);
  3560. $(this._element).trigger(startEvent);
  3561. if (startEvent.isDefaultPrevented()) {
  3562. return;
  3563. }
  3564. if (actives) {
  3565. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3566. if (!activesData) {
  3567. $(actives).data(DATA_KEY$3, null);
  3568. }
  3569. }
  3570. var dimension = this._getDimension();
  3571. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3572. this._element.style[dimension] = 0;
  3573. if (this._triggerArray.length) {
  3574. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3575. }
  3576. this.setTransitioning(true);
  3577. var complete = function complete() {
  3578. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3579. _this._element.style[dimension] = '';
  3580. _this.setTransitioning(false);
  3581. $(_this._element).trigger(Event$3.SHOWN);
  3582. };
  3583. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3584. var scrollSize = "scroll" + capitalizedDimension;
  3585. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3586. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3587. this._element.style[dimension] = this._element[scrollSize] + "px";
  3588. };
  3589. _proto.hide = function hide() {
  3590. var _this2 = this;
  3591. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3592. return;
  3593. }
  3594. var startEvent = $.Event(Event$3.HIDE);
  3595. $(this._element).trigger(startEvent);
  3596. if (startEvent.isDefaultPrevented()) {
  3597. return;
  3598. }
  3599. var dimension = this._getDimension();
  3600. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3601. Util.reflow(this._element);
  3602. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3603. var triggerArrayLength = this._triggerArray.length;
  3604. if (triggerArrayLength > 0) {
  3605. for (var i = 0; i < triggerArrayLength; i++) {
  3606. var trigger = this._triggerArray[i];
  3607. var selector = Util.getSelectorFromElement(trigger);
  3608. if (selector !== null) {
  3609. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3610. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3611. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3612. }
  3613. }
  3614. }
  3615. }
  3616. this.setTransitioning(true);
  3617. var complete = function complete() {
  3618. _this2.setTransitioning(false);
  3619. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3620. };
  3621. this._element.style[dimension] = '';
  3622. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3623. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3624. };
  3625. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3626. this._isTransitioning = isTransitioning;
  3627. };
  3628. _proto.dispose = function dispose() {
  3629. $.removeData(this._element, DATA_KEY$3);
  3630. this._config = null;
  3631. this._parent = null;
  3632. this._element = null;
  3633. this._triggerArray = null;
  3634. this._isTransitioning = null;
  3635. } // Private
  3636. ;
  3637. _proto._getConfig = function _getConfig(config) {
  3638. config = _objectSpread2({}, Default$1, {}, config);
  3639. config.toggle = Boolean(config.toggle); // Coerce string values
  3640. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3641. return config;
  3642. };
  3643. _proto._getDimension = function _getDimension() {
  3644. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3645. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3646. };
  3647. _proto._getParent = function _getParent() {
  3648. var _this3 = this;
  3649. var parent;
  3650. if (Util.isElement(this._config.parent)) {
  3651. parent = this._config.parent; // It's a jQuery object
  3652. if (typeof this._config.parent.jquery !== 'undefined') {
  3653. parent = this._config.parent[0];
  3654. }
  3655. } else {
  3656. parent = document.querySelector(this._config.parent);
  3657. }
  3658. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3659. var children = [].slice.call(parent.querySelectorAll(selector));
  3660. $(children).each(function (i, element) {
  3661. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3662. });
  3663. return parent;
  3664. };
  3665. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3666. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3667. if (triggerArray.length) {
  3668. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3669. }
  3670. } // Static
  3671. ;
  3672. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3673. var selector = Util.getSelectorFromElement(element);
  3674. return selector ? document.querySelector(selector) : null;
  3675. };
  3676. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3677. return this.each(function () {
  3678. var $this = $(this);
  3679. var data = $this.data(DATA_KEY$3);
  3680. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3681. if (!data && _config.toggle && /show|hide/.test(config)) {
  3682. _config.toggle = false;
  3683. }
  3684. if (!data) {
  3685. data = new Collapse(this, _config);
  3686. $this.data(DATA_KEY$3, data);
  3687. }
  3688. if (typeof config === 'string') {
  3689. if (typeof data[config] === 'undefined') {
  3690. throw new TypeError("No method named \"" + config + "\"");
  3691. }
  3692. data[config]();
  3693. }
  3694. });
  3695. };
  3696. _createClass(Collapse, null, [{
  3697. key: "VERSION",
  3698. get: function get() {
  3699. return VERSION$3;
  3700. }
  3701. }, {
  3702. key: "Default",
  3703. get: function get() {
  3704. return Default$1;
  3705. }
  3706. }]);
  3707. return Collapse;
  3708. }();
  3709. /**
  3710. * ------------------------------------------------------------------------
  3711. * Data Api implementation
  3712. * ------------------------------------------------------------------------
  3713. */
  3714. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3715. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3716. if (event.currentTarget.tagName === 'A') {
  3717. event.preventDefault();
  3718. }
  3719. var $trigger = $(this);
  3720. var selector = Util.getSelectorFromElement(this);
  3721. var selectors = [].slice.call(document.querySelectorAll(selector));
  3722. $(selectors).each(function () {
  3723. var $target = $(this);
  3724. var data = $target.data(DATA_KEY$3);
  3725. var config = data ? 'toggle' : $trigger.data();
  3726. Collapse._jQueryInterface.call($target, config);
  3727. });
  3728. });
  3729. /**
  3730. * ------------------------------------------------------------------------
  3731. * jQuery
  3732. * ------------------------------------------------------------------------
  3733. */
  3734. $.fn[NAME$3] = Collapse._jQueryInterface;
  3735. $.fn[NAME$3].Constructor = Collapse;
  3736. $.fn[NAME$3].noConflict = function () {
  3737. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3738. return Collapse._jQueryInterface;
  3739. };
  3740. /**
  3741. * ------------------------------------------------------------------------
  3742. * Constants
  3743. * ------------------------------------------------------------------------
  3744. */
  3745. var NAME$4 = 'dropdown';
  3746. var VERSION$4 = '4.4.1';
  3747. var DATA_KEY$4 = 'bs.dropdown';
  3748. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3749. var DATA_API_KEY$4 = '.data-api';
  3750. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3751. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3752. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3753. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3754. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3755. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3756. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3757. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3758. var Event$4 = {
  3759. HIDE: "hide" + EVENT_KEY$4,
  3760. HIDDEN: "hidden" + EVENT_KEY$4,
  3761. SHOW: "show" + EVENT_KEY$4,
  3762. SHOWN: "shown" + EVENT_KEY$4,
  3763. CLICK: "click" + EVENT_KEY$4,
  3764. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3765. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3766. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3767. };
  3768. var ClassName$4 = {
  3769. DISABLED: 'disabled',
  3770. SHOW: 'show',
  3771. DROPUP: 'dropup',
  3772. DROPRIGHT: 'dropright',
  3773. DROPLEFT: 'dropleft',
  3774. MENURIGHT: 'dropdown-menu-right',
  3775. MENULEFT: 'dropdown-menu-left',
  3776. POSITION_STATIC: 'position-static'
  3777. };
  3778. var Selector$4 = {
  3779. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3780. FORM_CHILD: '.dropdown form',
  3781. MENU: '.dropdown-menu',
  3782. NAVBAR_NAV: '.navbar-nav',
  3783. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3784. };
  3785. var AttachmentMap = {
  3786. TOP: 'top-start',
  3787. TOPEND: 'top-end',
  3788. BOTTOM: 'bottom-start',
  3789. BOTTOMEND: 'bottom-end',
  3790. RIGHT: 'right-start',
  3791. RIGHTEND: 'right-end',
  3792. LEFT: 'left-start',
  3793. LEFTEND: 'left-end'
  3794. };
  3795. var Default$2 = {
  3796. offset: 0,
  3797. flip: true,
  3798. boundary: 'scrollParent',
  3799. reference: 'toggle',
  3800. display: 'dynamic',
  3801. popperConfig: null
  3802. };
  3803. var DefaultType$2 = {
  3804. offset: '(number|string|function)',
  3805. flip: 'boolean',
  3806. boundary: '(string|element)',
  3807. reference: '(string|element)',
  3808. display: 'string',
  3809. popperConfig: '(null|object)'
  3810. };
  3811. /**
  3812. * ------------------------------------------------------------------------
  3813. * Class Definition
  3814. * ------------------------------------------------------------------------
  3815. */
  3816. var Dropdown =
  3817. /*#__PURE__*/
  3818. function () {
  3819. function Dropdown(element, config) {
  3820. this._element = element;
  3821. this._popper = null;
  3822. this._config = this._getConfig(config);
  3823. this._menu = this._getMenuElement();
  3824. this._inNavbar = this._detectNavbar();
  3825. this._addEventListeners();
  3826. } // Getters
  3827. var _proto = Dropdown.prototype;
  3828. // Public
  3829. _proto.toggle = function toggle() {
  3830. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3831. return;
  3832. }
  3833. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3834. Dropdown._clearMenus();
  3835. if (isActive) {
  3836. return;
  3837. }
  3838. this.show(true);
  3839. };
  3840. _proto.show = function show(usePopper) {
  3841. if (usePopper === void 0) {
  3842. usePopper = false;
  3843. }
  3844. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3845. return;
  3846. }
  3847. var relatedTarget = {
  3848. relatedTarget: this._element
  3849. };
  3850. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3851. var parent = Dropdown._getParentFromElement(this._element);
  3852. $(parent).trigger(showEvent);
  3853. if (showEvent.isDefaultPrevented()) {
  3854. return;
  3855. } // Disable totally Popper.js for Dropdown in Navbar
  3856. if (!this._inNavbar && usePopper) {
  3857. /**
  3858. * Check for Popper dependency
  3859. * Popper - https://popper.js.org
  3860. */
  3861. if (typeof Popper === 'undefined') {
  3862. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3863. }
  3864. var referenceElement = this._element;
  3865. if (this._config.reference === 'parent') {
  3866. referenceElement = parent;
  3867. } else if (Util.isElement(this._config.reference)) {
  3868. referenceElement = this._config.reference; // Check if it's jQuery element
  3869. if (typeof this._config.reference.jquery !== 'undefined') {
  3870. referenceElement = this._config.reference[0];
  3871. }
  3872. } // If boundary is not `scrollParent`, then set position to `static`
  3873. // to allow the menu to "escape" the scroll parent's boundaries
  3874. // https://github.com/twbs/bootstrap/issues/24251
  3875. if (this._config.boundary !== 'scrollParent') {
  3876. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3877. }
  3878. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3879. } // If this is a touch-enabled device we add extra
  3880. // empty mouseover listeners to the body's immediate children;
  3881. // only needed because of broken event delegation on iOS
  3882. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3883. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3884. $(document.body).children().on('mouseover', null, $.noop);
  3885. }
  3886. this._element.focus();
  3887. this._element.setAttribute('aria-expanded', true);
  3888. $(this._menu).toggleClass(ClassName$4.SHOW);
  3889. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3890. };
  3891. _proto.hide = function hide() {
  3892. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3893. return;
  3894. }
  3895. var relatedTarget = {
  3896. relatedTarget: this._element
  3897. };
  3898. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3899. var parent = Dropdown._getParentFromElement(this._element);
  3900. $(parent).trigger(hideEvent);
  3901. if (hideEvent.isDefaultPrevented()) {
  3902. return;
  3903. }
  3904. if (this._popper) {
  3905. this._popper.destroy();
  3906. }
  3907. $(this._menu).toggleClass(ClassName$4.SHOW);
  3908. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3909. };
  3910. _proto.dispose = function dispose() {
  3911. $.removeData(this._element, DATA_KEY$4);
  3912. $(this._element).off(EVENT_KEY$4);
  3913. this._element = null;
  3914. this._menu = null;
  3915. if (this._popper !== null) {
  3916. this._popper.destroy();
  3917. this._popper = null;
  3918. }
  3919. };
  3920. _proto.update = function update() {
  3921. this._inNavbar = this._detectNavbar();
  3922. if (this._popper !== null) {
  3923. this._popper.scheduleUpdate();
  3924. }
  3925. } // Private
  3926. ;
  3927. _proto._addEventListeners = function _addEventListeners() {
  3928. var _this = this;
  3929. $(this._element).on(Event$4.CLICK, function (event) {
  3930. event.preventDefault();
  3931. event.stopPropagation();
  3932. _this.toggle();
  3933. });
  3934. };
  3935. _proto._getConfig = function _getConfig(config) {
  3936. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3937. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3938. return config;
  3939. };
  3940. _proto._getMenuElement = function _getMenuElement() {
  3941. if (!this._menu) {
  3942. var parent = Dropdown._getParentFromElement(this._element);
  3943. if (parent) {
  3944. this._menu = parent.querySelector(Selector$4.MENU);
  3945. }
  3946. }
  3947. return this._menu;
  3948. };
  3949. _proto._getPlacement = function _getPlacement() {
  3950. var $parentDropdown = $(this._element.parentNode);
  3951. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3952. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3953. placement = AttachmentMap.TOP;
  3954. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3955. placement = AttachmentMap.TOPEND;
  3956. }
  3957. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3958. placement = AttachmentMap.RIGHT;
  3959. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3960. placement = AttachmentMap.LEFT;
  3961. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3962. placement = AttachmentMap.BOTTOMEND;
  3963. }
  3964. return placement;
  3965. };
  3966. _proto._detectNavbar = function _detectNavbar() {
  3967. return $(this._element).closest('.navbar').length > 0;
  3968. };
  3969. _proto._getOffset = function _getOffset() {
  3970. var _this2 = this;
  3971. var offset = {};
  3972. if (typeof this._config.offset === 'function') {
  3973. offset.fn = function (data) {
  3974. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3975. return data;
  3976. };
  3977. } else {
  3978. offset.offset = this._config.offset;
  3979. }
  3980. return offset;
  3981. };
  3982. _proto._getPopperConfig = function _getPopperConfig() {
  3983. var popperConfig = {
  3984. placement: this._getPlacement(),
  3985. modifiers: {
  3986. offset: this._getOffset(),
  3987. flip: {
  3988. enabled: this._config.flip
  3989. },
  3990. preventOverflow: {
  3991. boundariesElement: this._config.boundary
  3992. }
  3993. }
  3994. }; // Disable Popper.js if we have a static display
  3995. if (this._config.display === 'static') {
  3996. popperConfig.modifiers.applyStyle = {
  3997. enabled: false
  3998. };
  3999. }
  4000. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4001. } // Static
  4002. ;
  4003. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4004. return this.each(function () {
  4005. var data = $(this).data(DATA_KEY$4);
  4006. var _config = typeof config === 'object' ? config : null;
  4007. if (!data) {
  4008. data = new Dropdown(this, _config);
  4009. $(this).data(DATA_KEY$4, data);
  4010. }
  4011. if (typeof config === 'string') {
  4012. if (typeof data[config] === 'undefined') {
  4013. throw new TypeError("No method named \"" + config + "\"");
  4014. }
  4015. data[config]();
  4016. }
  4017. });
  4018. };
  4019. Dropdown._clearMenus = function _clearMenus(event) {
  4020. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4021. return;
  4022. }
  4023. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4024. for (var i = 0, len = toggles.length; i < len; i++) {
  4025. var parent = Dropdown._getParentFromElement(toggles[i]);
  4026. var context = $(toggles[i]).data(DATA_KEY$4);
  4027. var relatedTarget = {
  4028. relatedTarget: toggles[i]
  4029. };
  4030. if (event && event.type === 'click') {
  4031. relatedTarget.clickEvent = event;
  4032. }
  4033. if (!context) {
  4034. continue;
  4035. }
  4036. var dropdownMenu = context._menu;
  4037. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4038. continue;
  4039. }
  4040. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4041. continue;
  4042. }
  4043. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4044. $(parent).trigger(hideEvent);
  4045. if (hideEvent.isDefaultPrevented()) {
  4046. continue;
  4047. } // If this is a touch-enabled device we remove the extra
  4048. // empty mouseover listeners we added for iOS support
  4049. if ('ontouchstart' in document.documentElement) {
  4050. $(document.body).children().off('mouseover', null, $.noop);
  4051. }
  4052. toggles[i].setAttribute('aria-expanded', 'false');
  4053. if (context._popper) {
  4054. context._popper.destroy();
  4055. }
  4056. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4057. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4058. }
  4059. };
  4060. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4061. var parent;
  4062. var selector = Util.getSelectorFromElement(element);
  4063. if (selector) {
  4064. parent = document.querySelector(selector);
  4065. }
  4066. return parent || element.parentNode;
  4067. } // eslint-disable-next-line complexity
  4068. ;
  4069. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4070. // If not input/textarea:
  4071. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4072. // If input/textarea:
  4073. // - If space key => not a dropdown command
  4074. // - If key is other than escape
  4075. // - If key is not up or down => not a dropdown command
  4076. // - If trigger inside the menu => not a dropdown command
  4077. 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)) {
  4078. return;
  4079. }
  4080. event.preventDefault();
  4081. event.stopPropagation();
  4082. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4083. return;
  4084. }
  4085. var parent = Dropdown._getParentFromElement(this);
  4086. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4087. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4088. return;
  4089. }
  4090. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4091. if (event.which === ESCAPE_KEYCODE) {
  4092. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4093. $(toggle).trigger('focus');
  4094. }
  4095. $(this).trigger('click');
  4096. return;
  4097. }
  4098. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4099. return $(item).is(':visible');
  4100. });
  4101. if (items.length === 0) {
  4102. return;
  4103. }
  4104. var index = items.indexOf(event.target);
  4105. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4106. // Up
  4107. index--;
  4108. }
  4109. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4110. // Down
  4111. index++;
  4112. }
  4113. if (index < 0) {
  4114. index = 0;
  4115. }
  4116. items[index].focus();
  4117. };
  4118. _createClass(Dropdown, null, [{
  4119. key: "VERSION",
  4120. get: function get() {
  4121. return VERSION$4;
  4122. }
  4123. }, {
  4124. key: "Default",
  4125. get: function get() {
  4126. return Default$2;
  4127. }
  4128. }, {
  4129. key: "DefaultType",
  4130. get: function get() {
  4131. return DefaultType$2;
  4132. }
  4133. }]);
  4134. return Dropdown;
  4135. }();
  4136. /**
  4137. * ------------------------------------------------------------------------
  4138. * Data Api implementation
  4139. * ------------------------------------------------------------------------
  4140. */
  4141. $(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) {
  4142. event.preventDefault();
  4143. event.stopPropagation();
  4144. Dropdown._jQueryInterface.call($(this), 'toggle');
  4145. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4146. e.stopPropagation();
  4147. });
  4148. /**
  4149. * ------------------------------------------------------------------------
  4150. * jQuery
  4151. * ------------------------------------------------------------------------
  4152. */
  4153. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4154. $.fn[NAME$4].Constructor = Dropdown;
  4155. $.fn[NAME$4].noConflict = function () {
  4156. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4157. return Dropdown._jQueryInterface;
  4158. };
  4159. /**
  4160. * ------------------------------------------------------------------------
  4161. * Constants
  4162. * ------------------------------------------------------------------------
  4163. */
  4164. var NAME$5 = 'modal';
  4165. var VERSION$5 = '4.4.1';
  4166. var DATA_KEY$5 = 'bs.modal';
  4167. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4168. var DATA_API_KEY$5 = '.data-api';
  4169. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4170. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4171. var Default$3 = {
  4172. backdrop: true,
  4173. keyboard: true,
  4174. focus: true,
  4175. show: true
  4176. };
  4177. var DefaultType$3 = {
  4178. backdrop: '(boolean|string)',
  4179. keyboard: 'boolean',
  4180. focus: 'boolean',
  4181. show: 'boolean'
  4182. };
  4183. var Event$5 = {
  4184. HIDE: "hide" + EVENT_KEY$5,
  4185. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4186. HIDDEN: "hidden" + EVENT_KEY$5,
  4187. SHOW: "show" + EVENT_KEY$5,
  4188. SHOWN: "shown" + EVENT_KEY$5,
  4189. FOCUSIN: "focusin" + EVENT_KEY$5,
  4190. RESIZE: "resize" + EVENT_KEY$5,
  4191. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4192. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4193. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4194. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4195. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4196. };
  4197. var ClassName$5 = {
  4198. SCROLLABLE: 'modal-dialog-scrollable',
  4199. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4200. BACKDROP: 'modal-backdrop',
  4201. OPEN: 'modal-open',
  4202. FADE: 'fade',
  4203. SHOW: 'show',
  4204. STATIC: 'modal-static'
  4205. };
  4206. var Selector$5 = {
  4207. DIALOG: '.modal-dialog',
  4208. MODAL_BODY: '.modal-body',
  4209. DATA_TOGGLE: '[data-toggle="modal"]',
  4210. DATA_DISMISS: '[data-dismiss="modal"]',
  4211. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4212. STICKY_CONTENT: '.sticky-top'
  4213. };
  4214. /**
  4215. * ------------------------------------------------------------------------
  4216. * Class Definition
  4217. * ------------------------------------------------------------------------
  4218. */
  4219. var Modal =
  4220. /*#__PURE__*/
  4221. function () {
  4222. function Modal(element, config) {
  4223. this._config = this._getConfig(config);
  4224. this._element = element;
  4225. this._dialog = element.querySelector(Selector$5.DIALOG);
  4226. this._backdrop = null;
  4227. this._isShown = false;
  4228. this._isBodyOverflowing = false;
  4229. this._ignoreBackdropClick = false;
  4230. this._isTransitioning = false;
  4231. this._scrollbarWidth = 0;
  4232. } // Getters
  4233. var _proto = Modal.prototype;
  4234. // Public
  4235. _proto.toggle = function toggle(relatedTarget) {
  4236. return this._isShown ? this.hide() : this.show(relatedTarget);
  4237. };
  4238. _proto.show = function show(relatedTarget) {
  4239. var _this = this;
  4240. if (this._isShown || this._isTransitioning) {
  4241. return;
  4242. }
  4243. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4244. this._isTransitioning = true;
  4245. }
  4246. var showEvent = $.Event(Event$5.SHOW, {
  4247. relatedTarget: relatedTarget
  4248. });
  4249. $(this._element).trigger(showEvent);
  4250. if (this._isShown || showEvent.isDefaultPrevented()) {
  4251. return;
  4252. }
  4253. this._isShown = true;
  4254. this._checkScrollbar();
  4255. this._setScrollbar();
  4256. this._adjustDialog();
  4257. this._setEscapeEvent();
  4258. this._setResizeEvent();
  4259. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4260. return _this.hide(event);
  4261. });
  4262. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4263. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4264. if ($(event.target).is(_this._element)) {
  4265. _this._ignoreBackdropClick = true;
  4266. }
  4267. });
  4268. });
  4269. this._showBackdrop(function () {
  4270. return _this._showElement(relatedTarget);
  4271. });
  4272. };
  4273. _proto.hide = function hide(event) {
  4274. var _this2 = this;
  4275. if (event) {
  4276. event.preventDefault();
  4277. }
  4278. if (!this._isShown || this._isTransitioning) {
  4279. return;
  4280. }
  4281. var hideEvent = $.Event(Event$5.HIDE);
  4282. $(this._element).trigger(hideEvent);
  4283. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4284. return;
  4285. }
  4286. this._isShown = false;
  4287. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4288. if (transition) {
  4289. this._isTransitioning = true;
  4290. }
  4291. this._setEscapeEvent();
  4292. this._setResizeEvent();
  4293. $(document).off(Event$5.FOCUSIN);
  4294. $(this._element).removeClass(ClassName$5.SHOW);
  4295. $(this._element).off(Event$5.CLICK_DISMISS);
  4296. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4297. if (transition) {
  4298. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4299. $(this._element).one(Util.TRANSITION_END, function (event) {
  4300. return _this2._hideModal(event);
  4301. }).emulateTransitionEnd(transitionDuration);
  4302. } else {
  4303. this._hideModal();
  4304. }
  4305. };
  4306. _proto.dispose = function dispose() {
  4307. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4308. return $(htmlElement).off(EVENT_KEY$5);
  4309. });
  4310. /**
  4311. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4312. * Do not move `document` in `htmlElements` array
  4313. * It will remove `Event.CLICK_DATA_API` event that should remain
  4314. */
  4315. $(document).off(Event$5.FOCUSIN);
  4316. $.removeData(this._element, DATA_KEY$5);
  4317. this._config = null;
  4318. this._element = null;
  4319. this._dialog = null;
  4320. this._backdrop = null;
  4321. this._isShown = null;
  4322. this._isBodyOverflowing = null;
  4323. this._ignoreBackdropClick = null;
  4324. this._isTransitioning = null;
  4325. this._scrollbarWidth = null;
  4326. };
  4327. _proto.handleUpdate = function handleUpdate() {
  4328. this._adjustDialog();
  4329. } // Private
  4330. ;
  4331. _proto._getConfig = function _getConfig(config) {
  4332. config = _objectSpread2({}, Default$3, {}, config);
  4333. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4334. return config;
  4335. };
  4336. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4337. var _this3 = this;
  4338. if (this._config.backdrop === 'static') {
  4339. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4340. $(this._element).trigger(hideEventPrevented);
  4341. if (hideEventPrevented.defaultPrevented) {
  4342. return;
  4343. }
  4344. this._element.classList.add(ClassName$5.STATIC);
  4345. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4346. $(this._element).one(Util.TRANSITION_END, function () {
  4347. _this3._element.classList.remove(ClassName$5.STATIC);
  4348. }).emulateTransitionEnd(modalTransitionDuration);
  4349. this._element.focus();
  4350. } else {
  4351. this.hide();
  4352. }
  4353. };
  4354. _proto._showElement = function _showElement(relatedTarget) {
  4355. var _this4 = this;
  4356. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4357. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4358. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4359. // Don't move modal's DOM position
  4360. document.body.appendChild(this._element);
  4361. }
  4362. this._element.style.display = 'block';
  4363. this._element.removeAttribute('aria-hidden');
  4364. this._element.setAttribute('aria-modal', true);
  4365. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4366. modalBody.scrollTop = 0;
  4367. } else {
  4368. this._element.scrollTop = 0;
  4369. }
  4370. if (transition) {
  4371. Util.reflow(this._element);
  4372. }
  4373. $(this._element).addClass(ClassName$5.SHOW);
  4374. if (this._config.focus) {
  4375. this._enforceFocus();
  4376. }
  4377. var shownEvent = $.Event(Event$5.SHOWN, {
  4378. relatedTarget: relatedTarget
  4379. });
  4380. var transitionComplete = function transitionComplete() {
  4381. if (_this4._config.focus) {
  4382. _this4._element.focus();
  4383. }
  4384. _this4._isTransitioning = false;
  4385. $(_this4._element).trigger(shownEvent);
  4386. };
  4387. if (transition) {
  4388. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4389. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4390. } else {
  4391. transitionComplete();
  4392. }
  4393. };
  4394. _proto._enforceFocus = function _enforceFocus() {
  4395. var _this5 = this;
  4396. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4397. .on(Event$5.FOCUSIN, function (event) {
  4398. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4399. _this5._element.focus();
  4400. }
  4401. });
  4402. };
  4403. _proto._setEscapeEvent = function _setEscapeEvent() {
  4404. var _this6 = this;
  4405. if (this._isShown && this._config.keyboard) {
  4406. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4407. if (event.which === ESCAPE_KEYCODE$1) {
  4408. _this6._triggerBackdropTransition();
  4409. }
  4410. });
  4411. } else if (!this._isShown) {
  4412. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4413. }
  4414. };
  4415. _proto._setResizeEvent = function _setResizeEvent() {
  4416. var _this7 = this;
  4417. if (this._isShown) {
  4418. $(window).on(Event$5.RESIZE, function (event) {
  4419. return _this7.handleUpdate(event);
  4420. });
  4421. } else {
  4422. $(window).off(Event$5.RESIZE);
  4423. }
  4424. };
  4425. _proto._hideModal = function _hideModal() {
  4426. var _this8 = this;
  4427. this._element.style.display = 'none';
  4428. this._element.setAttribute('aria-hidden', true);
  4429. this._element.removeAttribute('aria-modal');
  4430. this._isTransitioning = false;
  4431. this._showBackdrop(function () {
  4432. $(document.body).removeClass(ClassName$5.OPEN);
  4433. _this8._resetAdjustments();
  4434. _this8._resetScrollbar();
  4435. $(_this8._element).trigger(Event$5.HIDDEN);
  4436. });
  4437. };
  4438. _proto._removeBackdrop = function _removeBackdrop() {
  4439. if (this._backdrop) {
  4440. $(this._backdrop).remove();
  4441. this._backdrop = null;
  4442. }
  4443. };
  4444. _proto._showBackdrop = function _showBackdrop(callback) {
  4445. var _this9 = this;
  4446. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4447. if (this._isShown && this._config.backdrop) {
  4448. this._backdrop = document.createElement('div');
  4449. this._backdrop.className = ClassName$5.BACKDROP;
  4450. if (animate) {
  4451. this._backdrop.classList.add(animate);
  4452. }
  4453. $(this._backdrop).appendTo(document.body);
  4454. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4455. if (_this9._ignoreBackdropClick) {
  4456. _this9._ignoreBackdropClick = false;
  4457. return;
  4458. }
  4459. if (event.target !== event.currentTarget) {
  4460. return;
  4461. }
  4462. _this9._triggerBackdropTransition();
  4463. });
  4464. if (animate) {
  4465. Util.reflow(this._backdrop);
  4466. }
  4467. $(this._backdrop).addClass(ClassName$5.SHOW);
  4468. if (!callback) {
  4469. return;
  4470. }
  4471. if (!animate) {
  4472. callback();
  4473. return;
  4474. }
  4475. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4476. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4477. } else if (!this._isShown && this._backdrop) {
  4478. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4479. var callbackRemove = function callbackRemove() {
  4480. _this9._removeBackdrop();
  4481. if (callback) {
  4482. callback();
  4483. }
  4484. };
  4485. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4486. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4487. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4488. } else {
  4489. callbackRemove();
  4490. }
  4491. } else if (callback) {
  4492. callback();
  4493. }
  4494. } // ----------------------------------------------------------------------
  4495. // the following methods are used to handle overflowing modals
  4496. // todo (fat): these should probably be refactored out of modal.js
  4497. // ----------------------------------------------------------------------
  4498. ;
  4499. _proto._adjustDialog = function _adjustDialog() {
  4500. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4501. if (!this._isBodyOverflowing && isModalOverflowing) {
  4502. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4503. }
  4504. if (this._isBodyOverflowing && !isModalOverflowing) {
  4505. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4506. }
  4507. };
  4508. _proto._resetAdjustments = function _resetAdjustments() {
  4509. this._element.style.paddingLeft = '';
  4510. this._element.style.paddingRight = '';
  4511. };
  4512. _proto._checkScrollbar = function _checkScrollbar() {
  4513. var rect = document.body.getBoundingClientRect();
  4514. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4515. this._scrollbarWidth = this._getScrollbarWidth();
  4516. };
  4517. _proto._setScrollbar = function _setScrollbar() {
  4518. var _this10 = this;
  4519. if (this._isBodyOverflowing) {
  4520. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4521. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4522. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4523. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4524. $(fixedContent).each(function (index, element) {
  4525. var actualPadding = element.style.paddingRight;
  4526. var calculatedPadding = $(element).css('padding-right');
  4527. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4528. }); // Adjust sticky content margin
  4529. $(stickyContent).each(function (index, element) {
  4530. var actualMargin = element.style.marginRight;
  4531. var calculatedMargin = $(element).css('margin-right');
  4532. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4533. }); // Adjust body padding
  4534. var actualPadding = document.body.style.paddingRight;
  4535. var calculatedPadding = $(document.body).css('padding-right');
  4536. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4537. }
  4538. $(document.body).addClass(ClassName$5.OPEN);
  4539. };
  4540. _proto._resetScrollbar = function _resetScrollbar() {
  4541. // Restore fixed content padding
  4542. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4543. $(fixedContent).each(function (index, element) {
  4544. var padding = $(element).data('padding-right');
  4545. $(element).removeData('padding-right');
  4546. element.style.paddingRight = padding ? padding : '';
  4547. }); // Restore sticky content
  4548. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4549. $(elements).each(function (index, element) {
  4550. var margin = $(element).data('margin-right');
  4551. if (typeof margin !== 'undefined') {
  4552. $(element).css('margin-right', margin).removeData('margin-right');
  4553. }
  4554. }); // Restore body padding
  4555. var padding = $(document.body).data('padding-right');
  4556. $(document.body).removeData('padding-right');
  4557. document.body.style.paddingRight = padding ? padding : '';
  4558. };
  4559. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4560. // thx d.walsh
  4561. var scrollDiv = document.createElement('div');
  4562. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4563. document.body.appendChild(scrollDiv);
  4564. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4565. document.body.removeChild(scrollDiv);
  4566. return scrollbarWidth;
  4567. } // Static
  4568. ;
  4569. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4570. return this.each(function () {
  4571. var data = $(this).data(DATA_KEY$5);
  4572. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4573. if (!data) {
  4574. data = new Modal(this, _config);
  4575. $(this).data(DATA_KEY$5, data);
  4576. }
  4577. if (typeof config === 'string') {
  4578. if (typeof data[config] === 'undefined') {
  4579. throw new TypeError("No method named \"" + config + "\"");
  4580. }
  4581. data[config](relatedTarget);
  4582. } else if (_config.show) {
  4583. data.show(relatedTarget);
  4584. }
  4585. });
  4586. };
  4587. _createClass(Modal, null, [{
  4588. key: "VERSION",
  4589. get: function get() {
  4590. return VERSION$5;
  4591. }
  4592. }, {
  4593. key: "Default",
  4594. get: function get() {
  4595. return Default$3;
  4596. }
  4597. }]);
  4598. return Modal;
  4599. }();
  4600. /**
  4601. * ------------------------------------------------------------------------
  4602. * Data Api implementation
  4603. * ------------------------------------------------------------------------
  4604. */
  4605. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4606. var _this11 = this;
  4607. var target;
  4608. var selector = Util.getSelectorFromElement(this);
  4609. if (selector) {
  4610. target = document.querySelector(selector);
  4611. }
  4612. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4613. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4614. event.preventDefault();
  4615. }
  4616. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4617. if (showEvent.isDefaultPrevented()) {
  4618. // Only register focus restorer if modal will actually get shown
  4619. return;
  4620. }
  4621. $target.one(Event$5.HIDDEN, function () {
  4622. if ($(_this11).is(':visible')) {
  4623. _this11.focus();
  4624. }
  4625. });
  4626. });
  4627. Modal._jQueryInterface.call($(target), config, this);
  4628. });
  4629. /**
  4630. * ------------------------------------------------------------------------
  4631. * jQuery
  4632. * ------------------------------------------------------------------------
  4633. */
  4634. $.fn[NAME$5] = Modal._jQueryInterface;
  4635. $.fn[NAME$5].Constructor = Modal;
  4636. $.fn[NAME$5].noConflict = function () {
  4637. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4638. return Modal._jQueryInterface;
  4639. };
  4640. /**
  4641. * --------------------------------------------------------------------------
  4642. * Bootstrap (v4.4.1): tools/sanitizer.js
  4643. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4644. * --------------------------------------------------------------------------
  4645. */
  4646. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4647. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4648. var DefaultWhitelist = {
  4649. // Global attributes allowed on any supplied element below.
  4650. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4651. a: ['target', 'href', 'title', 'rel'],
  4652. area: [],
  4653. b: [],
  4654. br: [],
  4655. col: [],
  4656. code: [],
  4657. div: [],
  4658. em: [],
  4659. hr: [],
  4660. h1: [],
  4661. h2: [],
  4662. h3: [],
  4663. h4: [],
  4664. h5: [],
  4665. h6: [],
  4666. i: [],
  4667. img: ['src', 'alt', 'title', 'width', 'height'],
  4668. li: [],
  4669. ol: [],
  4670. p: [],
  4671. pre: [],
  4672. s: [],
  4673. small: [],
  4674. span: [],
  4675. sub: [],
  4676. sup: [],
  4677. strong: [],
  4678. u: [],
  4679. ul: []
  4680. };
  4681. /**
  4682. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4683. *
  4684. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4685. */
  4686. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4687. /**
  4688. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4689. *
  4690. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4691. */
  4692. 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;
  4693. function allowedAttribute(attr, allowedAttributeList) {
  4694. var attrName = attr.nodeName.toLowerCase();
  4695. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4696. if (uriAttrs.indexOf(attrName) !== -1) {
  4697. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4698. }
  4699. return true;
  4700. }
  4701. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4702. return attrRegex instanceof RegExp;
  4703. }); // Check if a regular expression validates the attribute.
  4704. for (var i = 0, l = regExp.length; i < l; i++) {
  4705. if (attrName.match(regExp[i])) {
  4706. return true;
  4707. }
  4708. }
  4709. return false;
  4710. }
  4711. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4712. if (unsafeHtml.length === 0) {
  4713. return unsafeHtml;
  4714. }
  4715. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4716. return sanitizeFn(unsafeHtml);
  4717. }
  4718. var domParser = new window.DOMParser();
  4719. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4720. var whitelistKeys = Object.keys(whiteList);
  4721. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4722. var _loop = function _loop(i, len) {
  4723. var el = elements[i];
  4724. var elName = el.nodeName.toLowerCase();
  4725. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4726. el.parentNode.removeChild(el);
  4727. return "continue";
  4728. }
  4729. var attributeList = [].slice.call(el.attributes);
  4730. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4731. attributeList.forEach(function (attr) {
  4732. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4733. el.removeAttribute(attr.nodeName);
  4734. }
  4735. });
  4736. };
  4737. for (var i = 0, len = elements.length; i < len; i++) {
  4738. var _ret = _loop(i);
  4739. if (_ret === "continue") continue;
  4740. }
  4741. return createdDocument.body.innerHTML;
  4742. }
  4743. /**
  4744. * ------------------------------------------------------------------------
  4745. * Constants
  4746. * ------------------------------------------------------------------------
  4747. */
  4748. var NAME$6 = 'tooltip';
  4749. var VERSION$6 = '4.4.1';
  4750. var DATA_KEY$6 = 'bs.tooltip';
  4751. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4752. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4753. var CLASS_PREFIX = 'bs-tooltip';
  4754. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4755. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4756. var DefaultType$4 = {
  4757. animation: 'boolean',
  4758. template: 'string',
  4759. title: '(string|element|function)',
  4760. trigger: 'string',
  4761. delay: '(number|object)',
  4762. html: 'boolean',
  4763. selector: '(string|boolean)',
  4764. placement: '(string|function)',
  4765. offset: '(number|string|function)',
  4766. container: '(string|element|boolean)',
  4767. fallbackPlacement: '(string|array)',
  4768. boundary: '(string|element)',
  4769. sanitize: 'boolean',
  4770. sanitizeFn: '(null|function)',
  4771. whiteList: 'object',
  4772. popperConfig: '(null|object)'
  4773. };
  4774. var AttachmentMap$1 = {
  4775. AUTO: 'auto',
  4776. TOP: 'top',
  4777. RIGHT: 'right',
  4778. BOTTOM: 'bottom',
  4779. LEFT: 'left'
  4780. };
  4781. var Default$4 = {
  4782. animation: true,
  4783. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4784. trigger: 'hover focus',
  4785. title: '',
  4786. delay: 0,
  4787. html: false,
  4788. selector: false,
  4789. placement: 'top',
  4790. offset: 0,
  4791. container: false,
  4792. fallbackPlacement: 'flip',
  4793. boundary: 'scrollParent',
  4794. sanitize: true,
  4795. sanitizeFn: null,
  4796. whiteList: DefaultWhitelist,
  4797. popperConfig: null
  4798. };
  4799. var HoverState = {
  4800. SHOW: 'show',
  4801. OUT: 'out'
  4802. };
  4803. var Event$6 = {
  4804. HIDE: "hide" + EVENT_KEY$6,
  4805. HIDDEN: "hidden" + EVENT_KEY$6,
  4806. SHOW: "show" + EVENT_KEY$6,
  4807. SHOWN: "shown" + EVENT_KEY$6,
  4808. INSERTED: "inserted" + EVENT_KEY$6,
  4809. CLICK: "click" + EVENT_KEY$6,
  4810. FOCUSIN: "focusin" + EVENT_KEY$6,
  4811. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4812. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4813. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4814. };
  4815. var ClassName$6 = {
  4816. FADE: 'fade',
  4817. SHOW: 'show'
  4818. };
  4819. var Selector$6 = {
  4820. TOOLTIP: '.tooltip',
  4821. TOOLTIP_INNER: '.tooltip-inner',
  4822. ARROW: '.arrow'
  4823. };
  4824. var Trigger = {
  4825. HOVER: 'hover',
  4826. FOCUS: 'focus',
  4827. CLICK: 'click',
  4828. MANUAL: 'manual'
  4829. };
  4830. /**
  4831. * ------------------------------------------------------------------------
  4832. * Class Definition
  4833. * ------------------------------------------------------------------------
  4834. */
  4835. var Tooltip =
  4836. /*#__PURE__*/
  4837. function () {
  4838. function Tooltip(element, config) {
  4839. if (typeof Popper === 'undefined') {
  4840. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4841. } // private
  4842. this._isEnabled = true;
  4843. this._timeout = 0;
  4844. this._hoverState = '';
  4845. this._activeTrigger = {};
  4846. this._popper = null; // Protected
  4847. this.element = element;
  4848. this.config = this._getConfig(config);
  4849. this.tip = null;
  4850. this._setListeners();
  4851. } // Getters
  4852. var _proto = Tooltip.prototype;
  4853. // Public
  4854. _proto.enable = function enable() {
  4855. this._isEnabled = true;
  4856. };
  4857. _proto.disable = function disable() {
  4858. this._isEnabled = false;
  4859. };
  4860. _proto.toggleEnabled = function toggleEnabled() {
  4861. this._isEnabled = !this._isEnabled;
  4862. };
  4863. _proto.toggle = function toggle(event) {
  4864. if (!this._isEnabled) {
  4865. return;
  4866. }
  4867. if (event) {
  4868. var dataKey = this.constructor.DATA_KEY;
  4869. var context = $(event.currentTarget).data(dataKey);
  4870. if (!context) {
  4871. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4872. $(event.currentTarget).data(dataKey, context);
  4873. }
  4874. context._activeTrigger.click = !context._activeTrigger.click;
  4875. if (context._isWithActiveTrigger()) {
  4876. context._enter(null, context);
  4877. } else {
  4878. context._leave(null, context);
  4879. }
  4880. } else {
  4881. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4882. this._leave(null, this);
  4883. return;
  4884. }
  4885. this._enter(null, this);
  4886. }
  4887. };
  4888. _proto.dispose = function dispose() {
  4889. clearTimeout(this._timeout);
  4890. $.removeData(this.element, this.constructor.DATA_KEY);
  4891. $(this.element).off(this.constructor.EVENT_KEY);
  4892. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4893. if (this.tip) {
  4894. $(this.tip).remove();
  4895. }
  4896. this._isEnabled = null;
  4897. this._timeout = null;
  4898. this._hoverState = null;
  4899. this._activeTrigger = null;
  4900. if (this._popper) {
  4901. this._popper.destroy();
  4902. }
  4903. this._popper = null;
  4904. this.element = null;
  4905. this.config = null;
  4906. this.tip = null;
  4907. };
  4908. _proto.show = function show() {
  4909. var _this = this;
  4910. if ($(this.element).css('display') === 'none') {
  4911. throw new Error('Please use show on visible elements');
  4912. }
  4913. var showEvent = $.Event(this.constructor.Event.SHOW);
  4914. if (this.isWithContent() && this._isEnabled) {
  4915. $(this.element).trigger(showEvent);
  4916. var shadowRoot = Util.findShadowRoot(this.element);
  4917. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4918. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4919. return;
  4920. }
  4921. var tip = this.getTipElement();
  4922. var tipId = Util.getUID(this.constructor.NAME);
  4923. tip.setAttribute('id', tipId);
  4924. this.element.setAttribute('aria-describedby', tipId);
  4925. this.setContent();
  4926. if (this.config.animation) {
  4927. $(tip).addClass(ClassName$6.FADE);
  4928. }
  4929. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4930. var attachment = this._getAttachment(placement);
  4931. this.addAttachmentClass(attachment);
  4932. var container = this._getContainer();
  4933. $(tip).data(this.constructor.DATA_KEY, this);
  4934. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4935. $(tip).appendTo(container);
  4936. }
  4937. $(this.element).trigger(this.constructor.Event.INSERTED);
  4938. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4939. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4940. // empty mouseover listeners to the body's immediate children;
  4941. // only needed because of broken event delegation on iOS
  4942. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4943. if ('ontouchstart' in document.documentElement) {
  4944. $(document.body).children().on('mouseover', null, $.noop);
  4945. }
  4946. var complete = function complete() {
  4947. if (_this.config.animation) {
  4948. _this._fixTransition();
  4949. }
  4950. var prevHoverState = _this._hoverState;
  4951. _this._hoverState = null;
  4952. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4953. if (prevHoverState === HoverState.OUT) {
  4954. _this._leave(null, _this);
  4955. }
  4956. };
  4957. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4958. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4959. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4960. } else {
  4961. complete();
  4962. }
  4963. }
  4964. };
  4965. _proto.hide = function hide(callback) {
  4966. var _this2 = this;
  4967. var tip = this.getTipElement();
  4968. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4969. var complete = function complete() {
  4970. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4971. tip.parentNode.removeChild(tip);
  4972. }
  4973. _this2._cleanTipClass();
  4974. _this2.element.removeAttribute('aria-describedby');
  4975. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4976. if (_this2._popper !== null) {
  4977. _this2._popper.destroy();
  4978. }
  4979. if (callback) {
  4980. callback();
  4981. }
  4982. };
  4983. $(this.element).trigger(hideEvent);
  4984. if (hideEvent.isDefaultPrevented()) {
  4985. return;
  4986. }
  4987. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4988. // empty mouseover listeners we added for iOS support
  4989. if ('ontouchstart' in document.documentElement) {
  4990. $(document.body).children().off('mouseover', null, $.noop);
  4991. }
  4992. this._activeTrigger[Trigger.CLICK] = false;
  4993. this._activeTrigger[Trigger.FOCUS] = false;
  4994. this._activeTrigger[Trigger.HOVER] = false;
  4995. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4996. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4997. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4998. } else {
  4999. complete();
  5000. }
  5001. this._hoverState = '';
  5002. };
  5003. _proto.update = function update() {
  5004. if (this._popper !== null) {
  5005. this._popper.scheduleUpdate();
  5006. }
  5007. } // Protected
  5008. ;
  5009. _proto.isWithContent = function isWithContent() {
  5010. return Boolean(this.getTitle());
  5011. };
  5012. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5013. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5014. };
  5015. _proto.getTipElement = function getTipElement() {
  5016. this.tip = this.tip || $(this.config.template)[0];
  5017. return this.tip;
  5018. };
  5019. _proto.setContent = function setContent() {
  5020. var tip = this.getTipElement();
  5021. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5022. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5023. };
  5024. _proto.setElementContent = function setElementContent($element, content) {
  5025. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5026. // Content is a DOM node or a jQuery
  5027. if (this.config.html) {
  5028. if (!$(content).parent().is($element)) {
  5029. $element.empty().append(content);
  5030. }
  5031. } else {
  5032. $element.text($(content).text());
  5033. }
  5034. return;
  5035. }
  5036. if (this.config.html) {
  5037. if (this.config.sanitize) {
  5038. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5039. }
  5040. $element.html(content);
  5041. } else {
  5042. $element.text(content);
  5043. }
  5044. };
  5045. _proto.getTitle = function getTitle() {
  5046. var title = this.element.getAttribute('data-original-title');
  5047. if (!title) {
  5048. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5049. }
  5050. return title;
  5051. } // Private
  5052. ;
  5053. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5054. var _this3 = this;
  5055. var defaultBsConfig = {
  5056. placement: attachment,
  5057. modifiers: {
  5058. offset: this._getOffset(),
  5059. flip: {
  5060. behavior: this.config.fallbackPlacement
  5061. },
  5062. arrow: {
  5063. element: Selector$6.ARROW
  5064. },
  5065. preventOverflow: {
  5066. boundariesElement: this.config.boundary
  5067. }
  5068. },
  5069. onCreate: function onCreate(data) {
  5070. if (data.originalPlacement !== data.placement) {
  5071. _this3._handlePopperPlacementChange(data);
  5072. }
  5073. },
  5074. onUpdate: function onUpdate(data) {
  5075. return _this3._handlePopperPlacementChange(data);
  5076. }
  5077. };
  5078. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5079. };
  5080. _proto._getOffset = function _getOffset() {
  5081. var _this4 = this;
  5082. var offset = {};
  5083. if (typeof this.config.offset === 'function') {
  5084. offset.fn = function (data) {
  5085. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5086. return data;
  5087. };
  5088. } else {
  5089. offset.offset = this.config.offset;
  5090. }
  5091. return offset;
  5092. };
  5093. _proto._getContainer = function _getContainer() {
  5094. if (this.config.container === false) {
  5095. return document.body;
  5096. }
  5097. if (Util.isElement(this.config.container)) {
  5098. return $(this.config.container);
  5099. }
  5100. return $(document).find(this.config.container);
  5101. };
  5102. _proto._getAttachment = function _getAttachment(placement) {
  5103. return AttachmentMap$1[placement.toUpperCase()];
  5104. };
  5105. _proto._setListeners = function _setListeners() {
  5106. var _this5 = this;
  5107. var triggers = this.config.trigger.split(' ');
  5108. triggers.forEach(function (trigger) {
  5109. if (trigger === 'click') {
  5110. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5111. return _this5.toggle(event);
  5112. });
  5113. } else if (trigger !== Trigger.MANUAL) {
  5114. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5115. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5116. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5117. return _this5._enter(event);
  5118. }).on(eventOut, _this5.config.selector, function (event) {
  5119. return _this5._leave(event);
  5120. });
  5121. }
  5122. });
  5123. this._hideModalHandler = function () {
  5124. if (_this5.element) {
  5125. _this5.hide();
  5126. }
  5127. };
  5128. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5129. if (this.config.selector) {
  5130. this.config = _objectSpread2({}, this.config, {
  5131. trigger: 'manual',
  5132. selector: ''
  5133. });
  5134. } else {
  5135. this._fixTitle();
  5136. }
  5137. };
  5138. _proto._fixTitle = function _fixTitle() {
  5139. var titleType = typeof this.element.getAttribute('data-original-title');
  5140. if (this.element.getAttribute('title') || titleType !== 'string') {
  5141. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5142. this.element.setAttribute('title', '');
  5143. }
  5144. };
  5145. _proto._enter = function _enter(event, context) {
  5146. var dataKey = this.constructor.DATA_KEY;
  5147. context = context || $(event.currentTarget).data(dataKey);
  5148. if (!context) {
  5149. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5150. $(event.currentTarget).data(dataKey, context);
  5151. }
  5152. if (event) {
  5153. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5154. }
  5155. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5156. context._hoverState = HoverState.SHOW;
  5157. return;
  5158. }
  5159. clearTimeout(context._timeout);
  5160. context._hoverState = HoverState.SHOW;
  5161. if (!context.config.delay || !context.config.delay.show) {
  5162. context.show();
  5163. return;
  5164. }
  5165. context._timeout = setTimeout(function () {
  5166. if (context._hoverState === HoverState.SHOW) {
  5167. context.show();
  5168. }
  5169. }, context.config.delay.show);
  5170. };
  5171. _proto._leave = function _leave(event, context) {
  5172. var dataKey = this.constructor.DATA_KEY;
  5173. context = context || $(event.currentTarget).data(dataKey);
  5174. if (!context) {
  5175. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5176. $(event.currentTarget).data(dataKey, context);
  5177. }
  5178. if (event) {
  5179. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5180. }
  5181. if (context._isWithActiveTrigger()) {
  5182. return;
  5183. }
  5184. clearTimeout(context._timeout);
  5185. context._hoverState = HoverState.OUT;
  5186. if (!context.config.delay || !context.config.delay.hide) {
  5187. context.hide();
  5188. return;
  5189. }
  5190. context._timeout = setTimeout(function () {
  5191. if (context._hoverState === HoverState.OUT) {
  5192. context.hide();
  5193. }
  5194. }, context.config.delay.hide);
  5195. };
  5196. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5197. for (var trigger in this._activeTrigger) {
  5198. if (this._activeTrigger[trigger]) {
  5199. return true;
  5200. }
  5201. }
  5202. return false;
  5203. };
  5204. _proto._getConfig = function _getConfig(config) {
  5205. var dataAttributes = $(this.element).data();
  5206. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5207. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5208. delete dataAttributes[dataAttr];
  5209. }
  5210. });
  5211. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5212. if (typeof config.delay === 'number') {
  5213. config.delay = {
  5214. show: config.delay,
  5215. hide: config.delay
  5216. };
  5217. }
  5218. if (typeof config.title === 'number') {
  5219. config.title = config.title.toString();
  5220. }
  5221. if (typeof config.content === 'number') {
  5222. config.content = config.content.toString();
  5223. }
  5224. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5225. if (config.sanitize) {
  5226. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5227. }
  5228. return config;
  5229. };
  5230. _proto._getDelegateConfig = function _getDelegateConfig() {
  5231. var config = {};
  5232. if (this.config) {
  5233. for (var key in this.config) {
  5234. if (this.constructor.Default[key] !== this.config[key]) {
  5235. config[key] = this.config[key];
  5236. }
  5237. }
  5238. }
  5239. return config;
  5240. };
  5241. _proto._cleanTipClass = function _cleanTipClass() {
  5242. var $tip = $(this.getTipElement());
  5243. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5244. if (tabClass !== null && tabClass.length) {
  5245. $tip.removeClass(tabClass.join(''));
  5246. }
  5247. };
  5248. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5249. var popperInstance = popperData.instance;
  5250. this.tip = popperInstance.popper;
  5251. this._cleanTipClass();
  5252. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5253. };
  5254. _proto._fixTransition = function _fixTransition() {
  5255. var tip = this.getTipElement();
  5256. var initConfigAnimation = this.config.animation;
  5257. if (tip.getAttribute('x-placement') !== null) {
  5258. return;
  5259. }
  5260. $(tip).removeClass(ClassName$6.FADE);
  5261. this.config.animation = false;
  5262. this.hide();
  5263. this.show();
  5264. this.config.animation = initConfigAnimation;
  5265. } // Static
  5266. ;
  5267. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5268. return this.each(function () {
  5269. var data = $(this).data(DATA_KEY$6);
  5270. var _config = typeof config === 'object' && config;
  5271. if (!data && /dispose|hide/.test(config)) {
  5272. return;
  5273. }
  5274. if (!data) {
  5275. data = new Tooltip(this, _config);
  5276. $(this).data(DATA_KEY$6, data);
  5277. }
  5278. if (typeof config === 'string') {
  5279. if (typeof data[config] === 'undefined') {
  5280. throw new TypeError("No method named \"" + config + "\"");
  5281. }
  5282. data[config]();
  5283. }
  5284. });
  5285. };
  5286. _createClass(Tooltip, null, [{
  5287. key: "VERSION",
  5288. get: function get() {
  5289. return VERSION$6;
  5290. }
  5291. }, {
  5292. key: "Default",
  5293. get: function get() {
  5294. return Default$4;
  5295. }
  5296. }, {
  5297. key: "NAME",
  5298. get: function get() {
  5299. return NAME$6;
  5300. }
  5301. }, {
  5302. key: "DATA_KEY",
  5303. get: function get() {
  5304. return DATA_KEY$6;
  5305. }
  5306. }, {
  5307. key: "Event",
  5308. get: function get() {
  5309. return Event$6;
  5310. }
  5311. }, {
  5312. key: "EVENT_KEY",
  5313. get: function get() {
  5314. return EVENT_KEY$6;
  5315. }
  5316. }, {
  5317. key: "DefaultType",
  5318. get: function get() {
  5319. return DefaultType$4;
  5320. }
  5321. }]);
  5322. return Tooltip;
  5323. }();
  5324. /**
  5325. * ------------------------------------------------------------------------
  5326. * jQuery
  5327. * ------------------------------------------------------------------------
  5328. */
  5329. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5330. $.fn[NAME$6].Constructor = Tooltip;
  5331. $.fn[NAME$6].noConflict = function () {
  5332. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5333. return Tooltip._jQueryInterface;
  5334. };
  5335. /**
  5336. * ------------------------------------------------------------------------
  5337. * Constants
  5338. * ------------------------------------------------------------------------
  5339. */
  5340. var NAME$7 = 'popover';
  5341. var VERSION$7 = '4.4.1';
  5342. var DATA_KEY$7 = 'bs.popover';
  5343. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5344. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5345. var CLASS_PREFIX$1 = 'bs-popover';
  5346. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5347. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5348. placement: 'right',
  5349. trigger: 'click',
  5350. content: '',
  5351. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5352. });
  5353. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5354. content: '(string|element|function)'
  5355. });
  5356. var ClassName$7 = {
  5357. FADE: 'fade',
  5358. SHOW: 'show'
  5359. };
  5360. var Selector$7 = {
  5361. TITLE: '.popover-header',
  5362. CONTENT: '.popover-body'
  5363. };
  5364. var Event$7 = {
  5365. HIDE: "hide" + EVENT_KEY$7,
  5366. HIDDEN: "hidden" + EVENT_KEY$7,
  5367. SHOW: "show" + EVENT_KEY$7,
  5368. SHOWN: "shown" + EVENT_KEY$7,
  5369. INSERTED: "inserted" + EVENT_KEY$7,
  5370. CLICK: "click" + EVENT_KEY$7,
  5371. FOCUSIN: "focusin" + EVENT_KEY$7,
  5372. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5373. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5374. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5375. };
  5376. /**
  5377. * ------------------------------------------------------------------------
  5378. * Class Definition
  5379. * ------------------------------------------------------------------------
  5380. */
  5381. var Popover =
  5382. /*#__PURE__*/
  5383. function (_Tooltip) {
  5384. _inheritsLoose(Popover, _Tooltip);
  5385. function Popover() {
  5386. return _Tooltip.apply(this, arguments) || this;
  5387. }
  5388. var _proto = Popover.prototype;
  5389. // Overrides
  5390. _proto.isWithContent = function isWithContent() {
  5391. return this.getTitle() || this._getContent();
  5392. };
  5393. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5394. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5395. };
  5396. _proto.getTipElement = function getTipElement() {
  5397. this.tip = this.tip || $(this.config.template)[0];
  5398. return this.tip;
  5399. };
  5400. _proto.setContent = function setContent() {
  5401. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5402. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5403. var content = this._getContent();
  5404. if (typeof content === 'function') {
  5405. content = content.call(this.element);
  5406. }
  5407. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5408. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5409. } // Private
  5410. ;
  5411. _proto._getContent = function _getContent() {
  5412. return this.element.getAttribute('data-content') || this.config.content;
  5413. };
  5414. _proto._cleanTipClass = function _cleanTipClass() {
  5415. var $tip = $(this.getTipElement());
  5416. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5417. if (tabClass !== null && tabClass.length > 0) {
  5418. $tip.removeClass(tabClass.join(''));
  5419. }
  5420. } // Static
  5421. ;
  5422. Popover._jQueryInterface = function _jQueryInterface(config) {
  5423. return this.each(function () {
  5424. var data = $(this).data(DATA_KEY$7);
  5425. var _config = typeof config === 'object' ? config : null;
  5426. if (!data && /dispose|hide/.test(config)) {
  5427. return;
  5428. }
  5429. if (!data) {
  5430. data = new Popover(this, _config);
  5431. $(this).data(DATA_KEY$7, data);
  5432. }
  5433. if (typeof config === 'string') {
  5434. if (typeof data[config] === 'undefined') {
  5435. throw new TypeError("No method named \"" + config + "\"");
  5436. }
  5437. data[config]();
  5438. }
  5439. });
  5440. };
  5441. _createClass(Popover, null, [{
  5442. key: "VERSION",
  5443. // Getters
  5444. get: function get() {
  5445. return VERSION$7;
  5446. }
  5447. }, {
  5448. key: "Default",
  5449. get: function get() {
  5450. return Default$5;
  5451. }
  5452. }, {
  5453. key: "NAME",
  5454. get: function get() {
  5455. return NAME$7;
  5456. }
  5457. }, {
  5458. key: "DATA_KEY",
  5459. get: function get() {
  5460. return DATA_KEY$7;
  5461. }
  5462. }, {
  5463. key: "Event",
  5464. get: function get() {
  5465. return Event$7;
  5466. }
  5467. }, {
  5468. key: "EVENT_KEY",
  5469. get: function get() {
  5470. return EVENT_KEY$7;
  5471. }
  5472. }, {
  5473. key: "DefaultType",
  5474. get: function get() {
  5475. return DefaultType$5;
  5476. }
  5477. }]);
  5478. return Popover;
  5479. }(Tooltip);
  5480. /**
  5481. * ------------------------------------------------------------------------
  5482. * jQuery
  5483. * ------------------------------------------------------------------------
  5484. */
  5485. $.fn[NAME$7] = Popover._jQueryInterface;
  5486. $.fn[NAME$7].Constructor = Popover;
  5487. $.fn[NAME$7].noConflict = function () {
  5488. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5489. return Popover._jQueryInterface;
  5490. };
  5491. /**
  5492. * ------------------------------------------------------------------------
  5493. * Constants
  5494. * ------------------------------------------------------------------------
  5495. */
  5496. var NAME$8 = 'scrollspy';
  5497. var VERSION$8 = '4.4.1';
  5498. var DATA_KEY$8 = 'bs.scrollspy';
  5499. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5500. var DATA_API_KEY$6 = '.data-api';
  5501. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5502. var Default$6 = {
  5503. offset: 10,
  5504. method: 'auto',
  5505. target: ''
  5506. };
  5507. var DefaultType$6 = {
  5508. offset: 'number',
  5509. method: 'string',
  5510. target: '(string|element)'
  5511. };
  5512. var Event$8 = {
  5513. ACTIVATE: "activate" + EVENT_KEY$8,
  5514. SCROLL: "scroll" + EVENT_KEY$8,
  5515. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5516. };
  5517. var ClassName$8 = {
  5518. DROPDOWN_ITEM: 'dropdown-item',
  5519. DROPDOWN_MENU: 'dropdown-menu',
  5520. ACTIVE: 'active'
  5521. };
  5522. var Selector$8 = {
  5523. DATA_SPY: '[data-spy="scroll"]',
  5524. ACTIVE: '.active',
  5525. NAV_LIST_GROUP: '.nav, .list-group',
  5526. NAV_LINKS: '.nav-link',
  5527. NAV_ITEMS: '.nav-item',
  5528. LIST_ITEMS: '.list-group-item',
  5529. DROPDOWN: '.dropdown',
  5530. DROPDOWN_ITEMS: '.dropdown-item',
  5531. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5532. };
  5533. var OffsetMethod = {
  5534. OFFSET: 'offset',
  5535. POSITION: 'position'
  5536. };
  5537. /**
  5538. * ------------------------------------------------------------------------
  5539. * Class Definition
  5540. * ------------------------------------------------------------------------
  5541. */
  5542. var ScrollSpy =
  5543. /*#__PURE__*/
  5544. function () {
  5545. function ScrollSpy(element, config) {
  5546. var _this = this;
  5547. this._element = element;
  5548. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5549. this._config = this._getConfig(config);
  5550. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5551. this._offsets = [];
  5552. this._targets = [];
  5553. this._activeTarget = null;
  5554. this._scrollHeight = 0;
  5555. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5556. return _this._process(event);
  5557. });
  5558. this.refresh();
  5559. this._process();
  5560. } // Getters
  5561. var _proto = ScrollSpy.prototype;
  5562. // Public
  5563. _proto.refresh = function refresh() {
  5564. var _this2 = this;
  5565. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5566. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5567. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5568. this._offsets = [];
  5569. this._targets = [];
  5570. this._scrollHeight = this._getScrollHeight();
  5571. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5572. targets.map(function (element) {
  5573. var target;
  5574. var targetSelector = Util.getSelectorFromElement(element);
  5575. if (targetSelector) {
  5576. target = document.querySelector(targetSelector);
  5577. }
  5578. if (target) {
  5579. var targetBCR = target.getBoundingClientRect();
  5580. if (targetBCR.width || targetBCR.height) {
  5581. // TODO (fat): remove sketch reliance on jQuery position/offset
  5582. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5583. }
  5584. }
  5585. return null;
  5586. }).filter(function (item) {
  5587. return item;
  5588. }).sort(function (a, b) {
  5589. return a[0] - b[0];
  5590. }).forEach(function (item) {
  5591. _this2._offsets.push(item[0]);
  5592. _this2._targets.push(item[1]);
  5593. });
  5594. };
  5595. _proto.dispose = function dispose() {
  5596. $.removeData(this._element, DATA_KEY$8);
  5597. $(this._scrollElement).off(EVENT_KEY$8);
  5598. this._element = null;
  5599. this._scrollElement = null;
  5600. this._config = null;
  5601. this._selector = null;
  5602. this._offsets = null;
  5603. this._targets = null;
  5604. this._activeTarget = null;
  5605. this._scrollHeight = null;
  5606. } // Private
  5607. ;
  5608. _proto._getConfig = function _getConfig(config) {
  5609. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5610. if (typeof config.target !== 'string') {
  5611. var id = $(config.target).attr('id');
  5612. if (!id) {
  5613. id = Util.getUID(NAME$8);
  5614. $(config.target).attr('id', id);
  5615. }
  5616. config.target = "#" + id;
  5617. }
  5618. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5619. return config;
  5620. };
  5621. _proto._getScrollTop = function _getScrollTop() {
  5622. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5623. };
  5624. _proto._getScrollHeight = function _getScrollHeight() {
  5625. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5626. };
  5627. _proto._getOffsetHeight = function _getOffsetHeight() {
  5628. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5629. };
  5630. _proto._process = function _process() {
  5631. var scrollTop = this._getScrollTop() + this._config.offset;
  5632. var scrollHeight = this._getScrollHeight();
  5633. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5634. if (this._scrollHeight !== scrollHeight) {
  5635. this.refresh();
  5636. }
  5637. if (scrollTop >= maxScroll) {
  5638. var target = this._targets[this._targets.length - 1];
  5639. if (this._activeTarget !== target) {
  5640. this._activate(target);
  5641. }
  5642. return;
  5643. }
  5644. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5645. this._activeTarget = null;
  5646. this._clear();
  5647. return;
  5648. }
  5649. var offsetLength = this._offsets.length;
  5650. for (var i = offsetLength; i--;) {
  5651. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5652. if (isActiveTarget) {
  5653. this._activate(this._targets[i]);
  5654. }
  5655. }
  5656. };
  5657. _proto._activate = function _activate(target) {
  5658. this._activeTarget = target;
  5659. this._clear();
  5660. var queries = this._selector.split(',').map(function (selector) {
  5661. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5662. });
  5663. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5664. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5665. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5666. $link.addClass(ClassName$8.ACTIVE);
  5667. } else {
  5668. // Set triggered link as active
  5669. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5670. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5671. $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
  5672. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5673. }
  5674. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5675. relatedTarget: target
  5676. });
  5677. };
  5678. _proto._clear = function _clear() {
  5679. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5680. return node.classList.contains(ClassName$8.ACTIVE);
  5681. }).forEach(function (node) {
  5682. return node.classList.remove(ClassName$8.ACTIVE);
  5683. });
  5684. } // Static
  5685. ;
  5686. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5687. return this.each(function () {
  5688. var data = $(this).data(DATA_KEY$8);
  5689. var _config = typeof config === 'object' && config;
  5690. if (!data) {
  5691. data = new ScrollSpy(this, _config);
  5692. $(this).data(DATA_KEY$8, data);
  5693. }
  5694. if (typeof config === 'string') {
  5695. if (typeof data[config] === 'undefined') {
  5696. throw new TypeError("No method named \"" + config + "\"");
  5697. }
  5698. data[config]();
  5699. }
  5700. });
  5701. };
  5702. _createClass(ScrollSpy, null, [{
  5703. key: "VERSION",
  5704. get: function get() {
  5705. return VERSION$8;
  5706. }
  5707. }, {
  5708. key: "Default",
  5709. get: function get() {
  5710. return Default$6;
  5711. }
  5712. }]);
  5713. return ScrollSpy;
  5714. }();
  5715. /**
  5716. * ------------------------------------------------------------------------
  5717. * Data Api implementation
  5718. * ------------------------------------------------------------------------
  5719. */
  5720. $(window).on(Event$8.LOAD_DATA_API, function () {
  5721. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5722. var scrollSpysLength = scrollSpys.length;
  5723. for (var i = scrollSpysLength; i--;) {
  5724. var $spy = $(scrollSpys[i]);
  5725. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5726. }
  5727. });
  5728. /**
  5729. * ------------------------------------------------------------------------
  5730. * jQuery
  5731. * ------------------------------------------------------------------------
  5732. */
  5733. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5734. $.fn[NAME$8].Constructor = ScrollSpy;
  5735. $.fn[NAME$8].noConflict = function () {
  5736. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5737. return ScrollSpy._jQueryInterface;
  5738. };
  5739. /**
  5740. * ------------------------------------------------------------------------
  5741. * Constants
  5742. * ------------------------------------------------------------------------
  5743. */
  5744. var NAME$9 = 'tab';
  5745. var VERSION$9 = '4.4.1';
  5746. var DATA_KEY$9 = 'bs.tab';
  5747. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5748. var DATA_API_KEY$7 = '.data-api';
  5749. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5750. var Event$9 = {
  5751. HIDE: "hide" + EVENT_KEY$9,
  5752. HIDDEN: "hidden" + EVENT_KEY$9,
  5753. SHOW: "show" + EVENT_KEY$9,
  5754. SHOWN: "shown" + EVENT_KEY$9,
  5755. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5756. };
  5757. var ClassName$9 = {
  5758. DROPDOWN_MENU: 'dropdown-menu',
  5759. ACTIVE: 'active',
  5760. DISABLED: 'disabled',
  5761. FADE: 'fade',
  5762. SHOW: 'show'
  5763. };
  5764. var Selector$9 = {
  5765. DROPDOWN: '.dropdown',
  5766. NAV_LIST_GROUP: '.nav, .list-group',
  5767. ACTIVE: '.active',
  5768. ACTIVE_UL: '> li > .active',
  5769. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5770. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5771. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5772. };
  5773. /**
  5774. * ------------------------------------------------------------------------
  5775. * Class Definition
  5776. * ------------------------------------------------------------------------
  5777. */
  5778. var Tab =
  5779. /*#__PURE__*/
  5780. function () {
  5781. function Tab(element) {
  5782. this._element = element;
  5783. } // Getters
  5784. var _proto = Tab.prototype;
  5785. // Public
  5786. _proto.show = function show() {
  5787. var _this = this;
  5788. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5789. return;
  5790. }
  5791. var target;
  5792. var previous;
  5793. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5794. var selector = Util.getSelectorFromElement(this._element);
  5795. if (listElement) {
  5796. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5797. previous = $.makeArray($(listElement).find(itemSelector));
  5798. previous = previous[previous.length - 1];
  5799. }
  5800. var hideEvent = $.Event(Event$9.HIDE, {
  5801. relatedTarget: this._element
  5802. });
  5803. var showEvent = $.Event(Event$9.SHOW, {
  5804. relatedTarget: previous
  5805. });
  5806. if (previous) {
  5807. $(previous).trigger(hideEvent);
  5808. }
  5809. $(this._element).trigger(showEvent);
  5810. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5811. return;
  5812. }
  5813. if (selector) {
  5814. target = document.querySelector(selector);
  5815. }
  5816. this._activate(this._element, listElement);
  5817. var complete = function complete() {
  5818. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5819. relatedTarget: _this._element
  5820. });
  5821. var shownEvent = $.Event(Event$9.SHOWN, {
  5822. relatedTarget: previous
  5823. });
  5824. $(previous).trigger(hiddenEvent);
  5825. $(_this._element).trigger(shownEvent);
  5826. };
  5827. if (target) {
  5828. this._activate(target, target.parentNode, complete);
  5829. } else {
  5830. complete();
  5831. }
  5832. };
  5833. _proto.dispose = function dispose() {
  5834. $.removeData(this._element, DATA_KEY$9);
  5835. this._element = null;
  5836. } // Private
  5837. ;
  5838. _proto._activate = function _activate(element, container, callback) {
  5839. var _this2 = this;
  5840. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5841. var active = activeElements[0];
  5842. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5843. var complete = function complete() {
  5844. return _this2._transitionComplete(element, active, callback);
  5845. };
  5846. if (active && isTransitioning) {
  5847. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5848. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5849. } else {
  5850. complete();
  5851. }
  5852. };
  5853. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5854. if (active) {
  5855. $(active).removeClass(ClassName$9.ACTIVE);
  5856. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5857. if (dropdownChild) {
  5858. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5859. }
  5860. if (active.getAttribute('role') === 'tab') {
  5861. active.setAttribute('aria-selected', false);
  5862. }
  5863. }
  5864. $(element).addClass(ClassName$9.ACTIVE);
  5865. if (element.getAttribute('role') === 'tab') {
  5866. element.setAttribute('aria-selected', true);
  5867. }
  5868. Util.reflow(element);
  5869. if (element.classList.contains(ClassName$9.FADE)) {
  5870. element.classList.add(ClassName$9.SHOW);
  5871. }
  5872. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5873. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5874. if (dropdownElement) {
  5875. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5876. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5877. }
  5878. element.setAttribute('aria-expanded', true);
  5879. }
  5880. if (callback) {
  5881. callback();
  5882. }
  5883. } // Static
  5884. ;
  5885. Tab._jQueryInterface = function _jQueryInterface(config) {
  5886. return this.each(function () {
  5887. var $this = $(this);
  5888. var data = $this.data(DATA_KEY$9);
  5889. if (!data) {
  5890. data = new Tab(this);
  5891. $this.data(DATA_KEY$9, data);
  5892. }
  5893. if (typeof config === 'string') {
  5894. if (typeof data[config] === 'undefined') {
  5895. throw new TypeError("No method named \"" + config + "\"");
  5896. }
  5897. data[config]();
  5898. }
  5899. });
  5900. };
  5901. _createClass(Tab, null, [{
  5902. key: "VERSION",
  5903. get: function get() {
  5904. return VERSION$9;
  5905. }
  5906. }]);
  5907. return Tab;
  5908. }();
  5909. /**
  5910. * ------------------------------------------------------------------------
  5911. * Data Api implementation
  5912. * ------------------------------------------------------------------------
  5913. */
  5914. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5915. event.preventDefault();
  5916. Tab._jQueryInterface.call($(this), 'show');
  5917. });
  5918. /**
  5919. * ------------------------------------------------------------------------
  5920. * jQuery
  5921. * ------------------------------------------------------------------------
  5922. */
  5923. $.fn[NAME$9] = Tab._jQueryInterface;
  5924. $.fn[NAME$9].Constructor = Tab;
  5925. $.fn[NAME$9].noConflict = function () {
  5926. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5927. return Tab._jQueryInterface;
  5928. };
  5929. /**
  5930. * ------------------------------------------------------------------------
  5931. * Constants
  5932. * ------------------------------------------------------------------------
  5933. */
  5934. var NAME$a = 'toast';
  5935. var VERSION$a = '4.4.1';
  5936. var DATA_KEY$a = 'bs.toast';
  5937. var EVENT_KEY$a = "." + DATA_KEY$a;
  5938. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5939. var Event$a = {
  5940. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5941. HIDE: "hide" + EVENT_KEY$a,
  5942. HIDDEN: "hidden" + EVENT_KEY$a,
  5943. SHOW: "show" + EVENT_KEY$a,
  5944. SHOWN: "shown" + EVENT_KEY$a
  5945. };
  5946. var ClassName$a = {
  5947. FADE: 'fade',
  5948. HIDE: 'hide',
  5949. SHOW: 'show',
  5950. SHOWING: 'showing'
  5951. };
  5952. var DefaultType$7 = {
  5953. animation: 'boolean',
  5954. autohide: 'boolean',
  5955. delay: 'number'
  5956. };
  5957. var Default$7 = {
  5958. animation: true,
  5959. autohide: true,
  5960. delay: 500
  5961. };
  5962. var Selector$a = {
  5963. DATA_DISMISS: '[data-dismiss="toast"]'
  5964. };
  5965. /**
  5966. * ------------------------------------------------------------------------
  5967. * Class Definition
  5968. * ------------------------------------------------------------------------
  5969. */
  5970. var Toast =
  5971. /*#__PURE__*/
  5972. function () {
  5973. function Toast(element, config) {
  5974. this._element = element;
  5975. this._config = this._getConfig(config);
  5976. this._timeout = null;
  5977. this._setListeners();
  5978. } // Getters
  5979. var _proto = Toast.prototype;
  5980. // Public
  5981. _proto.show = function show() {
  5982. var _this = this;
  5983. var showEvent = $.Event(Event$a.SHOW);
  5984. $(this._element).trigger(showEvent);
  5985. if (showEvent.isDefaultPrevented()) {
  5986. return;
  5987. }
  5988. if (this._config.animation) {
  5989. this._element.classList.add(ClassName$a.FADE);
  5990. }
  5991. var complete = function complete() {
  5992. _this._element.classList.remove(ClassName$a.SHOWING);
  5993. _this._element.classList.add(ClassName$a.SHOW);
  5994. $(_this._element).trigger(Event$a.SHOWN);
  5995. if (_this._config.autohide) {
  5996. _this._timeout = setTimeout(function () {
  5997. _this.hide();
  5998. }, _this._config.delay);
  5999. }
  6000. };
  6001. this._element.classList.remove(ClassName$a.HIDE);
  6002. Util.reflow(this._element);
  6003. this._element.classList.add(ClassName$a.SHOWING);
  6004. if (this._config.animation) {
  6005. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6006. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6007. } else {
  6008. complete();
  6009. }
  6010. };
  6011. _proto.hide = function hide() {
  6012. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6013. return;
  6014. }
  6015. var hideEvent = $.Event(Event$a.HIDE);
  6016. $(this._element).trigger(hideEvent);
  6017. if (hideEvent.isDefaultPrevented()) {
  6018. return;
  6019. }
  6020. this._close();
  6021. };
  6022. _proto.dispose = function dispose() {
  6023. clearTimeout(this._timeout);
  6024. this._timeout = null;
  6025. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6026. this._element.classList.remove(ClassName$a.SHOW);
  6027. }
  6028. $(this._element).off(Event$a.CLICK_DISMISS);
  6029. $.removeData(this._element, DATA_KEY$a);
  6030. this._element = null;
  6031. this._config = null;
  6032. } // Private
  6033. ;
  6034. _proto._getConfig = function _getConfig(config) {
  6035. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6036. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6037. return config;
  6038. };
  6039. _proto._setListeners = function _setListeners() {
  6040. var _this2 = this;
  6041. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6042. return _this2.hide();
  6043. });
  6044. };
  6045. _proto._close = function _close() {
  6046. var _this3 = this;
  6047. var complete = function complete() {
  6048. _this3._element.classList.add(ClassName$a.HIDE);
  6049. $(_this3._element).trigger(Event$a.HIDDEN);
  6050. };
  6051. this._element.classList.remove(ClassName$a.SHOW);
  6052. if (this._config.animation) {
  6053. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6054. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6055. } else {
  6056. complete();
  6057. }
  6058. } // Static
  6059. ;
  6060. Toast._jQueryInterface = function _jQueryInterface(config) {
  6061. return this.each(function () {
  6062. var $element = $(this);
  6063. var data = $element.data(DATA_KEY$a);
  6064. var _config = typeof config === 'object' && config;
  6065. if (!data) {
  6066. data = new Toast(this, _config);
  6067. $element.data(DATA_KEY$a, data);
  6068. }
  6069. if (typeof config === 'string') {
  6070. if (typeof data[config] === 'undefined') {
  6071. throw new TypeError("No method named \"" + config + "\"");
  6072. }
  6073. data[config](this);
  6074. }
  6075. });
  6076. };
  6077. _createClass(Toast, null, [{
  6078. key: "VERSION",
  6079. get: function get() {
  6080. return VERSION$a;
  6081. }
  6082. }, {
  6083. key: "DefaultType",
  6084. get: function get() {
  6085. return DefaultType$7;
  6086. }
  6087. }, {
  6088. key: "Default",
  6089. get: function get() {
  6090. return Default$7;
  6091. }
  6092. }]);
  6093. return Toast;
  6094. }();
  6095. /**
  6096. * ------------------------------------------------------------------------
  6097. * jQuery
  6098. * ------------------------------------------------------------------------
  6099. */
  6100. $.fn[NAME$a] = Toast._jQueryInterface;
  6101. $.fn[NAME$a].Constructor = Toast;
  6102. $.fn[NAME$a].noConflict = function () {
  6103. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6104. return Toast._jQueryInterface;
  6105. };
  6106. exports.Alert = Alert;
  6107. exports.Button = Button;
  6108. exports.Carousel = Carousel;
  6109. exports.Collapse = Collapse;
  6110. exports.Dropdown = Dropdown;
  6111. exports.Modal = Modal;
  6112. exports.Popover = Popover;
  6113. exports.Scrollspy = ScrollSpy;
  6114. exports.Tab = Tab;
  6115. exports.Toast = Toast;
  6116. exports.Tooltip = Tooltip;
  6117. exports.Util = Util;
  6118. Object.defineProperty(exports, '__esModule', { value: true });
  6119. })));
  6120. //# sourceMappingURL=bootstrap.js.map
  6121. /***/ }),
  6122. /***/ "./node_modules/buffer/index.js":
  6123. /*!**************************************!*\
  6124. !*** ./node_modules/buffer/index.js ***!
  6125. \**************************************/
  6126. /*! no static exports found */
  6127. /***/ (function(module, exports, __webpack_require__) {
  6128. "use strict";
  6129. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6130. * The buffer module from node.js, for the browser.
  6131. *
  6132. * @author Feross Aboukhadijeh <http://feross.org>
  6133. * @license MIT
  6134. */
  6135. /* eslint-disable no-proto */
  6136. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6137. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6138. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6139. exports.Buffer = Buffer
  6140. exports.SlowBuffer = SlowBuffer
  6141. exports.INSPECT_MAX_BYTES = 50
  6142. /**
  6143. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6144. * === true Use Uint8Array implementation (fastest)
  6145. * === false Use Object implementation (most compatible, even IE6)
  6146. *
  6147. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6148. * Opera 11.6+, iOS 4.2+.
  6149. *
  6150. * Due to various browser bugs, sometimes the Object implementation will be used even
  6151. * when the browser supports typed arrays.
  6152. *
  6153. * Note:
  6154. *
  6155. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6156. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6157. *
  6158. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6159. *
  6160. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6161. * incorrect length in some situations.
  6162. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6163. * get the Object implementation, which is slower but behaves correctly.
  6164. */
  6165. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6166. ? global.TYPED_ARRAY_SUPPORT
  6167. : typedArraySupport()
  6168. /*
  6169. * Export kMaxLength after typed array support is determined.
  6170. */
  6171. exports.kMaxLength = kMaxLength()
  6172. function typedArraySupport () {
  6173. try {
  6174. var arr = new Uint8Array(1)
  6175. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6176. return arr.foo() === 42 && // typed array instances can be augmented
  6177. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6178. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6179. } catch (e) {
  6180. return false
  6181. }
  6182. }
  6183. function kMaxLength () {
  6184. return Buffer.TYPED_ARRAY_SUPPORT
  6185. ? 0x7fffffff
  6186. : 0x3fffffff
  6187. }
  6188. function createBuffer (that, length) {
  6189. if (kMaxLength() < length) {
  6190. throw new RangeError('Invalid typed array length')
  6191. }
  6192. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6193. // Return an augmented `Uint8Array` instance, for best performance
  6194. that = new Uint8Array(length)
  6195. that.__proto__ = Buffer.prototype
  6196. } else {
  6197. // Fallback: Return an object instance of the Buffer class
  6198. if (that === null) {
  6199. that = new Buffer(length)
  6200. }
  6201. that.length = length
  6202. }
  6203. return that
  6204. }
  6205. /**
  6206. * The Buffer constructor returns instances of `Uint8Array` that have their
  6207. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6208. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6209. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6210. * returns a single octet.
  6211. *
  6212. * The `Uint8Array` prototype remains unmodified.
  6213. */
  6214. function Buffer (arg, encodingOrOffset, length) {
  6215. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6216. return new Buffer(arg, encodingOrOffset, length)
  6217. }
  6218. // Common case.
  6219. if (typeof arg === 'number') {
  6220. if (typeof encodingOrOffset === 'string') {
  6221. throw new Error(
  6222. 'If encoding is specified then the first argument must be a string'
  6223. )
  6224. }
  6225. return allocUnsafe(this, arg)
  6226. }
  6227. return from(this, arg, encodingOrOffset, length)
  6228. }
  6229. Buffer.poolSize = 8192 // not used by this implementation
  6230. // TODO: Legacy, not needed anymore. Remove in next major version.
  6231. Buffer._augment = function (arr) {
  6232. arr.__proto__ = Buffer.prototype
  6233. return arr
  6234. }
  6235. function from (that, value, encodingOrOffset, length) {
  6236. if (typeof value === 'number') {
  6237. throw new TypeError('"value" argument must not be a number')
  6238. }
  6239. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6240. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6241. }
  6242. if (typeof value === 'string') {
  6243. return fromString(that, value, encodingOrOffset)
  6244. }
  6245. return fromObject(that, value)
  6246. }
  6247. /**
  6248. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6249. * if value is a number.
  6250. * Buffer.from(str[, encoding])
  6251. * Buffer.from(array)
  6252. * Buffer.from(buffer)
  6253. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6254. **/
  6255. Buffer.from = function (value, encodingOrOffset, length) {
  6256. return from(null, value, encodingOrOffset, length)
  6257. }
  6258. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6259. Buffer.prototype.__proto__ = Uint8Array.prototype
  6260. Buffer.__proto__ = Uint8Array
  6261. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6262. Buffer[Symbol.species] === Buffer) {
  6263. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6264. Object.defineProperty(Buffer, Symbol.species, {
  6265. value: null,
  6266. configurable: true
  6267. })
  6268. }
  6269. }
  6270. function assertSize (size) {
  6271. if (typeof size !== 'number') {
  6272. throw new TypeError('"size" argument must be a number')
  6273. } else if (size < 0) {
  6274. throw new RangeError('"size" argument must not be negative')
  6275. }
  6276. }
  6277. function alloc (that, size, fill, encoding) {
  6278. assertSize(size)
  6279. if (size <= 0) {
  6280. return createBuffer(that, size)
  6281. }
  6282. if (fill !== undefined) {
  6283. // Only pay attention to encoding if it's a string. This
  6284. // prevents accidentally sending in a number that would
  6285. // be interpretted as a start offset.
  6286. return typeof encoding === 'string'
  6287. ? createBuffer(that, size).fill(fill, encoding)
  6288. : createBuffer(that, size).fill(fill)
  6289. }
  6290. return createBuffer(that, size)
  6291. }
  6292. /**
  6293. * Creates a new filled Buffer instance.
  6294. * alloc(size[, fill[, encoding]])
  6295. **/
  6296. Buffer.alloc = function (size, fill, encoding) {
  6297. return alloc(null, size, fill, encoding)
  6298. }
  6299. function allocUnsafe (that, size) {
  6300. assertSize(size)
  6301. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6302. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6303. for (var i = 0; i < size; ++i) {
  6304. that[i] = 0
  6305. }
  6306. }
  6307. return that
  6308. }
  6309. /**
  6310. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6311. * */
  6312. Buffer.allocUnsafe = function (size) {
  6313. return allocUnsafe(null, size)
  6314. }
  6315. /**
  6316. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6317. */
  6318. Buffer.allocUnsafeSlow = function (size) {
  6319. return allocUnsafe(null, size)
  6320. }
  6321. function fromString (that, string, encoding) {
  6322. if (typeof encoding !== 'string' || encoding === '') {
  6323. encoding = 'utf8'
  6324. }
  6325. if (!Buffer.isEncoding(encoding)) {
  6326. throw new TypeError('"encoding" must be a valid string encoding')
  6327. }
  6328. var length = byteLength(string, encoding) | 0
  6329. that = createBuffer(that, length)
  6330. var actual = that.write(string, encoding)
  6331. if (actual !== length) {
  6332. // Writing a hex string, for example, that contains invalid characters will
  6333. // cause everything after the first invalid character to be ignored. (e.g.
  6334. // 'abxxcd' will be treated as 'ab')
  6335. that = that.slice(0, actual)
  6336. }
  6337. return that
  6338. }
  6339. function fromArrayLike (that, array) {
  6340. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6341. that = createBuffer(that, length)
  6342. for (var i = 0; i < length; i += 1) {
  6343. that[i] = array[i] & 255
  6344. }
  6345. return that
  6346. }
  6347. function fromArrayBuffer (that, array, byteOffset, length) {
  6348. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6349. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6350. throw new RangeError('\'offset\' is out of bounds')
  6351. }
  6352. if (array.byteLength < byteOffset + (length || 0)) {
  6353. throw new RangeError('\'length\' is out of bounds')
  6354. }
  6355. if (byteOffset === undefined && length === undefined) {
  6356. array = new Uint8Array(array)
  6357. } else if (length === undefined) {
  6358. array = new Uint8Array(array, byteOffset)
  6359. } else {
  6360. array = new Uint8Array(array, byteOffset, length)
  6361. }
  6362. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6363. // Return an augmented `Uint8Array` instance, for best performance
  6364. that = array
  6365. that.__proto__ = Buffer.prototype
  6366. } else {
  6367. // Fallback: Return an object instance of the Buffer class
  6368. that = fromArrayLike(that, array)
  6369. }
  6370. return that
  6371. }
  6372. function fromObject (that, obj) {
  6373. if (Buffer.isBuffer(obj)) {
  6374. var len = checked(obj.length) | 0
  6375. that = createBuffer(that, len)
  6376. if (that.length === 0) {
  6377. return that
  6378. }
  6379. obj.copy(that, 0, 0, len)
  6380. return that
  6381. }
  6382. if (obj) {
  6383. if ((typeof ArrayBuffer !== 'undefined' &&
  6384. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6385. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6386. return createBuffer(that, 0)
  6387. }
  6388. return fromArrayLike(that, obj)
  6389. }
  6390. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6391. return fromArrayLike(that, obj.data)
  6392. }
  6393. }
  6394. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6395. }
  6396. function checked (length) {
  6397. // Note: cannot use `length < kMaxLength()` here because that fails when
  6398. // length is NaN (which is otherwise coerced to zero.)
  6399. if (length >= kMaxLength()) {
  6400. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6401. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6402. }
  6403. return length | 0
  6404. }
  6405. function SlowBuffer (length) {
  6406. if (+length != length) { // eslint-disable-line eqeqeq
  6407. length = 0
  6408. }
  6409. return Buffer.alloc(+length)
  6410. }
  6411. Buffer.isBuffer = function isBuffer (b) {
  6412. return !!(b != null && b._isBuffer)
  6413. }
  6414. Buffer.compare = function compare (a, b) {
  6415. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6416. throw new TypeError('Arguments must be Buffers')
  6417. }
  6418. if (a === b) return 0
  6419. var x = a.length
  6420. var y = b.length
  6421. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6422. if (a[i] !== b[i]) {
  6423. x = a[i]
  6424. y = b[i]
  6425. break
  6426. }
  6427. }
  6428. if (x < y) return -1
  6429. if (y < x) return 1
  6430. return 0
  6431. }
  6432. Buffer.isEncoding = function isEncoding (encoding) {
  6433. switch (String(encoding).toLowerCase()) {
  6434. case 'hex':
  6435. case 'utf8':
  6436. case 'utf-8':
  6437. case 'ascii':
  6438. case 'latin1':
  6439. case 'binary':
  6440. case 'base64':
  6441. case 'ucs2':
  6442. case 'ucs-2':
  6443. case 'utf16le':
  6444. case 'utf-16le':
  6445. return true
  6446. default:
  6447. return false
  6448. }
  6449. }
  6450. Buffer.concat = function concat (list, length) {
  6451. if (!isArray(list)) {
  6452. throw new TypeError('"list" argument must be an Array of Buffers')
  6453. }
  6454. if (list.length === 0) {
  6455. return Buffer.alloc(0)
  6456. }
  6457. var i
  6458. if (length === undefined) {
  6459. length = 0
  6460. for (i = 0; i < list.length; ++i) {
  6461. length += list[i].length
  6462. }
  6463. }
  6464. var buffer = Buffer.allocUnsafe(length)
  6465. var pos = 0
  6466. for (i = 0; i < list.length; ++i) {
  6467. var buf = list[i]
  6468. if (!Buffer.isBuffer(buf)) {
  6469. throw new TypeError('"list" argument must be an Array of Buffers')
  6470. }
  6471. buf.copy(buffer, pos)
  6472. pos += buf.length
  6473. }
  6474. return buffer
  6475. }
  6476. function byteLength (string, encoding) {
  6477. if (Buffer.isBuffer(string)) {
  6478. return string.length
  6479. }
  6480. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6481. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6482. return string.byteLength
  6483. }
  6484. if (typeof string !== 'string') {
  6485. string = '' + string
  6486. }
  6487. var len = string.length
  6488. if (len === 0) return 0
  6489. // Use a for loop to avoid recursion
  6490. var loweredCase = false
  6491. for (;;) {
  6492. switch (encoding) {
  6493. case 'ascii':
  6494. case 'latin1':
  6495. case 'binary':
  6496. return len
  6497. case 'utf8':
  6498. case 'utf-8':
  6499. case undefined:
  6500. return utf8ToBytes(string).length
  6501. case 'ucs2':
  6502. case 'ucs-2':
  6503. case 'utf16le':
  6504. case 'utf-16le':
  6505. return len * 2
  6506. case 'hex':
  6507. return len >>> 1
  6508. case 'base64':
  6509. return base64ToBytes(string).length
  6510. default:
  6511. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6512. encoding = ('' + encoding).toLowerCase()
  6513. loweredCase = true
  6514. }
  6515. }
  6516. }
  6517. Buffer.byteLength = byteLength
  6518. function slowToString (encoding, start, end) {
  6519. var loweredCase = false
  6520. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6521. // property of a typed array.
  6522. // This behaves neither like String nor Uint8Array in that we set start/end
  6523. // to their upper/lower bounds if the value passed is out of range.
  6524. // undefined is handled specially as per ECMA-262 6th Edition,
  6525. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6526. if (start === undefined || start < 0) {
  6527. start = 0
  6528. }
  6529. // Return early if start > this.length. Done here to prevent potential uint32
  6530. // coercion fail below.
  6531. if (start > this.length) {
  6532. return ''
  6533. }
  6534. if (end === undefined || end > this.length) {
  6535. end = this.length
  6536. }
  6537. if (end <= 0) {
  6538. return ''
  6539. }
  6540. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6541. end >>>= 0
  6542. start >>>= 0
  6543. if (end <= start) {
  6544. return ''
  6545. }
  6546. if (!encoding) encoding = 'utf8'
  6547. while (true) {
  6548. switch (encoding) {
  6549. case 'hex':
  6550. return hexSlice(this, start, end)
  6551. case 'utf8':
  6552. case 'utf-8':
  6553. return utf8Slice(this, start, end)
  6554. case 'ascii':
  6555. return asciiSlice(this, start, end)
  6556. case 'latin1':
  6557. case 'binary':
  6558. return latin1Slice(this, start, end)
  6559. case 'base64':
  6560. return base64Slice(this, start, end)
  6561. case 'ucs2':
  6562. case 'ucs-2':
  6563. case 'utf16le':
  6564. case 'utf-16le':
  6565. return utf16leSlice(this, start, end)
  6566. default:
  6567. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6568. encoding = (encoding + '').toLowerCase()
  6569. loweredCase = true
  6570. }
  6571. }
  6572. }
  6573. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6574. // Buffer instances.
  6575. Buffer.prototype._isBuffer = true
  6576. function swap (b, n, m) {
  6577. var i = b[n]
  6578. b[n] = b[m]
  6579. b[m] = i
  6580. }
  6581. Buffer.prototype.swap16 = function swap16 () {
  6582. var len = this.length
  6583. if (len % 2 !== 0) {
  6584. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6585. }
  6586. for (var i = 0; i < len; i += 2) {
  6587. swap(this, i, i + 1)
  6588. }
  6589. return this
  6590. }
  6591. Buffer.prototype.swap32 = function swap32 () {
  6592. var len = this.length
  6593. if (len % 4 !== 0) {
  6594. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6595. }
  6596. for (var i = 0; i < len; i += 4) {
  6597. swap(this, i, i + 3)
  6598. swap(this, i + 1, i + 2)
  6599. }
  6600. return this
  6601. }
  6602. Buffer.prototype.swap64 = function swap64 () {
  6603. var len = this.length
  6604. if (len % 8 !== 0) {
  6605. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6606. }
  6607. for (var i = 0; i < len; i += 8) {
  6608. swap(this, i, i + 7)
  6609. swap(this, i + 1, i + 6)
  6610. swap(this, i + 2, i + 5)
  6611. swap(this, i + 3, i + 4)
  6612. }
  6613. return this
  6614. }
  6615. Buffer.prototype.toString = function toString () {
  6616. var length = this.length | 0
  6617. if (length === 0) return ''
  6618. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6619. return slowToString.apply(this, arguments)
  6620. }
  6621. Buffer.prototype.equals = function equals (b) {
  6622. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6623. if (this === b) return true
  6624. return Buffer.compare(this, b) === 0
  6625. }
  6626. Buffer.prototype.inspect = function inspect () {
  6627. var str = ''
  6628. var max = exports.INSPECT_MAX_BYTES
  6629. if (this.length > 0) {
  6630. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6631. if (this.length > max) str += ' ... '
  6632. }
  6633. return '<Buffer ' + str + '>'
  6634. }
  6635. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6636. if (!Buffer.isBuffer(target)) {
  6637. throw new TypeError('Argument must be a Buffer')
  6638. }
  6639. if (start === undefined) {
  6640. start = 0
  6641. }
  6642. if (end === undefined) {
  6643. end = target ? target.length : 0
  6644. }
  6645. if (thisStart === undefined) {
  6646. thisStart = 0
  6647. }
  6648. if (thisEnd === undefined) {
  6649. thisEnd = this.length
  6650. }
  6651. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6652. throw new RangeError('out of range index')
  6653. }
  6654. if (thisStart >= thisEnd && start >= end) {
  6655. return 0
  6656. }
  6657. if (thisStart >= thisEnd) {
  6658. return -1
  6659. }
  6660. if (start >= end) {
  6661. return 1
  6662. }
  6663. start >>>= 0
  6664. end >>>= 0
  6665. thisStart >>>= 0
  6666. thisEnd >>>= 0
  6667. if (this === target) return 0
  6668. var x = thisEnd - thisStart
  6669. var y = end - start
  6670. var len = Math.min(x, y)
  6671. var thisCopy = this.slice(thisStart, thisEnd)
  6672. var targetCopy = target.slice(start, end)
  6673. for (var i = 0; i < len; ++i) {
  6674. if (thisCopy[i] !== targetCopy[i]) {
  6675. x = thisCopy[i]
  6676. y = targetCopy[i]
  6677. break
  6678. }
  6679. }
  6680. if (x < y) return -1
  6681. if (y < x) return 1
  6682. return 0
  6683. }
  6684. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6685. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6686. //
  6687. // Arguments:
  6688. // - buffer - a Buffer to search
  6689. // - val - a string, Buffer, or number
  6690. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6691. // - encoding - an optional encoding, relevant is val is a string
  6692. // - dir - true for indexOf, false for lastIndexOf
  6693. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6694. // Empty buffer means no match
  6695. if (buffer.length === 0) return -1
  6696. // Normalize byteOffset
  6697. if (typeof byteOffset === 'string') {
  6698. encoding = byteOffset
  6699. byteOffset = 0
  6700. } else if (byteOffset > 0x7fffffff) {
  6701. byteOffset = 0x7fffffff
  6702. } else if (byteOffset < -0x80000000) {
  6703. byteOffset = -0x80000000
  6704. }
  6705. byteOffset = +byteOffset // Coerce to Number.
  6706. if (isNaN(byteOffset)) {
  6707. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6708. byteOffset = dir ? 0 : (buffer.length - 1)
  6709. }
  6710. // Normalize byteOffset: negative offsets start from the end of the buffer
  6711. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6712. if (byteOffset >= buffer.length) {
  6713. if (dir) return -1
  6714. else byteOffset = buffer.length - 1
  6715. } else if (byteOffset < 0) {
  6716. if (dir) byteOffset = 0
  6717. else return -1
  6718. }
  6719. // Normalize val
  6720. if (typeof val === 'string') {
  6721. val = Buffer.from(val, encoding)
  6722. }
  6723. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6724. if (Buffer.isBuffer(val)) {
  6725. // Special case: looking for empty string/buffer always fails
  6726. if (val.length === 0) {
  6727. return -1
  6728. }
  6729. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6730. } else if (typeof val === 'number') {
  6731. val = val & 0xFF // Search for a byte value [0-255]
  6732. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6733. typeof Uint8Array.prototype.indexOf === 'function') {
  6734. if (dir) {
  6735. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6736. } else {
  6737. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6738. }
  6739. }
  6740. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6741. }
  6742. throw new TypeError('val must be string, number or Buffer')
  6743. }
  6744. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6745. var indexSize = 1
  6746. var arrLength = arr.length
  6747. var valLength = val.length
  6748. if (encoding !== undefined) {
  6749. encoding = String(encoding).toLowerCase()
  6750. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6751. encoding === 'utf16le' || encoding === 'utf-16le') {
  6752. if (arr.length < 2 || val.length < 2) {
  6753. return -1
  6754. }
  6755. indexSize = 2
  6756. arrLength /= 2
  6757. valLength /= 2
  6758. byteOffset /= 2
  6759. }
  6760. }
  6761. function read (buf, i) {
  6762. if (indexSize === 1) {
  6763. return buf[i]
  6764. } else {
  6765. return buf.readUInt16BE(i * indexSize)
  6766. }
  6767. }
  6768. var i
  6769. if (dir) {
  6770. var foundIndex = -1
  6771. for (i = byteOffset; i < arrLength; i++) {
  6772. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6773. if (foundIndex === -1) foundIndex = i
  6774. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6775. } else {
  6776. if (foundIndex !== -1) i -= i - foundIndex
  6777. foundIndex = -1
  6778. }
  6779. }
  6780. } else {
  6781. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6782. for (i = byteOffset; i >= 0; i--) {
  6783. var found = true
  6784. for (var j = 0; j < valLength; j++) {
  6785. if (read(arr, i + j) !== read(val, j)) {
  6786. found = false
  6787. break
  6788. }
  6789. }
  6790. if (found) return i
  6791. }
  6792. }
  6793. return -1
  6794. }
  6795. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6796. return this.indexOf(val, byteOffset, encoding) !== -1
  6797. }
  6798. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6799. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6800. }
  6801. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6802. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6803. }
  6804. function hexWrite (buf, string, offset, length) {
  6805. offset = Number(offset) || 0
  6806. var remaining = buf.length - offset
  6807. if (!length) {
  6808. length = remaining
  6809. } else {
  6810. length = Number(length)
  6811. if (length > remaining) {
  6812. length = remaining
  6813. }
  6814. }
  6815. // must be an even number of digits
  6816. var strLen = string.length
  6817. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6818. if (length > strLen / 2) {
  6819. length = strLen / 2
  6820. }
  6821. for (var i = 0; i < length; ++i) {
  6822. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6823. if (isNaN(parsed)) return i
  6824. buf[offset + i] = parsed
  6825. }
  6826. return i
  6827. }
  6828. function utf8Write (buf, string, offset, length) {
  6829. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6830. }
  6831. function asciiWrite (buf, string, offset, length) {
  6832. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6833. }
  6834. function latin1Write (buf, string, offset, length) {
  6835. return asciiWrite(buf, string, offset, length)
  6836. }
  6837. function base64Write (buf, string, offset, length) {
  6838. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6839. }
  6840. function ucs2Write (buf, string, offset, length) {
  6841. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6842. }
  6843. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6844. // Buffer#write(string)
  6845. if (offset === undefined) {
  6846. encoding = 'utf8'
  6847. length = this.length
  6848. offset = 0
  6849. // Buffer#write(string, encoding)
  6850. } else if (length === undefined && typeof offset === 'string') {
  6851. encoding = offset
  6852. length = this.length
  6853. offset = 0
  6854. // Buffer#write(string, offset[, length][, encoding])
  6855. } else if (isFinite(offset)) {
  6856. offset = offset | 0
  6857. if (isFinite(length)) {
  6858. length = length | 0
  6859. if (encoding === undefined) encoding = 'utf8'
  6860. } else {
  6861. encoding = length
  6862. length = undefined
  6863. }
  6864. // legacy write(string, encoding, offset, length) - remove in v0.13
  6865. } else {
  6866. throw new Error(
  6867. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6868. )
  6869. }
  6870. var remaining = this.length - offset
  6871. if (length === undefined || length > remaining) length = remaining
  6872. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6873. throw new RangeError('Attempt to write outside buffer bounds')
  6874. }
  6875. if (!encoding) encoding = 'utf8'
  6876. var loweredCase = false
  6877. for (;;) {
  6878. switch (encoding) {
  6879. case 'hex':
  6880. return hexWrite(this, string, offset, length)
  6881. case 'utf8':
  6882. case 'utf-8':
  6883. return utf8Write(this, string, offset, length)
  6884. case 'ascii':
  6885. return asciiWrite(this, string, offset, length)
  6886. case 'latin1':
  6887. case 'binary':
  6888. return latin1Write(this, string, offset, length)
  6889. case 'base64':
  6890. // Warning: maxLength not taken into account in base64Write
  6891. return base64Write(this, string, offset, length)
  6892. case 'ucs2':
  6893. case 'ucs-2':
  6894. case 'utf16le':
  6895. case 'utf-16le':
  6896. return ucs2Write(this, string, offset, length)
  6897. default:
  6898. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6899. encoding = ('' + encoding).toLowerCase()
  6900. loweredCase = true
  6901. }
  6902. }
  6903. }
  6904. Buffer.prototype.toJSON = function toJSON () {
  6905. return {
  6906. type: 'Buffer',
  6907. data: Array.prototype.slice.call(this._arr || this, 0)
  6908. }
  6909. }
  6910. function base64Slice (buf, start, end) {
  6911. if (start === 0 && end === buf.length) {
  6912. return base64.fromByteArray(buf)
  6913. } else {
  6914. return base64.fromByteArray(buf.slice(start, end))
  6915. }
  6916. }
  6917. function utf8Slice (buf, start, end) {
  6918. end = Math.min(buf.length, end)
  6919. var res = []
  6920. var i = start
  6921. while (i < end) {
  6922. var firstByte = buf[i]
  6923. var codePoint = null
  6924. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6925. : (firstByte > 0xDF) ? 3
  6926. : (firstByte > 0xBF) ? 2
  6927. : 1
  6928. if (i + bytesPerSequence <= end) {
  6929. var secondByte, thirdByte, fourthByte, tempCodePoint
  6930. switch (bytesPerSequence) {
  6931. case 1:
  6932. if (firstByte < 0x80) {
  6933. codePoint = firstByte
  6934. }
  6935. break
  6936. case 2:
  6937. secondByte = buf[i + 1]
  6938. if ((secondByte & 0xC0) === 0x80) {
  6939. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6940. if (tempCodePoint > 0x7F) {
  6941. codePoint = tempCodePoint
  6942. }
  6943. }
  6944. break
  6945. case 3:
  6946. secondByte = buf[i + 1]
  6947. thirdByte = buf[i + 2]
  6948. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6949. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6950. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6951. codePoint = tempCodePoint
  6952. }
  6953. }
  6954. break
  6955. case 4:
  6956. secondByte = buf[i + 1]
  6957. thirdByte = buf[i + 2]
  6958. fourthByte = buf[i + 3]
  6959. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6960. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6961. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6962. codePoint = tempCodePoint
  6963. }
  6964. }
  6965. }
  6966. }
  6967. if (codePoint === null) {
  6968. // we did not generate a valid codePoint so insert a
  6969. // replacement char (U+FFFD) and advance only 1 byte
  6970. codePoint = 0xFFFD
  6971. bytesPerSequence = 1
  6972. } else if (codePoint > 0xFFFF) {
  6973. // encode to utf16 (surrogate pair dance)
  6974. codePoint -= 0x10000
  6975. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6976. codePoint = 0xDC00 | codePoint & 0x3FF
  6977. }
  6978. res.push(codePoint)
  6979. i += bytesPerSequence
  6980. }
  6981. return decodeCodePointsArray(res)
  6982. }
  6983. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6984. // the lowest limit is Chrome, with 0x10000 args.
  6985. // We go 1 magnitude less, for safety
  6986. var MAX_ARGUMENTS_LENGTH = 0x1000
  6987. function decodeCodePointsArray (codePoints) {
  6988. var len = codePoints.length
  6989. if (len <= MAX_ARGUMENTS_LENGTH) {
  6990. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6991. }
  6992. // Decode in chunks to avoid "call stack size exceeded".
  6993. var res = ''
  6994. var i = 0
  6995. while (i < len) {
  6996. res += String.fromCharCode.apply(
  6997. String,
  6998. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6999. )
  7000. }
  7001. return res
  7002. }
  7003. function asciiSlice (buf, start, end) {
  7004. var ret = ''
  7005. end = Math.min(buf.length, end)
  7006. for (var i = start; i < end; ++i) {
  7007. ret += String.fromCharCode(buf[i] & 0x7F)
  7008. }
  7009. return ret
  7010. }
  7011. function latin1Slice (buf, start, end) {
  7012. var ret = ''
  7013. end = Math.min(buf.length, end)
  7014. for (var i = start; i < end; ++i) {
  7015. ret += String.fromCharCode(buf[i])
  7016. }
  7017. return ret
  7018. }
  7019. function hexSlice (buf, start, end) {
  7020. var len = buf.length
  7021. if (!start || start < 0) start = 0
  7022. if (!end || end < 0 || end > len) end = len
  7023. var out = ''
  7024. for (var i = start; i < end; ++i) {
  7025. out += toHex(buf[i])
  7026. }
  7027. return out
  7028. }
  7029. function utf16leSlice (buf, start, end) {
  7030. var bytes = buf.slice(start, end)
  7031. var res = ''
  7032. for (var i = 0; i < bytes.length; i += 2) {
  7033. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7034. }
  7035. return res
  7036. }
  7037. Buffer.prototype.slice = function slice (start, end) {
  7038. var len = this.length
  7039. start = ~~start
  7040. end = end === undefined ? len : ~~end
  7041. if (start < 0) {
  7042. start += len
  7043. if (start < 0) start = 0
  7044. } else if (start > len) {
  7045. start = len
  7046. }
  7047. if (end < 0) {
  7048. end += len
  7049. if (end < 0) end = 0
  7050. } else if (end > len) {
  7051. end = len
  7052. }
  7053. if (end < start) end = start
  7054. var newBuf
  7055. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7056. newBuf = this.subarray(start, end)
  7057. newBuf.__proto__ = Buffer.prototype
  7058. } else {
  7059. var sliceLen = end - start
  7060. newBuf = new Buffer(sliceLen, undefined)
  7061. for (var i = 0; i < sliceLen; ++i) {
  7062. newBuf[i] = this[i + start]
  7063. }
  7064. }
  7065. return newBuf
  7066. }
  7067. /*
  7068. * Need to make sure that buffer isn't trying to write out of bounds.
  7069. */
  7070. function checkOffset (offset, ext, length) {
  7071. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7072. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7073. }
  7074. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7075. offset = offset | 0
  7076. byteLength = byteLength | 0
  7077. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7078. var val = this[offset]
  7079. var mul = 1
  7080. var i = 0
  7081. while (++i < byteLength && (mul *= 0x100)) {
  7082. val += this[offset + i] * mul
  7083. }
  7084. return val
  7085. }
  7086. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7087. offset = offset | 0
  7088. byteLength = byteLength | 0
  7089. if (!noAssert) {
  7090. checkOffset(offset, byteLength, this.length)
  7091. }
  7092. var val = this[offset + --byteLength]
  7093. var mul = 1
  7094. while (byteLength > 0 && (mul *= 0x100)) {
  7095. val += this[offset + --byteLength] * mul
  7096. }
  7097. return val
  7098. }
  7099. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7100. if (!noAssert) checkOffset(offset, 1, this.length)
  7101. return this[offset]
  7102. }
  7103. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7104. if (!noAssert) checkOffset(offset, 2, this.length)
  7105. return this[offset] | (this[offset + 1] << 8)
  7106. }
  7107. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7108. if (!noAssert) checkOffset(offset, 2, this.length)
  7109. return (this[offset] << 8) | this[offset + 1]
  7110. }
  7111. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7112. if (!noAssert) checkOffset(offset, 4, this.length)
  7113. return ((this[offset]) |
  7114. (this[offset + 1] << 8) |
  7115. (this[offset + 2] << 16)) +
  7116. (this[offset + 3] * 0x1000000)
  7117. }
  7118. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7119. if (!noAssert) checkOffset(offset, 4, this.length)
  7120. return (this[offset] * 0x1000000) +
  7121. ((this[offset + 1] << 16) |
  7122. (this[offset + 2] << 8) |
  7123. this[offset + 3])
  7124. }
  7125. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7126. offset = offset | 0
  7127. byteLength = byteLength | 0
  7128. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7129. var val = this[offset]
  7130. var mul = 1
  7131. var i = 0
  7132. while (++i < byteLength && (mul *= 0x100)) {
  7133. val += this[offset + i] * mul
  7134. }
  7135. mul *= 0x80
  7136. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7137. return val
  7138. }
  7139. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7140. offset = offset | 0
  7141. byteLength = byteLength | 0
  7142. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7143. var i = byteLength
  7144. var mul = 1
  7145. var val = this[offset + --i]
  7146. while (i > 0 && (mul *= 0x100)) {
  7147. val += this[offset + --i] * mul
  7148. }
  7149. mul *= 0x80
  7150. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7151. return val
  7152. }
  7153. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7154. if (!noAssert) checkOffset(offset, 1, this.length)
  7155. if (!(this[offset] & 0x80)) return (this[offset])
  7156. return ((0xff - this[offset] + 1) * -1)
  7157. }
  7158. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7159. if (!noAssert) checkOffset(offset, 2, this.length)
  7160. var val = this[offset] | (this[offset + 1] << 8)
  7161. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7162. }
  7163. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7164. if (!noAssert) checkOffset(offset, 2, this.length)
  7165. var val = this[offset + 1] | (this[offset] << 8)
  7166. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7167. }
  7168. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7169. if (!noAssert) checkOffset(offset, 4, this.length)
  7170. return (this[offset]) |
  7171. (this[offset + 1] << 8) |
  7172. (this[offset + 2] << 16) |
  7173. (this[offset + 3] << 24)
  7174. }
  7175. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7176. if (!noAssert) checkOffset(offset, 4, this.length)
  7177. return (this[offset] << 24) |
  7178. (this[offset + 1] << 16) |
  7179. (this[offset + 2] << 8) |
  7180. (this[offset + 3])
  7181. }
  7182. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7183. if (!noAssert) checkOffset(offset, 4, this.length)
  7184. return ieee754.read(this, offset, true, 23, 4)
  7185. }
  7186. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7187. if (!noAssert) checkOffset(offset, 4, this.length)
  7188. return ieee754.read(this, offset, false, 23, 4)
  7189. }
  7190. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7191. if (!noAssert) checkOffset(offset, 8, this.length)
  7192. return ieee754.read(this, offset, true, 52, 8)
  7193. }
  7194. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7195. if (!noAssert) checkOffset(offset, 8, this.length)
  7196. return ieee754.read(this, offset, false, 52, 8)
  7197. }
  7198. function checkInt (buf, value, offset, ext, max, min) {
  7199. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7200. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7201. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7202. }
  7203. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7204. value = +value
  7205. offset = offset | 0
  7206. byteLength = byteLength | 0
  7207. if (!noAssert) {
  7208. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7209. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7210. }
  7211. var mul = 1
  7212. var i = 0
  7213. this[offset] = value & 0xFF
  7214. while (++i < byteLength && (mul *= 0x100)) {
  7215. this[offset + i] = (value / mul) & 0xFF
  7216. }
  7217. return offset + byteLength
  7218. }
  7219. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7220. value = +value
  7221. offset = offset | 0
  7222. byteLength = byteLength | 0
  7223. if (!noAssert) {
  7224. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7225. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7226. }
  7227. var i = byteLength - 1
  7228. var mul = 1
  7229. this[offset + i] = value & 0xFF
  7230. while (--i >= 0 && (mul *= 0x100)) {
  7231. this[offset + i] = (value / mul) & 0xFF
  7232. }
  7233. return offset + byteLength
  7234. }
  7235. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7236. value = +value
  7237. offset = offset | 0
  7238. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7239. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7240. this[offset] = (value & 0xff)
  7241. return offset + 1
  7242. }
  7243. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7244. if (value < 0) value = 0xffff + value + 1
  7245. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7246. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7247. (littleEndian ? i : 1 - i) * 8
  7248. }
  7249. }
  7250. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7251. value = +value
  7252. offset = offset | 0
  7253. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7254. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7255. this[offset] = (value & 0xff)
  7256. this[offset + 1] = (value >>> 8)
  7257. } else {
  7258. objectWriteUInt16(this, value, offset, true)
  7259. }
  7260. return offset + 2
  7261. }
  7262. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7263. value = +value
  7264. offset = offset | 0
  7265. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7266. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7267. this[offset] = (value >>> 8)
  7268. this[offset + 1] = (value & 0xff)
  7269. } else {
  7270. objectWriteUInt16(this, value, offset, false)
  7271. }
  7272. return offset + 2
  7273. }
  7274. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7275. if (value < 0) value = 0xffffffff + value + 1
  7276. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7277. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7278. }
  7279. }
  7280. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7281. value = +value
  7282. offset = offset | 0
  7283. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7284. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7285. this[offset + 3] = (value >>> 24)
  7286. this[offset + 2] = (value >>> 16)
  7287. this[offset + 1] = (value >>> 8)
  7288. this[offset] = (value & 0xff)
  7289. } else {
  7290. objectWriteUInt32(this, value, offset, true)
  7291. }
  7292. return offset + 4
  7293. }
  7294. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7295. value = +value
  7296. offset = offset | 0
  7297. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7298. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7299. this[offset] = (value >>> 24)
  7300. this[offset + 1] = (value >>> 16)
  7301. this[offset + 2] = (value >>> 8)
  7302. this[offset + 3] = (value & 0xff)
  7303. } else {
  7304. objectWriteUInt32(this, value, offset, false)
  7305. }
  7306. return offset + 4
  7307. }
  7308. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7309. value = +value
  7310. offset = offset | 0
  7311. if (!noAssert) {
  7312. var limit = Math.pow(2, 8 * byteLength - 1)
  7313. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7314. }
  7315. var i = 0
  7316. var mul = 1
  7317. var sub = 0
  7318. this[offset] = value & 0xFF
  7319. while (++i < byteLength && (mul *= 0x100)) {
  7320. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7321. sub = 1
  7322. }
  7323. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7324. }
  7325. return offset + byteLength
  7326. }
  7327. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7328. value = +value
  7329. offset = offset | 0
  7330. if (!noAssert) {
  7331. var limit = Math.pow(2, 8 * byteLength - 1)
  7332. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7333. }
  7334. var i = byteLength - 1
  7335. var mul = 1
  7336. var sub = 0
  7337. this[offset + i] = value & 0xFF
  7338. while (--i >= 0 && (mul *= 0x100)) {
  7339. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7340. sub = 1
  7341. }
  7342. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7343. }
  7344. return offset + byteLength
  7345. }
  7346. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7347. value = +value
  7348. offset = offset | 0
  7349. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7350. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7351. if (value < 0) value = 0xff + value + 1
  7352. this[offset] = (value & 0xff)
  7353. return offset + 1
  7354. }
  7355. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7356. value = +value
  7357. offset = offset | 0
  7358. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7359. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7360. this[offset] = (value & 0xff)
  7361. this[offset + 1] = (value >>> 8)
  7362. } else {
  7363. objectWriteUInt16(this, value, offset, true)
  7364. }
  7365. return offset + 2
  7366. }
  7367. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7368. value = +value
  7369. offset = offset | 0
  7370. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7371. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7372. this[offset] = (value >>> 8)
  7373. this[offset + 1] = (value & 0xff)
  7374. } else {
  7375. objectWriteUInt16(this, value, offset, false)
  7376. }
  7377. return offset + 2
  7378. }
  7379. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7380. value = +value
  7381. offset = offset | 0
  7382. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7383. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7384. this[offset] = (value & 0xff)
  7385. this[offset + 1] = (value >>> 8)
  7386. this[offset + 2] = (value >>> 16)
  7387. this[offset + 3] = (value >>> 24)
  7388. } else {
  7389. objectWriteUInt32(this, value, offset, true)
  7390. }
  7391. return offset + 4
  7392. }
  7393. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7394. value = +value
  7395. offset = offset | 0
  7396. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7397. if (value < 0) value = 0xffffffff + value + 1
  7398. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7399. this[offset] = (value >>> 24)
  7400. this[offset + 1] = (value >>> 16)
  7401. this[offset + 2] = (value >>> 8)
  7402. this[offset + 3] = (value & 0xff)
  7403. } else {
  7404. objectWriteUInt32(this, value, offset, false)
  7405. }
  7406. return offset + 4
  7407. }
  7408. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7409. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7410. if (offset < 0) throw new RangeError('Index out of range')
  7411. }
  7412. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7413. if (!noAssert) {
  7414. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7415. }
  7416. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7417. return offset + 4
  7418. }
  7419. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7420. return writeFloat(this, value, offset, true, noAssert)
  7421. }
  7422. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7423. return writeFloat(this, value, offset, false, noAssert)
  7424. }
  7425. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7426. if (!noAssert) {
  7427. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7428. }
  7429. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7430. return offset + 8
  7431. }
  7432. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7433. return writeDouble(this, value, offset, true, noAssert)
  7434. }
  7435. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7436. return writeDouble(this, value, offset, false, noAssert)
  7437. }
  7438. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7439. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7440. if (!start) start = 0
  7441. if (!end && end !== 0) end = this.length
  7442. if (targetStart >= target.length) targetStart = target.length
  7443. if (!targetStart) targetStart = 0
  7444. if (end > 0 && end < start) end = start
  7445. // Copy 0 bytes; we're done
  7446. if (end === start) return 0
  7447. if (target.length === 0 || this.length === 0) return 0
  7448. // Fatal error conditions
  7449. if (targetStart < 0) {
  7450. throw new RangeError('targetStart out of bounds')
  7451. }
  7452. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7453. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7454. // Are we oob?
  7455. if (end > this.length) end = this.length
  7456. if (target.length - targetStart < end - start) {
  7457. end = target.length - targetStart + start
  7458. }
  7459. var len = end - start
  7460. var i
  7461. if (this === target && start < targetStart && targetStart < end) {
  7462. // descending copy from end
  7463. for (i = len - 1; i >= 0; --i) {
  7464. target[i + targetStart] = this[i + start]
  7465. }
  7466. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7467. // ascending copy from start
  7468. for (i = 0; i < len; ++i) {
  7469. target[i + targetStart] = this[i + start]
  7470. }
  7471. } else {
  7472. Uint8Array.prototype.set.call(
  7473. target,
  7474. this.subarray(start, start + len),
  7475. targetStart
  7476. )
  7477. }
  7478. return len
  7479. }
  7480. // Usage:
  7481. // buffer.fill(number[, offset[, end]])
  7482. // buffer.fill(buffer[, offset[, end]])
  7483. // buffer.fill(string[, offset[, end]][, encoding])
  7484. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7485. // Handle string cases:
  7486. if (typeof val === 'string') {
  7487. if (typeof start === 'string') {
  7488. encoding = start
  7489. start = 0
  7490. end = this.length
  7491. } else if (typeof end === 'string') {
  7492. encoding = end
  7493. end = this.length
  7494. }
  7495. if (val.length === 1) {
  7496. var code = val.charCodeAt(0)
  7497. if (code < 256) {
  7498. val = code
  7499. }
  7500. }
  7501. if (encoding !== undefined && typeof encoding !== 'string') {
  7502. throw new TypeError('encoding must be a string')
  7503. }
  7504. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7505. throw new TypeError('Unknown encoding: ' + encoding)
  7506. }
  7507. } else if (typeof val === 'number') {
  7508. val = val & 255
  7509. }
  7510. // Invalid ranges are not set to a default, so can range check early.
  7511. if (start < 0 || this.length < start || this.length < end) {
  7512. throw new RangeError('Out of range index')
  7513. }
  7514. if (end <= start) {
  7515. return this
  7516. }
  7517. start = start >>> 0
  7518. end = end === undefined ? this.length : end >>> 0
  7519. if (!val) val = 0
  7520. var i
  7521. if (typeof val === 'number') {
  7522. for (i = start; i < end; ++i) {
  7523. this[i] = val
  7524. }
  7525. } else {
  7526. var bytes = Buffer.isBuffer(val)
  7527. ? val
  7528. : utf8ToBytes(new Buffer(val, encoding).toString())
  7529. var len = bytes.length
  7530. for (i = 0; i < end - start; ++i) {
  7531. this[i + start] = bytes[i % len]
  7532. }
  7533. }
  7534. return this
  7535. }
  7536. // HELPER FUNCTIONS
  7537. // ================
  7538. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7539. function base64clean (str) {
  7540. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7541. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7542. // Node converts strings with length < 2 to ''
  7543. if (str.length < 2) return ''
  7544. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7545. while (str.length % 4 !== 0) {
  7546. str = str + '='
  7547. }
  7548. return str
  7549. }
  7550. function stringtrim (str) {
  7551. if (str.trim) return str.trim()
  7552. return str.replace(/^\s+|\s+$/g, '')
  7553. }
  7554. function toHex (n) {
  7555. if (n < 16) return '0' + n.toString(16)
  7556. return n.toString(16)
  7557. }
  7558. function utf8ToBytes (string, units) {
  7559. units = units || Infinity
  7560. var codePoint
  7561. var length = string.length
  7562. var leadSurrogate = null
  7563. var bytes = []
  7564. for (var i = 0; i < length; ++i) {
  7565. codePoint = string.charCodeAt(i)
  7566. // is surrogate component
  7567. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7568. // last char was a lead
  7569. if (!leadSurrogate) {
  7570. // no lead yet
  7571. if (codePoint > 0xDBFF) {
  7572. // unexpected trail
  7573. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7574. continue
  7575. } else if (i + 1 === length) {
  7576. // unpaired lead
  7577. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7578. continue
  7579. }
  7580. // valid lead
  7581. leadSurrogate = codePoint
  7582. continue
  7583. }
  7584. // 2 leads in a row
  7585. if (codePoint < 0xDC00) {
  7586. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7587. leadSurrogate = codePoint
  7588. continue
  7589. }
  7590. // valid surrogate pair
  7591. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7592. } else if (leadSurrogate) {
  7593. // valid bmp char, but last char was a lead
  7594. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7595. }
  7596. leadSurrogate = null
  7597. // encode utf8
  7598. if (codePoint < 0x80) {
  7599. if ((units -= 1) < 0) break
  7600. bytes.push(codePoint)
  7601. } else if (codePoint < 0x800) {
  7602. if ((units -= 2) < 0) break
  7603. bytes.push(
  7604. codePoint >> 0x6 | 0xC0,
  7605. codePoint & 0x3F | 0x80
  7606. )
  7607. } else if (codePoint < 0x10000) {
  7608. if ((units -= 3) < 0) break
  7609. bytes.push(
  7610. codePoint >> 0xC | 0xE0,
  7611. codePoint >> 0x6 & 0x3F | 0x80,
  7612. codePoint & 0x3F | 0x80
  7613. )
  7614. } else if (codePoint < 0x110000) {
  7615. if ((units -= 4) < 0) break
  7616. bytes.push(
  7617. codePoint >> 0x12 | 0xF0,
  7618. codePoint >> 0xC & 0x3F | 0x80,
  7619. codePoint >> 0x6 & 0x3F | 0x80,
  7620. codePoint & 0x3F | 0x80
  7621. )
  7622. } else {
  7623. throw new Error('Invalid code point')
  7624. }
  7625. }
  7626. return bytes
  7627. }
  7628. function asciiToBytes (str) {
  7629. var byteArray = []
  7630. for (var i = 0; i < str.length; ++i) {
  7631. // Node's code seems to be doing this and not & 0x7F..
  7632. byteArray.push(str.charCodeAt(i) & 0xFF)
  7633. }
  7634. return byteArray
  7635. }
  7636. function utf16leToBytes (str, units) {
  7637. var c, hi, lo
  7638. var byteArray = []
  7639. for (var i = 0; i < str.length; ++i) {
  7640. if ((units -= 2) < 0) break
  7641. c = str.charCodeAt(i)
  7642. hi = c >> 8
  7643. lo = c % 256
  7644. byteArray.push(lo)
  7645. byteArray.push(hi)
  7646. }
  7647. return byteArray
  7648. }
  7649. function base64ToBytes (str) {
  7650. return base64.toByteArray(base64clean(str))
  7651. }
  7652. function blitBuffer (src, dst, offset, length) {
  7653. for (var i = 0; i < length; ++i) {
  7654. if ((i + offset >= dst.length) || (i >= src.length)) break
  7655. dst[i + offset] = src[i]
  7656. }
  7657. return i
  7658. }
  7659. function isnan (val) {
  7660. return val !== val // eslint-disable-line no-self-compare
  7661. }
  7662. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7663. /***/ }),
  7664. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7665. /*!**************************************************!*\
  7666. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7667. \**************************************************/
  7668. /*! no static exports found */
  7669. /***/ (function(module, exports, __webpack_require__) {
  7670. /*!
  7671. * clipboard.js v2.0.4
  7672. * https://zenorocha.github.io/clipboard.js
  7673. *
  7674. * Licensed MIT © Zeno Rocha
  7675. */
  7676. (function webpackUniversalModuleDefinition(root, factory) {
  7677. if(true)
  7678. module.exports = factory();
  7679. else {}
  7680. })(this, function() {
  7681. return /******/ (function(modules) { // webpackBootstrap
  7682. /******/ // The module cache
  7683. /******/ var installedModules = {};
  7684. /******/
  7685. /******/ // The require function
  7686. /******/ function __webpack_require__(moduleId) {
  7687. /******/
  7688. /******/ // Check if module is in cache
  7689. /******/ if(installedModules[moduleId]) {
  7690. /******/ return installedModules[moduleId].exports;
  7691. /******/ }
  7692. /******/ // Create a new module (and put it into the cache)
  7693. /******/ var module = installedModules[moduleId] = {
  7694. /******/ i: moduleId,
  7695. /******/ l: false,
  7696. /******/ exports: {}
  7697. /******/ };
  7698. /******/
  7699. /******/ // Execute the module function
  7700. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7701. /******/
  7702. /******/ // Flag the module as loaded
  7703. /******/ module.l = true;
  7704. /******/
  7705. /******/ // Return the exports of the module
  7706. /******/ return module.exports;
  7707. /******/ }
  7708. /******/
  7709. /******/
  7710. /******/ // expose the modules object (__webpack_modules__)
  7711. /******/ __webpack_require__.m = modules;
  7712. /******/
  7713. /******/ // expose the module cache
  7714. /******/ __webpack_require__.c = installedModules;
  7715. /******/
  7716. /******/ // define getter function for harmony exports
  7717. /******/ __webpack_require__.d = function(exports, name, getter) {
  7718. /******/ if(!__webpack_require__.o(exports, name)) {
  7719. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7720. /******/ }
  7721. /******/ };
  7722. /******/
  7723. /******/ // define __esModule on exports
  7724. /******/ __webpack_require__.r = function(exports) {
  7725. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7726. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7727. /******/ }
  7728. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7729. /******/ };
  7730. /******/
  7731. /******/ // create a fake namespace object
  7732. /******/ // mode & 1: value is a module id, require it
  7733. /******/ // mode & 2: merge all properties of value into the ns
  7734. /******/ // mode & 4: return value when already ns object
  7735. /******/ // mode & 8|1: behave like require
  7736. /******/ __webpack_require__.t = function(value, mode) {
  7737. /******/ if(mode & 1) value = __webpack_require__(value);
  7738. /******/ if(mode & 8) return value;
  7739. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7740. /******/ var ns = Object.create(null);
  7741. /******/ __webpack_require__.r(ns);
  7742. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7743. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7744. /******/ return ns;
  7745. /******/ };
  7746. /******/
  7747. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7748. /******/ __webpack_require__.n = function(module) {
  7749. /******/ var getter = module && module.__esModule ?
  7750. /******/ function getDefault() { return module['default']; } :
  7751. /******/ function getModuleExports() { return module; };
  7752. /******/ __webpack_require__.d(getter, 'a', getter);
  7753. /******/ return getter;
  7754. /******/ };
  7755. /******/
  7756. /******/ // Object.prototype.hasOwnProperty.call
  7757. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7758. /******/
  7759. /******/ // __webpack_public_path__
  7760. /******/ __webpack_require__.p = "";
  7761. /******/
  7762. /******/
  7763. /******/ // Load entry module and return exports
  7764. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7765. /******/ })
  7766. /************************************************************************/
  7767. /******/ ([
  7768. /* 0 */
  7769. /***/ (function(module, exports, __webpack_require__) {
  7770. "use strict";
  7771. 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; };
  7772. 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; }; }();
  7773. var _clipboardAction = __webpack_require__(1);
  7774. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7775. var _tinyEmitter = __webpack_require__(3);
  7776. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7777. var _goodListener = __webpack_require__(4);
  7778. var _goodListener2 = _interopRequireDefault(_goodListener);
  7779. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7780. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7781. 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; }
  7782. 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; }
  7783. /**
  7784. * Base class which takes one or more elements, adds event listeners to them,
  7785. * and instantiates a new `ClipboardAction` on each click.
  7786. */
  7787. var Clipboard = function (_Emitter) {
  7788. _inherits(Clipboard, _Emitter);
  7789. /**
  7790. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7791. * @param {Object} options
  7792. */
  7793. function Clipboard(trigger, options) {
  7794. _classCallCheck(this, Clipboard);
  7795. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7796. _this.resolveOptions(options);
  7797. _this.listenClick(trigger);
  7798. return _this;
  7799. }
  7800. /**
  7801. * Defines if attributes would be resolved using internal setter functions
  7802. * or custom functions that were passed in the constructor.
  7803. * @param {Object} options
  7804. */
  7805. _createClass(Clipboard, [{
  7806. key: 'resolveOptions',
  7807. value: function resolveOptions() {
  7808. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7809. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7810. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7811. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7812. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7813. }
  7814. /**
  7815. * Adds a click event listener to the passed trigger.
  7816. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7817. */
  7818. }, {
  7819. key: 'listenClick',
  7820. value: function listenClick(trigger) {
  7821. var _this2 = this;
  7822. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7823. return _this2.onClick(e);
  7824. });
  7825. }
  7826. /**
  7827. * Defines a new `ClipboardAction` on each click event.
  7828. * @param {Event} e
  7829. */
  7830. }, {
  7831. key: 'onClick',
  7832. value: function onClick(e) {
  7833. var trigger = e.delegateTarget || e.currentTarget;
  7834. if (this.clipboardAction) {
  7835. this.clipboardAction = null;
  7836. }
  7837. this.clipboardAction = new _clipboardAction2.default({
  7838. action: this.action(trigger),
  7839. target: this.target(trigger),
  7840. text: this.text(trigger),
  7841. container: this.container,
  7842. trigger: trigger,
  7843. emitter: this
  7844. });
  7845. }
  7846. /**
  7847. * Default `action` lookup function.
  7848. * @param {Element} trigger
  7849. */
  7850. }, {
  7851. key: 'defaultAction',
  7852. value: function defaultAction(trigger) {
  7853. return getAttributeValue('action', trigger);
  7854. }
  7855. /**
  7856. * Default `target` lookup function.
  7857. * @param {Element} trigger
  7858. */
  7859. }, {
  7860. key: 'defaultTarget',
  7861. value: function defaultTarget(trigger) {
  7862. var selector = getAttributeValue('target', trigger);
  7863. if (selector) {
  7864. return document.querySelector(selector);
  7865. }
  7866. }
  7867. /**
  7868. * Returns the support of the given action, or all actions if no action is
  7869. * given.
  7870. * @param {String} [action]
  7871. */
  7872. }, {
  7873. key: 'defaultText',
  7874. /**
  7875. * Default `text` lookup function.
  7876. * @param {Element} trigger
  7877. */
  7878. value: function defaultText(trigger) {
  7879. return getAttributeValue('text', trigger);
  7880. }
  7881. /**
  7882. * Destroy lifecycle.
  7883. */
  7884. }, {
  7885. key: 'destroy',
  7886. value: function destroy() {
  7887. this.listener.destroy();
  7888. if (this.clipboardAction) {
  7889. this.clipboardAction.destroy();
  7890. this.clipboardAction = null;
  7891. }
  7892. }
  7893. }], [{
  7894. key: 'isSupported',
  7895. value: function isSupported() {
  7896. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7897. var actions = typeof action === 'string' ? [action] : action;
  7898. var support = !!document.queryCommandSupported;
  7899. actions.forEach(function (action) {
  7900. support = support && !!document.queryCommandSupported(action);
  7901. });
  7902. return support;
  7903. }
  7904. }]);
  7905. return Clipboard;
  7906. }(_tinyEmitter2.default);
  7907. /**
  7908. * Helper function to retrieve attribute value.
  7909. * @param {String} suffix
  7910. * @param {Element} element
  7911. */
  7912. function getAttributeValue(suffix, element) {
  7913. var attribute = 'data-clipboard-' + suffix;
  7914. if (!element.hasAttribute(attribute)) {
  7915. return;
  7916. }
  7917. return element.getAttribute(attribute);
  7918. }
  7919. module.exports = Clipboard;
  7920. /***/ }),
  7921. /* 1 */
  7922. /***/ (function(module, exports, __webpack_require__) {
  7923. "use strict";
  7924. 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; };
  7925. 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; }; }();
  7926. var _select = __webpack_require__(2);
  7927. var _select2 = _interopRequireDefault(_select);
  7928. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7929. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7930. /**
  7931. * Inner class which performs selection from either `text` or `target`
  7932. * properties and then executes copy or cut operations.
  7933. */
  7934. var ClipboardAction = function () {
  7935. /**
  7936. * @param {Object} options
  7937. */
  7938. function ClipboardAction(options) {
  7939. _classCallCheck(this, ClipboardAction);
  7940. this.resolveOptions(options);
  7941. this.initSelection();
  7942. }
  7943. /**
  7944. * Defines base properties passed from constructor.
  7945. * @param {Object} options
  7946. */
  7947. _createClass(ClipboardAction, [{
  7948. key: 'resolveOptions',
  7949. value: function resolveOptions() {
  7950. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7951. this.action = options.action;
  7952. this.container = options.container;
  7953. this.emitter = options.emitter;
  7954. this.target = options.target;
  7955. this.text = options.text;
  7956. this.trigger = options.trigger;
  7957. this.selectedText = '';
  7958. }
  7959. /**
  7960. * Decides which selection strategy is going to be applied based
  7961. * on the existence of `text` and `target` properties.
  7962. */
  7963. }, {
  7964. key: 'initSelection',
  7965. value: function initSelection() {
  7966. if (this.text) {
  7967. this.selectFake();
  7968. } else if (this.target) {
  7969. this.selectTarget();
  7970. }
  7971. }
  7972. /**
  7973. * Creates a fake textarea element, sets its value from `text` property,
  7974. * and makes a selection on it.
  7975. */
  7976. }, {
  7977. key: 'selectFake',
  7978. value: function selectFake() {
  7979. var _this = this;
  7980. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7981. this.removeFake();
  7982. this.fakeHandlerCallback = function () {
  7983. return _this.removeFake();
  7984. };
  7985. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7986. this.fakeElem = document.createElement('textarea');
  7987. // Prevent zooming on iOS
  7988. this.fakeElem.style.fontSize = '12pt';
  7989. // Reset box model
  7990. this.fakeElem.style.border = '0';
  7991. this.fakeElem.style.padding = '0';
  7992. this.fakeElem.style.margin = '0';
  7993. // Move element out of screen horizontally
  7994. this.fakeElem.style.position = 'absolute';
  7995. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7996. // Move element to the same position vertically
  7997. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7998. this.fakeElem.style.top = yPosition + 'px';
  7999. this.fakeElem.setAttribute('readonly', '');
  8000. this.fakeElem.value = this.text;
  8001. this.container.appendChild(this.fakeElem);
  8002. this.selectedText = (0, _select2.default)(this.fakeElem);
  8003. this.copyText();
  8004. }
  8005. /**
  8006. * Only removes the fake element after another click event, that way
  8007. * a user can hit `Ctrl+C` to copy because selection still exists.
  8008. */
  8009. }, {
  8010. key: 'removeFake',
  8011. value: function removeFake() {
  8012. if (this.fakeHandler) {
  8013. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8014. this.fakeHandler = null;
  8015. this.fakeHandlerCallback = null;
  8016. }
  8017. if (this.fakeElem) {
  8018. this.container.removeChild(this.fakeElem);
  8019. this.fakeElem = null;
  8020. }
  8021. }
  8022. /**
  8023. * Selects the content from element passed on `target` property.
  8024. */
  8025. }, {
  8026. key: 'selectTarget',
  8027. value: function selectTarget() {
  8028. this.selectedText = (0, _select2.default)(this.target);
  8029. this.copyText();
  8030. }
  8031. /**
  8032. * Executes the copy operation based on the current selection.
  8033. */
  8034. }, {
  8035. key: 'copyText',
  8036. value: function copyText() {
  8037. var succeeded = void 0;
  8038. try {
  8039. succeeded = document.execCommand(this.action);
  8040. } catch (err) {
  8041. succeeded = false;
  8042. }
  8043. this.handleResult(succeeded);
  8044. }
  8045. /**
  8046. * Fires an event based on the copy operation result.
  8047. * @param {Boolean} succeeded
  8048. */
  8049. }, {
  8050. key: 'handleResult',
  8051. value: function handleResult(succeeded) {
  8052. this.emitter.emit(succeeded ? 'success' : 'error', {
  8053. action: this.action,
  8054. text: this.selectedText,
  8055. trigger: this.trigger,
  8056. clearSelection: this.clearSelection.bind(this)
  8057. });
  8058. }
  8059. /**
  8060. * Moves focus away from `target` and back to the trigger, removes current selection.
  8061. */
  8062. }, {
  8063. key: 'clearSelection',
  8064. value: function clearSelection() {
  8065. if (this.trigger) {
  8066. this.trigger.focus();
  8067. }
  8068. window.getSelection().removeAllRanges();
  8069. }
  8070. /**
  8071. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8072. * @param {String} action
  8073. */
  8074. }, {
  8075. key: 'destroy',
  8076. /**
  8077. * Destroy lifecycle.
  8078. */
  8079. value: function destroy() {
  8080. this.removeFake();
  8081. }
  8082. }, {
  8083. key: 'action',
  8084. set: function set() {
  8085. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8086. this._action = action;
  8087. if (this._action !== 'copy' && this._action !== 'cut') {
  8088. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8089. }
  8090. }
  8091. /**
  8092. * Gets the `action` property.
  8093. * @return {String}
  8094. */
  8095. ,
  8096. get: function get() {
  8097. return this._action;
  8098. }
  8099. /**
  8100. * Sets the `target` property using an element
  8101. * that will be have its content copied.
  8102. * @param {Element} target
  8103. */
  8104. }, {
  8105. key: 'target',
  8106. set: function set(target) {
  8107. if (target !== undefined) {
  8108. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8109. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8110. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8111. }
  8112. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8113. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8114. }
  8115. this._target = target;
  8116. } else {
  8117. throw new Error('Invalid "target" value, use a valid Element');
  8118. }
  8119. }
  8120. }
  8121. /**
  8122. * Gets the `target` property.
  8123. * @return {String|HTMLElement}
  8124. */
  8125. ,
  8126. get: function get() {
  8127. return this._target;
  8128. }
  8129. }]);
  8130. return ClipboardAction;
  8131. }();
  8132. module.exports = ClipboardAction;
  8133. /***/ }),
  8134. /* 2 */
  8135. /***/ (function(module, exports) {
  8136. function select(element) {
  8137. var selectedText;
  8138. if (element.nodeName === 'SELECT') {
  8139. element.focus();
  8140. selectedText = element.value;
  8141. }
  8142. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8143. var isReadOnly = element.hasAttribute('readonly');
  8144. if (!isReadOnly) {
  8145. element.setAttribute('readonly', '');
  8146. }
  8147. element.select();
  8148. element.setSelectionRange(0, element.value.length);
  8149. if (!isReadOnly) {
  8150. element.removeAttribute('readonly');
  8151. }
  8152. selectedText = element.value;
  8153. }
  8154. else {
  8155. if (element.hasAttribute('contenteditable')) {
  8156. element.focus();
  8157. }
  8158. var selection = window.getSelection();
  8159. var range = document.createRange();
  8160. range.selectNodeContents(element);
  8161. selection.removeAllRanges();
  8162. selection.addRange(range);
  8163. selectedText = selection.toString();
  8164. }
  8165. return selectedText;
  8166. }
  8167. module.exports = select;
  8168. /***/ }),
  8169. /* 3 */
  8170. /***/ (function(module, exports) {
  8171. function E () {
  8172. // Keep this empty so it's easier to inherit from
  8173. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8174. }
  8175. E.prototype = {
  8176. on: function (name, callback, ctx) {
  8177. var e = this.e || (this.e = {});
  8178. (e[name] || (e[name] = [])).push({
  8179. fn: callback,
  8180. ctx: ctx
  8181. });
  8182. return this;
  8183. },
  8184. once: function (name, callback, ctx) {
  8185. var self = this;
  8186. function listener () {
  8187. self.off(name, listener);
  8188. callback.apply(ctx, arguments);
  8189. };
  8190. listener._ = callback
  8191. return this.on(name, listener, ctx);
  8192. },
  8193. emit: function (name) {
  8194. var data = [].slice.call(arguments, 1);
  8195. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8196. var i = 0;
  8197. var len = evtArr.length;
  8198. for (i; i < len; i++) {
  8199. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8200. }
  8201. return this;
  8202. },
  8203. off: function (name, callback) {
  8204. var e = this.e || (this.e = {});
  8205. var evts = e[name];
  8206. var liveEvents = [];
  8207. if (evts && callback) {
  8208. for (var i = 0, len = evts.length; i < len; i++) {
  8209. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8210. liveEvents.push(evts[i]);
  8211. }
  8212. }
  8213. // Remove event from queue to prevent memory leak
  8214. // Suggested by https://github.com/lazd
  8215. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8216. (liveEvents.length)
  8217. ? e[name] = liveEvents
  8218. : delete e[name];
  8219. return this;
  8220. }
  8221. };
  8222. module.exports = E;
  8223. /***/ }),
  8224. /* 4 */
  8225. /***/ (function(module, exports, __webpack_require__) {
  8226. var is = __webpack_require__(5);
  8227. var delegate = __webpack_require__(6);
  8228. /**
  8229. * Validates all params and calls the right
  8230. * listener function based on its target type.
  8231. *
  8232. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8233. * @param {String} type
  8234. * @param {Function} callback
  8235. * @return {Object}
  8236. */
  8237. function listen(target, type, callback) {
  8238. if (!target && !type && !callback) {
  8239. throw new Error('Missing required arguments');
  8240. }
  8241. if (!is.string(type)) {
  8242. throw new TypeError('Second argument must be a String');
  8243. }
  8244. if (!is.fn(callback)) {
  8245. throw new TypeError('Third argument must be a Function');
  8246. }
  8247. if (is.node(target)) {
  8248. return listenNode(target, type, callback);
  8249. }
  8250. else if (is.nodeList(target)) {
  8251. return listenNodeList(target, type, callback);
  8252. }
  8253. else if (is.string(target)) {
  8254. return listenSelector(target, type, callback);
  8255. }
  8256. else {
  8257. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8258. }
  8259. }
  8260. /**
  8261. * Adds an event listener to a HTML element
  8262. * and returns a remove listener function.
  8263. *
  8264. * @param {HTMLElement} node
  8265. * @param {String} type
  8266. * @param {Function} callback
  8267. * @return {Object}
  8268. */
  8269. function listenNode(node, type, callback) {
  8270. node.addEventListener(type, callback);
  8271. return {
  8272. destroy: function() {
  8273. node.removeEventListener(type, callback);
  8274. }
  8275. }
  8276. }
  8277. /**
  8278. * Add an event listener to a list of HTML elements
  8279. * and returns a remove listener function.
  8280. *
  8281. * @param {NodeList|HTMLCollection} nodeList
  8282. * @param {String} type
  8283. * @param {Function} callback
  8284. * @return {Object}
  8285. */
  8286. function listenNodeList(nodeList, type, callback) {
  8287. Array.prototype.forEach.call(nodeList, function(node) {
  8288. node.addEventListener(type, callback);
  8289. });
  8290. return {
  8291. destroy: function() {
  8292. Array.prototype.forEach.call(nodeList, function(node) {
  8293. node.removeEventListener(type, callback);
  8294. });
  8295. }
  8296. }
  8297. }
  8298. /**
  8299. * Add an event listener to a selector
  8300. * and returns a remove listener function.
  8301. *
  8302. * @param {String} selector
  8303. * @param {String} type
  8304. * @param {Function} callback
  8305. * @return {Object}
  8306. */
  8307. function listenSelector(selector, type, callback) {
  8308. return delegate(document.body, selector, type, callback);
  8309. }
  8310. module.exports = listen;
  8311. /***/ }),
  8312. /* 5 */
  8313. /***/ (function(module, exports) {
  8314. /**
  8315. * Check if argument is a HTML element.
  8316. *
  8317. * @param {Object} value
  8318. * @return {Boolean}
  8319. */
  8320. exports.node = function(value) {
  8321. return value !== undefined
  8322. && value instanceof HTMLElement
  8323. && value.nodeType === 1;
  8324. };
  8325. /**
  8326. * Check if argument is a list of HTML elements.
  8327. *
  8328. * @param {Object} value
  8329. * @return {Boolean}
  8330. */
  8331. exports.nodeList = function(value) {
  8332. var type = Object.prototype.toString.call(value);
  8333. return value !== undefined
  8334. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8335. && ('length' in value)
  8336. && (value.length === 0 || exports.node(value[0]));
  8337. };
  8338. /**
  8339. * Check if argument is a string.
  8340. *
  8341. * @param {Object} value
  8342. * @return {Boolean}
  8343. */
  8344. exports.string = function(value) {
  8345. return typeof value === 'string'
  8346. || value instanceof String;
  8347. };
  8348. /**
  8349. * Check if argument is a function.
  8350. *
  8351. * @param {Object} value
  8352. * @return {Boolean}
  8353. */
  8354. exports.fn = function(value) {
  8355. var type = Object.prototype.toString.call(value);
  8356. return type === '[object Function]';
  8357. };
  8358. /***/ }),
  8359. /* 6 */
  8360. /***/ (function(module, exports, __webpack_require__) {
  8361. var closest = __webpack_require__(7);
  8362. /**
  8363. * Delegates event to a selector.
  8364. *
  8365. * @param {Element} element
  8366. * @param {String} selector
  8367. * @param {String} type
  8368. * @param {Function} callback
  8369. * @param {Boolean} useCapture
  8370. * @return {Object}
  8371. */
  8372. function _delegate(element, selector, type, callback, useCapture) {
  8373. var listenerFn = listener.apply(this, arguments);
  8374. element.addEventListener(type, listenerFn, useCapture);
  8375. return {
  8376. destroy: function() {
  8377. element.removeEventListener(type, listenerFn, useCapture);
  8378. }
  8379. }
  8380. }
  8381. /**
  8382. * Delegates event to a selector.
  8383. *
  8384. * @param {Element|String|Array} [elements]
  8385. * @param {String} selector
  8386. * @param {String} type
  8387. * @param {Function} callback
  8388. * @param {Boolean} useCapture
  8389. * @return {Object}
  8390. */
  8391. function delegate(elements, selector, type, callback, useCapture) {
  8392. // Handle the regular Element usage
  8393. if (typeof elements.addEventListener === 'function') {
  8394. return _delegate.apply(null, arguments);
  8395. }
  8396. // Handle Element-less usage, it defaults to global delegation
  8397. if (typeof type === 'function') {
  8398. // Use `document` as the first parameter, then apply arguments
  8399. // This is a short way to .unshift `arguments` without running into deoptimizations
  8400. return _delegate.bind(null, document).apply(null, arguments);
  8401. }
  8402. // Handle Selector-based usage
  8403. if (typeof elements === 'string') {
  8404. elements = document.querySelectorAll(elements);
  8405. }
  8406. // Handle Array-like based usage
  8407. return Array.prototype.map.call(elements, function (element) {
  8408. return _delegate(element, selector, type, callback, useCapture);
  8409. });
  8410. }
  8411. /**
  8412. * Finds closest match and invokes callback.
  8413. *
  8414. * @param {Element} element
  8415. * @param {String} selector
  8416. * @param {String} type
  8417. * @param {Function} callback
  8418. * @return {Function}
  8419. */
  8420. function listener(element, selector, type, callback) {
  8421. return function(e) {
  8422. e.delegateTarget = closest(e.target, selector);
  8423. if (e.delegateTarget) {
  8424. callback.call(element, e);
  8425. }
  8426. }
  8427. }
  8428. module.exports = delegate;
  8429. /***/ }),
  8430. /* 7 */
  8431. /***/ (function(module, exports) {
  8432. var DOCUMENT_NODE_TYPE = 9;
  8433. /**
  8434. * A polyfill for Element.matches()
  8435. */
  8436. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8437. var proto = Element.prototype;
  8438. proto.matches = proto.matchesSelector ||
  8439. proto.mozMatchesSelector ||
  8440. proto.msMatchesSelector ||
  8441. proto.oMatchesSelector ||
  8442. proto.webkitMatchesSelector;
  8443. }
  8444. /**
  8445. * Finds the closest parent that matches a selector.
  8446. *
  8447. * @param {Element} element
  8448. * @param {String} selector
  8449. * @return {Function}
  8450. */
  8451. function closest (element, selector) {
  8452. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8453. if (typeof element.matches === 'function' &&
  8454. element.matches(selector)) {
  8455. return element;
  8456. }
  8457. element = element.parentNode;
  8458. }
  8459. }
  8460. module.exports = closest;
  8461. /***/ })
  8462. /******/ ]);
  8463. });
  8464. /***/ }),
  8465. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  8466. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  8467. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  8468. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  8469. /*! no static exports found */
  8470. /***/ (function(module, exports, __webpack_require__) {
  8471. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8472. // imports
  8473. // module
  8474. exports.push([module.i, "\n.loader[data-v-9a543b64],\n.loader[data-v-9a543b64]:after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n.loader[data-v-9a543b64] {\n margin: 60px auto;\n font-size: 10px;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(255, 255, 255, 0.2);\n border-right: 1.1em solid rgba(255, 255, 255, 0.2);\n border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);\n border-left: 1.1em solid #663399;\n transform: translateZ(0);\n -webkit-animation: load8-data-v-9a543b64 1.1s infinite linear;\n animation: load8-data-v-9a543b64 1.1s infinite linear;\n}\n@-webkit-keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n@keyframes load8-data-v-9a543b64 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n", ""]);
  8475. // exports
  8476. /***/ }),
  8477. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  8478. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8479. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  8480. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8481. /*! no static exports found */
  8482. /***/ (function(module, exports, __webpack_require__) {
  8483. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8484. // imports
  8485. // module
  8486. exports.push([module.i, "\n.full-height[data-v-1ae8ae93] {\n height: 100vh;\n}\n.flex-center[data-v-1ae8ae93] {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n.position-ref[data-v-1ae8ae93] {\n position: relative;\n}\n.top-right[data-v-1ae8ae93] {\n position: absolute;\n right: 10px;\n top: 18px;\n}\n.content[data-v-1ae8ae93] {\n text-align: center;\n}\n.title[data-v-1ae8ae93] {\n font-size: 60px;\n}\n.links > a[data-v-1ae8ae93] {\n color: #636b6f;\n padding: 0 25px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: .1rem;\n text-decoration: none;\n text-transform: uppercase;\n}\n.m-b-md[data-v-1ae8ae93] {\n margin-bottom: 30px;\n color: #000000;\n}\n", ""]);
  8487. // exports
  8488. /***/ }),
  8489. /***/ "./node_modules/css-loader/lib/css-base.js":
  8490. /*!*************************************************!*\
  8491. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8492. \*************************************************/
  8493. /*! no static exports found */
  8494. /***/ (function(module, exports) {
  8495. /*
  8496. MIT License http://www.opensource.org/licenses/mit-license.php
  8497. Author Tobias Koppers @sokra
  8498. */
  8499. // css base code, injected by the css-loader
  8500. module.exports = function(useSourceMap) {
  8501. var list = [];
  8502. // return the list of modules as css string
  8503. list.toString = function toString() {
  8504. return this.map(function (item) {
  8505. var content = cssWithMappingToString(item, useSourceMap);
  8506. if(item[2]) {
  8507. return "@media " + item[2] + "{" + content + "}";
  8508. } else {
  8509. return content;
  8510. }
  8511. }).join("");
  8512. };
  8513. // import a list of modules into the list
  8514. list.i = function(modules, mediaQuery) {
  8515. if(typeof modules === "string")
  8516. modules = [[null, modules, ""]];
  8517. var alreadyImportedModules = {};
  8518. for(var i = 0; i < this.length; i++) {
  8519. var id = this[i][0];
  8520. if(typeof id === "number")
  8521. alreadyImportedModules[id] = true;
  8522. }
  8523. for(i = 0; i < modules.length; i++) {
  8524. var item = modules[i];
  8525. // skip already imported module
  8526. // this implementation is not 100% perfect for weird media query combinations
  8527. // when a module is imported multiple times with different media queries.
  8528. // I hope this will never occur (Hey this way we have smaller bundles)
  8529. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8530. if(mediaQuery && !item[2]) {
  8531. item[2] = mediaQuery;
  8532. } else if(mediaQuery) {
  8533. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  8534. }
  8535. list.push(item);
  8536. }
  8537. }
  8538. };
  8539. return list;
  8540. };
  8541. function cssWithMappingToString(item, useSourceMap) {
  8542. var content = item[1] || '';
  8543. var cssMapping = item[3];
  8544. if (!cssMapping) {
  8545. return content;
  8546. }
  8547. if (useSourceMap && typeof btoa === 'function') {
  8548. var sourceMapping = toComment(cssMapping);
  8549. var sourceURLs = cssMapping.sources.map(function (source) {
  8550. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  8551. });
  8552. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  8553. }
  8554. return [content].join('\n');
  8555. }
  8556. // Adapted from convert-source-map (MIT)
  8557. function toComment(sourceMap) {
  8558. // eslint-disable-next-line no-undef
  8559. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  8560. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  8561. return '/*# ' + data + ' */';
  8562. }
  8563. /***/ }),
  8564. /***/ "./node_modules/ieee754/index.js":
  8565. /*!***************************************!*\
  8566. !*** ./node_modules/ieee754/index.js ***!
  8567. \***************************************/
  8568. /*! no static exports found */
  8569. /***/ (function(module, exports) {
  8570. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8571. var e, m
  8572. var eLen = (nBytes * 8) - mLen - 1
  8573. var eMax = (1 << eLen) - 1
  8574. var eBias = eMax >> 1
  8575. var nBits = -7
  8576. var i = isLE ? (nBytes - 1) : 0
  8577. var d = isLE ? -1 : 1
  8578. var s = buffer[offset + i]
  8579. i += d
  8580. e = s & ((1 << (-nBits)) - 1)
  8581. s >>= (-nBits)
  8582. nBits += eLen
  8583. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8584. m = e & ((1 << (-nBits)) - 1)
  8585. e >>= (-nBits)
  8586. nBits += mLen
  8587. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8588. if (e === 0) {
  8589. e = 1 - eBias
  8590. } else if (e === eMax) {
  8591. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8592. } else {
  8593. m = m + Math.pow(2, mLen)
  8594. e = e - eBias
  8595. }
  8596. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8597. }
  8598. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8599. var e, m, c
  8600. var eLen = (nBytes * 8) - mLen - 1
  8601. var eMax = (1 << eLen) - 1
  8602. var eBias = eMax >> 1
  8603. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8604. var i = isLE ? 0 : (nBytes - 1)
  8605. var d = isLE ? 1 : -1
  8606. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8607. value = Math.abs(value)
  8608. if (isNaN(value) || value === Infinity) {
  8609. m = isNaN(value) ? 1 : 0
  8610. e = eMax
  8611. } else {
  8612. e = Math.floor(Math.log(value) / Math.LN2)
  8613. if (value * (c = Math.pow(2, -e)) < 1) {
  8614. e--
  8615. c *= 2
  8616. }
  8617. if (e + eBias >= 1) {
  8618. value += rt / c
  8619. } else {
  8620. value += rt * Math.pow(2, 1 - eBias)
  8621. }
  8622. if (value * c >= 2) {
  8623. e++
  8624. c /= 2
  8625. }
  8626. if (e + eBias >= eMax) {
  8627. m = 0
  8628. e = eMax
  8629. } else if (e + eBias >= 1) {
  8630. m = ((value * c) - 1) * Math.pow(2, mLen)
  8631. e = e + eBias
  8632. } else {
  8633. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8634. e = 0
  8635. }
  8636. }
  8637. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8638. e = (e << mLen) | m
  8639. eLen += mLen
  8640. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8641. buffer[offset + i - d] |= s * 128
  8642. }
  8643. /***/ }),
  8644. /***/ "./node_modules/isarray/index.js":
  8645. /*!***************************************!*\
  8646. !*** ./node_modules/isarray/index.js ***!
  8647. \***************************************/
  8648. /*! no static exports found */
  8649. /***/ (function(module, exports) {
  8650. var toString = {}.toString;
  8651. module.exports = Array.isArray || function (arr) {
  8652. return toString.call(arr) == '[object Array]';
  8653. };
  8654. /***/ }),
  8655. /***/ "./node_modules/jquery/dist/jquery.js":
  8656. /*!********************************************!*\
  8657. !*** ./node_modules/jquery/dist/jquery.js ***!
  8658. \********************************************/
  8659. /*! no static exports found */
  8660. /***/ (function(module, exports, __webpack_require__) {
  8661. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8662. * jQuery JavaScript Library v3.4.1
  8663. * https://jquery.com/
  8664. *
  8665. * Includes Sizzle.js
  8666. * https://sizzlejs.com/
  8667. *
  8668. * Copyright JS Foundation and other contributors
  8669. * Released under the MIT license
  8670. * https://jquery.org/license
  8671. *
  8672. * Date: 2019-05-01T21:04Z
  8673. */
  8674. ( function( global, factory ) {
  8675. "use strict";
  8676. if ( true && typeof module.exports === "object" ) {
  8677. // For CommonJS and CommonJS-like environments where a proper `window`
  8678. // is present, execute the factory and get jQuery.
  8679. // For environments that do not have a `window` with a `document`
  8680. // (such as Node.js), expose a factory as module.exports.
  8681. // This accentuates the need for the creation of a real `window`.
  8682. // e.g. var jQuery = require("jquery")(window);
  8683. // See ticket #14549 for more info.
  8684. module.exports = global.document ?
  8685. factory( global, true ) :
  8686. function( w ) {
  8687. if ( !w.document ) {
  8688. throw new Error( "jQuery requires a window with a document" );
  8689. }
  8690. return factory( w );
  8691. };
  8692. } else {
  8693. factory( global );
  8694. }
  8695. // Pass this if window is not defined yet
  8696. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8697. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8698. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8699. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8700. // enough that all such attempts are guarded in a try block.
  8701. "use strict";
  8702. var arr = [];
  8703. var document = window.document;
  8704. var getProto = Object.getPrototypeOf;
  8705. var slice = arr.slice;
  8706. var concat = arr.concat;
  8707. var push = arr.push;
  8708. var indexOf = arr.indexOf;
  8709. var class2type = {};
  8710. var toString = class2type.toString;
  8711. var hasOwn = class2type.hasOwnProperty;
  8712. var fnToString = hasOwn.toString;
  8713. var ObjectFunctionString = fnToString.call( Object );
  8714. var support = {};
  8715. var isFunction = function isFunction( obj ) {
  8716. // Support: Chrome <=57, Firefox <=52
  8717. // In some browsers, typeof returns "function" for HTML <object> elements
  8718. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8719. // We don't want to classify *any* DOM node as a function.
  8720. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8721. };
  8722. var isWindow = function isWindow( obj ) {
  8723. return obj != null && obj === obj.window;
  8724. };
  8725. var preservedScriptAttributes = {
  8726. type: true,
  8727. src: true,
  8728. nonce: true,
  8729. noModule: true
  8730. };
  8731. function DOMEval( code, node, doc ) {
  8732. doc = doc || document;
  8733. var i, val,
  8734. script = doc.createElement( "script" );
  8735. script.text = code;
  8736. if ( node ) {
  8737. for ( i in preservedScriptAttributes ) {
  8738. // Support: Firefox 64+, Edge 18+
  8739. // Some browsers don't support the "nonce" property on scripts.
  8740. // On the other hand, just using `getAttribute` is not enough as
  8741. // the `nonce` attribute is reset to an empty string whenever it
  8742. // becomes browsing-context connected.
  8743. // See https://github.com/whatwg/html/issues/2369
  8744. // See https://html.spec.whatwg.org/#nonce-attributes
  8745. // The `node.getAttribute` check was added for the sake of
  8746. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8747. // via an object.
  8748. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8749. if ( val ) {
  8750. script.setAttribute( i, val );
  8751. }
  8752. }
  8753. }
  8754. doc.head.appendChild( script ).parentNode.removeChild( script );
  8755. }
  8756. function toType( obj ) {
  8757. if ( obj == null ) {
  8758. return obj + "";
  8759. }
  8760. // Support: Android <=2.3 only (functionish RegExp)
  8761. return typeof obj === "object" || typeof obj === "function" ?
  8762. class2type[ toString.call( obj ) ] || "object" :
  8763. typeof obj;
  8764. }
  8765. /* global Symbol */
  8766. // Defining this global in .eslintrc.json would create a danger of using the global
  8767. // unguarded in another place, it seems safer to define global only for this module
  8768. var
  8769. version = "3.4.1",
  8770. // Define a local copy of jQuery
  8771. jQuery = function( selector, context ) {
  8772. // The jQuery object is actually just the init constructor 'enhanced'
  8773. // Need init if jQuery is called (just allow error to be thrown if not included)
  8774. return new jQuery.fn.init( selector, context );
  8775. },
  8776. // Support: Android <=4.0 only
  8777. // Make sure we trim BOM and NBSP
  8778. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8779. jQuery.fn = jQuery.prototype = {
  8780. // The current version of jQuery being used
  8781. jquery: version,
  8782. constructor: jQuery,
  8783. // The default length of a jQuery object is 0
  8784. length: 0,
  8785. toArray: function() {
  8786. return slice.call( this );
  8787. },
  8788. // Get the Nth element in the matched element set OR
  8789. // Get the whole matched element set as a clean array
  8790. get: function( num ) {
  8791. // Return all the elements in a clean array
  8792. if ( num == null ) {
  8793. return slice.call( this );
  8794. }
  8795. // Return just the one element from the set
  8796. return num < 0 ? this[ num + this.length ] : this[ num ];
  8797. },
  8798. // Take an array of elements and push it onto the stack
  8799. // (returning the new matched element set)
  8800. pushStack: function( elems ) {
  8801. // Build a new jQuery matched element set
  8802. var ret = jQuery.merge( this.constructor(), elems );
  8803. // Add the old object onto the stack (as a reference)
  8804. ret.prevObject = this;
  8805. // Return the newly-formed element set
  8806. return ret;
  8807. },
  8808. // Execute a callback for every element in the matched set.
  8809. each: function( callback ) {
  8810. return jQuery.each( this, callback );
  8811. },
  8812. map: function( callback ) {
  8813. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8814. return callback.call( elem, i, elem );
  8815. } ) );
  8816. },
  8817. slice: function() {
  8818. return this.pushStack( slice.apply( this, arguments ) );
  8819. },
  8820. first: function() {
  8821. return this.eq( 0 );
  8822. },
  8823. last: function() {
  8824. return this.eq( -1 );
  8825. },
  8826. eq: function( i ) {
  8827. var len = this.length,
  8828. j = +i + ( i < 0 ? len : 0 );
  8829. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8830. },
  8831. end: function() {
  8832. return this.prevObject || this.constructor();
  8833. },
  8834. // For internal use only.
  8835. // Behaves like an Array's method, not like a jQuery method.
  8836. push: push,
  8837. sort: arr.sort,
  8838. splice: arr.splice
  8839. };
  8840. jQuery.extend = jQuery.fn.extend = function() {
  8841. var options, name, src, copy, copyIsArray, clone,
  8842. target = arguments[ 0 ] || {},
  8843. i = 1,
  8844. length = arguments.length,
  8845. deep = false;
  8846. // Handle a deep copy situation
  8847. if ( typeof target === "boolean" ) {
  8848. deep = target;
  8849. // Skip the boolean and the target
  8850. target = arguments[ i ] || {};
  8851. i++;
  8852. }
  8853. // Handle case when target is a string or something (possible in deep copy)
  8854. if ( typeof target !== "object" && !isFunction( target ) ) {
  8855. target = {};
  8856. }
  8857. // Extend jQuery itself if only one argument is passed
  8858. if ( i === length ) {
  8859. target = this;
  8860. i--;
  8861. }
  8862. for ( ; i < length; i++ ) {
  8863. // Only deal with non-null/undefined values
  8864. if ( ( options = arguments[ i ] ) != null ) {
  8865. // Extend the base object
  8866. for ( name in options ) {
  8867. copy = options[ name ];
  8868. // Prevent Object.prototype pollution
  8869. // Prevent never-ending loop
  8870. if ( name === "__proto__" || target === copy ) {
  8871. continue;
  8872. }
  8873. // Recurse if we're merging plain objects or arrays
  8874. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8875. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8876. src = target[ name ];
  8877. // Ensure proper type for the source value
  8878. if ( copyIsArray && !Array.isArray( src ) ) {
  8879. clone = [];
  8880. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8881. clone = {};
  8882. } else {
  8883. clone = src;
  8884. }
  8885. copyIsArray = false;
  8886. // Never move original objects, clone them
  8887. target[ name ] = jQuery.extend( deep, clone, copy );
  8888. // Don't bring in undefined values
  8889. } else if ( copy !== undefined ) {
  8890. target[ name ] = copy;
  8891. }
  8892. }
  8893. }
  8894. }
  8895. // Return the modified object
  8896. return target;
  8897. };
  8898. jQuery.extend( {
  8899. // Unique for each copy of jQuery on the page
  8900. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8901. // Assume jQuery is ready without the ready module
  8902. isReady: true,
  8903. error: function( msg ) {
  8904. throw new Error( msg );
  8905. },
  8906. noop: function() {},
  8907. isPlainObject: function( obj ) {
  8908. var proto, Ctor;
  8909. // Detect obvious negatives
  8910. // Use toString instead of jQuery.type to catch host objects
  8911. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8912. return false;
  8913. }
  8914. proto = getProto( obj );
  8915. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8916. if ( !proto ) {
  8917. return true;
  8918. }
  8919. // Objects with prototype are plain iff they were constructed by a global Object function
  8920. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8921. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8922. },
  8923. isEmptyObject: function( obj ) {
  8924. var name;
  8925. for ( name in obj ) {
  8926. return false;
  8927. }
  8928. return true;
  8929. },
  8930. // Evaluates a script in a global context
  8931. globalEval: function( code, options ) {
  8932. DOMEval( code, { nonce: options && options.nonce } );
  8933. },
  8934. each: function( obj, callback ) {
  8935. var length, i = 0;
  8936. if ( isArrayLike( obj ) ) {
  8937. length = obj.length;
  8938. for ( ; i < length; i++ ) {
  8939. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8940. break;
  8941. }
  8942. }
  8943. } else {
  8944. for ( i in obj ) {
  8945. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8946. break;
  8947. }
  8948. }
  8949. }
  8950. return obj;
  8951. },
  8952. // Support: Android <=4.0 only
  8953. trim: function( text ) {
  8954. return text == null ?
  8955. "" :
  8956. ( text + "" ).replace( rtrim, "" );
  8957. },
  8958. // results is for internal usage only
  8959. makeArray: function( arr, results ) {
  8960. var ret = results || [];
  8961. if ( arr != null ) {
  8962. if ( isArrayLike( Object( arr ) ) ) {
  8963. jQuery.merge( ret,
  8964. typeof arr === "string" ?
  8965. [ arr ] : arr
  8966. );
  8967. } else {
  8968. push.call( ret, arr );
  8969. }
  8970. }
  8971. return ret;
  8972. },
  8973. inArray: function( elem, arr, i ) {
  8974. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8975. },
  8976. // Support: Android <=4.0 only, PhantomJS 1 only
  8977. // push.apply(_, arraylike) throws on ancient WebKit
  8978. merge: function( first, second ) {
  8979. var len = +second.length,
  8980. j = 0,
  8981. i = first.length;
  8982. for ( ; j < len; j++ ) {
  8983. first[ i++ ] = second[ j ];
  8984. }
  8985. first.length = i;
  8986. return first;
  8987. },
  8988. grep: function( elems, callback, invert ) {
  8989. var callbackInverse,
  8990. matches = [],
  8991. i = 0,
  8992. length = elems.length,
  8993. callbackExpect = !invert;
  8994. // Go through the array, only saving the items
  8995. // that pass the validator function
  8996. for ( ; i < length; i++ ) {
  8997. callbackInverse = !callback( elems[ i ], i );
  8998. if ( callbackInverse !== callbackExpect ) {
  8999. matches.push( elems[ i ] );
  9000. }
  9001. }
  9002. return matches;
  9003. },
  9004. // arg is for internal usage only
  9005. map: function( elems, callback, arg ) {
  9006. var length, value,
  9007. i = 0,
  9008. ret = [];
  9009. // Go through the array, translating each of the items to their new values
  9010. if ( isArrayLike( elems ) ) {
  9011. length = elems.length;
  9012. for ( ; i < length; i++ ) {
  9013. value = callback( elems[ i ], i, arg );
  9014. if ( value != null ) {
  9015. ret.push( value );
  9016. }
  9017. }
  9018. // Go through every key on the object,
  9019. } else {
  9020. for ( i in elems ) {
  9021. value = callback( elems[ i ], i, arg );
  9022. if ( value != null ) {
  9023. ret.push( value );
  9024. }
  9025. }
  9026. }
  9027. // Flatten any nested arrays
  9028. return concat.apply( [], ret );
  9029. },
  9030. // A global GUID counter for objects
  9031. guid: 1,
  9032. // jQuery.support is not used in Core but other projects attach their
  9033. // properties to it so it needs to exist.
  9034. support: support
  9035. } );
  9036. if ( typeof Symbol === "function" ) {
  9037. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9038. }
  9039. // Populate the class2type map
  9040. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9041. function( i, name ) {
  9042. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9043. } );
  9044. function isArrayLike( obj ) {
  9045. // Support: real iOS 8.2 only (not reproducible in simulator)
  9046. // `in` check used to prevent JIT error (gh-2145)
  9047. // hasOwn isn't used here due to false negatives
  9048. // regarding Nodelist length in IE
  9049. var length = !!obj && "length" in obj && obj.length,
  9050. type = toType( obj );
  9051. if ( isFunction( obj ) || isWindow( obj ) ) {
  9052. return false;
  9053. }
  9054. return type === "array" || length === 0 ||
  9055. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9056. }
  9057. var Sizzle =
  9058. /*!
  9059. * Sizzle CSS Selector Engine v2.3.4
  9060. * https://sizzlejs.com/
  9061. *
  9062. * Copyright JS Foundation and other contributors
  9063. * Released under the MIT license
  9064. * https://js.foundation/
  9065. *
  9066. * Date: 2019-04-08
  9067. */
  9068. (function( window ) {
  9069. var i,
  9070. support,
  9071. Expr,
  9072. getText,
  9073. isXML,
  9074. tokenize,
  9075. compile,
  9076. select,
  9077. outermostContext,
  9078. sortInput,
  9079. hasDuplicate,
  9080. // Local document vars
  9081. setDocument,
  9082. document,
  9083. docElem,
  9084. documentIsHTML,
  9085. rbuggyQSA,
  9086. rbuggyMatches,
  9087. matches,
  9088. contains,
  9089. // Instance-specific data
  9090. expando = "sizzle" + 1 * new Date(),
  9091. preferredDoc = window.document,
  9092. dirruns = 0,
  9093. done = 0,
  9094. classCache = createCache(),
  9095. tokenCache = createCache(),
  9096. compilerCache = createCache(),
  9097. nonnativeSelectorCache = createCache(),
  9098. sortOrder = function( a, b ) {
  9099. if ( a === b ) {
  9100. hasDuplicate = true;
  9101. }
  9102. return 0;
  9103. },
  9104. // Instance methods
  9105. hasOwn = ({}).hasOwnProperty,
  9106. arr = [],
  9107. pop = arr.pop,
  9108. push_native = arr.push,
  9109. push = arr.push,
  9110. slice = arr.slice,
  9111. // Use a stripped-down indexOf as it's faster than native
  9112. // https://jsperf.com/thor-indexof-vs-for/5
  9113. indexOf = function( list, elem ) {
  9114. var i = 0,
  9115. len = list.length;
  9116. for ( ; i < len; i++ ) {
  9117. if ( list[i] === elem ) {
  9118. return i;
  9119. }
  9120. }
  9121. return -1;
  9122. },
  9123. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9124. // Regular expressions
  9125. // http://www.w3.org/TR/css3-selectors/#whitespace
  9126. whitespace = "[\\x20\\t\\r\\n\\f]",
  9127. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9128. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9129. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9130. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9131. // Operator (capture 2)
  9132. "*([*^$|!~]?=)" + whitespace +
  9133. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9134. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9135. "*\\]",
  9136. pseudos = ":(" + identifier + ")(?:\\((" +
  9137. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9138. // 1. quoted (capture 3; capture 4 or capture 5)
  9139. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9140. // 2. simple (capture 6)
  9141. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9142. // 3. anything else (capture 2)
  9143. ".*" +
  9144. ")\\)|)",
  9145. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9146. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9147. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9148. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9149. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9150. rdescend = new RegExp( whitespace + "|>" ),
  9151. rpseudo = new RegExp( pseudos ),
  9152. ridentifier = new RegExp( "^" + identifier + "$" ),
  9153. matchExpr = {
  9154. "ID": new RegExp( "^#(" + identifier + ")" ),
  9155. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9156. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9157. "ATTR": new RegExp( "^" + attributes ),
  9158. "PSEUDO": new RegExp( "^" + pseudos ),
  9159. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9160. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9161. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9162. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9163. // For use in libraries implementing .is()
  9164. // We use this for POS matching in `select`
  9165. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9166. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9167. },
  9168. rhtml = /HTML$/i,
  9169. rinputs = /^(?:input|select|textarea|button)$/i,
  9170. rheader = /^h\d$/i,
  9171. rnative = /^[^{]+\{\s*\[native \w/,
  9172. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9173. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9174. rsibling = /[+~]/,
  9175. // CSS escapes
  9176. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9177. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9178. funescape = function( _, escaped, escapedWhitespace ) {
  9179. var high = "0x" + escaped - 0x10000;
  9180. // NaN means non-codepoint
  9181. // Support: Firefox<24
  9182. // Workaround erroneous numeric interpretation of +"0x"
  9183. return high !== high || escapedWhitespace ?
  9184. escaped :
  9185. high < 0 ?
  9186. // BMP codepoint
  9187. String.fromCharCode( high + 0x10000 ) :
  9188. // Supplemental Plane codepoint (surrogate pair)
  9189. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9190. },
  9191. // CSS string/identifier serialization
  9192. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9193. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9194. fcssescape = function( ch, asCodePoint ) {
  9195. if ( asCodePoint ) {
  9196. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9197. if ( ch === "\0" ) {
  9198. return "\uFFFD";
  9199. }
  9200. // Control characters and (dependent upon position) numbers get escaped as code points
  9201. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9202. }
  9203. // Other potentially-special ASCII characters get backslash-escaped
  9204. return "\\" + ch;
  9205. },
  9206. // Used for iframes
  9207. // See setDocument()
  9208. // Removing the function wrapper causes a "Permission Denied"
  9209. // error in IE
  9210. unloadHandler = function() {
  9211. setDocument();
  9212. },
  9213. inDisabledFieldset = addCombinator(
  9214. function( elem ) {
  9215. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9216. },
  9217. { dir: "parentNode", next: "legend" }
  9218. );
  9219. // Optimize for push.apply( _, NodeList )
  9220. try {
  9221. push.apply(
  9222. (arr = slice.call( preferredDoc.childNodes )),
  9223. preferredDoc.childNodes
  9224. );
  9225. // Support: Android<4.0
  9226. // Detect silently failing push.apply
  9227. arr[ preferredDoc.childNodes.length ].nodeType;
  9228. } catch ( e ) {
  9229. push = { apply: arr.length ?
  9230. // Leverage slice if possible
  9231. function( target, els ) {
  9232. push_native.apply( target, slice.call(els) );
  9233. } :
  9234. // Support: IE<9
  9235. // Otherwise append directly
  9236. function( target, els ) {
  9237. var j = target.length,
  9238. i = 0;
  9239. // Can't trust NodeList.length
  9240. while ( (target[j++] = els[i++]) ) {}
  9241. target.length = j - 1;
  9242. }
  9243. };
  9244. }
  9245. function Sizzle( selector, context, results, seed ) {
  9246. var m, i, elem, nid, match, groups, newSelector,
  9247. newContext = context && context.ownerDocument,
  9248. // nodeType defaults to 9, since context defaults to document
  9249. nodeType = context ? context.nodeType : 9;
  9250. results = results || [];
  9251. // Return early from calls with invalid selector or context
  9252. if ( typeof selector !== "string" || !selector ||
  9253. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9254. return results;
  9255. }
  9256. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9257. if ( !seed ) {
  9258. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9259. setDocument( context );
  9260. }
  9261. context = context || document;
  9262. if ( documentIsHTML ) {
  9263. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9264. // (excepting DocumentFragment context, where the methods don't exist)
  9265. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9266. // ID selector
  9267. if ( (m = match[1]) ) {
  9268. // Document context
  9269. if ( nodeType === 9 ) {
  9270. if ( (elem = context.getElementById( m )) ) {
  9271. // Support: IE, Opera, Webkit
  9272. // TODO: identify versions
  9273. // getElementById can match elements by name instead of ID
  9274. if ( elem.id === m ) {
  9275. results.push( elem );
  9276. return results;
  9277. }
  9278. } else {
  9279. return results;
  9280. }
  9281. // Element context
  9282. } else {
  9283. // Support: IE, Opera, Webkit
  9284. // TODO: identify versions
  9285. // getElementById can match elements by name instead of ID
  9286. if ( newContext && (elem = newContext.getElementById( m )) &&
  9287. contains( context, elem ) &&
  9288. elem.id === m ) {
  9289. results.push( elem );
  9290. return results;
  9291. }
  9292. }
  9293. // Type selector
  9294. } else if ( match[2] ) {
  9295. push.apply( results, context.getElementsByTagName( selector ) );
  9296. return results;
  9297. // Class selector
  9298. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9299. context.getElementsByClassName ) {
  9300. push.apply( results, context.getElementsByClassName( m ) );
  9301. return results;
  9302. }
  9303. }
  9304. // Take advantage of querySelectorAll
  9305. if ( support.qsa &&
  9306. !nonnativeSelectorCache[ selector + " " ] &&
  9307. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9308. // Support: IE 8 only
  9309. // Exclude object elements
  9310. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9311. newSelector = selector;
  9312. newContext = context;
  9313. // qSA considers elements outside a scoping root when evaluating child or
  9314. // descendant combinators, which is not what we want.
  9315. // In such cases, we work around the behavior by prefixing every selector in the
  9316. // list with an ID selector referencing the scope context.
  9317. // Thanks to Andrew Dupont for this technique.
  9318. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9319. // Capture the context ID, setting it first if necessary
  9320. if ( (nid = context.getAttribute( "id" )) ) {
  9321. nid = nid.replace( rcssescape, fcssescape );
  9322. } else {
  9323. context.setAttribute( "id", (nid = expando) );
  9324. }
  9325. // Prefix every selector in the list
  9326. groups = tokenize( selector );
  9327. i = groups.length;
  9328. while ( i-- ) {
  9329. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9330. }
  9331. newSelector = groups.join( "," );
  9332. // Expand context for sibling selectors
  9333. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9334. context;
  9335. }
  9336. try {
  9337. push.apply( results,
  9338. newContext.querySelectorAll( newSelector )
  9339. );
  9340. return results;
  9341. } catch ( qsaError ) {
  9342. nonnativeSelectorCache( selector, true );
  9343. } finally {
  9344. if ( nid === expando ) {
  9345. context.removeAttribute( "id" );
  9346. }
  9347. }
  9348. }
  9349. }
  9350. }
  9351. // All others
  9352. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9353. }
  9354. /**
  9355. * Create key-value caches of limited size
  9356. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9357. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9358. * deleting the oldest entry
  9359. */
  9360. function createCache() {
  9361. var keys = [];
  9362. function cache( key, value ) {
  9363. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9364. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9365. // Only keep the most recent entries
  9366. delete cache[ keys.shift() ];
  9367. }
  9368. return (cache[ key + " " ] = value);
  9369. }
  9370. return cache;
  9371. }
  9372. /**
  9373. * Mark a function for special use by Sizzle
  9374. * @param {Function} fn The function to mark
  9375. */
  9376. function markFunction( fn ) {
  9377. fn[ expando ] = true;
  9378. return fn;
  9379. }
  9380. /**
  9381. * Support testing using an element
  9382. * @param {Function} fn Passed the created element and returns a boolean result
  9383. */
  9384. function assert( fn ) {
  9385. var el = document.createElement("fieldset");
  9386. try {
  9387. return !!fn( el );
  9388. } catch (e) {
  9389. return false;
  9390. } finally {
  9391. // Remove from its parent by default
  9392. if ( el.parentNode ) {
  9393. el.parentNode.removeChild( el );
  9394. }
  9395. // release memory in IE
  9396. el = null;
  9397. }
  9398. }
  9399. /**
  9400. * Adds the same handler for all of the specified attrs
  9401. * @param {String} attrs Pipe-separated list of attributes
  9402. * @param {Function} handler The method that will be applied
  9403. */
  9404. function addHandle( attrs, handler ) {
  9405. var arr = attrs.split("|"),
  9406. i = arr.length;
  9407. while ( i-- ) {
  9408. Expr.attrHandle[ arr[i] ] = handler;
  9409. }
  9410. }
  9411. /**
  9412. * Checks document order of two siblings
  9413. * @param {Element} a
  9414. * @param {Element} b
  9415. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9416. */
  9417. function siblingCheck( a, b ) {
  9418. var cur = b && a,
  9419. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9420. a.sourceIndex - b.sourceIndex;
  9421. // Use IE sourceIndex if available on both nodes
  9422. if ( diff ) {
  9423. return diff;
  9424. }
  9425. // Check if b follows a
  9426. if ( cur ) {
  9427. while ( (cur = cur.nextSibling) ) {
  9428. if ( cur === b ) {
  9429. return -1;
  9430. }
  9431. }
  9432. }
  9433. return a ? 1 : -1;
  9434. }
  9435. /**
  9436. * Returns a function to use in pseudos for input types
  9437. * @param {String} type
  9438. */
  9439. function createInputPseudo( type ) {
  9440. return function( elem ) {
  9441. var name = elem.nodeName.toLowerCase();
  9442. return name === "input" && elem.type === type;
  9443. };
  9444. }
  9445. /**
  9446. * Returns a function to use in pseudos for buttons
  9447. * @param {String} type
  9448. */
  9449. function createButtonPseudo( type ) {
  9450. return function( elem ) {
  9451. var name = elem.nodeName.toLowerCase();
  9452. return (name === "input" || name === "button") && elem.type === type;
  9453. };
  9454. }
  9455. /**
  9456. * Returns a function to use in pseudos for :enabled/:disabled
  9457. * @param {Boolean} disabled true for :disabled; false for :enabled
  9458. */
  9459. function createDisabledPseudo( disabled ) {
  9460. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9461. return function( elem ) {
  9462. // Only certain elements can match :enabled or :disabled
  9463. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9464. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9465. if ( "form" in elem ) {
  9466. // Check for inherited disabledness on relevant non-disabled elements:
  9467. // * listed form-associated elements in a disabled fieldset
  9468. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9469. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9470. // * option elements in a disabled optgroup
  9471. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9472. // All such elements have a "form" property.
  9473. if ( elem.parentNode && elem.disabled === false ) {
  9474. // Option elements defer to a parent optgroup if present
  9475. if ( "label" in elem ) {
  9476. if ( "label" in elem.parentNode ) {
  9477. return elem.parentNode.disabled === disabled;
  9478. } else {
  9479. return elem.disabled === disabled;
  9480. }
  9481. }
  9482. // Support: IE 6 - 11
  9483. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9484. return elem.isDisabled === disabled ||
  9485. // Where there is no isDisabled, check manually
  9486. /* jshint -W018 */
  9487. elem.isDisabled !== !disabled &&
  9488. inDisabledFieldset( elem ) === disabled;
  9489. }
  9490. return elem.disabled === disabled;
  9491. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9492. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9493. // even exist on them, let alone have a boolean value.
  9494. } else if ( "label" in elem ) {
  9495. return elem.disabled === disabled;
  9496. }
  9497. // Remaining elements are neither :enabled nor :disabled
  9498. return false;
  9499. };
  9500. }
  9501. /**
  9502. * Returns a function to use in pseudos for positionals
  9503. * @param {Function} fn
  9504. */
  9505. function createPositionalPseudo( fn ) {
  9506. return markFunction(function( argument ) {
  9507. argument = +argument;
  9508. return markFunction(function( seed, matches ) {
  9509. var j,
  9510. matchIndexes = fn( [], seed.length, argument ),
  9511. i = matchIndexes.length;
  9512. // Match elements found at the specified indexes
  9513. while ( i-- ) {
  9514. if ( seed[ (j = matchIndexes[i]) ] ) {
  9515. seed[j] = !(matches[j] = seed[j]);
  9516. }
  9517. }
  9518. });
  9519. });
  9520. }
  9521. /**
  9522. * Checks a node for validity as a Sizzle context
  9523. * @param {Element|Object=} context
  9524. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9525. */
  9526. function testContext( context ) {
  9527. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9528. }
  9529. // Expose support vars for convenience
  9530. support = Sizzle.support = {};
  9531. /**
  9532. * Detects XML nodes
  9533. * @param {Element|Object} elem An element or a document
  9534. * @returns {Boolean} True iff elem is a non-HTML XML node
  9535. */
  9536. isXML = Sizzle.isXML = function( elem ) {
  9537. var namespace = elem.namespaceURI,
  9538. docElem = (elem.ownerDocument || elem).documentElement;
  9539. // Support: IE <=8
  9540. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9541. // https://bugs.jquery.com/ticket/4833
  9542. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9543. };
  9544. /**
  9545. * Sets document-related variables once based on the current document
  9546. * @param {Element|Object} [doc] An element or document object to use to set the document
  9547. * @returns {Object} Returns the current document
  9548. */
  9549. setDocument = Sizzle.setDocument = function( node ) {
  9550. var hasCompare, subWindow,
  9551. doc = node ? node.ownerDocument || node : preferredDoc;
  9552. // Return early if doc is invalid or already selected
  9553. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9554. return document;
  9555. }
  9556. // Update global variables
  9557. document = doc;
  9558. docElem = document.documentElement;
  9559. documentIsHTML = !isXML( document );
  9560. // Support: IE 9-11, Edge
  9561. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9562. if ( preferredDoc !== document &&
  9563. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9564. // Support: IE 11, Edge
  9565. if ( subWindow.addEventListener ) {
  9566. subWindow.addEventListener( "unload", unloadHandler, false );
  9567. // Support: IE 9 - 10 only
  9568. } else if ( subWindow.attachEvent ) {
  9569. subWindow.attachEvent( "onunload", unloadHandler );
  9570. }
  9571. }
  9572. /* Attributes
  9573. ---------------------------------------------------------------------- */
  9574. // Support: IE<8
  9575. // Verify that getAttribute really returns attributes and not properties
  9576. // (excepting IE8 booleans)
  9577. support.attributes = assert(function( el ) {
  9578. el.className = "i";
  9579. return !el.getAttribute("className");
  9580. });
  9581. /* getElement(s)By*
  9582. ---------------------------------------------------------------------- */
  9583. // Check if getElementsByTagName("*") returns only elements
  9584. support.getElementsByTagName = assert(function( el ) {
  9585. el.appendChild( document.createComment("") );
  9586. return !el.getElementsByTagName("*").length;
  9587. });
  9588. // Support: IE<9
  9589. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9590. // Support: IE<10
  9591. // Check if getElementById returns elements by name
  9592. // The broken getElementById methods don't pick up programmatically-set names,
  9593. // so use a roundabout getElementsByName test
  9594. support.getById = assert(function( el ) {
  9595. docElem.appendChild( el ).id = expando;
  9596. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9597. });
  9598. // ID filter and find
  9599. if ( support.getById ) {
  9600. Expr.filter["ID"] = function( id ) {
  9601. var attrId = id.replace( runescape, funescape );
  9602. return function( elem ) {
  9603. return elem.getAttribute("id") === attrId;
  9604. };
  9605. };
  9606. Expr.find["ID"] = function( id, context ) {
  9607. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9608. var elem = context.getElementById( id );
  9609. return elem ? [ elem ] : [];
  9610. }
  9611. };
  9612. } else {
  9613. Expr.filter["ID"] = function( id ) {
  9614. var attrId = id.replace( runescape, funescape );
  9615. return function( elem ) {
  9616. var node = typeof elem.getAttributeNode !== "undefined" &&
  9617. elem.getAttributeNode("id");
  9618. return node && node.value === attrId;
  9619. };
  9620. };
  9621. // Support: IE 6 - 7 only
  9622. // getElementById is not reliable as a find shortcut
  9623. Expr.find["ID"] = function( id, context ) {
  9624. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9625. var node, i, elems,
  9626. elem = context.getElementById( id );
  9627. if ( elem ) {
  9628. // Verify the id attribute
  9629. node = elem.getAttributeNode("id");
  9630. if ( node && node.value === id ) {
  9631. return [ elem ];
  9632. }
  9633. // Fall back on getElementsByName
  9634. elems = context.getElementsByName( id );
  9635. i = 0;
  9636. while ( (elem = elems[i++]) ) {
  9637. node = elem.getAttributeNode("id");
  9638. if ( node && node.value === id ) {
  9639. return [ elem ];
  9640. }
  9641. }
  9642. }
  9643. return [];
  9644. }
  9645. };
  9646. }
  9647. // Tag
  9648. Expr.find["TAG"] = support.getElementsByTagName ?
  9649. function( tag, context ) {
  9650. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9651. return context.getElementsByTagName( tag );
  9652. // DocumentFragment nodes don't have gEBTN
  9653. } else if ( support.qsa ) {
  9654. return context.querySelectorAll( tag );
  9655. }
  9656. } :
  9657. function( tag, context ) {
  9658. var elem,
  9659. tmp = [],
  9660. i = 0,
  9661. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9662. results = context.getElementsByTagName( tag );
  9663. // Filter out possible comments
  9664. if ( tag === "*" ) {
  9665. while ( (elem = results[i++]) ) {
  9666. if ( elem.nodeType === 1 ) {
  9667. tmp.push( elem );
  9668. }
  9669. }
  9670. return tmp;
  9671. }
  9672. return results;
  9673. };
  9674. // Class
  9675. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9676. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9677. return context.getElementsByClassName( className );
  9678. }
  9679. };
  9680. /* QSA/matchesSelector
  9681. ---------------------------------------------------------------------- */
  9682. // QSA and matchesSelector support
  9683. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9684. rbuggyMatches = [];
  9685. // qSa(:focus) reports false when true (Chrome 21)
  9686. // We allow this because of a bug in IE8/9 that throws an error
  9687. // whenever `document.activeElement` is accessed on an iframe
  9688. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9689. // See https://bugs.jquery.com/ticket/13378
  9690. rbuggyQSA = [];
  9691. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9692. // Build QSA regex
  9693. // Regex strategy adopted from Diego Perini
  9694. assert(function( el ) {
  9695. // Select is set to empty string on purpose
  9696. // This is to test IE's treatment of not explicitly
  9697. // setting a boolean content attribute,
  9698. // since its presence should be enough
  9699. // https://bugs.jquery.com/ticket/12359
  9700. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9701. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9702. "<option selected=''></option></select>";
  9703. // Support: IE8, Opera 11-12.16
  9704. // Nothing should be selected when empty strings follow ^= or $= or *=
  9705. // The test attribute must be unknown in Opera but "safe" for WinRT
  9706. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9707. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9708. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9709. }
  9710. // Support: IE8
  9711. // Boolean attributes and "value" are not treated correctly
  9712. if ( !el.querySelectorAll("[selected]").length ) {
  9713. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9714. }
  9715. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9716. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9717. rbuggyQSA.push("~=");
  9718. }
  9719. // Webkit/Opera - :checked should return selected option elements
  9720. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9721. // IE8 throws error here and will not see later tests
  9722. if ( !el.querySelectorAll(":checked").length ) {
  9723. rbuggyQSA.push(":checked");
  9724. }
  9725. // Support: Safari 8+, iOS 8+
  9726. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9727. // In-page `selector#id sibling-combinator selector` fails
  9728. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9729. rbuggyQSA.push(".#.+[+~]");
  9730. }
  9731. });
  9732. assert(function( el ) {
  9733. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9734. "<select disabled='disabled'><option/></select>";
  9735. // Support: Windows 8 Native Apps
  9736. // The type and name attributes are restricted during .innerHTML assignment
  9737. var input = document.createElement("input");
  9738. input.setAttribute( "type", "hidden" );
  9739. el.appendChild( input ).setAttribute( "name", "D" );
  9740. // Support: IE8
  9741. // Enforce case-sensitivity of name attribute
  9742. if ( el.querySelectorAll("[name=d]").length ) {
  9743. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9744. }
  9745. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9746. // IE8 throws error here and will not see later tests
  9747. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9748. rbuggyQSA.push( ":enabled", ":disabled" );
  9749. }
  9750. // Support: IE9-11+
  9751. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9752. docElem.appendChild( el ).disabled = true;
  9753. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9754. rbuggyQSA.push( ":enabled", ":disabled" );
  9755. }
  9756. // Opera 10-11 does not throw on post-comma invalid pseudos
  9757. el.querySelectorAll("*,:x");
  9758. rbuggyQSA.push(",.*:");
  9759. });
  9760. }
  9761. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9762. docElem.webkitMatchesSelector ||
  9763. docElem.mozMatchesSelector ||
  9764. docElem.oMatchesSelector ||
  9765. docElem.msMatchesSelector) )) ) {
  9766. assert(function( el ) {
  9767. // Check to see if it's possible to do matchesSelector
  9768. // on a disconnected node (IE 9)
  9769. support.disconnectedMatch = matches.call( el, "*" );
  9770. // This should fail with an exception
  9771. // Gecko does not error, returns false instead
  9772. matches.call( el, "[s!='']:x" );
  9773. rbuggyMatches.push( "!=", pseudos );
  9774. });
  9775. }
  9776. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9777. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9778. /* Contains
  9779. ---------------------------------------------------------------------- */
  9780. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9781. // Element contains another
  9782. // Purposefully self-exclusive
  9783. // As in, an element does not contain itself
  9784. contains = hasCompare || rnative.test( docElem.contains ) ?
  9785. function( a, b ) {
  9786. var adown = a.nodeType === 9 ? a.documentElement : a,
  9787. bup = b && b.parentNode;
  9788. return a === bup || !!( bup && bup.nodeType === 1 && (
  9789. adown.contains ?
  9790. adown.contains( bup ) :
  9791. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9792. ));
  9793. } :
  9794. function( a, b ) {
  9795. if ( b ) {
  9796. while ( (b = b.parentNode) ) {
  9797. if ( b === a ) {
  9798. return true;
  9799. }
  9800. }
  9801. }
  9802. return false;
  9803. };
  9804. /* Sorting
  9805. ---------------------------------------------------------------------- */
  9806. // Document order sorting
  9807. sortOrder = hasCompare ?
  9808. function( a, b ) {
  9809. // Flag for duplicate removal
  9810. if ( a === b ) {
  9811. hasDuplicate = true;
  9812. return 0;
  9813. }
  9814. // Sort on method existence if only one input has compareDocumentPosition
  9815. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9816. if ( compare ) {
  9817. return compare;
  9818. }
  9819. // Calculate position if both inputs belong to the same document
  9820. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9821. a.compareDocumentPosition( b ) :
  9822. // Otherwise we know they are disconnected
  9823. 1;
  9824. // Disconnected nodes
  9825. if ( compare & 1 ||
  9826. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9827. // Choose the first element that is related to our preferred document
  9828. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9829. return -1;
  9830. }
  9831. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9832. return 1;
  9833. }
  9834. // Maintain original order
  9835. return sortInput ?
  9836. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9837. 0;
  9838. }
  9839. return compare & 4 ? -1 : 1;
  9840. } :
  9841. function( a, b ) {
  9842. // Exit early if the nodes are identical
  9843. if ( a === b ) {
  9844. hasDuplicate = true;
  9845. return 0;
  9846. }
  9847. var cur,
  9848. i = 0,
  9849. aup = a.parentNode,
  9850. bup = b.parentNode,
  9851. ap = [ a ],
  9852. bp = [ b ];
  9853. // Parentless nodes are either documents or disconnected
  9854. if ( !aup || !bup ) {
  9855. return a === document ? -1 :
  9856. b === document ? 1 :
  9857. aup ? -1 :
  9858. bup ? 1 :
  9859. sortInput ?
  9860. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9861. 0;
  9862. // If the nodes are siblings, we can do a quick check
  9863. } else if ( aup === bup ) {
  9864. return siblingCheck( a, b );
  9865. }
  9866. // Otherwise we need full lists of their ancestors for comparison
  9867. cur = a;
  9868. while ( (cur = cur.parentNode) ) {
  9869. ap.unshift( cur );
  9870. }
  9871. cur = b;
  9872. while ( (cur = cur.parentNode) ) {
  9873. bp.unshift( cur );
  9874. }
  9875. // Walk down the tree looking for a discrepancy
  9876. while ( ap[i] === bp[i] ) {
  9877. i++;
  9878. }
  9879. return i ?
  9880. // Do a sibling check if the nodes have a common ancestor
  9881. siblingCheck( ap[i], bp[i] ) :
  9882. // Otherwise nodes in our document sort first
  9883. ap[i] === preferredDoc ? -1 :
  9884. bp[i] === preferredDoc ? 1 :
  9885. 0;
  9886. };
  9887. return document;
  9888. };
  9889. Sizzle.matches = function( expr, elements ) {
  9890. return Sizzle( expr, null, null, elements );
  9891. };
  9892. Sizzle.matchesSelector = function( elem, expr ) {
  9893. // Set document vars if needed
  9894. if ( ( elem.ownerDocument || elem ) !== document ) {
  9895. setDocument( elem );
  9896. }
  9897. if ( support.matchesSelector && documentIsHTML &&
  9898. !nonnativeSelectorCache[ expr + " " ] &&
  9899. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9900. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9901. try {
  9902. var ret = matches.call( elem, expr );
  9903. // IE 9's matchesSelector returns false on disconnected nodes
  9904. if ( ret || support.disconnectedMatch ||
  9905. // As well, disconnected nodes are said to be in a document
  9906. // fragment in IE 9
  9907. elem.document && elem.document.nodeType !== 11 ) {
  9908. return ret;
  9909. }
  9910. } catch (e) {
  9911. nonnativeSelectorCache( expr, true );
  9912. }
  9913. }
  9914. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9915. };
  9916. Sizzle.contains = function( context, elem ) {
  9917. // Set document vars if needed
  9918. if ( ( context.ownerDocument || context ) !== document ) {
  9919. setDocument( context );
  9920. }
  9921. return contains( context, elem );
  9922. };
  9923. Sizzle.attr = function( elem, name ) {
  9924. // Set document vars if needed
  9925. if ( ( elem.ownerDocument || elem ) !== document ) {
  9926. setDocument( elem );
  9927. }
  9928. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9929. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9930. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9931. fn( elem, name, !documentIsHTML ) :
  9932. undefined;
  9933. return val !== undefined ?
  9934. val :
  9935. support.attributes || !documentIsHTML ?
  9936. elem.getAttribute( name ) :
  9937. (val = elem.getAttributeNode(name)) && val.specified ?
  9938. val.value :
  9939. null;
  9940. };
  9941. Sizzle.escape = function( sel ) {
  9942. return (sel + "").replace( rcssescape, fcssescape );
  9943. };
  9944. Sizzle.error = function( msg ) {
  9945. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9946. };
  9947. /**
  9948. * Document sorting and removing duplicates
  9949. * @param {ArrayLike} results
  9950. */
  9951. Sizzle.uniqueSort = function( results ) {
  9952. var elem,
  9953. duplicates = [],
  9954. j = 0,
  9955. i = 0;
  9956. // Unless we *know* we can detect duplicates, assume their presence
  9957. hasDuplicate = !support.detectDuplicates;
  9958. sortInput = !support.sortStable && results.slice( 0 );
  9959. results.sort( sortOrder );
  9960. if ( hasDuplicate ) {
  9961. while ( (elem = results[i++]) ) {
  9962. if ( elem === results[ i ] ) {
  9963. j = duplicates.push( i );
  9964. }
  9965. }
  9966. while ( j-- ) {
  9967. results.splice( duplicates[ j ], 1 );
  9968. }
  9969. }
  9970. // Clear input after sorting to release objects
  9971. // See https://github.com/jquery/sizzle/pull/225
  9972. sortInput = null;
  9973. return results;
  9974. };
  9975. /**
  9976. * Utility function for retrieving the text value of an array of DOM nodes
  9977. * @param {Array|Element} elem
  9978. */
  9979. getText = Sizzle.getText = function( elem ) {
  9980. var node,
  9981. ret = "",
  9982. i = 0,
  9983. nodeType = elem.nodeType;
  9984. if ( !nodeType ) {
  9985. // If no nodeType, this is expected to be an array
  9986. while ( (node = elem[i++]) ) {
  9987. // Do not traverse comment nodes
  9988. ret += getText( node );
  9989. }
  9990. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9991. // Use textContent for elements
  9992. // innerText usage removed for consistency of new lines (jQuery #11153)
  9993. if ( typeof elem.textContent === "string" ) {
  9994. return elem.textContent;
  9995. } else {
  9996. // Traverse its children
  9997. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9998. ret += getText( elem );
  9999. }
  10000. }
  10001. } else if ( nodeType === 3 || nodeType === 4 ) {
  10002. return elem.nodeValue;
  10003. }
  10004. // Do not include comment or processing instruction nodes
  10005. return ret;
  10006. };
  10007. Expr = Sizzle.selectors = {
  10008. // Can be adjusted by the user
  10009. cacheLength: 50,
  10010. createPseudo: markFunction,
  10011. match: matchExpr,
  10012. attrHandle: {},
  10013. find: {},
  10014. relative: {
  10015. ">": { dir: "parentNode", first: true },
  10016. " ": { dir: "parentNode" },
  10017. "+": { dir: "previousSibling", first: true },
  10018. "~": { dir: "previousSibling" }
  10019. },
  10020. preFilter: {
  10021. "ATTR": function( match ) {
  10022. match[1] = match[1].replace( runescape, funescape );
  10023. // Move the given value to match[3] whether quoted or unquoted
  10024. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10025. if ( match[2] === "~=" ) {
  10026. match[3] = " " + match[3] + " ";
  10027. }
  10028. return match.slice( 0, 4 );
  10029. },
  10030. "CHILD": function( match ) {
  10031. /* matches from matchExpr["CHILD"]
  10032. 1 type (only|nth|...)
  10033. 2 what (child|of-type)
  10034. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10035. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10036. 5 sign of xn-component
  10037. 6 x of xn-component
  10038. 7 sign of y-component
  10039. 8 y of y-component
  10040. */
  10041. match[1] = match[1].toLowerCase();
  10042. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10043. // nth-* requires argument
  10044. if ( !match[3] ) {
  10045. Sizzle.error( match[0] );
  10046. }
  10047. // numeric x and y parameters for Expr.filter.CHILD
  10048. // remember that false/true cast respectively to 0/1
  10049. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10050. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10051. // other types prohibit arguments
  10052. } else if ( match[3] ) {
  10053. Sizzle.error( match[0] );
  10054. }
  10055. return match;
  10056. },
  10057. "PSEUDO": function( match ) {
  10058. var excess,
  10059. unquoted = !match[6] && match[2];
  10060. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10061. return null;
  10062. }
  10063. // Accept quoted arguments as-is
  10064. if ( match[3] ) {
  10065. match[2] = match[4] || match[5] || "";
  10066. // Strip excess characters from unquoted arguments
  10067. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10068. // Get excess from tokenize (recursively)
  10069. (excess = tokenize( unquoted, true )) &&
  10070. // advance to the next closing parenthesis
  10071. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10072. // excess is a negative index
  10073. match[0] = match[0].slice( 0, excess );
  10074. match[2] = unquoted.slice( 0, excess );
  10075. }
  10076. // Return only captures needed by the pseudo filter method (type and argument)
  10077. return match.slice( 0, 3 );
  10078. }
  10079. },
  10080. filter: {
  10081. "TAG": function( nodeNameSelector ) {
  10082. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10083. return nodeNameSelector === "*" ?
  10084. function() { return true; } :
  10085. function( elem ) {
  10086. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10087. };
  10088. },
  10089. "CLASS": function( className ) {
  10090. var pattern = classCache[ className + " " ];
  10091. return pattern ||
  10092. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10093. classCache( className, function( elem ) {
  10094. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10095. });
  10096. },
  10097. "ATTR": function( name, operator, check ) {
  10098. return function( elem ) {
  10099. var result = Sizzle.attr( elem, name );
  10100. if ( result == null ) {
  10101. return operator === "!=";
  10102. }
  10103. if ( !operator ) {
  10104. return true;
  10105. }
  10106. result += "";
  10107. return operator === "=" ? result === check :
  10108. operator === "!=" ? result !== check :
  10109. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10110. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10111. operator === "$=" ? check && result.slice( -check.length ) === check :
  10112. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10113. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10114. false;
  10115. };
  10116. },
  10117. "CHILD": function( type, what, argument, first, last ) {
  10118. var simple = type.slice( 0, 3 ) !== "nth",
  10119. forward = type.slice( -4 ) !== "last",
  10120. ofType = what === "of-type";
  10121. return first === 1 && last === 0 ?
  10122. // Shortcut for :nth-*(n)
  10123. function( elem ) {
  10124. return !!elem.parentNode;
  10125. } :
  10126. function( elem, context, xml ) {
  10127. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10128. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10129. parent = elem.parentNode,
  10130. name = ofType && elem.nodeName.toLowerCase(),
  10131. useCache = !xml && !ofType,
  10132. diff = false;
  10133. if ( parent ) {
  10134. // :(first|last|only)-(child|of-type)
  10135. if ( simple ) {
  10136. while ( dir ) {
  10137. node = elem;
  10138. while ( (node = node[ dir ]) ) {
  10139. if ( ofType ?
  10140. node.nodeName.toLowerCase() === name :
  10141. node.nodeType === 1 ) {
  10142. return false;
  10143. }
  10144. }
  10145. // Reverse direction for :only-* (if we haven't yet done so)
  10146. start = dir = type === "only" && !start && "nextSibling";
  10147. }
  10148. return true;
  10149. }
  10150. start = [ forward ? parent.firstChild : parent.lastChild ];
  10151. // non-xml :nth-child(...) stores cache data on `parent`
  10152. if ( forward && useCache ) {
  10153. // Seek `elem` from a previously-cached index
  10154. // ...in a gzip-friendly way
  10155. node = parent;
  10156. outerCache = node[ expando ] || (node[ expando ] = {});
  10157. // Support: IE <9 only
  10158. // Defend against cloned attroperties (jQuery gh-1709)
  10159. uniqueCache = outerCache[ node.uniqueID ] ||
  10160. (outerCache[ node.uniqueID ] = {});
  10161. cache = uniqueCache[ type ] || [];
  10162. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10163. diff = nodeIndex && cache[ 2 ];
  10164. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10165. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10166. // Fallback to seeking `elem` from the start
  10167. (diff = nodeIndex = 0) || start.pop()) ) {
  10168. // When found, cache indexes on `parent` and break
  10169. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10170. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10171. break;
  10172. }
  10173. }
  10174. } else {
  10175. // Use previously-cached element index if available
  10176. if ( useCache ) {
  10177. // ...in a gzip-friendly way
  10178. node = elem;
  10179. outerCache = node[ expando ] || (node[ expando ] = {});
  10180. // Support: IE <9 only
  10181. // Defend against cloned attroperties (jQuery gh-1709)
  10182. uniqueCache = outerCache[ node.uniqueID ] ||
  10183. (outerCache[ node.uniqueID ] = {});
  10184. cache = uniqueCache[ type ] || [];
  10185. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10186. diff = nodeIndex;
  10187. }
  10188. // xml :nth-child(...)
  10189. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10190. if ( diff === false ) {
  10191. // Use the same loop as above to seek `elem` from the start
  10192. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10193. (diff = nodeIndex = 0) || start.pop()) ) {
  10194. if ( ( ofType ?
  10195. node.nodeName.toLowerCase() === name :
  10196. node.nodeType === 1 ) &&
  10197. ++diff ) {
  10198. // Cache the index of each encountered element
  10199. if ( useCache ) {
  10200. outerCache = node[ expando ] || (node[ expando ] = {});
  10201. // Support: IE <9 only
  10202. // Defend against cloned attroperties (jQuery gh-1709)
  10203. uniqueCache = outerCache[ node.uniqueID ] ||
  10204. (outerCache[ node.uniqueID ] = {});
  10205. uniqueCache[ type ] = [ dirruns, diff ];
  10206. }
  10207. if ( node === elem ) {
  10208. break;
  10209. }
  10210. }
  10211. }
  10212. }
  10213. }
  10214. // Incorporate the offset, then check against cycle size
  10215. diff -= last;
  10216. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10217. }
  10218. };
  10219. },
  10220. "PSEUDO": function( pseudo, argument ) {
  10221. // pseudo-class names are case-insensitive
  10222. // http://www.w3.org/TR/selectors/#pseudo-classes
  10223. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10224. // Remember that setFilters inherits from pseudos
  10225. var args,
  10226. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10227. Sizzle.error( "unsupported pseudo: " + pseudo );
  10228. // The user may use createPseudo to indicate that
  10229. // arguments are needed to create the filter function
  10230. // just as Sizzle does
  10231. if ( fn[ expando ] ) {
  10232. return fn( argument );
  10233. }
  10234. // But maintain support for old signatures
  10235. if ( fn.length > 1 ) {
  10236. args = [ pseudo, pseudo, "", argument ];
  10237. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10238. markFunction(function( seed, matches ) {
  10239. var idx,
  10240. matched = fn( seed, argument ),
  10241. i = matched.length;
  10242. while ( i-- ) {
  10243. idx = indexOf( seed, matched[i] );
  10244. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10245. }
  10246. }) :
  10247. function( elem ) {
  10248. return fn( elem, 0, args );
  10249. };
  10250. }
  10251. return fn;
  10252. }
  10253. },
  10254. pseudos: {
  10255. // Potentially complex pseudos
  10256. "not": markFunction(function( selector ) {
  10257. // Trim the selector passed to compile
  10258. // to avoid treating leading and trailing
  10259. // spaces as combinators
  10260. var input = [],
  10261. results = [],
  10262. matcher = compile( selector.replace( rtrim, "$1" ) );
  10263. return matcher[ expando ] ?
  10264. markFunction(function( seed, matches, context, xml ) {
  10265. var elem,
  10266. unmatched = matcher( seed, null, xml, [] ),
  10267. i = seed.length;
  10268. // Match elements unmatched by `matcher`
  10269. while ( i-- ) {
  10270. if ( (elem = unmatched[i]) ) {
  10271. seed[i] = !(matches[i] = elem);
  10272. }
  10273. }
  10274. }) :
  10275. function( elem, context, xml ) {
  10276. input[0] = elem;
  10277. matcher( input, null, xml, results );
  10278. // Don't keep the element (issue #299)
  10279. input[0] = null;
  10280. return !results.pop();
  10281. };
  10282. }),
  10283. "has": markFunction(function( selector ) {
  10284. return function( elem ) {
  10285. return Sizzle( selector, elem ).length > 0;
  10286. };
  10287. }),
  10288. "contains": markFunction(function( text ) {
  10289. text = text.replace( runescape, funescape );
  10290. return function( elem ) {
  10291. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10292. };
  10293. }),
  10294. // "Whether an element is represented by a :lang() selector
  10295. // is based solely on the element's language value
  10296. // being equal to the identifier C,
  10297. // or beginning with the identifier C immediately followed by "-".
  10298. // The matching of C against the element's language value is performed case-insensitively.
  10299. // The identifier C does not have to be a valid language name."
  10300. // http://www.w3.org/TR/selectors/#lang-pseudo
  10301. "lang": markFunction( function( lang ) {
  10302. // lang value must be a valid identifier
  10303. if ( !ridentifier.test(lang || "") ) {
  10304. Sizzle.error( "unsupported lang: " + lang );
  10305. }
  10306. lang = lang.replace( runescape, funescape ).toLowerCase();
  10307. return function( elem ) {
  10308. var elemLang;
  10309. do {
  10310. if ( (elemLang = documentIsHTML ?
  10311. elem.lang :
  10312. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10313. elemLang = elemLang.toLowerCase();
  10314. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10315. }
  10316. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10317. return false;
  10318. };
  10319. }),
  10320. // Miscellaneous
  10321. "target": function( elem ) {
  10322. var hash = window.location && window.location.hash;
  10323. return hash && hash.slice( 1 ) === elem.id;
  10324. },
  10325. "root": function( elem ) {
  10326. return elem === docElem;
  10327. },
  10328. "focus": function( elem ) {
  10329. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10330. },
  10331. // Boolean properties
  10332. "enabled": createDisabledPseudo( false ),
  10333. "disabled": createDisabledPseudo( true ),
  10334. "checked": function( elem ) {
  10335. // In CSS3, :checked should return both checked and selected elements
  10336. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10337. var nodeName = elem.nodeName.toLowerCase();
  10338. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10339. },
  10340. "selected": function( elem ) {
  10341. // Accessing this property makes selected-by-default
  10342. // options in Safari work properly
  10343. if ( elem.parentNode ) {
  10344. elem.parentNode.selectedIndex;
  10345. }
  10346. return elem.selected === true;
  10347. },
  10348. // Contents
  10349. "empty": function( elem ) {
  10350. // http://www.w3.org/TR/selectors/#empty-pseudo
  10351. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10352. // but not by others (comment: 8; processing instruction: 7; etc.)
  10353. // nodeType < 6 works because attributes (2) do not appear as children
  10354. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10355. if ( elem.nodeType < 6 ) {
  10356. return false;
  10357. }
  10358. }
  10359. return true;
  10360. },
  10361. "parent": function( elem ) {
  10362. return !Expr.pseudos["empty"]( elem );
  10363. },
  10364. // Element/input types
  10365. "header": function( elem ) {
  10366. return rheader.test( elem.nodeName );
  10367. },
  10368. "input": function( elem ) {
  10369. return rinputs.test( elem.nodeName );
  10370. },
  10371. "button": function( elem ) {
  10372. var name = elem.nodeName.toLowerCase();
  10373. return name === "input" && elem.type === "button" || name === "button";
  10374. },
  10375. "text": function( elem ) {
  10376. var attr;
  10377. return elem.nodeName.toLowerCase() === "input" &&
  10378. elem.type === "text" &&
  10379. // Support: IE<8
  10380. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10381. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10382. },
  10383. // Position-in-collection
  10384. "first": createPositionalPseudo(function() {
  10385. return [ 0 ];
  10386. }),
  10387. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10388. return [ length - 1 ];
  10389. }),
  10390. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10391. return [ argument < 0 ? argument + length : argument ];
  10392. }),
  10393. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10394. var i = 0;
  10395. for ( ; i < length; i += 2 ) {
  10396. matchIndexes.push( i );
  10397. }
  10398. return matchIndexes;
  10399. }),
  10400. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10401. var i = 1;
  10402. for ( ; i < length; i += 2 ) {
  10403. matchIndexes.push( i );
  10404. }
  10405. return matchIndexes;
  10406. }),
  10407. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10408. var i = argument < 0 ?
  10409. argument + length :
  10410. argument > length ?
  10411. length :
  10412. argument;
  10413. for ( ; --i >= 0; ) {
  10414. matchIndexes.push( i );
  10415. }
  10416. return matchIndexes;
  10417. }),
  10418. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10419. var i = argument < 0 ? argument + length : argument;
  10420. for ( ; ++i < length; ) {
  10421. matchIndexes.push( i );
  10422. }
  10423. return matchIndexes;
  10424. })
  10425. }
  10426. };
  10427. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10428. // Add button/input type pseudos
  10429. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10430. Expr.pseudos[ i ] = createInputPseudo( i );
  10431. }
  10432. for ( i in { submit: true, reset: true } ) {
  10433. Expr.pseudos[ i ] = createButtonPseudo( i );
  10434. }
  10435. // Easy API for creating new setFilters
  10436. function setFilters() {}
  10437. setFilters.prototype = Expr.filters = Expr.pseudos;
  10438. Expr.setFilters = new setFilters();
  10439. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10440. var matched, match, tokens, type,
  10441. soFar, groups, preFilters,
  10442. cached = tokenCache[ selector + " " ];
  10443. if ( cached ) {
  10444. return parseOnly ? 0 : cached.slice( 0 );
  10445. }
  10446. soFar = selector;
  10447. groups = [];
  10448. preFilters = Expr.preFilter;
  10449. while ( soFar ) {
  10450. // Comma and first run
  10451. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10452. if ( match ) {
  10453. // Don't consume trailing commas as valid
  10454. soFar = soFar.slice( match[0].length ) || soFar;
  10455. }
  10456. groups.push( (tokens = []) );
  10457. }
  10458. matched = false;
  10459. // Combinators
  10460. if ( (match = rcombinators.exec( soFar )) ) {
  10461. matched = match.shift();
  10462. tokens.push({
  10463. value: matched,
  10464. // Cast descendant combinators to space
  10465. type: match[0].replace( rtrim, " " )
  10466. });
  10467. soFar = soFar.slice( matched.length );
  10468. }
  10469. // Filters
  10470. for ( type in Expr.filter ) {
  10471. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10472. (match = preFilters[ type ]( match ))) ) {
  10473. matched = match.shift();
  10474. tokens.push({
  10475. value: matched,
  10476. type: type,
  10477. matches: match
  10478. });
  10479. soFar = soFar.slice( matched.length );
  10480. }
  10481. }
  10482. if ( !matched ) {
  10483. break;
  10484. }
  10485. }
  10486. // Return the length of the invalid excess
  10487. // if we're just parsing
  10488. // Otherwise, throw an error or return tokens
  10489. return parseOnly ?
  10490. soFar.length :
  10491. soFar ?
  10492. Sizzle.error( selector ) :
  10493. // Cache the tokens
  10494. tokenCache( selector, groups ).slice( 0 );
  10495. };
  10496. function toSelector( tokens ) {
  10497. var i = 0,
  10498. len = tokens.length,
  10499. selector = "";
  10500. for ( ; i < len; i++ ) {
  10501. selector += tokens[i].value;
  10502. }
  10503. return selector;
  10504. }
  10505. function addCombinator( matcher, combinator, base ) {
  10506. var dir = combinator.dir,
  10507. skip = combinator.next,
  10508. key = skip || dir,
  10509. checkNonElements = base && key === "parentNode",
  10510. doneName = done++;
  10511. return combinator.first ?
  10512. // Check against closest ancestor/preceding element
  10513. function( elem, context, xml ) {
  10514. while ( (elem = elem[ dir ]) ) {
  10515. if ( elem.nodeType === 1 || checkNonElements ) {
  10516. return matcher( elem, context, xml );
  10517. }
  10518. }
  10519. return false;
  10520. } :
  10521. // Check against all ancestor/preceding elements
  10522. function( elem, context, xml ) {
  10523. var oldCache, uniqueCache, outerCache,
  10524. newCache = [ dirruns, doneName ];
  10525. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10526. if ( xml ) {
  10527. while ( (elem = elem[ dir ]) ) {
  10528. if ( elem.nodeType === 1 || checkNonElements ) {
  10529. if ( matcher( elem, context, xml ) ) {
  10530. return true;
  10531. }
  10532. }
  10533. }
  10534. } else {
  10535. while ( (elem = elem[ dir ]) ) {
  10536. if ( elem.nodeType === 1 || checkNonElements ) {
  10537. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10538. // Support: IE <9 only
  10539. // Defend against cloned attroperties (jQuery gh-1709)
  10540. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10541. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10542. elem = elem[ dir ] || elem;
  10543. } else if ( (oldCache = uniqueCache[ key ]) &&
  10544. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10545. // Assign to newCache so results back-propagate to previous elements
  10546. return (newCache[ 2 ] = oldCache[ 2 ]);
  10547. } else {
  10548. // Reuse newcache so results back-propagate to previous elements
  10549. uniqueCache[ key ] = newCache;
  10550. // A match means we're done; a fail means we have to keep checking
  10551. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10552. return true;
  10553. }
  10554. }
  10555. }
  10556. }
  10557. }
  10558. return false;
  10559. };
  10560. }
  10561. function elementMatcher( matchers ) {
  10562. return matchers.length > 1 ?
  10563. function( elem, context, xml ) {
  10564. var i = matchers.length;
  10565. while ( i-- ) {
  10566. if ( !matchers[i]( elem, context, xml ) ) {
  10567. return false;
  10568. }
  10569. }
  10570. return true;
  10571. } :
  10572. matchers[0];
  10573. }
  10574. function multipleContexts( selector, contexts, results ) {
  10575. var i = 0,
  10576. len = contexts.length;
  10577. for ( ; i < len; i++ ) {
  10578. Sizzle( selector, contexts[i], results );
  10579. }
  10580. return results;
  10581. }
  10582. function condense( unmatched, map, filter, context, xml ) {
  10583. var elem,
  10584. newUnmatched = [],
  10585. i = 0,
  10586. len = unmatched.length,
  10587. mapped = map != null;
  10588. for ( ; i < len; i++ ) {
  10589. if ( (elem = unmatched[i]) ) {
  10590. if ( !filter || filter( elem, context, xml ) ) {
  10591. newUnmatched.push( elem );
  10592. if ( mapped ) {
  10593. map.push( i );
  10594. }
  10595. }
  10596. }
  10597. }
  10598. return newUnmatched;
  10599. }
  10600. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10601. if ( postFilter && !postFilter[ expando ] ) {
  10602. postFilter = setMatcher( postFilter );
  10603. }
  10604. if ( postFinder && !postFinder[ expando ] ) {
  10605. postFinder = setMatcher( postFinder, postSelector );
  10606. }
  10607. return markFunction(function( seed, results, context, xml ) {
  10608. var temp, i, elem,
  10609. preMap = [],
  10610. postMap = [],
  10611. preexisting = results.length,
  10612. // Get initial elements from seed or context
  10613. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10614. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10615. matcherIn = preFilter && ( seed || !selector ) ?
  10616. condense( elems, preMap, preFilter, context, xml ) :
  10617. elems,
  10618. matcherOut = matcher ?
  10619. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10620. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10621. // ...intermediate processing is necessary
  10622. [] :
  10623. // ...otherwise use results directly
  10624. results :
  10625. matcherIn;
  10626. // Find primary matches
  10627. if ( matcher ) {
  10628. matcher( matcherIn, matcherOut, context, xml );
  10629. }
  10630. // Apply postFilter
  10631. if ( postFilter ) {
  10632. temp = condense( matcherOut, postMap );
  10633. postFilter( temp, [], context, xml );
  10634. // Un-match failing elements by moving them back to matcherIn
  10635. i = temp.length;
  10636. while ( i-- ) {
  10637. if ( (elem = temp[i]) ) {
  10638. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10639. }
  10640. }
  10641. }
  10642. if ( seed ) {
  10643. if ( postFinder || preFilter ) {
  10644. if ( postFinder ) {
  10645. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10646. temp = [];
  10647. i = matcherOut.length;
  10648. while ( i-- ) {
  10649. if ( (elem = matcherOut[i]) ) {
  10650. // Restore matcherIn since elem is not yet a final match
  10651. temp.push( (matcherIn[i] = elem) );
  10652. }
  10653. }
  10654. postFinder( null, (matcherOut = []), temp, xml );
  10655. }
  10656. // Move matched elements from seed to results to keep them synchronized
  10657. i = matcherOut.length;
  10658. while ( i-- ) {
  10659. if ( (elem = matcherOut[i]) &&
  10660. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10661. seed[temp] = !(results[temp] = elem);
  10662. }
  10663. }
  10664. }
  10665. // Add elements to results, through postFinder if defined
  10666. } else {
  10667. matcherOut = condense(
  10668. matcherOut === results ?
  10669. matcherOut.splice( preexisting, matcherOut.length ) :
  10670. matcherOut
  10671. );
  10672. if ( postFinder ) {
  10673. postFinder( null, results, matcherOut, xml );
  10674. } else {
  10675. push.apply( results, matcherOut );
  10676. }
  10677. }
  10678. });
  10679. }
  10680. function matcherFromTokens( tokens ) {
  10681. var checkContext, matcher, j,
  10682. len = tokens.length,
  10683. leadingRelative = Expr.relative[ tokens[0].type ],
  10684. implicitRelative = leadingRelative || Expr.relative[" "],
  10685. i = leadingRelative ? 1 : 0,
  10686. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10687. matchContext = addCombinator( function( elem ) {
  10688. return elem === checkContext;
  10689. }, implicitRelative, true ),
  10690. matchAnyContext = addCombinator( function( elem ) {
  10691. return indexOf( checkContext, elem ) > -1;
  10692. }, implicitRelative, true ),
  10693. matchers = [ function( elem, context, xml ) {
  10694. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10695. (checkContext = context).nodeType ?
  10696. matchContext( elem, context, xml ) :
  10697. matchAnyContext( elem, context, xml ) );
  10698. // Avoid hanging onto element (issue #299)
  10699. checkContext = null;
  10700. return ret;
  10701. } ];
  10702. for ( ; i < len; i++ ) {
  10703. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10704. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10705. } else {
  10706. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10707. // Return special upon seeing a positional matcher
  10708. if ( matcher[ expando ] ) {
  10709. // Find the next relative operator (if any) for proper handling
  10710. j = ++i;
  10711. for ( ; j < len; j++ ) {
  10712. if ( Expr.relative[ tokens[j].type ] ) {
  10713. break;
  10714. }
  10715. }
  10716. return setMatcher(
  10717. i > 1 && elementMatcher( matchers ),
  10718. i > 1 && toSelector(
  10719. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10720. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10721. ).replace( rtrim, "$1" ),
  10722. matcher,
  10723. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10724. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10725. j < len && toSelector( tokens )
  10726. );
  10727. }
  10728. matchers.push( matcher );
  10729. }
  10730. }
  10731. return elementMatcher( matchers );
  10732. }
  10733. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10734. var bySet = setMatchers.length > 0,
  10735. byElement = elementMatchers.length > 0,
  10736. superMatcher = function( seed, context, xml, results, outermost ) {
  10737. var elem, j, matcher,
  10738. matchedCount = 0,
  10739. i = "0",
  10740. unmatched = seed && [],
  10741. setMatched = [],
  10742. contextBackup = outermostContext,
  10743. // We must always have either seed elements or outermost context
  10744. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10745. // Use integer dirruns iff this is the outermost matcher
  10746. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10747. len = elems.length;
  10748. if ( outermost ) {
  10749. outermostContext = context === document || context || outermost;
  10750. }
  10751. // Add elements passing elementMatchers directly to results
  10752. // Support: IE<9, Safari
  10753. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10754. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10755. if ( byElement && elem ) {
  10756. j = 0;
  10757. if ( !context && elem.ownerDocument !== document ) {
  10758. setDocument( elem );
  10759. xml = !documentIsHTML;
  10760. }
  10761. while ( (matcher = elementMatchers[j++]) ) {
  10762. if ( matcher( elem, context || document, xml) ) {
  10763. results.push( elem );
  10764. break;
  10765. }
  10766. }
  10767. if ( outermost ) {
  10768. dirruns = dirrunsUnique;
  10769. }
  10770. }
  10771. // Track unmatched elements for set filters
  10772. if ( bySet ) {
  10773. // They will have gone through all possible matchers
  10774. if ( (elem = !matcher && elem) ) {
  10775. matchedCount--;
  10776. }
  10777. // Lengthen the array for every element, matched or not
  10778. if ( seed ) {
  10779. unmatched.push( elem );
  10780. }
  10781. }
  10782. }
  10783. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10784. // makes the latter nonnegative.
  10785. matchedCount += i;
  10786. // Apply set filters to unmatched elements
  10787. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10788. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10789. // no element matchers and no seed.
  10790. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10791. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10792. // numerically zero.
  10793. if ( bySet && i !== matchedCount ) {
  10794. j = 0;
  10795. while ( (matcher = setMatchers[j++]) ) {
  10796. matcher( unmatched, setMatched, context, xml );
  10797. }
  10798. if ( seed ) {
  10799. // Reintegrate element matches to eliminate the need for sorting
  10800. if ( matchedCount > 0 ) {
  10801. while ( i-- ) {
  10802. if ( !(unmatched[i] || setMatched[i]) ) {
  10803. setMatched[i] = pop.call( results );
  10804. }
  10805. }
  10806. }
  10807. // Discard index placeholder values to get only actual matches
  10808. setMatched = condense( setMatched );
  10809. }
  10810. // Add matches to results
  10811. push.apply( results, setMatched );
  10812. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10813. if ( outermost && !seed && setMatched.length > 0 &&
  10814. ( matchedCount + setMatchers.length ) > 1 ) {
  10815. Sizzle.uniqueSort( results );
  10816. }
  10817. }
  10818. // Override manipulation of globals by nested matchers
  10819. if ( outermost ) {
  10820. dirruns = dirrunsUnique;
  10821. outermostContext = contextBackup;
  10822. }
  10823. return unmatched;
  10824. };
  10825. return bySet ?
  10826. markFunction( superMatcher ) :
  10827. superMatcher;
  10828. }
  10829. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10830. var i,
  10831. setMatchers = [],
  10832. elementMatchers = [],
  10833. cached = compilerCache[ selector + " " ];
  10834. if ( !cached ) {
  10835. // Generate a function of recursive functions that can be used to check each element
  10836. if ( !match ) {
  10837. match = tokenize( selector );
  10838. }
  10839. i = match.length;
  10840. while ( i-- ) {
  10841. cached = matcherFromTokens( match[i] );
  10842. if ( cached[ expando ] ) {
  10843. setMatchers.push( cached );
  10844. } else {
  10845. elementMatchers.push( cached );
  10846. }
  10847. }
  10848. // Cache the compiled function
  10849. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10850. // Save selector and tokenization
  10851. cached.selector = selector;
  10852. }
  10853. return cached;
  10854. };
  10855. /**
  10856. * A low-level selection function that works with Sizzle's compiled
  10857. * selector functions
  10858. * @param {String|Function} selector A selector or a pre-compiled
  10859. * selector function built with Sizzle.compile
  10860. * @param {Element} context
  10861. * @param {Array} [results]
  10862. * @param {Array} [seed] A set of elements to match against
  10863. */
  10864. select = Sizzle.select = function( selector, context, results, seed ) {
  10865. var i, tokens, token, type, find,
  10866. compiled = typeof selector === "function" && selector,
  10867. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10868. results = results || [];
  10869. // Try to minimize operations if there is only one selector in the list and no seed
  10870. // (the latter of which guarantees us context)
  10871. if ( match.length === 1 ) {
  10872. // Reduce context if the leading compound selector is an ID
  10873. tokens = match[0] = match[0].slice( 0 );
  10874. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10875. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10876. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10877. if ( !context ) {
  10878. return results;
  10879. // Precompiled matchers will still verify ancestry, so step up a level
  10880. } else if ( compiled ) {
  10881. context = context.parentNode;
  10882. }
  10883. selector = selector.slice( tokens.shift().value.length );
  10884. }
  10885. // Fetch a seed set for right-to-left matching
  10886. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10887. while ( i-- ) {
  10888. token = tokens[i];
  10889. // Abort if we hit a combinator
  10890. if ( Expr.relative[ (type = token.type) ] ) {
  10891. break;
  10892. }
  10893. if ( (find = Expr.find[ type ]) ) {
  10894. // Search, expanding context for leading sibling combinators
  10895. if ( (seed = find(
  10896. token.matches[0].replace( runescape, funescape ),
  10897. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10898. )) ) {
  10899. // If seed is empty or no tokens remain, we can return early
  10900. tokens.splice( i, 1 );
  10901. selector = seed.length && toSelector( tokens );
  10902. if ( !selector ) {
  10903. push.apply( results, seed );
  10904. return results;
  10905. }
  10906. break;
  10907. }
  10908. }
  10909. }
  10910. }
  10911. // Compile and execute a filtering function if one is not provided
  10912. // Provide `match` to avoid retokenization if we modified the selector above
  10913. ( compiled || compile( selector, match ) )(
  10914. seed,
  10915. context,
  10916. !documentIsHTML,
  10917. results,
  10918. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10919. );
  10920. return results;
  10921. };
  10922. // One-time assignments
  10923. // Sort stability
  10924. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10925. // Support: Chrome 14-35+
  10926. // Always assume duplicates if they aren't passed to the comparison function
  10927. support.detectDuplicates = !!hasDuplicate;
  10928. // Initialize against the default document
  10929. setDocument();
  10930. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10931. // Detached nodes confoundingly follow *each other*
  10932. support.sortDetached = assert(function( el ) {
  10933. // Should return 1, but returns 4 (following)
  10934. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10935. });
  10936. // Support: IE<8
  10937. // Prevent attribute/property "interpolation"
  10938. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10939. if ( !assert(function( el ) {
  10940. el.innerHTML = "<a href='#'></a>";
  10941. return el.firstChild.getAttribute("href") === "#" ;
  10942. }) ) {
  10943. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10944. if ( !isXML ) {
  10945. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10946. }
  10947. });
  10948. }
  10949. // Support: IE<9
  10950. // Use defaultValue in place of getAttribute("value")
  10951. if ( !support.attributes || !assert(function( el ) {
  10952. el.innerHTML = "<input/>";
  10953. el.firstChild.setAttribute( "value", "" );
  10954. return el.firstChild.getAttribute( "value" ) === "";
  10955. }) ) {
  10956. addHandle( "value", function( elem, name, isXML ) {
  10957. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10958. return elem.defaultValue;
  10959. }
  10960. });
  10961. }
  10962. // Support: IE<9
  10963. // Use getAttributeNode to fetch booleans when getAttribute lies
  10964. if ( !assert(function( el ) {
  10965. return el.getAttribute("disabled") == null;
  10966. }) ) {
  10967. addHandle( booleans, function( elem, name, isXML ) {
  10968. var val;
  10969. if ( !isXML ) {
  10970. return elem[ name ] === true ? name.toLowerCase() :
  10971. (val = elem.getAttributeNode( name )) && val.specified ?
  10972. val.value :
  10973. null;
  10974. }
  10975. });
  10976. }
  10977. return Sizzle;
  10978. })( window );
  10979. jQuery.find = Sizzle;
  10980. jQuery.expr = Sizzle.selectors;
  10981. // Deprecated
  10982. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10983. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10984. jQuery.text = Sizzle.getText;
  10985. jQuery.isXMLDoc = Sizzle.isXML;
  10986. jQuery.contains = Sizzle.contains;
  10987. jQuery.escapeSelector = Sizzle.escape;
  10988. var dir = function( elem, dir, until ) {
  10989. var matched = [],
  10990. truncate = until !== undefined;
  10991. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10992. if ( elem.nodeType === 1 ) {
  10993. if ( truncate && jQuery( elem ).is( until ) ) {
  10994. break;
  10995. }
  10996. matched.push( elem );
  10997. }
  10998. }
  10999. return matched;
  11000. };
  11001. var siblings = function( n, elem ) {
  11002. var matched = [];
  11003. for ( ; n; n = n.nextSibling ) {
  11004. if ( n.nodeType === 1 && n !== elem ) {
  11005. matched.push( n );
  11006. }
  11007. }
  11008. return matched;
  11009. };
  11010. var rneedsContext = jQuery.expr.match.needsContext;
  11011. function nodeName( elem, name ) {
  11012. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11013. };
  11014. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11015. // Implement the identical functionality for filter and not
  11016. function winnow( elements, qualifier, not ) {
  11017. if ( isFunction( qualifier ) ) {
  11018. return jQuery.grep( elements, function( elem, i ) {
  11019. return !!qualifier.call( elem, i, elem ) !== not;
  11020. } );
  11021. }
  11022. // Single element
  11023. if ( qualifier.nodeType ) {
  11024. return jQuery.grep( elements, function( elem ) {
  11025. return ( elem === qualifier ) !== not;
  11026. } );
  11027. }
  11028. // Arraylike of elements (jQuery, arguments, Array)
  11029. if ( typeof qualifier !== "string" ) {
  11030. return jQuery.grep( elements, function( elem ) {
  11031. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11032. } );
  11033. }
  11034. // Filtered directly for both simple and complex selectors
  11035. return jQuery.filter( qualifier, elements, not );
  11036. }
  11037. jQuery.filter = function( expr, elems, not ) {
  11038. var elem = elems[ 0 ];
  11039. if ( not ) {
  11040. expr = ":not(" + expr + ")";
  11041. }
  11042. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11043. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11044. }
  11045. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11046. return elem.nodeType === 1;
  11047. } ) );
  11048. };
  11049. jQuery.fn.extend( {
  11050. find: function( selector ) {
  11051. var i, ret,
  11052. len = this.length,
  11053. self = this;
  11054. if ( typeof selector !== "string" ) {
  11055. return this.pushStack( jQuery( selector ).filter( function() {
  11056. for ( i = 0; i < len; i++ ) {
  11057. if ( jQuery.contains( self[ i ], this ) ) {
  11058. return true;
  11059. }
  11060. }
  11061. } ) );
  11062. }
  11063. ret = this.pushStack( [] );
  11064. for ( i = 0; i < len; i++ ) {
  11065. jQuery.find( selector, self[ i ], ret );
  11066. }
  11067. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11068. },
  11069. filter: function( selector ) {
  11070. return this.pushStack( winnow( this, selector || [], false ) );
  11071. },
  11072. not: function( selector ) {
  11073. return this.pushStack( winnow( this, selector || [], true ) );
  11074. },
  11075. is: function( selector ) {
  11076. return !!winnow(
  11077. this,
  11078. // If this is a positional/relative selector, check membership in the returned set
  11079. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11080. typeof selector === "string" && rneedsContext.test( selector ) ?
  11081. jQuery( selector ) :
  11082. selector || [],
  11083. false
  11084. ).length;
  11085. }
  11086. } );
  11087. // Initialize a jQuery object
  11088. // A central reference to the root jQuery(document)
  11089. var rootjQuery,
  11090. // A simple way to check for HTML strings
  11091. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11092. // Strict HTML recognition (#11290: must start with <)
  11093. // Shortcut simple #id case for speed
  11094. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11095. init = jQuery.fn.init = function( selector, context, root ) {
  11096. var match, elem;
  11097. // HANDLE: $(""), $(null), $(undefined), $(false)
  11098. if ( !selector ) {
  11099. return this;
  11100. }
  11101. // Method init() accepts an alternate rootjQuery
  11102. // so migrate can support jQuery.sub (gh-2101)
  11103. root = root || rootjQuery;
  11104. // Handle HTML strings
  11105. if ( typeof selector === "string" ) {
  11106. if ( selector[ 0 ] === "<" &&
  11107. selector[ selector.length - 1 ] === ">" &&
  11108. selector.length >= 3 ) {
  11109. // Assume that strings that start and end with <> are HTML and skip the regex check
  11110. match = [ null, selector, null ];
  11111. } else {
  11112. match = rquickExpr.exec( selector );
  11113. }
  11114. // Match html or make sure no context is specified for #id
  11115. if ( match && ( match[ 1 ] || !context ) ) {
  11116. // HANDLE: $(html) -> $(array)
  11117. if ( match[ 1 ] ) {
  11118. context = context instanceof jQuery ? context[ 0 ] : context;
  11119. // Option to run scripts is true for back-compat
  11120. // Intentionally let the error be thrown if parseHTML is not present
  11121. jQuery.merge( this, jQuery.parseHTML(
  11122. match[ 1 ],
  11123. context && context.nodeType ? context.ownerDocument || context : document,
  11124. true
  11125. ) );
  11126. // HANDLE: $(html, props)
  11127. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11128. for ( match in context ) {
  11129. // Properties of context are called as methods if possible
  11130. if ( isFunction( this[ match ] ) ) {
  11131. this[ match ]( context[ match ] );
  11132. // ...and otherwise set as attributes
  11133. } else {
  11134. this.attr( match, context[ match ] );
  11135. }
  11136. }
  11137. }
  11138. return this;
  11139. // HANDLE: $(#id)
  11140. } else {
  11141. elem = document.getElementById( match[ 2 ] );
  11142. if ( elem ) {
  11143. // Inject the element directly into the jQuery object
  11144. this[ 0 ] = elem;
  11145. this.length = 1;
  11146. }
  11147. return this;
  11148. }
  11149. // HANDLE: $(expr, $(...))
  11150. } else if ( !context || context.jquery ) {
  11151. return ( context || root ).find( selector );
  11152. // HANDLE: $(expr, context)
  11153. // (which is just equivalent to: $(context).find(expr)
  11154. } else {
  11155. return this.constructor( context ).find( selector );
  11156. }
  11157. // HANDLE: $(DOMElement)
  11158. } else if ( selector.nodeType ) {
  11159. this[ 0 ] = selector;
  11160. this.length = 1;
  11161. return this;
  11162. // HANDLE: $(function)
  11163. // Shortcut for document ready
  11164. } else if ( isFunction( selector ) ) {
  11165. return root.ready !== undefined ?
  11166. root.ready( selector ) :
  11167. // Execute immediately if ready is not present
  11168. selector( jQuery );
  11169. }
  11170. return jQuery.makeArray( selector, this );
  11171. };
  11172. // Give the init function the jQuery prototype for later instantiation
  11173. init.prototype = jQuery.fn;
  11174. // Initialize central reference
  11175. rootjQuery = jQuery( document );
  11176. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11177. // Methods guaranteed to produce a unique set when starting from a unique set
  11178. guaranteedUnique = {
  11179. children: true,
  11180. contents: true,
  11181. next: true,
  11182. prev: true
  11183. };
  11184. jQuery.fn.extend( {
  11185. has: function( target ) {
  11186. var targets = jQuery( target, this ),
  11187. l = targets.length;
  11188. return this.filter( function() {
  11189. var i = 0;
  11190. for ( ; i < l; i++ ) {
  11191. if ( jQuery.contains( this, targets[ i ] ) ) {
  11192. return true;
  11193. }
  11194. }
  11195. } );
  11196. },
  11197. closest: function( selectors, context ) {
  11198. var cur,
  11199. i = 0,
  11200. l = this.length,
  11201. matched = [],
  11202. targets = typeof selectors !== "string" && jQuery( selectors );
  11203. // Positional selectors never match, since there's no _selection_ context
  11204. if ( !rneedsContext.test( selectors ) ) {
  11205. for ( ; i < l; i++ ) {
  11206. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11207. // Always skip document fragments
  11208. if ( cur.nodeType < 11 && ( targets ?
  11209. targets.index( cur ) > -1 :
  11210. // Don't pass non-elements to Sizzle
  11211. cur.nodeType === 1 &&
  11212. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11213. matched.push( cur );
  11214. break;
  11215. }
  11216. }
  11217. }
  11218. }
  11219. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11220. },
  11221. // Determine the position of an element within the set
  11222. index: function( elem ) {
  11223. // No argument, return index in parent
  11224. if ( !elem ) {
  11225. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11226. }
  11227. // Index in selector
  11228. if ( typeof elem === "string" ) {
  11229. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11230. }
  11231. // Locate the position of the desired element
  11232. return indexOf.call( this,
  11233. // If it receives a jQuery object, the first element is used
  11234. elem.jquery ? elem[ 0 ] : elem
  11235. );
  11236. },
  11237. add: function( selector, context ) {
  11238. return this.pushStack(
  11239. jQuery.uniqueSort(
  11240. jQuery.merge( this.get(), jQuery( selector, context ) )
  11241. )
  11242. );
  11243. },
  11244. addBack: function( selector ) {
  11245. return this.add( selector == null ?
  11246. this.prevObject : this.prevObject.filter( selector )
  11247. );
  11248. }
  11249. } );
  11250. function sibling( cur, dir ) {
  11251. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11252. return cur;
  11253. }
  11254. jQuery.each( {
  11255. parent: function( elem ) {
  11256. var parent = elem.parentNode;
  11257. return parent && parent.nodeType !== 11 ? parent : null;
  11258. },
  11259. parents: function( elem ) {
  11260. return dir( elem, "parentNode" );
  11261. },
  11262. parentsUntil: function( elem, i, until ) {
  11263. return dir( elem, "parentNode", until );
  11264. },
  11265. next: function( elem ) {
  11266. return sibling( elem, "nextSibling" );
  11267. },
  11268. prev: function( elem ) {
  11269. return sibling( elem, "previousSibling" );
  11270. },
  11271. nextAll: function( elem ) {
  11272. return dir( elem, "nextSibling" );
  11273. },
  11274. prevAll: function( elem ) {
  11275. return dir( elem, "previousSibling" );
  11276. },
  11277. nextUntil: function( elem, i, until ) {
  11278. return dir( elem, "nextSibling", until );
  11279. },
  11280. prevUntil: function( elem, i, until ) {
  11281. return dir( elem, "previousSibling", until );
  11282. },
  11283. siblings: function( elem ) {
  11284. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11285. },
  11286. children: function( elem ) {
  11287. return siblings( elem.firstChild );
  11288. },
  11289. contents: function( elem ) {
  11290. if ( typeof elem.contentDocument !== "undefined" ) {
  11291. return elem.contentDocument;
  11292. }
  11293. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11294. // Treat the template element as a regular one in browsers that
  11295. // don't support it.
  11296. if ( nodeName( elem, "template" ) ) {
  11297. elem = elem.content || elem;
  11298. }
  11299. return jQuery.merge( [], elem.childNodes );
  11300. }
  11301. }, function( name, fn ) {
  11302. jQuery.fn[ name ] = function( until, selector ) {
  11303. var matched = jQuery.map( this, fn, until );
  11304. if ( name.slice( -5 ) !== "Until" ) {
  11305. selector = until;
  11306. }
  11307. if ( selector && typeof selector === "string" ) {
  11308. matched = jQuery.filter( selector, matched );
  11309. }
  11310. if ( this.length > 1 ) {
  11311. // Remove duplicates
  11312. if ( !guaranteedUnique[ name ] ) {
  11313. jQuery.uniqueSort( matched );
  11314. }
  11315. // Reverse order for parents* and prev-derivatives
  11316. if ( rparentsprev.test( name ) ) {
  11317. matched.reverse();
  11318. }
  11319. }
  11320. return this.pushStack( matched );
  11321. };
  11322. } );
  11323. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11324. // Convert String-formatted options into Object-formatted ones
  11325. function createOptions( options ) {
  11326. var object = {};
  11327. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11328. object[ flag ] = true;
  11329. } );
  11330. return object;
  11331. }
  11332. /*
  11333. * Create a callback list using the following parameters:
  11334. *
  11335. * options: an optional list of space-separated options that will change how
  11336. * the callback list behaves or a more traditional option object
  11337. *
  11338. * By default a callback list will act like an event callback list and can be
  11339. * "fired" multiple times.
  11340. *
  11341. * Possible options:
  11342. *
  11343. * once: will ensure the callback list can only be fired once (like a Deferred)
  11344. *
  11345. * memory: will keep track of previous values and will call any callback added
  11346. * after the list has been fired right away with the latest "memorized"
  11347. * values (like a Deferred)
  11348. *
  11349. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11350. *
  11351. * stopOnFalse: interrupt callings when a callback returns false
  11352. *
  11353. */
  11354. jQuery.Callbacks = function( options ) {
  11355. // Convert options from String-formatted to Object-formatted if needed
  11356. // (we check in cache first)
  11357. options = typeof options === "string" ?
  11358. createOptions( options ) :
  11359. jQuery.extend( {}, options );
  11360. var // Flag to know if list is currently firing
  11361. firing,
  11362. // Last fire value for non-forgettable lists
  11363. memory,
  11364. // Flag to know if list was already fired
  11365. fired,
  11366. // Flag to prevent firing
  11367. locked,
  11368. // Actual callback list
  11369. list = [],
  11370. // Queue of execution data for repeatable lists
  11371. queue = [],
  11372. // Index of currently firing callback (modified by add/remove as needed)
  11373. firingIndex = -1,
  11374. // Fire callbacks
  11375. fire = function() {
  11376. // Enforce single-firing
  11377. locked = locked || options.once;
  11378. // Execute callbacks for all pending executions,
  11379. // respecting firingIndex overrides and runtime changes
  11380. fired = firing = true;
  11381. for ( ; queue.length; firingIndex = -1 ) {
  11382. memory = queue.shift();
  11383. while ( ++firingIndex < list.length ) {
  11384. // Run callback and check for early termination
  11385. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11386. options.stopOnFalse ) {
  11387. // Jump to end and forget the data so .add doesn't re-fire
  11388. firingIndex = list.length;
  11389. memory = false;
  11390. }
  11391. }
  11392. }
  11393. // Forget the data if we're done with it
  11394. if ( !options.memory ) {
  11395. memory = false;
  11396. }
  11397. firing = false;
  11398. // Clean up if we're done firing for good
  11399. if ( locked ) {
  11400. // Keep an empty list if we have data for future add calls
  11401. if ( memory ) {
  11402. list = [];
  11403. // Otherwise, this object is spent
  11404. } else {
  11405. list = "";
  11406. }
  11407. }
  11408. },
  11409. // Actual Callbacks object
  11410. self = {
  11411. // Add a callback or a collection of callbacks to the list
  11412. add: function() {
  11413. if ( list ) {
  11414. // If we have memory from a past run, we should fire after adding
  11415. if ( memory && !firing ) {
  11416. firingIndex = list.length - 1;
  11417. queue.push( memory );
  11418. }
  11419. ( function add( args ) {
  11420. jQuery.each( args, function( _, arg ) {
  11421. if ( isFunction( arg ) ) {
  11422. if ( !options.unique || !self.has( arg ) ) {
  11423. list.push( arg );
  11424. }
  11425. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11426. // Inspect recursively
  11427. add( arg );
  11428. }
  11429. } );
  11430. } )( arguments );
  11431. if ( memory && !firing ) {
  11432. fire();
  11433. }
  11434. }
  11435. return this;
  11436. },
  11437. // Remove a callback from the list
  11438. remove: function() {
  11439. jQuery.each( arguments, function( _, arg ) {
  11440. var index;
  11441. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11442. list.splice( index, 1 );
  11443. // Handle firing indexes
  11444. if ( index <= firingIndex ) {
  11445. firingIndex--;
  11446. }
  11447. }
  11448. } );
  11449. return this;
  11450. },
  11451. // Check if a given callback is in the list.
  11452. // If no argument is given, return whether or not list has callbacks attached.
  11453. has: function( fn ) {
  11454. return fn ?
  11455. jQuery.inArray( fn, list ) > -1 :
  11456. list.length > 0;
  11457. },
  11458. // Remove all callbacks from the list
  11459. empty: function() {
  11460. if ( list ) {
  11461. list = [];
  11462. }
  11463. return this;
  11464. },
  11465. // Disable .fire and .add
  11466. // Abort any current/pending executions
  11467. // Clear all callbacks and values
  11468. disable: function() {
  11469. locked = queue = [];
  11470. list = memory = "";
  11471. return this;
  11472. },
  11473. disabled: function() {
  11474. return !list;
  11475. },
  11476. // Disable .fire
  11477. // Also disable .add unless we have memory (since it would have no effect)
  11478. // Abort any pending executions
  11479. lock: function() {
  11480. locked = queue = [];
  11481. if ( !memory && !firing ) {
  11482. list = memory = "";
  11483. }
  11484. return this;
  11485. },
  11486. locked: function() {
  11487. return !!locked;
  11488. },
  11489. // Call all callbacks with the given context and arguments
  11490. fireWith: function( context, args ) {
  11491. if ( !locked ) {
  11492. args = args || [];
  11493. args = [ context, args.slice ? args.slice() : args ];
  11494. queue.push( args );
  11495. if ( !firing ) {
  11496. fire();
  11497. }
  11498. }
  11499. return this;
  11500. },
  11501. // Call all the callbacks with the given arguments
  11502. fire: function() {
  11503. self.fireWith( this, arguments );
  11504. return this;
  11505. },
  11506. // To know if the callbacks have already been called at least once
  11507. fired: function() {
  11508. return !!fired;
  11509. }
  11510. };
  11511. return self;
  11512. };
  11513. function Identity( v ) {
  11514. return v;
  11515. }
  11516. function Thrower( ex ) {
  11517. throw ex;
  11518. }
  11519. function adoptValue( value, resolve, reject, noValue ) {
  11520. var method;
  11521. try {
  11522. // Check for promise aspect first to privilege synchronous behavior
  11523. if ( value && isFunction( ( method = value.promise ) ) ) {
  11524. method.call( value ).done( resolve ).fail( reject );
  11525. // Other thenables
  11526. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11527. method.call( value, resolve, reject );
  11528. // Other non-thenables
  11529. } else {
  11530. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11531. // * false: [ value ].slice( 0 ) => resolve( value )
  11532. // * true: [ value ].slice( 1 ) => resolve()
  11533. resolve.apply( undefined, [ value ].slice( noValue ) );
  11534. }
  11535. // For Promises/A+, convert exceptions into rejections
  11536. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11537. // Deferred#then to conditionally suppress rejection.
  11538. } catch ( value ) {
  11539. // Support: Android 4.0 only
  11540. // Strict mode functions invoked without .call/.apply get global-object context
  11541. reject.apply( undefined, [ value ] );
  11542. }
  11543. }
  11544. jQuery.extend( {
  11545. Deferred: function( func ) {
  11546. var tuples = [
  11547. // action, add listener, callbacks,
  11548. // ... .then handlers, argument index, [final state]
  11549. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11550. jQuery.Callbacks( "memory" ), 2 ],
  11551. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11552. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11553. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11554. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11555. ],
  11556. state = "pending",
  11557. promise = {
  11558. state: function() {
  11559. return state;
  11560. },
  11561. always: function() {
  11562. deferred.done( arguments ).fail( arguments );
  11563. return this;
  11564. },
  11565. "catch": function( fn ) {
  11566. return promise.then( null, fn );
  11567. },
  11568. // Keep pipe for back-compat
  11569. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11570. var fns = arguments;
  11571. return jQuery.Deferred( function( newDefer ) {
  11572. jQuery.each( tuples, function( i, tuple ) {
  11573. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11574. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11575. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11576. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11577. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11578. deferred[ tuple[ 1 ] ]( function() {
  11579. var returned = fn && fn.apply( this, arguments );
  11580. if ( returned && isFunction( returned.promise ) ) {
  11581. returned.promise()
  11582. .progress( newDefer.notify )
  11583. .done( newDefer.resolve )
  11584. .fail( newDefer.reject );
  11585. } else {
  11586. newDefer[ tuple[ 0 ] + "With" ](
  11587. this,
  11588. fn ? [ returned ] : arguments
  11589. );
  11590. }
  11591. } );
  11592. } );
  11593. fns = null;
  11594. } ).promise();
  11595. },
  11596. then: function( onFulfilled, onRejected, onProgress ) {
  11597. var maxDepth = 0;
  11598. function resolve( depth, deferred, handler, special ) {
  11599. return function() {
  11600. var that = this,
  11601. args = arguments,
  11602. mightThrow = function() {
  11603. var returned, then;
  11604. // Support: Promises/A+ section 2.3.3.3.3
  11605. // https://promisesaplus.com/#point-59
  11606. // Ignore double-resolution attempts
  11607. if ( depth < maxDepth ) {
  11608. return;
  11609. }
  11610. returned = handler.apply( that, args );
  11611. // Support: Promises/A+ section 2.3.1
  11612. // https://promisesaplus.com/#point-48
  11613. if ( returned === deferred.promise() ) {
  11614. throw new TypeError( "Thenable self-resolution" );
  11615. }
  11616. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11617. // https://promisesaplus.com/#point-54
  11618. // https://promisesaplus.com/#point-75
  11619. // Retrieve `then` only once
  11620. then = returned &&
  11621. // Support: Promises/A+ section 2.3.4
  11622. // https://promisesaplus.com/#point-64
  11623. // Only check objects and functions for thenability
  11624. ( typeof returned === "object" ||
  11625. typeof returned === "function" ) &&
  11626. returned.then;
  11627. // Handle a returned thenable
  11628. if ( isFunction( then ) ) {
  11629. // Special processors (notify) just wait for resolution
  11630. if ( special ) {
  11631. then.call(
  11632. returned,
  11633. resolve( maxDepth, deferred, Identity, special ),
  11634. resolve( maxDepth, deferred, Thrower, special )
  11635. );
  11636. // Normal processors (resolve) also hook into progress
  11637. } else {
  11638. // ...and disregard older resolution values
  11639. maxDepth++;
  11640. then.call(
  11641. returned,
  11642. resolve( maxDepth, deferred, Identity, special ),
  11643. resolve( maxDepth, deferred, Thrower, special ),
  11644. resolve( maxDepth, deferred, Identity,
  11645. deferred.notifyWith )
  11646. );
  11647. }
  11648. // Handle all other returned values
  11649. } else {
  11650. // Only substitute handlers pass on context
  11651. // and multiple values (non-spec behavior)
  11652. if ( handler !== Identity ) {
  11653. that = undefined;
  11654. args = [ returned ];
  11655. }
  11656. // Process the value(s)
  11657. // Default process is resolve
  11658. ( special || deferred.resolveWith )( that, args );
  11659. }
  11660. },
  11661. // Only normal processors (resolve) catch and reject exceptions
  11662. process = special ?
  11663. mightThrow :
  11664. function() {
  11665. try {
  11666. mightThrow();
  11667. } catch ( e ) {
  11668. if ( jQuery.Deferred.exceptionHook ) {
  11669. jQuery.Deferred.exceptionHook( e,
  11670. process.stackTrace );
  11671. }
  11672. // Support: Promises/A+ section 2.3.3.3.4.1
  11673. // https://promisesaplus.com/#point-61
  11674. // Ignore post-resolution exceptions
  11675. if ( depth + 1 >= maxDepth ) {
  11676. // Only substitute handlers pass on context
  11677. // and multiple values (non-spec behavior)
  11678. if ( handler !== Thrower ) {
  11679. that = undefined;
  11680. args = [ e ];
  11681. }
  11682. deferred.rejectWith( that, args );
  11683. }
  11684. }
  11685. };
  11686. // Support: Promises/A+ section 2.3.3.3.1
  11687. // https://promisesaplus.com/#point-57
  11688. // Re-resolve promises immediately to dodge false rejection from
  11689. // subsequent errors
  11690. if ( depth ) {
  11691. process();
  11692. } else {
  11693. // Call an optional hook to record the stack, in case of exception
  11694. // since it's otherwise lost when execution goes async
  11695. if ( jQuery.Deferred.getStackHook ) {
  11696. process.stackTrace = jQuery.Deferred.getStackHook();
  11697. }
  11698. window.setTimeout( process );
  11699. }
  11700. };
  11701. }
  11702. return jQuery.Deferred( function( newDefer ) {
  11703. // progress_handlers.add( ... )
  11704. tuples[ 0 ][ 3 ].add(
  11705. resolve(
  11706. 0,
  11707. newDefer,
  11708. isFunction( onProgress ) ?
  11709. onProgress :
  11710. Identity,
  11711. newDefer.notifyWith
  11712. )
  11713. );
  11714. // fulfilled_handlers.add( ... )
  11715. tuples[ 1 ][ 3 ].add(
  11716. resolve(
  11717. 0,
  11718. newDefer,
  11719. isFunction( onFulfilled ) ?
  11720. onFulfilled :
  11721. Identity
  11722. )
  11723. );
  11724. // rejected_handlers.add( ... )
  11725. tuples[ 2 ][ 3 ].add(
  11726. resolve(
  11727. 0,
  11728. newDefer,
  11729. isFunction( onRejected ) ?
  11730. onRejected :
  11731. Thrower
  11732. )
  11733. );
  11734. } ).promise();
  11735. },
  11736. // Get a promise for this deferred
  11737. // If obj is provided, the promise aspect is added to the object
  11738. promise: function( obj ) {
  11739. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11740. }
  11741. },
  11742. deferred = {};
  11743. // Add list-specific methods
  11744. jQuery.each( tuples, function( i, tuple ) {
  11745. var list = tuple[ 2 ],
  11746. stateString = tuple[ 5 ];
  11747. // promise.progress = list.add
  11748. // promise.done = list.add
  11749. // promise.fail = list.add
  11750. promise[ tuple[ 1 ] ] = list.add;
  11751. // Handle state
  11752. if ( stateString ) {
  11753. list.add(
  11754. function() {
  11755. // state = "resolved" (i.e., fulfilled)
  11756. // state = "rejected"
  11757. state = stateString;
  11758. },
  11759. // rejected_callbacks.disable
  11760. // fulfilled_callbacks.disable
  11761. tuples[ 3 - i ][ 2 ].disable,
  11762. // rejected_handlers.disable
  11763. // fulfilled_handlers.disable
  11764. tuples[ 3 - i ][ 3 ].disable,
  11765. // progress_callbacks.lock
  11766. tuples[ 0 ][ 2 ].lock,
  11767. // progress_handlers.lock
  11768. tuples[ 0 ][ 3 ].lock
  11769. );
  11770. }
  11771. // progress_handlers.fire
  11772. // fulfilled_handlers.fire
  11773. // rejected_handlers.fire
  11774. list.add( tuple[ 3 ].fire );
  11775. // deferred.notify = function() { deferred.notifyWith(...) }
  11776. // deferred.resolve = function() { deferred.resolveWith(...) }
  11777. // deferred.reject = function() { deferred.rejectWith(...) }
  11778. deferred[ tuple[ 0 ] ] = function() {
  11779. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11780. return this;
  11781. };
  11782. // deferred.notifyWith = list.fireWith
  11783. // deferred.resolveWith = list.fireWith
  11784. // deferred.rejectWith = list.fireWith
  11785. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11786. } );
  11787. // Make the deferred a promise
  11788. promise.promise( deferred );
  11789. // Call given func if any
  11790. if ( func ) {
  11791. func.call( deferred, deferred );
  11792. }
  11793. // All done!
  11794. return deferred;
  11795. },
  11796. // Deferred helper
  11797. when: function( singleValue ) {
  11798. var
  11799. // count of uncompleted subordinates
  11800. remaining = arguments.length,
  11801. // count of unprocessed arguments
  11802. i = remaining,
  11803. // subordinate fulfillment data
  11804. resolveContexts = Array( i ),
  11805. resolveValues = slice.call( arguments ),
  11806. // the master Deferred
  11807. master = jQuery.Deferred(),
  11808. // subordinate callback factory
  11809. updateFunc = function( i ) {
  11810. return function( value ) {
  11811. resolveContexts[ i ] = this;
  11812. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11813. if ( !( --remaining ) ) {
  11814. master.resolveWith( resolveContexts, resolveValues );
  11815. }
  11816. };
  11817. };
  11818. // Single- and empty arguments are adopted like Promise.resolve
  11819. if ( remaining <= 1 ) {
  11820. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11821. !remaining );
  11822. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11823. if ( master.state() === "pending" ||
  11824. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11825. return master.then();
  11826. }
  11827. }
  11828. // Multiple arguments are aggregated like Promise.all array elements
  11829. while ( i-- ) {
  11830. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11831. }
  11832. return master.promise();
  11833. }
  11834. } );
  11835. // These usually indicate a programmer mistake during development,
  11836. // warn about them ASAP rather than swallowing them by default.
  11837. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11838. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11839. // Support: IE 8 - 9 only
  11840. // Console exists when dev tools are open, which can happen at any time
  11841. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11842. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11843. }
  11844. };
  11845. jQuery.readyException = function( error ) {
  11846. window.setTimeout( function() {
  11847. throw error;
  11848. } );
  11849. };
  11850. // The deferred used on DOM ready
  11851. var readyList = jQuery.Deferred();
  11852. jQuery.fn.ready = function( fn ) {
  11853. readyList
  11854. .then( fn )
  11855. // Wrap jQuery.readyException in a function so that the lookup
  11856. // happens at the time of error handling instead of callback
  11857. // registration.
  11858. .catch( function( error ) {
  11859. jQuery.readyException( error );
  11860. } );
  11861. return this;
  11862. };
  11863. jQuery.extend( {
  11864. // Is the DOM ready to be used? Set to true once it occurs.
  11865. isReady: false,
  11866. // A counter to track how many items to wait for before
  11867. // the ready event fires. See #6781
  11868. readyWait: 1,
  11869. // Handle when the DOM is ready
  11870. ready: function( wait ) {
  11871. // Abort if there are pending holds or we're already ready
  11872. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11873. return;
  11874. }
  11875. // Remember that the DOM is ready
  11876. jQuery.isReady = true;
  11877. // If a normal DOM Ready event fired, decrement, and wait if need be
  11878. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11879. return;
  11880. }
  11881. // If there are functions bound, to execute
  11882. readyList.resolveWith( document, [ jQuery ] );
  11883. }
  11884. } );
  11885. jQuery.ready.then = readyList.then;
  11886. // The ready event handler and self cleanup method
  11887. function completed() {
  11888. document.removeEventListener( "DOMContentLoaded", completed );
  11889. window.removeEventListener( "load", completed );
  11890. jQuery.ready();
  11891. }
  11892. // Catch cases where $(document).ready() is called
  11893. // after the browser event has already occurred.
  11894. // Support: IE <=9 - 10 only
  11895. // Older IE sometimes signals "interactive" too soon
  11896. if ( document.readyState === "complete" ||
  11897. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11898. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11899. window.setTimeout( jQuery.ready );
  11900. } else {
  11901. // Use the handy event callback
  11902. document.addEventListener( "DOMContentLoaded", completed );
  11903. // A fallback to window.onload, that will always work
  11904. window.addEventListener( "load", completed );
  11905. }
  11906. // Multifunctional method to get and set values of a collection
  11907. // The value/s can optionally be executed if it's a function
  11908. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11909. var i = 0,
  11910. len = elems.length,
  11911. bulk = key == null;
  11912. // Sets many values
  11913. if ( toType( key ) === "object" ) {
  11914. chainable = true;
  11915. for ( i in key ) {
  11916. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11917. }
  11918. // Sets one value
  11919. } else if ( value !== undefined ) {
  11920. chainable = true;
  11921. if ( !isFunction( value ) ) {
  11922. raw = true;
  11923. }
  11924. if ( bulk ) {
  11925. // Bulk operations run against the entire set
  11926. if ( raw ) {
  11927. fn.call( elems, value );
  11928. fn = null;
  11929. // ...except when executing function values
  11930. } else {
  11931. bulk = fn;
  11932. fn = function( elem, key, value ) {
  11933. return bulk.call( jQuery( elem ), value );
  11934. };
  11935. }
  11936. }
  11937. if ( fn ) {
  11938. for ( ; i < len; i++ ) {
  11939. fn(
  11940. elems[ i ], key, raw ?
  11941. value :
  11942. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11943. );
  11944. }
  11945. }
  11946. }
  11947. if ( chainable ) {
  11948. return elems;
  11949. }
  11950. // Gets
  11951. if ( bulk ) {
  11952. return fn.call( elems );
  11953. }
  11954. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11955. };
  11956. // Matches dashed string for camelizing
  11957. var rmsPrefix = /^-ms-/,
  11958. rdashAlpha = /-([a-z])/g;
  11959. // Used by camelCase as callback to replace()
  11960. function fcamelCase( all, letter ) {
  11961. return letter.toUpperCase();
  11962. }
  11963. // Convert dashed to camelCase; used by the css and data modules
  11964. // Support: IE <=9 - 11, Edge 12 - 15
  11965. // Microsoft forgot to hump their vendor prefix (#9572)
  11966. function camelCase( string ) {
  11967. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11968. }
  11969. var acceptData = function( owner ) {
  11970. // Accepts only:
  11971. // - Node
  11972. // - Node.ELEMENT_NODE
  11973. // - Node.DOCUMENT_NODE
  11974. // - Object
  11975. // - Any
  11976. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11977. };
  11978. function Data() {
  11979. this.expando = jQuery.expando + Data.uid++;
  11980. }
  11981. Data.uid = 1;
  11982. Data.prototype = {
  11983. cache: function( owner ) {
  11984. // Check if the owner object already has a cache
  11985. var value = owner[ this.expando ];
  11986. // If not, create one
  11987. if ( !value ) {
  11988. value = {};
  11989. // We can accept data for non-element nodes in modern browsers,
  11990. // but we should not, see #8335.
  11991. // Always return an empty object.
  11992. if ( acceptData( owner ) ) {
  11993. // If it is a node unlikely to be stringify-ed or looped over
  11994. // use plain assignment
  11995. if ( owner.nodeType ) {
  11996. owner[ this.expando ] = value;
  11997. // Otherwise secure it in a non-enumerable property
  11998. // configurable must be true to allow the property to be
  11999. // deleted when data is removed
  12000. } else {
  12001. Object.defineProperty( owner, this.expando, {
  12002. value: value,
  12003. configurable: true
  12004. } );
  12005. }
  12006. }
  12007. }
  12008. return value;
  12009. },
  12010. set: function( owner, data, value ) {
  12011. var prop,
  12012. cache = this.cache( owner );
  12013. // Handle: [ owner, key, value ] args
  12014. // Always use camelCase key (gh-2257)
  12015. if ( typeof data === "string" ) {
  12016. cache[ camelCase( data ) ] = value;
  12017. // Handle: [ owner, { properties } ] args
  12018. } else {
  12019. // Copy the properties one-by-one to the cache object
  12020. for ( prop in data ) {
  12021. cache[ camelCase( prop ) ] = data[ prop ];
  12022. }
  12023. }
  12024. return cache;
  12025. },
  12026. get: function( owner, key ) {
  12027. return key === undefined ?
  12028. this.cache( owner ) :
  12029. // Always use camelCase key (gh-2257)
  12030. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12031. },
  12032. access: function( owner, key, value ) {
  12033. // In cases where either:
  12034. //
  12035. // 1. No key was specified
  12036. // 2. A string key was specified, but no value provided
  12037. //
  12038. // Take the "read" path and allow the get method to determine
  12039. // which value to return, respectively either:
  12040. //
  12041. // 1. The entire cache object
  12042. // 2. The data stored at the key
  12043. //
  12044. if ( key === undefined ||
  12045. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12046. return this.get( owner, key );
  12047. }
  12048. // When the key is not a string, or both a key and value
  12049. // are specified, set or extend (existing objects) with either:
  12050. //
  12051. // 1. An object of properties
  12052. // 2. A key and value
  12053. //
  12054. this.set( owner, key, value );
  12055. // Since the "set" path can have two possible entry points
  12056. // return the expected data based on which path was taken[*]
  12057. return value !== undefined ? value : key;
  12058. },
  12059. remove: function( owner, key ) {
  12060. var i,
  12061. cache = owner[ this.expando ];
  12062. if ( cache === undefined ) {
  12063. return;
  12064. }
  12065. if ( key !== undefined ) {
  12066. // Support array or space separated string of keys
  12067. if ( Array.isArray( key ) ) {
  12068. // If key is an array of keys...
  12069. // We always set camelCase keys, so remove that.
  12070. key = key.map( camelCase );
  12071. } else {
  12072. key = camelCase( key );
  12073. // If a key with the spaces exists, use it.
  12074. // Otherwise, create an array by matching non-whitespace
  12075. key = key in cache ?
  12076. [ key ] :
  12077. ( key.match( rnothtmlwhite ) || [] );
  12078. }
  12079. i = key.length;
  12080. while ( i-- ) {
  12081. delete cache[ key[ i ] ];
  12082. }
  12083. }
  12084. // Remove the expando if there's no more data
  12085. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12086. // Support: Chrome <=35 - 45
  12087. // Webkit & Blink performance suffers when deleting properties
  12088. // from DOM nodes, so set to undefined instead
  12089. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12090. if ( owner.nodeType ) {
  12091. owner[ this.expando ] = undefined;
  12092. } else {
  12093. delete owner[ this.expando ];
  12094. }
  12095. }
  12096. },
  12097. hasData: function( owner ) {
  12098. var cache = owner[ this.expando ];
  12099. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12100. }
  12101. };
  12102. var dataPriv = new Data();
  12103. var dataUser = new Data();
  12104. // Implementation Summary
  12105. //
  12106. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12107. // 2. Improve the module's maintainability by reducing the storage
  12108. // paths to a single mechanism.
  12109. // 3. Use the same single mechanism to support "private" and "user" data.
  12110. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12111. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12112. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12113. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12114. rmultiDash = /[A-Z]/g;
  12115. function getData( data ) {
  12116. if ( data === "true" ) {
  12117. return true;
  12118. }
  12119. if ( data === "false" ) {
  12120. return false;
  12121. }
  12122. if ( data === "null" ) {
  12123. return null;
  12124. }
  12125. // Only convert to a number if it doesn't change the string
  12126. if ( data === +data + "" ) {
  12127. return +data;
  12128. }
  12129. if ( rbrace.test( data ) ) {
  12130. return JSON.parse( data );
  12131. }
  12132. return data;
  12133. }
  12134. function dataAttr( elem, key, data ) {
  12135. var name;
  12136. // If nothing was found internally, try to fetch any
  12137. // data from the HTML5 data-* attribute
  12138. if ( data === undefined && elem.nodeType === 1 ) {
  12139. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12140. data = elem.getAttribute( name );
  12141. if ( typeof data === "string" ) {
  12142. try {
  12143. data = getData( data );
  12144. } catch ( e ) {}
  12145. // Make sure we set the data so it isn't changed later
  12146. dataUser.set( elem, key, data );
  12147. } else {
  12148. data = undefined;
  12149. }
  12150. }
  12151. return data;
  12152. }
  12153. jQuery.extend( {
  12154. hasData: function( elem ) {
  12155. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12156. },
  12157. data: function( elem, name, data ) {
  12158. return dataUser.access( elem, name, data );
  12159. },
  12160. removeData: function( elem, name ) {
  12161. dataUser.remove( elem, name );
  12162. },
  12163. // TODO: Now that all calls to _data and _removeData have been replaced
  12164. // with direct calls to dataPriv methods, these can be deprecated.
  12165. _data: function( elem, name, data ) {
  12166. return dataPriv.access( elem, name, data );
  12167. },
  12168. _removeData: function( elem, name ) {
  12169. dataPriv.remove( elem, name );
  12170. }
  12171. } );
  12172. jQuery.fn.extend( {
  12173. data: function( key, value ) {
  12174. var i, name, data,
  12175. elem = this[ 0 ],
  12176. attrs = elem && elem.attributes;
  12177. // Gets all values
  12178. if ( key === undefined ) {
  12179. if ( this.length ) {
  12180. data = dataUser.get( elem );
  12181. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12182. i = attrs.length;
  12183. while ( i-- ) {
  12184. // Support: IE 11 only
  12185. // The attrs elements can be null (#14894)
  12186. if ( attrs[ i ] ) {
  12187. name = attrs[ i ].name;
  12188. if ( name.indexOf( "data-" ) === 0 ) {
  12189. name = camelCase( name.slice( 5 ) );
  12190. dataAttr( elem, name, data[ name ] );
  12191. }
  12192. }
  12193. }
  12194. dataPriv.set( elem, "hasDataAttrs", true );
  12195. }
  12196. }
  12197. return data;
  12198. }
  12199. // Sets multiple values
  12200. if ( typeof key === "object" ) {
  12201. return this.each( function() {
  12202. dataUser.set( this, key );
  12203. } );
  12204. }
  12205. return access( this, function( value ) {
  12206. var data;
  12207. // The calling jQuery object (element matches) is not empty
  12208. // (and therefore has an element appears at this[ 0 ]) and the
  12209. // `value` parameter was not undefined. An empty jQuery object
  12210. // will result in `undefined` for elem = this[ 0 ] which will
  12211. // throw an exception if an attempt to read a data cache is made.
  12212. if ( elem && value === undefined ) {
  12213. // Attempt to get data from the cache
  12214. // The key will always be camelCased in Data
  12215. data = dataUser.get( elem, key );
  12216. if ( data !== undefined ) {
  12217. return data;
  12218. }
  12219. // Attempt to "discover" the data in
  12220. // HTML5 custom data-* attrs
  12221. data = dataAttr( elem, key );
  12222. if ( data !== undefined ) {
  12223. return data;
  12224. }
  12225. // We tried really hard, but the data doesn't exist.
  12226. return;
  12227. }
  12228. // Set the data...
  12229. this.each( function() {
  12230. // We always store the camelCased key
  12231. dataUser.set( this, key, value );
  12232. } );
  12233. }, null, value, arguments.length > 1, null, true );
  12234. },
  12235. removeData: function( key ) {
  12236. return this.each( function() {
  12237. dataUser.remove( this, key );
  12238. } );
  12239. }
  12240. } );
  12241. jQuery.extend( {
  12242. queue: function( elem, type, data ) {
  12243. var queue;
  12244. if ( elem ) {
  12245. type = ( type || "fx" ) + "queue";
  12246. queue = dataPriv.get( elem, type );
  12247. // Speed up dequeue by getting out quickly if this is just a lookup
  12248. if ( data ) {
  12249. if ( !queue || Array.isArray( data ) ) {
  12250. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12251. } else {
  12252. queue.push( data );
  12253. }
  12254. }
  12255. return queue || [];
  12256. }
  12257. },
  12258. dequeue: function( elem, type ) {
  12259. type = type || "fx";
  12260. var queue = jQuery.queue( elem, type ),
  12261. startLength = queue.length,
  12262. fn = queue.shift(),
  12263. hooks = jQuery._queueHooks( elem, type ),
  12264. next = function() {
  12265. jQuery.dequeue( elem, type );
  12266. };
  12267. // If the fx queue is dequeued, always remove the progress sentinel
  12268. if ( fn === "inprogress" ) {
  12269. fn = queue.shift();
  12270. startLength--;
  12271. }
  12272. if ( fn ) {
  12273. // Add a progress sentinel to prevent the fx queue from being
  12274. // automatically dequeued
  12275. if ( type === "fx" ) {
  12276. queue.unshift( "inprogress" );
  12277. }
  12278. // Clear up the last queue stop function
  12279. delete hooks.stop;
  12280. fn.call( elem, next, hooks );
  12281. }
  12282. if ( !startLength && hooks ) {
  12283. hooks.empty.fire();
  12284. }
  12285. },
  12286. // Not public - generate a queueHooks object, or return the current one
  12287. _queueHooks: function( elem, type ) {
  12288. var key = type + "queueHooks";
  12289. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12290. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12291. dataPriv.remove( elem, [ type + "queue", key ] );
  12292. } )
  12293. } );
  12294. }
  12295. } );
  12296. jQuery.fn.extend( {
  12297. queue: function( type, data ) {
  12298. var setter = 2;
  12299. if ( typeof type !== "string" ) {
  12300. data = type;
  12301. type = "fx";
  12302. setter--;
  12303. }
  12304. if ( arguments.length < setter ) {
  12305. return jQuery.queue( this[ 0 ], type );
  12306. }
  12307. return data === undefined ?
  12308. this :
  12309. this.each( function() {
  12310. var queue = jQuery.queue( this, type, data );
  12311. // Ensure a hooks for this queue
  12312. jQuery._queueHooks( this, type );
  12313. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12314. jQuery.dequeue( this, type );
  12315. }
  12316. } );
  12317. },
  12318. dequeue: function( type ) {
  12319. return this.each( function() {
  12320. jQuery.dequeue( this, type );
  12321. } );
  12322. },
  12323. clearQueue: function( type ) {
  12324. return this.queue( type || "fx", [] );
  12325. },
  12326. // Get a promise resolved when queues of a certain type
  12327. // are emptied (fx is the type by default)
  12328. promise: function( type, obj ) {
  12329. var tmp,
  12330. count = 1,
  12331. defer = jQuery.Deferred(),
  12332. elements = this,
  12333. i = this.length,
  12334. resolve = function() {
  12335. if ( !( --count ) ) {
  12336. defer.resolveWith( elements, [ elements ] );
  12337. }
  12338. };
  12339. if ( typeof type !== "string" ) {
  12340. obj = type;
  12341. type = undefined;
  12342. }
  12343. type = type || "fx";
  12344. while ( i-- ) {
  12345. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12346. if ( tmp && tmp.empty ) {
  12347. count++;
  12348. tmp.empty.add( resolve );
  12349. }
  12350. }
  12351. resolve();
  12352. return defer.promise( obj );
  12353. }
  12354. } );
  12355. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12356. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12357. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12358. var documentElement = document.documentElement;
  12359. var isAttached = function( elem ) {
  12360. return jQuery.contains( elem.ownerDocument, elem );
  12361. },
  12362. composed = { composed: true };
  12363. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12364. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12365. // Support: iOS 10.0-10.2 only
  12366. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12367. // leading to errors. We need to check for `getRootNode`.
  12368. if ( documentElement.getRootNode ) {
  12369. isAttached = function( elem ) {
  12370. return jQuery.contains( elem.ownerDocument, elem ) ||
  12371. elem.getRootNode( composed ) === elem.ownerDocument;
  12372. };
  12373. }
  12374. var isHiddenWithinTree = function( elem, el ) {
  12375. // isHiddenWithinTree might be called from jQuery#filter function;
  12376. // in that case, element will be second argument
  12377. elem = el || elem;
  12378. // Inline style trumps all
  12379. return elem.style.display === "none" ||
  12380. elem.style.display === "" &&
  12381. // Otherwise, check computed style
  12382. // Support: Firefox <=43 - 45
  12383. // Disconnected elements can have computed display: none, so first confirm that elem is
  12384. // in the document.
  12385. isAttached( elem ) &&
  12386. jQuery.css( elem, "display" ) === "none";
  12387. };
  12388. var swap = function( elem, options, callback, args ) {
  12389. var ret, name,
  12390. old = {};
  12391. // Remember the old values, and insert the new ones
  12392. for ( name in options ) {
  12393. old[ name ] = elem.style[ name ];
  12394. elem.style[ name ] = options[ name ];
  12395. }
  12396. ret = callback.apply( elem, args || [] );
  12397. // Revert the old values
  12398. for ( name in options ) {
  12399. elem.style[ name ] = old[ name ];
  12400. }
  12401. return ret;
  12402. };
  12403. function adjustCSS( elem, prop, valueParts, tween ) {
  12404. var adjusted, scale,
  12405. maxIterations = 20,
  12406. currentValue = tween ?
  12407. function() {
  12408. return tween.cur();
  12409. } :
  12410. function() {
  12411. return jQuery.css( elem, prop, "" );
  12412. },
  12413. initial = currentValue(),
  12414. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12415. // Starting value computation is required for potential unit mismatches
  12416. initialInUnit = elem.nodeType &&
  12417. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12418. rcssNum.exec( jQuery.css( elem, prop ) );
  12419. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12420. // Support: Firefox <=54
  12421. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12422. initial = initial / 2;
  12423. // Trust units reported by jQuery.css
  12424. unit = unit || initialInUnit[ 3 ];
  12425. // Iteratively approximate from a nonzero starting point
  12426. initialInUnit = +initial || 1;
  12427. while ( maxIterations-- ) {
  12428. // Evaluate and update our best guess (doubling guesses that zero out).
  12429. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12430. jQuery.style( elem, prop, initialInUnit + unit );
  12431. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12432. maxIterations = 0;
  12433. }
  12434. initialInUnit = initialInUnit / scale;
  12435. }
  12436. initialInUnit = initialInUnit * 2;
  12437. jQuery.style( elem, prop, initialInUnit + unit );
  12438. // Make sure we update the tween properties later on
  12439. valueParts = valueParts || [];
  12440. }
  12441. if ( valueParts ) {
  12442. initialInUnit = +initialInUnit || +initial || 0;
  12443. // Apply relative offset (+=/-=) if specified
  12444. adjusted = valueParts[ 1 ] ?
  12445. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12446. +valueParts[ 2 ];
  12447. if ( tween ) {
  12448. tween.unit = unit;
  12449. tween.start = initialInUnit;
  12450. tween.end = adjusted;
  12451. }
  12452. }
  12453. return adjusted;
  12454. }
  12455. var defaultDisplayMap = {};
  12456. function getDefaultDisplay( elem ) {
  12457. var temp,
  12458. doc = elem.ownerDocument,
  12459. nodeName = elem.nodeName,
  12460. display = defaultDisplayMap[ nodeName ];
  12461. if ( display ) {
  12462. return display;
  12463. }
  12464. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12465. display = jQuery.css( temp, "display" );
  12466. temp.parentNode.removeChild( temp );
  12467. if ( display === "none" ) {
  12468. display = "block";
  12469. }
  12470. defaultDisplayMap[ nodeName ] = display;
  12471. return display;
  12472. }
  12473. function showHide( elements, show ) {
  12474. var display, elem,
  12475. values = [],
  12476. index = 0,
  12477. length = elements.length;
  12478. // Determine new display value for elements that need to change
  12479. for ( ; index < length; index++ ) {
  12480. elem = elements[ index ];
  12481. if ( !elem.style ) {
  12482. continue;
  12483. }
  12484. display = elem.style.display;
  12485. if ( show ) {
  12486. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12487. // check is required in this first loop unless we have a nonempty display value (either
  12488. // inline or about-to-be-restored)
  12489. if ( display === "none" ) {
  12490. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12491. if ( !values[ index ] ) {
  12492. elem.style.display = "";
  12493. }
  12494. }
  12495. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12496. values[ index ] = getDefaultDisplay( elem );
  12497. }
  12498. } else {
  12499. if ( display !== "none" ) {
  12500. values[ index ] = "none";
  12501. // Remember what we're overwriting
  12502. dataPriv.set( elem, "display", display );
  12503. }
  12504. }
  12505. }
  12506. // Set the display of the elements in a second loop to avoid constant reflow
  12507. for ( index = 0; index < length; index++ ) {
  12508. if ( values[ index ] != null ) {
  12509. elements[ index ].style.display = values[ index ];
  12510. }
  12511. }
  12512. return elements;
  12513. }
  12514. jQuery.fn.extend( {
  12515. show: function() {
  12516. return showHide( this, true );
  12517. },
  12518. hide: function() {
  12519. return showHide( this );
  12520. },
  12521. toggle: function( state ) {
  12522. if ( typeof state === "boolean" ) {
  12523. return state ? this.show() : this.hide();
  12524. }
  12525. return this.each( function() {
  12526. if ( isHiddenWithinTree( this ) ) {
  12527. jQuery( this ).show();
  12528. } else {
  12529. jQuery( this ).hide();
  12530. }
  12531. } );
  12532. }
  12533. } );
  12534. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12535. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12536. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12537. // We have to close these tags to support XHTML (#13200)
  12538. var wrapMap = {
  12539. // Support: IE <=9 only
  12540. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12541. // XHTML parsers do not magically insert elements in the
  12542. // same way that tag soup parsers do. So we cannot shorten
  12543. // this by omitting <tbody> or other required elements.
  12544. thead: [ 1, "<table>", "</table>" ],
  12545. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12546. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12547. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12548. _default: [ 0, "", "" ]
  12549. };
  12550. // Support: IE <=9 only
  12551. wrapMap.optgroup = wrapMap.option;
  12552. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12553. wrapMap.th = wrapMap.td;
  12554. function getAll( context, tag ) {
  12555. // Support: IE <=9 - 11 only
  12556. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12557. var ret;
  12558. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12559. ret = context.getElementsByTagName( tag || "*" );
  12560. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12561. ret = context.querySelectorAll( tag || "*" );
  12562. } else {
  12563. ret = [];
  12564. }
  12565. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12566. return jQuery.merge( [ context ], ret );
  12567. }
  12568. return ret;
  12569. }
  12570. // Mark scripts as having already been evaluated
  12571. function setGlobalEval( elems, refElements ) {
  12572. var i = 0,
  12573. l = elems.length;
  12574. for ( ; i < l; i++ ) {
  12575. dataPriv.set(
  12576. elems[ i ],
  12577. "globalEval",
  12578. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12579. );
  12580. }
  12581. }
  12582. var rhtml = /<|&#?\w+;/;
  12583. function buildFragment( elems, context, scripts, selection, ignored ) {
  12584. var elem, tmp, tag, wrap, attached, j,
  12585. fragment = context.createDocumentFragment(),
  12586. nodes = [],
  12587. i = 0,
  12588. l = elems.length;
  12589. for ( ; i < l; i++ ) {
  12590. elem = elems[ i ];
  12591. if ( elem || elem === 0 ) {
  12592. // Add nodes directly
  12593. if ( toType( elem ) === "object" ) {
  12594. // Support: Android <=4.0 only, PhantomJS 1 only
  12595. // push.apply(_, arraylike) throws on ancient WebKit
  12596. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12597. // Convert non-html into a text node
  12598. } else if ( !rhtml.test( elem ) ) {
  12599. nodes.push( context.createTextNode( elem ) );
  12600. // Convert html into DOM nodes
  12601. } else {
  12602. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12603. // Deserialize a standard representation
  12604. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12605. wrap = wrapMap[ tag ] || wrapMap._default;
  12606. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12607. // Descend through wrappers to the right content
  12608. j = wrap[ 0 ];
  12609. while ( j-- ) {
  12610. tmp = tmp.lastChild;
  12611. }
  12612. // Support: Android <=4.0 only, PhantomJS 1 only
  12613. // push.apply(_, arraylike) throws on ancient WebKit
  12614. jQuery.merge( nodes, tmp.childNodes );
  12615. // Remember the top-level container
  12616. tmp = fragment.firstChild;
  12617. // Ensure the created nodes are orphaned (#12392)
  12618. tmp.textContent = "";
  12619. }
  12620. }
  12621. }
  12622. // Remove wrapper from fragment
  12623. fragment.textContent = "";
  12624. i = 0;
  12625. while ( ( elem = nodes[ i++ ] ) ) {
  12626. // Skip elements already in the context collection (trac-4087)
  12627. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12628. if ( ignored ) {
  12629. ignored.push( elem );
  12630. }
  12631. continue;
  12632. }
  12633. attached = isAttached( elem );
  12634. // Append to fragment
  12635. tmp = getAll( fragment.appendChild( elem ), "script" );
  12636. // Preserve script evaluation history
  12637. if ( attached ) {
  12638. setGlobalEval( tmp );
  12639. }
  12640. // Capture executables
  12641. if ( scripts ) {
  12642. j = 0;
  12643. while ( ( elem = tmp[ j++ ] ) ) {
  12644. if ( rscriptType.test( elem.type || "" ) ) {
  12645. scripts.push( elem );
  12646. }
  12647. }
  12648. }
  12649. }
  12650. return fragment;
  12651. }
  12652. ( function() {
  12653. var fragment = document.createDocumentFragment(),
  12654. div = fragment.appendChild( document.createElement( "div" ) ),
  12655. input = document.createElement( "input" );
  12656. // Support: Android 4.0 - 4.3 only
  12657. // Check state lost if the name is set (#11217)
  12658. // Support: Windows Web Apps (WWA)
  12659. // `name` and `type` must use .setAttribute for WWA (#14901)
  12660. input.setAttribute( "type", "radio" );
  12661. input.setAttribute( "checked", "checked" );
  12662. input.setAttribute( "name", "t" );
  12663. div.appendChild( input );
  12664. // Support: Android <=4.1 only
  12665. // Older WebKit doesn't clone checked state correctly in fragments
  12666. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12667. // Support: IE <=11 only
  12668. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12669. div.innerHTML = "<textarea>x</textarea>";
  12670. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12671. } )();
  12672. var
  12673. rkeyEvent = /^key/,
  12674. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12675. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12676. function returnTrue() {
  12677. return true;
  12678. }
  12679. function returnFalse() {
  12680. return false;
  12681. }
  12682. // Support: IE <=9 - 11+
  12683. // focus() and blur() are asynchronous, except when they are no-op.
  12684. // So expect focus to be synchronous when the element is already active,
  12685. // and blur to be synchronous when the element is not already active.
  12686. // (focus and blur are always synchronous in other supported browsers,
  12687. // this just defines when we can count on it).
  12688. function expectSync( elem, type ) {
  12689. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12690. }
  12691. // Support: IE <=9 only
  12692. // Accessing document.activeElement can throw unexpectedly
  12693. // https://bugs.jquery.com/ticket/13393
  12694. function safeActiveElement() {
  12695. try {
  12696. return document.activeElement;
  12697. } catch ( err ) { }
  12698. }
  12699. function on( elem, types, selector, data, fn, one ) {
  12700. var origFn, type;
  12701. // Types can be a map of types/handlers
  12702. if ( typeof types === "object" ) {
  12703. // ( types-Object, selector, data )
  12704. if ( typeof selector !== "string" ) {
  12705. // ( types-Object, data )
  12706. data = data || selector;
  12707. selector = undefined;
  12708. }
  12709. for ( type in types ) {
  12710. on( elem, type, selector, data, types[ type ], one );
  12711. }
  12712. return elem;
  12713. }
  12714. if ( data == null && fn == null ) {
  12715. // ( types, fn )
  12716. fn = selector;
  12717. data = selector = undefined;
  12718. } else if ( fn == null ) {
  12719. if ( typeof selector === "string" ) {
  12720. // ( types, selector, fn )
  12721. fn = data;
  12722. data = undefined;
  12723. } else {
  12724. // ( types, data, fn )
  12725. fn = data;
  12726. data = selector;
  12727. selector = undefined;
  12728. }
  12729. }
  12730. if ( fn === false ) {
  12731. fn = returnFalse;
  12732. } else if ( !fn ) {
  12733. return elem;
  12734. }
  12735. if ( one === 1 ) {
  12736. origFn = fn;
  12737. fn = function( event ) {
  12738. // Can use an empty set, since event contains the info
  12739. jQuery().off( event );
  12740. return origFn.apply( this, arguments );
  12741. };
  12742. // Use same guid so caller can remove using origFn
  12743. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12744. }
  12745. return elem.each( function() {
  12746. jQuery.event.add( this, types, fn, data, selector );
  12747. } );
  12748. }
  12749. /*
  12750. * Helper functions for managing events -- not part of the public interface.
  12751. * Props to Dean Edwards' addEvent library for many of the ideas.
  12752. */
  12753. jQuery.event = {
  12754. global: {},
  12755. add: function( elem, types, handler, data, selector ) {
  12756. var handleObjIn, eventHandle, tmp,
  12757. events, t, handleObj,
  12758. special, handlers, type, namespaces, origType,
  12759. elemData = dataPriv.get( elem );
  12760. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12761. if ( !elemData ) {
  12762. return;
  12763. }
  12764. // Caller can pass in an object of custom data in lieu of the handler
  12765. if ( handler.handler ) {
  12766. handleObjIn = handler;
  12767. handler = handleObjIn.handler;
  12768. selector = handleObjIn.selector;
  12769. }
  12770. // Ensure that invalid selectors throw exceptions at attach time
  12771. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12772. if ( selector ) {
  12773. jQuery.find.matchesSelector( documentElement, selector );
  12774. }
  12775. // Make sure that the handler has a unique ID, used to find/remove it later
  12776. if ( !handler.guid ) {
  12777. handler.guid = jQuery.guid++;
  12778. }
  12779. // Init the element's event structure and main handler, if this is the first
  12780. if ( !( events = elemData.events ) ) {
  12781. events = elemData.events = {};
  12782. }
  12783. if ( !( eventHandle = elemData.handle ) ) {
  12784. eventHandle = elemData.handle = function( e ) {
  12785. // Discard the second event of a jQuery.event.trigger() and
  12786. // when an event is called after a page has unloaded
  12787. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12788. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12789. };
  12790. }
  12791. // Handle multiple events separated by a space
  12792. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12793. t = types.length;
  12794. while ( t-- ) {
  12795. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12796. type = origType = tmp[ 1 ];
  12797. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12798. // There *must* be a type, no attaching namespace-only handlers
  12799. if ( !type ) {
  12800. continue;
  12801. }
  12802. // If event changes its type, use the special event handlers for the changed type
  12803. special = jQuery.event.special[ type ] || {};
  12804. // If selector defined, determine special event api type, otherwise given type
  12805. type = ( selector ? special.delegateType : special.bindType ) || type;
  12806. // Update special based on newly reset type
  12807. special = jQuery.event.special[ type ] || {};
  12808. // handleObj is passed to all event handlers
  12809. handleObj = jQuery.extend( {
  12810. type: type,
  12811. origType: origType,
  12812. data: data,
  12813. handler: handler,
  12814. guid: handler.guid,
  12815. selector: selector,
  12816. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12817. namespace: namespaces.join( "." )
  12818. }, handleObjIn );
  12819. // Init the event handler queue if we're the first
  12820. if ( !( handlers = events[ type ] ) ) {
  12821. handlers = events[ type ] = [];
  12822. handlers.delegateCount = 0;
  12823. // Only use addEventListener if the special events handler returns false
  12824. if ( !special.setup ||
  12825. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12826. if ( elem.addEventListener ) {
  12827. elem.addEventListener( type, eventHandle );
  12828. }
  12829. }
  12830. }
  12831. if ( special.add ) {
  12832. special.add.call( elem, handleObj );
  12833. if ( !handleObj.handler.guid ) {
  12834. handleObj.handler.guid = handler.guid;
  12835. }
  12836. }
  12837. // Add to the element's handler list, delegates in front
  12838. if ( selector ) {
  12839. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12840. } else {
  12841. handlers.push( handleObj );
  12842. }
  12843. // Keep track of which events have ever been used, for event optimization
  12844. jQuery.event.global[ type ] = true;
  12845. }
  12846. },
  12847. // Detach an event or set of events from an element
  12848. remove: function( elem, types, handler, selector, mappedTypes ) {
  12849. var j, origCount, tmp,
  12850. events, t, handleObj,
  12851. special, handlers, type, namespaces, origType,
  12852. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12853. if ( !elemData || !( events = elemData.events ) ) {
  12854. return;
  12855. }
  12856. // Once for each type.namespace in types; type may be omitted
  12857. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12858. t = types.length;
  12859. while ( t-- ) {
  12860. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12861. type = origType = tmp[ 1 ];
  12862. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12863. // Unbind all events (on this namespace, if provided) for the element
  12864. if ( !type ) {
  12865. for ( type in events ) {
  12866. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12867. }
  12868. continue;
  12869. }
  12870. special = jQuery.event.special[ type ] || {};
  12871. type = ( selector ? special.delegateType : special.bindType ) || type;
  12872. handlers = events[ type ] || [];
  12873. tmp = tmp[ 2 ] &&
  12874. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12875. // Remove matching events
  12876. origCount = j = handlers.length;
  12877. while ( j-- ) {
  12878. handleObj = handlers[ j ];
  12879. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12880. ( !handler || handler.guid === handleObj.guid ) &&
  12881. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12882. ( !selector || selector === handleObj.selector ||
  12883. selector === "**" && handleObj.selector ) ) {
  12884. handlers.splice( j, 1 );
  12885. if ( handleObj.selector ) {
  12886. handlers.delegateCount--;
  12887. }
  12888. if ( special.remove ) {
  12889. special.remove.call( elem, handleObj );
  12890. }
  12891. }
  12892. }
  12893. // Remove generic event handler if we removed something and no more handlers exist
  12894. // (avoids potential for endless recursion during removal of special event handlers)
  12895. if ( origCount && !handlers.length ) {
  12896. if ( !special.teardown ||
  12897. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12898. jQuery.removeEvent( elem, type, elemData.handle );
  12899. }
  12900. delete events[ type ];
  12901. }
  12902. }
  12903. // Remove data and the expando if it's no longer used
  12904. if ( jQuery.isEmptyObject( events ) ) {
  12905. dataPriv.remove( elem, "handle events" );
  12906. }
  12907. },
  12908. dispatch: function( nativeEvent ) {
  12909. // Make a writable jQuery.Event from the native event object
  12910. var event = jQuery.event.fix( nativeEvent );
  12911. var i, j, ret, matched, handleObj, handlerQueue,
  12912. args = new Array( arguments.length ),
  12913. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12914. special = jQuery.event.special[ event.type ] || {};
  12915. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12916. args[ 0 ] = event;
  12917. for ( i = 1; i < arguments.length; i++ ) {
  12918. args[ i ] = arguments[ i ];
  12919. }
  12920. event.delegateTarget = this;
  12921. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12922. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12923. return;
  12924. }
  12925. // Determine handlers
  12926. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12927. // Run delegates first; they may want to stop propagation beneath us
  12928. i = 0;
  12929. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12930. event.currentTarget = matched.elem;
  12931. j = 0;
  12932. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12933. !event.isImmediatePropagationStopped() ) {
  12934. // If the event is namespaced, then each handler is only invoked if it is
  12935. // specially universal or its namespaces are a superset of the event's.
  12936. if ( !event.rnamespace || handleObj.namespace === false ||
  12937. event.rnamespace.test( handleObj.namespace ) ) {
  12938. event.handleObj = handleObj;
  12939. event.data = handleObj.data;
  12940. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12941. handleObj.handler ).apply( matched.elem, args );
  12942. if ( ret !== undefined ) {
  12943. if ( ( event.result = ret ) === false ) {
  12944. event.preventDefault();
  12945. event.stopPropagation();
  12946. }
  12947. }
  12948. }
  12949. }
  12950. }
  12951. // Call the postDispatch hook for the mapped type
  12952. if ( special.postDispatch ) {
  12953. special.postDispatch.call( this, event );
  12954. }
  12955. return event.result;
  12956. },
  12957. handlers: function( event, handlers ) {
  12958. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12959. handlerQueue = [],
  12960. delegateCount = handlers.delegateCount,
  12961. cur = event.target;
  12962. // Find delegate handlers
  12963. if ( delegateCount &&
  12964. // Support: IE <=9
  12965. // Black-hole SVG <use> instance trees (trac-13180)
  12966. cur.nodeType &&
  12967. // Support: Firefox <=42
  12968. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12969. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12970. // Support: IE 11 only
  12971. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12972. !( event.type === "click" && event.button >= 1 ) ) {
  12973. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12974. // Don't check non-elements (#13208)
  12975. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12976. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12977. matchedHandlers = [];
  12978. matchedSelectors = {};
  12979. for ( i = 0; i < delegateCount; i++ ) {
  12980. handleObj = handlers[ i ];
  12981. // Don't conflict with Object.prototype properties (#13203)
  12982. sel = handleObj.selector + " ";
  12983. if ( matchedSelectors[ sel ] === undefined ) {
  12984. matchedSelectors[ sel ] = handleObj.needsContext ?
  12985. jQuery( sel, this ).index( cur ) > -1 :
  12986. jQuery.find( sel, this, null, [ cur ] ).length;
  12987. }
  12988. if ( matchedSelectors[ sel ] ) {
  12989. matchedHandlers.push( handleObj );
  12990. }
  12991. }
  12992. if ( matchedHandlers.length ) {
  12993. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12994. }
  12995. }
  12996. }
  12997. }
  12998. // Add the remaining (directly-bound) handlers
  12999. cur = this;
  13000. if ( delegateCount < handlers.length ) {
  13001. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13002. }
  13003. return handlerQueue;
  13004. },
  13005. addProp: function( name, hook ) {
  13006. Object.defineProperty( jQuery.Event.prototype, name, {
  13007. enumerable: true,
  13008. configurable: true,
  13009. get: isFunction( hook ) ?
  13010. function() {
  13011. if ( this.originalEvent ) {
  13012. return hook( this.originalEvent );
  13013. }
  13014. } :
  13015. function() {
  13016. if ( this.originalEvent ) {
  13017. return this.originalEvent[ name ];
  13018. }
  13019. },
  13020. set: function( value ) {
  13021. Object.defineProperty( this, name, {
  13022. enumerable: true,
  13023. configurable: true,
  13024. writable: true,
  13025. value: value
  13026. } );
  13027. }
  13028. } );
  13029. },
  13030. fix: function( originalEvent ) {
  13031. return originalEvent[ jQuery.expando ] ?
  13032. originalEvent :
  13033. new jQuery.Event( originalEvent );
  13034. },
  13035. special: {
  13036. load: {
  13037. // Prevent triggered image.load events from bubbling to window.load
  13038. noBubble: true
  13039. },
  13040. click: {
  13041. // Utilize native event to ensure correct state for checkable inputs
  13042. setup: function( data ) {
  13043. // For mutual compressibility with _default, replace `this` access with a local var.
  13044. // `|| data` is dead code meant only to preserve the variable through minification.
  13045. var el = this || data;
  13046. // Claim the first handler
  13047. if ( rcheckableType.test( el.type ) &&
  13048. el.click && nodeName( el, "input" ) ) {
  13049. // dataPriv.set( el, "click", ... )
  13050. leverageNative( el, "click", returnTrue );
  13051. }
  13052. // Return false to allow normal processing in the caller
  13053. return false;
  13054. },
  13055. trigger: function( data ) {
  13056. // For mutual compressibility with _default, replace `this` access with a local var.
  13057. // `|| data` is dead code meant only to preserve the variable through minification.
  13058. var el = this || data;
  13059. // Force setup before triggering a click
  13060. if ( rcheckableType.test( el.type ) &&
  13061. el.click && nodeName( el, "input" ) ) {
  13062. leverageNative( el, "click" );
  13063. }
  13064. // Return non-false to allow normal event-path propagation
  13065. return true;
  13066. },
  13067. // For cross-browser consistency, suppress native .click() on links
  13068. // Also prevent it if we're currently inside a leveraged native-event stack
  13069. _default: function( event ) {
  13070. var target = event.target;
  13071. return rcheckableType.test( target.type ) &&
  13072. target.click && nodeName( target, "input" ) &&
  13073. dataPriv.get( target, "click" ) ||
  13074. nodeName( target, "a" );
  13075. }
  13076. },
  13077. beforeunload: {
  13078. postDispatch: function( event ) {
  13079. // Support: Firefox 20+
  13080. // Firefox doesn't alert if the returnValue field is not set.
  13081. if ( event.result !== undefined && event.originalEvent ) {
  13082. event.originalEvent.returnValue = event.result;
  13083. }
  13084. }
  13085. }
  13086. }
  13087. };
  13088. // Ensure the presence of an event listener that handles manually-triggered
  13089. // synthetic events by interrupting progress until reinvoked in response to
  13090. // *native* events that it fires directly, ensuring that state changes have
  13091. // already occurred before other listeners are invoked.
  13092. function leverageNative( el, type, expectSync ) {
  13093. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13094. if ( !expectSync ) {
  13095. if ( dataPriv.get( el, type ) === undefined ) {
  13096. jQuery.event.add( el, type, returnTrue );
  13097. }
  13098. return;
  13099. }
  13100. // Register the controller as a special universal handler for all event namespaces
  13101. dataPriv.set( el, type, false );
  13102. jQuery.event.add( el, type, {
  13103. namespace: false,
  13104. handler: function( event ) {
  13105. var notAsync, result,
  13106. saved = dataPriv.get( this, type );
  13107. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13108. // Interrupt processing of the outer synthetic .trigger()ed event
  13109. // Saved data should be false in such cases, but might be a leftover capture object
  13110. // from an async native handler (gh-4350)
  13111. if ( !saved.length ) {
  13112. // Store arguments for use when handling the inner native event
  13113. // There will always be at least one argument (an event object), so this array
  13114. // will not be confused with a leftover capture object.
  13115. saved = slice.call( arguments );
  13116. dataPriv.set( this, type, saved );
  13117. // Trigger the native event and capture its result
  13118. // Support: IE <=9 - 11+
  13119. // focus() and blur() are asynchronous
  13120. notAsync = expectSync( this, type );
  13121. this[ type ]();
  13122. result = dataPriv.get( this, type );
  13123. if ( saved !== result || notAsync ) {
  13124. dataPriv.set( this, type, false );
  13125. } else {
  13126. result = {};
  13127. }
  13128. if ( saved !== result ) {
  13129. // Cancel the outer synthetic event
  13130. event.stopImmediatePropagation();
  13131. event.preventDefault();
  13132. return result.value;
  13133. }
  13134. // If this is an inner synthetic event for an event with a bubbling surrogate
  13135. // (focus or blur), assume that the surrogate already propagated from triggering the
  13136. // native event and prevent that from happening again here.
  13137. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13138. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13139. // less bad than duplication.
  13140. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13141. event.stopPropagation();
  13142. }
  13143. // If this is a native event triggered above, everything is now in order
  13144. // Fire an inner synthetic event with the original arguments
  13145. } else if ( saved.length ) {
  13146. // ...and capture the result
  13147. dataPriv.set( this, type, {
  13148. value: jQuery.event.trigger(
  13149. // Support: IE <=9 - 11+
  13150. // Extend with the prototype to reset the above stopImmediatePropagation()
  13151. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13152. saved.slice( 1 ),
  13153. this
  13154. )
  13155. } );
  13156. // Abort handling of the native event
  13157. event.stopImmediatePropagation();
  13158. }
  13159. }
  13160. } );
  13161. }
  13162. jQuery.removeEvent = function( elem, type, handle ) {
  13163. // This "if" is needed for plain objects
  13164. if ( elem.removeEventListener ) {
  13165. elem.removeEventListener( type, handle );
  13166. }
  13167. };
  13168. jQuery.Event = function( src, props ) {
  13169. // Allow instantiation without the 'new' keyword
  13170. if ( !( this instanceof jQuery.Event ) ) {
  13171. return new jQuery.Event( src, props );
  13172. }
  13173. // Event object
  13174. if ( src && src.type ) {
  13175. this.originalEvent = src;
  13176. this.type = src.type;
  13177. // Events bubbling up the document may have been marked as prevented
  13178. // by a handler lower down the tree; reflect the correct value.
  13179. this.isDefaultPrevented = src.defaultPrevented ||
  13180. src.defaultPrevented === undefined &&
  13181. // Support: Android <=2.3 only
  13182. src.returnValue === false ?
  13183. returnTrue :
  13184. returnFalse;
  13185. // Create target properties
  13186. // Support: Safari <=6 - 7 only
  13187. // Target should not be a text node (#504, #13143)
  13188. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13189. src.target.parentNode :
  13190. src.target;
  13191. this.currentTarget = src.currentTarget;
  13192. this.relatedTarget = src.relatedTarget;
  13193. // Event type
  13194. } else {
  13195. this.type = src;
  13196. }
  13197. // Put explicitly provided properties onto the event object
  13198. if ( props ) {
  13199. jQuery.extend( this, props );
  13200. }
  13201. // Create a timestamp if incoming event doesn't have one
  13202. this.timeStamp = src && src.timeStamp || Date.now();
  13203. // Mark it as fixed
  13204. this[ jQuery.expando ] = true;
  13205. };
  13206. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13207. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13208. jQuery.Event.prototype = {
  13209. constructor: jQuery.Event,
  13210. isDefaultPrevented: returnFalse,
  13211. isPropagationStopped: returnFalse,
  13212. isImmediatePropagationStopped: returnFalse,
  13213. isSimulated: false,
  13214. preventDefault: function() {
  13215. var e = this.originalEvent;
  13216. this.isDefaultPrevented = returnTrue;
  13217. if ( e && !this.isSimulated ) {
  13218. e.preventDefault();
  13219. }
  13220. },
  13221. stopPropagation: function() {
  13222. var e = this.originalEvent;
  13223. this.isPropagationStopped = returnTrue;
  13224. if ( e && !this.isSimulated ) {
  13225. e.stopPropagation();
  13226. }
  13227. },
  13228. stopImmediatePropagation: function() {
  13229. var e = this.originalEvent;
  13230. this.isImmediatePropagationStopped = returnTrue;
  13231. if ( e && !this.isSimulated ) {
  13232. e.stopImmediatePropagation();
  13233. }
  13234. this.stopPropagation();
  13235. }
  13236. };
  13237. // Includes all common event props including KeyEvent and MouseEvent specific props
  13238. jQuery.each( {
  13239. altKey: true,
  13240. bubbles: true,
  13241. cancelable: true,
  13242. changedTouches: true,
  13243. ctrlKey: true,
  13244. detail: true,
  13245. eventPhase: true,
  13246. metaKey: true,
  13247. pageX: true,
  13248. pageY: true,
  13249. shiftKey: true,
  13250. view: true,
  13251. "char": true,
  13252. code: true,
  13253. charCode: true,
  13254. key: true,
  13255. keyCode: true,
  13256. button: true,
  13257. buttons: true,
  13258. clientX: true,
  13259. clientY: true,
  13260. offsetX: true,
  13261. offsetY: true,
  13262. pointerId: true,
  13263. pointerType: true,
  13264. screenX: true,
  13265. screenY: true,
  13266. targetTouches: true,
  13267. toElement: true,
  13268. touches: true,
  13269. which: function( event ) {
  13270. var button = event.button;
  13271. // Add which for key events
  13272. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13273. return event.charCode != null ? event.charCode : event.keyCode;
  13274. }
  13275. // Add which for click: 1 === left; 2 === middle; 3 === right
  13276. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13277. if ( button & 1 ) {
  13278. return 1;
  13279. }
  13280. if ( button & 2 ) {
  13281. return 3;
  13282. }
  13283. if ( button & 4 ) {
  13284. return 2;
  13285. }
  13286. return 0;
  13287. }
  13288. return event.which;
  13289. }
  13290. }, jQuery.event.addProp );
  13291. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13292. jQuery.event.special[ type ] = {
  13293. // Utilize native event if possible so blur/focus sequence is correct
  13294. setup: function() {
  13295. // Claim the first handler
  13296. // dataPriv.set( this, "focus", ... )
  13297. // dataPriv.set( this, "blur", ... )
  13298. leverageNative( this, type, expectSync );
  13299. // Return false to allow normal processing in the caller
  13300. return false;
  13301. },
  13302. trigger: function() {
  13303. // Force setup before trigger
  13304. leverageNative( this, type );
  13305. // Return non-false to allow normal event-path propagation
  13306. return true;
  13307. },
  13308. delegateType: delegateType
  13309. };
  13310. } );
  13311. // Create mouseenter/leave events using mouseover/out and event-time checks
  13312. // so that event delegation works in jQuery.
  13313. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13314. //
  13315. // Support: Safari 7 only
  13316. // Safari sends mouseenter too often; see:
  13317. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13318. // for the description of the bug (it existed in older Chrome versions as well).
  13319. jQuery.each( {
  13320. mouseenter: "mouseover",
  13321. mouseleave: "mouseout",
  13322. pointerenter: "pointerover",
  13323. pointerleave: "pointerout"
  13324. }, function( orig, fix ) {
  13325. jQuery.event.special[ orig ] = {
  13326. delegateType: fix,
  13327. bindType: fix,
  13328. handle: function( event ) {
  13329. var ret,
  13330. target = this,
  13331. related = event.relatedTarget,
  13332. handleObj = event.handleObj;
  13333. // For mouseenter/leave call the handler if related is outside the target.
  13334. // NB: No relatedTarget if the mouse left/entered the browser window
  13335. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13336. event.type = handleObj.origType;
  13337. ret = handleObj.handler.apply( this, arguments );
  13338. event.type = fix;
  13339. }
  13340. return ret;
  13341. }
  13342. };
  13343. } );
  13344. jQuery.fn.extend( {
  13345. on: function( types, selector, data, fn ) {
  13346. return on( this, types, selector, data, fn );
  13347. },
  13348. one: function( types, selector, data, fn ) {
  13349. return on( this, types, selector, data, fn, 1 );
  13350. },
  13351. off: function( types, selector, fn ) {
  13352. var handleObj, type;
  13353. if ( types && types.preventDefault && types.handleObj ) {
  13354. // ( event ) dispatched jQuery.Event
  13355. handleObj = types.handleObj;
  13356. jQuery( types.delegateTarget ).off(
  13357. handleObj.namespace ?
  13358. handleObj.origType + "." + handleObj.namespace :
  13359. handleObj.origType,
  13360. handleObj.selector,
  13361. handleObj.handler
  13362. );
  13363. return this;
  13364. }
  13365. if ( typeof types === "object" ) {
  13366. // ( types-object [, selector] )
  13367. for ( type in types ) {
  13368. this.off( type, selector, types[ type ] );
  13369. }
  13370. return this;
  13371. }
  13372. if ( selector === false || typeof selector === "function" ) {
  13373. // ( types [, fn] )
  13374. fn = selector;
  13375. selector = undefined;
  13376. }
  13377. if ( fn === false ) {
  13378. fn = returnFalse;
  13379. }
  13380. return this.each( function() {
  13381. jQuery.event.remove( this, types, fn, selector );
  13382. } );
  13383. }
  13384. } );
  13385. var
  13386. /* eslint-disable max-len */
  13387. // See https://github.com/eslint/eslint/issues/3229
  13388. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13389. /* eslint-enable */
  13390. // Support: IE <=10 - 11, Edge 12 - 13 only
  13391. // In IE/Edge using regex groups here causes severe slowdowns.
  13392. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13393. rnoInnerhtml = /<script|<style|<link/i,
  13394. // checked="checked" or checked
  13395. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13396. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13397. // Prefer a tbody over its parent table for containing new rows
  13398. function manipulationTarget( elem, content ) {
  13399. if ( nodeName( elem, "table" ) &&
  13400. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13401. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13402. }
  13403. return elem;
  13404. }
  13405. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13406. function disableScript( elem ) {
  13407. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13408. return elem;
  13409. }
  13410. function restoreScript( elem ) {
  13411. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13412. elem.type = elem.type.slice( 5 );
  13413. } else {
  13414. elem.removeAttribute( "type" );
  13415. }
  13416. return elem;
  13417. }
  13418. function cloneCopyEvent( src, dest ) {
  13419. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13420. if ( dest.nodeType !== 1 ) {
  13421. return;
  13422. }
  13423. // 1. Copy private data: events, handlers, etc.
  13424. if ( dataPriv.hasData( src ) ) {
  13425. pdataOld = dataPriv.access( src );
  13426. pdataCur = dataPriv.set( dest, pdataOld );
  13427. events = pdataOld.events;
  13428. if ( events ) {
  13429. delete pdataCur.handle;
  13430. pdataCur.events = {};
  13431. for ( type in events ) {
  13432. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13433. jQuery.event.add( dest, type, events[ type ][ i ] );
  13434. }
  13435. }
  13436. }
  13437. }
  13438. // 2. Copy user data
  13439. if ( dataUser.hasData( src ) ) {
  13440. udataOld = dataUser.access( src );
  13441. udataCur = jQuery.extend( {}, udataOld );
  13442. dataUser.set( dest, udataCur );
  13443. }
  13444. }
  13445. // Fix IE bugs, see support tests
  13446. function fixInput( src, dest ) {
  13447. var nodeName = dest.nodeName.toLowerCase();
  13448. // Fails to persist the checked state of a cloned checkbox or radio button.
  13449. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13450. dest.checked = src.checked;
  13451. // Fails to return the selected option to the default selected state when cloning options
  13452. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13453. dest.defaultValue = src.defaultValue;
  13454. }
  13455. }
  13456. function domManip( collection, args, callback, ignored ) {
  13457. // Flatten any nested arrays
  13458. args = concat.apply( [], args );
  13459. var fragment, first, scripts, hasScripts, node, doc,
  13460. i = 0,
  13461. l = collection.length,
  13462. iNoClone = l - 1,
  13463. value = args[ 0 ],
  13464. valueIsFunction = isFunction( value );
  13465. // We can't cloneNode fragments that contain checked, in WebKit
  13466. if ( valueIsFunction ||
  13467. ( l > 1 && typeof value === "string" &&
  13468. !support.checkClone && rchecked.test( value ) ) ) {
  13469. return collection.each( function( index ) {
  13470. var self = collection.eq( index );
  13471. if ( valueIsFunction ) {
  13472. args[ 0 ] = value.call( this, index, self.html() );
  13473. }
  13474. domManip( self, args, callback, ignored );
  13475. } );
  13476. }
  13477. if ( l ) {
  13478. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13479. first = fragment.firstChild;
  13480. if ( fragment.childNodes.length === 1 ) {
  13481. fragment = first;
  13482. }
  13483. // Require either new content or an interest in ignored elements to invoke the callback
  13484. if ( first || ignored ) {
  13485. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13486. hasScripts = scripts.length;
  13487. // Use the original fragment for the last item
  13488. // instead of the first because it can end up
  13489. // being emptied incorrectly in certain situations (#8070).
  13490. for ( ; i < l; i++ ) {
  13491. node = fragment;
  13492. if ( i !== iNoClone ) {
  13493. node = jQuery.clone( node, true, true );
  13494. // Keep references to cloned scripts for later restoration
  13495. if ( hasScripts ) {
  13496. // Support: Android <=4.0 only, PhantomJS 1 only
  13497. // push.apply(_, arraylike) throws on ancient WebKit
  13498. jQuery.merge( scripts, getAll( node, "script" ) );
  13499. }
  13500. }
  13501. callback.call( collection[ i ], node, i );
  13502. }
  13503. if ( hasScripts ) {
  13504. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13505. // Reenable scripts
  13506. jQuery.map( scripts, restoreScript );
  13507. // Evaluate executable scripts on first document insertion
  13508. for ( i = 0; i < hasScripts; i++ ) {
  13509. node = scripts[ i ];
  13510. if ( rscriptType.test( node.type || "" ) &&
  13511. !dataPriv.access( node, "globalEval" ) &&
  13512. jQuery.contains( doc, node ) ) {
  13513. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13514. // Optional AJAX dependency, but won't run scripts if not present
  13515. if ( jQuery._evalUrl && !node.noModule ) {
  13516. jQuery._evalUrl( node.src, {
  13517. nonce: node.nonce || node.getAttribute( "nonce" )
  13518. } );
  13519. }
  13520. } else {
  13521. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13522. }
  13523. }
  13524. }
  13525. }
  13526. }
  13527. }
  13528. return collection;
  13529. }
  13530. function remove( elem, selector, keepData ) {
  13531. var node,
  13532. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13533. i = 0;
  13534. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13535. if ( !keepData && node.nodeType === 1 ) {
  13536. jQuery.cleanData( getAll( node ) );
  13537. }
  13538. if ( node.parentNode ) {
  13539. if ( keepData && isAttached( node ) ) {
  13540. setGlobalEval( getAll( node, "script" ) );
  13541. }
  13542. node.parentNode.removeChild( node );
  13543. }
  13544. }
  13545. return elem;
  13546. }
  13547. jQuery.extend( {
  13548. htmlPrefilter: function( html ) {
  13549. return html.replace( rxhtmlTag, "<$1></$2>" );
  13550. },
  13551. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13552. var i, l, srcElements, destElements,
  13553. clone = elem.cloneNode( true ),
  13554. inPage = isAttached( elem );
  13555. // Fix IE cloning issues
  13556. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13557. !jQuery.isXMLDoc( elem ) ) {
  13558. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13559. destElements = getAll( clone );
  13560. srcElements = getAll( elem );
  13561. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13562. fixInput( srcElements[ i ], destElements[ i ] );
  13563. }
  13564. }
  13565. // Copy the events from the original to the clone
  13566. if ( dataAndEvents ) {
  13567. if ( deepDataAndEvents ) {
  13568. srcElements = srcElements || getAll( elem );
  13569. destElements = destElements || getAll( clone );
  13570. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13571. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13572. }
  13573. } else {
  13574. cloneCopyEvent( elem, clone );
  13575. }
  13576. }
  13577. // Preserve script evaluation history
  13578. destElements = getAll( clone, "script" );
  13579. if ( destElements.length > 0 ) {
  13580. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13581. }
  13582. // Return the cloned set
  13583. return clone;
  13584. },
  13585. cleanData: function( elems ) {
  13586. var data, elem, type,
  13587. special = jQuery.event.special,
  13588. i = 0;
  13589. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13590. if ( acceptData( elem ) ) {
  13591. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13592. if ( data.events ) {
  13593. for ( type in data.events ) {
  13594. if ( special[ type ] ) {
  13595. jQuery.event.remove( elem, type );
  13596. // This is a shortcut to avoid jQuery.event.remove's overhead
  13597. } else {
  13598. jQuery.removeEvent( elem, type, data.handle );
  13599. }
  13600. }
  13601. }
  13602. // Support: Chrome <=35 - 45+
  13603. // Assign undefined instead of using delete, see Data#remove
  13604. elem[ dataPriv.expando ] = undefined;
  13605. }
  13606. if ( elem[ dataUser.expando ] ) {
  13607. // Support: Chrome <=35 - 45+
  13608. // Assign undefined instead of using delete, see Data#remove
  13609. elem[ dataUser.expando ] = undefined;
  13610. }
  13611. }
  13612. }
  13613. }
  13614. } );
  13615. jQuery.fn.extend( {
  13616. detach: function( selector ) {
  13617. return remove( this, selector, true );
  13618. },
  13619. remove: function( selector ) {
  13620. return remove( this, selector );
  13621. },
  13622. text: function( value ) {
  13623. return access( this, function( value ) {
  13624. return value === undefined ?
  13625. jQuery.text( this ) :
  13626. this.empty().each( function() {
  13627. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13628. this.textContent = value;
  13629. }
  13630. } );
  13631. }, null, value, arguments.length );
  13632. },
  13633. append: function() {
  13634. return domManip( this, arguments, function( elem ) {
  13635. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13636. var target = manipulationTarget( this, elem );
  13637. target.appendChild( elem );
  13638. }
  13639. } );
  13640. },
  13641. prepend: function() {
  13642. return domManip( this, arguments, function( elem ) {
  13643. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13644. var target = manipulationTarget( this, elem );
  13645. target.insertBefore( elem, target.firstChild );
  13646. }
  13647. } );
  13648. },
  13649. before: function() {
  13650. return domManip( this, arguments, function( elem ) {
  13651. if ( this.parentNode ) {
  13652. this.parentNode.insertBefore( elem, this );
  13653. }
  13654. } );
  13655. },
  13656. after: function() {
  13657. return domManip( this, arguments, function( elem ) {
  13658. if ( this.parentNode ) {
  13659. this.parentNode.insertBefore( elem, this.nextSibling );
  13660. }
  13661. } );
  13662. },
  13663. empty: function() {
  13664. var elem,
  13665. i = 0;
  13666. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13667. if ( elem.nodeType === 1 ) {
  13668. // Prevent memory leaks
  13669. jQuery.cleanData( getAll( elem, false ) );
  13670. // Remove any remaining nodes
  13671. elem.textContent = "";
  13672. }
  13673. }
  13674. return this;
  13675. },
  13676. clone: function( dataAndEvents, deepDataAndEvents ) {
  13677. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13678. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13679. return this.map( function() {
  13680. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13681. } );
  13682. },
  13683. html: function( value ) {
  13684. return access( this, function( value ) {
  13685. var elem = this[ 0 ] || {},
  13686. i = 0,
  13687. l = this.length;
  13688. if ( value === undefined && elem.nodeType === 1 ) {
  13689. return elem.innerHTML;
  13690. }
  13691. // See if we can take a shortcut and just use innerHTML
  13692. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13693. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13694. value = jQuery.htmlPrefilter( value );
  13695. try {
  13696. for ( ; i < l; i++ ) {
  13697. elem = this[ i ] || {};
  13698. // Remove element nodes and prevent memory leaks
  13699. if ( elem.nodeType === 1 ) {
  13700. jQuery.cleanData( getAll( elem, false ) );
  13701. elem.innerHTML = value;
  13702. }
  13703. }
  13704. elem = 0;
  13705. // If using innerHTML throws an exception, use the fallback method
  13706. } catch ( e ) {}
  13707. }
  13708. if ( elem ) {
  13709. this.empty().append( value );
  13710. }
  13711. }, null, value, arguments.length );
  13712. },
  13713. replaceWith: function() {
  13714. var ignored = [];
  13715. // Make the changes, replacing each non-ignored context element with the new content
  13716. return domManip( this, arguments, function( elem ) {
  13717. var parent = this.parentNode;
  13718. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13719. jQuery.cleanData( getAll( this ) );
  13720. if ( parent ) {
  13721. parent.replaceChild( elem, this );
  13722. }
  13723. }
  13724. // Force callback invocation
  13725. }, ignored );
  13726. }
  13727. } );
  13728. jQuery.each( {
  13729. appendTo: "append",
  13730. prependTo: "prepend",
  13731. insertBefore: "before",
  13732. insertAfter: "after",
  13733. replaceAll: "replaceWith"
  13734. }, function( name, original ) {
  13735. jQuery.fn[ name ] = function( selector ) {
  13736. var elems,
  13737. ret = [],
  13738. insert = jQuery( selector ),
  13739. last = insert.length - 1,
  13740. i = 0;
  13741. for ( ; i <= last; i++ ) {
  13742. elems = i === last ? this : this.clone( true );
  13743. jQuery( insert[ i ] )[ original ]( elems );
  13744. // Support: Android <=4.0 only, PhantomJS 1 only
  13745. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13746. push.apply( ret, elems.get() );
  13747. }
  13748. return this.pushStack( ret );
  13749. };
  13750. } );
  13751. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13752. var getStyles = function( elem ) {
  13753. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13754. // IE throws on elements created in popups
  13755. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13756. var view = elem.ownerDocument.defaultView;
  13757. if ( !view || !view.opener ) {
  13758. view = window;
  13759. }
  13760. return view.getComputedStyle( elem );
  13761. };
  13762. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13763. ( function() {
  13764. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13765. // so they're executed at the same time to save the second computation.
  13766. function computeStyleTests() {
  13767. // This is a singleton, we need to execute it only once
  13768. if ( !div ) {
  13769. return;
  13770. }
  13771. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13772. "margin-top:1px;padding:0;border:0";
  13773. div.style.cssText =
  13774. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13775. "margin:auto;border:1px;padding:1px;" +
  13776. "width:60%;top:1%";
  13777. documentElement.appendChild( container ).appendChild( div );
  13778. var divStyle = window.getComputedStyle( div );
  13779. pixelPositionVal = divStyle.top !== "1%";
  13780. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13781. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13782. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13783. // Some styles come back with percentage values, even though they shouldn't
  13784. div.style.right = "60%";
  13785. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13786. // Support: IE 9 - 11 only
  13787. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13788. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13789. // Support: IE 9 only
  13790. // Detect overflow:scroll screwiness (gh-3699)
  13791. // Support: Chrome <=64
  13792. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13793. div.style.position = "absolute";
  13794. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13795. documentElement.removeChild( container );
  13796. // Nullify the div so it wouldn't be stored in the memory and
  13797. // it will also be a sign that checks already performed
  13798. div = null;
  13799. }
  13800. function roundPixelMeasures( measure ) {
  13801. return Math.round( parseFloat( measure ) );
  13802. }
  13803. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13804. reliableMarginLeftVal,
  13805. container = document.createElement( "div" ),
  13806. div = document.createElement( "div" );
  13807. // Finish early in limited (non-browser) environments
  13808. if ( !div.style ) {
  13809. return;
  13810. }
  13811. // Support: IE <=9 - 11 only
  13812. // Style of cloned element affects source element cloned (#8908)
  13813. div.style.backgroundClip = "content-box";
  13814. div.cloneNode( true ).style.backgroundClip = "";
  13815. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13816. jQuery.extend( support, {
  13817. boxSizingReliable: function() {
  13818. computeStyleTests();
  13819. return boxSizingReliableVal;
  13820. },
  13821. pixelBoxStyles: function() {
  13822. computeStyleTests();
  13823. return pixelBoxStylesVal;
  13824. },
  13825. pixelPosition: function() {
  13826. computeStyleTests();
  13827. return pixelPositionVal;
  13828. },
  13829. reliableMarginLeft: function() {
  13830. computeStyleTests();
  13831. return reliableMarginLeftVal;
  13832. },
  13833. scrollboxSize: function() {
  13834. computeStyleTests();
  13835. return scrollboxSizeVal;
  13836. }
  13837. } );
  13838. } )();
  13839. function curCSS( elem, name, computed ) {
  13840. var width, minWidth, maxWidth, ret,
  13841. // Support: Firefox 51+
  13842. // Retrieving style before computed somehow
  13843. // fixes an issue with getting wrong values
  13844. // on detached elements
  13845. style = elem.style;
  13846. computed = computed || getStyles( elem );
  13847. // getPropertyValue is needed for:
  13848. // .css('filter') (IE 9 only, #12537)
  13849. // .css('--customProperty) (#3144)
  13850. if ( computed ) {
  13851. ret = computed.getPropertyValue( name ) || computed[ name ];
  13852. if ( ret === "" && !isAttached( elem ) ) {
  13853. ret = jQuery.style( elem, name );
  13854. }
  13855. // A tribute to the "awesome hack by Dean Edwards"
  13856. // Android Browser returns percentage for some values,
  13857. // but width seems to be reliably pixels.
  13858. // This is against the CSSOM draft spec:
  13859. // https://drafts.csswg.org/cssom/#resolved-values
  13860. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13861. // Remember the original values
  13862. width = style.width;
  13863. minWidth = style.minWidth;
  13864. maxWidth = style.maxWidth;
  13865. // Put in the new values to get a computed value out
  13866. style.minWidth = style.maxWidth = style.width = ret;
  13867. ret = computed.width;
  13868. // Revert the changed values
  13869. style.width = width;
  13870. style.minWidth = minWidth;
  13871. style.maxWidth = maxWidth;
  13872. }
  13873. }
  13874. return ret !== undefined ?
  13875. // Support: IE <=9 - 11 only
  13876. // IE returns zIndex value as an integer.
  13877. ret + "" :
  13878. ret;
  13879. }
  13880. function addGetHookIf( conditionFn, hookFn ) {
  13881. // Define the hook, we'll check on the first run if it's really needed.
  13882. return {
  13883. get: function() {
  13884. if ( conditionFn() ) {
  13885. // Hook not needed (or it's not possible to use it due
  13886. // to missing dependency), remove it.
  13887. delete this.get;
  13888. return;
  13889. }
  13890. // Hook needed; redefine it so that the support test is not executed again.
  13891. return ( this.get = hookFn ).apply( this, arguments );
  13892. }
  13893. };
  13894. }
  13895. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13896. emptyStyle = document.createElement( "div" ).style,
  13897. vendorProps = {};
  13898. // Return a vendor-prefixed property or undefined
  13899. function vendorPropName( name ) {
  13900. // Check for vendor prefixed names
  13901. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13902. i = cssPrefixes.length;
  13903. while ( i-- ) {
  13904. name = cssPrefixes[ i ] + capName;
  13905. if ( name in emptyStyle ) {
  13906. return name;
  13907. }
  13908. }
  13909. }
  13910. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13911. function finalPropName( name ) {
  13912. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13913. if ( final ) {
  13914. return final;
  13915. }
  13916. if ( name in emptyStyle ) {
  13917. return name;
  13918. }
  13919. return vendorProps[ name ] = vendorPropName( name ) || name;
  13920. }
  13921. var
  13922. // Swappable if display is none or starts with table
  13923. // except "table", "table-cell", or "table-caption"
  13924. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13925. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13926. rcustomProp = /^--/,
  13927. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13928. cssNormalTransform = {
  13929. letterSpacing: "0",
  13930. fontWeight: "400"
  13931. };
  13932. function setPositiveNumber( elem, value, subtract ) {
  13933. // Any relative (+/-) values have already been
  13934. // normalized at this point
  13935. var matches = rcssNum.exec( value );
  13936. return matches ?
  13937. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13938. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13939. value;
  13940. }
  13941. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13942. var i = dimension === "width" ? 1 : 0,
  13943. extra = 0,
  13944. delta = 0;
  13945. // Adjustment may not be necessary
  13946. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13947. return 0;
  13948. }
  13949. for ( ; i < 4; i += 2 ) {
  13950. // Both box models exclude margin
  13951. if ( box === "margin" ) {
  13952. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13953. }
  13954. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13955. if ( !isBorderBox ) {
  13956. // Add padding
  13957. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13958. // For "border" or "margin", add border
  13959. if ( box !== "padding" ) {
  13960. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13961. // But still keep track of it otherwise
  13962. } else {
  13963. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13964. }
  13965. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13966. // "padding" or "margin"
  13967. } else {
  13968. // For "content", subtract padding
  13969. if ( box === "content" ) {
  13970. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13971. }
  13972. // For "content" or "padding", subtract border
  13973. if ( box !== "margin" ) {
  13974. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13975. }
  13976. }
  13977. }
  13978. // Account for positive content-box scroll gutter when requested by providing computedVal
  13979. if ( !isBorderBox && computedVal >= 0 ) {
  13980. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13981. // Assuming integer scroll gutter, subtract the rest and round down
  13982. delta += Math.max( 0, Math.ceil(
  13983. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13984. computedVal -
  13985. delta -
  13986. extra -
  13987. 0.5
  13988. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13989. // Use an explicit zero to avoid NaN (gh-3964)
  13990. ) ) || 0;
  13991. }
  13992. return delta;
  13993. }
  13994. function getWidthOrHeight( elem, dimension, extra ) {
  13995. // Start with computed style
  13996. var styles = getStyles( elem ),
  13997. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13998. // Fake content-box until we know it's needed to know the true value.
  13999. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14000. isBorderBox = boxSizingNeeded &&
  14001. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14002. valueIsBorderBox = isBorderBox,
  14003. val = curCSS( elem, dimension, styles ),
  14004. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14005. // Support: Firefox <=54
  14006. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14007. if ( rnumnonpx.test( val ) ) {
  14008. if ( !extra ) {
  14009. return val;
  14010. }
  14011. val = "auto";
  14012. }
  14013. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14014. // This happens for inline elements with no explicit setting (gh-3571)
  14015. // Support: Android <=4.1 - 4.3 only
  14016. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14017. // Support: IE 9-11 only
  14018. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14019. // We use getClientRects() to check for hidden/disconnected.
  14020. // In those cases, the computed value can be trusted to be border-box
  14021. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14022. val === "auto" ||
  14023. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14024. elem.getClientRects().length ) {
  14025. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14026. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14027. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14028. // retrieved value as a content box dimension.
  14029. valueIsBorderBox = offsetProp in elem;
  14030. if ( valueIsBorderBox ) {
  14031. val = elem[ offsetProp ];
  14032. }
  14033. }
  14034. // Normalize "" and auto
  14035. val = parseFloat( val ) || 0;
  14036. // Adjust for the element's box model
  14037. return ( val +
  14038. boxModelAdjustment(
  14039. elem,
  14040. dimension,
  14041. extra || ( isBorderBox ? "border" : "content" ),
  14042. valueIsBorderBox,
  14043. styles,
  14044. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14045. val
  14046. )
  14047. ) + "px";
  14048. }
  14049. jQuery.extend( {
  14050. // Add in style property hooks for overriding the default
  14051. // behavior of getting and setting a style property
  14052. cssHooks: {
  14053. opacity: {
  14054. get: function( elem, computed ) {
  14055. if ( computed ) {
  14056. // We should always get a number back from opacity
  14057. var ret = curCSS( elem, "opacity" );
  14058. return ret === "" ? "1" : ret;
  14059. }
  14060. }
  14061. }
  14062. },
  14063. // Don't automatically add "px" to these possibly-unitless properties
  14064. cssNumber: {
  14065. "animationIterationCount": true,
  14066. "columnCount": true,
  14067. "fillOpacity": true,
  14068. "flexGrow": true,
  14069. "flexShrink": true,
  14070. "fontWeight": true,
  14071. "gridArea": true,
  14072. "gridColumn": true,
  14073. "gridColumnEnd": true,
  14074. "gridColumnStart": true,
  14075. "gridRow": true,
  14076. "gridRowEnd": true,
  14077. "gridRowStart": true,
  14078. "lineHeight": true,
  14079. "opacity": true,
  14080. "order": true,
  14081. "orphans": true,
  14082. "widows": true,
  14083. "zIndex": true,
  14084. "zoom": true
  14085. },
  14086. // Add in properties whose names you wish to fix before
  14087. // setting or getting the value
  14088. cssProps: {},
  14089. // Get and set the style property on a DOM Node
  14090. style: function( elem, name, value, extra ) {
  14091. // Don't set styles on text and comment nodes
  14092. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14093. return;
  14094. }
  14095. // Make sure that we're working with the right name
  14096. var ret, type, hooks,
  14097. origName = camelCase( name ),
  14098. isCustomProp = rcustomProp.test( name ),
  14099. style = elem.style;
  14100. // Make sure that we're working with the right name. We don't
  14101. // want to query the value if it is a CSS custom property
  14102. // since they are user-defined.
  14103. if ( !isCustomProp ) {
  14104. name = finalPropName( origName );
  14105. }
  14106. // Gets hook for the prefixed version, then unprefixed version
  14107. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14108. // Check if we're setting a value
  14109. if ( value !== undefined ) {
  14110. type = typeof value;
  14111. // Convert "+=" or "-=" to relative numbers (#7345)
  14112. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14113. value = adjustCSS( elem, name, ret );
  14114. // Fixes bug #9237
  14115. type = "number";
  14116. }
  14117. // Make sure that null and NaN values aren't set (#7116)
  14118. if ( value == null || value !== value ) {
  14119. return;
  14120. }
  14121. // If a number was passed in, add the unit (except for certain CSS properties)
  14122. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14123. // "px" to a few hardcoded values.
  14124. if ( type === "number" && !isCustomProp ) {
  14125. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14126. }
  14127. // background-* props affect original clone's values
  14128. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14129. style[ name ] = "inherit";
  14130. }
  14131. // If a hook was provided, use that value, otherwise just set the specified value
  14132. if ( !hooks || !( "set" in hooks ) ||
  14133. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14134. if ( isCustomProp ) {
  14135. style.setProperty( name, value );
  14136. } else {
  14137. style[ name ] = value;
  14138. }
  14139. }
  14140. } else {
  14141. // If a hook was provided get the non-computed value from there
  14142. if ( hooks && "get" in hooks &&
  14143. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14144. return ret;
  14145. }
  14146. // Otherwise just get the value from the style object
  14147. return style[ name ];
  14148. }
  14149. },
  14150. css: function( elem, name, extra, styles ) {
  14151. var val, num, hooks,
  14152. origName = camelCase( name ),
  14153. isCustomProp = rcustomProp.test( name );
  14154. // Make sure that we're working with the right name. We don't
  14155. // want to modify the value if it is a CSS custom property
  14156. // since they are user-defined.
  14157. if ( !isCustomProp ) {
  14158. name = finalPropName( origName );
  14159. }
  14160. // Try prefixed name followed by the unprefixed name
  14161. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14162. // If a hook was provided get the computed value from there
  14163. if ( hooks && "get" in hooks ) {
  14164. val = hooks.get( elem, true, extra );
  14165. }
  14166. // Otherwise, if a way to get the computed value exists, use that
  14167. if ( val === undefined ) {
  14168. val = curCSS( elem, name, styles );
  14169. }
  14170. // Convert "normal" to computed value
  14171. if ( val === "normal" && name in cssNormalTransform ) {
  14172. val = cssNormalTransform[ name ];
  14173. }
  14174. // Make numeric if forced or a qualifier was provided and val looks numeric
  14175. if ( extra === "" || extra ) {
  14176. num = parseFloat( val );
  14177. return extra === true || isFinite( num ) ? num || 0 : val;
  14178. }
  14179. return val;
  14180. }
  14181. } );
  14182. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14183. jQuery.cssHooks[ dimension ] = {
  14184. get: function( elem, computed, extra ) {
  14185. if ( computed ) {
  14186. // Certain elements can have dimension info if we invisibly show them
  14187. // but it must have a current display style that would benefit
  14188. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14189. // Support: Safari 8+
  14190. // Table columns in Safari have non-zero offsetWidth & zero
  14191. // getBoundingClientRect().width unless display is changed.
  14192. // Support: IE <=11 only
  14193. // Running getBoundingClientRect on a disconnected node
  14194. // in IE throws an error.
  14195. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14196. swap( elem, cssShow, function() {
  14197. return getWidthOrHeight( elem, dimension, extra );
  14198. } ) :
  14199. getWidthOrHeight( elem, dimension, extra );
  14200. }
  14201. },
  14202. set: function( elem, value, extra ) {
  14203. var matches,
  14204. styles = getStyles( elem ),
  14205. // Only read styles.position if the test has a chance to fail
  14206. // to avoid forcing a reflow.
  14207. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14208. styles.position === "absolute",
  14209. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14210. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14211. isBorderBox = boxSizingNeeded &&
  14212. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14213. subtract = extra ?
  14214. boxModelAdjustment(
  14215. elem,
  14216. dimension,
  14217. extra,
  14218. isBorderBox,
  14219. styles
  14220. ) :
  14221. 0;
  14222. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14223. // faking a content-box to get border and padding (gh-3699)
  14224. if ( isBorderBox && scrollboxSizeBuggy ) {
  14225. subtract -= Math.ceil(
  14226. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14227. parseFloat( styles[ dimension ] ) -
  14228. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14229. 0.5
  14230. );
  14231. }
  14232. // Convert to pixels if value adjustment is needed
  14233. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14234. ( matches[ 3 ] || "px" ) !== "px" ) {
  14235. elem.style[ dimension ] = value;
  14236. value = jQuery.css( elem, dimension );
  14237. }
  14238. return setPositiveNumber( elem, value, subtract );
  14239. }
  14240. };
  14241. } );
  14242. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14243. function( elem, computed ) {
  14244. if ( computed ) {
  14245. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14246. elem.getBoundingClientRect().left -
  14247. swap( elem, { marginLeft: 0 }, function() {
  14248. return elem.getBoundingClientRect().left;
  14249. } )
  14250. ) + "px";
  14251. }
  14252. }
  14253. );
  14254. // These hooks are used by animate to expand properties
  14255. jQuery.each( {
  14256. margin: "",
  14257. padding: "",
  14258. border: "Width"
  14259. }, function( prefix, suffix ) {
  14260. jQuery.cssHooks[ prefix + suffix ] = {
  14261. expand: function( value ) {
  14262. var i = 0,
  14263. expanded = {},
  14264. // Assumes a single number if not a string
  14265. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14266. for ( ; i < 4; i++ ) {
  14267. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14268. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14269. }
  14270. return expanded;
  14271. }
  14272. };
  14273. if ( prefix !== "margin" ) {
  14274. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14275. }
  14276. } );
  14277. jQuery.fn.extend( {
  14278. css: function( name, value ) {
  14279. return access( this, function( elem, name, value ) {
  14280. var styles, len,
  14281. map = {},
  14282. i = 0;
  14283. if ( Array.isArray( name ) ) {
  14284. styles = getStyles( elem );
  14285. len = name.length;
  14286. for ( ; i < len; i++ ) {
  14287. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14288. }
  14289. return map;
  14290. }
  14291. return value !== undefined ?
  14292. jQuery.style( elem, name, value ) :
  14293. jQuery.css( elem, name );
  14294. }, name, value, arguments.length > 1 );
  14295. }
  14296. } );
  14297. function Tween( elem, options, prop, end, easing ) {
  14298. return new Tween.prototype.init( elem, options, prop, end, easing );
  14299. }
  14300. jQuery.Tween = Tween;
  14301. Tween.prototype = {
  14302. constructor: Tween,
  14303. init: function( elem, options, prop, end, easing, unit ) {
  14304. this.elem = elem;
  14305. this.prop = prop;
  14306. this.easing = easing || jQuery.easing._default;
  14307. this.options = options;
  14308. this.start = this.now = this.cur();
  14309. this.end = end;
  14310. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14311. },
  14312. cur: function() {
  14313. var hooks = Tween.propHooks[ this.prop ];
  14314. return hooks && hooks.get ?
  14315. hooks.get( this ) :
  14316. Tween.propHooks._default.get( this );
  14317. },
  14318. run: function( percent ) {
  14319. var eased,
  14320. hooks = Tween.propHooks[ this.prop ];
  14321. if ( this.options.duration ) {
  14322. this.pos = eased = jQuery.easing[ this.easing ](
  14323. percent, this.options.duration * percent, 0, 1, this.options.duration
  14324. );
  14325. } else {
  14326. this.pos = eased = percent;
  14327. }
  14328. this.now = ( this.end - this.start ) * eased + this.start;
  14329. if ( this.options.step ) {
  14330. this.options.step.call( this.elem, this.now, this );
  14331. }
  14332. if ( hooks && hooks.set ) {
  14333. hooks.set( this );
  14334. } else {
  14335. Tween.propHooks._default.set( this );
  14336. }
  14337. return this;
  14338. }
  14339. };
  14340. Tween.prototype.init.prototype = Tween.prototype;
  14341. Tween.propHooks = {
  14342. _default: {
  14343. get: function( tween ) {
  14344. var result;
  14345. // Use a property on the element directly when it is not a DOM element,
  14346. // or when there is no matching style property that exists.
  14347. if ( tween.elem.nodeType !== 1 ||
  14348. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14349. return tween.elem[ tween.prop ];
  14350. }
  14351. // Passing an empty string as a 3rd parameter to .css will automatically
  14352. // attempt a parseFloat and fallback to a string if the parse fails.
  14353. // Simple values such as "10px" are parsed to Float;
  14354. // complex values such as "rotate(1rad)" are returned as-is.
  14355. result = jQuery.css( tween.elem, tween.prop, "" );
  14356. // Empty strings, null, undefined and "auto" are converted to 0.
  14357. return !result || result === "auto" ? 0 : result;
  14358. },
  14359. set: function( tween ) {
  14360. // Use step hook for back compat.
  14361. // Use cssHook if its there.
  14362. // Use .style if available and use plain properties where available.
  14363. if ( jQuery.fx.step[ tween.prop ] ) {
  14364. jQuery.fx.step[ tween.prop ]( tween );
  14365. } else if ( tween.elem.nodeType === 1 && (
  14366. jQuery.cssHooks[ tween.prop ] ||
  14367. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14368. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14369. } else {
  14370. tween.elem[ tween.prop ] = tween.now;
  14371. }
  14372. }
  14373. }
  14374. };
  14375. // Support: IE <=9 only
  14376. // Panic based approach to setting things on disconnected nodes
  14377. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14378. set: function( tween ) {
  14379. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14380. tween.elem[ tween.prop ] = tween.now;
  14381. }
  14382. }
  14383. };
  14384. jQuery.easing = {
  14385. linear: function( p ) {
  14386. return p;
  14387. },
  14388. swing: function( p ) {
  14389. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14390. },
  14391. _default: "swing"
  14392. };
  14393. jQuery.fx = Tween.prototype.init;
  14394. // Back compat <1.8 extension point
  14395. jQuery.fx.step = {};
  14396. var
  14397. fxNow, inProgress,
  14398. rfxtypes = /^(?:toggle|show|hide)$/,
  14399. rrun = /queueHooks$/;
  14400. function schedule() {
  14401. if ( inProgress ) {
  14402. if ( document.hidden === false && window.requestAnimationFrame ) {
  14403. window.requestAnimationFrame( schedule );
  14404. } else {
  14405. window.setTimeout( schedule, jQuery.fx.interval );
  14406. }
  14407. jQuery.fx.tick();
  14408. }
  14409. }
  14410. // Animations created synchronously will run synchronously
  14411. function createFxNow() {
  14412. window.setTimeout( function() {
  14413. fxNow = undefined;
  14414. } );
  14415. return ( fxNow = Date.now() );
  14416. }
  14417. // Generate parameters to create a standard animation
  14418. function genFx( type, includeWidth ) {
  14419. var which,
  14420. i = 0,
  14421. attrs = { height: type };
  14422. // If we include width, step value is 1 to do all cssExpand values,
  14423. // otherwise step value is 2 to skip over Left and Right
  14424. includeWidth = includeWidth ? 1 : 0;
  14425. for ( ; i < 4; i += 2 - includeWidth ) {
  14426. which = cssExpand[ i ];
  14427. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14428. }
  14429. if ( includeWidth ) {
  14430. attrs.opacity = attrs.width = type;
  14431. }
  14432. return attrs;
  14433. }
  14434. function createTween( value, prop, animation ) {
  14435. var tween,
  14436. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14437. index = 0,
  14438. length = collection.length;
  14439. for ( ; index < length; index++ ) {
  14440. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14441. // We're done with this property
  14442. return tween;
  14443. }
  14444. }
  14445. }
  14446. function defaultPrefilter( elem, props, opts ) {
  14447. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14448. isBox = "width" in props || "height" in props,
  14449. anim = this,
  14450. orig = {},
  14451. style = elem.style,
  14452. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14453. dataShow = dataPriv.get( elem, "fxshow" );
  14454. // Queue-skipping animations hijack the fx hooks
  14455. if ( !opts.queue ) {
  14456. hooks = jQuery._queueHooks( elem, "fx" );
  14457. if ( hooks.unqueued == null ) {
  14458. hooks.unqueued = 0;
  14459. oldfire = hooks.empty.fire;
  14460. hooks.empty.fire = function() {
  14461. if ( !hooks.unqueued ) {
  14462. oldfire();
  14463. }
  14464. };
  14465. }
  14466. hooks.unqueued++;
  14467. anim.always( function() {
  14468. // Ensure the complete handler is called before this completes
  14469. anim.always( function() {
  14470. hooks.unqueued--;
  14471. if ( !jQuery.queue( elem, "fx" ).length ) {
  14472. hooks.empty.fire();
  14473. }
  14474. } );
  14475. } );
  14476. }
  14477. // Detect show/hide animations
  14478. for ( prop in props ) {
  14479. value = props[ prop ];
  14480. if ( rfxtypes.test( value ) ) {
  14481. delete props[ prop ];
  14482. toggle = toggle || value === "toggle";
  14483. if ( value === ( hidden ? "hide" : "show" ) ) {
  14484. // Pretend to be hidden if this is a "show" and
  14485. // there is still data from a stopped show/hide
  14486. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14487. hidden = true;
  14488. // Ignore all other no-op show/hide data
  14489. } else {
  14490. continue;
  14491. }
  14492. }
  14493. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14494. }
  14495. }
  14496. // Bail out if this is a no-op like .hide().hide()
  14497. propTween = !jQuery.isEmptyObject( props );
  14498. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14499. return;
  14500. }
  14501. // Restrict "overflow" and "display" styles during box animations
  14502. if ( isBox && elem.nodeType === 1 ) {
  14503. // Support: IE <=9 - 11, Edge 12 - 15
  14504. // Record all 3 overflow attributes because IE does not infer the shorthand
  14505. // from identically-valued overflowX and overflowY and Edge just mirrors
  14506. // the overflowX value there.
  14507. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14508. // Identify a display type, preferring old show/hide data over the CSS cascade
  14509. restoreDisplay = dataShow && dataShow.display;
  14510. if ( restoreDisplay == null ) {
  14511. restoreDisplay = dataPriv.get( elem, "display" );
  14512. }
  14513. display = jQuery.css( elem, "display" );
  14514. if ( display === "none" ) {
  14515. if ( restoreDisplay ) {
  14516. display = restoreDisplay;
  14517. } else {
  14518. // Get nonempty value(s) by temporarily forcing visibility
  14519. showHide( [ elem ], true );
  14520. restoreDisplay = elem.style.display || restoreDisplay;
  14521. display = jQuery.css( elem, "display" );
  14522. showHide( [ elem ] );
  14523. }
  14524. }
  14525. // Animate inline elements as inline-block
  14526. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14527. if ( jQuery.css( elem, "float" ) === "none" ) {
  14528. // Restore the original display value at the end of pure show/hide animations
  14529. if ( !propTween ) {
  14530. anim.done( function() {
  14531. style.display = restoreDisplay;
  14532. } );
  14533. if ( restoreDisplay == null ) {
  14534. display = style.display;
  14535. restoreDisplay = display === "none" ? "" : display;
  14536. }
  14537. }
  14538. style.display = "inline-block";
  14539. }
  14540. }
  14541. }
  14542. if ( opts.overflow ) {
  14543. style.overflow = "hidden";
  14544. anim.always( function() {
  14545. style.overflow = opts.overflow[ 0 ];
  14546. style.overflowX = opts.overflow[ 1 ];
  14547. style.overflowY = opts.overflow[ 2 ];
  14548. } );
  14549. }
  14550. // Implement show/hide animations
  14551. propTween = false;
  14552. for ( prop in orig ) {
  14553. // General show/hide setup for this element animation
  14554. if ( !propTween ) {
  14555. if ( dataShow ) {
  14556. if ( "hidden" in dataShow ) {
  14557. hidden = dataShow.hidden;
  14558. }
  14559. } else {
  14560. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14561. }
  14562. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14563. if ( toggle ) {
  14564. dataShow.hidden = !hidden;
  14565. }
  14566. // Show elements before animating them
  14567. if ( hidden ) {
  14568. showHide( [ elem ], true );
  14569. }
  14570. /* eslint-disable no-loop-func */
  14571. anim.done( function() {
  14572. /* eslint-enable no-loop-func */
  14573. // The final step of a "hide" animation is actually hiding the element
  14574. if ( !hidden ) {
  14575. showHide( [ elem ] );
  14576. }
  14577. dataPriv.remove( elem, "fxshow" );
  14578. for ( prop in orig ) {
  14579. jQuery.style( elem, prop, orig[ prop ] );
  14580. }
  14581. } );
  14582. }
  14583. // Per-property setup
  14584. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14585. if ( !( prop in dataShow ) ) {
  14586. dataShow[ prop ] = propTween.start;
  14587. if ( hidden ) {
  14588. propTween.end = propTween.start;
  14589. propTween.start = 0;
  14590. }
  14591. }
  14592. }
  14593. }
  14594. function propFilter( props, specialEasing ) {
  14595. var index, name, easing, value, hooks;
  14596. // camelCase, specialEasing and expand cssHook pass
  14597. for ( index in props ) {
  14598. name = camelCase( index );
  14599. easing = specialEasing[ name ];
  14600. value = props[ index ];
  14601. if ( Array.isArray( value ) ) {
  14602. easing = value[ 1 ];
  14603. value = props[ index ] = value[ 0 ];
  14604. }
  14605. if ( index !== name ) {
  14606. props[ name ] = value;
  14607. delete props[ index ];
  14608. }
  14609. hooks = jQuery.cssHooks[ name ];
  14610. if ( hooks && "expand" in hooks ) {
  14611. value = hooks.expand( value );
  14612. delete props[ name ];
  14613. // Not quite $.extend, this won't overwrite existing keys.
  14614. // Reusing 'index' because we have the correct "name"
  14615. for ( index in value ) {
  14616. if ( !( index in props ) ) {
  14617. props[ index ] = value[ index ];
  14618. specialEasing[ index ] = easing;
  14619. }
  14620. }
  14621. } else {
  14622. specialEasing[ name ] = easing;
  14623. }
  14624. }
  14625. }
  14626. function Animation( elem, properties, options ) {
  14627. var result,
  14628. stopped,
  14629. index = 0,
  14630. length = Animation.prefilters.length,
  14631. deferred = jQuery.Deferred().always( function() {
  14632. // Don't match elem in the :animated selector
  14633. delete tick.elem;
  14634. } ),
  14635. tick = function() {
  14636. if ( stopped ) {
  14637. return false;
  14638. }
  14639. var currentTime = fxNow || createFxNow(),
  14640. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14641. // Support: Android 2.3 only
  14642. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14643. temp = remaining / animation.duration || 0,
  14644. percent = 1 - temp,
  14645. index = 0,
  14646. length = animation.tweens.length;
  14647. for ( ; index < length; index++ ) {
  14648. animation.tweens[ index ].run( percent );
  14649. }
  14650. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14651. // If there's more to do, yield
  14652. if ( percent < 1 && length ) {
  14653. return remaining;
  14654. }
  14655. // If this was an empty animation, synthesize a final progress notification
  14656. if ( !length ) {
  14657. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14658. }
  14659. // Resolve the animation and report its conclusion
  14660. deferred.resolveWith( elem, [ animation ] );
  14661. return false;
  14662. },
  14663. animation = deferred.promise( {
  14664. elem: elem,
  14665. props: jQuery.extend( {}, properties ),
  14666. opts: jQuery.extend( true, {
  14667. specialEasing: {},
  14668. easing: jQuery.easing._default
  14669. }, options ),
  14670. originalProperties: properties,
  14671. originalOptions: options,
  14672. startTime: fxNow || createFxNow(),
  14673. duration: options.duration,
  14674. tweens: [],
  14675. createTween: function( prop, end ) {
  14676. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14677. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14678. animation.tweens.push( tween );
  14679. return tween;
  14680. },
  14681. stop: function( gotoEnd ) {
  14682. var index = 0,
  14683. // If we are going to the end, we want to run all the tweens
  14684. // otherwise we skip this part
  14685. length = gotoEnd ? animation.tweens.length : 0;
  14686. if ( stopped ) {
  14687. return this;
  14688. }
  14689. stopped = true;
  14690. for ( ; index < length; index++ ) {
  14691. animation.tweens[ index ].run( 1 );
  14692. }
  14693. // Resolve when we played the last frame; otherwise, reject
  14694. if ( gotoEnd ) {
  14695. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14696. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14697. } else {
  14698. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14699. }
  14700. return this;
  14701. }
  14702. } ),
  14703. props = animation.props;
  14704. propFilter( props, animation.opts.specialEasing );
  14705. for ( ; index < length; index++ ) {
  14706. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14707. if ( result ) {
  14708. if ( isFunction( result.stop ) ) {
  14709. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14710. result.stop.bind( result );
  14711. }
  14712. return result;
  14713. }
  14714. }
  14715. jQuery.map( props, createTween, animation );
  14716. if ( isFunction( animation.opts.start ) ) {
  14717. animation.opts.start.call( elem, animation );
  14718. }
  14719. // Attach callbacks from options
  14720. animation
  14721. .progress( animation.opts.progress )
  14722. .done( animation.opts.done, animation.opts.complete )
  14723. .fail( animation.opts.fail )
  14724. .always( animation.opts.always );
  14725. jQuery.fx.timer(
  14726. jQuery.extend( tick, {
  14727. elem: elem,
  14728. anim: animation,
  14729. queue: animation.opts.queue
  14730. } )
  14731. );
  14732. return animation;
  14733. }
  14734. jQuery.Animation = jQuery.extend( Animation, {
  14735. tweeners: {
  14736. "*": [ function( prop, value ) {
  14737. var tween = this.createTween( prop, value );
  14738. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14739. return tween;
  14740. } ]
  14741. },
  14742. tweener: function( props, callback ) {
  14743. if ( isFunction( props ) ) {
  14744. callback = props;
  14745. props = [ "*" ];
  14746. } else {
  14747. props = props.match( rnothtmlwhite );
  14748. }
  14749. var prop,
  14750. index = 0,
  14751. length = props.length;
  14752. for ( ; index < length; index++ ) {
  14753. prop = props[ index ];
  14754. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14755. Animation.tweeners[ prop ].unshift( callback );
  14756. }
  14757. },
  14758. prefilters: [ defaultPrefilter ],
  14759. prefilter: function( callback, prepend ) {
  14760. if ( prepend ) {
  14761. Animation.prefilters.unshift( callback );
  14762. } else {
  14763. Animation.prefilters.push( callback );
  14764. }
  14765. }
  14766. } );
  14767. jQuery.speed = function( speed, easing, fn ) {
  14768. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14769. complete: fn || !fn && easing ||
  14770. isFunction( speed ) && speed,
  14771. duration: speed,
  14772. easing: fn && easing || easing && !isFunction( easing ) && easing
  14773. };
  14774. // Go to the end state if fx are off
  14775. if ( jQuery.fx.off ) {
  14776. opt.duration = 0;
  14777. } else {
  14778. if ( typeof opt.duration !== "number" ) {
  14779. if ( opt.duration in jQuery.fx.speeds ) {
  14780. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14781. } else {
  14782. opt.duration = jQuery.fx.speeds._default;
  14783. }
  14784. }
  14785. }
  14786. // Normalize opt.queue - true/undefined/null -> "fx"
  14787. if ( opt.queue == null || opt.queue === true ) {
  14788. opt.queue = "fx";
  14789. }
  14790. // Queueing
  14791. opt.old = opt.complete;
  14792. opt.complete = function() {
  14793. if ( isFunction( opt.old ) ) {
  14794. opt.old.call( this );
  14795. }
  14796. if ( opt.queue ) {
  14797. jQuery.dequeue( this, opt.queue );
  14798. }
  14799. };
  14800. return opt;
  14801. };
  14802. jQuery.fn.extend( {
  14803. fadeTo: function( speed, to, easing, callback ) {
  14804. // Show any hidden elements after setting opacity to 0
  14805. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14806. // Animate to the value specified
  14807. .end().animate( { opacity: to }, speed, easing, callback );
  14808. },
  14809. animate: function( prop, speed, easing, callback ) {
  14810. var empty = jQuery.isEmptyObject( prop ),
  14811. optall = jQuery.speed( speed, easing, callback ),
  14812. doAnimation = function() {
  14813. // Operate on a copy of prop so per-property easing won't be lost
  14814. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14815. // Empty animations, or finishing resolves immediately
  14816. if ( empty || dataPriv.get( this, "finish" ) ) {
  14817. anim.stop( true );
  14818. }
  14819. };
  14820. doAnimation.finish = doAnimation;
  14821. return empty || optall.queue === false ?
  14822. this.each( doAnimation ) :
  14823. this.queue( optall.queue, doAnimation );
  14824. },
  14825. stop: function( type, clearQueue, gotoEnd ) {
  14826. var stopQueue = function( hooks ) {
  14827. var stop = hooks.stop;
  14828. delete hooks.stop;
  14829. stop( gotoEnd );
  14830. };
  14831. if ( typeof type !== "string" ) {
  14832. gotoEnd = clearQueue;
  14833. clearQueue = type;
  14834. type = undefined;
  14835. }
  14836. if ( clearQueue && type !== false ) {
  14837. this.queue( type || "fx", [] );
  14838. }
  14839. return this.each( function() {
  14840. var dequeue = true,
  14841. index = type != null && type + "queueHooks",
  14842. timers = jQuery.timers,
  14843. data = dataPriv.get( this );
  14844. if ( index ) {
  14845. if ( data[ index ] && data[ index ].stop ) {
  14846. stopQueue( data[ index ] );
  14847. }
  14848. } else {
  14849. for ( index in data ) {
  14850. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14851. stopQueue( data[ index ] );
  14852. }
  14853. }
  14854. }
  14855. for ( index = timers.length; index--; ) {
  14856. if ( timers[ index ].elem === this &&
  14857. ( type == null || timers[ index ].queue === type ) ) {
  14858. timers[ index ].anim.stop( gotoEnd );
  14859. dequeue = false;
  14860. timers.splice( index, 1 );
  14861. }
  14862. }
  14863. // Start the next in the queue if the last step wasn't forced.
  14864. // Timers currently will call their complete callbacks, which
  14865. // will dequeue but only if they were gotoEnd.
  14866. if ( dequeue || !gotoEnd ) {
  14867. jQuery.dequeue( this, type );
  14868. }
  14869. } );
  14870. },
  14871. finish: function( type ) {
  14872. if ( type !== false ) {
  14873. type = type || "fx";
  14874. }
  14875. return this.each( function() {
  14876. var index,
  14877. data = dataPriv.get( this ),
  14878. queue = data[ type + "queue" ],
  14879. hooks = data[ type + "queueHooks" ],
  14880. timers = jQuery.timers,
  14881. length = queue ? queue.length : 0;
  14882. // Enable finishing flag on private data
  14883. data.finish = true;
  14884. // Empty the queue first
  14885. jQuery.queue( this, type, [] );
  14886. if ( hooks && hooks.stop ) {
  14887. hooks.stop.call( this, true );
  14888. }
  14889. // Look for any active animations, and finish them
  14890. for ( index = timers.length; index--; ) {
  14891. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14892. timers[ index ].anim.stop( true );
  14893. timers.splice( index, 1 );
  14894. }
  14895. }
  14896. // Look for any animations in the old queue and finish them
  14897. for ( index = 0; index < length; index++ ) {
  14898. if ( queue[ index ] && queue[ index ].finish ) {
  14899. queue[ index ].finish.call( this );
  14900. }
  14901. }
  14902. // Turn off finishing flag
  14903. delete data.finish;
  14904. } );
  14905. }
  14906. } );
  14907. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14908. var cssFn = jQuery.fn[ name ];
  14909. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14910. return speed == null || typeof speed === "boolean" ?
  14911. cssFn.apply( this, arguments ) :
  14912. this.animate( genFx( name, true ), speed, easing, callback );
  14913. };
  14914. } );
  14915. // Generate shortcuts for custom animations
  14916. jQuery.each( {
  14917. slideDown: genFx( "show" ),
  14918. slideUp: genFx( "hide" ),
  14919. slideToggle: genFx( "toggle" ),
  14920. fadeIn: { opacity: "show" },
  14921. fadeOut: { opacity: "hide" },
  14922. fadeToggle: { opacity: "toggle" }
  14923. }, function( name, props ) {
  14924. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14925. return this.animate( props, speed, easing, callback );
  14926. };
  14927. } );
  14928. jQuery.timers = [];
  14929. jQuery.fx.tick = function() {
  14930. var timer,
  14931. i = 0,
  14932. timers = jQuery.timers;
  14933. fxNow = Date.now();
  14934. for ( ; i < timers.length; i++ ) {
  14935. timer = timers[ i ];
  14936. // Run the timer and safely remove it when done (allowing for external removal)
  14937. if ( !timer() && timers[ i ] === timer ) {
  14938. timers.splice( i--, 1 );
  14939. }
  14940. }
  14941. if ( !timers.length ) {
  14942. jQuery.fx.stop();
  14943. }
  14944. fxNow = undefined;
  14945. };
  14946. jQuery.fx.timer = function( timer ) {
  14947. jQuery.timers.push( timer );
  14948. jQuery.fx.start();
  14949. };
  14950. jQuery.fx.interval = 13;
  14951. jQuery.fx.start = function() {
  14952. if ( inProgress ) {
  14953. return;
  14954. }
  14955. inProgress = true;
  14956. schedule();
  14957. };
  14958. jQuery.fx.stop = function() {
  14959. inProgress = null;
  14960. };
  14961. jQuery.fx.speeds = {
  14962. slow: 600,
  14963. fast: 200,
  14964. // Default speed
  14965. _default: 400
  14966. };
  14967. // Based off of the plugin by Clint Helfers, with permission.
  14968. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14969. jQuery.fn.delay = function( time, type ) {
  14970. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14971. type = type || "fx";
  14972. return this.queue( type, function( next, hooks ) {
  14973. var timeout = window.setTimeout( next, time );
  14974. hooks.stop = function() {
  14975. window.clearTimeout( timeout );
  14976. };
  14977. } );
  14978. };
  14979. ( function() {
  14980. var input = document.createElement( "input" ),
  14981. select = document.createElement( "select" ),
  14982. opt = select.appendChild( document.createElement( "option" ) );
  14983. input.type = "checkbox";
  14984. // Support: Android <=4.3 only
  14985. // Default value for a checkbox should be "on"
  14986. support.checkOn = input.value !== "";
  14987. // Support: IE <=11 only
  14988. // Must access selectedIndex to make default options select
  14989. support.optSelected = opt.selected;
  14990. // Support: IE <=11 only
  14991. // An input loses its value after becoming a radio
  14992. input = document.createElement( "input" );
  14993. input.value = "t";
  14994. input.type = "radio";
  14995. support.radioValue = input.value === "t";
  14996. } )();
  14997. var boolHook,
  14998. attrHandle = jQuery.expr.attrHandle;
  14999. jQuery.fn.extend( {
  15000. attr: function( name, value ) {
  15001. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15002. },
  15003. removeAttr: function( name ) {
  15004. return this.each( function() {
  15005. jQuery.removeAttr( this, name );
  15006. } );
  15007. }
  15008. } );
  15009. jQuery.extend( {
  15010. attr: function( elem, name, value ) {
  15011. var ret, hooks,
  15012. nType = elem.nodeType;
  15013. // Don't get/set attributes on text, comment and attribute nodes
  15014. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15015. return;
  15016. }
  15017. // Fallback to prop when attributes are not supported
  15018. if ( typeof elem.getAttribute === "undefined" ) {
  15019. return jQuery.prop( elem, name, value );
  15020. }
  15021. // Attribute hooks are determined by the lowercase version
  15022. // Grab necessary hook if one is defined
  15023. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15024. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15025. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15026. }
  15027. if ( value !== undefined ) {
  15028. if ( value === null ) {
  15029. jQuery.removeAttr( elem, name );
  15030. return;
  15031. }
  15032. if ( hooks && "set" in hooks &&
  15033. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15034. return ret;
  15035. }
  15036. elem.setAttribute( name, value + "" );
  15037. return value;
  15038. }
  15039. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15040. return ret;
  15041. }
  15042. ret = jQuery.find.attr( elem, name );
  15043. // Non-existent attributes return null, we normalize to undefined
  15044. return ret == null ? undefined : ret;
  15045. },
  15046. attrHooks: {
  15047. type: {
  15048. set: function( elem, value ) {
  15049. if ( !support.radioValue && value === "radio" &&
  15050. nodeName( elem, "input" ) ) {
  15051. var val = elem.value;
  15052. elem.setAttribute( "type", value );
  15053. if ( val ) {
  15054. elem.value = val;
  15055. }
  15056. return value;
  15057. }
  15058. }
  15059. }
  15060. },
  15061. removeAttr: function( elem, value ) {
  15062. var name,
  15063. i = 0,
  15064. // Attribute names can contain non-HTML whitespace characters
  15065. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15066. attrNames = value && value.match( rnothtmlwhite );
  15067. if ( attrNames && elem.nodeType === 1 ) {
  15068. while ( ( name = attrNames[ i++ ] ) ) {
  15069. elem.removeAttribute( name );
  15070. }
  15071. }
  15072. }
  15073. } );
  15074. // Hooks for boolean attributes
  15075. boolHook = {
  15076. set: function( elem, value, name ) {
  15077. if ( value === false ) {
  15078. // Remove boolean attributes when set to false
  15079. jQuery.removeAttr( elem, name );
  15080. } else {
  15081. elem.setAttribute( name, name );
  15082. }
  15083. return name;
  15084. }
  15085. };
  15086. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15087. var getter = attrHandle[ name ] || jQuery.find.attr;
  15088. attrHandle[ name ] = function( elem, name, isXML ) {
  15089. var ret, handle,
  15090. lowercaseName = name.toLowerCase();
  15091. if ( !isXML ) {
  15092. // Avoid an infinite loop by temporarily removing this function from the getter
  15093. handle = attrHandle[ lowercaseName ];
  15094. attrHandle[ lowercaseName ] = ret;
  15095. ret = getter( elem, name, isXML ) != null ?
  15096. lowercaseName :
  15097. null;
  15098. attrHandle[ lowercaseName ] = handle;
  15099. }
  15100. return ret;
  15101. };
  15102. } );
  15103. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15104. rclickable = /^(?:a|area)$/i;
  15105. jQuery.fn.extend( {
  15106. prop: function( name, value ) {
  15107. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15108. },
  15109. removeProp: function( name ) {
  15110. return this.each( function() {
  15111. delete this[ jQuery.propFix[ name ] || name ];
  15112. } );
  15113. }
  15114. } );
  15115. jQuery.extend( {
  15116. prop: function( elem, name, value ) {
  15117. var ret, hooks,
  15118. nType = elem.nodeType;
  15119. // Don't get/set properties on text, comment and attribute nodes
  15120. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15121. return;
  15122. }
  15123. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15124. // Fix name and attach hooks
  15125. name = jQuery.propFix[ name ] || name;
  15126. hooks = jQuery.propHooks[ name ];
  15127. }
  15128. if ( value !== undefined ) {
  15129. if ( hooks && "set" in hooks &&
  15130. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15131. return ret;
  15132. }
  15133. return ( elem[ name ] = value );
  15134. }
  15135. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15136. return ret;
  15137. }
  15138. return elem[ name ];
  15139. },
  15140. propHooks: {
  15141. tabIndex: {
  15142. get: function( elem ) {
  15143. // Support: IE <=9 - 11 only
  15144. // elem.tabIndex doesn't always return the
  15145. // correct value when it hasn't been explicitly set
  15146. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15147. // Use proper attribute retrieval(#12072)
  15148. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15149. if ( tabindex ) {
  15150. return parseInt( tabindex, 10 );
  15151. }
  15152. if (
  15153. rfocusable.test( elem.nodeName ) ||
  15154. rclickable.test( elem.nodeName ) &&
  15155. elem.href
  15156. ) {
  15157. return 0;
  15158. }
  15159. return -1;
  15160. }
  15161. }
  15162. },
  15163. propFix: {
  15164. "for": "htmlFor",
  15165. "class": "className"
  15166. }
  15167. } );
  15168. // Support: IE <=11 only
  15169. // Accessing the selectedIndex property
  15170. // forces the browser to respect setting selected
  15171. // on the option
  15172. // The getter ensures a default option is selected
  15173. // when in an optgroup
  15174. // eslint rule "no-unused-expressions" is disabled for this code
  15175. // since it considers such accessions noop
  15176. if ( !support.optSelected ) {
  15177. jQuery.propHooks.selected = {
  15178. get: function( elem ) {
  15179. /* eslint no-unused-expressions: "off" */
  15180. var parent = elem.parentNode;
  15181. if ( parent && parent.parentNode ) {
  15182. parent.parentNode.selectedIndex;
  15183. }
  15184. return null;
  15185. },
  15186. set: function( elem ) {
  15187. /* eslint no-unused-expressions: "off" */
  15188. var parent = elem.parentNode;
  15189. if ( parent ) {
  15190. parent.selectedIndex;
  15191. if ( parent.parentNode ) {
  15192. parent.parentNode.selectedIndex;
  15193. }
  15194. }
  15195. }
  15196. };
  15197. }
  15198. jQuery.each( [
  15199. "tabIndex",
  15200. "readOnly",
  15201. "maxLength",
  15202. "cellSpacing",
  15203. "cellPadding",
  15204. "rowSpan",
  15205. "colSpan",
  15206. "useMap",
  15207. "frameBorder",
  15208. "contentEditable"
  15209. ], function() {
  15210. jQuery.propFix[ this.toLowerCase() ] = this;
  15211. } );
  15212. // Strip and collapse whitespace according to HTML spec
  15213. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15214. function stripAndCollapse( value ) {
  15215. var tokens = value.match( rnothtmlwhite ) || [];
  15216. return tokens.join( " " );
  15217. }
  15218. function getClass( elem ) {
  15219. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15220. }
  15221. function classesToArray( value ) {
  15222. if ( Array.isArray( value ) ) {
  15223. return value;
  15224. }
  15225. if ( typeof value === "string" ) {
  15226. return value.match( rnothtmlwhite ) || [];
  15227. }
  15228. return [];
  15229. }
  15230. jQuery.fn.extend( {
  15231. addClass: function( value ) {
  15232. var classes, elem, cur, curValue, clazz, j, finalValue,
  15233. i = 0;
  15234. if ( isFunction( value ) ) {
  15235. return this.each( function( j ) {
  15236. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15237. } );
  15238. }
  15239. classes = classesToArray( value );
  15240. if ( classes.length ) {
  15241. while ( ( elem = this[ i++ ] ) ) {
  15242. curValue = getClass( elem );
  15243. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15244. if ( cur ) {
  15245. j = 0;
  15246. while ( ( clazz = classes[ j++ ] ) ) {
  15247. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15248. cur += clazz + " ";
  15249. }
  15250. }
  15251. // Only assign if different to avoid unneeded rendering.
  15252. finalValue = stripAndCollapse( cur );
  15253. if ( curValue !== finalValue ) {
  15254. elem.setAttribute( "class", finalValue );
  15255. }
  15256. }
  15257. }
  15258. }
  15259. return this;
  15260. },
  15261. removeClass: function( value ) {
  15262. var classes, elem, cur, curValue, clazz, j, finalValue,
  15263. i = 0;
  15264. if ( isFunction( value ) ) {
  15265. return this.each( function( j ) {
  15266. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15267. } );
  15268. }
  15269. if ( !arguments.length ) {
  15270. return this.attr( "class", "" );
  15271. }
  15272. classes = classesToArray( value );
  15273. if ( classes.length ) {
  15274. while ( ( elem = this[ i++ ] ) ) {
  15275. curValue = getClass( elem );
  15276. // This expression is here for better compressibility (see addClass)
  15277. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15278. if ( cur ) {
  15279. j = 0;
  15280. while ( ( clazz = classes[ j++ ] ) ) {
  15281. // Remove *all* instances
  15282. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15283. cur = cur.replace( " " + clazz + " ", " " );
  15284. }
  15285. }
  15286. // Only assign if different to avoid unneeded rendering.
  15287. finalValue = stripAndCollapse( cur );
  15288. if ( curValue !== finalValue ) {
  15289. elem.setAttribute( "class", finalValue );
  15290. }
  15291. }
  15292. }
  15293. }
  15294. return this;
  15295. },
  15296. toggleClass: function( value, stateVal ) {
  15297. var type = typeof value,
  15298. isValidValue = type === "string" || Array.isArray( value );
  15299. if ( typeof stateVal === "boolean" && isValidValue ) {
  15300. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15301. }
  15302. if ( isFunction( value ) ) {
  15303. return this.each( function( i ) {
  15304. jQuery( this ).toggleClass(
  15305. value.call( this, i, getClass( this ), stateVal ),
  15306. stateVal
  15307. );
  15308. } );
  15309. }
  15310. return this.each( function() {
  15311. var className, i, self, classNames;
  15312. if ( isValidValue ) {
  15313. // Toggle individual class names
  15314. i = 0;
  15315. self = jQuery( this );
  15316. classNames = classesToArray( value );
  15317. while ( ( className = classNames[ i++ ] ) ) {
  15318. // Check each className given, space separated list
  15319. if ( self.hasClass( className ) ) {
  15320. self.removeClass( className );
  15321. } else {
  15322. self.addClass( className );
  15323. }
  15324. }
  15325. // Toggle whole class name
  15326. } else if ( value === undefined || type === "boolean" ) {
  15327. className = getClass( this );
  15328. if ( className ) {
  15329. // Store className if set
  15330. dataPriv.set( this, "__className__", className );
  15331. }
  15332. // If the element has a class name or if we're passed `false`,
  15333. // then remove the whole classname (if there was one, the above saved it).
  15334. // Otherwise bring back whatever was previously saved (if anything),
  15335. // falling back to the empty string if nothing was stored.
  15336. if ( this.setAttribute ) {
  15337. this.setAttribute( "class",
  15338. className || value === false ?
  15339. "" :
  15340. dataPriv.get( this, "__className__" ) || ""
  15341. );
  15342. }
  15343. }
  15344. } );
  15345. },
  15346. hasClass: function( selector ) {
  15347. var className, elem,
  15348. i = 0;
  15349. className = " " + selector + " ";
  15350. while ( ( elem = this[ i++ ] ) ) {
  15351. if ( elem.nodeType === 1 &&
  15352. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15353. return true;
  15354. }
  15355. }
  15356. return false;
  15357. }
  15358. } );
  15359. var rreturn = /\r/g;
  15360. jQuery.fn.extend( {
  15361. val: function( value ) {
  15362. var hooks, ret, valueIsFunction,
  15363. elem = this[ 0 ];
  15364. if ( !arguments.length ) {
  15365. if ( elem ) {
  15366. hooks = jQuery.valHooks[ elem.type ] ||
  15367. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15368. if ( hooks &&
  15369. "get" in hooks &&
  15370. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15371. ) {
  15372. return ret;
  15373. }
  15374. ret = elem.value;
  15375. // Handle most common string cases
  15376. if ( typeof ret === "string" ) {
  15377. return ret.replace( rreturn, "" );
  15378. }
  15379. // Handle cases where value is null/undef or number
  15380. return ret == null ? "" : ret;
  15381. }
  15382. return;
  15383. }
  15384. valueIsFunction = isFunction( value );
  15385. return this.each( function( i ) {
  15386. var val;
  15387. if ( this.nodeType !== 1 ) {
  15388. return;
  15389. }
  15390. if ( valueIsFunction ) {
  15391. val = value.call( this, i, jQuery( this ).val() );
  15392. } else {
  15393. val = value;
  15394. }
  15395. // Treat null/undefined as ""; convert numbers to string
  15396. if ( val == null ) {
  15397. val = "";
  15398. } else if ( typeof val === "number" ) {
  15399. val += "";
  15400. } else if ( Array.isArray( val ) ) {
  15401. val = jQuery.map( val, function( value ) {
  15402. return value == null ? "" : value + "";
  15403. } );
  15404. }
  15405. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15406. // If set returns undefined, fall back to normal setting
  15407. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15408. this.value = val;
  15409. }
  15410. } );
  15411. }
  15412. } );
  15413. jQuery.extend( {
  15414. valHooks: {
  15415. option: {
  15416. get: function( elem ) {
  15417. var val = jQuery.find.attr( elem, "value" );
  15418. return val != null ?
  15419. val :
  15420. // Support: IE <=10 - 11 only
  15421. // option.text throws exceptions (#14686, #14858)
  15422. // Strip and collapse whitespace
  15423. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15424. stripAndCollapse( jQuery.text( elem ) );
  15425. }
  15426. },
  15427. select: {
  15428. get: function( elem ) {
  15429. var value, option, i,
  15430. options = elem.options,
  15431. index = elem.selectedIndex,
  15432. one = elem.type === "select-one",
  15433. values = one ? null : [],
  15434. max = one ? index + 1 : options.length;
  15435. if ( index < 0 ) {
  15436. i = max;
  15437. } else {
  15438. i = one ? index : 0;
  15439. }
  15440. // Loop through all the selected options
  15441. for ( ; i < max; i++ ) {
  15442. option = options[ i ];
  15443. // Support: IE <=9 only
  15444. // IE8-9 doesn't update selected after form reset (#2551)
  15445. if ( ( option.selected || i === index ) &&
  15446. // Don't return options that are disabled or in a disabled optgroup
  15447. !option.disabled &&
  15448. ( !option.parentNode.disabled ||
  15449. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15450. // Get the specific value for the option
  15451. value = jQuery( option ).val();
  15452. // We don't need an array for one selects
  15453. if ( one ) {
  15454. return value;
  15455. }
  15456. // Multi-Selects return an array
  15457. values.push( value );
  15458. }
  15459. }
  15460. return values;
  15461. },
  15462. set: function( elem, value ) {
  15463. var optionSet, option,
  15464. options = elem.options,
  15465. values = jQuery.makeArray( value ),
  15466. i = options.length;
  15467. while ( i-- ) {
  15468. option = options[ i ];
  15469. /* eslint-disable no-cond-assign */
  15470. if ( option.selected =
  15471. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15472. ) {
  15473. optionSet = true;
  15474. }
  15475. /* eslint-enable no-cond-assign */
  15476. }
  15477. // Force browsers to behave consistently when non-matching value is set
  15478. if ( !optionSet ) {
  15479. elem.selectedIndex = -1;
  15480. }
  15481. return values;
  15482. }
  15483. }
  15484. }
  15485. } );
  15486. // Radios and checkboxes getter/setter
  15487. jQuery.each( [ "radio", "checkbox" ], function() {
  15488. jQuery.valHooks[ this ] = {
  15489. set: function( elem, value ) {
  15490. if ( Array.isArray( value ) ) {
  15491. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15492. }
  15493. }
  15494. };
  15495. if ( !support.checkOn ) {
  15496. jQuery.valHooks[ this ].get = function( elem ) {
  15497. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15498. };
  15499. }
  15500. } );
  15501. // Return jQuery for attributes-only inclusion
  15502. support.focusin = "onfocusin" in window;
  15503. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15504. stopPropagationCallback = function( e ) {
  15505. e.stopPropagation();
  15506. };
  15507. jQuery.extend( jQuery.event, {
  15508. trigger: function( event, data, elem, onlyHandlers ) {
  15509. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15510. eventPath = [ elem || document ],
  15511. type = hasOwn.call( event, "type" ) ? event.type : event,
  15512. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15513. cur = lastElement = tmp = elem = elem || document;
  15514. // Don't do events on text and comment nodes
  15515. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15516. return;
  15517. }
  15518. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15519. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15520. return;
  15521. }
  15522. if ( type.indexOf( "." ) > -1 ) {
  15523. // Namespaced trigger; create a regexp to match event type in handle()
  15524. namespaces = type.split( "." );
  15525. type = namespaces.shift();
  15526. namespaces.sort();
  15527. }
  15528. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15529. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15530. event = event[ jQuery.expando ] ?
  15531. event :
  15532. new jQuery.Event( type, typeof event === "object" && event );
  15533. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15534. event.isTrigger = onlyHandlers ? 2 : 3;
  15535. event.namespace = namespaces.join( "." );
  15536. event.rnamespace = event.namespace ?
  15537. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15538. null;
  15539. // Clean up the event in case it is being reused
  15540. event.result = undefined;
  15541. if ( !event.target ) {
  15542. event.target = elem;
  15543. }
  15544. // Clone any incoming data and prepend the event, creating the handler arg list
  15545. data = data == null ?
  15546. [ event ] :
  15547. jQuery.makeArray( data, [ event ] );
  15548. // Allow special events to draw outside the lines
  15549. special = jQuery.event.special[ type ] || {};
  15550. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15551. return;
  15552. }
  15553. // Determine event propagation path in advance, per W3C events spec (#9951)
  15554. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15555. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15556. bubbleType = special.delegateType || type;
  15557. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15558. cur = cur.parentNode;
  15559. }
  15560. for ( ; cur; cur = cur.parentNode ) {
  15561. eventPath.push( cur );
  15562. tmp = cur;
  15563. }
  15564. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15565. if ( tmp === ( elem.ownerDocument || document ) ) {
  15566. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15567. }
  15568. }
  15569. // Fire handlers on the event path
  15570. i = 0;
  15571. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15572. lastElement = cur;
  15573. event.type = i > 1 ?
  15574. bubbleType :
  15575. special.bindType || type;
  15576. // jQuery handler
  15577. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15578. dataPriv.get( cur, "handle" );
  15579. if ( handle ) {
  15580. handle.apply( cur, data );
  15581. }
  15582. // Native handler
  15583. handle = ontype && cur[ ontype ];
  15584. if ( handle && handle.apply && acceptData( cur ) ) {
  15585. event.result = handle.apply( cur, data );
  15586. if ( event.result === false ) {
  15587. event.preventDefault();
  15588. }
  15589. }
  15590. }
  15591. event.type = type;
  15592. // If nobody prevented the default action, do it now
  15593. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15594. if ( ( !special._default ||
  15595. special._default.apply( eventPath.pop(), data ) === false ) &&
  15596. acceptData( elem ) ) {
  15597. // Call a native DOM method on the target with the same name as the event.
  15598. // Don't do default actions on window, that's where global variables be (#6170)
  15599. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15600. // Don't re-trigger an onFOO event when we call its FOO() method
  15601. tmp = elem[ ontype ];
  15602. if ( tmp ) {
  15603. elem[ ontype ] = null;
  15604. }
  15605. // Prevent re-triggering of the same event, since we already bubbled it above
  15606. jQuery.event.triggered = type;
  15607. if ( event.isPropagationStopped() ) {
  15608. lastElement.addEventListener( type, stopPropagationCallback );
  15609. }
  15610. elem[ type ]();
  15611. if ( event.isPropagationStopped() ) {
  15612. lastElement.removeEventListener( type, stopPropagationCallback );
  15613. }
  15614. jQuery.event.triggered = undefined;
  15615. if ( tmp ) {
  15616. elem[ ontype ] = tmp;
  15617. }
  15618. }
  15619. }
  15620. }
  15621. return event.result;
  15622. },
  15623. // Piggyback on a donor event to simulate a different one
  15624. // Used only for `focus(in | out)` events
  15625. simulate: function( type, elem, event ) {
  15626. var e = jQuery.extend(
  15627. new jQuery.Event(),
  15628. event,
  15629. {
  15630. type: type,
  15631. isSimulated: true
  15632. }
  15633. );
  15634. jQuery.event.trigger( e, null, elem );
  15635. }
  15636. } );
  15637. jQuery.fn.extend( {
  15638. trigger: function( type, data ) {
  15639. return this.each( function() {
  15640. jQuery.event.trigger( type, data, this );
  15641. } );
  15642. },
  15643. triggerHandler: function( type, data ) {
  15644. var elem = this[ 0 ];
  15645. if ( elem ) {
  15646. return jQuery.event.trigger( type, data, elem, true );
  15647. }
  15648. }
  15649. } );
  15650. // Support: Firefox <=44
  15651. // Firefox doesn't have focus(in | out) events
  15652. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15653. //
  15654. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15655. // focus(in | out) events fire after focus & blur events,
  15656. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15657. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15658. if ( !support.focusin ) {
  15659. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15660. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15661. var handler = function( event ) {
  15662. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15663. };
  15664. jQuery.event.special[ fix ] = {
  15665. setup: function() {
  15666. var doc = this.ownerDocument || this,
  15667. attaches = dataPriv.access( doc, fix );
  15668. if ( !attaches ) {
  15669. doc.addEventListener( orig, handler, true );
  15670. }
  15671. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15672. },
  15673. teardown: function() {
  15674. var doc = this.ownerDocument || this,
  15675. attaches = dataPriv.access( doc, fix ) - 1;
  15676. if ( !attaches ) {
  15677. doc.removeEventListener( orig, handler, true );
  15678. dataPriv.remove( doc, fix );
  15679. } else {
  15680. dataPriv.access( doc, fix, attaches );
  15681. }
  15682. }
  15683. };
  15684. } );
  15685. }
  15686. var location = window.location;
  15687. var nonce = Date.now();
  15688. var rquery = ( /\?/ );
  15689. // Cross-browser xml parsing
  15690. jQuery.parseXML = function( data ) {
  15691. var xml;
  15692. if ( !data || typeof data !== "string" ) {
  15693. return null;
  15694. }
  15695. // Support: IE 9 - 11 only
  15696. // IE throws on parseFromString with invalid input.
  15697. try {
  15698. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15699. } catch ( e ) {
  15700. xml = undefined;
  15701. }
  15702. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15703. jQuery.error( "Invalid XML: " + data );
  15704. }
  15705. return xml;
  15706. };
  15707. var
  15708. rbracket = /\[\]$/,
  15709. rCRLF = /\r?\n/g,
  15710. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15711. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15712. function buildParams( prefix, obj, traditional, add ) {
  15713. var name;
  15714. if ( Array.isArray( obj ) ) {
  15715. // Serialize array item.
  15716. jQuery.each( obj, function( i, v ) {
  15717. if ( traditional || rbracket.test( prefix ) ) {
  15718. // Treat each array item as a scalar.
  15719. add( prefix, v );
  15720. } else {
  15721. // Item is non-scalar (array or object), encode its numeric index.
  15722. buildParams(
  15723. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15724. v,
  15725. traditional,
  15726. add
  15727. );
  15728. }
  15729. } );
  15730. } else if ( !traditional && toType( obj ) === "object" ) {
  15731. // Serialize object item.
  15732. for ( name in obj ) {
  15733. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15734. }
  15735. } else {
  15736. // Serialize scalar item.
  15737. add( prefix, obj );
  15738. }
  15739. }
  15740. // Serialize an array of form elements or a set of
  15741. // key/values into a query string
  15742. jQuery.param = function( a, traditional ) {
  15743. var prefix,
  15744. s = [],
  15745. add = function( key, valueOrFunction ) {
  15746. // If value is a function, invoke it and use its return value
  15747. var value = isFunction( valueOrFunction ) ?
  15748. valueOrFunction() :
  15749. valueOrFunction;
  15750. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15751. encodeURIComponent( value == null ? "" : value );
  15752. };
  15753. if ( a == null ) {
  15754. return "";
  15755. }
  15756. // If an array was passed in, assume that it is an array of form elements.
  15757. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15758. // Serialize the form elements
  15759. jQuery.each( a, function() {
  15760. add( this.name, this.value );
  15761. } );
  15762. } else {
  15763. // If traditional, encode the "old" way (the way 1.3.2 or older
  15764. // did it), otherwise encode params recursively.
  15765. for ( prefix in a ) {
  15766. buildParams( prefix, a[ prefix ], traditional, add );
  15767. }
  15768. }
  15769. // Return the resulting serialization
  15770. return s.join( "&" );
  15771. };
  15772. jQuery.fn.extend( {
  15773. serialize: function() {
  15774. return jQuery.param( this.serializeArray() );
  15775. },
  15776. serializeArray: function() {
  15777. return this.map( function() {
  15778. // Can add propHook for "elements" to filter or add form elements
  15779. var elements = jQuery.prop( this, "elements" );
  15780. return elements ? jQuery.makeArray( elements ) : this;
  15781. } )
  15782. .filter( function() {
  15783. var type = this.type;
  15784. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15785. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15786. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15787. ( this.checked || !rcheckableType.test( type ) );
  15788. } )
  15789. .map( function( i, elem ) {
  15790. var val = jQuery( this ).val();
  15791. if ( val == null ) {
  15792. return null;
  15793. }
  15794. if ( Array.isArray( val ) ) {
  15795. return jQuery.map( val, function( val ) {
  15796. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15797. } );
  15798. }
  15799. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15800. } ).get();
  15801. }
  15802. } );
  15803. var
  15804. r20 = /%20/g,
  15805. rhash = /#.*$/,
  15806. rantiCache = /([?&])_=[^&]*/,
  15807. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15808. // #7653, #8125, #8152: local protocol detection
  15809. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15810. rnoContent = /^(?:GET|HEAD)$/,
  15811. rprotocol = /^\/\//,
  15812. /* Prefilters
  15813. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15814. * 2) These are called:
  15815. * - BEFORE asking for a transport
  15816. * - AFTER param serialization (s.data is a string if s.processData is true)
  15817. * 3) key is the dataType
  15818. * 4) the catchall symbol "*" can be used
  15819. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15820. */
  15821. prefilters = {},
  15822. /* Transports bindings
  15823. * 1) key is the dataType
  15824. * 2) the catchall symbol "*" can be used
  15825. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15826. */
  15827. transports = {},
  15828. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15829. allTypes = "*/".concat( "*" ),
  15830. // Anchor tag for parsing the document origin
  15831. originAnchor = document.createElement( "a" );
  15832. originAnchor.href = location.href;
  15833. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15834. function addToPrefiltersOrTransports( structure ) {
  15835. // dataTypeExpression is optional and defaults to "*"
  15836. return function( dataTypeExpression, func ) {
  15837. if ( typeof dataTypeExpression !== "string" ) {
  15838. func = dataTypeExpression;
  15839. dataTypeExpression = "*";
  15840. }
  15841. var dataType,
  15842. i = 0,
  15843. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15844. if ( isFunction( func ) ) {
  15845. // For each dataType in the dataTypeExpression
  15846. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15847. // Prepend if requested
  15848. if ( dataType[ 0 ] === "+" ) {
  15849. dataType = dataType.slice( 1 ) || "*";
  15850. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15851. // Otherwise append
  15852. } else {
  15853. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15854. }
  15855. }
  15856. }
  15857. };
  15858. }
  15859. // Base inspection function for prefilters and transports
  15860. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15861. var inspected = {},
  15862. seekingTransport = ( structure === transports );
  15863. function inspect( dataType ) {
  15864. var selected;
  15865. inspected[ dataType ] = true;
  15866. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15867. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15868. if ( typeof dataTypeOrTransport === "string" &&
  15869. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15870. options.dataTypes.unshift( dataTypeOrTransport );
  15871. inspect( dataTypeOrTransport );
  15872. return false;
  15873. } else if ( seekingTransport ) {
  15874. return !( selected = dataTypeOrTransport );
  15875. }
  15876. } );
  15877. return selected;
  15878. }
  15879. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15880. }
  15881. // A special extend for ajax options
  15882. // that takes "flat" options (not to be deep extended)
  15883. // Fixes #9887
  15884. function ajaxExtend( target, src ) {
  15885. var key, deep,
  15886. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15887. for ( key in src ) {
  15888. if ( src[ key ] !== undefined ) {
  15889. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15890. }
  15891. }
  15892. if ( deep ) {
  15893. jQuery.extend( true, target, deep );
  15894. }
  15895. return target;
  15896. }
  15897. /* Handles responses to an ajax request:
  15898. * - finds the right dataType (mediates between content-type and expected dataType)
  15899. * - returns the corresponding response
  15900. */
  15901. function ajaxHandleResponses( s, jqXHR, responses ) {
  15902. var ct, type, finalDataType, firstDataType,
  15903. contents = s.contents,
  15904. dataTypes = s.dataTypes;
  15905. // Remove auto dataType and get content-type in the process
  15906. while ( dataTypes[ 0 ] === "*" ) {
  15907. dataTypes.shift();
  15908. if ( ct === undefined ) {
  15909. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15910. }
  15911. }
  15912. // Check if we're dealing with a known content-type
  15913. if ( ct ) {
  15914. for ( type in contents ) {
  15915. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15916. dataTypes.unshift( type );
  15917. break;
  15918. }
  15919. }
  15920. }
  15921. // Check to see if we have a response for the expected dataType
  15922. if ( dataTypes[ 0 ] in responses ) {
  15923. finalDataType = dataTypes[ 0 ];
  15924. } else {
  15925. // Try convertible dataTypes
  15926. for ( type in responses ) {
  15927. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15928. finalDataType = type;
  15929. break;
  15930. }
  15931. if ( !firstDataType ) {
  15932. firstDataType = type;
  15933. }
  15934. }
  15935. // Or just use first one
  15936. finalDataType = finalDataType || firstDataType;
  15937. }
  15938. // If we found a dataType
  15939. // We add the dataType to the list if needed
  15940. // and return the corresponding response
  15941. if ( finalDataType ) {
  15942. if ( finalDataType !== dataTypes[ 0 ] ) {
  15943. dataTypes.unshift( finalDataType );
  15944. }
  15945. return responses[ finalDataType ];
  15946. }
  15947. }
  15948. /* Chain conversions given the request and the original response
  15949. * Also sets the responseXXX fields on the jqXHR instance
  15950. */
  15951. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15952. var conv2, current, conv, tmp, prev,
  15953. converters = {},
  15954. // Work with a copy of dataTypes in case we need to modify it for conversion
  15955. dataTypes = s.dataTypes.slice();
  15956. // Create converters map with lowercased keys
  15957. if ( dataTypes[ 1 ] ) {
  15958. for ( conv in s.converters ) {
  15959. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15960. }
  15961. }
  15962. current = dataTypes.shift();
  15963. // Convert to each sequential dataType
  15964. while ( current ) {
  15965. if ( s.responseFields[ current ] ) {
  15966. jqXHR[ s.responseFields[ current ] ] = response;
  15967. }
  15968. // Apply the dataFilter if provided
  15969. if ( !prev && isSuccess && s.dataFilter ) {
  15970. response = s.dataFilter( response, s.dataType );
  15971. }
  15972. prev = current;
  15973. current = dataTypes.shift();
  15974. if ( current ) {
  15975. // There's only work to do if current dataType is non-auto
  15976. if ( current === "*" ) {
  15977. current = prev;
  15978. // Convert response if prev dataType is non-auto and differs from current
  15979. } else if ( prev !== "*" && prev !== current ) {
  15980. // Seek a direct converter
  15981. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15982. // If none found, seek a pair
  15983. if ( !conv ) {
  15984. for ( conv2 in converters ) {
  15985. // If conv2 outputs current
  15986. tmp = conv2.split( " " );
  15987. if ( tmp[ 1 ] === current ) {
  15988. // If prev can be converted to accepted input
  15989. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15990. converters[ "* " + tmp[ 0 ] ];
  15991. if ( conv ) {
  15992. // Condense equivalence converters
  15993. if ( conv === true ) {
  15994. conv = converters[ conv2 ];
  15995. // Otherwise, insert the intermediate dataType
  15996. } else if ( converters[ conv2 ] !== true ) {
  15997. current = tmp[ 0 ];
  15998. dataTypes.unshift( tmp[ 1 ] );
  15999. }
  16000. break;
  16001. }
  16002. }
  16003. }
  16004. }
  16005. // Apply converter (if not an equivalence)
  16006. if ( conv !== true ) {
  16007. // Unless errors are allowed to bubble, catch and return them
  16008. if ( conv && s.throws ) {
  16009. response = conv( response );
  16010. } else {
  16011. try {
  16012. response = conv( response );
  16013. } catch ( e ) {
  16014. return {
  16015. state: "parsererror",
  16016. error: conv ? e : "No conversion from " + prev + " to " + current
  16017. };
  16018. }
  16019. }
  16020. }
  16021. }
  16022. }
  16023. }
  16024. return { state: "success", data: response };
  16025. }
  16026. jQuery.extend( {
  16027. // Counter for holding the number of active queries
  16028. active: 0,
  16029. // Last-Modified header cache for next request
  16030. lastModified: {},
  16031. etag: {},
  16032. ajaxSettings: {
  16033. url: location.href,
  16034. type: "GET",
  16035. isLocal: rlocalProtocol.test( location.protocol ),
  16036. global: true,
  16037. processData: true,
  16038. async: true,
  16039. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16040. /*
  16041. timeout: 0,
  16042. data: null,
  16043. dataType: null,
  16044. username: null,
  16045. password: null,
  16046. cache: null,
  16047. throws: false,
  16048. traditional: false,
  16049. headers: {},
  16050. */
  16051. accepts: {
  16052. "*": allTypes,
  16053. text: "text/plain",
  16054. html: "text/html",
  16055. xml: "application/xml, text/xml",
  16056. json: "application/json, text/javascript"
  16057. },
  16058. contents: {
  16059. xml: /\bxml\b/,
  16060. html: /\bhtml/,
  16061. json: /\bjson\b/
  16062. },
  16063. responseFields: {
  16064. xml: "responseXML",
  16065. text: "responseText",
  16066. json: "responseJSON"
  16067. },
  16068. // Data converters
  16069. // Keys separate source (or catchall "*") and destination types with a single space
  16070. converters: {
  16071. // Convert anything to text
  16072. "* text": String,
  16073. // Text to html (true = no transformation)
  16074. "text html": true,
  16075. // Evaluate text as a json expression
  16076. "text json": JSON.parse,
  16077. // Parse text as xml
  16078. "text xml": jQuery.parseXML
  16079. },
  16080. // For options that shouldn't be deep extended:
  16081. // you can add your own custom options here if
  16082. // and when you create one that shouldn't be
  16083. // deep extended (see ajaxExtend)
  16084. flatOptions: {
  16085. url: true,
  16086. context: true
  16087. }
  16088. },
  16089. // Creates a full fledged settings object into target
  16090. // with both ajaxSettings and settings fields.
  16091. // If target is omitted, writes into ajaxSettings.
  16092. ajaxSetup: function( target, settings ) {
  16093. return settings ?
  16094. // Building a settings object
  16095. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16096. // Extending ajaxSettings
  16097. ajaxExtend( jQuery.ajaxSettings, target );
  16098. },
  16099. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16100. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16101. // Main method
  16102. ajax: function( url, options ) {
  16103. // If url is an object, simulate pre-1.5 signature
  16104. if ( typeof url === "object" ) {
  16105. options = url;
  16106. url = undefined;
  16107. }
  16108. // Force options to be an object
  16109. options = options || {};
  16110. var transport,
  16111. // URL without anti-cache param
  16112. cacheURL,
  16113. // Response headers
  16114. responseHeadersString,
  16115. responseHeaders,
  16116. // timeout handle
  16117. timeoutTimer,
  16118. // Url cleanup var
  16119. urlAnchor,
  16120. // Request state (becomes false upon send and true upon completion)
  16121. completed,
  16122. // To know if global events are to be dispatched
  16123. fireGlobals,
  16124. // Loop variable
  16125. i,
  16126. // uncached part of the url
  16127. uncached,
  16128. // Create the final options object
  16129. s = jQuery.ajaxSetup( {}, options ),
  16130. // Callbacks context
  16131. callbackContext = s.context || s,
  16132. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16133. globalEventContext = s.context &&
  16134. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16135. jQuery( callbackContext ) :
  16136. jQuery.event,
  16137. // Deferreds
  16138. deferred = jQuery.Deferred(),
  16139. completeDeferred = jQuery.Callbacks( "once memory" ),
  16140. // Status-dependent callbacks
  16141. statusCode = s.statusCode || {},
  16142. // Headers (they are sent all at once)
  16143. requestHeaders = {},
  16144. requestHeadersNames = {},
  16145. // Default abort message
  16146. strAbort = "canceled",
  16147. // Fake xhr
  16148. jqXHR = {
  16149. readyState: 0,
  16150. // Builds headers hashtable if needed
  16151. getResponseHeader: function( key ) {
  16152. var match;
  16153. if ( completed ) {
  16154. if ( !responseHeaders ) {
  16155. responseHeaders = {};
  16156. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16157. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16158. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16159. .concat( match[ 2 ] );
  16160. }
  16161. }
  16162. match = responseHeaders[ key.toLowerCase() + " " ];
  16163. }
  16164. return match == null ? null : match.join( ", " );
  16165. },
  16166. // Raw string
  16167. getAllResponseHeaders: function() {
  16168. return completed ? responseHeadersString : null;
  16169. },
  16170. // Caches the header
  16171. setRequestHeader: function( name, value ) {
  16172. if ( completed == null ) {
  16173. name = requestHeadersNames[ name.toLowerCase() ] =
  16174. requestHeadersNames[ name.toLowerCase() ] || name;
  16175. requestHeaders[ name ] = value;
  16176. }
  16177. return this;
  16178. },
  16179. // Overrides response content-type header
  16180. overrideMimeType: function( type ) {
  16181. if ( completed == null ) {
  16182. s.mimeType = type;
  16183. }
  16184. return this;
  16185. },
  16186. // Status-dependent callbacks
  16187. statusCode: function( map ) {
  16188. var code;
  16189. if ( map ) {
  16190. if ( completed ) {
  16191. // Execute the appropriate callbacks
  16192. jqXHR.always( map[ jqXHR.status ] );
  16193. } else {
  16194. // Lazy-add the new callbacks in a way that preserves old ones
  16195. for ( code in map ) {
  16196. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16197. }
  16198. }
  16199. }
  16200. return this;
  16201. },
  16202. // Cancel the request
  16203. abort: function( statusText ) {
  16204. var finalText = statusText || strAbort;
  16205. if ( transport ) {
  16206. transport.abort( finalText );
  16207. }
  16208. done( 0, finalText );
  16209. return this;
  16210. }
  16211. };
  16212. // Attach deferreds
  16213. deferred.promise( jqXHR );
  16214. // Add protocol if not provided (prefilters might expect it)
  16215. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16216. // We also use the url parameter if available
  16217. s.url = ( ( url || s.url || location.href ) + "" )
  16218. .replace( rprotocol, location.protocol + "//" );
  16219. // Alias method option to type as per ticket #12004
  16220. s.type = options.method || options.type || s.method || s.type;
  16221. // Extract dataTypes list
  16222. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16223. // A cross-domain request is in order when the origin doesn't match the current origin.
  16224. if ( s.crossDomain == null ) {
  16225. urlAnchor = document.createElement( "a" );
  16226. // Support: IE <=8 - 11, Edge 12 - 15
  16227. // IE throws exception on accessing the href property if url is malformed,
  16228. // e.g. http://example.com:80x/
  16229. try {
  16230. urlAnchor.href = s.url;
  16231. // Support: IE <=8 - 11 only
  16232. // Anchor's host property isn't correctly set when s.url is relative
  16233. urlAnchor.href = urlAnchor.href;
  16234. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16235. urlAnchor.protocol + "//" + urlAnchor.host;
  16236. } catch ( e ) {
  16237. // If there is an error parsing the URL, assume it is crossDomain,
  16238. // it can be rejected by the transport if it is invalid
  16239. s.crossDomain = true;
  16240. }
  16241. }
  16242. // Convert data if not already a string
  16243. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16244. s.data = jQuery.param( s.data, s.traditional );
  16245. }
  16246. // Apply prefilters
  16247. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16248. // If request was aborted inside a prefilter, stop there
  16249. if ( completed ) {
  16250. return jqXHR;
  16251. }
  16252. // We can fire global events as of now if asked to
  16253. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16254. fireGlobals = jQuery.event && s.global;
  16255. // Watch for a new set of requests
  16256. if ( fireGlobals && jQuery.active++ === 0 ) {
  16257. jQuery.event.trigger( "ajaxStart" );
  16258. }
  16259. // Uppercase the type
  16260. s.type = s.type.toUpperCase();
  16261. // Determine if request has content
  16262. s.hasContent = !rnoContent.test( s.type );
  16263. // Save the URL in case we're toying with the If-Modified-Since
  16264. // and/or If-None-Match header later on
  16265. // Remove hash to simplify url manipulation
  16266. cacheURL = s.url.replace( rhash, "" );
  16267. // More options handling for requests with no content
  16268. if ( !s.hasContent ) {
  16269. // Remember the hash so we can put it back
  16270. uncached = s.url.slice( cacheURL.length );
  16271. // If data is available and should be processed, append data to url
  16272. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16273. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16274. // #9682: remove data so that it's not used in an eventual retry
  16275. delete s.data;
  16276. }
  16277. // Add or update anti-cache param if needed
  16278. if ( s.cache === false ) {
  16279. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16280. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16281. }
  16282. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16283. s.url = cacheURL + uncached;
  16284. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16285. } else if ( s.data && s.processData &&
  16286. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16287. s.data = s.data.replace( r20, "+" );
  16288. }
  16289. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16290. if ( s.ifModified ) {
  16291. if ( jQuery.lastModified[ cacheURL ] ) {
  16292. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16293. }
  16294. if ( jQuery.etag[ cacheURL ] ) {
  16295. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16296. }
  16297. }
  16298. // Set the correct header, if data is being sent
  16299. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16300. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16301. }
  16302. // Set the Accepts header for the server, depending on the dataType
  16303. jqXHR.setRequestHeader(
  16304. "Accept",
  16305. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16306. s.accepts[ s.dataTypes[ 0 ] ] +
  16307. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16308. s.accepts[ "*" ]
  16309. );
  16310. // Check for headers option
  16311. for ( i in s.headers ) {
  16312. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16313. }
  16314. // Allow custom headers/mimetypes and early abort
  16315. if ( s.beforeSend &&
  16316. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16317. // Abort if not done already and return
  16318. return jqXHR.abort();
  16319. }
  16320. // Aborting is no longer a cancellation
  16321. strAbort = "abort";
  16322. // Install callbacks on deferreds
  16323. completeDeferred.add( s.complete );
  16324. jqXHR.done( s.success );
  16325. jqXHR.fail( s.error );
  16326. // Get transport
  16327. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16328. // If no transport, we auto-abort
  16329. if ( !transport ) {
  16330. done( -1, "No Transport" );
  16331. } else {
  16332. jqXHR.readyState = 1;
  16333. // Send global event
  16334. if ( fireGlobals ) {
  16335. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16336. }
  16337. // If request was aborted inside ajaxSend, stop there
  16338. if ( completed ) {
  16339. return jqXHR;
  16340. }
  16341. // Timeout
  16342. if ( s.async && s.timeout > 0 ) {
  16343. timeoutTimer = window.setTimeout( function() {
  16344. jqXHR.abort( "timeout" );
  16345. }, s.timeout );
  16346. }
  16347. try {
  16348. completed = false;
  16349. transport.send( requestHeaders, done );
  16350. } catch ( e ) {
  16351. // Rethrow post-completion exceptions
  16352. if ( completed ) {
  16353. throw e;
  16354. }
  16355. // Propagate others as results
  16356. done( -1, e );
  16357. }
  16358. }
  16359. // Callback for when everything is done
  16360. function done( status, nativeStatusText, responses, headers ) {
  16361. var isSuccess, success, error, response, modified,
  16362. statusText = nativeStatusText;
  16363. // Ignore repeat invocations
  16364. if ( completed ) {
  16365. return;
  16366. }
  16367. completed = true;
  16368. // Clear timeout if it exists
  16369. if ( timeoutTimer ) {
  16370. window.clearTimeout( timeoutTimer );
  16371. }
  16372. // Dereference transport for early garbage collection
  16373. // (no matter how long the jqXHR object will be used)
  16374. transport = undefined;
  16375. // Cache response headers
  16376. responseHeadersString = headers || "";
  16377. // Set readyState
  16378. jqXHR.readyState = status > 0 ? 4 : 0;
  16379. // Determine if successful
  16380. isSuccess = status >= 200 && status < 300 || status === 304;
  16381. // Get response data
  16382. if ( responses ) {
  16383. response = ajaxHandleResponses( s, jqXHR, responses );
  16384. }
  16385. // Convert no matter what (that way responseXXX fields are always set)
  16386. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16387. // If successful, handle type chaining
  16388. if ( isSuccess ) {
  16389. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16390. if ( s.ifModified ) {
  16391. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16392. if ( modified ) {
  16393. jQuery.lastModified[ cacheURL ] = modified;
  16394. }
  16395. modified = jqXHR.getResponseHeader( "etag" );
  16396. if ( modified ) {
  16397. jQuery.etag[ cacheURL ] = modified;
  16398. }
  16399. }
  16400. // if no content
  16401. if ( status === 204 || s.type === "HEAD" ) {
  16402. statusText = "nocontent";
  16403. // if not modified
  16404. } else if ( status === 304 ) {
  16405. statusText = "notmodified";
  16406. // If we have data, let's convert it
  16407. } else {
  16408. statusText = response.state;
  16409. success = response.data;
  16410. error = response.error;
  16411. isSuccess = !error;
  16412. }
  16413. } else {
  16414. // Extract error from statusText and normalize for non-aborts
  16415. error = statusText;
  16416. if ( status || !statusText ) {
  16417. statusText = "error";
  16418. if ( status < 0 ) {
  16419. status = 0;
  16420. }
  16421. }
  16422. }
  16423. // Set data for the fake xhr object
  16424. jqXHR.status = status;
  16425. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16426. // Success/Error
  16427. if ( isSuccess ) {
  16428. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16429. } else {
  16430. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16431. }
  16432. // Status-dependent callbacks
  16433. jqXHR.statusCode( statusCode );
  16434. statusCode = undefined;
  16435. if ( fireGlobals ) {
  16436. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16437. [ jqXHR, s, isSuccess ? success : error ] );
  16438. }
  16439. // Complete
  16440. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16441. if ( fireGlobals ) {
  16442. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16443. // Handle the global AJAX counter
  16444. if ( !( --jQuery.active ) ) {
  16445. jQuery.event.trigger( "ajaxStop" );
  16446. }
  16447. }
  16448. }
  16449. return jqXHR;
  16450. },
  16451. getJSON: function( url, data, callback ) {
  16452. return jQuery.get( url, data, callback, "json" );
  16453. },
  16454. getScript: function( url, callback ) {
  16455. return jQuery.get( url, undefined, callback, "script" );
  16456. }
  16457. } );
  16458. jQuery.each( [ "get", "post" ], function( i, method ) {
  16459. jQuery[ method ] = function( url, data, callback, type ) {
  16460. // Shift arguments if data argument was omitted
  16461. if ( isFunction( data ) ) {
  16462. type = type || callback;
  16463. callback = data;
  16464. data = undefined;
  16465. }
  16466. // The url can be an options object (which then must have .url)
  16467. return jQuery.ajax( jQuery.extend( {
  16468. url: url,
  16469. type: method,
  16470. dataType: type,
  16471. data: data,
  16472. success: callback
  16473. }, jQuery.isPlainObject( url ) && url ) );
  16474. };
  16475. } );
  16476. jQuery._evalUrl = function( url, options ) {
  16477. return jQuery.ajax( {
  16478. url: url,
  16479. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16480. type: "GET",
  16481. dataType: "script",
  16482. cache: true,
  16483. async: false,
  16484. global: false,
  16485. // Only evaluate the response if it is successful (gh-4126)
  16486. // dataFilter is not invoked for failure responses, so using it instead
  16487. // of the default converter is kludgy but it works.
  16488. converters: {
  16489. "text script": function() {}
  16490. },
  16491. dataFilter: function( response ) {
  16492. jQuery.globalEval( response, options );
  16493. }
  16494. } );
  16495. };
  16496. jQuery.fn.extend( {
  16497. wrapAll: function( html ) {
  16498. var wrap;
  16499. if ( this[ 0 ] ) {
  16500. if ( isFunction( html ) ) {
  16501. html = html.call( this[ 0 ] );
  16502. }
  16503. // The elements to wrap the target around
  16504. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16505. if ( this[ 0 ].parentNode ) {
  16506. wrap.insertBefore( this[ 0 ] );
  16507. }
  16508. wrap.map( function() {
  16509. var elem = this;
  16510. while ( elem.firstElementChild ) {
  16511. elem = elem.firstElementChild;
  16512. }
  16513. return elem;
  16514. } ).append( this );
  16515. }
  16516. return this;
  16517. },
  16518. wrapInner: function( html ) {
  16519. if ( isFunction( html ) ) {
  16520. return this.each( function( i ) {
  16521. jQuery( this ).wrapInner( html.call( this, i ) );
  16522. } );
  16523. }
  16524. return this.each( function() {
  16525. var self = jQuery( this ),
  16526. contents = self.contents();
  16527. if ( contents.length ) {
  16528. contents.wrapAll( html );
  16529. } else {
  16530. self.append( html );
  16531. }
  16532. } );
  16533. },
  16534. wrap: function( html ) {
  16535. var htmlIsFunction = isFunction( html );
  16536. return this.each( function( i ) {
  16537. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16538. } );
  16539. },
  16540. unwrap: function( selector ) {
  16541. this.parent( selector ).not( "body" ).each( function() {
  16542. jQuery( this ).replaceWith( this.childNodes );
  16543. } );
  16544. return this;
  16545. }
  16546. } );
  16547. jQuery.expr.pseudos.hidden = function( elem ) {
  16548. return !jQuery.expr.pseudos.visible( elem );
  16549. };
  16550. jQuery.expr.pseudos.visible = function( elem ) {
  16551. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16552. };
  16553. jQuery.ajaxSettings.xhr = function() {
  16554. try {
  16555. return new window.XMLHttpRequest();
  16556. } catch ( e ) {}
  16557. };
  16558. var xhrSuccessStatus = {
  16559. // File protocol always yields status code 0, assume 200
  16560. 0: 200,
  16561. // Support: IE <=9 only
  16562. // #1450: sometimes IE returns 1223 when it should be 204
  16563. 1223: 204
  16564. },
  16565. xhrSupported = jQuery.ajaxSettings.xhr();
  16566. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16567. support.ajax = xhrSupported = !!xhrSupported;
  16568. jQuery.ajaxTransport( function( options ) {
  16569. var callback, errorCallback;
  16570. // Cross domain only allowed if supported through XMLHttpRequest
  16571. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16572. return {
  16573. send: function( headers, complete ) {
  16574. var i,
  16575. xhr = options.xhr();
  16576. xhr.open(
  16577. options.type,
  16578. options.url,
  16579. options.async,
  16580. options.username,
  16581. options.password
  16582. );
  16583. // Apply custom fields if provided
  16584. if ( options.xhrFields ) {
  16585. for ( i in options.xhrFields ) {
  16586. xhr[ i ] = options.xhrFields[ i ];
  16587. }
  16588. }
  16589. // Override mime type if needed
  16590. if ( options.mimeType && xhr.overrideMimeType ) {
  16591. xhr.overrideMimeType( options.mimeType );
  16592. }
  16593. // X-Requested-With header
  16594. // For cross-domain requests, seeing as conditions for a preflight are
  16595. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16596. // (it can always be set on a per-request basis or even using ajaxSetup)
  16597. // For same-domain requests, won't change header if already provided.
  16598. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16599. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16600. }
  16601. // Set headers
  16602. for ( i in headers ) {
  16603. xhr.setRequestHeader( i, headers[ i ] );
  16604. }
  16605. // Callback
  16606. callback = function( type ) {
  16607. return function() {
  16608. if ( callback ) {
  16609. callback = errorCallback = xhr.onload =
  16610. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16611. xhr.onreadystatechange = null;
  16612. if ( type === "abort" ) {
  16613. xhr.abort();
  16614. } else if ( type === "error" ) {
  16615. // Support: IE <=9 only
  16616. // On a manual native abort, IE9 throws
  16617. // errors on any property access that is not readyState
  16618. if ( typeof xhr.status !== "number" ) {
  16619. complete( 0, "error" );
  16620. } else {
  16621. complete(
  16622. // File: protocol always yields status 0; see #8605, #14207
  16623. xhr.status,
  16624. xhr.statusText
  16625. );
  16626. }
  16627. } else {
  16628. complete(
  16629. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16630. xhr.statusText,
  16631. // Support: IE <=9 only
  16632. // IE9 has no XHR2 but throws on binary (trac-11426)
  16633. // For XHR2 non-text, let the caller handle it (gh-2498)
  16634. ( xhr.responseType || "text" ) !== "text" ||
  16635. typeof xhr.responseText !== "string" ?
  16636. { binary: xhr.response } :
  16637. { text: xhr.responseText },
  16638. xhr.getAllResponseHeaders()
  16639. );
  16640. }
  16641. }
  16642. };
  16643. };
  16644. // Listen to events
  16645. xhr.onload = callback();
  16646. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16647. // Support: IE 9 only
  16648. // Use onreadystatechange to replace onabort
  16649. // to handle uncaught aborts
  16650. if ( xhr.onabort !== undefined ) {
  16651. xhr.onabort = errorCallback;
  16652. } else {
  16653. xhr.onreadystatechange = function() {
  16654. // Check readyState before timeout as it changes
  16655. if ( xhr.readyState === 4 ) {
  16656. // Allow onerror to be called first,
  16657. // but that will not handle a native abort
  16658. // Also, save errorCallback to a variable
  16659. // as xhr.onerror cannot be accessed
  16660. window.setTimeout( function() {
  16661. if ( callback ) {
  16662. errorCallback();
  16663. }
  16664. } );
  16665. }
  16666. };
  16667. }
  16668. // Create the abort callback
  16669. callback = callback( "abort" );
  16670. try {
  16671. // Do send the request (this may raise an exception)
  16672. xhr.send( options.hasContent && options.data || null );
  16673. } catch ( e ) {
  16674. // #14683: Only rethrow if this hasn't been notified as an error yet
  16675. if ( callback ) {
  16676. throw e;
  16677. }
  16678. }
  16679. },
  16680. abort: function() {
  16681. if ( callback ) {
  16682. callback();
  16683. }
  16684. }
  16685. };
  16686. }
  16687. } );
  16688. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16689. jQuery.ajaxPrefilter( function( s ) {
  16690. if ( s.crossDomain ) {
  16691. s.contents.script = false;
  16692. }
  16693. } );
  16694. // Install script dataType
  16695. jQuery.ajaxSetup( {
  16696. accepts: {
  16697. script: "text/javascript, application/javascript, " +
  16698. "application/ecmascript, application/x-ecmascript"
  16699. },
  16700. contents: {
  16701. script: /\b(?:java|ecma)script\b/
  16702. },
  16703. converters: {
  16704. "text script": function( text ) {
  16705. jQuery.globalEval( text );
  16706. return text;
  16707. }
  16708. }
  16709. } );
  16710. // Handle cache's special case and crossDomain
  16711. jQuery.ajaxPrefilter( "script", function( s ) {
  16712. if ( s.cache === undefined ) {
  16713. s.cache = false;
  16714. }
  16715. if ( s.crossDomain ) {
  16716. s.type = "GET";
  16717. }
  16718. } );
  16719. // Bind script tag hack transport
  16720. jQuery.ajaxTransport( "script", function( s ) {
  16721. // This transport only deals with cross domain or forced-by-attrs requests
  16722. if ( s.crossDomain || s.scriptAttrs ) {
  16723. var script, callback;
  16724. return {
  16725. send: function( _, complete ) {
  16726. script = jQuery( "<script>" )
  16727. .attr( s.scriptAttrs || {} )
  16728. .prop( { charset: s.scriptCharset, src: s.url } )
  16729. .on( "load error", callback = function( evt ) {
  16730. script.remove();
  16731. callback = null;
  16732. if ( evt ) {
  16733. complete( evt.type === "error" ? 404 : 200, evt.type );
  16734. }
  16735. } );
  16736. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16737. document.head.appendChild( script[ 0 ] );
  16738. },
  16739. abort: function() {
  16740. if ( callback ) {
  16741. callback();
  16742. }
  16743. }
  16744. };
  16745. }
  16746. } );
  16747. var oldCallbacks = [],
  16748. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16749. // Default jsonp settings
  16750. jQuery.ajaxSetup( {
  16751. jsonp: "callback",
  16752. jsonpCallback: function() {
  16753. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16754. this[ callback ] = true;
  16755. return callback;
  16756. }
  16757. } );
  16758. // Detect, normalize options and install callbacks for jsonp requests
  16759. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16760. var callbackName, overwritten, responseContainer,
  16761. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16762. "url" :
  16763. typeof s.data === "string" &&
  16764. ( s.contentType || "" )
  16765. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16766. rjsonp.test( s.data ) && "data"
  16767. );
  16768. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16769. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16770. // Get callback name, remembering preexisting value associated with it
  16771. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16772. s.jsonpCallback() :
  16773. s.jsonpCallback;
  16774. // Insert callback into url or form data
  16775. if ( jsonProp ) {
  16776. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16777. } else if ( s.jsonp !== false ) {
  16778. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16779. }
  16780. // Use data converter to retrieve json after script execution
  16781. s.converters[ "script json" ] = function() {
  16782. if ( !responseContainer ) {
  16783. jQuery.error( callbackName + " was not called" );
  16784. }
  16785. return responseContainer[ 0 ];
  16786. };
  16787. // Force json dataType
  16788. s.dataTypes[ 0 ] = "json";
  16789. // Install callback
  16790. overwritten = window[ callbackName ];
  16791. window[ callbackName ] = function() {
  16792. responseContainer = arguments;
  16793. };
  16794. // Clean-up function (fires after converters)
  16795. jqXHR.always( function() {
  16796. // If previous value didn't exist - remove it
  16797. if ( overwritten === undefined ) {
  16798. jQuery( window ).removeProp( callbackName );
  16799. // Otherwise restore preexisting value
  16800. } else {
  16801. window[ callbackName ] = overwritten;
  16802. }
  16803. // Save back as free
  16804. if ( s[ callbackName ] ) {
  16805. // Make sure that re-using the options doesn't screw things around
  16806. s.jsonpCallback = originalSettings.jsonpCallback;
  16807. // Save the callback name for future use
  16808. oldCallbacks.push( callbackName );
  16809. }
  16810. // Call if it was a function and we have a response
  16811. if ( responseContainer && isFunction( overwritten ) ) {
  16812. overwritten( responseContainer[ 0 ] );
  16813. }
  16814. responseContainer = overwritten = undefined;
  16815. } );
  16816. // Delegate to script
  16817. return "script";
  16818. }
  16819. } );
  16820. // Support: Safari 8 only
  16821. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16822. // collapse sibling forms: the second one becomes a child of the first one.
  16823. // Because of that, this security measure has to be disabled in Safari 8.
  16824. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16825. support.createHTMLDocument = ( function() {
  16826. var body = document.implementation.createHTMLDocument( "" ).body;
  16827. body.innerHTML = "<form></form><form></form>";
  16828. return body.childNodes.length === 2;
  16829. } )();
  16830. // Argument "data" should be string of html
  16831. // context (optional): If specified, the fragment will be created in this context,
  16832. // defaults to document
  16833. // keepScripts (optional): If true, will include scripts passed in the html string
  16834. jQuery.parseHTML = function( data, context, keepScripts ) {
  16835. if ( typeof data !== "string" ) {
  16836. return [];
  16837. }
  16838. if ( typeof context === "boolean" ) {
  16839. keepScripts = context;
  16840. context = false;
  16841. }
  16842. var base, parsed, scripts;
  16843. if ( !context ) {
  16844. // Stop scripts or inline event handlers from being executed immediately
  16845. // by using document.implementation
  16846. if ( support.createHTMLDocument ) {
  16847. context = document.implementation.createHTMLDocument( "" );
  16848. // Set the base href for the created document
  16849. // so any parsed elements with URLs
  16850. // are based on the document's URL (gh-2965)
  16851. base = context.createElement( "base" );
  16852. base.href = document.location.href;
  16853. context.head.appendChild( base );
  16854. } else {
  16855. context = document;
  16856. }
  16857. }
  16858. parsed = rsingleTag.exec( data );
  16859. scripts = !keepScripts && [];
  16860. // Single tag
  16861. if ( parsed ) {
  16862. return [ context.createElement( parsed[ 1 ] ) ];
  16863. }
  16864. parsed = buildFragment( [ data ], context, scripts );
  16865. if ( scripts && scripts.length ) {
  16866. jQuery( scripts ).remove();
  16867. }
  16868. return jQuery.merge( [], parsed.childNodes );
  16869. };
  16870. /**
  16871. * Load a url into a page
  16872. */
  16873. jQuery.fn.load = function( url, params, callback ) {
  16874. var selector, type, response,
  16875. self = this,
  16876. off = url.indexOf( " " );
  16877. if ( off > -1 ) {
  16878. selector = stripAndCollapse( url.slice( off ) );
  16879. url = url.slice( 0, off );
  16880. }
  16881. // If it's a function
  16882. if ( isFunction( params ) ) {
  16883. // We assume that it's the callback
  16884. callback = params;
  16885. params = undefined;
  16886. // Otherwise, build a param string
  16887. } else if ( params && typeof params === "object" ) {
  16888. type = "POST";
  16889. }
  16890. // If we have elements to modify, make the request
  16891. if ( self.length > 0 ) {
  16892. jQuery.ajax( {
  16893. url: url,
  16894. // If "type" variable is undefined, then "GET" method will be used.
  16895. // Make value of this field explicit since
  16896. // user can override it through ajaxSetup method
  16897. type: type || "GET",
  16898. dataType: "html",
  16899. data: params
  16900. } ).done( function( responseText ) {
  16901. // Save response for use in complete callback
  16902. response = arguments;
  16903. self.html( selector ?
  16904. // If a selector was specified, locate the right elements in a dummy div
  16905. // Exclude scripts to avoid IE 'Permission Denied' errors
  16906. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16907. // Otherwise use the full result
  16908. responseText );
  16909. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16910. // but they are ignored because response was set above.
  16911. // If it fails, this function gets "jqXHR", "status", "error"
  16912. } ).always( callback && function( jqXHR, status ) {
  16913. self.each( function() {
  16914. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16915. } );
  16916. } );
  16917. }
  16918. return this;
  16919. };
  16920. // Attach a bunch of functions for handling common AJAX events
  16921. jQuery.each( [
  16922. "ajaxStart",
  16923. "ajaxStop",
  16924. "ajaxComplete",
  16925. "ajaxError",
  16926. "ajaxSuccess",
  16927. "ajaxSend"
  16928. ], function( i, type ) {
  16929. jQuery.fn[ type ] = function( fn ) {
  16930. return this.on( type, fn );
  16931. };
  16932. } );
  16933. jQuery.expr.pseudos.animated = function( elem ) {
  16934. return jQuery.grep( jQuery.timers, function( fn ) {
  16935. return elem === fn.elem;
  16936. } ).length;
  16937. };
  16938. jQuery.offset = {
  16939. setOffset: function( elem, options, i ) {
  16940. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16941. position = jQuery.css( elem, "position" ),
  16942. curElem = jQuery( elem ),
  16943. props = {};
  16944. // Set position first, in-case top/left are set even on static elem
  16945. if ( position === "static" ) {
  16946. elem.style.position = "relative";
  16947. }
  16948. curOffset = curElem.offset();
  16949. curCSSTop = jQuery.css( elem, "top" );
  16950. curCSSLeft = jQuery.css( elem, "left" );
  16951. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16952. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16953. // Need to be able to calculate position if either
  16954. // top or left is auto and position is either absolute or fixed
  16955. if ( calculatePosition ) {
  16956. curPosition = curElem.position();
  16957. curTop = curPosition.top;
  16958. curLeft = curPosition.left;
  16959. } else {
  16960. curTop = parseFloat( curCSSTop ) || 0;
  16961. curLeft = parseFloat( curCSSLeft ) || 0;
  16962. }
  16963. if ( isFunction( options ) ) {
  16964. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16965. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16966. }
  16967. if ( options.top != null ) {
  16968. props.top = ( options.top - curOffset.top ) + curTop;
  16969. }
  16970. if ( options.left != null ) {
  16971. props.left = ( options.left - curOffset.left ) + curLeft;
  16972. }
  16973. if ( "using" in options ) {
  16974. options.using.call( elem, props );
  16975. } else {
  16976. curElem.css( props );
  16977. }
  16978. }
  16979. };
  16980. jQuery.fn.extend( {
  16981. // offset() relates an element's border box to the document origin
  16982. offset: function( options ) {
  16983. // Preserve chaining for setter
  16984. if ( arguments.length ) {
  16985. return options === undefined ?
  16986. this :
  16987. this.each( function( i ) {
  16988. jQuery.offset.setOffset( this, options, i );
  16989. } );
  16990. }
  16991. var rect, win,
  16992. elem = this[ 0 ];
  16993. if ( !elem ) {
  16994. return;
  16995. }
  16996. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16997. // Support: IE <=11 only
  16998. // Running getBoundingClientRect on a
  16999. // disconnected node in IE throws an error
  17000. if ( !elem.getClientRects().length ) {
  17001. return { top: 0, left: 0 };
  17002. }
  17003. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17004. rect = elem.getBoundingClientRect();
  17005. win = elem.ownerDocument.defaultView;
  17006. return {
  17007. top: rect.top + win.pageYOffset,
  17008. left: rect.left + win.pageXOffset
  17009. };
  17010. },
  17011. // position() relates an element's margin box to its offset parent's padding box
  17012. // This corresponds to the behavior of CSS absolute positioning
  17013. position: function() {
  17014. if ( !this[ 0 ] ) {
  17015. return;
  17016. }
  17017. var offsetParent, offset, doc,
  17018. elem = this[ 0 ],
  17019. parentOffset = { top: 0, left: 0 };
  17020. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17021. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17022. // Assume position:fixed implies availability of getBoundingClientRect
  17023. offset = elem.getBoundingClientRect();
  17024. } else {
  17025. offset = this.offset();
  17026. // Account for the *real* offset parent, which can be the document or its root element
  17027. // when a statically positioned element is identified
  17028. doc = elem.ownerDocument;
  17029. offsetParent = elem.offsetParent || doc.documentElement;
  17030. while ( offsetParent &&
  17031. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17032. jQuery.css( offsetParent, "position" ) === "static" ) {
  17033. offsetParent = offsetParent.parentNode;
  17034. }
  17035. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17036. // Incorporate borders into its offset, since they are outside its content origin
  17037. parentOffset = jQuery( offsetParent ).offset();
  17038. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17039. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17040. }
  17041. }
  17042. // Subtract parent offsets and element margins
  17043. return {
  17044. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17045. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17046. };
  17047. },
  17048. // This method will return documentElement in the following cases:
  17049. // 1) For the element inside the iframe without offsetParent, this method will return
  17050. // documentElement of the parent window
  17051. // 2) For the hidden or detached element
  17052. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17053. //
  17054. // but those exceptions were never presented as a real life use-cases
  17055. // and might be considered as more preferable results.
  17056. //
  17057. // This logic, however, is not guaranteed and can change at any point in the future
  17058. offsetParent: function() {
  17059. return this.map( function() {
  17060. var offsetParent = this.offsetParent;
  17061. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17062. offsetParent = offsetParent.offsetParent;
  17063. }
  17064. return offsetParent || documentElement;
  17065. } );
  17066. }
  17067. } );
  17068. // Create scrollLeft and scrollTop methods
  17069. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17070. var top = "pageYOffset" === prop;
  17071. jQuery.fn[ method ] = function( val ) {
  17072. return access( this, function( elem, method, val ) {
  17073. // Coalesce documents and windows
  17074. var win;
  17075. if ( isWindow( elem ) ) {
  17076. win = elem;
  17077. } else if ( elem.nodeType === 9 ) {
  17078. win = elem.defaultView;
  17079. }
  17080. if ( val === undefined ) {
  17081. return win ? win[ prop ] : elem[ method ];
  17082. }
  17083. if ( win ) {
  17084. win.scrollTo(
  17085. !top ? val : win.pageXOffset,
  17086. top ? val : win.pageYOffset
  17087. );
  17088. } else {
  17089. elem[ method ] = val;
  17090. }
  17091. }, method, val, arguments.length );
  17092. };
  17093. } );
  17094. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17095. // Add the top/left cssHooks using jQuery.fn.position
  17096. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17097. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17098. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17099. // rather than make the css module depend on the offset module, just check for it here
  17100. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17101. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17102. function( elem, computed ) {
  17103. if ( computed ) {
  17104. computed = curCSS( elem, prop );
  17105. // If curCSS returns percentage, fallback to offset
  17106. return rnumnonpx.test( computed ) ?
  17107. jQuery( elem ).position()[ prop ] + "px" :
  17108. computed;
  17109. }
  17110. }
  17111. );
  17112. } );
  17113. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17114. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17115. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17116. function( defaultExtra, funcName ) {
  17117. // Margin is only for outerHeight, outerWidth
  17118. jQuery.fn[ funcName ] = function( margin, value ) {
  17119. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17120. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17121. return access( this, function( elem, type, value ) {
  17122. var doc;
  17123. if ( isWindow( elem ) ) {
  17124. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17125. return funcName.indexOf( "outer" ) === 0 ?
  17126. elem[ "inner" + name ] :
  17127. elem.document.documentElement[ "client" + name ];
  17128. }
  17129. // Get document width or height
  17130. if ( elem.nodeType === 9 ) {
  17131. doc = elem.documentElement;
  17132. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17133. // whichever is greatest
  17134. return Math.max(
  17135. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17136. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17137. doc[ "client" + name ]
  17138. );
  17139. }
  17140. return value === undefined ?
  17141. // Get width or height on the element, requesting but not forcing parseFloat
  17142. jQuery.css( elem, type, extra ) :
  17143. // Set width or height on the element
  17144. jQuery.style( elem, type, value, extra );
  17145. }, type, chainable ? margin : undefined, chainable );
  17146. };
  17147. } );
  17148. } );
  17149. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17150. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17151. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17152. function( i, name ) {
  17153. // Handle event binding
  17154. jQuery.fn[ name ] = function( data, fn ) {
  17155. return arguments.length > 0 ?
  17156. this.on( name, null, data, fn ) :
  17157. this.trigger( name );
  17158. };
  17159. } );
  17160. jQuery.fn.extend( {
  17161. hover: function( fnOver, fnOut ) {
  17162. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17163. }
  17164. } );
  17165. jQuery.fn.extend( {
  17166. bind: function( types, data, fn ) {
  17167. return this.on( types, null, data, fn );
  17168. },
  17169. unbind: function( types, fn ) {
  17170. return this.off( types, null, fn );
  17171. },
  17172. delegate: function( selector, types, data, fn ) {
  17173. return this.on( types, selector, data, fn );
  17174. },
  17175. undelegate: function( selector, types, fn ) {
  17176. // ( namespace ) or ( selector, types [, fn] )
  17177. return arguments.length === 1 ?
  17178. this.off( selector, "**" ) :
  17179. this.off( types, selector || "**", fn );
  17180. }
  17181. } );
  17182. // Bind a function to a context, optionally partially applying any
  17183. // arguments.
  17184. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17185. // However, it is not slated for removal any time soon
  17186. jQuery.proxy = function( fn, context ) {
  17187. var tmp, args, proxy;
  17188. if ( typeof context === "string" ) {
  17189. tmp = fn[ context ];
  17190. context = fn;
  17191. fn = tmp;
  17192. }
  17193. // Quick check to determine if target is callable, in the spec
  17194. // this throws a TypeError, but we will just return undefined.
  17195. if ( !isFunction( fn ) ) {
  17196. return undefined;
  17197. }
  17198. // Simulated bind
  17199. args = slice.call( arguments, 2 );
  17200. proxy = function() {
  17201. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17202. };
  17203. // Set the guid of unique handler to the same of original handler, so it can be removed
  17204. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17205. return proxy;
  17206. };
  17207. jQuery.holdReady = function( hold ) {
  17208. if ( hold ) {
  17209. jQuery.readyWait++;
  17210. } else {
  17211. jQuery.ready( true );
  17212. }
  17213. };
  17214. jQuery.isArray = Array.isArray;
  17215. jQuery.parseJSON = JSON.parse;
  17216. jQuery.nodeName = nodeName;
  17217. jQuery.isFunction = isFunction;
  17218. jQuery.isWindow = isWindow;
  17219. jQuery.camelCase = camelCase;
  17220. jQuery.type = toType;
  17221. jQuery.now = Date.now;
  17222. jQuery.isNumeric = function( obj ) {
  17223. // As of jQuery 3.0, isNumeric is limited to
  17224. // strings and numbers (primitives or objects)
  17225. // that can be coerced to finite numbers (gh-2662)
  17226. var type = jQuery.type( obj );
  17227. return ( type === "number" || type === "string" ) &&
  17228. // parseFloat NaNs numeric-cast false positives ("")
  17229. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17230. // subtraction forces infinities to NaN
  17231. !isNaN( obj - parseFloat( obj ) );
  17232. };
  17233. // Register as a named AMD module, since jQuery can be concatenated with other
  17234. // files that may use define, but not via a proper concatenation script that
  17235. // understands anonymous AMD modules. A named AMD is safest and most robust
  17236. // way to register. Lowercase jquery is used because AMD module names are
  17237. // derived from file names, and jQuery is normally delivered in a lowercase
  17238. // file name. Do this after creating the global so that if an AMD module wants
  17239. // to call noConflict to hide this version of jQuery, it will work.
  17240. // Note that for maximum portability, libraries that are not jQuery should
  17241. // declare themselves as anonymous modules, and avoid setting a global if an
  17242. // AMD loader is present. jQuery is a special case. For more information, see
  17243. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17244. if ( true ) {
  17245. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17246. return jQuery;
  17247. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17248. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17249. }
  17250. var
  17251. // Map over jQuery in case of overwrite
  17252. _jQuery = window.jQuery,
  17253. // Map over the $ in case of overwrite
  17254. _$ = window.$;
  17255. jQuery.noConflict = function( deep ) {
  17256. if ( window.$ === jQuery ) {
  17257. window.$ = _$;
  17258. }
  17259. if ( deep && window.jQuery === jQuery ) {
  17260. window.jQuery = _jQuery;
  17261. }
  17262. return jQuery;
  17263. };
  17264. // Expose jQuery and $ identifiers, even in AMD
  17265. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17266. // and CommonJS for browser emulators (#13566)
  17267. if ( !noGlobal ) {
  17268. window.jQuery = window.$ = jQuery;
  17269. }
  17270. return jQuery;
  17271. } );
  17272. /***/ }),
  17273. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17274. /*!************************************************!*\
  17275. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17276. \************************************************/
  17277. /*! exports provided: default */
  17278. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17279. "use strict";
  17280. __webpack_require__.r(__webpack_exports__);
  17281. var classCallCheck = function (instance, Constructor) {
  17282. if (!(instance instanceof Constructor)) {
  17283. throw new TypeError("Cannot call a class as a function");
  17284. }
  17285. };
  17286. var createClass = function () {
  17287. function defineProperties(target, props) {
  17288. for (var i = 0; i < props.length; i++) {
  17289. var descriptor = props[i];
  17290. descriptor.enumerable = descriptor.enumerable || false;
  17291. descriptor.configurable = true;
  17292. if ("value" in descriptor) descriptor.writable = true;
  17293. Object.defineProperty(target, descriptor.key, descriptor);
  17294. }
  17295. }
  17296. return function (Constructor, protoProps, staticProps) {
  17297. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17298. if (staticProps) defineProperties(Constructor, staticProps);
  17299. return Constructor;
  17300. };
  17301. }();
  17302. var _extends = Object.assign || function (target) {
  17303. for (var i = 1; i < arguments.length; i++) {
  17304. var source = arguments[i];
  17305. for (var key in source) {
  17306. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17307. target[key] = source[key];
  17308. }
  17309. }
  17310. }
  17311. return target;
  17312. };
  17313. var inherits = function (subClass, superClass) {
  17314. if (typeof superClass !== "function" && superClass !== null) {
  17315. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17316. }
  17317. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17318. constructor: {
  17319. value: subClass,
  17320. enumerable: false,
  17321. writable: true,
  17322. configurable: true
  17323. }
  17324. });
  17325. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17326. };
  17327. var possibleConstructorReturn = function (self, call) {
  17328. if (!self) {
  17329. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17330. }
  17331. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17332. };
  17333. var Connector = function () {
  17334. /**
  17335. * Create a new class instance.
  17336. */
  17337. function Connector(options) {
  17338. classCallCheck(this, Connector);
  17339. /**
  17340. * Default connector options.
  17341. */
  17342. this._defaultOptions = {
  17343. auth: {
  17344. headers: {}
  17345. },
  17346. authEndpoint: '/broadcasting/auth',
  17347. broadcaster: 'pusher',
  17348. csrfToken: null,
  17349. host: null,
  17350. key: null,
  17351. namespace: 'App.Events'
  17352. };
  17353. this.setOptions(options);
  17354. this.connect();
  17355. }
  17356. /**
  17357. * Merge the custom options with the defaults.
  17358. */
  17359. createClass(Connector, [{
  17360. key: 'setOptions',
  17361. value: function setOptions(options) {
  17362. this.options = _extends(this._defaultOptions, options);
  17363. if (this.csrfToken()) {
  17364. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17365. }
  17366. return options;
  17367. }
  17368. /**
  17369. * Extract the CSRF token from the page.
  17370. */
  17371. }, {
  17372. key: 'csrfToken',
  17373. value: function csrfToken() {
  17374. var selector = void 0;
  17375. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17376. return window['Laravel'].csrfToken;
  17377. } else if (this.options.csrfToken) {
  17378. return this.options.csrfToken;
  17379. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17380. return selector.getAttribute('content');
  17381. }
  17382. return null;
  17383. }
  17384. }]);
  17385. return Connector;
  17386. }();
  17387. /**
  17388. * This class represents a basic channel.
  17389. */
  17390. var Channel = function () {
  17391. function Channel() {
  17392. classCallCheck(this, Channel);
  17393. }
  17394. createClass(Channel, [{
  17395. key: 'listenForWhisper',
  17396. /**
  17397. * Listen for a whisper event on the channel instance.
  17398. */
  17399. value: function listenForWhisper(event, callback) {
  17400. return this.listen('.client-' + event, callback);
  17401. }
  17402. /**
  17403. * Listen for an event on the channel instance.
  17404. */
  17405. }, {
  17406. key: 'notification',
  17407. value: function notification(callback) {
  17408. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17409. }
  17410. /**
  17411. * Stop listening for a whispser event on the channel instance.
  17412. */
  17413. }, {
  17414. key: 'stopListeningForWhisper',
  17415. value: function stopListeningForWhisper(event) {
  17416. return this.stopListening('.client-' + event);
  17417. }
  17418. }]);
  17419. return Channel;
  17420. }();
  17421. /**
  17422. * Event name formatter
  17423. */
  17424. var EventFormatter = function () {
  17425. /**
  17426. * Create a new class instance.
  17427. */
  17428. function EventFormatter(namespace) {
  17429. classCallCheck(this, EventFormatter);
  17430. this.setNamespace(namespace);
  17431. }
  17432. /**
  17433. * Format the given event name.
  17434. */
  17435. createClass(EventFormatter, [{
  17436. key: 'format',
  17437. value: function format(event) {
  17438. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17439. return event.substr(1);
  17440. } else if (this.namespace) {
  17441. event = this.namespace + '.' + event;
  17442. }
  17443. return event.replace(/\./g, '\\');
  17444. }
  17445. /**
  17446. * Set the event namespace.
  17447. */
  17448. }, {
  17449. key: 'setNamespace',
  17450. value: function setNamespace(value) {
  17451. this.namespace = value;
  17452. }
  17453. }]);
  17454. return EventFormatter;
  17455. }();
  17456. /**
  17457. * This class represents a Pusher channel.
  17458. */
  17459. var PusherChannel = function (_Channel) {
  17460. inherits(PusherChannel, _Channel);
  17461. /**
  17462. * Create a new class instance.
  17463. */
  17464. function PusherChannel(pusher, name, options) {
  17465. classCallCheck(this, PusherChannel);
  17466. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17467. _this.name = name;
  17468. _this.pusher = pusher;
  17469. _this.options = options;
  17470. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17471. _this.subscribe();
  17472. return _this;
  17473. }
  17474. /**
  17475. * Subscribe to a Pusher channel.
  17476. */
  17477. createClass(PusherChannel, [{
  17478. key: 'subscribe',
  17479. value: function subscribe() {
  17480. this.subscription = this.pusher.subscribe(this.name);
  17481. }
  17482. /**
  17483. * Unsubscribe from a Pusher channel.
  17484. */
  17485. }, {
  17486. key: 'unsubscribe',
  17487. value: function unsubscribe() {
  17488. this.pusher.unsubscribe(this.name);
  17489. }
  17490. /**
  17491. * Listen for an event on the channel instance.
  17492. */
  17493. }, {
  17494. key: 'listen',
  17495. value: function listen(event, callback) {
  17496. this.on(this.eventFormatter.format(event), callback);
  17497. return this;
  17498. }
  17499. /**
  17500. * Stop listening for an event on the channel instance.
  17501. */
  17502. }, {
  17503. key: 'stopListening',
  17504. value: function stopListening(event) {
  17505. this.subscription.unbind(this.eventFormatter.format(event));
  17506. return this;
  17507. }
  17508. /**
  17509. * Bind a channel to an event.
  17510. */
  17511. }, {
  17512. key: 'on',
  17513. value: function on(event, callback) {
  17514. this.subscription.bind(event, callback);
  17515. return this;
  17516. }
  17517. }]);
  17518. return PusherChannel;
  17519. }(Channel);
  17520. /**
  17521. * This class represents a Pusher private channel.
  17522. */
  17523. var PusherPrivateChannel = function (_PusherChannel) {
  17524. inherits(PusherPrivateChannel, _PusherChannel);
  17525. function PusherPrivateChannel() {
  17526. classCallCheck(this, PusherPrivateChannel);
  17527. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17528. }
  17529. createClass(PusherPrivateChannel, [{
  17530. key: 'whisper',
  17531. /**
  17532. * Trigger client event on the channel.
  17533. */
  17534. value: function whisper(eventName, data) {
  17535. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17536. return this;
  17537. }
  17538. }]);
  17539. return PusherPrivateChannel;
  17540. }(PusherChannel);
  17541. /**
  17542. * This class represents a Pusher presence channel.
  17543. */
  17544. var PusherPresenceChannel = function (_PusherChannel) {
  17545. inherits(PusherPresenceChannel, _PusherChannel);
  17546. function PusherPresenceChannel() {
  17547. classCallCheck(this, PusherPresenceChannel);
  17548. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17549. }
  17550. createClass(PusherPresenceChannel, [{
  17551. key: 'here',
  17552. /**
  17553. * Register a callback to be called anytime the member list changes.
  17554. */
  17555. value: function here(callback) {
  17556. this.on('pusher:subscription_succeeded', function (data) {
  17557. callback(Object.keys(data.members).map(function (k) {
  17558. return data.members[k];
  17559. }));
  17560. });
  17561. return this;
  17562. }
  17563. /**
  17564. * Listen for someone joining the channel.
  17565. */
  17566. }, {
  17567. key: 'joining',
  17568. value: function joining(callback) {
  17569. this.on('pusher:member_added', function (member) {
  17570. callback(member.info);
  17571. });
  17572. return this;
  17573. }
  17574. /**
  17575. * Listen for someone leaving the channel.
  17576. */
  17577. }, {
  17578. key: 'leaving',
  17579. value: function leaving(callback) {
  17580. this.on('pusher:member_removed', function (member) {
  17581. callback(member.info);
  17582. });
  17583. return this;
  17584. }
  17585. /**
  17586. * Trigger client event on the channel.
  17587. */
  17588. }, {
  17589. key: 'whisper',
  17590. value: function whisper(eventName, data) {
  17591. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17592. return this;
  17593. }
  17594. }]);
  17595. return PusherPresenceChannel;
  17596. }(PusherChannel);
  17597. /**
  17598. * This class represents a Socket.io channel.
  17599. */
  17600. var SocketIoChannel = function (_Channel) {
  17601. inherits(SocketIoChannel, _Channel);
  17602. /**
  17603. * Create a new class instance.
  17604. */
  17605. function SocketIoChannel(socket, name, options) {
  17606. classCallCheck(this, SocketIoChannel);
  17607. /**
  17608. * The event callbacks applied to the channel.
  17609. */
  17610. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17611. _this.events = {};
  17612. _this.name = name;
  17613. _this.socket = socket;
  17614. _this.options = options;
  17615. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17616. _this.subscribe();
  17617. _this.configureReconnector();
  17618. return _this;
  17619. }
  17620. /**
  17621. * Subscribe to a Socket.io channel.
  17622. */
  17623. createClass(SocketIoChannel, [{
  17624. key: 'subscribe',
  17625. value: function subscribe() {
  17626. this.socket.emit('subscribe', {
  17627. channel: this.name,
  17628. auth: this.options.auth || {}
  17629. });
  17630. }
  17631. /**
  17632. * Unsubscribe from channel and ubind event callbacks.
  17633. */
  17634. }, {
  17635. key: 'unsubscribe',
  17636. value: function unsubscribe() {
  17637. this.unbind();
  17638. this.socket.emit('unsubscribe', {
  17639. channel: this.name,
  17640. auth: this.options.auth || {}
  17641. });
  17642. }
  17643. /**
  17644. * Listen for an event on the channel instance.
  17645. */
  17646. }, {
  17647. key: 'listen',
  17648. value: function listen(event, callback) {
  17649. this.on(this.eventFormatter.format(event), callback);
  17650. return this;
  17651. }
  17652. /**
  17653. * Stop listening for an event on the channel instance.
  17654. */
  17655. }, {
  17656. key: 'stopListening',
  17657. value: function stopListening(event) {
  17658. var name = this.eventFormatter.format(event);
  17659. this.socket.removeListener(name);
  17660. delete this.events[name];
  17661. return this;
  17662. }
  17663. /**
  17664. * Bind the channel's socket to an event and store the callback.
  17665. */
  17666. }, {
  17667. key: 'on',
  17668. value: function on(event, callback) {
  17669. var _this2 = this;
  17670. var listener = function listener(channel, data) {
  17671. if (_this2.name == channel) {
  17672. callback(data);
  17673. }
  17674. };
  17675. this.socket.on(event, listener);
  17676. this.bind(event, listener);
  17677. }
  17678. /**
  17679. * Attach a 'reconnect' listener and bind the event.
  17680. */
  17681. }, {
  17682. key: 'configureReconnector',
  17683. value: function configureReconnector() {
  17684. var _this3 = this;
  17685. var listener = function listener() {
  17686. _this3.subscribe();
  17687. };
  17688. this.socket.on('reconnect', listener);
  17689. this.bind('reconnect', listener);
  17690. }
  17691. /**
  17692. * Bind the channel's socket to an event and store the callback.
  17693. */
  17694. }, {
  17695. key: 'bind',
  17696. value: function bind(event, callback) {
  17697. this.events[event] = this.events[event] || [];
  17698. this.events[event].push(callback);
  17699. }
  17700. /**
  17701. * Unbind the channel's socket from all stored event callbacks.
  17702. */
  17703. }, {
  17704. key: 'unbind',
  17705. value: function unbind() {
  17706. var _this4 = this;
  17707. Object.keys(this.events).forEach(function (event) {
  17708. _this4.events[event].forEach(function (callback) {
  17709. _this4.socket.removeListener(event, callback);
  17710. });
  17711. delete _this4.events[event];
  17712. });
  17713. }
  17714. }]);
  17715. return SocketIoChannel;
  17716. }(Channel);
  17717. /**
  17718. * This class represents a Socket.io presence channel.
  17719. */
  17720. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17721. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17722. function SocketIoPrivateChannel() {
  17723. classCallCheck(this, SocketIoPrivateChannel);
  17724. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17725. }
  17726. createClass(SocketIoPrivateChannel, [{
  17727. key: 'whisper',
  17728. /**
  17729. * Trigger client event on the channel.
  17730. */
  17731. value: function whisper(eventName, data) {
  17732. this.socket.emit('client event', {
  17733. channel: this.name,
  17734. event: 'client-' + eventName,
  17735. data: data
  17736. });
  17737. return this;
  17738. }
  17739. }]);
  17740. return SocketIoPrivateChannel;
  17741. }(SocketIoChannel);
  17742. /**
  17743. * This class represents a Socket.io presence channel.
  17744. */
  17745. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17746. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17747. function SocketIoPresenceChannel() {
  17748. classCallCheck(this, SocketIoPresenceChannel);
  17749. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17750. }
  17751. createClass(SocketIoPresenceChannel, [{
  17752. key: 'here',
  17753. /**
  17754. * Register a callback to be called anytime the member list changes.
  17755. */
  17756. value: function here(callback) {
  17757. this.on('presence:subscribed', function (members) {
  17758. callback(members.map(function (m) {
  17759. return m.user_info;
  17760. }));
  17761. });
  17762. return this;
  17763. }
  17764. /**
  17765. * Listen for someone joining the channel.
  17766. */
  17767. }, {
  17768. key: 'joining',
  17769. value: function joining(callback) {
  17770. this.on('presence:joining', function (member) {
  17771. return callback(member.user_info);
  17772. });
  17773. return this;
  17774. }
  17775. /**
  17776. * Listen for someone leaving the channel.
  17777. */
  17778. }, {
  17779. key: 'leaving',
  17780. value: function leaving(callback) {
  17781. this.on('presence:leaving', function (member) {
  17782. return callback(member.user_info);
  17783. });
  17784. return this;
  17785. }
  17786. }]);
  17787. return SocketIoPresenceChannel;
  17788. }(SocketIoPrivateChannel);
  17789. /**
  17790. * This class represents a null channel.
  17791. */
  17792. var NullChannel = function (_Channel) {
  17793. inherits(NullChannel, _Channel);
  17794. function NullChannel() {
  17795. classCallCheck(this, NullChannel);
  17796. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17797. }
  17798. createClass(NullChannel, [{
  17799. key: 'subscribe',
  17800. /**
  17801. * Subscribe to a channel.
  17802. */
  17803. value: function subscribe() {}
  17804. //
  17805. /**
  17806. * Unsubscribe from a channel.
  17807. */
  17808. }, {
  17809. key: 'unsubscribe',
  17810. value: function unsubscribe() {}
  17811. //
  17812. /**
  17813. * Listen for an event on the channel instance.
  17814. */
  17815. }, {
  17816. key: 'listen',
  17817. value: function listen(event, callback) {
  17818. return this;
  17819. }
  17820. /**
  17821. * Stop listening for an event on the channel instance.
  17822. */
  17823. }, {
  17824. key: 'stopListening',
  17825. value: function stopListening(event) {
  17826. return this;
  17827. }
  17828. /**
  17829. * Bind a channel to an event.
  17830. */
  17831. }, {
  17832. key: 'on',
  17833. value: function on(event, callback) {
  17834. return this;
  17835. }
  17836. }]);
  17837. return NullChannel;
  17838. }(Channel);
  17839. /**
  17840. * This class represents a null private channel.
  17841. */
  17842. var NullPrivateChannel = function (_NullChannel) {
  17843. inherits(NullPrivateChannel, _NullChannel);
  17844. function NullPrivateChannel() {
  17845. classCallCheck(this, NullPrivateChannel);
  17846. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17847. }
  17848. createClass(NullPrivateChannel, [{
  17849. key: 'whisper',
  17850. /**
  17851. * Trigger client event on the channel.
  17852. */
  17853. value: function whisper(eventName, data) {
  17854. return this;
  17855. }
  17856. }]);
  17857. return NullPrivateChannel;
  17858. }(NullChannel);
  17859. /**
  17860. * This class represents a null presence channel.
  17861. */
  17862. var NullPresenceChannel = function (_NullChannel) {
  17863. inherits(NullPresenceChannel, _NullChannel);
  17864. function NullPresenceChannel() {
  17865. classCallCheck(this, NullPresenceChannel);
  17866. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17867. }
  17868. createClass(NullPresenceChannel, [{
  17869. key: 'here',
  17870. /**
  17871. * Register a callback to be called anytime the member list changes.
  17872. */
  17873. value: function here(callback) {
  17874. return this;
  17875. }
  17876. /**
  17877. * Listen for someone joining the channel.
  17878. */
  17879. }, {
  17880. key: 'joining',
  17881. value: function joining(callback) {
  17882. return this;
  17883. }
  17884. /**
  17885. * Listen for someone leaving the channel.
  17886. */
  17887. }, {
  17888. key: 'leaving',
  17889. value: function leaving(callback) {
  17890. return this;
  17891. }
  17892. /**
  17893. * Trigger client event on the channel.
  17894. */
  17895. }, {
  17896. key: 'whisper',
  17897. value: function whisper(eventName, data) {
  17898. return this;
  17899. }
  17900. }]);
  17901. return NullPresenceChannel;
  17902. }(NullChannel);
  17903. /**
  17904. * This class creates a connector to Pusher.
  17905. */
  17906. var PusherConnector = function (_Connector) {
  17907. inherits(PusherConnector, _Connector);
  17908. function PusherConnector() {
  17909. classCallCheck(this, PusherConnector);
  17910. /**
  17911. * All of the subscribed channel names.
  17912. */
  17913. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17914. _this.channels = {};
  17915. return _this;
  17916. }
  17917. /**
  17918. * Create a fresh Pusher connection.
  17919. */
  17920. createClass(PusherConnector, [{
  17921. key: 'connect',
  17922. value: function connect() {
  17923. if (typeof this.options.client !== 'undefined') {
  17924. this.pusher = this.options.client;
  17925. } else {
  17926. this.pusher = new Pusher(this.options.key, this.options);
  17927. }
  17928. }
  17929. /**
  17930. * Listen for an event on a channel instance.
  17931. */
  17932. }, {
  17933. key: 'listen',
  17934. value: function listen(name, event, callback) {
  17935. return this.channel(name).listen(event, callback);
  17936. }
  17937. /**
  17938. * Get a channel instance by name.
  17939. */
  17940. }, {
  17941. key: 'channel',
  17942. value: function channel(name) {
  17943. if (!this.channels[name]) {
  17944. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17945. }
  17946. return this.channels[name];
  17947. }
  17948. /**
  17949. * Get a private channel instance by name.
  17950. */
  17951. }, {
  17952. key: 'privateChannel',
  17953. value: function privateChannel(name) {
  17954. if (!this.channels['private-' + name]) {
  17955. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17956. }
  17957. return this.channels['private-' + name];
  17958. }
  17959. /**
  17960. * Get a presence channel instance by name.
  17961. */
  17962. }, {
  17963. key: 'presenceChannel',
  17964. value: function presenceChannel(name) {
  17965. if (!this.channels['presence-' + name]) {
  17966. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17967. }
  17968. return this.channels['presence-' + name];
  17969. }
  17970. /**
  17971. * Leave the given channel, as well as its private and presence variants.
  17972. */
  17973. }, {
  17974. key: 'leave',
  17975. value: function leave(name) {
  17976. var _this2 = this;
  17977. var channels = [name, 'private-' + name, 'presence-' + name];
  17978. channels.forEach(function (name, index) {
  17979. _this2.leaveChannel(name);
  17980. });
  17981. }
  17982. /**
  17983. * Leave the given channel.
  17984. */
  17985. }, {
  17986. key: 'leaveChannel',
  17987. value: function leaveChannel(name) {
  17988. if (this.channels[name]) {
  17989. this.channels[name].unsubscribe();
  17990. delete this.channels[name];
  17991. }
  17992. }
  17993. /**
  17994. * Get the socket ID for the connection.
  17995. */
  17996. }, {
  17997. key: 'socketId',
  17998. value: function socketId() {
  17999. return this.pusher.connection.socket_id;
  18000. }
  18001. /**
  18002. * Disconnect Pusher connection.
  18003. */
  18004. }, {
  18005. key: 'disconnect',
  18006. value: function disconnect() {
  18007. this.pusher.disconnect();
  18008. }
  18009. }]);
  18010. return PusherConnector;
  18011. }(Connector);
  18012. /**
  18013. * This class creates a connnector to a Socket.io server.
  18014. */
  18015. var SocketIoConnector = function (_Connector) {
  18016. inherits(SocketIoConnector, _Connector);
  18017. function SocketIoConnector() {
  18018. classCallCheck(this, SocketIoConnector);
  18019. /**
  18020. * All of the subscribed channel names.
  18021. */
  18022. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18023. _this.channels = {};
  18024. return _this;
  18025. }
  18026. /**
  18027. * Create a fresh Socket.io connection.
  18028. */
  18029. createClass(SocketIoConnector, [{
  18030. key: 'connect',
  18031. value: function connect() {
  18032. var io = this.getSocketIO();
  18033. this.socket = io(this.options.host, this.options);
  18034. return this.socket;
  18035. }
  18036. /**
  18037. * Get socket.io module from global scope or options.
  18038. */
  18039. }, {
  18040. key: 'getSocketIO',
  18041. value: function getSocketIO() {
  18042. if (typeof this.options.client !== 'undefined') {
  18043. return this.options.client;
  18044. }
  18045. if (typeof io !== 'undefined') {
  18046. return io;
  18047. }
  18048. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18049. }
  18050. /**
  18051. * Listen for an event on a channel instance.
  18052. */
  18053. }, {
  18054. key: 'listen',
  18055. value: function listen(name, event, callback) {
  18056. return this.channel(name).listen(event, callback);
  18057. }
  18058. /**
  18059. * Get a channel instance by name.
  18060. */
  18061. }, {
  18062. key: 'channel',
  18063. value: function channel(name) {
  18064. if (!this.channels[name]) {
  18065. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18066. }
  18067. return this.channels[name];
  18068. }
  18069. /**
  18070. * Get a private channel instance by name.
  18071. */
  18072. }, {
  18073. key: 'privateChannel',
  18074. value: function privateChannel(name) {
  18075. if (!this.channels['private-' + name]) {
  18076. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18077. }
  18078. return this.channels['private-' + name];
  18079. }
  18080. /**
  18081. * Get a presence channel instance by name.
  18082. */
  18083. }, {
  18084. key: 'presenceChannel',
  18085. value: function presenceChannel(name) {
  18086. if (!this.channels['presence-' + name]) {
  18087. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18088. }
  18089. return this.channels['presence-' + name];
  18090. }
  18091. /**
  18092. * Leave the given channel, as well as its private and presence variants.
  18093. */
  18094. }, {
  18095. key: 'leave',
  18096. value: function leave(name) {
  18097. var _this2 = this;
  18098. var channels = [name, 'private-' + name, 'presence-' + name];
  18099. channels.forEach(function (name) {
  18100. _this2.leaveChannel(name);
  18101. });
  18102. }
  18103. /**
  18104. * Leave the given channel.
  18105. */
  18106. }, {
  18107. key: 'leaveChannel',
  18108. value: function leaveChannel(name) {
  18109. if (this.channels[name]) {
  18110. this.channels[name].unsubscribe();
  18111. delete this.channels[name];
  18112. }
  18113. }
  18114. /**
  18115. * Get the socket ID for the connection.
  18116. */
  18117. }, {
  18118. key: 'socketId',
  18119. value: function socketId() {
  18120. return this.socket.id;
  18121. }
  18122. /**
  18123. * Disconnect Socketio connection.
  18124. */
  18125. }, {
  18126. key: 'disconnect',
  18127. value: function disconnect() {
  18128. this.socket.disconnect();
  18129. }
  18130. }]);
  18131. return SocketIoConnector;
  18132. }(Connector);
  18133. /**
  18134. * This class creates a null connector.
  18135. */
  18136. var NullConnector = function (_Connector) {
  18137. inherits(NullConnector, _Connector);
  18138. function NullConnector() {
  18139. classCallCheck(this, NullConnector);
  18140. /**
  18141. * All of the subscribed channel names.
  18142. */
  18143. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18144. _this.channels = {};
  18145. return _this;
  18146. }
  18147. /**
  18148. * Create a fresh connection.
  18149. */
  18150. createClass(NullConnector, [{
  18151. key: 'connect',
  18152. value: function connect() {}
  18153. //
  18154. /**
  18155. * Listen for an event on a channel instance.
  18156. */
  18157. }, {
  18158. key: 'listen',
  18159. value: function listen(name, event, callback) {
  18160. return new NullChannel();
  18161. }
  18162. /**
  18163. * Get a channel instance by name.
  18164. */
  18165. }, {
  18166. key: 'channel',
  18167. value: function channel(name) {
  18168. return new NullChannel();
  18169. }
  18170. /**
  18171. * Get a private channel instance by name.
  18172. */
  18173. }, {
  18174. key: 'privateChannel',
  18175. value: function privateChannel(name) {
  18176. return new NullPrivateChannel();
  18177. }
  18178. /**
  18179. * Get a presence channel instance by name.
  18180. */
  18181. }, {
  18182. key: 'presenceChannel',
  18183. value: function presenceChannel(name) {
  18184. return new NullPresenceChannel();
  18185. }
  18186. /**
  18187. * Leave the given channel, as well as its private and presence variants.
  18188. */
  18189. }, {
  18190. key: 'leave',
  18191. value: function leave(name) {}
  18192. //
  18193. /**
  18194. * Leave the given channel.
  18195. */
  18196. }, {
  18197. key: 'leaveChannel',
  18198. value: function leaveChannel(name) {}
  18199. //
  18200. /**
  18201. * Get the socket ID for the connection.
  18202. */
  18203. }, {
  18204. key: 'socketId',
  18205. value: function socketId() {
  18206. return 'fake-socket-id';
  18207. }
  18208. /**
  18209. * Disconnect the connection.
  18210. */
  18211. }, {
  18212. key: 'disconnect',
  18213. value: function disconnect() {
  18214. //
  18215. }
  18216. }]);
  18217. return NullConnector;
  18218. }(Connector);
  18219. /**
  18220. * This class is the primary API for interacting with broadcasting.
  18221. */
  18222. var Echo = function () {
  18223. /**
  18224. * Create a new class instance.
  18225. */
  18226. function Echo(options) {
  18227. classCallCheck(this, Echo);
  18228. this.options = options;
  18229. this.connect();
  18230. if (!this.options.withoutInterceptors) {
  18231. this.registerInterceptors();
  18232. }
  18233. }
  18234. /**
  18235. * Get a channel instance by name.
  18236. */
  18237. createClass(Echo, [{
  18238. key: 'channel',
  18239. value: function channel(_channel) {
  18240. return this.connector.channel(_channel);
  18241. }
  18242. /**
  18243. * Create a new connection.
  18244. */
  18245. }, {
  18246. key: 'connect',
  18247. value: function connect() {
  18248. if (this.options.broadcaster == 'pusher') {
  18249. this.connector = new PusherConnector(this.options);
  18250. } else if (this.options.broadcaster == 'socket.io') {
  18251. this.connector = new SocketIoConnector(this.options);
  18252. } else if (this.options.broadcaster == 'null') {
  18253. this.connector = new NullConnector(this.options);
  18254. } else if (typeof this.options.broadcaster == 'function') {
  18255. this.connector = new this.options.broadcaster(this.options);
  18256. }
  18257. }
  18258. /**
  18259. * Disconnect from the Echo server.
  18260. */
  18261. }, {
  18262. key: 'disconnect',
  18263. value: function disconnect() {
  18264. this.connector.disconnect();
  18265. }
  18266. /**
  18267. * Get a presence channel instance by name.
  18268. */
  18269. }, {
  18270. key: 'join',
  18271. value: function join(channel) {
  18272. return this.connector.presenceChannel(channel);
  18273. }
  18274. /**
  18275. * Leave the given channel, as well as its private and presence variants.
  18276. */
  18277. }, {
  18278. key: 'leave',
  18279. value: function leave(channel) {
  18280. this.connector.leave(channel);
  18281. }
  18282. /**
  18283. * Leave the given channel.
  18284. */
  18285. }, {
  18286. key: 'leaveChannel',
  18287. value: function leaveChannel(channel) {
  18288. this.connector.leaveChannel(channel);
  18289. }
  18290. /**
  18291. * Listen for an event on a channel instance.
  18292. */
  18293. }, {
  18294. key: 'listen',
  18295. value: function listen(channel, event, callback) {
  18296. return this.connector.listen(channel, event, callback);
  18297. }
  18298. /**
  18299. * Get a private channel instance by name.
  18300. */
  18301. }, {
  18302. key: 'private',
  18303. value: function _private(channel) {
  18304. return this.connector.privateChannel(channel);
  18305. }
  18306. /**
  18307. * Get the Socket ID for the connection.
  18308. */
  18309. }, {
  18310. key: 'socketId',
  18311. value: function socketId() {
  18312. return this.connector.socketId();
  18313. }
  18314. /**
  18315. * Register 3rd party request interceptiors. These are used to automatically
  18316. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18317. */
  18318. }, {
  18319. key: 'registerInterceptors',
  18320. value: function registerInterceptors() {
  18321. if (typeof Vue === 'function' && Vue.http) {
  18322. this.registerVueRequestInterceptor();
  18323. }
  18324. if (typeof axios === 'function') {
  18325. this.registerAxiosRequestInterceptor();
  18326. }
  18327. if (typeof jQuery === 'function') {
  18328. this.registerjQueryAjaxSetup();
  18329. }
  18330. }
  18331. /**
  18332. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18333. */
  18334. }, {
  18335. key: 'registerVueRequestInterceptor',
  18336. value: function registerVueRequestInterceptor() {
  18337. var _this = this;
  18338. Vue.http.interceptors.push(function (request, next) {
  18339. if (_this.socketId()) {
  18340. request.headers.set('X-Socket-ID', _this.socketId());
  18341. }
  18342. next();
  18343. });
  18344. }
  18345. /**
  18346. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18347. */
  18348. }, {
  18349. key: 'registerAxiosRequestInterceptor',
  18350. value: function registerAxiosRequestInterceptor() {
  18351. var _this2 = this;
  18352. axios.interceptors.request.use(function (config) {
  18353. if (_this2.socketId()) {
  18354. config.headers['X-Socket-Id'] = _this2.socketId();
  18355. }
  18356. return config;
  18357. });
  18358. }
  18359. /**
  18360. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18361. */
  18362. }, {
  18363. key: 'registerjQueryAjaxSetup',
  18364. value: function registerjQueryAjaxSetup() {
  18365. var _this3 = this;
  18366. if (typeof jQuery.ajax != 'undefined') {
  18367. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18368. if (_this3.socketId()) {
  18369. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18370. }
  18371. });
  18372. }
  18373. }
  18374. }]);
  18375. return Echo;
  18376. }();
  18377. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18378. /***/ }),
  18379. /***/ "./node_modules/lodash/lodash.js":
  18380. /*!***************************************!*\
  18381. !*** ./node_modules/lodash/lodash.js ***!
  18382. \***************************************/
  18383. /*! no static exports found */
  18384. /***/ (function(module, exports, __webpack_require__) {
  18385. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18386. * @license
  18387. * Lodash <https://lodash.com/>
  18388. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18389. * Released under MIT license <https://lodash.com/license>
  18390. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18391. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18392. */
  18393. ;(function() {
  18394. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18395. var undefined;
  18396. /** Used as the semantic version number. */
  18397. var VERSION = '4.17.15';
  18398. /** Used as the size to enable large array optimizations. */
  18399. var LARGE_ARRAY_SIZE = 200;
  18400. /** Error message constants. */
  18401. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18402. FUNC_ERROR_TEXT = 'Expected a function';
  18403. /** Used to stand-in for `undefined` hash values. */
  18404. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18405. /** Used as the maximum memoize cache size. */
  18406. var MAX_MEMOIZE_SIZE = 500;
  18407. /** Used as the internal argument placeholder. */
  18408. var PLACEHOLDER = '__lodash_placeholder__';
  18409. /** Used to compose bitmasks for cloning. */
  18410. var CLONE_DEEP_FLAG = 1,
  18411. CLONE_FLAT_FLAG = 2,
  18412. CLONE_SYMBOLS_FLAG = 4;
  18413. /** Used to compose bitmasks for value comparisons. */
  18414. var COMPARE_PARTIAL_FLAG = 1,
  18415. COMPARE_UNORDERED_FLAG = 2;
  18416. /** Used to compose bitmasks for function metadata. */
  18417. var WRAP_BIND_FLAG = 1,
  18418. WRAP_BIND_KEY_FLAG = 2,
  18419. WRAP_CURRY_BOUND_FLAG = 4,
  18420. WRAP_CURRY_FLAG = 8,
  18421. WRAP_CURRY_RIGHT_FLAG = 16,
  18422. WRAP_PARTIAL_FLAG = 32,
  18423. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18424. WRAP_ARY_FLAG = 128,
  18425. WRAP_REARG_FLAG = 256,
  18426. WRAP_FLIP_FLAG = 512;
  18427. /** Used as default options for `_.truncate`. */
  18428. var DEFAULT_TRUNC_LENGTH = 30,
  18429. DEFAULT_TRUNC_OMISSION = '...';
  18430. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18431. var HOT_COUNT = 800,
  18432. HOT_SPAN = 16;
  18433. /** Used to indicate the type of lazy iteratees. */
  18434. var LAZY_FILTER_FLAG = 1,
  18435. LAZY_MAP_FLAG = 2,
  18436. LAZY_WHILE_FLAG = 3;
  18437. /** Used as references for various `Number` constants. */
  18438. var INFINITY = 1 / 0,
  18439. MAX_SAFE_INTEGER = 9007199254740991,
  18440. MAX_INTEGER = 1.7976931348623157e+308,
  18441. NAN = 0 / 0;
  18442. /** Used as references for the maximum length and index of an array. */
  18443. var MAX_ARRAY_LENGTH = 4294967295,
  18444. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18445. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18446. /** Used to associate wrap methods with their bit flags. */
  18447. var wrapFlags = [
  18448. ['ary', WRAP_ARY_FLAG],
  18449. ['bind', WRAP_BIND_FLAG],
  18450. ['bindKey', WRAP_BIND_KEY_FLAG],
  18451. ['curry', WRAP_CURRY_FLAG],
  18452. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18453. ['flip', WRAP_FLIP_FLAG],
  18454. ['partial', WRAP_PARTIAL_FLAG],
  18455. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18456. ['rearg', WRAP_REARG_FLAG]
  18457. ];
  18458. /** `Object#toString` result references. */
  18459. var argsTag = '[object Arguments]',
  18460. arrayTag = '[object Array]',
  18461. asyncTag = '[object AsyncFunction]',
  18462. boolTag = '[object Boolean]',
  18463. dateTag = '[object Date]',
  18464. domExcTag = '[object DOMException]',
  18465. errorTag = '[object Error]',
  18466. funcTag = '[object Function]',
  18467. genTag = '[object GeneratorFunction]',
  18468. mapTag = '[object Map]',
  18469. numberTag = '[object Number]',
  18470. nullTag = '[object Null]',
  18471. objectTag = '[object Object]',
  18472. promiseTag = '[object Promise]',
  18473. proxyTag = '[object Proxy]',
  18474. regexpTag = '[object RegExp]',
  18475. setTag = '[object Set]',
  18476. stringTag = '[object String]',
  18477. symbolTag = '[object Symbol]',
  18478. undefinedTag = '[object Undefined]',
  18479. weakMapTag = '[object WeakMap]',
  18480. weakSetTag = '[object WeakSet]';
  18481. var arrayBufferTag = '[object ArrayBuffer]',
  18482. dataViewTag = '[object DataView]',
  18483. float32Tag = '[object Float32Array]',
  18484. float64Tag = '[object Float64Array]',
  18485. int8Tag = '[object Int8Array]',
  18486. int16Tag = '[object Int16Array]',
  18487. int32Tag = '[object Int32Array]',
  18488. uint8Tag = '[object Uint8Array]',
  18489. uint8ClampedTag = '[object Uint8ClampedArray]',
  18490. uint16Tag = '[object Uint16Array]',
  18491. uint32Tag = '[object Uint32Array]';
  18492. /** Used to match empty string literals in compiled template source. */
  18493. var reEmptyStringLeading = /\b__p \+= '';/g,
  18494. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18495. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18496. /** Used to match HTML entities and HTML characters. */
  18497. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18498. reUnescapedHtml = /[&<>"']/g,
  18499. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18500. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18501. /** Used to match template delimiters. */
  18502. var reEscape = /<%-([\s\S]+?)%>/g,
  18503. reEvaluate = /<%([\s\S]+?)%>/g,
  18504. reInterpolate = /<%=([\s\S]+?)%>/g;
  18505. /** Used to match property names within property paths. */
  18506. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18507. reIsPlainProp = /^\w*$/,
  18508. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18509. /**
  18510. * Used to match `RegExp`
  18511. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18512. */
  18513. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18514. reHasRegExpChar = RegExp(reRegExpChar.source);
  18515. /** Used to match leading and trailing whitespace. */
  18516. var reTrim = /^\s+|\s+$/g,
  18517. reTrimStart = /^\s+/,
  18518. reTrimEnd = /\s+$/;
  18519. /** Used to match wrap detail comments. */
  18520. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18521. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18522. reSplitDetails = /,? & /;
  18523. /** Used to match words composed of alphanumeric characters. */
  18524. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18525. /** Used to match backslashes in property paths. */
  18526. var reEscapeChar = /\\(\\)?/g;
  18527. /**
  18528. * Used to match
  18529. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18530. */
  18531. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18532. /** Used to match `RegExp` flags from their coerced string values. */
  18533. var reFlags = /\w*$/;
  18534. /** Used to detect bad signed hexadecimal string values. */
  18535. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18536. /** Used to detect binary string values. */
  18537. var reIsBinary = /^0b[01]+$/i;
  18538. /** Used to detect host constructors (Safari). */
  18539. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18540. /** Used to detect octal string values. */
  18541. var reIsOctal = /^0o[0-7]+$/i;
  18542. /** Used to detect unsigned integer values. */
  18543. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18544. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18545. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18546. /** Used to ensure capturing order of template delimiters. */
  18547. var reNoMatch = /($^)/;
  18548. /** Used to match unescaped characters in compiled string literals. */
  18549. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18550. /** Used to compose unicode character classes. */
  18551. var rsAstralRange = '\\ud800-\\udfff',
  18552. rsComboMarksRange = '\\u0300-\\u036f',
  18553. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18554. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18555. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18556. rsDingbatRange = '\\u2700-\\u27bf',
  18557. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18558. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18559. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18560. rsPunctuationRange = '\\u2000-\\u206f',
  18561. 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',
  18562. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18563. rsVarRange = '\\ufe0e\\ufe0f',
  18564. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18565. /** Used to compose unicode capture groups. */
  18566. var rsApos = "['\u2019]",
  18567. rsAstral = '[' + rsAstralRange + ']',
  18568. rsBreak = '[' + rsBreakRange + ']',
  18569. rsCombo = '[' + rsComboRange + ']',
  18570. rsDigits = '\\d+',
  18571. rsDingbat = '[' + rsDingbatRange + ']',
  18572. rsLower = '[' + rsLowerRange + ']',
  18573. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18574. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18575. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18576. rsNonAstral = '[^' + rsAstralRange + ']',
  18577. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18578. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18579. rsUpper = '[' + rsUpperRange + ']',
  18580. rsZWJ = '\\u200d';
  18581. /** Used to compose unicode regexes. */
  18582. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18583. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18584. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18585. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18586. reOptMod = rsModifier + '?',
  18587. rsOptVar = '[' + rsVarRange + ']?',
  18588. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18589. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18590. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18591. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18592. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18593. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18594. /** Used to match apostrophes. */
  18595. var reApos = RegExp(rsApos, 'g');
  18596. /**
  18597. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18598. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18599. */
  18600. var reComboMark = RegExp(rsCombo, 'g');
  18601. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18602. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18603. /** Used to match complex or compound words. */
  18604. var reUnicodeWord = RegExp([
  18605. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18606. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18607. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18608. rsUpper + '+' + rsOptContrUpper,
  18609. rsOrdUpper,
  18610. rsOrdLower,
  18611. rsDigits,
  18612. rsEmoji
  18613. ].join('|'), 'g');
  18614. /** 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/). */
  18615. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18616. /** Used to detect strings that need a more robust regexp to match words. */
  18617. 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 ]/;
  18618. /** Used to assign default `context` object properties. */
  18619. var contextProps = [
  18620. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18621. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18622. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18623. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18624. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18625. ];
  18626. /** Used to make template sourceURLs easier to identify. */
  18627. var templateCounter = -1;
  18628. /** Used to identify `toStringTag` values of typed arrays. */
  18629. var typedArrayTags = {};
  18630. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18631. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18632. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18633. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18634. typedArrayTags[uint32Tag] = true;
  18635. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18636. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18637. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18638. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18639. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18640. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18641. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18642. typedArrayTags[weakMapTag] = false;
  18643. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18644. var cloneableTags = {};
  18645. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18646. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18647. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18648. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18649. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18650. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18651. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18652. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18653. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18654. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18655. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18656. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18657. cloneableTags[weakMapTag] = false;
  18658. /** Used to map Latin Unicode letters to basic Latin letters. */
  18659. var deburredLetters = {
  18660. // Latin-1 Supplement block.
  18661. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18662. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18663. '\xc7': 'C', '\xe7': 'c',
  18664. '\xd0': 'D', '\xf0': 'd',
  18665. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18666. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18667. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18668. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18669. '\xd1': 'N', '\xf1': 'n',
  18670. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18671. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18672. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18673. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18674. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18675. '\xc6': 'Ae', '\xe6': 'ae',
  18676. '\xde': 'Th', '\xfe': 'th',
  18677. '\xdf': 'ss',
  18678. // Latin Extended-A block.
  18679. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18680. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18681. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18682. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18683. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18684. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18685. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18686. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18687. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18688. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18689. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18690. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18691. '\u0134': 'J', '\u0135': 'j',
  18692. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18693. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18694. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18695. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18696. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18697. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18698. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18699. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18700. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18701. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18702. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18703. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18704. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18705. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18706. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18707. '\u0174': 'W', '\u0175': 'w',
  18708. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18709. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18710. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18711. '\u0132': 'IJ', '\u0133': 'ij',
  18712. '\u0152': 'Oe', '\u0153': 'oe',
  18713. '\u0149': "'n", '\u017f': 's'
  18714. };
  18715. /** Used to map characters to HTML entities. */
  18716. var htmlEscapes = {
  18717. '&': '&amp;',
  18718. '<': '&lt;',
  18719. '>': '&gt;',
  18720. '"': '&quot;',
  18721. "'": '&#39;'
  18722. };
  18723. /** Used to map HTML entities to characters. */
  18724. var htmlUnescapes = {
  18725. '&amp;': '&',
  18726. '&lt;': '<',
  18727. '&gt;': '>',
  18728. '&quot;': '"',
  18729. '&#39;': "'"
  18730. };
  18731. /** Used to escape characters for inclusion in compiled string literals. */
  18732. var stringEscapes = {
  18733. '\\': '\\',
  18734. "'": "'",
  18735. '\n': 'n',
  18736. '\r': 'r',
  18737. '\u2028': 'u2028',
  18738. '\u2029': 'u2029'
  18739. };
  18740. /** Built-in method references without a dependency on `root`. */
  18741. var freeParseFloat = parseFloat,
  18742. freeParseInt = parseInt;
  18743. /** Detect free variable `global` from Node.js. */
  18744. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18745. /** Detect free variable `self`. */
  18746. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18747. /** Used as a reference to the global object. */
  18748. var root = freeGlobal || freeSelf || Function('return this')();
  18749. /** Detect free variable `exports`. */
  18750. var freeExports = true && exports && !exports.nodeType && exports;
  18751. /** Detect free variable `module`. */
  18752. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18753. /** Detect the popular CommonJS extension `module.exports`. */
  18754. var moduleExports = freeModule && freeModule.exports === freeExports;
  18755. /** Detect free variable `process` from Node.js. */
  18756. var freeProcess = moduleExports && freeGlobal.process;
  18757. /** Used to access faster Node.js helpers. */
  18758. var nodeUtil = (function() {
  18759. try {
  18760. // Use `util.types` for Node.js 10+.
  18761. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18762. if (types) {
  18763. return types;
  18764. }
  18765. // Legacy `process.binding('util')` for Node.js < 10.
  18766. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18767. } catch (e) {}
  18768. }());
  18769. /* Node.js helper references. */
  18770. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18771. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18772. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18773. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18774. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18775. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18776. /*--------------------------------------------------------------------------*/
  18777. /**
  18778. * A faster alternative to `Function#apply`, this function invokes `func`
  18779. * with the `this` binding of `thisArg` and the arguments of `args`.
  18780. *
  18781. * @private
  18782. * @param {Function} func The function to invoke.
  18783. * @param {*} thisArg The `this` binding of `func`.
  18784. * @param {Array} args The arguments to invoke `func` with.
  18785. * @returns {*} Returns the result of `func`.
  18786. */
  18787. function apply(func, thisArg, args) {
  18788. switch (args.length) {
  18789. case 0: return func.call(thisArg);
  18790. case 1: return func.call(thisArg, args[0]);
  18791. case 2: return func.call(thisArg, args[0], args[1]);
  18792. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18793. }
  18794. return func.apply(thisArg, args);
  18795. }
  18796. /**
  18797. * A specialized version of `baseAggregator` for arrays.
  18798. *
  18799. * @private
  18800. * @param {Array} [array] The array to iterate over.
  18801. * @param {Function} setter The function to set `accumulator` values.
  18802. * @param {Function} iteratee The iteratee to transform keys.
  18803. * @param {Object} accumulator The initial aggregated object.
  18804. * @returns {Function} Returns `accumulator`.
  18805. */
  18806. function arrayAggregator(array, setter, iteratee, accumulator) {
  18807. var index = -1,
  18808. length = array == null ? 0 : array.length;
  18809. while (++index < length) {
  18810. var value = array[index];
  18811. setter(accumulator, value, iteratee(value), array);
  18812. }
  18813. return accumulator;
  18814. }
  18815. /**
  18816. * A specialized version of `_.forEach` for arrays without support for
  18817. * iteratee shorthands.
  18818. *
  18819. * @private
  18820. * @param {Array} [array] The array to iterate over.
  18821. * @param {Function} iteratee The function invoked per iteration.
  18822. * @returns {Array} Returns `array`.
  18823. */
  18824. function arrayEach(array, iteratee) {
  18825. var index = -1,
  18826. length = array == null ? 0 : array.length;
  18827. while (++index < length) {
  18828. if (iteratee(array[index], index, array) === false) {
  18829. break;
  18830. }
  18831. }
  18832. return array;
  18833. }
  18834. /**
  18835. * A specialized version of `_.forEachRight` for arrays without support for
  18836. * iteratee shorthands.
  18837. *
  18838. * @private
  18839. * @param {Array} [array] The array to iterate over.
  18840. * @param {Function} iteratee The function invoked per iteration.
  18841. * @returns {Array} Returns `array`.
  18842. */
  18843. function arrayEachRight(array, iteratee) {
  18844. var length = array == null ? 0 : array.length;
  18845. while (length--) {
  18846. if (iteratee(array[length], length, array) === false) {
  18847. break;
  18848. }
  18849. }
  18850. return array;
  18851. }
  18852. /**
  18853. * A specialized version of `_.every` for arrays without support for
  18854. * iteratee shorthands.
  18855. *
  18856. * @private
  18857. * @param {Array} [array] The array to iterate over.
  18858. * @param {Function} predicate The function invoked per iteration.
  18859. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18860. * else `false`.
  18861. */
  18862. function arrayEvery(array, predicate) {
  18863. var index = -1,
  18864. length = array == null ? 0 : array.length;
  18865. while (++index < length) {
  18866. if (!predicate(array[index], index, array)) {
  18867. return false;
  18868. }
  18869. }
  18870. return true;
  18871. }
  18872. /**
  18873. * A specialized version of `_.filter` for arrays without support for
  18874. * iteratee shorthands.
  18875. *
  18876. * @private
  18877. * @param {Array} [array] The array to iterate over.
  18878. * @param {Function} predicate The function invoked per iteration.
  18879. * @returns {Array} Returns the new filtered array.
  18880. */
  18881. function arrayFilter(array, predicate) {
  18882. var index = -1,
  18883. length = array == null ? 0 : array.length,
  18884. resIndex = 0,
  18885. result = [];
  18886. while (++index < length) {
  18887. var value = array[index];
  18888. if (predicate(value, index, array)) {
  18889. result[resIndex++] = value;
  18890. }
  18891. }
  18892. return result;
  18893. }
  18894. /**
  18895. * A specialized version of `_.includes` for arrays without support for
  18896. * specifying an index to search from.
  18897. *
  18898. * @private
  18899. * @param {Array} [array] The array to inspect.
  18900. * @param {*} target The value to search for.
  18901. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18902. */
  18903. function arrayIncludes(array, value) {
  18904. var length = array == null ? 0 : array.length;
  18905. return !!length && baseIndexOf(array, value, 0) > -1;
  18906. }
  18907. /**
  18908. * This function is like `arrayIncludes` except that it accepts a comparator.
  18909. *
  18910. * @private
  18911. * @param {Array} [array] The array to inspect.
  18912. * @param {*} target The value to search for.
  18913. * @param {Function} comparator The comparator invoked per element.
  18914. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18915. */
  18916. function arrayIncludesWith(array, value, comparator) {
  18917. var index = -1,
  18918. length = array == null ? 0 : array.length;
  18919. while (++index < length) {
  18920. if (comparator(value, array[index])) {
  18921. return true;
  18922. }
  18923. }
  18924. return false;
  18925. }
  18926. /**
  18927. * A specialized version of `_.map` for arrays without support for iteratee
  18928. * shorthands.
  18929. *
  18930. * @private
  18931. * @param {Array} [array] The array to iterate over.
  18932. * @param {Function} iteratee The function invoked per iteration.
  18933. * @returns {Array} Returns the new mapped array.
  18934. */
  18935. function arrayMap(array, iteratee) {
  18936. var index = -1,
  18937. length = array == null ? 0 : array.length,
  18938. result = Array(length);
  18939. while (++index < length) {
  18940. result[index] = iteratee(array[index], index, array);
  18941. }
  18942. return result;
  18943. }
  18944. /**
  18945. * Appends the elements of `values` to `array`.
  18946. *
  18947. * @private
  18948. * @param {Array} array The array to modify.
  18949. * @param {Array} values The values to append.
  18950. * @returns {Array} Returns `array`.
  18951. */
  18952. function arrayPush(array, values) {
  18953. var index = -1,
  18954. length = values.length,
  18955. offset = array.length;
  18956. while (++index < length) {
  18957. array[offset + index] = values[index];
  18958. }
  18959. return array;
  18960. }
  18961. /**
  18962. * A specialized version of `_.reduce` for arrays without support for
  18963. * iteratee shorthands.
  18964. *
  18965. * @private
  18966. * @param {Array} [array] The array to iterate over.
  18967. * @param {Function} iteratee The function invoked per iteration.
  18968. * @param {*} [accumulator] The initial value.
  18969. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18970. * the initial value.
  18971. * @returns {*} Returns the accumulated value.
  18972. */
  18973. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18974. var index = -1,
  18975. length = array == null ? 0 : array.length;
  18976. if (initAccum && length) {
  18977. accumulator = array[++index];
  18978. }
  18979. while (++index < length) {
  18980. accumulator = iteratee(accumulator, array[index], index, array);
  18981. }
  18982. return accumulator;
  18983. }
  18984. /**
  18985. * A specialized version of `_.reduceRight` for arrays without support for
  18986. * iteratee shorthands.
  18987. *
  18988. * @private
  18989. * @param {Array} [array] The array to iterate over.
  18990. * @param {Function} iteratee The function invoked per iteration.
  18991. * @param {*} [accumulator] The initial value.
  18992. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18993. * the initial value.
  18994. * @returns {*} Returns the accumulated value.
  18995. */
  18996. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18997. var length = array == null ? 0 : array.length;
  18998. if (initAccum && length) {
  18999. accumulator = array[--length];
  19000. }
  19001. while (length--) {
  19002. accumulator = iteratee(accumulator, array[length], length, array);
  19003. }
  19004. return accumulator;
  19005. }
  19006. /**
  19007. * A specialized version of `_.some` for arrays without support for iteratee
  19008. * shorthands.
  19009. *
  19010. * @private
  19011. * @param {Array} [array] The array to iterate over.
  19012. * @param {Function} predicate The function invoked per iteration.
  19013. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19014. * else `false`.
  19015. */
  19016. function arraySome(array, predicate) {
  19017. var index = -1,
  19018. length = array == null ? 0 : array.length;
  19019. while (++index < length) {
  19020. if (predicate(array[index], index, array)) {
  19021. return true;
  19022. }
  19023. }
  19024. return false;
  19025. }
  19026. /**
  19027. * Gets the size of an ASCII `string`.
  19028. *
  19029. * @private
  19030. * @param {string} string The string inspect.
  19031. * @returns {number} Returns the string size.
  19032. */
  19033. var asciiSize = baseProperty('length');
  19034. /**
  19035. * Converts an ASCII `string` to an array.
  19036. *
  19037. * @private
  19038. * @param {string} string The string to convert.
  19039. * @returns {Array} Returns the converted array.
  19040. */
  19041. function asciiToArray(string) {
  19042. return string.split('');
  19043. }
  19044. /**
  19045. * Splits an ASCII `string` into an array of its words.
  19046. *
  19047. * @private
  19048. * @param {string} The string to inspect.
  19049. * @returns {Array} Returns the words of `string`.
  19050. */
  19051. function asciiWords(string) {
  19052. return string.match(reAsciiWord) || [];
  19053. }
  19054. /**
  19055. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19056. * without support for iteratee shorthands, which iterates over `collection`
  19057. * using `eachFunc`.
  19058. *
  19059. * @private
  19060. * @param {Array|Object} collection The collection to inspect.
  19061. * @param {Function} predicate The function invoked per iteration.
  19062. * @param {Function} eachFunc The function to iterate over `collection`.
  19063. * @returns {*} Returns the found element or its key, else `undefined`.
  19064. */
  19065. function baseFindKey(collection, predicate, eachFunc) {
  19066. var result;
  19067. eachFunc(collection, function(value, key, collection) {
  19068. if (predicate(value, key, collection)) {
  19069. result = key;
  19070. return false;
  19071. }
  19072. });
  19073. return result;
  19074. }
  19075. /**
  19076. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19077. * support for iteratee shorthands.
  19078. *
  19079. * @private
  19080. * @param {Array} array The array to inspect.
  19081. * @param {Function} predicate The function invoked per iteration.
  19082. * @param {number} fromIndex The index to search from.
  19083. * @param {boolean} [fromRight] Specify iterating from right to left.
  19084. * @returns {number} Returns the index of the matched value, else `-1`.
  19085. */
  19086. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19087. var length = array.length,
  19088. index = fromIndex + (fromRight ? 1 : -1);
  19089. while ((fromRight ? index-- : ++index < length)) {
  19090. if (predicate(array[index], index, array)) {
  19091. return index;
  19092. }
  19093. }
  19094. return -1;
  19095. }
  19096. /**
  19097. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19098. *
  19099. * @private
  19100. * @param {Array} array The array to inspect.
  19101. * @param {*} value The value to search for.
  19102. * @param {number} fromIndex The index to search from.
  19103. * @returns {number} Returns the index of the matched value, else `-1`.
  19104. */
  19105. function baseIndexOf(array, value, fromIndex) {
  19106. return value === value
  19107. ? strictIndexOf(array, value, fromIndex)
  19108. : baseFindIndex(array, baseIsNaN, fromIndex);
  19109. }
  19110. /**
  19111. * This function is like `baseIndexOf` except that it accepts a comparator.
  19112. *
  19113. * @private
  19114. * @param {Array} array The array to inspect.
  19115. * @param {*} value The value to search for.
  19116. * @param {number} fromIndex The index to search from.
  19117. * @param {Function} comparator The comparator invoked per element.
  19118. * @returns {number} Returns the index of the matched value, else `-1`.
  19119. */
  19120. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19121. var index = fromIndex - 1,
  19122. length = array.length;
  19123. while (++index < length) {
  19124. if (comparator(array[index], value)) {
  19125. return index;
  19126. }
  19127. }
  19128. return -1;
  19129. }
  19130. /**
  19131. * The base implementation of `_.isNaN` without support for number objects.
  19132. *
  19133. * @private
  19134. * @param {*} value The value to check.
  19135. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19136. */
  19137. function baseIsNaN(value) {
  19138. return value !== value;
  19139. }
  19140. /**
  19141. * The base implementation of `_.mean` and `_.meanBy` without support for
  19142. * iteratee shorthands.
  19143. *
  19144. * @private
  19145. * @param {Array} array The array to iterate over.
  19146. * @param {Function} iteratee The function invoked per iteration.
  19147. * @returns {number} Returns the mean.
  19148. */
  19149. function baseMean(array, iteratee) {
  19150. var length = array == null ? 0 : array.length;
  19151. return length ? (baseSum(array, iteratee) / length) : NAN;
  19152. }
  19153. /**
  19154. * The base implementation of `_.property` without support for deep paths.
  19155. *
  19156. * @private
  19157. * @param {string} key The key of the property to get.
  19158. * @returns {Function} Returns the new accessor function.
  19159. */
  19160. function baseProperty(key) {
  19161. return function(object) {
  19162. return object == null ? undefined : object[key];
  19163. };
  19164. }
  19165. /**
  19166. * The base implementation of `_.propertyOf` without support for deep paths.
  19167. *
  19168. * @private
  19169. * @param {Object} object The object to query.
  19170. * @returns {Function} Returns the new accessor function.
  19171. */
  19172. function basePropertyOf(object) {
  19173. return function(key) {
  19174. return object == null ? undefined : object[key];
  19175. };
  19176. }
  19177. /**
  19178. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19179. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19180. *
  19181. * @private
  19182. * @param {Array|Object} collection The collection to iterate over.
  19183. * @param {Function} iteratee The function invoked per iteration.
  19184. * @param {*} accumulator The initial value.
  19185. * @param {boolean} initAccum Specify using the first or last element of
  19186. * `collection` as the initial value.
  19187. * @param {Function} eachFunc The function to iterate over `collection`.
  19188. * @returns {*} Returns the accumulated value.
  19189. */
  19190. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19191. eachFunc(collection, function(value, index, collection) {
  19192. accumulator = initAccum
  19193. ? (initAccum = false, value)
  19194. : iteratee(accumulator, value, index, collection);
  19195. });
  19196. return accumulator;
  19197. }
  19198. /**
  19199. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19200. * sort order of `array` and replaces criteria objects with their corresponding
  19201. * values.
  19202. *
  19203. * @private
  19204. * @param {Array} array The array to sort.
  19205. * @param {Function} comparer The function to define sort order.
  19206. * @returns {Array} Returns `array`.
  19207. */
  19208. function baseSortBy(array, comparer) {
  19209. var length = array.length;
  19210. array.sort(comparer);
  19211. while (length--) {
  19212. array[length] = array[length].value;
  19213. }
  19214. return array;
  19215. }
  19216. /**
  19217. * The base implementation of `_.sum` and `_.sumBy` without support for
  19218. * iteratee shorthands.
  19219. *
  19220. * @private
  19221. * @param {Array} array The array to iterate over.
  19222. * @param {Function} iteratee The function invoked per iteration.
  19223. * @returns {number} Returns the sum.
  19224. */
  19225. function baseSum(array, iteratee) {
  19226. var result,
  19227. index = -1,
  19228. length = array.length;
  19229. while (++index < length) {
  19230. var current = iteratee(array[index]);
  19231. if (current !== undefined) {
  19232. result = result === undefined ? current : (result + current);
  19233. }
  19234. }
  19235. return result;
  19236. }
  19237. /**
  19238. * The base implementation of `_.times` without support for iteratee shorthands
  19239. * or max array length checks.
  19240. *
  19241. * @private
  19242. * @param {number} n The number of times to invoke `iteratee`.
  19243. * @param {Function} iteratee The function invoked per iteration.
  19244. * @returns {Array} Returns the array of results.
  19245. */
  19246. function baseTimes(n, iteratee) {
  19247. var index = -1,
  19248. result = Array(n);
  19249. while (++index < n) {
  19250. result[index] = iteratee(index);
  19251. }
  19252. return result;
  19253. }
  19254. /**
  19255. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19256. * of key-value pairs for `object` corresponding to the property names of `props`.
  19257. *
  19258. * @private
  19259. * @param {Object} object The object to query.
  19260. * @param {Array} props The property names to get values for.
  19261. * @returns {Object} Returns the key-value pairs.
  19262. */
  19263. function baseToPairs(object, props) {
  19264. return arrayMap(props, function(key) {
  19265. return [key, object[key]];
  19266. });
  19267. }
  19268. /**
  19269. * The base implementation of `_.unary` without support for storing metadata.
  19270. *
  19271. * @private
  19272. * @param {Function} func The function to cap arguments for.
  19273. * @returns {Function} Returns the new capped function.
  19274. */
  19275. function baseUnary(func) {
  19276. return function(value) {
  19277. return func(value);
  19278. };
  19279. }
  19280. /**
  19281. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19282. * array of `object` property values corresponding to the property names
  19283. * of `props`.
  19284. *
  19285. * @private
  19286. * @param {Object} object The object to query.
  19287. * @param {Array} props The property names to get values for.
  19288. * @returns {Object} Returns the array of property values.
  19289. */
  19290. function baseValues(object, props) {
  19291. return arrayMap(props, function(key) {
  19292. return object[key];
  19293. });
  19294. }
  19295. /**
  19296. * Checks if a `cache` value for `key` exists.
  19297. *
  19298. * @private
  19299. * @param {Object} cache The cache to query.
  19300. * @param {string} key The key of the entry to check.
  19301. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19302. */
  19303. function cacheHas(cache, key) {
  19304. return cache.has(key);
  19305. }
  19306. /**
  19307. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19308. * that is not found in the character symbols.
  19309. *
  19310. * @private
  19311. * @param {Array} strSymbols The string symbols to inspect.
  19312. * @param {Array} chrSymbols The character symbols to find.
  19313. * @returns {number} Returns the index of the first unmatched string symbol.
  19314. */
  19315. function charsStartIndex(strSymbols, chrSymbols) {
  19316. var index = -1,
  19317. length = strSymbols.length;
  19318. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19319. return index;
  19320. }
  19321. /**
  19322. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19323. * that is not found in the character symbols.
  19324. *
  19325. * @private
  19326. * @param {Array} strSymbols The string symbols to inspect.
  19327. * @param {Array} chrSymbols The character symbols to find.
  19328. * @returns {number} Returns the index of the last unmatched string symbol.
  19329. */
  19330. function charsEndIndex(strSymbols, chrSymbols) {
  19331. var index = strSymbols.length;
  19332. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19333. return index;
  19334. }
  19335. /**
  19336. * Gets the number of `placeholder` occurrences in `array`.
  19337. *
  19338. * @private
  19339. * @param {Array} array The array to inspect.
  19340. * @param {*} placeholder The placeholder to search for.
  19341. * @returns {number} Returns the placeholder count.
  19342. */
  19343. function countHolders(array, placeholder) {
  19344. var length = array.length,
  19345. result = 0;
  19346. while (length--) {
  19347. if (array[length] === placeholder) {
  19348. ++result;
  19349. }
  19350. }
  19351. return result;
  19352. }
  19353. /**
  19354. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19355. * letters to basic Latin letters.
  19356. *
  19357. * @private
  19358. * @param {string} letter The matched letter to deburr.
  19359. * @returns {string} Returns the deburred letter.
  19360. */
  19361. var deburrLetter = basePropertyOf(deburredLetters);
  19362. /**
  19363. * Used by `_.escape` to convert characters to HTML entities.
  19364. *
  19365. * @private
  19366. * @param {string} chr The matched character to escape.
  19367. * @returns {string} Returns the escaped character.
  19368. */
  19369. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19370. /**
  19371. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19372. *
  19373. * @private
  19374. * @param {string} chr The matched character to escape.
  19375. * @returns {string} Returns the escaped character.
  19376. */
  19377. function escapeStringChar(chr) {
  19378. return '\\' + stringEscapes[chr];
  19379. }
  19380. /**
  19381. * Gets the value at `key` of `object`.
  19382. *
  19383. * @private
  19384. * @param {Object} [object] The object to query.
  19385. * @param {string} key The key of the property to get.
  19386. * @returns {*} Returns the property value.
  19387. */
  19388. function getValue(object, key) {
  19389. return object == null ? undefined : object[key];
  19390. }
  19391. /**
  19392. * Checks if `string` contains Unicode symbols.
  19393. *
  19394. * @private
  19395. * @param {string} string The string to inspect.
  19396. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19397. */
  19398. function hasUnicode(string) {
  19399. return reHasUnicode.test(string);
  19400. }
  19401. /**
  19402. * Checks if `string` contains a word composed of Unicode symbols.
  19403. *
  19404. * @private
  19405. * @param {string} string The string to inspect.
  19406. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19407. */
  19408. function hasUnicodeWord(string) {
  19409. return reHasUnicodeWord.test(string);
  19410. }
  19411. /**
  19412. * Converts `iterator` to an array.
  19413. *
  19414. * @private
  19415. * @param {Object} iterator The iterator to convert.
  19416. * @returns {Array} Returns the converted array.
  19417. */
  19418. function iteratorToArray(iterator) {
  19419. var data,
  19420. result = [];
  19421. while (!(data = iterator.next()).done) {
  19422. result.push(data.value);
  19423. }
  19424. return result;
  19425. }
  19426. /**
  19427. * Converts `map` to its key-value pairs.
  19428. *
  19429. * @private
  19430. * @param {Object} map The map to convert.
  19431. * @returns {Array} Returns the key-value pairs.
  19432. */
  19433. function mapToArray(map) {
  19434. var index = -1,
  19435. result = Array(map.size);
  19436. map.forEach(function(value, key) {
  19437. result[++index] = [key, value];
  19438. });
  19439. return result;
  19440. }
  19441. /**
  19442. * Creates a unary function that invokes `func` with its argument transformed.
  19443. *
  19444. * @private
  19445. * @param {Function} func The function to wrap.
  19446. * @param {Function} transform The argument transform.
  19447. * @returns {Function} Returns the new function.
  19448. */
  19449. function overArg(func, transform) {
  19450. return function(arg) {
  19451. return func(transform(arg));
  19452. };
  19453. }
  19454. /**
  19455. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19456. * and returns an array of their indexes.
  19457. *
  19458. * @private
  19459. * @param {Array} array The array to modify.
  19460. * @param {*} placeholder The placeholder to replace.
  19461. * @returns {Array} Returns the new array of placeholder indexes.
  19462. */
  19463. function replaceHolders(array, placeholder) {
  19464. var index = -1,
  19465. length = array.length,
  19466. resIndex = 0,
  19467. result = [];
  19468. while (++index < length) {
  19469. var value = array[index];
  19470. if (value === placeholder || value === PLACEHOLDER) {
  19471. array[index] = PLACEHOLDER;
  19472. result[resIndex++] = index;
  19473. }
  19474. }
  19475. return result;
  19476. }
  19477. /**
  19478. * Converts `set` to an array of its values.
  19479. *
  19480. * @private
  19481. * @param {Object} set The set to convert.
  19482. * @returns {Array} Returns the values.
  19483. */
  19484. function setToArray(set) {
  19485. var index = -1,
  19486. result = Array(set.size);
  19487. set.forEach(function(value) {
  19488. result[++index] = value;
  19489. });
  19490. return result;
  19491. }
  19492. /**
  19493. * Converts `set` to its value-value pairs.
  19494. *
  19495. * @private
  19496. * @param {Object} set The set to convert.
  19497. * @returns {Array} Returns the value-value pairs.
  19498. */
  19499. function setToPairs(set) {
  19500. var index = -1,
  19501. result = Array(set.size);
  19502. set.forEach(function(value) {
  19503. result[++index] = [value, value];
  19504. });
  19505. return result;
  19506. }
  19507. /**
  19508. * A specialized version of `_.indexOf` which performs strict equality
  19509. * comparisons of values, i.e. `===`.
  19510. *
  19511. * @private
  19512. * @param {Array} array The array to inspect.
  19513. * @param {*} value The value to search for.
  19514. * @param {number} fromIndex The index to search from.
  19515. * @returns {number} Returns the index of the matched value, else `-1`.
  19516. */
  19517. function strictIndexOf(array, value, fromIndex) {
  19518. var index = fromIndex - 1,
  19519. length = array.length;
  19520. while (++index < length) {
  19521. if (array[index] === value) {
  19522. return index;
  19523. }
  19524. }
  19525. return -1;
  19526. }
  19527. /**
  19528. * A specialized version of `_.lastIndexOf` which performs strict equality
  19529. * comparisons of values, i.e. `===`.
  19530. *
  19531. * @private
  19532. * @param {Array} array The array to inspect.
  19533. * @param {*} value The value to search for.
  19534. * @param {number} fromIndex The index to search from.
  19535. * @returns {number} Returns the index of the matched value, else `-1`.
  19536. */
  19537. function strictLastIndexOf(array, value, fromIndex) {
  19538. var index = fromIndex + 1;
  19539. while (index--) {
  19540. if (array[index] === value) {
  19541. return index;
  19542. }
  19543. }
  19544. return index;
  19545. }
  19546. /**
  19547. * Gets the number of symbols in `string`.
  19548. *
  19549. * @private
  19550. * @param {string} string The string to inspect.
  19551. * @returns {number} Returns the string size.
  19552. */
  19553. function stringSize(string) {
  19554. return hasUnicode(string)
  19555. ? unicodeSize(string)
  19556. : asciiSize(string);
  19557. }
  19558. /**
  19559. * Converts `string` to an array.
  19560. *
  19561. * @private
  19562. * @param {string} string The string to convert.
  19563. * @returns {Array} Returns the converted array.
  19564. */
  19565. function stringToArray(string) {
  19566. return hasUnicode(string)
  19567. ? unicodeToArray(string)
  19568. : asciiToArray(string);
  19569. }
  19570. /**
  19571. * Used by `_.unescape` to convert HTML entities to characters.
  19572. *
  19573. * @private
  19574. * @param {string} chr The matched character to unescape.
  19575. * @returns {string} Returns the unescaped character.
  19576. */
  19577. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19578. /**
  19579. * Gets the size of a Unicode `string`.
  19580. *
  19581. * @private
  19582. * @param {string} string The string inspect.
  19583. * @returns {number} Returns the string size.
  19584. */
  19585. function unicodeSize(string) {
  19586. var result = reUnicode.lastIndex = 0;
  19587. while (reUnicode.test(string)) {
  19588. ++result;
  19589. }
  19590. return result;
  19591. }
  19592. /**
  19593. * Converts a Unicode `string` to an array.
  19594. *
  19595. * @private
  19596. * @param {string} string The string to convert.
  19597. * @returns {Array} Returns the converted array.
  19598. */
  19599. function unicodeToArray(string) {
  19600. return string.match(reUnicode) || [];
  19601. }
  19602. /**
  19603. * Splits a Unicode `string` into an array of its words.
  19604. *
  19605. * @private
  19606. * @param {string} The string to inspect.
  19607. * @returns {Array} Returns the words of `string`.
  19608. */
  19609. function unicodeWords(string) {
  19610. return string.match(reUnicodeWord) || [];
  19611. }
  19612. /*--------------------------------------------------------------------------*/
  19613. /**
  19614. * Create a new pristine `lodash` function using the `context` object.
  19615. *
  19616. * @static
  19617. * @memberOf _
  19618. * @since 1.1.0
  19619. * @category Util
  19620. * @param {Object} [context=root] The context object.
  19621. * @returns {Function} Returns a new `lodash` function.
  19622. * @example
  19623. *
  19624. * _.mixin({ 'foo': _.constant('foo') });
  19625. *
  19626. * var lodash = _.runInContext();
  19627. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19628. *
  19629. * _.isFunction(_.foo);
  19630. * // => true
  19631. * _.isFunction(_.bar);
  19632. * // => false
  19633. *
  19634. * lodash.isFunction(lodash.foo);
  19635. * // => false
  19636. * lodash.isFunction(lodash.bar);
  19637. * // => true
  19638. *
  19639. * // Create a suped-up `defer` in Node.js.
  19640. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19641. */
  19642. var runInContext = (function runInContext(context) {
  19643. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19644. /** Built-in constructor references. */
  19645. var Array = context.Array,
  19646. Date = context.Date,
  19647. Error = context.Error,
  19648. Function = context.Function,
  19649. Math = context.Math,
  19650. Object = context.Object,
  19651. RegExp = context.RegExp,
  19652. String = context.String,
  19653. TypeError = context.TypeError;
  19654. /** Used for built-in method references. */
  19655. var arrayProto = Array.prototype,
  19656. funcProto = Function.prototype,
  19657. objectProto = Object.prototype;
  19658. /** Used to detect overreaching core-js shims. */
  19659. var coreJsData = context['__core-js_shared__'];
  19660. /** Used to resolve the decompiled source of functions. */
  19661. var funcToString = funcProto.toString;
  19662. /** Used to check objects for own properties. */
  19663. var hasOwnProperty = objectProto.hasOwnProperty;
  19664. /** Used to generate unique IDs. */
  19665. var idCounter = 0;
  19666. /** Used to detect methods masquerading as native. */
  19667. var maskSrcKey = (function() {
  19668. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19669. return uid ? ('Symbol(src)_1.' + uid) : '';
  19670. }());
  19671. /**
  19672. * Used to resolve the
  19673. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19674. * of values.
  19675. */
  19676. var nativeObjectToString = objectProto.toString;
  19677. /** Used to infer the `Object` constructor. */
  19678. var objectCtorString = funcToString.call(Object);
  19679. /** Used to restore the original `_` reference in `_.noConflict`. */
  19680. var oldDash = root._;
  19681. /** Used to detect if a method is native. */
  19682. var reIsNative = RegExp('^' +
  19683. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19684. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19685. );
  19686. /** Built-in value references. */
  19687. var Buffer = moduleExports ? context.Buffer : undefined,
  19688. Symbol = context.Symbol,
  19689. Uint8Array = context.Uint8Array,
  19690. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19691. getPrototype = overArg(Object.getPrototypeOf, Object),
  19692. objectCreate = Object.create,
  19693. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19694. splice = arrayProto.splice,
  19695. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19696. symIterator = Symbol ? Symbol.iterator : undefined,
  19697. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19698. var defineProperty = (function() {
  19699. try {
  19700. var func = getNative(Object, 'defineProperty');
  19701. func({}, '', {});
  19702. return func;
  19703. } catch (e) {}
  19704. }());
  19705. /** Mocked built-ins. */
  19706. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19707. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19708. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19709. /* Built-in method references for those with the same name as other `lodash` methods. */
  19710. var nativeCeil = Math.ceil,
  19711. nativeFloor = Math.floor,
  19712. nativeGetSymbols = Object.getOwnPropertySymbols,
  19713. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19714. nativeIsFinite = context.isFinite,
  19715. nativeJoin = arrayProto.join,
  19716. nativeKeys = overArg(Object.keys, Object),
  19717. nativeMax = Math.max,
  19718. nativeMin = Math.min,
  19719. nativeNow = Date.now,
  19720. nativeParseInt = context.parseInt,
  19721. nativeRandom = Math.random,
  19722. nativeReverse = arrayProto.reverse;
  19723. /* Built-in method references that are verified to be native. */
  19724. var DataView = getNative(context, 'DataView'),
  19725. Map = getNative(context, 'Map'),
  19726. Promise = getNative(context, 'Promise'),
  19727. Set = getNative(context, 'Set'),
  19728. WeakMap = getNative(context, 'WeakMap'),
  19729. nativeCreate = getNative(Object, 'create');
  19730. /** Used to store function metadata. */
  19731. var metaMap = WeakMap && new WeakMap;
  19732. /** Used to lookup unminified function names. */
  19733. var realNames = {};
  19734. /** Used to detect maps, sets, and weakmaps. */
  19735. var dataViewCtorString = toSource(DataView),
  19736. mapCtorString = toSource(Map),
  19737. promiseCtorString = toSource(Promise),
  19738. setCtorString = toSource(Set),
  19739. weakMapCtorString = toSource(WeakMap);
  19740. /** Used to convert symbols to primitives and strings. */
  19741. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19742. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19743. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19744. /*------------------------------------------------------------------------*/
  19745. /**
  19746. * Creates a `lodash` object which wraps `value` to enable implicit method
  19747. * chain sequences. Methods that operate on and return arrays, collections,
  19748. * and functions can be chained together. Methods that retrieve a single value
  19749. * or may return a primitive value will automatically end the chain sequence
  19750. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19751. * with `_#value`.
  19752. *
  19753. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19754. * enabled using `_.chain`.
  19755. *
  19756. * The execution of chained methods is lazy, that is, it's deferred until
  19757. * `_#value` is implicitly or explicitly called.
  19758. *
  19759. * Lazy evaluation allows several methods to support shortcut fusion.
  19760. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19761. * the creation of intermediate arrays and can greatly reduce the number of
  19762. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19763. * fusion if the section is applied to an array and iteratees accept only
  19764. * one argument. The heuristic for whether a section qualifies for shortcut
  19765. * fusion is subject to change.
  19766. *
  19767. * Chaining is supported in custom builds as long as the `_#value` method is
  19768. * directly or indirectly included in the build.
  19769. *
  19770. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19771. *
  19772. * The wrapper `Array` methods are:
  19773. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19774. *
  19775. * The wrapper `String` methods are:
  19776. * `replace` and `split`
  19777. *
  19778. * The wrapper methods that support shortcut fusion are:
  19779. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19780. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19781. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19782. *
  19783. * The chainable wrapper methods are:
  19784. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19785. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19786. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19787. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19788. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19789. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19790. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19791. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19792. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19793. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19794. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19795. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19796. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19797. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19798. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19799. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19800. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19801. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19802. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19803. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19804. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19805. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19806. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19807. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19808. *
  19809. * The wrapper methods that are **not** chainable by default are:
  19810. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19811. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19812. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19813. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19814. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19815. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19816. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19817. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19818. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19819. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19820. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19821. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19822. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19823. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19824. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19825. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19826. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19827. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19828. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19829. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19830. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19831. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19832. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19833. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19834. * `upperFirst`, `value`, and `words`
  19835. *
  19836. * @name _
  19837. * @constructor
  19838. * @category Seq
  19839. * @param {*} value The value to wrap in a `lodash` instance.
  19840. * @returns {Object} Returns the new `lodash` wrapper instance.
  19841. * @example
  19842. *
  19843. * function square(n) {
  19844. * return n * n;
  19845. * }
  19846. *
  19847. * var wrapped = _([1, 2, 3]);
  19848. *
  19849. * // Returns an unwrapped value.
  19850. * wrapped.reduce(_.add);
  19851. * // => 6
  19852. *
  19853. * // Returns a wrapped value.
  19854. * var squares = wrapped.map(square);
  19855. *
  19856. * _.isArray(squares);
  19857. * // => false
  19858. *
  19859. * _.isArray(squares.value());
  19860. * // => true
  19861. */
  19862. function lodash(value) {
  19863. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19864. if (value instanceof LodashWrapper) {
  19865. return value;
  19866. }
  19867. if (hasOwnProperty.call(value, '__wrapped__')) {
  19868. return wrapperClone(value);
  19869. }
  19870. }
  19871. return new LodashWrapper(value);
  19872. }
  19873. /**
  19874. * The base implementation of `_.create` without support for assigning
  19875. * properties to the created object.
  19876. *
  19877. * @private
  19878. * @param {Object} proto The object to inherit from.
  19879. * @returns {Object} Returns the new object.
  19880. */
  19881. var baseCreate = (function() {
  19882. function object() {}
  19883. return function(proto) {
  19884. if (!isObject(proto)) {
  19885. return {};
  19886. }
  19887. if (objectCreate) {
  19888. return objectCreate(proto);
  19889. }
  19890. object.prototype = proto;
  19891. var result = new object;
  19892. object.prototype = undefined;
  19893. return result;
  19894. };
  19895. }());
  19896. /**
  19897. * The function whose prototype chain sequence wrappers inherit from.
  19898. *
  19899. * @private
  19900. */
  19901. function baseLodash() {
  19902. // No operation performed.
  19903. }
  19904. /**
  19905. * The base constructor for creating `lodash` wrapper objects.
  19906. *
  19907. * @private
  19908. * @param {*} value The value to wrap.
  19909. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19910. */
  19911. function LodashWrapper(value, chainAll) {
  19912. this.__wrapped__ = value;
  19913. this.__actions__ = [];
  19914. this.__chain__ = !!chainAll;
  19915. this.__index__ = 0;
  19916. this.__values__ = undefined;
  19917. }
  19918. /**
  19919. * By default, the template delimiters used by lodash are like those in
  19920. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19921. * following template settings to use alternative delimiters.
  19922. *
  19923. * @static
  19924. * @memberOf _
  19925. * @type {Object}
  19926. */
  19927. lodash.templateSettings = {
  19928. /**
  19929. * Used to detect `data` property values to be HTML-escaped.
  19930. *
  19931. * @memberOf _.templateSettings
  19932. * @type {RegExp}
  19933. */
  19934. 'escape': reEscape,
  19935. /**
  19936. * Used to detect code to be evaluated.
  19937. *
  19938. * @memberOf _.templateSettings
  19939. * @type {RegExp}
  19940. */
  19941. 'evaluate': reEvaluate,
  19942. /**
  19943. * Used to detect `data` property values to inject.
  19944. *
  19945. * @memberOf _.templateSettings
  19946. * @type {RegExp}
  19947. */
  19948. 'interpolate': reInterpolate,
  19949. /**
  19950. * Used to reference the data object in the template text.
  19951. *
  19952. * @memberOf _.templateSettings
  19953. * @type {string}
  19954. */
  19955. 'variable': '',
  19956. /**
  19957. * Used to import variables into the compiled template.
  19958. *
  19959. * @memberOf _.templateSettings
  19960. * @type {Object}
  19961. */
  19962. 'imports': {
  19963. /**
  19964. * A reference to the `lodash` function.
  19965. *
  19966. * @memberOf _.templateSettings.imports
  19967. * @type {Function}
  19968. */
  19969. '_': lodash
  19970. }
  19971. };
  19972. // Ensure wrappers are instances of `baseLodash`.
  19973. lodash.prototype = baseLodash.prototype;
  19974. lodash.prototype.constructor = lodash;
  19975. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19976. LodashWrapper.prototype.constructor = LodashWrapper;
  19977. /*------------------------------------------------------------------------*/
  19978. /**
  19979. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19980. *
  19981. * @private
  19982. * @constructor
  19983. * @param {*} value The value to wrap.
  19984. */
  19985. function LazyWrapper(value) {
  19986. this.__wrapped__ = value;
  19987. this.__actions__ = [];
  19988. this.__dir__ = 1;
  19989. this.__filtered__ = false;
  19990. this.__iteratees__ = [];
  19991. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19992. this.__views__ = [];
  19993. }
  19994. /**
  19995. * Creates a clone of the lazy wrapper object.
  19996. *
  19997. * @private
  19998. * @name clone
  19999. * @memberOf LazyWrapper
  20000. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20001. */
  20002. function lazyClone() {
  20003. var result = new LazyWrapper(this.__wrapped__);
  20004. result.__actions__ = copyArray(this.__actions__);
  20005. result.__dir__ = this.__dir__;
  20006. result.__filtered__ = this.__filtered__;
  20007. result.__iteratees__ = copyArray(this.__iteratees__);
  20008. result.__takeCount__ = this.__takeCount__;
  20009. result.__views__ = copyArray(this.__views__);
  20010. return result;
  20011. }
  20012. /**
  20013. * Reverses the direction of lazy iteration.
  20014. *
  20015. * @private
  20016. * @name reverse
  20017. * @memberOf LazyWrapper
  20018. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20019. */
  20020. function lazyReverse() {
  20021. if (this.__filtered__) {
  20022. var result = new LazyWrapper(this);
  20023. result.__dir__ = -1;
  20024. result.__filtered__ = true;
  20025. } else {
  20026. result = this.clone();
  20027. result.__dir__ *= -1;
  20028. }
  20029. return result;
  20030. }
  20031. /**
  20032. * Extracts the unwrapped value from its lazy wrapper.
  20033. *
  20034. * @private
  20035. * @name value
  20036. * @memberOf LazyWrapper
  20037. * @returns {*} Returns the unwrapped value.
  20038. */
  20039. function lazyValue() {
  20040. var array = this.__wrapped__.value(),
  20041. dir = this.__dir__,
  20042. isArr = isArray(array),
  20043. isRight = dir < 0,
  20044. arrLength = isArr ? array.length : 0,
  20045. view = getView(0, arrLength, this.__views__),
  20046. start = view.start,
  20047. end = view.end,
  20048. length = end - start,
  20049. index = isRight ? end : (start - 1),
  20050. iteratees = this.__iteratees__,
  20051. iterLength = iteratees.length,
  20052. resIndex = 0,
  20053. takeCount = nativeMin(length, this.__takeCount__);
  20054. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20055. return baseWrapperValue(array, this.__actions__);
  20056. }
  20057. var result = [];
  20058. outer:
  20059. while (length-- && resIndex < takeCount) {
  20060. index += dir;
  20061. var iterIndex = -1,
  20062. value = array[index];
  20063. while (++iterIndex < iterLength) {
  20064. var data = iteratees[iterIndex],
  20065. iteratee = data.iteratee,
  20066. type = data.type,
  20067. computed = iteratee(value);
  20068. if (type == LAZY_MAP_FLAG) {
  20069. value = computed;
  20070. } else if (!computed) {
  20071. if (type == LAZY_FILTER_FLAG) {
  20072. continue outer;
  20073. } else {
  20074. break outer;
  20075. }
  20076. }
  20077. }
  20078. result[resIndex++] = value;
  20079. }
  20080. return result;
  20081. }
  20082. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20083. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20084. LazyWrapper.prototype.constructor = LazyWrapper;
  20085. /*------------------------------------------------------------------------*/
  20086. /**
  20087. * Creates a hash object.
  20088. *
  20089. * @private
  20090. * @constructor
  20091. * @param {Array} [entries] The key-value pairs to cache.
  20092. */
  20093. function Hash(entries) {
  20094. var index = -1,
  20095. length = entries == null ? 0 : entries.length;
  20096. this.clear();
  20097. while (++index < length) {
  20098. var entry = entries[index];
  20099. this.set(entry[0], entry[1]);
  20100. }
  20101. }
  20102. /**
  20103. * Removes all key-value entries from the hash.
  20104. *
  20105. * @private
  20106. * @name clear
  20107. * @memberOf Hash
  20108. */
  20109. function hashClear() {
  20110. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20111. this.size = 0;
  20112. }
  20113. /**
  20114. * Removes `key` and its value from the hash.
  20115. *
  20116. * @private
  20117. * @name delete
  20118. * @memberOf Hash
  20119. * @param {Object} hash The hash to modify.
  20120. * @param {string} key The key of the value to remove.
  20121. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20122. */
  20123. function hashDelete(key) {
  20124. var result = this.has(key) && delete this.__data__[key];
  20125. this.size -= result ? 1 : 0;
  20126. return result;
  20127. }
  20128. /**
  20129. * Gets the hash value for `key`.
  20130. *
  20131. * @private
  20132. * @name get
  20133. * @memberOf Hash
  20134. * @param {string} key The key of the value to get.
  20135. * @returns {*} Returns the entry value.
  20136. */
  20137. function hashGet(key) {
  20138. var data = this.__data__;
  20139. if (nativeCreate) {
  20140. var result = data[key];
  20141. return result === HASH_UNDEFINED ? undefined : result;
  20142. }
  20143. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20144. }
  20145. /**
  20146. * Checks if a hash value for `key` exists.
  20147. *
  20148. * @private
  20149. * @name has
  20150. * @memberOf Hash
  20151. * @param {string} key The key of the entry to check.
  20152. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20153. */
  20154. function hashHas(key) {
  20155. var data = this.__data__;
  20156. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20157. }
  20158. /**
  20159. * Sets the hash `key` to `value`.
  20160. *
  20161. * @private
  20162. * @name set
  20163. * @memberOf Hash
  20164. * @param {string} key The key of the value to set.
  20165. * @param {*} value The value to set.
  20166. * @returns {Object} Returns the hash instance.
  20167. */
  20168. function hashSet(key, value) {
  20169. var data = this.__data__;
  20170. this.size += this.has(key) ? 0 : 1;
  20171. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20172. return this;
  20173. }
  20174. // Add methods to `Hash`.
  20175. Hash.prototype.clear = hashClear;
  20176. Hash.prototype['delete'] = hashDelete;
  20177. Hash.prototype.get = hashGet;
  20178. Hash.prototype.has = hashHas;
  20179. Hash.prototype.set = hashSet;
  20180. /*------------------------------------------------------------------------*/
  20181. /**
  20182. * Creates an list cache object.
  20183. *
  20184. * @private
  20185. * @constructor
  20186. * @param {Array} [entries] The key-value pairs to cache.
  20187. */
  20188. function ListCache(entries) {
  20189. var index = -1,
  20190. length = entries == null ? 0 : entries.length;
  20191. this.clear();
  20192. while (++index < length) {
  20193. var entry = entries[index];
  20194. this.set(entry[0], entry[1]);
  20195. }
  20196. }
  20197. /**
  20198. * Removes all key-value entries from the list cache.
  20199. *
  20200. * @private
  20201. * @name clear
  20202. * @memberOf ListCache
  20203. */
  20204. function listCacheClear() {
  20205. this.__data__ = [];
  20206. this.size = 0;
  20207. }
  20208. /**
  20209. * Removes `key` and its value from the list cache.
  20210. *
  20211. * @private
  20212. * @name delete
  20213. * @memberOf ListCache
  20214. * @param {string} key The key of the value to remove.
  20215. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20216. */
  20217. function listCacheDelete(key) {
  20218. var data = this.__data__,
  20219. index = assocIndexOf(data, key);
  20220. if (index < 0) {
  20221. return false;
  20222. }
  20223. var lastIndex = data.length - 1;
  20224. if (index == lastIndex) {
  20225. data.pop();
  20226. } else {
  20227. splice.call(data, index, 1);
  20228. }
  20229. --this.size;
  20230. return true;
  20231. }
  20232. /**
  20233. * Gets the list cache value for `key`.
  20234. *
  20235. * @private
  20236. * @name get
  20237. * @memberOf ListCache
  20238. * @param {string} key The key of the value to get.
  20239. * @returns {*} Returns the entry value.
  20240. */
  20241. function listCacheGet(key) {
  20242. var data = this.__data__,
  20243. index = assocIndexOf(data, key);
  20244. return index < 0 ? undefined : data[index][1];
  20245. }
  20246. /**
  20247. * Checks if a list cache value for `key` exists.
  20248. *
  20249. * @private
  20250. * @name has
  20251. * @memberOf ListCache
  20252. * @param {string} key The key of the entry to check.
  20253. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20254. */
  20255. function listCacheHas(key) {
  20256. return assocIndexOf(this.__data__, key) > -1;
  20257. }
  20258. /**
  20259. * Sets the list cache `key` to `value`.
  20260. *
  20261. * @private
  20262. * @name set
  20263. * @memberOf ListCache
  20264. * @param {string} key The key of the value to set.
  20265. * @param {*} value The value to set.
  20266. * @returns {Object} Returns the list cache instance.
  20267. */
  20268. function listCacheSet(key, value) {
  20269. var data = this.__data__,
  20270. index = assocIndexOf(data, key);
  20271. if (index < 0) {
  20272. ++this.size;
  20273. data.push([key, value]);
  20274. } else {
  20275. data[index][1] = value;
  20276. }
  20277. return this;
  20278. }
  20279. // Add methods to `ListCache`.
  20280. ListCache.prototype.clear = listCacheClear;
  20281. ListCache.prototype['delete'] = listCacheDelete;
  20282. ListCache.prototype.get = listCacheGet;
  20283. ListCache.prototype.has = listCacheHas;
  20284. ListCache.prototype.set = listCacheSet;
  20285. /*------------------------------------------------------------------------*/
  20286. /**
  20287. * Creates a map cache object to store key-value pairs.
  20288. *
  20289. * @private
  20290. * @constructor
  20291. * @param {Array} [entries] The key-value pairs to cache.
  20292. */
  20293. function MapCache(entries) {
  20294. var index = -1,
  20295. length = entries == null ? 0 : entries.length;
  20296. this.clear();
  20297. while (++index < length) {
  20298. var entry = entries[index];
  20299. this.set(entry[0], entry[1]);
  20300. }
  20301. }
  20302. /**
  20303. * Removes all key-value entries from the map.
  20304. *
  20305. * @private
  20306. * @name clear
  20307. * @memberOf MapCache
  20308. */
  20309. function mapCacheClear() {
  20310. this.size = 0;
  20311. this.__data__ = {
  20312. 'hash': new Hash,
  20313. 'map': new (Map || ListCache),
  20314. 'string': new Hash
  20315. };
  20316. }
  20317. /**
  20318. * Removes `key` and its value from the map.
  20319. *
  20320. * @private
  20321. * @name delete
  20322. * @memberOf MapCache
  20323. * @param {string} key The key of the value to remove.
  20324. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20325. */
  20326. function mapCacheDelete(key) {
  20327. var result = getMapData(this, key)['delete'](key);
  20328. this.size -= result ? 1 : 0;
  20329. return result;
  20330. }
  20331. /**
  20332. * Gets the map value for `key`.
  20333. *
  20334. * @private
  20335. * @name get
  20336. * @memberOf MapCache
  20337. * @param {string} key The key of the value to get.
  20338. * @returns {*} Returns the entry value.
  20339. */
  20340. function mapCacheGet(key) {
  20341. return getMapData(this, key).get(key);
  20342. }
  20343. /**
  20344. * Checks if a map value for `key` exists.
  20345. *
  20346. * @private
  20347. * @name has
  20348. * @memberOf MapCache
  20349. * @param {string} key The key of the entry to check.
  20350. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20351. */
  20352. function mapCacheHas(key) {
  20353. return getMapData(this, key).has(key);
  20354. }
  20355. /**
  20356. * Sets the map `key` to `value`.
  20357. *
  20358. * @private
  20359. * @name set
  20360. * @memberOf MapCache
  20361. * @param {string} key The key of the value to set.
  20362. * @param {*} value The value to set.
  20363. * @returns {Object} Returns the map cache instance.
  20364. */
  20365. function mapCacheSet(key, value) {
  20366. var data = getMapData(this, key),
  20367. size = data.size;
  20368. data.set(key, value);
  20369. this.size += data.size == size ? 0 : 1;
  20370. return this;
  20371. }
  20372. // Add methods to `MapCache`.
  20373. MapCache.prototype.clear = mapCacheClear;
  20374. MapCache.prototype['delete'] = mapCacheDelete;
  20375. MapCache.prototype.get = mapCacheGet;
  20376. MapCache.prototype.has = mapCacheHas;
  20377. MapCache.prototype.set = mapCacheSet;
  20378. /*------------------------------------------------------------------------*/
  20379. /**
  20380. *
  20381. * Creates an array cache object to store unique values.
  20382. *
  20383. * @private
  20384. * @constructor
  20385. * @param {Array} [values] The values to cache.
  20386. */
  20387. function SetCache(values) {
  20388. var index = -1,
  20389. length = values == null ? 0 : values.length;
  20390. this.__data__ = new MapCache;
  20391. while (++index < length) {
  20392. this.add(values[index]);
  20393. }
  20394. }
  20395. /**
  20396. * Adds `value` to the array cache.
  20397. *
  20398. * @private
  20399. * @name add
  20400. * @memberOf SetCache
  20401. * @alias push
  20402. * @param {*} value The value to cache.
  20403. * @returns {Object} Returns the cache instance.
  20404. */
  20405. function setCacheAdd(value) {
  20406. this.__data__.set(value, HASH_UNDEFINED);
  20407. return this;
  20408. }
  20409. /**
  20410. * Checks if `value` is in the array cache.
  20411. *
  20412. * @private
  20413. * @name has
  20414. * @memberOf SetCache
  20415. * @param {*} value The value to search for.
  20416. * @returns {number} Returns `true` if `value` is found, else `false`.
  20417. */
  20418. function setCacheHas(value) {
  20419. return this.__data__.has(value);
  20420. }
  20421. // Add methods to `SetCache`.
  20422. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20423. SetCache.prototype.has = setCacheHas;
  20424. /*------------------------------------------------------------------------*/
  20425. /**
  20426. * Creates a stack cache object to store key-value pairs.
  20427. *
  20428. * @private
  20429. * @constructor
  20430. * @param {Array} [entries] The key-value pairs to cache.
  20431. */
  20432. function Stack(entries) {
  20433. var data = this.__data__ = new ListCache(entries);
  20434. this.size = data.size;
  20435. }
  20436. /**
  20437. * Removes all key-value entries from the stack.
  20438. *
  20439. * @private
  20440. * @name clear
  20441. * @memberOf Stack
  20442. */
  20443. function stackClear() {
  20444. this.__data__ = new ListCache;
  20445. this.size = 0;
  20446. }
  20447. /**
  20448. * Removes `key` and its value from the stack.
  20449. *
  20450. * @private
  20451. * @name delete
  20452. * @memberOf Stack
  20453. * @param {string} key The key of the value to remove.
  20454. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20455. */
  20456. function stackDelete(key) {
  20457. var data = this.__data__,
  20458. result = data['delete'](key);
  20459. this.size = data.size;
  20460. return result;
  20461. }
  20462. /**
  20463. * Gets the stack value for `key`.
  20464. *
  20465. * @private
  20466. * @name get
  20467. * @memberOf Stack
  20468. * @param {string} key The key of the value to get.
  20469. * @returns {*} Returns the entry value.
  20470. */
  20471. function stackGet(key) {
  20472. return this.__data__.get(key);
  20473. }
  20474. /**
  20475. * Checks if a stack value for `key` exists.
  20476. *
  20477. * @private
  20478. * @name has
  20479. * @memberOf Stack
  20480. * @param {string} key The key of the entry to check.
  20481. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20482. */
  20483. function stackHas(key) {
  20484. return this.__data__.has(key);
  20485. }
  20486. /**
  20487. * Sets the stack `key` to `value`.
  20488. *
  20489. * @private
  20490. * @name set
  20491. * @memberOf Stack
  20492. * @param {string} key The key of the value to set.
  20493. * @param {*} value The value to set.
  20494. * @returns {Object} Returns the stack cache instance.
  20495. */
  20496. function stackSet(key, value) {
  20497. var data = this.__data__;
  20498. if (data instanceof ListCache) {
  20499. var pairs = data.__data__;
  20500. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20501. pairs.push([key, value]);
  20502. this.size = ++data.size;
  20503. return this;
  20504. }
  20505. data = this.__data__ = new MapCache(pairs);
  20506. }
  20507. data.set(key, value);
  20508. this.size = data.size;
  20509. return this;
  20510. }
  20511. // Add methods to `Stack`.
  20512. Stack.prototype.clear = stackClear;
  20513. Stack.prototype['delete'] = stackDelete;
  20514. Stack.prototype.get = stackGet;
  20515. Stack.prototype.has = stackHas;
  20516. Stack.prototype.set = stackSet;
  20517. /*------------------------------------------------------------------------*/
  20518. /**
  20519. * Creates an array of the enumerable property names of the array-like `value`.
  20520. *
  20521. * @private
  20522. * @param {*} value The value to query.
  20523. * @param {boolean} inherited Specify returning inherited property names.
  20524. * @returns {Array} Returns the array of property names.
  20525. */
  20526. function arrayLikeKeys(value, inherited) {
  20527. var isArr = isArray(value),
  20528. isArg = !isArr && isArguments(value),
  20529. isBuff = !isArr && !isArg && isBuffer(value),
  20530. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20531. skipIndexes = isArr || isArg || isBuff || isType,
  20532. result = skipIndexes ? baseTimes(value.length, String) : [],
  20533. length = result.length;
  20534. for (var key in value) {
  20535. if ((inherited || hasOwnProperty.call(value, key)) &&
  20536. !(skipIndexes && (
  20537. // Safari 9 has enumerable `arguments.length` in strict mode.
  20538. key == 'length' ||
  20539. // Node.js 0.10 has enumerable non-index properties on buffers.
  20540. (isBuff && (key == 'offset' || key == 'parent')) ||
  20541. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20542. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20543. // Skip index properties.
  20544. isIndex(key, length)
  20545. ))) {
  20546. result.push(key);
  20547. }
  20548. }
  20549. return result;
  20550. }
  20551. /**
  20552. * A specialized version of `_.sample` for arrays.
  20553. *
  20554. * @private
  20555. * @param {Array} array The array to sample.
  20556. * @returns {*} Returns the random element.
  20557. */
  20558. function arraySample(array) {
  20559. var length = array.length;
  20560. return length ? array[baseRandom(0, length - 1)] : undefined;
  20561. }
  20562. /**
  20563. * A specialized version of `_.sampleSize` for arrays.
  20564. *
  20565. * @private
  20566. * @param {Array} array The array to sample.
  20567. * @param {number} n The number of elements to sample.
  20568. * @returns {Array} Returns the random elements.
  20569. */
  20570. function arraySampleSize(array, n) {
  20571. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20572. }
  20573. /**
  20574. * A specialized version of `_.shuffle` for arrays.
  20575. *
  20576. * @private
  20577. * @param {Array} array The array to shuffle.
  20578. * @returns {Array} Returns the new shuffled array.
  20579. */
  20580. function arrayShuffle(array) {
  20581. return shuffleSelf(copyArray(array));
  20582. }
  20583. /**
  20584. * This function is like `assignValue` except that it doesn't assign
  20585. * `undefined` values.
  20586. *
  20587. * @private
  20588. * @param {Object} object The object to modify.
  20589. * @param {string} key The key of the property to assign.
  20590. * @param {*} value The value to assign.
  20591. */
  20592. function assignMergeValue(object, key, value) {
  20593. if ((value !== undefined && !eq(object[key], value)) ||
  20594. (value === undefined && !(key in object))) {
  20595. baseAssignValue(object, key, value);
  20596. }
  20597. }
  20598. /**
  20599. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20600. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20601. * for equality comparisons.
  20602. *
  20603. * @private
  20604. * @param {Object} object The object to modify.
  20605. * @param {string} key The key of the property to assign.
  20606. * @param {*} value The value to assign.
  20607. */
  20608. function assignValue(object, key, value) {
  20609. var objValue = object[key];
  20610. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20611. (value === undefined && !(key in object))) {
  20612. baseAssignValue(object, key, value);
  20613. }
  20614. }
  20615. /**
  20616. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20617. *
  20618. * @private
  20619. * @param {Array} array The array to inspect.
  20620. * @param {*} key The key to search for.
  20621. * @returns {number} Returns the index of the matched value, else `-1`.
  20622. */
  20623. function assocIndexOf(array, key) {
  20624. var length = array.length;
  20625. while (length--) {
  20626. if (eq(array[length][0], key)) {
  20627. return length;
  20628. }
  20629. }
  20630. return -1;
  20631. }
  20632. /**
  20633. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20634. * by `iteratee` and values set by `setter`.
  20635. *
  20636. * @private
  20637. * @param {Array|Object} collection The collection to iterate over.
  20638. * @param {Function} setter The function to set `accumulator` values.
  20639. * @param {Function} iteratee The iteratee to transform keys.
  20640. * @param {Object} accumulator The initial aggregated object.
  20641. * @returns {Function} Returns `accumulator`.
  20642. */
  20643. function baseAggregator(collection, setter, iteratee, accumulator) {
  20644. baseEach(collection, function(value, key, collection) {
  20645. setter(accumulator, value, iteratee(value), collection);
  20646. });
  20647. return accumulator;
  20648. }
  20649. /**
  20650. * The base implementation of `_.assign` without support for multiple sources
  20651. * or `customizer` functions.
  20652. *
  20653. * @private
  20654. * @param {Object} object The destination object.
  20655. * @param {Object} source The source object.
  20656. * @returns {Object} Returns `object`.
  20657. */
  20658. function baseAssign(object, source) {
  20659. return object && copyObject(source, keys(source), object);
  20660. }
  20661. /**
  20662. * The base implementation of `_.assignIn` without support for multiple sources
  20663. * or `customizer` functions.
  20664. *
  20665. * @private
  20666. * @param {Object} object The destination object.
  20667. * @param {Object} source The source object.
  20668. * @returns {Object} Returns `object`.
  20669. */
  20670. function baseAssignIn(object, source) {
  20671. return object && copyObject(source, keysIn(source), object);
  20672. }
  20673. /**
  20674. * The base implementation of `assignValue` and `assignMergeValue` without
  20675. * value checks.
  20676. *
  20677. * @private
  20678. * @param {Object} object The object to modify.
  20679. * @param {string} key The key of the property to assign.
  20680. * @param {*} value The value to assign.
  20681. */
  20682. function baseAssignValue(object, key, value) {
  20683. if (key == '__proto__' && defineProperty) {
  20684. defineProperty(object, key, {
  20685. 'configurable': true,
  20686. 'enumerable': true,
  20687. 'value': value,
  20688. 'writable': true
  20689. });
  20690. } else {
  20691. object[key] = value;
  20692. }
  20693. }
  20694. /**
  20695. * The base implementation of `_.at` without support for individual paths.
  20696. *
  20697. * @private
  20698. * @param {Object} object The object to iterate over.
  20699. * @param {string[]} paths The property paths to pick.
  20700. * @returns {Array} Returns the picked elements.
  20701. */
  20702. function baseAt(object, paths) {
  20703. var index = -1,
  20704. length = paths.length,
  20705. result = Array(length),
  20706. skip = object == null;
  20707. while (++index < length) {
  20708. result[index] = skip ? undefined : get(object, paths[index]);
  20709. }
  20710. return result;
  20711. }
  20712. /**
  20713. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20714. *
  20715. * @private
  20716. * @param {number} number The number to clamp.
  20717. * @param {number} [lower] The lower bound.
  20718. * @param {number} upper The upper bound.
  20719. * @returns {number} Returns the clamped number.
  20720. */
  20721. function baseClamp(number, lower, upper) {
  20722. if (number === number) {
  20723. if (upper !== undefined) {
  20724. number = number <= upper ? number : upper;
  20725. }
  20726. if (lower !== undefined) {
  20727. number = number >= lower ? number : lower;
  20728. }
  20729. }
  20730. return number;
  20731. }
  20732. /**
  20733. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20734. * traversed objects.
  20735. *
  20736. * @private
  20737. * @param {*} value The value to clone.
  20738. * @param {boolean} bitmask The bitmask flags.
  20739. * 1 - Deep clone
  20740. * 2 - Flatten inherited properties
  20741. * 4 - Clone symbols
  20742. * @param {Function} [customizer] The function to customize cloning.
  20743. * @param {string} [key] The key of `value`.
  20744. * @param {Object} [object] The parent object of `value`.
  20745. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20746. * @returns {*} Returns the cloned value.
  20747. */
  20748. function baseClone(value, bitmask, customizer, key, object, stack) {
  20749. var result,
  20750. isDeep = bitmask & CLONE_DEEP_FLAG,
  20751. isFlat = bitmask & CLONE_FLAT_FLAG,
  20752. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20753. if (customizer) {
  20754. result = object ? customizer(value, key, object, stack) : customizer(value);
  20755. }
  20756. if (result !== undefined) {
  20757. return result;
  20758. }
  20759. if (!isObject(value)) {
  20760. return value;
  20761. }
  20762. var isArr = isArray(value);
  20763. if (isArr) {
  20764. result = initCloneArray(value);
  20765. if (!isDeep) {
  20766. return copyArray(value, result);
  20767. }
  20768. } else {
  20769. var tag = getTag(value),
  20770. isFunc = tag == funcTag || tag == genTag;
  20771. if (isBuffer(value)) {
  20772. return cloneBuffer(value, isDeep);
  20773. }
  20774. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20775. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20776. if (!isDeep) {
  20777. return isFlat
  20778. ? copySymbolsIn(value, baseAssignIn(result, value))
  20779. : copySymbols(value, baseAssign(result, value));
  20780. }
  20781. } else {
  20782. if (!cloneableTags[tag]) {
  20783. return object ? value : {};
  20784. }
  20785. result = initCloneByTag(value, tag, isDeep);
  20786. }
  20787. }
  20788. // Check for circular references and return its corresponding clone.
  20789. stack || (stack = new Stack);
  20790. var stacked = stack.get(value);
  20791. if (stacked) {
  20792. return stacked;
  20793. }
  20794. stack.set(value, result);
  20795. if (isSet(value)) {
  20796. value.forEach(function(subValue) {
  20797. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20798. });
  20799. } else if (isMap(value)) {
  20800. value.forEach(function(subValue, key) {
  20801. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20802. });
  20803. }
  20804. var keysFunc = isFull
  20805. ? (isFlat ? getAllKeysIn : getAllKeys)
  20806. : (isFlat ? keysIn : keys);
  20807. var props = isArr ? undefined : keysFunc(value);
  20808. arrayEach(props || value, function(subValue, key) {
  20809. if (props) {
  20810. key = subValue;
  20811. subValue = value[key];
  20812. }
  20813. // Recursively populate clone (susceptible to call stack limits).
  20814. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20815. });
  20816. return result;
  20817. }
  20818. /**
  20819. * The base implementation of `_.conforms` which doesn't clone `source`.
  20820. *
  20821. * @private
  20822. * @param {Object} source The object of property predicates to conform to.
  20823. * @returns {Function} Returns the new spec function.
  20824. */
  20825. function baseConforms(source) {
  20826. var props = keys(source);
  20827. return function(object) {
  20828. return baseConformsTo(object, source, props);
  20829. };
  20830. }
  20831. /**
  20832. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20833. *
  20834. * @private
  20835. * @param {Object} object The object to inspect.
  20836. * @param {Object} source The object of property predicates to conform to.
  20837. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20838. */
  20839. function baseConformsTo(object, source, props) {
  20840. var length = props.length;
  20841. if (object == null) {
  20842. return !length;
  20843. }
  20844. object = Object(object);
  20845. while (length--) {
  20846. var key = props[length],
  20847. predicate = source[key],
  20848. value = object[key];
  20849. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20850. return false;
  20851. }
  20852. }
  20853. return true;
  20854. }
  20855. /**
  20856. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20857. * to provide to `func`.
  20858. *
  20859. * @private
  20860. * @param {Function} func The function to delay.
  20861. * @param {number} wait The number of milliseconds to delay invocation.
  20862. * @param {Array} args The arguments to provide to `func`.
  20863. * @returns {number|Object} Returns the timer id or timeout object.
  20864. */
  20865. function baseDelay(func, wait, args) {
  20866. if (typeof func != 'function') {
  20867. throw new TypeError(FUNC_ERROR_TEXT);
  20868. }
  20869. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20870. }
  20871. /**
  20872. * The base implementation of methods like `_.difference` without support
  20873. * for excluding multiple arrays or iteratee shorthands.
  20874. *
  20875. * @private
  20876. * @param {Array} array The array to inspect.
  20877. * @param {Array} values The values to exclude.
  20878. * @param {Function} [iteratee] The iteratee invoked per element.
  20879. * @param {Function} [comparator] The comparator invoked per element.
  20880. * @returns {Array} Returns the new array of filtered values.
  20881. */
  20882. function baseDifference(array, values, iteratee, comparator) {
  20883. var index = -1,
  20884. includes = arrayIncludes,
  20885. isCommon = true,
  20886. length = array.length,
  20887. result = [],
  20888. valuesLength = values.length;
  20889. if (!length) {
  20890. return result;
  20891. }
  20892. if (iteratee) {
  20893. values = arrayMap(values, baseUnary(iteratee));
  20894. }
  20895. if (comparator) {
  20896. includes = arrayIncludesWith;
  20897. isCommon = false;
  20898. }
  20899. else if (values.length >= LARGE_ARRAY_SIZE) {
  20900. includes = cacheHas;
  20901. isCommon = false;
  20902. values = new SetCache(values);
  20903. }
  20904. outer:
  20905. while (++index < length) {
  20906. var value = array[index],
  20907. computed = iteratee == null ? value : iteratee(value);
  20908. value = (comparator || value !== 0) ? value : 0;
  20909. if (isCommon && computed === computed) {
  20910. var valuesIndex = valuesLength;
  20911. while (valuesIndex--) {
  20912. if (values[valuesIndex] === computed) {
  20913. continue outer;
  20914. }
  20915. }
  20916. result.push(value);
  20917. }
  20918. else if (!includes(values, computed, comparator)) {
  20919. result.push(value);
  20920. }
  20921. }
  20922. return result;
  20923. }
  20924. /**
  20925. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20926. *
  20927. * @private
  20928. * @param {Array|Object} collection The collection to iterate over.
  20929. * @param {Function} iteratee The function invoked per iteration.
  20930. * @returns {Array|Object} Returns `collection`.
  20931. */
  20932. var baseEach = createBaseEach(baseForOwn);
  20933. /**
  20934. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20935. *
  20936. * @private
  20937. * @param {Array|Object} collection The collection to iterate over.
  20938. * @param {Function} iteratee The function invoked per iteration.
  20939. * @returns {Array|Object} Returns `collection`.
  20940. */
  20941. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20942. /**
  20943. * The base implementation of `_.every` without support for iteratee shorthands.
  20944. *
  20945. * @private
  20946. * @param {Array|Object} collection The collection to iterate over.
  20947. * @param {Function} predicate The function invoked per iteration.
  20948. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20949. * else `false`
  20950. */
  20951. function baseEvery(collection, predicate) {
  20952. var result = true;
  20953. baseEach(collection, function(value, index, collection) {
  20954. result = !!predicate(value, index, collection);
  20955. return result;
  20956. });
  20957. return result;
  20958. }
  20959. /**
  20960. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20961. * `comparator` to determine the extremum value.
  20962. *
  20963. * @private
  20964. * @param {Array} array The array to iterate over.
  20965. * @param {Function} iteratee The iteratee invoked per iteration.
  20966. * @param {Function} comparator The comparator used to compare values.
  20967. * @returns {*} Returns the extremum value.
  20968. */
  20969. function baseExtremum(array, iteratee, comparator) {
  20970. var index = -1,
  20971. length = array.length;
  20972. while (++index < length) {
  20973. var value = array[index],
  20974. current = iteratee(value);
  20975. if (current != null && (computed === undefined
  20976. ? (current === current && !isSymbol(current))
  20977. : comparator(current, computed)
  20978. )) {
  20979. var computed = current,
  20980. result = value;
  20981. }
  20982. }
  20983. return result;
  20984. }
  20985. /**
  20986. * The base implementation of `_.fill` without an iteratee call guard.
  20987. *
  20988. * @private
  20989. * @param {Array} array The array to fill.
  20990. * @param {*} value The value to fill `array` with.
  20991. * @param {number} [start=0] The start position.
  20992. * @param {number} [end=array.length] The end position.
  20993. * @returns {Array} Returns `array`.
  20994. */
  20995. function baseFill(array, value, start, end) {
  20996. var length = array.length;
  20997. start = toInteger(start);
  20998. if (start < 0) {
  20999. start = -start > length ? 0 : (length + start);
  21000. }
  21001. end = (end === undefined || end > length) ? length : toInteger(end);
  21002. if (end < 0) {
  21003. end += length;
  21004. }
  21005. end = start > end ? 0 : toLength(end);
  21006. while (start < end) {
  21007. array[start++] = value;
  21008. }
  21009. return array;
  21010. }
  21011. /**
  21012. * The base implementation of `_.filter` without support for iteratee shorthands.
  21013. *
  21014. * @private
  21015. * @param {Array|Object} collection The collection to iterate over.
  21016. * @param {Function} predicate The function invoked per iteration.
  21017. * @returns {Array} Returns the new filtered array.
  21018. */
  21019. function baseFilter(collection, predicate) {
  21020. var result = [];
  21021. baseEach(collection, function(value, index, collection) {
  21022. if (predicate(value, index, collection)) {
  21023. result.push(value);
  21024. }
  21025. });
  21026. return result;
  21027. }
  21028. /**
  21029. * The base implementation of `_.flatten` with support for restricting flattening.
  21030. *
  21031. * @private
  21032. * @param {Array} array The array to flatten.
  21033. * @param {number} depth The maximum recursion depth.
  21034. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21035. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21036. * @param {Array} [result=[]] The initial result value.
  21037. * @returns {Array} Returns the new flattened array.
  21038. */
  21039. function baseFlatten(array, depth, predicate, isStrict, result) {
  21040. var index = -1,
  21041. length = array.length;
  21042. predicate || (predicate = isFlattenable);
  21043. result || (result = []);
  21044. while (++index < length) {
  21045. var value = array[index];
  21046. if (depth > 0 && predicate(value)) {
  21047. if (depth > 1) {
  21048. // Recursively flatten arrays (susceptible to call stack limits).
  21049. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21050. } else {
  21051. arrayPush(result, value);
  21052. }
  21053. } else if (!isStrict) {
  21054. result[result.length] = value;
  21055. }
  21056. }
  21057. return result;
  21058. }
  21059. /**
  21060. * The base implementation of `baseForOwn` which iterates over `object`
  21061. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21062. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21063. *
  21064. * @private
  21065. * @param {Object} object The object to iterate over.
  21066. * @param {Function} iteratee The function invoked per iteration.
  21067. * @param {Function} keysFunc The function to get the keys of `object`.
  21068. * @returns {Object} Returns `object`.
  21069. */
  21070. var baseFor = createBaseFor();
  21071. /**
  21072. * This function is like `baseFor` except that it iterates over properties
  21073. * in the opposite order.
  21074. *
  21075. * @private
  21076. * @param {Object} object The object to iterate over.
  21077. * @param {Function} iteratee The function invoked per iteration.
  21078. * @param {Function} keysFunc The function to get the keys of `object`.
  21079. * @returns {Object} Returns `object`.
  21080. */
  21081. var baseForRight = createBaseFor(true);
  21082. /**
  21083. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21084. *
  21085. * @private
  21086. * @param {Object} object The object to iterate over.
  21087. * @param {Function} iteratee The function invoked per iteration.
  21088. * @returns {Object} Returns `object`.
  21089. */
  21090. function baseForOwn(object, iteratee) {
  21091. return object && baseFor(object, iteratee, keys);
  21092. }
  21093. /**
  21094. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21095. *
  21096. * @private
  21097. * @param {Object} object The object to iterate over.
  21098. * @param {Function} iteratee The function invoked per iteration.
  21099. * @returns {Object} Returns `object`.
  21100. */
  21101. function baseForOwnRight(object, iteratee) {
  21102. return object && baseForRight(object, iteratee, keys);
  21103. }
  21104. /**
  21105. * The base implementation of `_.functions` which creates an array of
  21106. * `object` function property names filtered from `props`.
  21107. *
  21108. * @private
  21109. * @param {Object} object The object to inspect.
  21110. * @param {Array} props The property names to filter.
  21111. * @returns {Array} Returns the function names.
  21112. */
  21113. function baseFunctions(object, props) {
  21114. return arrayFilter(props, function(key) {
  21115. return isFunction(object[key]);
  21116. });
  21117. }
  21118. /**
  21119. * The base implementation of `_.get` without support for default values.
  21120. *
  21121. * @private
  21122. * @param {Object} object The object to query.
  21123. * @param {Array|string} path The path of the property to get.
  21124. * @returns {*} Returns the resolved value.
  21125. */
  21126. function baseGet(object, path) {
  21127. path = castPath(path, object);
  21128. var index = 0,
  21129. length = path.length;
  21130. while (object != null && index < length) {
  21131. object = object[toKey(path[index++])];
  21132. }
  21133. return (index && index == length) ? object : undefined;
  21134. }
  21135. /**
  21136. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21137. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21138. * symbols of `object`.
  21139. *
  21140. * @private
  21141. * @param {Object} object The object to query.
  21142. * @param {Function} keysFunc The function to get the keys of `object`.
  21143. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21144. * @returns {Array} Returns the array of property names and symbols.
  21145. */
  21146. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21147. var result = keysFunc(object);
  21148. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21149. }
  21150. /**
  21151. * The base implementation of `getTag` without fallbacks for buggy environments.
  21152. *
  21153. * @private
  21154. * @param {*} value The value to query.
  21155. * @returns {string} Returns the `toStringTag`.
  21156. */
  21157. function baseGetTag(value) {
  21158. if (value == null) {
  21159. return value === undefined ? undefinedTag : nullTag;
  21160. }
  21161. return (symToStringTag && symToStringTag in Object(value))
  21162. ? getRawTag(value)
  21163. : objectToString(value);
  21164. }
  21165. /**
  21166. * The base implementation of `_.gt` which doesn't coerce arguments.
  21167. *
  21168. * @private
  21169. * @param {*} value The value to compare.
  21170. * @param {*} other The other value to compare.
  21171. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21172. * else `false`.
  21173. */
  21174. function baseGt(value, other) {
  21175. return value > other;
  21176. }
  21177. /**
  21178. * The base implementation of `_.has` without support for deep paths.
  21179. *
  21180. * @private
  21181. * @param {Object} [object] The object to query.
  21182. * @param {Array|string} key The key to check.
  21183. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21184. */
  21185. function baseHas(object, key) {
  21186. return object != null && hasOwnProperty.call(object, key);
  21187. }
  21188. /**
  21189. * The base implementation of `_.hasIn` without support for deep paths.
  21190. *
  21191. * @private
  21192. * @param {Object} [object] The object to query.
  21193. * @param {Array|string} key The key to check.
  21194. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21195. */
  21196. function baseHasIn(object, key) {
  21197. return object != null && key in Object(object);
  21198. }
  21199. /**
  21200. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21201. *
  21202. * @private
  21203. * @param {number} number The number to check.
  21204. * @param {number} start The start of the range.
  21205. * @param {number} end The end of the range.
  21206. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21207. */
  21208. function baseInRange(number, start, end) {
  21209. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21210. }
  21211. /**
  21212. * The base implementation of methods like `_.intersection`, without support
  21213. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21214. *
  21215. * @private
  21216. * @param {Array} arrays The arrays to inspect.
  21217. * @param {Function} [iteratee] The iteratee invoked per element.
  21218. * @param {Function} [comparator] The comparator invoked per element.
  21219. * @returns {Array} Returns the new array of shared values.
  21220. */
  21221. function baseIntersection(arrays, iteratee, comparator) {
  21222. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21223. length = arrays[0].length,
  21224. othLength = arrays.length,
  21225. othIndex = othLength,
  21226. caches = Array(othLength),
  21227. maxLength = Infinity,
  21228. result = [];
  21229. while (othIndex--) {
  21230. var array = arrays[othIndex];
  21231. if (othIndex && iteratee) {
  21232. array = arrayMap(array, baseUnary(iteratee));
  21233. }
  21234. maxLength = nativeMin(array.length, maxLength);
  21235. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21236. ? new SetCache(othIndex && array)
  21237. : undefined;
  21238. }
  21239. array = arrays[0];
  21240. var index = -1,
  21241. seen = caches[0];
  21242. outer:
  21243. while (++index < length && result.length < maxLength) {
  21244. var value = array[index],
  21245. computed = iteratee ? iteratee(value) : value;
  21246. value = (comparator || value !== 0) ? value : 0;
  21247. if (!(seen
  21248. ? cacheHas(seen, computed)
  21249. : includes(result, computed, comparator)
  21250. )) {
  21251. othIndex = othLength;
  21252. while (--othIndex) {
  21253. var cache = caches[othIndex];
  21254. if (!(cache
  21255. ? cacheHas(cache, computed)
  21256. : includes(arrays[othIndex], computed, comparator))
  21257. ) {
  21258. continue outer;
  21259. }
  21260. }
  21261. if (seen) {
  21262. seen.push(computed);
  21263. }
  21264. result.push(value);
  21265. }
  21266. }
  21267. return result;
  21268. }
  21269. /**
  21270. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21271. * `object` with values transformed by `iteratee` and set by `setter`.
  21272. *
  21273. * @private
  21274. * @param {Object} object The object to iterate over.
  21275. * @param {Function} setter The function to set `accumulator` values.
  21276. * @param {Function} iteratee The iteratee to transform values.
  21277. * @param {Object} accumulator The initial inverted object.
  21278. * @returns {Function} Returns `accumulator`.
  21279. */
  21280. function baseInverter(object, setter, iteratee, accumulator) {
  21281. baseForOwn(object, function(value, key, object) {
  21282. setter(accumulator, iteratee(value), key, object);
  21283. });
  21284. return accumulator;
  21285. }
  21286. /**
  21287. * The base implementation of `_.invoke` without support for individual
  21288. * method arguments.
  21289. *
  21290. * @private
  21291. * @param {Object} object The object to query.
  21292. * @param {Array|string} path The path of the method to invoke.
  21293. * @param {Array} args The arguments to invoke the method with.
  21294. * @returns {*} Returns the result of the invoked method.
  21295. */
  21296. function baseInvoke(object, path, args) {
  21297. path = castPath(path, object);
  21298. object = parent(object, path);
  21299. var func = object == null ? object : object[toKey(last(path))];
  21300. return func == null ? undefined : apply(func, object, args);
  21301. }
  21302. /**
  21303. * The base implementation of `_.isArguments`.
  21304. *
  21305. * @private
  21306. * @param {*} value The value to check.
  21307. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21308. */
  21309. function baseIsArguments(value) {
  21310. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21311. }
  21312. /**
  21313. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21314. *
  21315. * @private
  21316. * @param {*} value The value to check.
  21317. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21318. */
  21319. function baseIsArrayBuffer(value) {
  21320. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21321. }
  21322. /**
  21323. * The base implementation of `_.isDate` without Node.js optimizations.
  21324. *
  21325. * @private
  21326. * @param {*} value The value to check.
  21327. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21328. */
  21329. function baseIsDate(value) {
  21330. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21331. }
  21332. /**
  21333. * The base implementation of `_.isEqual` which supports partial comparisons
  21334. * and tracks traversed objects.
  21335. *
  21336. * @private
  21337. * @param {*} value The value to compare.
  21338. * @param {*} other The other value to compare.
  21339. * @param {boolean} bitmask The bitmask flags.
  21340. * 1 - Unordered comparison
  21341. * 2 - Partial comparison
  21342. * @param {Function} [customizer] The function to customize comparisons.
  21343. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21344. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21345. */
  21346. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21347. if (value === other) {
  21348. return true;
  21349. }
  21350. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21351. return value !== value && other !== other;
  21352. }
  21353. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21354. }
  21355. /**
  21356. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21357. * deep comparisons and tracks traversed objects enabling objects with circular
  21358. * references to be compared.
  21359. *
  21360. * @private
  21361. * @param {Object} object The object to compare.
  21362. * @param {Object} other The other object to compare.
  21363. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21364. * @param {Function} customizer The function to customize comparisons.
  21365. * @param {Function} equalFunc The function to determine equivalents of values.
  21366. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21367. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21368. */
  21369. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21370. var objIsArr = isArray(object),
  21371. othIsArr = isArray(other),
  21372. objTag = objIsArr ? arrayTag : getTag(object),
  21373. othTag = othIsArr ? arrayTag : getTag(other);
  21374. objTag = objTag == argsTag ? objectTag : objTag;
  21375. othTag = othTag == argsTag ? objectTag : othTag;
  21376. var objIsObj = objTag == objectTag,
  21377. othIsObj = othTag == objectTag,
  21378. isSameTag = objTag == othTag;
  21379. if (isSameTag && isBuffer(object)) {
  21380. if (!isBuffer(other)) {
  21381. return false;
  21382. }
  21383. objIsArr = true;
  21384. objIsObj = false;
  21385. }
  21386. if (isSameTag && !objIsObj) {
  21387. stack || (stack = new Stack);
  21388. return (objIsArr || isTypedArray(object))
  21389. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21390. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21391. }
  21392. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21393. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21394. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21395. if (objIsWrapped || othIsWrapped) {
  21396. var objUnwrapped = objIsWrapped ? object.value() : object,
  21397. othUnwrapped = othIsWrapped ? other.value() : other;
  21398. stack || (stack = new Stack);
  21399. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21400. }
  21401. }
  21402. if (!isSameTag) {
  21403. return false;
  21404. }
  21405. stack || (stack = new Stack);
  21406. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21407. }
  21408. /**
  21409. * The base implementation of `_.isMap` without Node.js optimizations.
  21410. *
  21411. * @private
  21412. * @param {*} value The value to check.
  21413. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21414. */
  21415. function baseIsMap(value) {
  21416. return isObjectLike(value) && getTag(value) == mapTag;
  21417. }
  21418. /**
  21419. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21420. *
  21421. * @private
  21422. * @param {Object} object The object to inspect.
  21423. * @param {Object} source The object of property values to match.
  21424. * @param {Array} matchData The property names, values, and compare flags to match.
  21425. * @param {Function} [customizer] The function to customize comparisons.
  21426. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21427. */
  21428. function baseIsMatch(object, source, matchData, customizer) {
  21429. var index = matchData.length,
  21430. length = index,
  21431. noCustomizer = !customizer;
  21432. if (object == null) {
  21433. return !length;
  21434. }
  21435. object = Object(object);
  21436. while (index--) {
  21437. var data = matchData[index];
  21438. if ((noCustomizer && data[2])
  21439. ? data[1] !== object[data[0]]
  21440. : !(data[0] in object)
  21441. ) {
  21442. return false;
  21443. }
  21444. }
  21445. while (++index < length) {
  21446. data = matchData[index];
  21447. var key = data[0],
  21448. objValue = object[key],
  21449. srcValue = data[1];
  21450. if (noCustomizer && data[2]) {
  21451. if (objValue === undefined && !(key in object)) {
  21452. return false;
  21453. }
  21454. } else {
  21455. var stack = new Stack;
  21456. if (customizer) {
  21457. var result = customizer(objValue, srcValue, key, object, source, stack);
  21458. }
  21459. if (!(result === undefined
  21460. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21461. : result
  21462. )) {
  21463. return false;
  21464. }
  21465. }
  21466. }
  21467. return true;
  21468. }
  21469. /**
  21470. * The base implementation of `_.isNative` without bad shim checks.
  21471. *
  21472. * @private
  21473. * @param {*} value The value to check.
  21474. * @returns {boolean} Returns `true` if `value` is a native function,
  21475. * else `false`.
  21476. */
  21477. function baseIsNative(value) {
  21478. if (!isObject(value) || isMasked(value)) {
  21479. return false;
  21480. }
  21481. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21482. return pattern.test(toSource(value));
  21483. }
  21484. /**
  21485. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21486. *
  21487. * @private
  21488. * @param {*} value The value to check.
  21489. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21490. */
  21491. function baseIsRegExp(value) {
  21492. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21493. }
  21494. /**
  21495. * The base implementation of `_.isSet` without Node.js optimizations.
  21496. *
  21497. * @private
  21498. * @param {*} value The value to check.
  21499. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21500. */
  21501. function baseIsSet(value) {
  21502. return isObjectLike(value) && getTag(value) == setTag;
  21503. }
  21504. /**
  21505. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21506. *
  21507. * @private
  21508. * @param {*} value The value to check.
  21509. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21510. */
  21511. function baseIsTypedArray(value) {
  21512. return isObjectLike(value) &&
  21513. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21514. }
  21515. /**
  21516. * The base implementation of `_.iteratee`.
  21517. *
  21518. * @private
  21519. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21520. * @returns {Function} Returns the iteratee.
  21521. */
  21522. function baseIteratee(value) {
  21523. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21524. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21525. if (typeof value == 'function') {
  21526. return value;
  21527. }
  21528. if (value == null) {
  21529. return identity;
  21530. }
  21531. if (typeof value == 'object') {
  21532. return isArray(value)
  21533. ? baseMatchesProperty(value[0], value[1])
  21534. : baseMatches(value);
  21535. }
  21536. return property(value);
  21537. }
  21538. /**
  21539. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21540. *
  21541. * @private
  21542. * @param {Object} object The object to query.
  21543. * @returns {Array} Returns the array of property names.
  21544. */
  21545. function baseKeys(object) {
  21546. if (!isPrototype(object)) {
  21547. return nativeKeys(object);
  21548. }
  21549. var result = [];
  21550. for (var key in Object(object)) {
  21551. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21552. result.push(key);
  21553. }
  21554. }
  21555. return result;
  21556. }
  21557. /**
  21558. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21559. *
  21560. * @private
  21561. * @param {Object} object The object to query.
  21562. * @returns {Array} Returns the array of property names.
  21563. */
  21564. function baseKeysIn(object) {
  21565. if (!isObject(object)) {
  21566. return nativeKeysIn(object);
  21567. }
  21568. var isProto = isPrototype(object),
  21569. result = [];
  21570. for (var key in object) {
  21571. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21572. result.push(key);
  21573. }
  21574. }
  21575. return result;
  21576. }
  21577. /**
  21578. * The base implementation of `_.lt` which doesn't coerce arguments.
  21579. *
  21580. * @private
  21581. * @param {*} value The value to compare.
  21582. * @param {*} other The other value to compare.
  21583. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21584. * else `false`.
  21585. */
  21586. function baseLt(value, other) {
  21587. return value < other;
  21588. }
  21589. /**
  21590. * The base implementation of `_.map` without support for iteratee shorthands.
  21591. *
  21592. * @private
  21593. * @param {Array|Object} collection The collection to iterate over.
  21594. * @param {Function} iteratee The function invoked per iteration.
  21595. * @returns {Array} Returns the new mapped array.
  21596. */
  21597. function baseMap(collection, iteratee) {
  21598. var index = -1,
  21599. result = isArrayLike(collection) ? Array(collection.length) : [];
  21600. baseEach(collection, function(value, key, collection) {
  21601. result[++index] = iteratee(value, key, collection);
  21602. });
  21603. return result;
  21604. }
  21605. /**
  21606. * The base implementation of `_.matches` which doesn't clone `source`.
  21607. *
  21608. * @private
  21609. * @param {Object} source The object of property values to match.
  21610. * @returns {Function} Returns the new spec function.
  21611. */
  21612. function baseMatches(source) {
  21613. var matchData = getMatchData(source);
  21614. if (matchData.length == 1 && matchData[0][2]) {
  21615. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21616. }
  21617. return function(object) {
  21618. return object === source || baseIsMatch(object, source, matchData);
  21619. };
  21620. }
  21621. /**
  21622. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21623. *
  21624. * @private
  21625. * @param {string} path The path of the property to get.
  21626. * @param {*} srcValue The value to match.
  21627. * @returns {Function} Returns the new spec function.
  21628. */
  21629. function baseMatchesProperty(path, srcValue) {
  21630. if (isKey(path) && isStrictComparable(srcValue)) {
  21631. return matchesStrictComparable(toKey(path), srcValue);
  21632. }
  21633. return function(object) {
  21634. var objValue = get(object, path);
  21635. return (objValue === undefined && objValue === srcValue)
  21636. ? hasIn(object, path)
  21637. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21638. };
  21639. }
  21640. /**
  21641. * The base implementation of `_.merge` without support for multiple sources.
  21642. *
  21643. * @private
  21644. * @param {Object} object The destination object.
  21645. * @param {Object} source The source object.
  21646. * @param {number} srcIndex The index of `source`.
  21647. * @param {Function} [customizer] The function to customize merged values.
  21648. * @param {Object} [stack] Tracks traversed source values and their merged
  21649. * counterparts.
  21650. */
  21651. function baseMerge(object, source, srcIndex, customizer, stack) {
  21652. if (object === source) {
  21653. return;
  21654. }
  21655. baseFor(source, function(srcValue, key) {
  21656. stack || (stack = new Stack);
  21657. if (isObject(srcValue)) {
  21658. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21659. }
  21660. else {
  21661. var newValue = customizer
  21662. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21663. : undefined;
  21664. if (newValue === undefined) {
  21665. newValue = srcValue;
  21666. }
  21667. assignMergeValue(object, key, newValue);
  21668. }
  21669. }, keysIn);
  21670. }
  21671. /**
  21672. * A specialized version of `baseMerge` for arrays and objects which performs
  21673. * deep merges and tracks traversed objects enabling objects with circular
  21674. * references to be merged.
  21675. *
  21676. * @private
  21677. * @param {Object} object The destination object.
  21678. * @param {Object} source The source object.
  21679. * @param {string} key The key of the value to merge.
  21680. * @param {number} srcIndex The index of `source`.
  21681. * @param {Function} mergeFunc The function to merge values.
  21682. * @param {Function} [customizer] The function to customize assigned values.
  21683. * @param {Object} [stack] Tracks traversed source values and their merged
  21684. * counterparts.
  21685. */
  21686. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21687. var objValue = safeGet(object, key),
  21688. srcValue = safeGet(source, key),
  21689. stacked = stack.get(srcValue);
  21690. if (stacked) {
  21691. assignMergeValue(object, key, stacked);
  21692. return;
  21693. }
  21694. var newValue = customizer
  21695. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21696. : undefined;
  21697. var isCommon = newValue === undefined;
  21698. if (isCommon) {
  21699. var isArr = isArray(srcValue),
  21700. isBuff = !isArr && isBuffer(srcValue),
  21701. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21702. newValue = srcValue;
  21703. if (isArr || isBuff || isTyped) {
  21704. if (isArray(objValue)) {
  21705. newValue = objValue;
  21706. }
  21707. else if (isArrayLikeObject(objValue)) {
  21708. newValue = copyArray(objValue);
  21709. }
  21710. else if (isBuff) {
  21711. isCommon = false;
  21712. newValue = cloneBuffer(srcValue, true);
  21713. }
  21714. else if (isTyped) {
  21715. isCommon = false;
  21716. newValue = cloneTypedArray(srcValue, true);
  21717. }
  21718. else {
  21719. newValue = [];
  21720. }
  21721. }
  21722. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21723. newValue = objValue;
  21724. if (isArguments(objValue)) {
  21725. newValue = toPlainObject(objValue);
  21726. }
  21727. else if (!isObject(objValue) || isFunction(objValue)) {
  21728. newValue = initCloneObject(srcValue);
  21729. }
  21730. }
  21731. else {
  21732. isCommon = false;
  21733. }
  21734. }
  21735. if (isCommon) {
  21736. // Recursively merge objects and arrays (susceptible to call stack limits).
  21737. stack.set(srcValue, newValue);
  21738. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21739. stack['delete'](srcValue);
  21740. }
  21741. assignMergeValue(object, key, newValue);
  21742. }
  21743. /**
  21744. * The base implementation of `_.nth` which doesn't coerce arguments.
  21745. *
  21746. * @private
  21747. * @param {Array} array The array to query.
  21748. * @param {number} n The index of the element to return.
  21749. * @returns {*} Returns the nth element of `array`.
  21750. */
  21751. function baseNth(array, n) {
  21752. var length = array.length;
  21753. if (!length) {
  21754. return;
  21755. }
  21756. n += n < 0 ? length : 0;
  21757. return isIndex(n, length) ? array[n] : undefined;
  21758. }
  21759. /**
  21760. * The base implementation of `_.orderBy` without param guards.
  21761. *
  21762. * @private
  21763. * @param {Array|Object} collection The collection to iterate over.
  21764. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21765. * @param {string[]} orders The sort orders of `iteratees`.
  21766. * @returns {Array} Returns the new sorted array.
  21767. */
  21768. function baseOrderBy(collection, iteratees, orders) {
  21769. var index = -1;
  21770. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21771. var result = baseMap(collection, function(value, key, collection) {
  21772. var criteria = arrayMap(iteratees, function(iteratee) {
  21773. return iteratee(value);
  21774. });
  21775. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21776. });
  21777. return baseSortBy(result, function(object, other) {
  21778. return compareMultiple(object, other, orders);
  21779. });
  21780. }
  21781. /**
  21782. * The base implementation of `_.pick` without support for individual
  21783. * property identifiers.
  21784. *
  21785. * @private
  21786. * @param {Object} object The source object.
  21787. * @param {string[]} paths The property paths to pick.
  21788. * @returns {Object} Returns the new object.
  21789. */
  21790. function basePick(object, paths) {
  21791. return basePickBy(object, paths, function(value, path) {
  21792. return hasIn(object, path);
  21793. });
  21794. }
  21795. /**
  21796. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21797. *
  21798. * @private
  21799. * @param {Object} object The source object.
  21800. * @param {string[]} paths The property paths to pick.
  21801. * @param {Function} predicate The function invoked per property.
  21802. * @returns {Object} Returns the new object.
  21803. */
  21804. function basePickBy(object, paths, predicate) {
  21805. var index = -1,
  21806. length = paths.length,
  21807. result = {};
  21808. while (++index < length) {
  21809. var path = paths[index],
  21810. value = baseGet(object, path);
  21811. if (predicate(value, path)) {
  21812. baseSet(result, castPath(path, object), value);
  21813. }
  21814. }
  21815. return result;
  21816. }
  21817. /**
  21818. * A specialized version of `baseProperty` which supports deep paths.
  21819. *
  21820. * @private
  21821. * @param {Array|string} path The path of the property to get.
  21822. * @returns {Function} Returns the new accessor function.
  21823. */
  21824. function basePropertyDeep(path) {
  21825. return function(object) {
  21826. return baseGet(object, path);
  21827. };
  21828. }
  21829. /**
  21830. * The base implementation of `_.pullAllBy` without support for iteratee
  21831. * shorthands.
  21832. *
  21833. * @private
  21834. * @param {Array} array The array to modify.
  21835. * @param {Array} values The values to remove.
  21836. * @param {Function} [iteratee] The iteratee invoked per element.
  21837. * @param {Function} [comparator] The comparator invoked per element.
  21838. * @returns {Array} Returns `array`.
  21839. */
  21840. function basePullAll(array, values, iteratee, comparator) {
  21841. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21842. index = -1,
  21843. length = values.length,
  21844. seen = array;
  21845. if (array === values) {
  21846. values = copyArray(values);
  21847. }
  21848. if (iteratee) {
  21849. seen = arrayMap(array, baseUnary(iteratee));
  21850. }
  21851. while (++index < length) {
  21852. var fromIndex = 0,
  21853. value = values[index],
  21854. computed = iteratee ? iteratee(value) : value;
  21855. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21856. if (seen !== array) {
  21857. splice.call(seen, fromIndex, 1);
  21858. }
  21859. splice.call(array, fromIndex, 1);
  21860. }
  21861. }
  21862. return array;
  21863. }
  21864. /**
  21865. * The base implementation of `_.pullAt` without support for individual
  21866. * indexes or capturing the removed elements.
  21867. *
  21868. * @private
  21869. * @param {Array} array The array to modify.
  21870. * @param {number[]} indexes The indexes of elements to remove.
  21871. * @returns {Array} Returns `array`.
  21872. */
  21873. function basePullAt(array, indexes) {
  21874. var length = array ? indexes.length : 0,
  21875. lastIndex = length - 1;
  21876. while (length--) {
  21877. var index = indexes[length];
  21878. if (length == lastIndex || index !== previous) {
  21879. var previous = index;
  21880. if (isIndex(index)) {
  21881. splice.call(array, index, 1);
  21882. } else {
  21883. baseUnset(array, index);
  21884. }
  21885. }
  21886. }
  21887. return array;
  21888. }
  21889. /**
  21890. * The base implementation of `_.random` without support for returning
  21891. * floating-point numbers.
  21892. *
  21893. * @private
  21894. * @param {number} lower The lower bound.
  21895. * @param {number} upper The upper bound.
  21896. * @returns {number} Returns the random number.
  21897. */
  21898. function baseRandom(lower, upper) {
  21899. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21900. }
  21901. /**
  21902. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21903. * coerce arguments.
  21904. *
  21905. * @private
  21906. * @param {number} start The start of the range.
  21907. * @param {number} end The end of the range.
  21908. * @param {number} step The value to increment or decrement by.
  21909. * @param {boolean} [fromRight] Specify iterating from right to left.
  21910. * @returns {Array} Returns the range of numbers.
  21911. */
  21912. function baseRange(start, end, step, fromRight) {
  21913. var index = -1,
  21914. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21915. result = Array(length);
  21916. while (length--) {
  21917. result[fromRight ? length : ++index] = start;
  21918. start += step;
  21919. }
  21920. return result;
  21921. }
  21922. /**
  21923. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21924. *
  21925. * @private
  21926. * @param {string} string The string to repeat.
  21927. * @param {number} n The number of times to repeat the string.
  21928. * @returns {string} Returns the repeated string.
  21929. */
  21930. function baseRepeat(string, n) {
  21931. var result = '';
  21932. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21933. return result;
  21934. }
  21935. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21936. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21937. do {
  21938. if (n % 2) {
  21939. result += string;
  21940. }
  21941. n = nativeFloor(n / 2);
  21942. if (n) {
  21943. string += string;
  21944. }
  21945. } while (n);
  21946. return result;
  21947. }
  21948. /**
  21949. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21950. *
  21951. * @private
  21952. * @param {Function} func The function to apply a rest parameter to.
  21953. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21954. * @returns {Function} Returns the new function.
  21955. */
  21956. function baseRest(func, start) {
  21957. return setToString(overRest(func, start, identity), func + '');
  21958. }
  21959. /**
  21960. * The base implementation of `_.sample`.
  21961. *
  21962. * @private
  21963. * @param {Array|Object} collection The collection to sample.
  21964. * @returns {*} Returns the random element.
  21965. */
  21966. function baseSample(collection) {
  21967. return arraySample(values(collection));
  21968. }
  21969. /**
  21970. * The base implementation of `_.sampleSize` without param guards.
  21971. *
  21972. * @private
  21973. * @param {Array|Object} collection The collection to sample.
  21974. * @param {number} n The number of elements to sample.
  21975. * @returns {Array} Returns the random elements.
  21976. */
  21977. function baseSampleSize(collection, n) {
  21978. var array = values(collection);
  21979. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21980. }
  21981. /**
  21982. * The base implementation of `_.set`.
  21983. *
  21984. * @private
  21985. * @param {Object} object The object to modify.
  21986. * @param {Array|string} path The path of the property to set.
  21987. * @param {*} value The value to set.
  21988. * @param {Function} [customizer] The function to customize path creation.
  21989. * @returns {Object} Returns `object`.
  21990. */
  21991. function baseSet(object, path, value, customizer) {
  21992. if (!isObject(object)) {
  21993. return object;
  21994. }
  21995. path = castPath(path, object);
  21996. var index = -1,
  21997. length = path.length,
  21998. lastIndex = length - 1,
  21999. nested = object;
  22000. while (nested != null && ++index < length) {
  22001. var key = toKey(path[index]),
  22002. newValue = value;
  22003. if (index != lastIndex) {
  22004. var objValue = nested[key];
  22005. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22006. if (newValue === undefined) {
  22007. newValue = isObject(objValue)
  22008. ? objValue
  22009. : (isIndex(path[index + 1]) ? [] : {});
  22010. }
  22011. }
  22012. assignValue(nested, key, newValue);
  22013. nested = nested[key];
  22014. }
  22015. return object;
  22016. }
  22017. /**
  22018. * The base implementation of `setData` without support for hot loop shorting.
  22019. *
  22020. * @private
  22021. * @param {Function} func The function to associate metadata with.
  22022. * @param {*} data The metadata.
  22023. * @returns {Function} Returns `func`.
  22024. */
  22025. var baseSetData = !metaMap ? identity : function(func, data) {
  22026. metaMap.set(func, data);
  22027. return func;
  22028. };
  22029. /**
  22030. * The base implementation of `setToString` without support for hot loop shorting.
  22031. *
  22032. * @private
  22033. * @param {Function} func The function to modify.
  22034. * @param {Function} string The `toString` result.
  22035. * @returns {Function} Returns `func`.
  22036. */
  22037. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22038. return defineProperty(func, 'toString', {
  22039. 'configurable': true,
  22040. 'enumerable': false,
  22041. 'value': constant(string),
  22042. 'writable': true
  22043. });
  22044. };
  22045. /**
  22046. * The base implementation of `_.shuffle`.
  22047. *
  22048. * @private
  22049. * @param {Array|Object} collection The collection to shuffle.
  22050. * @returns {Array} Returns the new shuffled array.
  22051. */
  22052. function baseShuffle(collection) {
  22053. return shuffleSelf(values(collection));
  22054. }
  22055. /**
  22056. * The base implementation of `_.slice` without an iteratee call guard.
  22057. *
  22058. * @private
  22059. * @param {Array} array The array to slice.
  22060. * @param {number} [start=0] The start position.
  22061. * @param {number} [end=array.length] The end position.
  22062. * @returns {Array} Returns the slice of `array`.
  22063. */
  22064. function baseSlice(array, start, end) {
  22065. var index = -1,
  22066. length = array.length;
  22067. if (start < 0) {
  22068. start = -start > length ? 0 : (length + start);
  22069. }
  22070. end = end > length ? length : end;
  22071. if (end < 0) {
  22072. end += length;
  22073. }
  22074. length = start > end ? 0 : ((end - start) >>> 0);
  22075. start >>>= 0;
  22076. var result = Array(length);
  22077. while (++index < length) {
  22078. result[index] = array[index + start];
  22079. }
  22080. return result;
  22081. }
  22082. /**
  22083. * The base implementation of `_.some` without support for iteratee shorthands.
  22084. *
  22085. * @private
  22086. * @param {Array|Object} collection The collection to iterate over.
  22087. * @param {Function} predicate The function invoked per iteration.
  22088. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22089. * else `false`.
  22090. */
  22091. function baseSome(collection, predicate) {
  22092. var result;
  22093. baseEach(collection, function(value, index, collection) {
  22094. result = predicate(value, index, collection);
  22095. return !result;
  22096. });
  22097. return !!result;
  22098. }
  22099. /**
  22100. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22101. * performs a binary search of `array` to determine the index at which `value`
  22102. * should be inserted into `array` in order to maintain its sort order.
  22103. *
  22104. * @private
  22105. * @param {Array} array The sorted array to inspect.
  22106. * @param {*} value The value to evaluate.
  22107. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22108. * @returns {number} Returns the index at which `value` should be inserted
  22109. * into `array`.
  22110. */
  22111. function baseSortedIndex(array, value, retHighest) {
  22112. var low = 0,
  22113. high = array == null ? low : array.length;
  22114. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22115. while (low < high) {
  22116. var mid = (low + high) >>> 1,
  22117. computed = array[mid];
  22118. if (computed !== null && !isSymbol(computed) &&
  22119. (retHighest ? (computed <= value) : (computed < value))) {
  22120. low = mid + 1;
  22121. } else {
  22122. high = mid;
  22123. }
  22124. }
  22125. return high;
  22126. }
  22127. return baseSortedIndexBy(array, value, identity, retHighest);
  22128. }
  22129. /**
  22130. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22131. * which invokes `iteratee` for `value` and each element of `array` to compute
  22132. * their sort ranking. The iteratee is invoked with one argument; (value).
  22133. *
  22134. * @private
  22135. * @param {Array} array The sorted array to inspect.
  22136. * @param {*} value The value to evaluate.
  22137. * @param {Function} iteratee The iteratee invoked per element.
  22138. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22139. * @returns {number} Returns the index at which `value` should be inserted
  22140. * into `array`.
  22141. */
  22142. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22143. value = iteratee(value);
  22144. var low = 0,
  22145. high = array == null ? 0 : array.length,
  22146. valIsNaN = value !== value,
  22147. valIsNull = value === null,
  22148. valIsSymbol = isSymbol(value),
  22149. valIsUndefined = value === undefined;
  22150. while (low < high) {
  22151. var mid = nativeFloor((low + high) / 2),
  22152. computed = iteratee(array[mid]),
  22153. othIsDefined = computed !== undefined,
  22154. othIsNull = computed === null,
  22155. othIsReflexive = computed === computed,
  22156. othIsSymbol = isSymbol(computed);
  22157. if (valIsNaN) {
  22158. var setLow = retHighest || othIsReflexive;
  22159. } else if (valIsUndefined) {
  22160. setLow = othIsReflexive && (retHighest || othIsDefined);
  22161. } else if (valIsNull) {
  22162. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22163. } else if (valIsSymbol) {
  22164. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22165. } else if (othIsNull || othIsSymbol) {
  22166. setLow = false;
  22167. } else {
  22168. setLow = retHighest ? (computed <= value) : (computed < value);
  22169. }
  22170. if (setLow) {
  22171. low = mid + 1;
  22172. } else {
  22173. high = mid;
  22174. }
  22175. }
  22176. return nativeMin(high, MAX_ARRAY_INDEX);
  22177. }
  22178. /**
  22179. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22180. * support for iteratee shorthands.
  22181. *
  22182. * @private
  22183. * @param {Array} array The array to inspect.
  22184. * @param {Function} [iteratee] The iteratee invoked per element.
  22185. * @returns {Array} Returns the new duplicate free array.
  22186. */
  22187. function baseSortedUniq(array, iteratee) {
  22188. var index = -1,
  22189. length = array.length,
  22190. resIndex = 0,
  22191. result = [];
  22192. while (++index < length) {
  22193. var value = array[index],
  22194. computed = iteratee ? iteratee(value) : value;
  22195. if (!index || !eq(computed, seen)) {
  22196. var seen = computed;
  22197. result[resIndex++] = value === 0 ? 0 : value;
  22198. }
  22199. }
  22200. return result;
  22201. }
  22202. /**
  22203. * The base implementation of `_.toNumber` which doesn't ensure correct
  22204. * conversions of binary, hexadecimal, or octal string values.
  22205. *
  22206. * @private
  22207. * @param {*} value The value to process.
  22208. * @returns {number} Returns the number.
  22209. */
  22210. function baseToNumber(value) {
  22211. if (typeof value == 'number') {
  22212. return value;
  22213. }
  22214. if (isSymbol(value)) {
  22215. return NAN;
  22216. }
  22217. return +value;
  22218. }
  22219. /**
  22220. * The base implementation of `_.toString` which doesn't convert nullish
  22221. * values to empty strings.
  22222. *
  22223. * @private
  22224. * @param {*} value The value to process.
  22225. * @returns {string} Returns the string.
  22226. */
  22227. function baseToString(value) {
  22228. // Exit early for strings to avoid a performance hit in some environments.
  22229. if (typeof value == 'string') {
  22230. return value;
  22231. }
  22232. if (isArray(value)) {
  22233. // Recursively convert values (susceptible to call stack limits).
  22234. return arrayMap(value, baseToString) + '';
  22235. }
  22236. if (isSymbol(value)) {
  22237. return symbolToString ? symbolToString.call(value) : '';
  22238. }
  22239. var result = (value + '');
  22240. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22241. }
  22242. /**
  22243. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22244. *
  22245. * @private
  22246. * @param {Array} array The array to inspect.
  22247. * @param {Function} [iteratee] The iteratee invoked per element.
  22248. * @param {Function} [comparator] The comparator invoked per element.
  22249. * @returns {Array} Returns the new duplicate free array.
  22250. */
  22251. function baseUniq(array, iteratee, comparator) {
  22252. var index = -1,
  22253. includes = arrayIncludes,
  22254. length = array.length,
  22255. isCommon = true,
  22256. result = [],
  22257. seen = result;
  22258. if (comparator) {
  22259. isCommon = false;
  22260. includes = arrayIncludesWith;
  22261. }
  22262. else if (length >= LARGE_ARRAY_SIZE) {
  22263. var set = iteratee ? null : createSet(array);
  22264. if (set) {
  22265. return setToArray(set);
  22266. }
  22267. isCommon = false;
  22268. includes = cacheHas;
  22269. seen = new SetCache;
  22270. }
  22271. else {
  22272. seen = iteratee ? [] : result;
  22273. }
  22274. outer:
  22275. while (++index < length) {
  22276. var value = array[index],
  22277. computed = iteratee ? iteratee(value) : value;
  22278. value = (comparator || value !== 0) ? value : 0;
  22279. if (isCommon && computed === computed) {
  22280. var seenIndex = seen.length;
  22281. while (seenIndex--) {
  22282. if (seen[seenIndex] === computed) {
  22283. continue outer;
  22284. }
  22285. }
  22286. if (iteratee) {
  22287. seen.push(computed);
  22288. }
  22289. result.push(value);
  22290. }
  22291. else if (!includes(seen, computed, comparator)) {
  22292. if (seen !== result) {
  22293. seen.push(computed);
  22294. }
  22295. result.push(value);
  22296. }
  22297. }
  22298. return result;
  22299. }
  22300. /**
  22301. * The base implementation of `_.unset`.
  22302. *
  22303. * @private
  22304. * @param {Object} object The object to modify.
  22305. * @param {Array|string} path The property path to unset.
  22306. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22307. */
  22308. function baseUnset(object, path) {
  22309. path = castPath(path, object);
  22310. object = parent(object, path);
  22311. return object == null || delete object[toKey(last(path))];
  22312. }
  22313. /**
  22314. * The base implementation of `_.update`.
  22315. *
  22316. * @private
  22317. * @param {Object} object The object to modify.
  22318. * @param {Array|string} path The path of the property to update.
  22319. * @param {Function} updater The function to produce the updated value.
  22320. * @param {Function} [customizer] The function to customize path creation.
  22321. * @returns {Object} Returns `object`.
  22322. */
  22323. function baseUpdate(object, path, updater, customizer) {
  22324. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22325. }
  22326. /**
  22327. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22328. * without support for iteratee shorthands.
  22329. *
  22330. * @private
  22331. * @param {Array} array The array to query.
  22332. * @param {Function} predicate The function invoked per iteration.
  22333. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22334. * @param {boolean} [fromRight] Specify iterating from right to left.
  22335. * @returns {Array} Returns the slice of `array`.
  22336. */
  22337. function baseWhile(array, predicate, isDrop, fromRight) {
  22338. var length = array.length,
  22339. index = fromRight ? length : -1;
  22340. while ((fromRight ? index-- : ++index < length) &&
  22341. predicate(array[index], index, array)) {}
  22342. return isDrop
  22343. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22344. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22345. }
  22346. /**
  22347. * The base implementation of `wrapperValue` which returns the result of
  22348. * performing a sequence of actions on the unwrapped `value`, where each
  22349. * successive action is supplied the return value of the previous.
  22350. *
  22351. * @private
  22352. * @param {*} value The unwrapped value.
  22353. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22354. * @returns {*} Returns the resolved value.
  22355. */
  22356. function baseWrapperValue(value, actions) {
  22357. var result = value;
  22358. if (result instanceof LazyWrapper) {
  22359. result = result.value();
  22360. }
  22361. return arrayReduce(actions, function(result, action) {
  22362. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22363. }, result);
  22364. }
  22365. /**
  22366. * The base implementation of methods like `_.xor`, without support for
  22367. * iteratee shorthands, that accepts an array of arrays to inspect.
  22368. *
  22369. * @private
  22370. * @param {Array} arrays The arrays to inspect.
  22371. * @param {Function} [iteratee] The iteratee invoked per element.
  22372. * @param {Function} [comparator] The comparator invoked per element.
  22373. * @returns {Array} Returns the new array of values.
  22374. */
  22375. function baseXor(arrays, iteratee, comparator) {
  22376. var length = arrays.length;
  22377. if (length < 2) {
  22378. return length ? baseUniq(arrays[0]) : [];
  22379. }
  22380. var index = -1,
  22381. result = Array(length);
  22382. while (++index < length) {
  22383. var array = arrays[index],
  22384. othIndex = -1;
  22385. while (++othIndex < length) {
  22386. if (othIndex != index) {
  22387. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22388. }
  22389. }
  22390. }
  22391. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22392. }
  22393. /**
  22394. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22395. *
  22396. * @private
  22397. * @param {Array} props The property identifiers.
  22398. * @param {Array} values The property values.
  22399. * @param {Function} assignFunc The function to assign values.
  22400. * @returns {Object} Returns the new object.
  22401. */
  22402. function baseZipObject(props, values, assignFunc) {
  22403. var index = -1,
  22404. length = props.length,
  22405. valsLength = values.length,
  22406. result = {};
  22407. while (++index < length) {
  22408. var value = index < valsLength ? values[index] : undefined;
  22409. assignFunc(result, props[index], value);
  22410. }
  22411. return result;
  22412. }
  22413. /**
  22414. * Casts `value` to an empty array if it's not an array like object.
  22415. *
  22416. * @private
  22417. * @param {*} value The value to inspect.
  22418. * @returns {Array|Object} Returns the cast array-like object.
  22419. */
  22420. function castArrayLikeObject(value) {
  22421. return isArrayLikeObject(value) ? value : [];
  22422. }
  22423. /**
  22424. * Casts `value` to `identity` if it's not a function.
  22425. *
  22426. * @private
  22427. * @param {*} value The value to inspect.
  22428. * @returns {Function} Returns cast function.
  22429. */
  22430. function castFunction(value) {
  22431. return typeof value == 'function' ? value : identity;
  22432. }
  22433. /**
  22434. * Casts `value` to a path array if it's not one.
  22435. *
  22436. * @private
  22437. * @param {*} value The value to inspect.
  22438. * @param {Object} [object] The object to query keys on.
  22439. * @returns {Array} Returns the cast property path array.
  22440. */
  22441. function castPath(value, object) {
  22442. if (isArray(value)) {
  22443. return value;
  22444. }
  22445. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22446. }
  22447. /**
  22448. * A `baseRest` alias which can be replaced with `identity` by module
  22449. * replacement plugins.
  22450. *
  22451. * @private
  22452. * @type {Function}
  22453. * @param {Function} func The function to apply a rest parameter to.
  22454. * @returns {Function} Returns the new function.
  22455. */
  22456. var castRest = baseRest;
  22457. /**
  22458. * Casts `array` to a slice if it's needed.
  22459. *
  22460. * @private
  22461. * @param {Array} array The array to inspect.
  22462. * @param {number} start The start position.
  22463. * @param {number} [end=array.length] The end position.
  22464. * @returns {Array} Returns the cast slice.
  22465. */
  22466. function castSlice(array, start, end) {
  22467. var length = array.length;
  22468. end = end === undefined ? length : end;
  22469. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22470. }
  22471. /**
  22472. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22473. *
  22474. * @private
  22475. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22476. */
  22477. var clearTimeout = ctxClearTimeout || function(id) {
  22478. return root.clearTimeout(id);
  22479. };
  22480. /**
  22481. * Creates a clone of `buffer`.
  22482. *
  22483. * @private
  22484. * @param {Buffer} buffer The buffer to clone.
  22485. * @param {boolean} [isDeep] Specify a deep clone.
  22486. * @returns {Buffer} Returns the cloned buffer.
  22487. */
  22488. function cloneBuffer(buffer, isDeep) {
  22489. if (isDeep) {
  22490. return buffer.slice();
  22491. }
  22492. var length = buffer.length,
  22493. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22494. buffer.copy(result);
  22495. return result;
  22496. }
  22497. /**
  22498. * Creates a clone of `arrayBuffer`.
  22499. *
  22500. * @private
  22501. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22502. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22503. */
  22504. function cloneArrayBuffer(arrayBuffer) {
  22505. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22506. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22507. return result;
  22508. }
  22509. /**
  22510. * Creates a clone of `dataView`.
  22511. *
  22512. * @private
  22513. * @param {Object} dataView The data view to clone.
  22514. * @param {boolean} [isDeep] Specify a deep clone.
  22515. * @returns {Object} Returns the cloned data view.
  22516. */
  22517. function cloneDataView(dataView, isDeep) {
  22518. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22519. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22520. }
  22521. /**
  22522. * Creates a clone of `regexp`.
  22523. *
  22524. * @private
  22525. * @param {Object} regexp The regexp to clone.
  22526. * @returns {Object} Returns the cloned regexp.
  22527. */
  22528. function cloneRegExp(regexp) {
  22529. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22530. result.lastIndex = regexp.lastIndex;
  22531. return result;
  22532. }
  22533. /**
  22534. * Creates a clone of the `symbol` object.
  22535. *
  22536. * @private
  22537. * @param {Object} symbol The symbol object to clone.
  22538. * @returns {Object} Returns the cloned symbol object.
  22539. */
  22540. function cloneSymbol(symbol) {
  22541. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22542. }
  22543. /**
  22544. * Creates a clone of `typedArray`.
  22545. *
  22546. * @private
  22547. * @param {Object} typedArray The typed array to clone.
  22548. * @param {boolean} [isDeep] Specify a deep clone.
  22549. * @returns {Object} Returns the cloned typed array.
  22550. */
  22551. function cloneTypedArray(typedArray, isDeep) {
  22552. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22553. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22554. }
  22555. /**
  22556. * Compares values to sort them in ascending order.
  22557. *
  22558. * @private
  22559. * @param {*} value The value to compare.
  22560. * @param {*} other The other value to compare.
  22561. * @returns {number} Returns the sort order indicator for `value`.
  22562. */
  22563. function compareAscending(value, other) {
  22564. if (value !== other) {
  22565. var valIsDefined = value !== undefined,
  22566. valIsNull = value === null,
  22567. valIsReflexive = value === value,
  22568. valIsSymbol = isSymbol(value);
  22569. var othIsDefined = other !== undefined,
  22570. othIsNull = other === null,
  22571. othIsReflexive = other === other,
  22572. othIsSymbol = isSymbol(other);
  22573. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22574. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22575. (valIsNull && othIsDefined && othIsReflexive) ||
  22576. (!valIsDefined && othIsReflexive) ||
  22577. !valIsReflexive) {
  22578. return 1;
  22579. }
  22580. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22581. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22582. (othIsNull && valIsDefined && valIsReflexive) ||
  22583. (!othIsDefined && valIsReflexive) ||
  22584. !othIsReflexive) {
  22585. return -1;
  22586. }
  22587. }
  22588. return 0;
  22589. }
  22590. /**
  22591. * Used by `_.orderBy` to compare multiple properties of a value to another
  22592. * and stable sort them.
  22593. *
  22594. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22595. * specify an order of "desc" for descending or "asc" for ascending sort order
  22596. * of corresponding values.
  22597. *
  22598. * @private
  22599. * @param {Object} object The object to compare.
  22600. * @param {Object} other The other object to compare.
  22601. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22602. * @returns {number} Returns the sort order indicator for `object`.
  22603. */
  22604. function compareMultiple(object, other, orders) {
  22605. var index = -1,
  22606. objCriteria = object.criteria,
  22607. othCriteria = other.criteria,
  22608. length = objCriteria.length,
  22609. ordersLength = orders.length;
  22610. while (++index < length) {
  22611. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22612. if (result) {
  22613. if (index >= ordersLength) {
  22614. return result;
  22615. }
  22616. var order = orders[index];
  22617. return result * (order == 'desc' ? -1 : 1);
  22618. }
  22619. }
  22620. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22621. // that causes it, under certain circumstances, to provide the same value for
  22622. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22623. // for more details.
  22624. //
  22625. // This also ensures a stable sort in V8 and other engines.
  22626. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22627. return object.index - other.index;
  22628. }
  22629. /**
  22630. * Creates an array that is the composition of partially applied arguments,
  22631. * placeholders, and provided arguments into a single array of arguments.
  22632. *
  22633. * @private
  22634. * @param {Array} args The provided arguments.
  22635. * @param {Array} partials The arguments to prepend to those provided.
  22636. * @param {Array} holders The `partials` placeholder indexes.
  22637. * @params {boolean} [isCurried] Specify composing for a curried function.
  22638. * @returns {Array} Returns the new array of composed arguments.
  22639. */
  22640. function composeArgs(args, partials, holders, isCurried) {
  22641. var argsIndex = -1,
  22642. argsLength = args.length,
  22643. holdersLength = holders.length,
  22644. leftIndex = -1,
  22645. leftLength = partials.length,
  22646. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22647. result = Array(leftLength + rangeLength),
  22648. isUncurried = !isCurried;
  22649. while (++leftIndex < leftLength) {
  22650. result[leftIndex] = partials[leftIndex];
  22651. }
  22652. while (++argsIndex < holdersLength) {
  22653. if (isUncurried || argsIndex < argsLength) {
  22654. result[holders[argsIndex]] = args[argsIndex];
  22655. }
  22656. }
  22657. while (rangeLength--) {
  22658. result[leftIndex++] = args[argsIndex++];
  22659. }
  22660. return result;
  22661. }
  22662. /**
  22663. * This function is like `composeArgs` except that the arguments composition
  22664. * is tailored for `_.partialRight`.
  22665. *
  22666. * @private
  22667. * @param {Array} args The provided arguments.
  22668. * @param {Array} partials The arguments to append to those provided.
  22669. * @param {Array} holders The `partials` placeholder indexes.
  22670. * @params {boolean} [isCurried] Specify composing for a curried function.
  22671. * @returns {Array} Returns the new array of composed arguments.
  22672. */
  22673. function composeArgsRight(args, partials, holders, isCurried) {
  22674. var argsIndex = -1,
  22675. argsLength = args.length,
  22676. holdersIndex = -1,
  22677. holdersLength = holders.length,
  22678. rightIndex = -1,
  22679. rightLength = partials.length,
  22680. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22681. result = Array(rangeLength + rightLength),
  22682. isUncurried = !isCurried;
  22683. while (++argsIndex < rangeLength) {
  22684. result[argsIndex] = args[argsIndex];
  22685. }
  22686. var offset = argsIndex;
  22687. while (++rightIndex < rightLength) {
  22688. result[offset + rightIndex] = partials[rightIndex];
  22689. }
  22690. while (++holdersIndex < holdersLength) {
  22691. if (isUncurried || argsIndex < argsLength) {
  22692. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22693. }
  22694. }
  22695. return result;
  22696. }
  22697. /**
  22698. * Copies the values of `source` to `array`.
  22699. *
  22700. * @private
  22701. * @param {Array} source The array to copy values from.
  22702. * @param {Array} [array=[]] The array to copy values to.
  22703. * @returns {Array} Returns `array`.
  22704. */
  22705. function copyArray(source, array) {
  22706. var index = -1,
  22707. length = source.length;
  22708. array || (array = Array(length));
  22709. while (++index < length) {
  22710. array[index] = source[index];
  22711. }
  22712. return array;
  22713. }
  22714. /**
  22715. * Copies properties of `source` to `object`.
  22716. *
  22717. * @private
  22718. * @param {Object} source The object to copy properties from.
  22719. * @param {Array} props The property identifiers to copy.
  22720. * @param {Object} [object={}] The object to copy properties to.
  22721. * @param {Function} [customizer] The function to customize copied values.
  22722. * @returns {Object} Returns `object`.
  22723. */
  22724. function copyObject(source, props, object, customizer) {
  22725. var isNew = !object;
  22726. object || (object = {});
  22727. var index = -1,
  22728. length = props.length;
  22729. while (++index < length) {
  22730. var key = props[index];
  22731. var newValue = customizer
  22732. ? customizer(object[key], source[key], key, object, source)
  22733. : undefined;
  22734. if (newValue === undefined) {
  22735. newValue = source[key];
  22736. }
  22737. if (isNew) {
  22738. baseAssignValue(object, key, newValue);
  22739. } else {
  22740. assignValue(object, key, newValue);
  22741. }
  22742. }
  22743. return object;
  22744. }
  22745. /**
  22746. * Copies own symbols of `source` to `object`.
  22747. *
  22748. * @private
  22749. * @param {Object} source The object to copy symbols from.
  22750. * @param {Object} [object={}] The object to copy symbols to.
  22751. * @returns {Object} Returns `object`.
  22752. */
  22753. function copySymbols(source, object) {
  22754. return copyObject(source, getSymbols(source), object);
  22755. }
  22756. /**
  22757. * Copies own and inherited symbols of `source` to `object`.
  22758. *
  22759. * @private
  22760. * @param {Object} source The object to copy symbols from.
  22761. * @param {Object} [object={}] The object to copy symbols to.
  22762. * @returns {Object} Returns `object`.
  22763. */
  22764. function copySymbolsIn(source, object) {
  22765. return copyObject(source, getSymbolsIn(source), object);
  22766. }
  22767. /**
  22768. * Creates a function like `_.groupBy`.
  22769. *
  22770. * @private
  22771. * @param {Function} setter The function to set accumulator values.
  22772. * @param {Function} [initializer] The accumulator object initializer.
  22773. * @returns {Function} Returns the new aggregator function.
  22774. */
  22775. function createAggregator(setter, initializer) {
  22776. return function(collection, iteratee) {
  22777. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22778. accumulator = initializer ? initializer() : {};
  22779. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22780. };
  22781. }
  22782. /**
  22783. * Creates a function like `_.assign`.
  22784. *
  22785. * @private
  22786. * @param {Function} assigner The function to assign values.
  22787. * @returns {Function} Returns the new assigner function.
  22788. */
  22789. function createAssigner(assigner) {
  22790. return baseRest(function(object, sources) {
  22791. var index = -1,
  22792. length = sources.length,
  22793. customizer = length > 1 ? sources[length - 1] : undefined,
  22794. guard = length > 2 ? sources[2] : undefined;
  22795. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22796. ? (length--, customizer)
  22797. : undefined;
  22798. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22799. customizer = length < 3 ? undefined : customizer;
  22800. length = 1;
  22801. }
  22802. object = Object(object);
  22803. while (++index < length) {
  22804. var source = sources[index];
  22805. if (source) {
  22806. assigner(object, source, index, customizer);
  22807. }
  22808. }
  22809. return object;
  22810. });
  22811. }
  22812. /**
  22813. * Creates a `baseEach` or `baseEachRight` function.
  22814. *
  22815. * @private
  22816. * @param {Function} eachFunc The function to iterate over a collection.
  22817. * @param {boolean} [fromRight] Specify iterating from right to left.
  22818. * @returns {Function} Returns the new base function.
  22819. */
  22820. function createBaseEach(eachFunc, fromRight) {
  22821. return function(collection, iteratee) {
  22822. if (collection == null) {
  22823. return collection;
  22824. }
  22825. if (!isArrayLike(collection)) {
  22826. return eachFunc(collection, iteratee);
  22827. }
  22828. var length = collection.length,
  22829. index = fromRight ? length : -1,
  22830. iterable = Object(collection);
  22831. while ((fromRight ? index-- : ++index < length)) {
  22832. if (iteratee(iterable[index], index, iterable) === false) {
  22833. break;
  22834. }
  22835. }
  22836. return collection;
  22837. };
  22838. }
  22839. /**
  22840. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22841. *
  22842. * @private
  22843. * @param {boolean} [fromRight] Specify iterating from right to left.
  22844. * @returns {Function} Returns the new base function.
  22845. */
  22846. function createBaseFor(fromRight) {
  22847. return function(object, iteratee, keysFunc) {
  22848. var index = -1,
  22849. iterable = Object(object),
  22850. props = keysFunc(object),
  22851. length = props.length;
  22852. while (length--) {
  22853. var key = props[fromRight ? length : ++index];
  22854. if (iteratee(iterable[key], key, iterable) === false) {
  22855. break;
  22856. }
  22857. }
  22858. return object;
  22859. };
  22860. }
  22861. /**
  22862. * Creates a function that wraps `func` to invoke it with the optional `this`
  22863. * binding of `thisArg`.
  22864. *
  22865. * @private
  22866. * @param {Function} func The function to wrap.
  22867. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22868. * @param {*} [thisArg] The `this` binding of `func`.
  22869. * @returns {Function} Returns the new wrapped function.
  22870. */
  22871. function createBind(func, bitmask, thisArg) {
  22872. var isBind = bitmask & WRAP_BIND_FLAG,
  22873. Ctor = createCtor(func);
  22874. function wrapper() {
  22875. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22876. return fn.apply(isBind ? thisArg : this, arguments);
  22877. }
  22878. return wrapper;
  22879. }
  22880. /**
  22881. * Creates a function like `_.lowerFirst`.
  22882. *
  22883. * @private
  22884. * @param {string} methodName The name of the `String` case method to use.
  22885. * @returns {Function} Returns the new case function.
  22886. */
  22887. function createCaseFirst(methodName) {
  22888. return function(string) {
  22889. string = toString(string);
  22890. var strSymbols = hasUnicode(string)
  22891. ? stringToArray(string)
  22892. : undefined;
  22893. var chr = strSymbols
  22894. ? strSymbols[0]
  22895. : string.charAt(0);
  22896. var trailing = strSymbols
  22897. ? castSlice(strSymbols, 1).join('')
  22898. : string.slice(1);
  22899. return chr[methodName]() + trailing;
  22900. };
  22901. }
  22902. /**
  22903. * Creates a function like `_.camelCase`.
  22904. *
  22905. * @private
  22906. * @param {Function} callback The function to combine each word.
  22907. * @returns {Function} Returns the new compounder function.
  22908. */
  22909. function createCompounder(callback) {
  22910. return function(string) {
  22911. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22912. };
  22913. }
  22914. /**
  22915. * Creates a function that produces an instance of `Ctor` regardless of
  22916. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22917. *
  22918. * @private
  22919. * @param {Function} Ctor The constructor to wrap.
  22920. * @returns {Function} Returns the new wrapped function.
  22921. */
  22922. function createCtor(Ctor) {
  22923. return function() {
  22924. // Use a `switch` statement to work with class constructors. See
  22925. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22926. // for more details.
  22927. var args = arguments;
  22928. switch (args.length) {
  22929. case 0: return new Ctor;
  22930. case 1: return new Ctor(args[0]);
  22931. case 2: return new Ctor(args[0], args[1]);
  22932. case 3: return new Ctor(args[0], args[1], args[2]);
  22933. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22934. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22935. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22936. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22937. }
  22938. var thisBinding = baseCreate(Ctor.prototype),
  22939. result = Ctor.apply(thisBinding, args);
  22940. // Mimic the constructor's `return` behavior.
  22941. // See https://es5.github.io/#x13.2.2 for more details.
  22942. return isObject(result) ? result : thisBinding;
  22943. };
  22944. }
  22945. /**
  22946. * Creates a function that wraps `func` to enable currying.
  22947. *
  22948. * @private
  22949. * @param {Function} func The function to wrap.
  22950. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22951. * @param {number} arity The arity of `func`.
  22952. * @returns {Function} Returns the new wrapped function.
  22953. */
  22954. function createCurry(func, bitmask, arity) {
  22955. var Ctor = createCtor(func);
  22956. function wrapper() {
  22957. var length = arguments.length,
  22958. args = Array(length),
  22959. index = length,
  22960. placeholder = getHolder(wrapper);
  22961. while (index--) {
  22962. args[index] = arguments[index];
  22963. }
  22964. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22965. ? []
  22966. : replaceHolders(args, placeholder);
  22967. length -= holders.length;
  22968. if (length < arity) {
  22969. return createRecurry(
  22970. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22971. args, holders, undefined, undefined, arity - length);
  22972. }
  22973. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22974. return apply(fn, this, args);
  22975. }
  22976. return wrapper;
  22977. }
  22978. /**
  22979. * Creates a `_.find` or `_.findLast` function.
  22980. *
  22981. * @private
  22982. * @param {Function} findIndexFunc The function to find the collection index.
  22983. * @returns {Function} Returns the new find function.
  22984. */
  22985. function createFind(findIndexFunc) {
  22986. return function(collection, predicate, fromIndex) {
  22987. var iterable = Object(collection);
  22988. if (!isArrayLike(collection)) {
  22989. var iteratee = getIteratee(predicate, 3);
  22990. collection = keys(collection);
  22991. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22992. }
  22993. var index = findIndexFunc(collection, predicate, fromIndex);
  22994. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22995. };
  22996. }
  22997. /**
  22998. * Creates a `_.flow` or `_.flowRight` function.
  22999. *
  23000. * @private
  23001. * @param {boolean} [fromRight] Specify iterating from right to left.
  23002. * @returns {Function} Returns the new flow function.
  23003. */
  23004. function createFlow(fromRight) {
  23005. return flatRest(function(funcs) {
  23006. var length = funcs.length,
  23007. index = length,
  23008. prereq = LodashWrapper.prototype.thru;
  23009. if (fromRight) {
  23010. funcs.reverse();
  23011. }
  23012. while (index--) {
  23013. var func = funcs[index];
  23014. if (typeof func != 'function') {
  23015. throw new TypeError(FUNC_ERROR_TEXT);
  23016. }
  23017. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23018. var wrapper = new LodashWrapper([], true);
  23019. }
  23020. }
  23021. index = wrapper ? index : length;
  23022. while (++index < length) {
  23023. func = funcs[index];
  23024. var funcName = getFuncName(func),
  23025. data = funcName == 'wrapper' ? getData(func) : undefined;
  23026. if (data && isLaziable(data[0]) &&
  23027. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23028. !data[4].length && data[9] == 1
  23029. ) {
  23030. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23031. } else {
  23032. wrapper = (func.length == 1 && isLaziable(func))
  23033. ? wrapper[funcName]()
  23034. : wrapper.thru(func);
  23035. }
  23036. }
  23037. return function() {
  23038. var args = arguments,
  23039. value = args[0];
  23040. if (wrapper && args.length == 1 && isArray(value)) {
  23041. return wrapper.plant(value).value();
  23042. }
  23043. var index = 0,
  23044. result = length ? funcs[index].apply(this, args) : value;
  23045. while (++index < length) {
  23046. result = funcs[index].call(this, result);
  23047. }
  23048. return result;
  23049. };
  23050. });
  23051. }
  23052. /**
  23053. * Creates a function that wraps `func` to invoke it with optional `this`
  23054. * binding of `thisArg`, partial application, and currying.
  23055. *
  23056. * @private
  23057. * @param {Function|string} func The function or method name to wrap.
  23058. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23059. * @param {*} [thisArg] The `this` binding of `func`.
  23060. * @param {Array} [partials] The arguments to prepend to those provided to
  23061. * the new function.
  23062. * @param {Array} [holders] The `partials` placeholder indexes.
  23063. * @param {Array} [partialsRight] The arguments to append to those provided
  23064. * to the new function.
  23065. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23066. * @param {Array} [argPos] The argument positions of the new function.
  23067. * @param {number} [ary] The arity cap of `func`.
  23068. * @param {number} [arity] The arity of `func`.
  23069. * @returns {Function} Returns the new wrapped function.
  23070. */
  23071. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23072. var isAry = bitmask & WRAP_ARY_FLAG,
  23073. isBind = bitmask & WRAP_BIND_FLAG,
  23074. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23075. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23076. isFlip = bitmask & WRAP_FLIP_FLAG,
  23077. Ctor = isBindKey ? undefined : createCtor(func);
  23078. function wrapper() {
  23079. var length = arguments.length,
  23080. args = Array(length),
  23081. index = length;
  23082. while (index--) {
  23083. args[index] = arguments[index];
  23084. }
  23085. if (isCurried) {
  23086. var placeholder = getHolder(wrapper),
  23087. holdersCount = countHolders(args, placeholder);
  23088. }
  23089. if (partials) {
  23090. args = composeArgs(args, partials, holders, isCurried);
  23091. }
  23092. if (partialsRight) {
  23093. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23094. }
  23095. length -= holdersCount;
  23096. if (isCurried && length < arity) {
  23097. var newHolders = replaceHolders(args, placeholder);
  23098. return createRecurry(
  23099. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23100. args, newHolders, argPos, ary, arity - length
  23101. );
  23102. }
  23103. var thisBinding = isBind ? thisArg : this,
  23104. fn = isBindKey ? thisBinding[func] : func;
  23105. length = args.length;
  23106. if (argPos) {
  23107. args = reorder(args, argPos);
  23108. } else if (isFlip && length > 1) {
  23109. args.reverse();
  23110. }
  23111. if (isAry && ary < length) {
  23112. args.length = ary;
  23113. }
  23114. if (this && this !== root && this instanceof wrapper) {
  23115. fn = Ctor || createCtor(fn);
  23116. }
  23117. return fn.apply(thisBinding, args);
  23118. }
  23119. return wrapper;
  23120. }
  23121. /**
  23122. * Creates a function like `_.invertBy`.
  23123. *
  23124. * @private
  23125. * @param {Function} setter The function to set accumulator values.
  23126. * @param {Function} toIteratee The function to resolve iteratees.
  23127. * @returns {Function} Returns the new inverter function.
  23128. */
  23129. function createInverter(setter, toIteratee) {
  23130. return function(object, iteratee) {
  23131. return baseInverter(object, setter, toIteratee(iteratee), {});
  23132. };
  23133. }
  23134. /**
  23135. * Creates a function that performs a mathematical operation on two values.
  23136. *
  23137. * @private
  23138. * @param {Function} operator The function to perform the operation.
  23139. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23140. * @returns {Function} Returns the new mathematical operation function.
  23141. */
  23142. function createMathOperation(operator, defaultValue) {
  23143. return function(value, other) {
  23144. var result;
  23145. if (value === undefined && other === undefined) {
  23146. return defaultValue;
  23147. }
  23148. if (value !== undefined) {
  23149. result = value;
  23150. }
  23151. if (other !== undefined) {
  23152. if (result === undefined) {
  23153. return other;
  23154. }
  23155. if (typeof value == 'string' || typeof other == 'string') {
  23156. value = baseToString(value);
  23157. other = baseToString(other);
  23158. } else {
  23159. value = baseToNumber(value);
  23160. other = baseToNumber(other);
  23161. }
  23162. result = operator(value, other);
  23163. }
  23164. return result;
  23165. };
  23166. }
  23167. /**
  23168. * Creates a function like `_.over`.
  23169. *
  23170. * @private
  23171. * @param {Function} arrayFunc The function to iterate over iteratees.
  23172. * @returns {Function} Returns the new over function.
  23173. */
  23174. function createOver(arrayFunc) {
  23175. return flatRest(function(iteratees) {
  23176. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23177. return baseRest(function(args) {
  23178. var thisArg = this;
  23179. return arrayFunc(iteratees, function(iteratee) {
  23180. return apply(iteratee, thisArg, args);
  23181. });
  23182. });
  23183. });
  23184. }
  23185. /**
  23186. * Creates the padding for `string` based on `length`. The `chars` string
  23187. * is truncated if the number of characters exceeds `length`.
  23188. *
  23189. * @private
  23190. * @param {number} length The padding length.
  23191. * @param {string} [chars=' '] The string used as padding.
  23192. * @returns {string} Returns the padding for `string`.
  23193. */
  23194. function createPadding(length, chars) {
  23195. chars = chars === undefined ? ' ' : baseToString(chars);
  23196. var charsLength = chars.length;
  23197. if (charsLength < 2) {
  23198. return charsLength ? baseRepeat(chars, length) : chars;
  23199. }
  23200. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23201. return hasUnicode(chars)
  23202. ? castSlice(stringToArray(result), 0, length).join('')
  23203. : result.slice(0, length);
  23204. }
  23205. /**
  23206. * Creates a function that wraps `func` to invoke it with the `this` binding
  23207. * of `thisArg` and `partials` prepended to the arguments it receives.
  23208. *
  23209. * @private
  23210. * @param {Function} func The function to wrap.
  23211. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23212. * @param {*} thisArg The `this` binding of `func`.
  23213. * @param {Array} partials The arguments to prepend to those provided to
  23214. * the new function.
  23215. * @returns {Function} Returns the new wrapped function.
  23216. */
  23217. function createPartial(func, bitmask, thisArg, partials) {
  23218. var isBind = bitmask & WRAP_BIND_FLAG,
  23219. Ctor = createCtor(func);
  23220. function wrapper() {
  23221. var argsIndex = -1,
  23222. argsLength = arguments.length,
  23223. leftIndex = -1,
  23224. leftLength = partials.length,
  23225. args = Array(leftLength + argsLength),
  23226. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23227. while (++leftIndex < leftLength) {
  23228. args[leftIndex] = partials[leftIndex];
  23229. }
  23230. while (argsLength--) {
  23231. args[leftIndex++] = arguments[++argsIndex];
  23232. }
  23233. return apply(fn, isBind ? thisArg : this, args);
  23234. }
  23235. return wrapper;
  23236. }
  23237. /**
  23238. * Creates a `_.range` or `_.rangeRight` function.
  23239. *
  23240. * @private
  23241. * @param {boolean} [fromRight] Specify iterating from right to left.
  23242. * @returns {Function} Returns the new range function.
  23243. */
  23244. function createRange(fromRight) {
  23245. return function(start, end, step) {
  23246. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23247. end = step = undefined;
  23248. }
  23249. // Ensure the sign of `-0` is preserved.
  23250. start = toFinite(start);
  23251. if (end === undefined) {
  23252. end = start;
  23253. start = 0;
  23254. } else {
  23255. end = toFinite(end);
  23256. }
  23257. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23258. return baseRange(start, end, step, fromRight);
  23259. };
  23260. }
  23261. /**
  23262. * Creates a function that performs a relational operation on two values.
  23263. *
  23264. * @private
  23265. * @param {Function} operator The function to perform the operation.
  23266. * @returns {Function} Returns the new relational operation function.
  23267. */
  23268. function createRelationalOperation(operator) {
  23269. return function(value, other) {
  23270. if (!(typeof value == 'string' && typeof other == 'string')) {
  23271. value = toNumber(value);
  23272. other = toNumber(other);
  23273. }
  23274. return operator(value, other);
  23275. };
  23276. }
  23277. /**
  23278. * Creates a function that wraps `func` to continue currying.
  23279. *
  23280. * @private
  23281. * @param {Function} func The function to wrap.
  23282. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23283. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23284. * @param {*} placeholder The placeholder value.
  23285. * @param {*} [thisArg] The `this` binding of `func`.
  23286. * @param {Array} [partials] The arguments to prepend to those provided to
  23287. * the new function.
  23288. * @param {Array} [holders] The `partials` placeholder indexes.
  23289. * @param {Array} [argPos] The argument positions of the new function.
  23290. * @param {number} [ary] The arity cap of `func`.
  23291. * @param {number} [arity] The arity of `func`.
  23292. * @returns {Function} Returns the new wrapped function.
  23293. */
  23294. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23295. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23296. newHolders = isCurry ? holders : undefined,
  23297. newHoldersRight = isCurry ? undefined : holders,
  23298. newPartials = isCurry ? partials : undefined,
  23299. newPartialsRight = isCurry ? undefined : partials;
  23300. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23301. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23302. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23303. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23304. }
  23305. var newData = [
  23306. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23307. newHoldersRight, argPos, ary, arity
  23308. ];
  23309. var result = wrapFunc.apply(undefined, newData);
  23310. if (isLaziable(func)) {
  23311. setData(result, newData);
  23312. }
  23313. result.placeholder = placeholder;
  23314. return setWrapToString(result, func, bitmask);
  23315. }
  23316. /**
  23317. * Creates a function like `_.round`.
  23318. *
  23319. * @private
  23320. * @param {string} methodName The name of the `Math` method to use when rounding.
  23321. * @returns {Function} Returns the new round function.
  23322. */
  23323. function createRound(methodName) {
  23324. var func = Math[methodName];
  23325. return function(number, precision) {
  23326. number = toNumber(number);
  23327. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23328. if (precision && nativeIsFinite(number)) {
  23329. // Shift with exponential notation to avoid floating-point issues.
  23330. // See [MDN](https://mdn.io/round#Examples) for more details.
  23331. var pair = (toString(number) + 'e').split('e'),
  23332. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23333. pair = (toString(value) + 'e').split('e');
  23334. return +(pair[0] + 'e' + (+pair[1] - precision));
  23335. }
  23336. return func(number);
  23337. };
  23338. }
  23339. /**
  23340. * Creates a set object of `values`.
  23341. *
  23342. * @private
  23343. * @param {Array} values The values to add to the set.
  23344. * @returns {Object} Returns the new set.
  23345. */
  23346. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23347. return new Set(values);
  23348. };
  23349. /**
  23350. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23351. *
  23352. * @private
  23353. * @param {Function} keysFunc The function to get the keys of a given object.
  23354. * @returns {Function} Returns the new pairs function.
  23355. */
  23356. function createToPairs(keysFunc) {
  23357. return function(object) {
  23358. var tag = getTag(object);
  23359. if (tag == mapTag) {
  23360. return mapToArray(object);
  23361. }
  23362. if (tag == setTag) {
  23363. return setToPairs(object);
  23364. }
  23365. return baseToPairs(object, keysFunc(object));
  23366. };
  23367. }
  23368. /**
  23369. * Creates a function that either curries or invokes `func` with optional
  23370. * `this` binding and partially applied arguments.
  23371. *
  23372. * @private
  23373. * @param {Function|string} func The function or method name to wrap.
  23374. * @param {number} bitmask The bitmask flags.
  23375. * 1 - `_.bind`
  23376. * 2 - `_.bindKey`
  23377. * 4 - `_.curry` or `_.curryRight` of a bound function
  23378. * 8 - `_.curry`
  23379. * 16 - `_.curryRight`
  23380. * 32 - `_.partial`
  23381. * 64 - `_.partialRight`
  23382. * 128 - `_.rearg`
  23383. * 256 - `_.ary`
  23384. * 512 - `_.flip`
  23385. * @param {*} [thisArg] The `this` binding of `func`.
  23386. * @param {Array} [partials] The arguments to be partially applied.
  23387. * @param {Array} [holders] The `partials` placeholder indexes.
  23388. * @param {Array} [argPos] The argument positions of the new function.
  23389. * @param {number} [ary] The arity cap of `func`.
  23390. * @param {number} [arity] The arity of `func`.
  23391. * @returns {Function} Returns the new wrapped function.
  23392. */
  23393. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23394. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23395. if (!isBindKey && typeof func != 'function') {
  23396. throw new TypeError(FUNC_ERROR_TEXT);
  23397. }
  23398. var length = partials ? partials.length : 0;
  23399. if (!length) {
  23400. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23401. partials = holders = undefined;
  23402. }
  23403. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23404. arity = arity === undefined ? arity : toInteger(arity);
  23405. length -= holders ? holders.length : 0;
  23406. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23407. var partialsRight = partials,
  23408. holdersRight = holders;
  23409. partials = holders = undefined;
  23410. }
  23411. var data = isBindKey ? undefined : getData(func);
  23412. var newData = [
  23413. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23414. argPos, ary, arity
  23415. ];
  23416. if (data) {
  23417. mergeData(newData, data);
  23418. }
  23419. func = newData[0];
  23420. bitmask = newData[1];
  23421. thisArg = newData[2];
  23422. partials = newData[3];
  23423. holders = newData[4];
  23424. arity = newData[9] = newData[9] === undefined
  23425. ? (isBindKey ? 0 : func.length)
  23426. : nativeMax(newData[9] - length, 0);
  23427. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23428. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23429. }
  23430. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23431. var result = createBind(func, bitmask, thisArg);
  23432. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23433. result = createCurry(func, bitmask, arity);
  23434. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23435. result = createPartial(func, bitmask, thisArg, partials);
  23436. } else {
  23437. result = createHybrid.apply(undefined, newData);
  23438. }
  23439. var setter = data ? baseSetData : setData;
  23440. return setWrapToString(setter(result, newData), func, bitmask);
  23441. }
  23442. /**
  23443. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23444. * of source objects to the destination object for all destination properties
  23445. * that resolve to `undefined`.
  23446. *
  23447. * @private
  23448. * @param {*} objValue The destination value.
  23449. * @param {*} srcValue The source value.
  23450. * @param {string} key The key of the property to assign.
  23451. * @param {Object} object The parent object of `objValue`.
  23452. * @returns {*} Returns the value to assign.
  23453. */
  23454. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23455. if (objValue === undefined ||
  23456. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23457. return srcValue;
  23458. }
  23459. return objValue;
  23460. }
  23461. /**
  23462. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23463. * objects into destination objects that are passed thru.
  23464. *
  23465. * @private
  23466. * @param {*} objValue The destination value.
  23467. * @param {*} srcValue The source value.
  23468. * @param {string} key The key of the property to merge.
  23469. * @param {Object} object The parent object of `objValue`.
  23470. * @param {Object} source The parent object of `srcValue`.
  23471. * @param {Object} [stack] Tracks traversed source values and their merged
  23472. * counterparts.
  23473. * @returns {*} Returns the value to assign.
  23474. */
  23475. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23476. if (isObject(objValue) && isObject(srcValue)) {
  23477. // Recursively merge objects and arrays (susceptible to call stack limits).
  23478. stack.set(srcValue, objValue);
  23479. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23480. stack['delete'](srcValue);
  23481. }
  23482. return objValue;
  23483. }
  23484. /**
  23485. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23486. * objects.
  23487. *
  23488. * @private
  23489. * @param {*} value The value to inspect.
  23490. * @param {string} key The key of the property to inspect.
  23491. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23492. */
  23493. function customOmitClone(value) {
  23494. return isPlainObject(value) ? undefined : value;
  23495. }
  23496. /**
  23497. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23498. * partial deep comparisons.
  23499. *
  23500. * @private
  23501. * @param {Array} array The array to compare.
  23502. * @param {Array} other The other array to compare.
  23503. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23504. * @param {Function} customizer The function to customize comparisons.
  23505. * @param {Function} equalFunc The function to determine equivalents of values.
  23506. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23507. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23508. */
  23509. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23510. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23511. arrLength = array.length,
  23512. othLength = other.length;
  23513. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23514. return false;
  23515. }
  23516. // Assume cyclic values are equal.
  23517. var stacked = stack.get(array);
  23518. if (stacked && stack.get(other)) {
  23519. return stacked == other;
  23520. }
  23521. var index = -1,
  23522. result = true,
  23523. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23524. stack.set(array, other);
  23525. stack.set(other, array);
  23526. // Ignore non-index properties.
  23527. while (++index < arrLength) {
  23528. var arrValue = array[index],
  23529. othValue = other[index];
  23530. if (customizer) {
  23531. var compared = isPartial
  23532. ? customizer(othValue, arrValue, index, other, array, stack)
  23533. : customizer(arrValue, othValue, index, array, other, stack);
  23534. }
  23535. if (compared !== undefined) {
  23536. if (compared) {
  23537. continue;
  23538. }
  23539. result = false;
  23540. break;
  23541. }
  23542. // Recursively compare arrays (susceptible to call stack limits).
  23543. if (seen) {
  23544. if (!arraySome(other, function(othValue, othIndex) {
  23545. if (!cacheHas(seen, othIndex) &&
  23546. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23547. return seen.push(othIndex);
  23548. }
  23549. })) {
  23550. result = false;
  23551. break;
  23552. }
  23553. } else if (!(
  23554. arrValue === othValue ||
  23555. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23556. )) {
  23557. result = false;
  23558. break;
  23559. }
  23560. }
  23561. stack['delete'](array);
  23562. stack['delete'](other);
  23563. return result;
  23564. }
  23565. /**
  23566. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23567. * the same `toStringTag`.
  23568. *
  23569. * **Note:** This function only supports comparing values with tags of
  23570. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23571. *
  23572. * @private
  23573. * @param {Object} object The object to compare.
  23574. * @param {Object} other The other object to compare.
  23575. * @param {string} tag The `toStringTag` of the objects to compare.
  23576. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23577. * @param {Function} customizer The function to customize comparisons.
  23578. * @param {Function} equalFunc The function to determine equivalents of values.
  23579. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23580. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23581. */
  23582. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23583. switch (tag) {
  23584. case dataViewTag:
  23585. if ((object.byteLength != other.byteLength) ||
  23586. (object.byteOffset != other.byteOffset)) {
  23587. return false;
  23588. }
  23589. object = object.buffer;
  23590. other = other.buffer;
  23591. case arrayBufferTag:
  23592. if ((object.byteLength != other.byteLength) ||
  23593. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23594. return false;
  23595. }
  23596. return true;
  23597. case boolTag:
  23598. case dateTag:
  23599. case numberTag:
  23600. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23601. // Invalid dates are coerced to `NaN`.
  23602. return eq(+object, +other);
  23603. case errorTag:
  23604. return object.name == other.name && object.message == other.message;
  23605. case regexpTag:
  23606. case stringTag:
  23607. // Coerce regexes to strings and treat strings, primitives and objects,
  23608. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23609. // for more details.
  23610. return object == (other + '');
  23611. case mapTag:
  23612. var convert = mapToArray;
  23613. case setTag:
  23614. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23615. convert || (convert = setToArray);
  23616. if (object.size != other.size && !isPartial) {
  23617. return false;
  23618. }
  23619. // Assume cyclic values are equal.
  23620. var stacked = stack.get(object);
  23621. if (stacked) {
  23622. return stacked == other;
  23623. }
  23624. bitmask |= COMPARE_UNORDERED_FLAG;
  23625. // Recursively compare objects (susceptible to call stack limits).
  23626. stack.set(object, other);
  23627. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23628. stack['delete'](object);
  23629. return result;
  23630. case symbolTag:
  23631. if (symbolValueOf) {
  23632. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23633. }
  23634. }
  23635. return false;
  23636. }
  23637. /**
  23638. * A specialized version of `baseIsEqualDeep` for objects with support for
  23639. * partial deep comparisons.
  23640. *
  23641. * @private
  23642. * @param {Object} object The object to compare.
  23643. * @param {Object} other The other object to compare.
  23644. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23645. * @param {Function} customizer The function to customize comparisons.
  23646. * @param {Function} equalFunc The function to determine equivalents of values.
  23647. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23648. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23649. */
  23650. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23651. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23652. objProps = getAllKeys(object),
  23653. objLength = objProps.length,
  23654. othProps = getAllKeys(other),
  23655. othLength = othProps.length;
  23656. if (objLength != othLength && !isPartial) {
  23657. return false;
  23658. }
  23659. var index = objLength;
  23660. while (index--) {
  23661. var key = objProps[index];
  23662. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23663. return false;
  23664. }
  23665. }
  23666. // Assume cyclic values are equal.
  23667. var stacked = stack.get(object);
  23668. if (stacked && stack.get(other)) {
  23669. return stacked == other;
  23670. }
  23671. var result = true;
  23672. stack.set(object, other);
  23673. stack.set(other, object);
  23674. var skipCtor = isPartial;
  23675. while (++index < objLength) {
  23676. key = objProps[index];
  23677. var objValue = object[key],
  23678. othValue = other[key];
  23679. if (customizer) {
  23680. var compared = isPartial
  23681. ? customizer(othValue, objValue, key, other, object, stack)
  23682. : customizer(objValue, othValue, key, object, other, stack);
  23683. }
  23684. // Recursively compare objects (susceptible to call stack limits).
  23685. if (!(compared === undefined
  23686. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23687. : compared
  23688. )) {
  23689. result = false;
  23690. break;
  23691. }
  23692. skipCtor || (skipCtor = key == 'constructor');
  23693. }
  23694. if (result && !skipCtor) {
  23695. var objCtor = object.constructor,
  23696. othCtor = other.constructor;
  23697. // Non `Object` object instances with different constructors are not equal.
  23698. if (objCtor != othCtor &&
  23699. ('constructor' in object && 'constructor' in other) &&
  23700. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23701. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23702. result = false;
  23703. }
  23704. }
  23705. stack['delete'](object);
  23706. stack['delete'](other);
  23707. return result;
  23708. }
  23709. /**
  23710. * A specialized version of `baseRest` which flattens the rest array.
  23711. *
  23712. * @private
  23713. * @param {Function} func The function to apply a rest parameter to.
  23714. * @returns {Function} Returns the new function.
  23715. */
  23716. function flatRest(func) {
  23717. return setToString(overRest(func, undefined, flatten), func + '');
  23718. }
  23719. /**
  23720. * Creates an array of own enumerable property names and symbols of `object`.
  23721. *
  23722. * @private
  23723. * @param {Object} object The object to query.
  23724. * @returns {Array} Returns the array of property names and symbols.
  23725. */
  23726. function getAllKeys(object) {
  23727. return baseGetAllKeys(object, keys, getSymbols);
  23728. }
  23729. /**
  23730. * Creates an array of own and inherited enumerable property names and
  23731. * symbols of `object`.
  23732. *
  23733. * @private
  23734. * @param {Object} object The object to query.
  23735. * @returns {Array} Returns the array of property names and symbols.
  23736. */
  23737. function getAllKeysIn(object) {
  23738. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23739. }
  23740. /**
  23741. * Gets metadata for `func`.
  23742. *
  23743. * @private
  23744. * @param {Function} func The function to query.
  23745. * @returns {*} Returns the metadata for `func`.
  23746. */
  23747. var getData = !metaMap ? noop : function(func) {
  23748. return metaMap.get(func);
  23749. };
  23750. /**
  23751. * Gets the name of `func`.
  23752. *
  23753. * @private
  23754. * @param {Function} func The function to query.
  23755. * @returns {string} Returns the function name.
  23756. */
  23757. function getFuncName(func) {
  23758. var result = (func.name + ''),
  23759. array = realNames[result],
  23760. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23761. while (length--) {
  23762. var data = array[length],
  23763. otherFunc = data.func;
  23764. if (otherFunc == null || otherFunc == func) {
  23765. return data.name;
  23766. }
  23767. }
  23768. return result;
  23769. }
  23770. /**
  23771. * Gets the argument placeholder value for `func`.
  23772. *
  23773. * @private
  23774. * @param {Function} func The function to inspect.
  23775. * @returns {*} Returns the placeholder value.
  23776. */
  23777. function getHolder(func) {
  23778. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23779. return object.placeholder;
  23780. }
  23781. /**
  23782. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23783. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23784. * If arguments are provided, the chosen function is invoked with them and
  23785. * its result is returned.
  23786. *
  23787. * @private
  23788. * @param {*} [value] The value to convert to an iteratee.
  23789. * @param {number} [arity] The arity of the created iteratee.
  23790. * @returns {Function} Returns the chosen function or its result.
  23791. */
  23792. function getIteratee() {
  23793. var result = lodash.iteratee || iteratee;
  23794. result = result === iteratee ? baseIteratee : result;
  23795. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23796. }
  23797. /**
  23798. * Gets the data for `map`.
  23799. *
  23800. * @private
  23801. * @param {Object} map The map to query.
  23802. * @param {string} key The reference key.
  23803. * @returns {*} Returns the map data.
  23804. */
  23805. function getMapData(map, key) {
  23806. var data = map.__data__;
  23807. return isKeyable(key)
  23808. ? data[typeof key == 'string' ? 'string' : 'hash']
  23809. : data.map;
  23810. }
  23811. /**
  23812. * Gets the property names, values, and compare flags of `object`.
  23813. *
  23814. * @private
  23815. * @param {Object} object The object to query.
  23816. * @returns {Array} Returns the match data of `object`.
  23817. */
  23818. function getMatchData(object) {
  23819. var result = keys(object),
  23820. length = result.length;
  23821. while (length--) {
  23822. var key = result[length],
  23823. value = object[key];
  23824. result[length] = [key, value, isStrictComparable(value)];
  23825. }
  23826. return result;
  23827. }
  23828. /**
  23829. * Gets the native function at `key` of `object`.
  23830. *
  23831. * @private
  23832. * @param {Object} object The object to query.
  23833. * @param {string} key The key of the method to get.
  23834. * @returns {*} Returns the function if it's native, else `undefined`.
  23835. */
  23836. function getNative(object, key) {
  23837. var value = getValue(object, key);
  23838. return baseIsNative(value) ? value : undefined;
  23839. }
  23840. /**
  23841. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23842. *
  23843. * @private
  23844. * @param {*} value The value to query.
  23845. * @returns {string} Returns the raw `toStringTag`.
  23846. */
  23847. function getRawTag(value) {
  23848. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23849. tag = value[symToStringTag];
  23850. try {
  23851. value[symToStringTag] = undefined;
  23852. var unmasked = true;
  23853. } catch (e) {}
  23854. var result = nativeObjectToString.call(value);
  23855. if (unmasked) {
  23856. if (isOwn) {
  23857. value[symToStringTag] = tag;
  23858. } else {
  23859. delete value[symToStringTag];
  23860. }
  23861. }
  23862. return result;
  23863. }
  23864. /**
  23865. * Creates an array of the own enumerable symbols of `object`.
  23866. *
  23867. * @private
  23868. * @param {Object} object The object to query.
  23869. * @returns {Array} Returns the array of symbols.
  23870. */
  23871. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23872. if (object == null) {
  23873. return [];
  23874. }
  23875. object = Object(object);
  23876. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23877. return propertyIsEnumerable.call(object, symbol);
  23878. });
  23879. };
  23880. /**
  23881. * Creates an array of the own and inherited enumerable symbols of `object`.
  23882. *
  23883. * @private
  23884. * @param {Object} object The object to query.
  23885. * @returns {Array} Returns the array of symbols.
  23886. */
  23887. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23888. var result = [];
  23889. while (object) {
  23890. arrayPush(result, getSymbols(object));
  23891. object = getPrototype(object);
  23892. }
  23893. return result;
  23894. };
  23895. /**
  23896. * Gets the `toStringTag` of `value`.
  23897. *
  23898. * @private
  23899. * @param {*} value The value to query.
  23900. * @returns {string} Returns the `toStringTag`.
  23901. */
  23902. var getTag = baseGetTag;
  23903. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23904. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23905. (Map && getTag(new Map) != mapTag) ||
  23906. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23907. (Set && getTag(new Set) != setTag) ||
  23908. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23909. getTag = function(value) {
  23910. var result = baseGetTag(value),
  23911. Ctor = result == objectTag ? value.constructor : undefined,
  23912. ctorString = Ctor ? toSource(Ctor) : '';
  23913. if (ctorString) {
  23914. switch (ctorString) {
  23915. case dataViewCtorString: return dataViewTag;
  23916. case mapCtorString: return mapTag;
  23917. case promiseCtorString: return promiseTag;
  23918. case setCtorString: return setTag;
  23919. case weakMapCtorString: return weakMapTag;
  23920. }
  23921. }
  23922. return result;
  23923. };
  23924. }
  23925. /**
  23926. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23927. *
  23928. * @private
  23929. * @param {number} start The start of the view.
  23930. * @param {number} end The end of the view.
  23931. * @param {Array} transforms The transformations to apply to the view.
  23932. * @returns {Object} Returns an object containing the `start` and `end`
  23933. * positions of the view.
  23934. */
  23935. function getView(start, end, transforms) {
  23936. var index = -1,
  23937. length = transforms.length;
  23938. while (++index < length) {
  23939. var data = transforms[index],
  23940. size = data.size;
  23941. switch (data.type) {
  23942. case 'drop': start += size; break;
  23943. case 'dropRight': end -= size; break;
  23944. case 'take': end = nativeMin(end, start + size); break;
  23945. case 'takeRight': start = nativeMax(start, end - size); break;
  23946. }
  23947. }
  23948. return { 'start': start, 'end': end };
  23949. }
  23950. /**
  23951. * Extracts wrapper details from the `source` body comment.
  23952. *
  23953. * @private
  23954. * @param {string} source The source to inspect.
  23955. * @returns {Array} Returns the wrapper details.
  23956. */
  23957. function getWrapDetails(source) {
  23958. var match = source.match(reWrapDetails);
  23959. return match ? match[1].split(reSplitDetails) : [];
  23960. }
  23961. /**
  23962. * Checks if `path` exists on `object`.
  23963. *
  23964. * @private
  23965. * @param {Object} object The object to query.
  23966. * @param {Array|string} path The path to check.
  23967. * @param {Function} hasFunc The function to check properties.
  23968. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23969. */
  23970. function hasPath(object, path, hasFunc) {
  23971. path = castPath(path, object);
  23972. var index = -1,
  23973. length = path.length,
  23974. result = false;
  23975. while (++index < length) {
  23976. var key = toKey(path[index]);
  23977. if (!(result = object != null && hasFunc(object, key))) {
  23978. break;
  23979. }
  23980. object = object[key];
  23981. }
  23982. if (result || ++index != length) {
  23983. return result;
  23984. }
  23985. length = object == null ? 0 : object.length;
  23986. return !!length && isLength(length) && isIndex(key, length) &&
  23987. (isArray(object) || isArguments(object));
  23988. }
  23989. /**
  23990. * Initializes an array clone.
  23991. *
  23992. * @private
  23993. * @param {Array} array The array to clone.
  23994. * @returns {Array} Returns the initialized clone.
  23995. */
  23996. function initCloneArray(array) {
  23997. var length = array.length,
  23998. result = new array.constructor(length);
  23999. // Add properties assigned by `RegExp#exec`.
  24000. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24001. result.index = array.index;
  24002. result.input = array.input;
  24003. }
  24004. return result;
  24005. }
  24006. /**
  24007. * Initializes an object clone.
  24008. *
  24009. * @private
  24010. * @param {Object} object The object to clone.
  24011. * @returns {Object} Returns the initialized clone.
  24012. */
  24013. function initCloneObject(object) {
  24014. return (typeof object.constructor == 'function' && !isPrototype(object))
  24015. ? baseCreate(getPrototype(object))
  24016. : {};
  24017. }
  24018. /**
  24019. * Initializes an object clone based on its `toStringTag`.
  24020. *
  24021. * **Note:** This function only supports cloning values with tags of
  24022. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24023. *
  24024. * @private
  24025. * @param {Object} object The object to clone.
  24026. * @param {string} tag The `toStringTag` of the object to clone.
  24027. * @param {boolean} [isDeep] Specify a deep clone.
  24028. * @returns {Object} Returns the initialized clone.
  24029. */
  24030. function initCloneByTag(object, tag, isDeep) {
  24031. var Ctor = object.constructor;
  24032. switch (tag) {
  24033. case arrayBufferTag:
  24034. return cloneArrayBuffer(object);
  24035. case boolTag:
  24036. case dateTag:
  24037. return new Ctor(+object);
  24038. case dataViewTag:
  24039. return cloneDataView(object, isDeep);
  24040. case float32Tag: case float64Tag:
  24041. case int8Tag: case int16Tag: case int32Tag:
  24042. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24043. return cloneTypedArray(object, isDeep);
  24044. case mapTag:
  24045. return new Ctor;
  24046. case numberTag:
  24047. case stringTag:
  24048. return new Ctor(object);
  24049. case regexpTag:
  24050. return cloneRegExp(object);
  24051. case setTag:
  24052. return new Ctor;
  24053. case symbolTag:
  24054. return cloneSymbol(object);
  24055. }
  24056. }
  24057. /**
  24058. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24059. *
  24060. * @private
  24061. * @param {string} source The source to modify.
  24062. * @returns {Array} details The details to insert.
  24063. * @returns {string} Returns the modified source.
  24064. */
  24065. function insertWrapDetails(source, details) {
  24066. var length = details.length;
  24067. if (!length) {
  24068. return source;
  24069. }
  24070. var lastIndex = length - 1;
  24071. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24072. details = details.join(length > 2 ? ', ' : ' ');
  24073. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24074. }
  24075. /**
  24076. * Checks if `value` is a flattenable `arguments` object or array.
  24077. *
  24078. * @private
  24079. * @param {*} value The value to check.
  24080. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24081. */
  24082. function isFlattenable(value) {
  24083. return isArray(value) || isArguments(value) ||
  24084. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24085. }
  24086. /**
  24087. * Checks if `value` is a valid array-like index.
  24088. *
  24089. * @private
  24090. * @param {*} value The value to check.
  24091. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24092. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24093. */
  24094. function isIndex(value, length) {
  24095. var type = typeof value;
  24096. length = length == null ? MAX_SAFE_INTEGER : length;
  24097. return !!length &&
  24098. (type == 'number' ||
  24099. (type != 'symbol' && reIsUint.test(value))) &&
  24100. (value > -1 && value % 1 == 0 && value < length);
  24101. }
  24102. /**
  24103. * Checks if the given arguments are from an iteratee call.
  24104. *
  24105. * @private
  24106. * @param {*} value The potential iteratee value argument.
  24107. * @param {*} index The potential iteratee index or key argument.
  24108. * @param {*} object The potential iteratee object argument.
  24109. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24110. * else `false`.
  24111. */
  24112. function isIterateeCall(value, index, object) {
  24113. if (!isObject(object)) {
  24114. return false;
  24115. }
  24116. var type = typeof index;
  24117. if (type == 'number'
  24118. ? (isArrayLike(object) && isIndex(index, object.length))
  24119. : (type == 'string' && index in object)
  24120. ) {
  24121. return eq(object[index], value);
  24122. }
  24123. return false;
  24124. }
  24125. /**
  24126. * Checks if `value` is a property name and not a property path.
  24127. *
  24128. * @private
  24129. * @param {*} value The value to check.
  24130. * @param {Object} [object] The object to query keys on.
  24131. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24132. */
  24133. function isKey(value, object) {
  24134. if (isArray(value)) {
  24135. return false;
  24136. }
  24137. var type = typeof value;
  24138. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24139. value == null || isSymbol(value)) {
  24140. return true;
  24141. }
  24142. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24143. (object != null && value in Object(object));
  24144. }
  24145. /**
  24146. * Checks if `value` is suitable for use as unique object key.
  24147. *
  24148. * @private
  24149. * @param {*} value The value to check.
  24150. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24151. */
  24152. function isKeyable(value) {
  24153. var type = typeof value;
  24154. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24155. ? (value !== '__proto__')
  24156. : (value === null);
  24157. }
  24158. /**
  24159. * Checks if `func` has a lazy counterpart.
  24160. *
  24161. * @private
  24162. * @param {Function} func The function to check.
  24163. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24164. * else `false`.
  24165. */
  24166. function isLaziable(func) {
  24167. var funcName = getFuncName(func),
  24168. other = lodash[funcName];
  24169. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24170. return false;
  24171. }
  24172. if (func === other) {
  24173. return true;
  24174. }
  24175. var data = getData(other);
  24176. return !!data && func === data[0];
  24177. }
  24178. /**
  24179. * Checks if `func` has its source masked.
  24180. *
  24181. * @private
  24182. * @param {Function} func The function to check.
  24183. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24184. */
  24185. function isMasked(func) {
  24186. return !!maskSrcKey && (maskSrcKey in func);
  24187. }
  24188. /**
  24189. * Checks if `func` is capable of being masked.
  24190. *
  24191. * @private
  24192. * @param {*} value The value to check.
  24193. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24194. */
  24195. var isMaskable = coreJsData ? isFunction : stubFalse;
  24196. /**
  24197. * Checks if `value` is likely a prototype object.
  24198. *
  24199. * @private
  24200. * @param {*} value The value to check.
  24201. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24202. */
  24203. function isPrototype(value) {
  24204. var Ctor = value && value.constructor,
  24205. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24206. return value === proto;
  24207. }
  24208. /**
  24209. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24210. *
  24211. * @private
  24212. * @param {*} value The value to check.
  24213. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24214. * equality comparisons, else `false`.
  24215. */
  24216. function isStrictComparable(value) {
  24217. return value === value && !isObject(value);
  24218. }
  24219. /**
  24220. * A specialized version of `matchesProperty` for source values suitable
  24221. * for strict equality comparisons, i.e. `===`.
  24222. *
  24223. * @private
  24224. * @param {string} key The key of the property to get.
  24225. * @param {*} srcValue The value to match.
  24226. * @returns {Function} Returns the new spec function.
  24227. */
  24228. function matchesStrictComparable(key, srcValue) {
  24229. return function(object) {
  24230. if (object == null) {
  24231. return false;
  24232. }
  24233. return object[key] === srcValue &&
  24234. (srcValue !== undefined || (key in Object(object)));
  24235. };
  24236. }
  24237. /**
  24238. * A specialized version of `_.memoize` which clears the memoized function's
  24239. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24240. *
  24241. * @private
  24242. * @param {Function} func The function to have its output memoized.
  24243. * @returns {Function} Returns the new memoized function.
  24244. */
  24245. function memoizeCapped(func) {
  24246. var result = memoize(func, function(key) {
  24247. if (cache.size === MAX_MEMOIZE_SIZE) {
  24248. cache.clear();
  24249. }
  24250. return key;
  24251. });
  24252. var cache = result.cache;
  24253. return result;
  24254. }
  24255. /**
  24256. * Merges the function metadata of `source` into `data`.
  24257. *
  24258. * Merging metadata reduces the number of wrappers used to invoke a function.
  24259. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24260. * may be applied regardless of execution order. Methods like `_.ary` and
  24261. * `_.rearg` modify function arguments, making the order in which they are
  24262. * executed important, preventing the merging of metadata. However, we make
  24263. * an exception for a safe combined case where curried functions have `_.ary`
  24264. * and or `_.rearg` applied.
  24265. *
  24266. * @private
  24267. * @param {Array} data The destination metadata.
  24268. * @param {Array} source The source metadata.
  24269. * @returns {Array} Returns `data`.
  24270. */
  24271. function mergeData(data, source) {
  24272. var bitmask = data[1],
  24273. srcBitmask = source[1],
  24274. newBitmask = bitmask | srcBitmask,
  24275. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24276. var isCombo =
  24277. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24278. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24279. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24280. // Exit early if metadata can't be merged.
  24281. if (!(isCommon || isCombo)) {
  24282. return data;
  24283. }
  24284. // Use source `thisArg` if available.
  24285. if (srcBitmask & WRAP_BIND_FLAG) {
  24286. data[2] = source[2];
  24287. // Set when currying a bound function.
  24288. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24289. }
  24290. // Compose partial arguments.
  24291. var value = source[3];
  24292. if (value) {
  24293. var partials = data[3];
  24294. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24295. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24296. }
  24297. // Compose partial right arguments.
  24298. value = source[5];
  24299. if (value) {
  24300. partials = data[5];
  24301. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24302. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24303. }
  24304. // Use source `argPos` if available.
  24305. value = source[7];
  24306. if (value) {
  24307. data[7] = value;
  24308. }
  24309. // Use source `ary` if it's smaller.
  24310. if (srcBitmask & WRAP_ARY_FLAG) {
  24311. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24312. }
  24313. // Use source `arity` if one is not provided.
  24314. if (data[9] == null) {
  24315. data[9] = source[9];
  24316. }
  24317. // Use source `func` and merge bitmasks.
  24318. data[0] = source[0];
  24319. data[1] = newBitmask;
  24320. return data;
  24321. }
  24322. /**
  24323. * This function is like
  24324. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24325. * except that it includes inherited enumerable properties.
  24326. *
  24327. * @private
  24328. * @param {Object} object The object to query.
  24329. * @returns {Array} Returns the array of property names.
  24330. */
  24331. function nativeKeysIn(object) {
  24332. var result = [];
  24333. if (object != null) {
  24334. for (var key in Object(object)) {
  24335. result.push(key);
  24336. }
  24337. }
  24338. return result;
  24339. }
  24340. /**
  24341. * Converts `value` to a string using `Object.prototype.toString`.
  24342. *
  24343. * @private
  24344. * @param {*} value The value to convert.
  24345. * @returns {string} Returns the converted string.
  24346. */
  24347. function objectToString(value) {
  24348. return nativeObjectToString.call(value);
  24349. }
  24350. /**
  24351. * A specialized version of `baseRest` which transforms the rest array.
  24352. *
  24353. * @private
  24354. * @param {Function} func The function to apply a rest parameter to.
  24355. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24356. * @param {Function} transform The rest array transform.
  24357. * @returns {Function} Returns the new function.
  24358. */
  24359. function overRest(func, start, transform) {
  24360. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24361. return function() {
  24362. var args = arguments,
  24363. index = -1,
  24364. length = nativeMax(args.length - start, 0),
  24365. array = Array(length);
  24366. while (++index < length) {
  24367. array[index] = args[start + index];
  24368. }
  24369. index = -1;
  24370. var otherArgs = Array(start + 1);
  24371. while (++index < start) {
  24372. otherArgs[index] = args[index];
  24373. }
  24374. otherArgs[start] = transform(array);
  24375. return apply(func, this, otherArgs);
  24376. };
  24377. }
  24378. /**
  24379. * Gets the parent value at `path` of `object`.
  24380. *
  24381. * @private
  24382. * @param {Object} object The object to query.
  24383. * @param {Array} path The path to get the parent value of.
  24384. * @returns {*} Returns the parent value.
  24385. */
  24386. function parent(object, path) {
  24387. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24388. }
  24389. /**
  24390. * Reorder `array` according to the specified indexes where the element at
  24391. * the first index is assigned as the first element, the element at
  24392. * the second index is assigned as the second element, and so on.
  24393. *
  24394. * @private
  24395. * @param {Array} array The array to reorder.
  24396. * @param {Array} indexes The arranged array indexes.
  24397. * @returns {Array} Returns `array`.
  24398. */
  24399. function reorder(array, indexes) {
  24400. var arrLength = array.length,
  24401. length = nativeMin(indexes.length, arrLength),
  24402. oldArray = copyArray(array);
  24403. while (length--) {
  24404. var index = indexes[length];
  24405. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24406. }
  24407. return array;
  24408. }
  24409. /**
  24410. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24411. *
  24412. * @private
  24413. * @param {Object} object The object to query.
  24414. * @param {string} key The key of the property to get.
  24415. * @returns {*} Returns the property value.
  24416. */
  24417. function safeGet(object, key) {
  24418. if (key === 'constructor' && typeof object[key] === 'function') {
  24419. return;
  24420. }
  24421. if (key == '__proto__') {
  24422. return;
  24423. }
  24424. return object[key];
  24425. }
  24426. /**
  24427. * Sets metadata for `func`.
  24428. *
  24429. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24430. * period of time, it will trip its breaker and transition to an identity
  24431. * function to avoid garbage collection pauses in V8. See
  24432. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24433. * for more details.
  24434. *
  24435. * @private
  24436. * @param {Function} func The function to associate metadata with.
  24437. * @param {*} data The metadata.
  24438. * @returns {Function} Returns `func`.
  24439. */
  24440. var setData = shortOut(baseSetData);
  24441. /**
  24442. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24443. *
  24444. * @private
  24445. * @param {Function} func The function to delay.
  24446. * @param {number} wait The number of milliseconds to delay invocation.
  24447. * @returns {number|Object} Returns the timer id or timeout object.
  24448. */
  24449. var setTimeout = ctxSetTimeout || function(func, wait) {
  24450. return root.setTimeout(func, wait);
  24451. };
  24452. /**
  24453. * Sets the `toString` method of `func` to return `string`.
  24454. *
  24455. * @private
  24456. * @param {Function} func The function to modify.
  24457. * @param {Function} string The `toString` result.
  24458. * @returns {Function} Returns `func`.
  24459. */
  24460. var setToString = shortOut(baseSetToString);
  24461. /**
  24462. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24463. * with wrapper details in a comment at the top of the source body.
  24464. *
  24465. * @private
  24466. * @param {Function} wrapper The function to modify.
  24467. * @param {Function} reference The reference function.
  24468. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24469. * @returns {Function} Returns `wrapper`.
  24470. */
  24471. function setWrapToString(wrapper, reference, bitmask) {
  24472. var source = (reference + '');
  24473. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24474. }
  24475. /**
  24476. * Creates a function that'll short out and invoke `identity` instead
  24477. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24478. * milliseconds.
  24479. *
  24480. * @private
  24481. * @param {Function} func The function to restrict.
  24482. * @returns {Function} Returns the new shortable function.
  24483. */
  24484. function shortOut(func) {
  24485. var count = 0,
  24486. lastCalled = 0;
  24487. return function() {
  24488. var stamp = nativeNow(),
  24489. remaining = HOT_SPAN - (stamp - lastCalled);
  24490. lastCalled = stamp;
  24491. if (remaining > 0) {
  24492. if (++count >= HOT_COUNT) {
  24493. return arguments[0];
  24494. }
  24495. } else {
  24496. count = 0;
  24497. }
  24498. return func.apply(undefined, arguments);
  24499. };
  24500. }
  24501. /**
  24502. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24503. *
  24504. * @private
  24505. * @param {Array} array The array to shuffle.
  24506. * @param {number} [size=array.length] The size of `array`.
  24507. * @returns {Array} Returns `array`.
  24508. */
  24509. function shuffleSelf(array, size) {
  24510. var index = -1,
  24511. length = array.length,
  24512. lastIndex = length - 1;
  24513. size = size === undefined ? length : size;
  24514. while (++index < size) {
  24515. var rand = baseRandom(index, lastIndex),
  24516. value = array[rand];
  24517. array[rand] = array[index];
  24518. array[index] = value;
  24519. }
  24520. array.length = size;
  24521. return array;
  24522. }
  24523. /**
  24524. * Converts `string` to a property path array.
  24525. *
  24526. * @private
  24527. * @param {string} string The string to convert.
  24528. * @returns {Array} Returns the property path array.
  24529. */
  24530. var stringToPath = memoizeCapped(function(string) {
  24531. var result = [];
  24532. if (string.charCodeAt(0) === 46 /* . */) {
  24533. result.push('');
  24534. }
  24535. string.replace(rePropName, function(match, number, quote, subString) {
  24536. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24537. });
  24538. return result;
  24539. });
  24540. /**
  24541. * Converts `value` to a string key if it's not a string or symbol.
  24542. *
  24543. * @private
  24544. * @param {*} value The value to inspect.
  24545. * @returns {string|symbol} Returns the key.
  24546. */
  24547. function toKey(value) {
  24548. if (typeof value == 'string' || isSymbol(value)) {
  24549. return value;
  24550. }
  24551. var result = (value + '');
  24552. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24553. }
  24554. /**
  24555. * Converts `func` to its source code.
  24556. *
  24557. * @private
  24558. * @param {Function} func The function to convert.
  24559. * @returns {string} Returns the source code.
  24560. */
  24561. function toSource(func) {
  24562. if (func != null) {
  24563. try {
  24564. return funcToString.call(func);
  24565. } catch (e) {}
  24566. try {
  24567. return (func + '');
  24568. } catch (e) {}
  24569. }
  24570. return '';
  24571. }
  24572. /**
  24573. * Updates wrapper `details` based on `bitmask` flags.
  24574. *
  24575. * @private
  24576. * @returns {Array} details The details to modify.
  24577. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24578. * @returns {Array} Returns `details`.
  24579. */
  24580. function updateWrapDetails(details, bitmask) {
  24581. arrayEach(wrapFlags, function(pair) {
  24582. var value = '_.' + pair[0];
  24583. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24584. details.push(value);
  24585. }
  24586. });
  24587. return details.sort();
  24588. }
  24589. /**
  24590. * Creates a clone of `wrapper`.
  24591. *
  24592. * @private
  24593. * @param {Object} wrapper The wrapper to clone.
  24594. * @returns {Object} Returns the cloned wrapper.
  24595. */
  24596. function wrapperClone(wrapper) {
  24597. if (wrapper instanceof LazyWrapper) {
  24598. return wrapper.clone();
  24599. }
  24600. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24601. result.__actions__ = copyArray(wrapper.__actions__);
  24602. result.__index__ = wrapper.__index__;
  24603. result.__values__ = wrapper.__values__;
  24604. return result;
  24605. }
  24606. /*------------------------------------------------------------------------*/
  24607. /**
  24608. * Creates an array of elements split into groups the length of `size`.
  24609. * If `array` can't be split evenly, the final chunk will be the remaining
  24610. * elements.
  24611. *
  24612. * @static
  24613. * @memberOf _
  24614. * @since 3.0.0
  24615. * @category Array
  24616. * @param {Array} array The array to process.
  24617. * @param {number} [size=1] The length of each chunk
  24618. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24619. * @returns {Array} Returns the new array of chunks.
  24620. * @example
  24621. *
  24622. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24623. * // => [['a', 'b'], ['c', 'd']]
  24624. *
  24625. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24626. * // => [['a', 'b', 'c'], ['d']]
  24627. */
  24628. function chunk(array, size, guard) {
  24629. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24630. size = 1;
  24631. } else {
  24632. size = nativeMax(toInteger(size), 0);
  24633. }
  24634. var length = array == null ? 0 : array.length;
  24635. if (!length || size < 1) {
  24636. return [];
  24637. }
  24638. var index = 0,
  24639. resIndex = 0,
  24640. result = Array(nativeCeil(length / size));
  24641. while (index < length) {
  24642. result[resIndex++] = baseSlice(array, index, (index += size));
  24643. }
  24644. return result;
  24645. }
  24646. /**
  24647. * Creates an array with all falsey values removed. The values `false`, `null`,
  24648. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24649. *
  24650. * @static
  24651. * @memberOf _
  24652. * @since 0.1.0
  24653. * @category Array
  24654. * @param {Array} array The array to compact.
  24655. * @returns {Array} Returns the new array of filtered values.
  24656. * @example
  24657. *
  24658. * _.compact([0, 1, false, 2, '', 3]);
  24659. * // => [1, 2, 3]
  24660. */
  24661. function compact(array) {
  24662. var index = -1,
  24663. length = array == null ? 0 : array.length,
  24664. resIndex = 0,
  24665. result = [];
  24666. while (++index < length) {
  24667. var value = array[index];
  24668. if (value) {
  24669. result[resIndex++] = value;
  24670. }
  24671. }
  24672. return result;
  24673. }
  24674. /**
  24675. * Creates a new array concatenating `array` with any additional arrays
  24676. * and/or values.
  24677. *
  24678. * @static
  24679. * @memberOf _
  24680. * @since 4.0.0
  24681. * @category Array
  24682. * @param {Array} array The array to concatenate.
  24683. * @param {...*} [values] The values to concatenate.
  24684. * @returns {Array} Returns the new concatenated array.
  24685. * @example
  24686. *
  24687. * var array = [1];
  24688. * var other = _.concat(array, 2, [3], [[4]]);
  24689. *
  24690. * console.log(other);
  24691. * // => [1, 2, 3, [4]]
  24692. *
  24693. * console.log(array);
  24694. * // => [1]
  24695. */
  24696. function concat() {
  24697. var length = arguments.length;
  24698. if (!length) {
  24699. return [];
  24700. }
  24701. var args = Array(length - 1),
  24702. array = arguments[0],
  24703. index = length;
  24704. while (index--) {
  24705. args[index - 1] = arguments[index];
  24706. }
  24707. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24708. }
  24709. /**
  24710. * Creates an array of `array` values not included in the other given arrays
  24711. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24712. * for equality comparisons. The order and references of result values are
  24713. * determined by the first array.
  24714. *
  24715. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24716. *
  24717. * @static
  24718. * @memberOf _
  24719. * @since 0.1.0
  24720. * @category Array
  24721. * @param {Array} array The array to inspect.
  24722. * @param {...Array} [values] The values to exclude.
  24723. * @returns {Array} Returns the new array of filtered values.
  24724. * @see _.without, _.xor
  24725. * @example
  24726. *
  24727. * _.difference([2, 1], [2, 3]);
  24728. * // => [1]
  24729. */
  24730. var difference = baseRest(function(array, values) {
  24731. return isArrayLikeObject(array)
  24732. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24733. : [];
  24734. });
  24735. /**
  24736. * This method is like `_.difference` except that it accepts `iteratee` which
  24737. * is invoked for each element of `array` and `values` to generate the criterion
  24738. * by which they're compared. The order and references of result values are
  24739. * determined by the first array. The iteratee is invoked with one argument:
  24740. * (value).
  24741. *
  24742. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24743. *
  24744. * @static
  24745. * @memberOf _
  24746. * @since 4.0.0
  24747. * @category Array
  24748. * @param {Array} array The array to inspect.
  24749. * @param {...Array} [values] The values to exclude.
  24750. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24751. * @returns {Array} Returns the new array of filtered values.
  24752. * @example
  24753. *
  24754. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24755. * // => [1.2]
  24756. *
  24757. * // The `_.property` iteratee shorthand.
  24758. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24759. * // => [{ 'x': 2 }]
  24760. */
  24761. var differenceBy = baseRest(function(array, values) {
  24762. var iteratee = last(values);
  24763. if (isArrayLikeObject(iteratee)) {
  24764. iteratee = undefined;
  24765. }
  24766. return isArrayLikeObject(array)
  24767. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24768. : [];
  24769. });
  24770. /**
  24771. * This method is like `_.difference` except that it accepts `comparator`
  24772. * which is invoked to compare elements of `array` to `values`. The order and
  24773. * references of result values are determined by the first array. The comparator
  24774. * is invoked with two arguments: (arrVal, othVal).
  24775. *
  24776. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24777. *
  24778. * @static
  24779. * @memberOf _
  24780. * @since 4.0.0
  24781. * @category Array
  24782. * @param {Array} array The array to inspect.
  24783. * @param {...Array} [values] The values to exclude.
  24784. * @param {Function} [comparator] The comparator invoked per element.
  24785. * @returns {Array} Returns the new array of filtered values.
  24786. * @example
  24787. *
  24788. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24789. *
  24790. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24791. * // => [{ 'x': 2, 'y': 1 }]
  24792. */
  24793. var differenceWith = baseRest(function(array, values) {
  24794. var comparator = last(values);
  24795. if (isArrayLikeObject(comparator)) {
  24796. comparator = undefined;
  24797. }
  24798. return isArrayLikeObject(array)
  24799. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24800. : [];
  24801. });
  24802. /**
  24803. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24804. *
  24805. * @static
  24806. * @memberOf _
  24807. * @since 0.5.0
  24808. * @category Array
  24809. * @param {Array} array The array to query.
  24810. * @param {number} [n=1] The number of elements to drop.
  24811. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24812. * @returns {Array} Returns the slice of `array`.
  24813. * @example
  24814. *
  24815. * _.drop([1, 2, 3]);
  24816. * // => [2, 3]
  24817. *
  24818. * _.drop([1, 2, 3], 2);
  24819. * // => [3]
  24820. *
  24821. * _.drop([1, 2, 3], 5);
  24822. * // => []
  24823. *
  24824. * _.drop([1, 2, 3], 0);
  24825. * // => [1, 2, 3]
  24826. */
  24827. function drop(array, n, guard) {
  24828. var length = array == null ? 0 : array.length;
  24829. if (!length) {
  24830. return [];
  24831. }
  24832. n = (guard || n === undefined) ? 1 : toInteger(n);
  24833. return baseSlice(array, n < 0 ? 0 : n, length);
  24834. }
  24835. /**
  24836. * Creates a slice of `array` with `n` elements dropped from the end.
  24837. *
  24838. * @static
  24839. * @memberOf _
  24840. * @since 3.0.0
  24841. * @category Array
  24842. * @param {Array} array The array to query.
  24843. * @param {number} [n=1] The number of elements to drop.
  24844. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24845. * @returns {Array} Returns the slice of `array`.
  24846. * @example
  24847. *
  24848. * _.dropRight([1, 2, 3]);
  24849. * // => [1, 2]
  24850. *
  24851. * _.dropRight([1, 2, 3], 2);
  24852. * // => [1]
  24853. *
  24854. * _.dropRight([1, 2, 3], 5);
  24855. * // => []
  24856. *
  24857. * _.dropRight([1, 2, 3], 0);
  24858. * // => [1, 2, 3]
  24859. */
  24860. function dropRight(array, n, guard) {
  24861. var length = array == null ? 0 : array.length;
  24862. if (!length) {
  24863. return [];
  24864. }
  24865. n = (guard || n === undefined) ? 1 : toInteger(n);
  24866. n = length - n;
  24867. return baseSlice(array, 0, n < 0 ? 0 : n);
  24868. }
  24869. /**
  24870. * Creates a slice of `array` excluding elements dropped from the end.
  24871. * Elements are dropped until `predicate` returns falsey. The predicate is
  24872. * invoked with three arguments: (value, index, array).
  24873. *
  24874. * @static
  24875. * @memberOf _
  24876. * @since 3.0.0
  24877. * @category Array
  24878. * @param {Array} array The array to query.
  24879. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24880. * @returns {Array} Returns the slice of `array`.
  24881. * @example
  24882. *
  24883. * var users = [
  24884. * { 'user': 'barney', 'active': true },
  24885. * { 'user': 'fred', 'active': false },
  24886. * { 'user': 'pebbles', 'active': false }
  24887. * ];
  24888. *
  24889. * _.dropRightWhile(users, function(o) { return !o.active; });
  24890. * // => objects for ['barney']
  24891. *
  24892. * // The `_.matches` iteratee shorthand.
  24893. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24894. * // => objects for ['barney', 'fred']
  24895. *
  24896. * // The `_.matchesProperty` iteratee shorthand.
  24897. * _.dropRightWhile(users, ['active', false]);
  24898. * // => objects for ['barney']
  24899. *
  24900. * // The `_.property` iteratee shorthand.
  24901. * _.dropRightWhile(users, 'active');
  24902. * // => objects for ['barney', 'fred', 'pebbles']
  24903. */
  24904. function dropRightWhile(array, predicate) {
  24905. return (array && array.length)
  24906. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24907. : [];
  24908. }
  24909. /**
  24910. * Creates a slice of `array` excluding elements dropped from the beginning.
  24911. * Elements are dropped until `predicate` returns falsey. The predicate is
  24912. * invoked with three arguments: (value, index, array).
  24913. *
  24914. * @static
  24915. * @memberOf _
  24916. * @since 3.0.0
  24917. * @category Array
  24918. * @param {Array} array The array to query.
  24919. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24920. * @returns {Array} Returns the slice of `array`.
  24921. * @example
  24922. *
  24923. * var users = [
  24924. * { 'user': 'barney', 'active': false },
  24925. * { 'user': 'fred', 'active': false },
  24926. * { 'user': 'pebbles', 'active': true }
  24927. * ];
  24928. *
  24929. * _.dropWhile(users, function(o) { return !o.active; });
  24930. * // => objects for ['pebbles']
  24931. *
  24932. * // The `_.matches` iteratee shorthand.
  24933. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24934. * // => objects for ['fred', 'pebbles']
  24935. *
  24936. * // The `_.matchesProperty` iteratee shorthand.
  24937. * _.dropWhile(users, ['active', false]);
  24938. * // => objects for ['pebbles']
  24939. *
  24940. * // The `_.property` iteratee shorthand.
  24941. * _.dropWhile(users, 'active');
  24942. * // => objects for ['barney', 'fred', 'pebbles']
  24943. */
  24944. function dropWhile(array, predicate) {
  24945. return (array && array.length)
  24946. ? baseWhile(array, getIteratee(predicate, 3), true)
  24947. : [];
  24948. }
  24949. /**
  24950. * Fills elements of `array` with `value` from `start` up to, but not
  24951. * including, `end`.
  24952. *
  24953. * **Note:** This method mutates `array`.
  24954. *
  24955. * @static
  24956. * @memberOf _
  24957. * @since 3.2.0
  24958. * @category Array
  24959. * @param {Array} array The array to fill.
  24960. * @param {*} value The value to fill `array` with.
  24961. * @param {number} [start=0] The start position.
  24962. * @param {number} [end=array.length] The end position.
  24963. * @returns {Array} Returns `array`.
  24964. * @example
  24965. *
  24966. * var array = [1, 2, 3];
  24967. *
  24968. * _.fill(array, 'a');
  24969. * console.log(array);
  24970. * // => ['a', 'a', 'a']
  24971. *
  24972. * _.fill(Array(3), 2);
  24973. * // => [2, 2, 2]
  24974. *
  24975. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24976. * // => [4, '*', '*', 10]
  24977. */
  24978. function fill(array, value, start, end) {
  24979. var length = array == null ? 0 : array.length;
  24980. if (!length) {
  24981. return [];
  24982. }
  24983. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24984. start = 0;
  24985. end = length;
  24986. }
  24987. return baseFill(array, value, start, end);
  24988. }
  24989. /**
  24990. * This method is like `_.find` except that it returns the index of the first
  24991. * element `predicate` returns truthy for instead of the element itself.
  24992. *
  24993. * @static
  24994. * @memberOf _
  24995. * @since 1.1.0
  24996. * @category Array
  24997. * @param {Array} array The array to inspect.
  24998. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24999. * @param {number} [fromIndex=0] The index to search from.
  25000. * @returns {number} Returns the index of the found element, else `-1`.
  25001. * @example
  25002. *
  25003. * var users = [
  25004. * { 'user': 'barney', 'active': false },
  25005. * { 'user': 'fred', 'active': false },
  25006. * { 'user': 'pebbles', 'active': true }
  25007. * ];
  25008. *
  25009. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25010. * // => 0
  25011. *
  25012. * // The `_.matches` iteratee shorthand.
  25013. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25014. * // => 1
  25015. *
  25016. * // The `_.matchesProperty` iteratee shorthand.
  25017. * _.findIndex(users, ['active', false]);
  25018. * // => 0
  25019. *
  25020. * // The `_.property` iteratee shorthand.
  25021. * _.findIndex(users, 'active');
  25022. * // => 2
  25023. */
  25024. function findIndex(array, predicate, fromIndex) {
  25025. var length = array == null ? 0 : array.length;
  25026. if (!length) {
  25027. return -1;
  25028. }
  25029. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25030. if (index < 0) {
  25031. index = nativeMax(length + index, 0);
  25032. }
  25033. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25034. }
  25035. /**
  25036. * This method is like `_.findIndex` except that it iterates over elements
  25037. * of `collection` from right to left.
  25038. *
  25039. * @static
  25040. * @memberOf _
  25041. * @since 2.0.0
  25042. * @category Array
  25043. * @param {Array} array The array to inspect.
  25044. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25045. * @param {number} [fromIndex=array.length-1] The index to search from.
  25046. * @returns {number} Returns the index of the found element, else `-1`.
  25047. * @example
  25048. *
  25049. * var users = [
  25050. * { 'user': 'barney', 'active': true },
  25051. * { 'user': 'fred', 'active': false },
  25052. * { 'user': 'pebbles', 'active': false }
  25053. * ];
  25054. *
  25055. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25056. * // => 2
  25057. *
  25058. * // The `_.matches` iteratee shorthand.
  25059. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25060. * // => 0
  25061. *
  25062. * // The `_.matchesProperty` iteratee shorthand.
  25063. * _.findLastIndex(users, ['active', false]);
  25064. * // => 2
  25065. *
  25066. * // The `_.property` iteratee shorthand.
  25067. * _.findLastIndex(users, 'active');
  25068. * // => 0
  25069. */
  25070. function findLastIndex(array, predicate, fromIndex) {
  25071. var length = array == null ? 0 : array.length;
  25072. if (!length) {
  25073. return -1;
  25074. }
  25075. var index = length - 1;
  25076. if (fromIndex !== undefined) {
  25077. index = toInteger(fromIndex);
  25078. index = fromIndex < 0
  25079. ? nativeMax(length + index, 0)
  25080. : nativeMin(index, length - 1);
  25081. }
  25082. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25083. }
  25084. /**
  25085. * Flattens `array` a single level deep.
  25086. *
  25087. * @static
  25088. * @memberOf _
  25089. * @since 0.1.0
  25090. * @category Array
  25091. * @param {Array} array The array to flatten.
  25092. * @returns {Array} Returns the new flattened array.
  25093. * @example
  25094. *
  25095. * _.flatten([1, [2, [3, [4]], 5]]);
  25096. * // => [1, 2, [3, [4]], 5]
  25097. */
  25098. function flatten(array) {
  25099. var length = array == null ? 0 : array.length;
  25100. return length ? baseFlatten(array, 1) : [];
  25101. }
  25102. /**
  25103. * Recursively flattens `array`.
  25104. *
  25105. * @static
  25106. * @memberOf _
  25107. * @since 3.0.0
  25108. * @category Array
  25109. * @param {Array} array The array to flatten.
  25110. * @returns {Array} Returns the new flattened array.
  25111. * @example
  25112. *
  25113. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25114. * // => [1, 2, 3, 4, 5]
  25115. */
  25116. function flattenDeep(array) {
  25117. var length = array == null ? 0 : array.length;
  25118. return length ? baseFlatten(array, INFINITY) : [];
  25119. }
  25120. /**
  25121. * Recursively flatten `array` up to `depth` times.
  25122. *
  25123. * @static
  25124. * @memberOf _
  25125. * @since 4.4.0
  25126. * @category Array
  25127. * @param {Array} array The array to flatten.
  25128. * @param {number} [depth=1] The maximum recursion depth.
  25129. * @returns {Array} Returns the new flattened array.
  25130. * @example
  25131. *
  25132. * var array = [1, [2, [3, [4]], 5]];
  25133. *
  25134. * _.flattenDepth(array, 1);
  25135. * // => [1, 2, [3, [4]], 5]
  25136. *
  25137. * _.flattenDepth(array, 2);
  25138. * // => [1, 2, 3, [4], 5]
  25139. */
  25140. function flattenDepth(array, depth) {
  25141. var length = array == null ? 0 : array.length;
  25142. if (!length) {
  25143. return [];
  25144. }
  25145. depth = depth === undefined ? 1 : toInteger(depth);
  25146. return baseFlatten(array, depth);
  25147. }
  25148. /**
  25149. * The inverse of `_.toPairs`; this method returns an object composed
  25150. * from key-value `pairs`.
  25151. *
  25152. * @static
  25153. * @memberOf _
  25154. * @since 4.0.0
  25155. * @category Array
  25156. * @param {Array} pairs The key-value pairs.
  25157. * @returns {Object} Returns the new object.
  25158. * @example
  25159. *
  25160. * _.fromPairs([['a', 1], ['b', 2]]);
  25161. * // => { 'a': 1, 'b': 2 }
  25162. */
  25163. function fromPairs(pairs) {
  25164. var index = -1,
  25165. length = pairs == null ? 0 : pairs.length,
  25166. result = {};
  25167. while (++index < length) {
  25168. var pair = pairs[index];
  25169. result[pair[0]] = pair[1];
  25170. }
  25171. return result;
  25172. }
  25173. /**
  25174. * Gets the first element of `array`.
  25175. *
  25176. * @static
  25177. * @memberOf _
  25178. * @since 0.1.0
  25179. * @alias first
  25180. * @category Array
  25181. * @param {Array} array The array to query.
  25182. * @returns {*} Returns the first element of `array`.
  25183. * @example
  25184. *
  25185. * _.head([1, 2, 3]);
  25186. * // => 1
  25187. *
  25188. * _.head([]);
  25189. * // => undefined
  25190. */
  25191. function head(array) {
  25192. return (array && array.length) ? array[0] : undefined;
  25193. }
  25194. /**
  25195. * Gets the index at which the first occurrence of `value` is found in `array`
  25196. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25197. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25198. * offset from the end of `array`.
  25199. *
  25200. * @static
  25201. * @memberOf _
  25202. * @since 0.1.0
  25203. * @category Array
  25204. * @param {Array} array The array to inspect.
  25205. * @param {*} value The value to search for.
  25206. * @param {number} [fromIndex=0] The index to search from.
  25207. * @returns {number} Returns the index of the matched value, else `-1`.
  25208. * @example
  25209. *
  25210. * _.indexOf([1, 2, 1, 2], 2);
  25211. * // => 1
  25212. *
  25213. * // Search from the `fromIndex`.
  25214. * _.indexOf([1, 2, 1, 2], 2, 2);
  25215. * // => 3
  25216. */
  25217. function indexOf(array, value, fromIndex) {
  25218. var length = array == null ? 0 : array.length;
  25219. if (!length) {
  25220. return -1;
  25221. }
  25222. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25223. if (index < 0) {
  25224. index = nativeMax(length + index, 0);
  25225. }
  25226. return baseIndexOf(array, value, index);
  25227. }
  25228. /**
  25229. * Gets all but the last element of `array`.
  25230. *
  25231. * @static
  25232. * @memberOf _
  25233. * @since 0.1.0
  25234. * @category Array
  25235. * @param {Array} array The array to query.
  25236. * @returns {Array} Returns the slice of `array`.
  25237. * @example
  25238. *
  25239. * _.initial([1, 2, 3]);
  25240. * // => [1, 2]
  25241. */
  25242. function initial(array) {
  25243. var length = array == null ? 0 : array.length;
  25244. return length ? baseSlice(array, 0, -1) : [];
  25245. }
  25246. /**
  25247. * Creates an array of unique values that are included in all given arrays
  25248. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25249. * for equality comparisons. The order and references of result values are
  25250. * determined by the first array.
  25251. *
  25252. * @static
  25253. * @memberOf _
  25254. * @since 0.1.0
  25255. * @category Array
  25256. * @param {...Array} [arrays] The arrays to inspect.
  25257. * @returns {Array} Returns the new array of intersecting values.
  25258. * @example
  25259. *
  25260. * _.intersection([2, 1], [2, 3]);
  25261. * // => [2]
  25262. */
  25263. var intersection = baseRest(function(arrays) {
  25264. var mapped = arrayMap(arrays, castArrayLikeObject);
  25265. return (mapped.length && mapped[0] === arrays[0])
  25266. ? baseIntersection(mapped)
  25267. : [];
  25268. });
  25269. /**
  25270. * This method is like `_.intersection` except that it accepts `iteratee`
  25271. * which is invoked for each element of each `arrays` to generate the criterion
  25272. * by which they're compared. The order and references of result values are
  25273. * determined by the first array. The iteratee is invoked with one argument:
  25274. * (value).
  25275. *
  25276. * @static
  25277. * @memberOf _
  25278. * @since 4.0.0
  25279. * @category Array
  25280. * @param {...Array} [arrays] The arrays to inspect.
  25281. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25282. * @returns {Array} Returns the new array of intersecting values.
  25283. * @example
  25284. *
  25285. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25286. * // => [2.1]
  25287. *
  25288. * // The `_.property` iteratee shorthand.
  25289. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25290. * // => [{ 'x': 1 }]
  25291. */
  25292. var intersectionBy = baseRest(function(arrays) {
  25293. var iteratee = last(arrays),
  25294. mapped = arrayMap(arrays, castArrayLikeObject);
  25295. if (iteratee === last(mapped)) {
  25296. iteratee = undefined;
  25297. } else {
  25298. mapped.pop();
  25299. }
  25300. return (mapped.length && mapped[0] === arrays[0])
  25301. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25302. : [];
  25303. });
  25304. /**
  25305. * This method is like `_.intersection` except that it accepts `comparator`
  25306. * which is invoked to compare elements of `arrays`. The order and references
  25307. * of result values are determined by the first array. The comparator is
  25308. * invoked with two arguments: (arrVal, othVal).
  25309. *
  25310. * @static
  25311. * @memberOf _
  25312. * @since 4.0.0
  25313. * @category Array
  25314. * @param {...Array} [arrays] The arrays to inspect.
  25315. * @param {Function} [comparator] The comparator invoked per element.
  25316. * @returns {Array} Returns the new array of intersecting values.
  25317. * @example
  25318. *
  25319. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25320. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25321. *
  25322. * _.intersectionWith(objects, others, _.isEqual);
  25323. * // => [{ 'x': 1, 'y': 2 }]
  25324. */
  25325. var intersectionWith = baseRest(function(arrays) {
  25326. var comparator = last(arrays),
  25327. mapped = arrayMap(arrays, castArrayLikeObject);
  25328. comparator = typeof comparator == 'function' ? comparator : undefined;
  25329. if (comparator) {
  25330. mapped.pop();
  25331. }
  25332. return (mapped.length && mapped[0] === arrays[0])
  25333. ? baseIntersection(mapped, undefined, comparator)
  25334. : [];
  25335. });
  25336. /**
  25337. * Converts all elements in `array` into a string separated by `separator`.
  25338. *
  25339. * @static
  25340. * @memberOf _
  25341. * @since 4.0.0
  25342. * @category Array
  25343. * @param {Array} array The array to convert.
  25344. * @param {string} [separator=','] The element separator.
  25345. * @returns {string} Returns the joined string.
  25346. * @example
  25347. *
  25348. * _.join(['a', 'b', 'c'], '~');
  25349. * // => 'a~b~c'
  25350. */
  25351. function join(array, separator) {
  25352. return array == null ? '' : nativeJoin.call(array, separator);
  25353. }
  25354. /**
  25355. * Gets the last element of `array`.
  25356. *
  25357. * @static
  25358. * @memberOf _
  25359. * @since 0.1.0
  25360. * @category Array
  25361. * @param {Array} array The array to query.
  25362. * @returns {*} Returns the last element of `array`.
  25363. * @example
  25364. *
  25365. * _.last([1, 2, 3]);
  25366. * // => 3
  25367. */
  25368. function last(array) {
  25369. var length = array == null ? 0 : array.length;
  25370. return length ? array[length - 1] : undefined;
  25371. }
  25372. /**
  25373. * This method is like `_.indexOf` except that it iterates over elements of
  25374. * `array` from right to left.
  25375. *
  25376. * @static
  25377. * @memberOf _
  25378. * @since 0.1.0
  25379. * @category Array
  25380. * @param {Array} array The array to inspect.
  25381. * @param {*} value The value to search for.
  25382. * @param {number} [fromIndex=array.length-1] The index to search from.
  25383. * @returns {number} Returns the index of the matched value, else `-1`.
  25384. * @example
  25385. *
  25386. * _.lastIndexOf([1, 2, 1, 2], 2);
  25387. * // => 3
  25388. *
  25389. * // Search from the `fromIndex`.
  25390. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25391. * // => 1
  25392. */
  25393. function lastIndexOf(array, value, fromIndex) {
  25394. var length = array == null ? 0 : array.length;
  25395. if (!length) {
  25396. return -1;
  25397. }
  25398. var index = length;
  25399. if (fromIndex !== undefined) {
  25400. index = toInteger(fromIndex);
  25401. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25402. }
  25403. return value === value
  25404. ? strictLastIndexOf(array, value, index)
  25405. : baseFindIndex(array, baseIsNaN, index, true);
  25406. }
  25407. /**
  25408. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25409. * element from the end is returned.
  25410. *
  25411. * @static
  25412. * @memberOf _
  25413. * @since 4.11.0
  25414. * @category Array
  25415. * @param {Array} array The array to query.
  25416. * @param {number} [n=0] The index of the element to return.
  25417. * @returns {*} Returns the nth element of `array`.
  25418. * @example
  25419. *
  25420. * var array = ['a', 'b', 'c', 'd'];
  25421. *
  25422. * _.nth(array, 1);
  25423. * // => 'b'
  25424. *
  25425. * _.nth(array, -2);
  25426. * // => 'c';
  25427. */
  25428. function nth(array, n) {
  25429. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25430. }
  25431. /**
  25432. * Removes all given values from `array` using
  25433. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25434. * for equality comparisons.
  25435. *
  25436. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25437. * to remove elements from an array by predicate.
  25438. *
  25439. * @static
  25440. * @memberOf _
  25441. * @since 2.0.0
  25442. * @category Array
  25443. * @param {Array} array The array to modify.
  25444. * @param {...*} [values] The values to remove.
  25445. * @returns {Array} Returns `array`.
  25446. * @example
  25447. *
  25448. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25449. *
  25450. * _.pull(array, 'a', 'c');
  25451. * console.log(array);
  25452. * // => ['b', 'b']
  25453. */
  25454. var pull = baseRest(pullAll);
  25455. /**
  25456. * This method is like `_.pull` except that it accepts an array of values to remove.
  25457. *
  25458. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25459. *
  25460. * @static
  25461. * @memberOf _
  25462. * @since 4.0.0
  25463. * @category Array
  25464. * @param {Array} array The array to modify.
  25465. * @param {Array} values The values to remove.
  25466. * @returns {Array} Returns `array`.
  25467. * @example
  25468. *
  25469. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25470. *
  25471. * _.pullAll(array, ['a', 'c']);
  25472. * console.log(array);
  25473. * // => ['b', 'b']
  25474. */
  25475. function pullAll(array, values) {
  25476. return (array && array.length && values && values.length)
  25477. ? basePullAll(array, values)
  25478. : array;
  25479. }
  25480. /**
  25481. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25482. * invoked for each element of `array` and `values` to generate the criterion
  25483. * by which they're compared. The iteratee is invoked with one argument: (value).
  25484. *
  25485. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25486. *
  25487. * @static
  25488. * @memberOf _
  25489. * @since 4.0.0
  25490. * @category Array
  25491. * @param {Array} array The array to modify.
  25492. * @param {Array} values The values to remove.
  25493. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25494. * @returns {Array} Returns `array`.
  25495. * @example
  25496. *
  25497. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25498. *
  25499. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25500. * console.log(array);
  25501. * // => [{ 'x': 2 }]
  25502. */
  25503. function pullAllBy(array, values, iteratee) {
  25504. return (array && array.length && values && values.length)
  25505. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25506. : array;
  25507. }
  25508. /**
  25509. * This method is like `_.pullAll` except that it accepts `comparator` which
  25510. * is invoked to compare elements of `array` to `values`. The comparator is
  25511. * invoked with two arguments: (arrVal, othVal).
  25512. *
  25513. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25514. *
  25515. * @static
  25516. * @memberOf _
  25517. * @since 4.6.0
  25518. * @category Array
  25519. * @param {Array} array The array to modify.
  25520. * @param {Array} values The values to remove.
  25521. * @param {Function} [comparator] The comparator invoked per element.
  25522. * @returns {Array} Returns `array`.
  25523. * @example
  25524. *
  25525. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25526. *
  25527. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25528. * console.log(array);
  25529. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25530. */
  25531. function pullAllWith(array, values, comparator) {
  25532. return (array && array.length && values && values.length)
  25533. ? basePullAll(array, values, undefined, comparator)
  25534. : array;
  25535. }
  25536. /**
  25537. * Removes elements from `array` corresponding to `indexes` and returns an
  25538. * array of removed elements.
  25539. *
  25540. * **Note:** Unlike `_.at`, this method mutates `array`.
  25541. *
  25542. * @static
  25543. * @memberOf _
  25544. * @since 3.0.0
  25545. * @category Array
  25546. * @param {Array} array The array to modify.
  25547. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25548. * @returns {Array} Returns the new array of removed elements.
  25549. * @example
  25550. *
  25551. * var array = ['a', 'b', 'c', 'd'];
  25552. * var pulled = _.pullAt(array, [1, 3]);
  25553. *
  25554. * console.log(array);
  25555. * // => ['a', 'c']
  25556. *
  25557. * console.log(pulled);
  25558. * // => ['b', 'd']
  25559. */
  25560. var pullAt = flatRest(function(array, indexes) {
  25561. var length = array == null ? 0 : array.length,
  25562. result = baseAt(array, indexes);
  25563. basePullAt(array, arrayMap(indexes, function(index) {
  25564. return isIndex(index, length) ? +index : index;
  25565. }).sort(compareAscending));
  25566. return result;
  25567. });
  25568. /**
  25569. * Removes all elements from `array` that `predicate` returns truthy for
  25570. * and returns an array of the removed elements. The predicate is invoked
  25571. * with three arguments: (value, index, array).
  25572. *
  25573. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25574. * to pull elements from an array by value.
  25575. *
  25576. * @static
  25577. * @memberOf _
  25578. * @since 2.0.0
  25579. * @category Array
  25580. * @param {Array} array The array to modify.
  25581. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25582. * @returns {Array} Returns the new array of removed elements.
  25583. * @example
  25584. *
  25585. * var array = [1, 2, 3, 4];
  25586. * var evens = _.remove(array, function(n) {
  25587. * return n % 2 == 0;
  25588. * });
  25589. *
  25590. * console.log(array);
  25591. * // => [1, 3]
  25592. *
  25593. * console.log(evens);
  25594. * // => [2, 4]
  25595. */
  25596. function remove(array, predicate) {
  25597. var result = [];
  25598. if (!(array && array.length)) {
  25599. return result;
  25600. }
  25601. var index = -1,
  25602. indexes = [],
  25603. length = array.length;
  25604. predicate = getIteratee(predicate, 3);
  25605. while (++index < length) {
  25606. var value = array[index];
  25607. if (predicate(value, index, array)) {
  25608. result.push(value);
  25609. indexes.push(index);
  25610. }
  25611. }
  25612. basePullAt(array, indexes);
  25613. return result;
  25614. }
  25615. /**
  25616. * Reverses `array` so that the first element becomes the last, the second
  25617. * element becomes the second to last, and so on.
  25618. *
  25619. * **Note:** This method mutates `array` and is based on
  25620. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25621. *
  25622. * @static
  25623. * @memberOf _
  25624. * @since 4.0.0
  25625. * @category Array
  25626. * @param {Array} array The array to modify.
  25627. * @returns {Array} Returns `array`.
  25628. * @example
  25629. *
  25630. * var array = [1, 2, 3];
  25631. *
  25632. * _.reverse(array);
  25633. * // => [3, 2, 1]
  25634. *
  25635. * console.log(array);
  25636. * // => [3, 2, 1]
  25637. */
  25638. function reverse(array) {
  25639. return array == null ? array : nativeReverse.call(array);
  25640. }
  25641. /**
  25642. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25643. *
  25644. * **Note:** This method is used instead of
  25645. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25646. * returned.
  25647. *
  25648. * @static
  25649. * @memberOf _
  25650. * @since 3.0.0
  25651. * @category Array
  25652. * @param {Array} array The array to slice.
  25653. * @param {number} [start=0] The start position.
  25654. * @param {number} [end=array.length] The end position.
  25655. * @returns {Array} Returns the slice of `array`.
  25656. */
  25657. function slice(array, start, end) {
  25658. var length = array == null ? 0 : array.length;
  25659. if (!length) {
  25660. return [];
  25661. }
  25662. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25663. start = 0;
  25664. end = length;
  25665. }
  25666. else {
  25667. start = start == null ? 0 : toInteger(start);
  25668. end = end === undefined ? length : toInteger(end);
  25669. }
  25670. return baseSlice(array, start, end);
  25671. }
  25672. /**
  25673. * Uses a binary search to determine the lowest index at which `value`
  25674. * should be inserted into `array` in order to maintain its sort order.
  25675. *
  25676. * @static
  25677. * @memberOf _
  25678. * @since 0.1.0
  25679. * @category Array
  25680. * @param {Array} array The sorted array to inspect.
  25681. * @param {*} value The value to evaluate.
  25682. * @returns {number} Returns the index at which `value` should be inserted
  25683. * into `array`.
  25684. * @example
  25685. *
  25686. * _.sortedIndex([30, 50], 40);
  25687. * // => 1
  25688. */
  25689. function sortedIndex(array, value) {
  25690. return baseSortedIndex(array, value);
  25691. }
  25692. /**
  25693. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25694. * which is invoked for `value` and each element of `array` to compute their
  25695. * sort ranking. The iteratee is invoked with one argument: (value).
  25696. *
  25697. * @static
  25698. * @memberOf _
  25699. * @since 4.0.0
  25700. * @category Array
  25701. * @param {Array} array The sorted array to inspect.
  25702. * @param {*} value The value to evaluate.
  25703. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25704. * @returns {number} Returns the index at which `value` should be inserted
  25705. * into `array`.
  25706. * @example
  25707. *
  25708. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25709. *
  25710. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25711. * // => 0
  25712. *
  25713. * // The `_.property` iteratee shorthand.
  25714. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25715. * // => 0
  25716. */
  25717. function sortedIndexBy(array, value, iteratee) {
  25718. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25719. }
  25720. /**
  25721. * This method is like `_.indexOf` except that it performs a binary
  25722. * search on a sorted `array`.
  25723. *
  25724. * @static
  25725. * @memberOf _
  25726. * @since 4.0.0
  25727. * @category Array
  25728. * @param {Array} array The array to inspect.
  25729. * @param {*} value The value to search for.
  25730. * @returns {number} Returns the index of the matched value, else `-1`.
  25731. * @example
  25732. *
  25733. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25734. * // => 1
  25735. */
  25736. function sortedIndexOf(array, value) {
  25737. var length = array == null ? 0 : array.length;
  25738. if (length) {
  25739. var index = baseSortedIndex(array, value);
  25740. if (index < length && eq(array[index], value)) {
  25741. return index;
  25742. }
  25743. }
  25744. return -1;
  25745. }
  25746. /**
  25747. * This method is like `_.sortedIndex` except that it returns the highest
  25748. * index at which `value` should be inserted into `array` in order to
  25749. * maintain its sort order.
  25750. *
  25751. * @static
  25752. * @memberOf _
  25753. * @since 3.0.0
  25754. * @category Array
  25755. * @param {Array} array The sorted array to inspect.
  25756. * @param {*} value The value to evaluate.
  25757. * @returns {number} Returns the index at which `value` should be inserted
  25758. * into `array`.
  25759. * @example
  25760. *
  25761. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25762. * // => 4
  25763. */
  25764. function sortedLastIndex(array, value) {
  25765. return baseSortedIndex(array, value, true);
  25766. }
  25767. /**
  25768. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25769. * which is invoked for `value` and each element of `array` to compute their
  25770. * sort ranking. The iteratee is invoked with one argument: (value).
  25771. *
  25772. * @static
  25773. * @memberOf _
  25774. * @since 4.0.0
  25775. * @category Array
  25776. * @param {Array} array The sorted array to inspect.
  25777. * @param {*} value The value to evaluate.
  25778. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25779. * @returns {number} Returns the index at which `value` should be inserted
  25780. * into `array`.
  25781. * @example
  25782. *
  25783. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25784. *
  25785. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25786. * // => 1
  25787. *
  25788. * // The `_.property` iteratee shorthand.
  25789. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25790. * // => 1
  25791. */
  25792. function sortedLastIndexBy(array, value, iteratee) {
  25793. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25794. }
  25795. /**
  25796. * This method is like `_.lastIndexOf` except that it performs a binary
  25797. * search on a sorted `array`.
  25798. *
  25799. * @static
  25800. * @memberOf _
  25801. * @since 4.0.0
  25802. * @category Array
  25803. * @param {Array} array The array to inspect.
  25804. * @param {*} value The value to search for.
  25805. * @returns {number} Returns the index of the matched value, else `-1`.
  25806. * @example
  25807. *
  25808. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25809. * // => 3
  25810. */
  25811. function sortedLastIndexOf(array, value) {
  25812. var length = array == null ? 0 : array.length;
  25813. if (length) {
  25814. var index = baseSortedIndex(array, value, true) - 1;
  25815. if (eq(array[index], value)) {
  25816. return index;
  25817. }
  25818. }
  25819. return -1;
  25820. }
  25821. /**
  25822. * This method is like `_.uniq` except that it's designed and optimized
  25823. * for sorted arrays.
  25824. *
  25825. * @static
  25826. * @memberOf _
  25827. * @since 4.0.0
  25828. * @category Array
  25829. * @param {Array} array The array to inspect.
  25830. * @returns {Array} Returns the new duplicate free array.
  25831. * @example
  25832. *
  25833. * _.sortedUniq([1, 1, 2]);
  25834. * // => [1, 2]
  25835. */
  25836. function sortedUniq(array) {
  25837. return (array && array.length)
  25838. ? baseSortedUniq(array)
  25839. : [];
  25840. }
  25841. /**
  25842. * This method is like `_.uniqBy` except that it's designed and optimized
  25843. * for sorted arrays.
  25844. *
  25845. * @static
  25846. * @memberOf _
  25847. * @since 4.0.0
  25848. * @category Array
  25849. * @param {Array} array The array to inspect.
  25850. * @param {Function} [iteratee] The iteratee invoked per element.
  25851. * @returns {Array} Returns the new duplicate free array.
  25852. * @example
  25853. *
  25854. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25855. * // => [1.1, 2.3]
  25856. */
  25857. function sortedUniqBy(array, iteratee) {
  25858. return (array && array.length)
  25859. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25860. : [];
  25861. }
  25862. /**
  25863. * Gets all but the first element of `array`.
  25864. *
  25865. * @static
  25866. * @memberOf _
  25867. * @since 4.0.0
  25868. * @category Array
  25869. * @param {Array} array The array to query.
  25870. * @returns {Array} Returns the slice of `array`.
  25871. * @example
  25872. *
  25873. * _.tail([1, 2, 3]);
  25874. * // => [2, 3]
  25875. */
  25876. function tail(array) {
  25877. var length = array == null ? 0 : array.length;
  25878. return length ? baseSlice(array, 1, length) : [];
  25879. }
  25880. /**
  25881. * Creates a slice of `array` with `n` elements taken from the beginning.
  25882. *
  25883. * @static
  25884. * @memberOf _
  25885. * @since 0.1.0
  25886. * @category Array
  25887. * @param {Array} array The array to query.
  25888. * @param {number} [n=1] The number of elements to take.
  25889. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25890. * @returns {Array} Returns the slice of `array`.
  25891. * @example
  25892. *
  25893. * _.take([1, 2, 3]);
  25894. * // => [1]
  25895. *
  25896. * _.take([1, 2, 3], 2);
  25897. * // => [1, 2]
  25898. *
  25899. * _.take([1, 2, 3], 5);
  25900. * // => [1, 2, 3]
  25901. *
  25902. * _.take([1, 2, 3], 0);
  25903. * // => []
  25904. */
  25905. function take(array, n, guard) {
  25906. if (!(array && array.length)) {
  25907. return [];
  25908. }
  25909. n = (guard || n === undefined) ? 1 : toInteger(n);
  25910. return baseSlice(array, 0, n < 0 ? 0 : n);
  25911. }
  25912. /**
  25913. * Creates a slice of `array` with `n` elements taken from the end.
  25914. *
  25915. * @static
  25916. * @memberOf _
  25917. * @since 3.0.0
  25918. * @category Array
  25919. * @param {Array} array The array to query.
  25920. * @param {number} [n=1] The number of elements to take.
  25921. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25922. * @returns {Array} Returns the slice of `array`.
  25923. * @example
  25924. *
  25925. * _.takeRight([1, 2, 3]);
  25926. * // => [3]
  25927. *
  25928. * _.takeRight([1, 2, 3], 2);
  25929. * // => [2, 3]
  25930. *
  25931. * _.takeRight([1, 2, 3], 5);
  25932. * // => [1, 2, 3]
  25933. *
  25934. * _.takeRight([1, 2, 3], 0);
  25935. * // => []
  25936. */
  25937. function takeRight(array, n, guard) {
  25938. var length = array == null ? 0 : array.length;
  25939. if (!length) {
  25940. return [];
  25941. }
  25942. n = (guard || n === undefined) ? 1 : toInteger(n);
  25943. n = length - n;
  25944. return baseSlice(array, n < 0 ? 0 : n, length);
  25945. }
  25946. /**
  25947. * Creates a slice of `array` with elements taken from the end. Elements are
  25948. * taken until `predicate` returns falsey. The predicate is invoked with
  25949. * three arguments: (value, index, array).
  25950. *
  25951. * @static
  25952. * @memberOf _
  25953. * @since 3.0.0
  25954. * @category Array
  25955. * @param {Array} array The array to query.
  25956. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25957. * @returns {Array} Returns the slice of `array`.
  25958. * @example
  25959. *
  25960. * var users = [
  25961. * { 'user': 'barney', 'active': true },
  25962. * { 'user': 'fred', 'active': false },
  25963. * { 'user': 'pebbles', 'active': false }
  25964. * ];
  25965. *
  25966. * _.takeRightWhile(users, function(o) { return !o.active; });
  25967. * // => objects for ['fred', 'pebbles']
  25968. *
  25969. * // The `_.matches` iteratee shorthand.
  25970. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25971. * // => objects for ['pebbles']
  25972. *
  25973. * // The `_.matchesProperty` iteratee shorthand.
  25974. * _.takeRightWhile(users, ['active', false]);
  25975. * // => objects for ['fred', 'pebbles']
  25976. *
  25977. * // The `_.property` iteratee shorthand.
  25978. * _.takeRightWhile(users, 'active');
  25979. * // => []
  25980. */
  25981. function takeRightWhile(array, predicate) {
  25982. return (array && array.length)
  25983. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25984. : [];
  25985. }
  25986. /**
  25987. * Creates a slice of `array` with elements taken from the beginning. Elements
  25988. * are taken until `predicate` returns falsey. The predicate is invoked with
  25989. * three arguments: (value, index, array).
  25990. *
  25991. * @static
  25992. * @memberOf _
  25993. * @since 3.0.0
  25994. * @category Array
  25995. * @param {Array} array The array to query.
  25996. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25997. * @returns {Array} Returns the slice of `array`.
  25998. * @example
  25999. *
  26000. * var users = [
  26001. * { 'user': 'barney', 'active': false },
  26002. * { 'user': 'fred', 'active': false },
  26003. * { 'user': 'pebbles', 'active': true }
  26004. * ];
  26005. *
  26006. * _.takeWhile(users, function(o) { return !o.active; });
  26007. * // => objects for ['barney', 'fred']
  26008. *
  26009. * // The `_.matches` iteratee shorthand.
  26010. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26011. * // => objects for ['barney']
  26012. *
  26013. * // The `_.matchesProperty` iteratee shorthand.
  26014. * _.takeWhile(users, ['active', false]);
  26015. * // => objects for ['barney', 'fred']
  26016. *
  26017. * // The `_.property` iteratee shorthand.
  26018. * _.takeWhile(users, 'active');
  26019. * // => []
  26020. */
  26021. function takeWhile(array, predicate) {
  26022. return (array && array.length)
  26023. ? baseWhile(array, getIteratee(predicate, 3))
  26024. : [];
  26025. }
  26026. /**
  26027. * Creates an array of unique values, in order, from all given arrays using
  26028. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26029. * for equality comparisons.
  26030. *
  26031. * @static
  26032. * @memberOf _
  26033. * @since 0.1.0
  26034. * @category Array
  26035. * @param {...Array} [arrays] The arrays to inspect.
  26036. * @returns {Array} Returns the new array of combined values.
  26037. * @example
  26038. *
  26039. * _.union([2], [1, 2]);
  26040. * // => [2, 1]
  26041. */
  26042. var union = baseRest(function(arrays) {
  26043. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26044. });
  26045. /**
  26046. * This method is like `_.union` except that it accepts `iteratee` which is
  26047. * invoked for each element of each `arrays` to generate the criterion by
  26048. * which uniqueness is computed. Result values are chosen from the first
  26049. * array in which the value occurs. The iteratee is invoked with one argument:
  26050. * (value).
  26051. *
  26052. * @static
  26053. * @memberOf _
  26054. * @since 4.0.0
  26055. * @category Array
  26056. * @param {...Array} [arrays] The arrays to inspect.
  26057. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26058. * @returns {Array} Returns the new array of combined values.
  26059. * @example
  26060. *
  26061. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26062. * // => [2.1, 1.2]
  26063. *
  26064. * // The `_.property` iteratee shorthand.
  26065. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26066. * // => [{ 'x': 1 }, { 'x': 2 }]
  26067. */
  26068. var unionBy = baseRest(function(arrays) {
  26069. var iteratee = last(arrays);
  26070. if (isArrayLikeObject(iteratee)) {
  26071. iteratee = undefined;
  26072. }
  26073. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26074. });
  26075. /**
  26076. * This method is like `_.union` except that it accepts `comparator` which
  26077. * is invoked to compare elements of `arrays`. Result values are chosen from
  26078. * the first array in which the value occurs. The comparator is invoked
  26079. * with two arguments: (arrVal, othVal).
  26080. *
  26081. * @static
  26082. * @memberOf _
  26083. * @since 4.0.0
  26084. * @category Array
  26085. * @param {...Array} [arrays] The arrays to inspect.
  26086. * @param {Function} [comparator] The comparator invoked per element.
  26087. * @returns {Array} Returns the new array of combined values.
  26088. * @example
  26089. *
  26090. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26091. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26092. *
  26093. * _.unionWith(objects, others, _.isEqual);
  26094. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26095. */
  26096. var unionWith = baseRest(function(arrays) {
  26097. var comparator = last(arrays);
  26098. comparator = typeof comparator == 'function' ? comparator : undefined;
  26099. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26100. });
  26101. /**
  26102. * Creates a duplicate-free version of an array, using
  26103. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26104. * for equality comparisons, in which only the first occurrence of each element
  26105. * is kept. The order of result values is determined by the order they occur
  26106. * in the array.
  26107. *
  26108. * @static
  26109. * @memberOf _
  26110. * @since 0.1.0
  26111. * @category Array
  26112. * @param {Array} array The array to inspect.
  26113. * @returns {Array} Returns the new duplicate free array.
  26114. * @example
  26115. *
  26116. * _.uniq([2, 1, 2]);
  26117. * // => [2, 1]
  26118. */
  26119. function uniq(array) {
  26120. return (array && array.length) ? baseUniq(array) : [];
  26121. }
  26122. /**
  26123. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26124. * invoked for each element in `array` to generate the criterion by which
  26125. * uniqueness is computed. The order of result values is determined by the
  26126. * order they occur in the array. The iteratee is invoked with one argument:
  26127. * (value).
  26128. *
  26129. * @static
  26130. * @memberOf _
  26131. * @since 4.0.0
  26132. * @category Array
  26133. * @param {Array} array The array to inspect.
  26134. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26135. * @returns {Array} Returns the new duplicate free array.
  26136. * @example
  26137. *
  26138. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26139. * // => [2.1, 1.2]
  26140. *
  26141. * // The `_.property` iteratee shorthand.
  26142. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26143. * // => [{ 'x': 1 }, { 'x': 2 }]
  26144. */
  26145. function uniqBy(array, iteratee) {
  26146. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26147. }
  26148. /**
  26149. * This method is like `_.uniq` except that it accepts `comparator` which
  26150. * is invoked to compare elements of `array`. The order of result values is
  26151. * determined by the order they occur in the array.The comparator is invoked
  26152. * with two arguments: (arrVal, othVal).
  26153. *
  26154. * @static
  26155. * @memberOf _
  26156. * @since 4.0.0
  26157. * @category Array
  26158. * @param {Array} array The array to inspect.
  26159. * @param {Function} [comparator] The comparator invoked per element.
  26160. * @returns {Array} Returns the new duplicate free array.
  26161. * @example
  26162. *
  26163. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26164. *
  26165. * _.uniqWith(objects, _.isEqual);
  26166. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26167. */
  26168. function uniqWith(array, comparator) {
  26169. comparator = typeof comparator == 'function' ? comparator : undefined;
  26170. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26171. }
  26172. /**
  26173. * This method is like `_.zip` except that it accepts an array of grouped
  26174. * elements and creates an array regrouping the elements to their pre-zip
  26175. * configuration.
  26176. *
  26177. * @static
  26178. * @memberOf _
  26179. * @since 1.2.0
  26180. * @category Array
  26181. * @param {Array} array The array of grouped elements to process.
  26182. * @returns {Array} Returns the new array of regrouped elements.
  26183. * @example
  26184. *
  26185. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26186. * // => [['a', 1, true], ['b', 2, false]]
  26187. *
  26188. * _.unzip(zipped);
  26189. * // => [['a', 'b'], [1, 2], [true, false]]
  26190. */
  26191. function unzip(array) {
  26192. if (!(array && array.length)) {
  26193. return [];
  26194. }
  26195. var length = 0;
  26196. array = arrayFilter(array, function(group) {
  26197. if (isArrayLikeObject(group)) {
  26198. length = nativeMax(group.length, length);
  26199. return true;
  26200. }
  26201. });
  26202. return baseTimes(length, function(index) {
  26203. return arrayMap(array, baseProperty(index));
  26204. });
  26205. }
  26206. /**
  26207. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26208. * how regrouped values should be combined. The iteratee is invoked with the
  26209. * elements of each group: (...group).
  26210. *
  26211. * @static
  26212. * @memberOf _
  26213. * @since 3.8.0
  26214. * @category Array
  26215. * @param {Array} array The array of grouped elements to process.
  26216. * @param {Function} [iteratee=_.identity] The function to combine
  26217. * regrouped values.
  26218. * @returns {Array} Returns the new array of regrouped elements.
  26219. * @example
  26220. *
  26221. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26222. * // => [[1, 10, 100], [2, 20, 200]]
  26223. *
  26224. * _.unzipWith(zipped, _.add);
  26225. * // => [3, 30, 300]
  26226. */
  26227. function unzipWith(array, iteratee) {
  26228. if (!(array && array.length)) {
  26229. return [];
  26230. }
  26231. var result = unzip(array);
  26232. if (iteratee == null) {
  26233. return result;
  26234. }
  26235. return arrayMap(result, function(group) {
  26236. return apply(iteratee, undefined, group);
  26237. });
  26238. }
  26239. /**
  26240. * Creates an array excluding all given values using
  26241. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26242. * for equality comparisons.
  26243. *
  26244. * **Note:** Unlike `_.pull`, this method returns a new array.
  26245. *
  26246. * @static
  26247. * @memberOf _
  26248. * @since 0.1.0
  26249. * @category Array
  26250. * @param {Array} array The array to inspect.
  26251. * @param {...*} [values] The values to exclude.
  26252. * @returns {Array} Returns the new array of filtered values.
  26253. * @see _.difference, _.xor
  26254. * @example
  26255. *
  26256. * _.without([2, 1, 2, 3], 1, 2);
  26257. * // => [3]
  26258. */
  26259. var without = baseRest(function(array, values) {
  26260. return isArrayLikeObject(array)
  26261. ? baseDifference(array, values)
  26262. : [];
  26263. });
  26264. /**
  26265. * Creates an array of unique values that is the
  26266. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26267. * of the given arrays. The order of result values is determined by the order
  26268. * they occur in the arrays.
  26269. *
  26270. * @static
  26271. * @memberOf _
  26272. * @since 2.4.0
  26273. * @category Array
  26274. * @param {...Array} [arrays] The arrays to inspect.
  26275. * @returns {Array} Returns the new array of filtered values.
  26276. * @see _.difference, _.without
  26277. * @example
  26278. *
  26279. * _.xor([2, 1], [2, 3]);
  26280. * // => [1, 3]
  26281. */
  26282. var xor = baseRest(function(arrays) {
  26283. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26284. });
  26285. /**
  26286. * This method is like `_.xor` except that it accepts `iteratee` which is
  26287. * invoked for each element of each `arrays` to generate the criterion by
  26288. * which by which they're compared. The order of result values is determined
  26289. * by the order they occur in the arrays. The iteratee is invoked with one
  26290. * argument: (value).
  26291. *
  26292. * @static
  26293. * @memberOf _
  26294. * @since 4.0.0
  26295. * @category Array
  26296. * @param {...Array} [arrays] The arrays to inspect.
  26297. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26298. * @returns {Array} Returns the new array of filtered values.
  26299. * @example
  26300. *
  26301. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26302. * // => [1.2, 3.4]
  26303. *
  26304. * // The `_.property` iteratee shorthand.
  26305. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26306. * // => [{ 'x': 2 }]
  26307. */
  26308. var xorBy = baseRest(function(arrays) {
  26309. var iteratee = last(arrays);
  26310. if (isArrayLikeObject(iteratee)) {
  26311. iteratee = undefined;
  26312. }
  26313. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26314. });
  26315. /**
  26316. * This method is like `_.xor` except that it accepts `comparator` which is
  26317. * invoked to compare elements of `arrays`. The order of result values is
  26318. * determined by the order they occur in the arrays. The comparator is invoked
  26319. * with two arguments: (arrVal, othVal).
  26320. *
  26321. * @static
  26322. * @memberOf _
  26323. * @since 4.0.0
  26324. * @category Array
  26325. * @param {...Array} [arrays] The arrays to inspect.
  26326. * @param {Function} [comparator] The comparator invoked per element.
  26327. * @returns {Array} Returns the new array of filtered values.
  26328. * @example
  26329. *
  26330. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26331. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26332. *
  26333. * _.xorWith(objects, others, _.isEqual);
  26334. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26335. */
  26336. var xorWith = baseRest(function(arrays) {
  26337. var comparator = last(arrays);
  26338. comparator = typeof comparator == 'function' ? comparator : undefined;
  26339. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26340. });
  26341. /**
  26342. * Creates an array of grouped elements, the first of which contains the
  26343. * first elements of the given arrays, the second of which contains the
  26344. * second elements of the given arrays, and so on.
  26345. *
  26346. * @static
  26347. * @memberOf _
  26348. * @since 0.1.0
  26349. * @category Array
  26350. * @param {...Array} [arrays] The arrays to process.
  26351. * @returns {Array} Returns the new array of grouped elements.
  26352. * @example
  26353. *
  26354. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26355. * // => [['a', 1, true], ['b', 2, false]]
  26356. */
  26357. var zip = baseRest(unzip);
  26358. /**
  26359. * This method is like `_.fromPairs` except that it accepts two arrays,
  26360. * one of property identifiers and one of corresponding values.
  26361. *
  26362. * @static
  26363. * @memberOf _
  26364. * @since 0.4.0
  26365. * @category Array
  26366. * @param {Array} [props=[]] The property identifiers.
  26367. * @param {Array} [values=[]] The property values.
  26368. * @returns {Object} Returns the new object.
  26369. * @example
  26370. *
  26371. * _.zipObject(['a', 'b'], [1, 2]);
  26372. * // => { 'a': 1, 'b': 2 }
  26373. */
  26374. function zipObject(props, values) {
  26375. return baseZipObject(props || [], values || [], assignValue);
  26376. }
  26377. /**
  26378. * This method is like `_.zipObject` except that it supports property paths.
  26379. *
  26380. * @static
  26381. * @memberOf _
  26382. * @since 4.1.0
  26383. * @category Array
  26384. * @param {Array} [props=[]] The property identifiers.
  26385. * @param {Array} [values=[]] The property values.
  26386. * @returns {Object} Returns the new object.
  26387. * @example
  26388. *
  26389. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26390. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26391. */
  26392. function zipObjectDeep(props, values) {
  26393. return baseZipObject(props || [], values || [], baseSet);
  26394. }
  26395. /**
  26396. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26397. * how grouped values should be combined. The iteratee is invoked with the
  26398. * elements of each group: (...group).
  26399. *
  26400. * @static
  26401. * @memberOf _
  26402. * @since 3.8.0
  26403. * @category Array
  26404. * @param {...Array} [arrays] The arrays to process.
  26405. * @param {Function} [iteratee=_.identity] The function to combine
  26406. * grouped values.
  26407. * @returns {Array} Returns the new array of grouped elements.
  26408. * @example
  26409. *
  26410. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26411. * return a + b + c;
  26412. * });
  26413. * // => [111, 222]
  26414. */
  26415. var zipWith = baseRest(function(arrays) {
  26416. var length = arrays.length,
  26417. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26418. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26419. return unzipWith(arrays, iteratee);
  26420. });
  26421. /*------------------------------------------------------------------------*/
  26422. /**
  26423. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26424. * chain sequences enabled. The result of such sequences must be unwrapped
  26425. * with `_#value`.
  26426. *
  26427. * @static
  26428. * @memberOf _
  26429. * @since 1.3.0
  26430. * @category Seq
  26431. * @param {*} value The value to wrap.
  26432. * @returns {Object} Returns the new `lodash` wrapper instance.
  26433. * @example
  26434. *
  26435. * var users = [
  26436. * { 'user': 'barney', 'age': 36 },
  26437. * { 'user': 'fred', 'age': 40 },
  26438. * { 'user': 'pebbles', 'age': 1 }
  26439. * ];
  26440. *
  26441. * var youngest = _
  26442. * .chain(users)
  26443. * .sortBy('age')
  26444. * .map(function(o) {
  26445. * return o.user + ' is ' + o.age;
  26446. * })
  26447. * .head()
  26448. * .value();
  26449. * // => 'pebbles is 1'
  26450. */
  26451. function chain(value) {
  26452. var result = lodash(value);
  26453. result.__chain__ = true;
  26454. return result;
  26455. }
  26456. /**
  26457. * This method invokes `interceptor` and returns `value`. The interceptor
  26458. * is invoked with one argument; (value). The purpose of this method is to
  26459. * "tap into" a method chain sequence in order to modify intermediate results.
  26460. *
  26461. * @static
  26462. * @memberOf _
  26463. * @since 0.1.0
  26464. * @category Seq
  26465. * @param {*} value The value to provide to `interceptor`.
  26466. * @param {Function} interceptor The function to invoke.
  26467. * @returns {*} Returns `value`.
  26468. * @example
  26469. *
  26470. * _([1, 2, 3])
  26471. * .tap(function(array) {
  26472. * // Mutate input array.
  26473. * array.pop();
  26474. * })
  26475. * .reverse()
  26476. * .value();
  26477. * // => [2, 1]
  26478. */
  26479. function tap(value, interceptor) {
  26480. interceptor(value);
  26481. return value;
  26482. }
  26483. /**
  26484. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26485. * The purpose of this method is to "pass thru" values replacing intermediate
  26486. * results in a method chain sequence.
  26487. *
  26488. * @static
  26489. * @memberOf _
  26490. * @since 3.0.0
  26491. * @category Seq
  26492. * @param {*} value The value to provide to `interceptor`.
  26493. * @param {Function} interceptor The function to invoke.
  26494. * @returns {*} Returns the result of `interceptor`.
  26495. * @example
  26496. *
  26497. * _(' abc ')
  26498. * .chain()
  26499. * .trim()
  26500. * .thru(function(value) {
  26501. * return [value];
  26502. * })
  26503. * .value();
  26504. * // => ['abc']
  26505. */
  26506. function thru(value, interceptor) {
  26507. return interceptor(value);
  26508. }
  26509. /**
  26510. * This method is the wrapper version of `_.at`.
  26511. *
  26512. * @name at
  26513. * @memberOf _
  26514. * @since 1.0.0
  26515. * @category Seq
  26516. * @param {...(string|string[])} [paths] The property paths to pick.
  26517. * @returns {Object} Returns the new `lodash` wrapper instance.
  26518. * @example
  26519. *
  26520. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26521. *
  26522. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26523. * // => [3, 4]
  26524. */
  26525. var wrapperAt = flatRest(function(paths) {
  26526. var length = paths.length,
  26527. start = length ? paths[0] : 0,
  26528. value = this.__wrapped__,
  26529. interceptor = function(object) { return baseAt(object, paths); };
  26530. if (length > 1 || this.__actions__.length ||
  26531. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26532. return this.thru(interceptor);
  26533. }
  26534. value = value.slice(start, +start + (length ? 1 : 0));
  26535. value.__actions__.push({
  26536. 'func': thru,
  26537. 'args': [interceptor],
  26538. 'thisArg': undefined
  26539. });
  26540. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26541. if (length && !array.length) {
  26542. array.push(undefined);
  26543. }
  26544. return array;
  26545. });
  26546. });
  26547. /**
  26548. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26549. *
  26550. * @name chain
  26551. * @memberOf _
  26552. * @since 0.1.0
  26553. * @category Seq
  26554. * @returns {Object} Returns the new `lodash` wrapper instance.
  26555. * @example
  26556. *
  26557. * var users = [
  26558. * { 'user': 'barney', 'age': 36 },
  26559. * { 'user': 'fred', 'age': 40 }
  26560. * ];
  26561. *
  26562. * // A sequence without explicit chaining.
  26563. * _(users).head();
  26564. * // => { 'user': 'barney', 'age': 36 }
  26565. *
  26566. * // A sequence with explicit chaining.
  26567. * _(users)
  26568. * .chain()
  26569. * .head()
  26570. * .pick('user')
  26571. * .value();
  26572. * // => { 'user': 'barney' }
  26573. */
  26574. function wrapperChain() {
  26575. return chain(this);
  26576. }
  26577. /**
  26578. * Executes the chain sequence and returns the wrapped result.
  26579. *
  26580. * @name commit
  26581. * @memberOf _
  26582. * @since 3.2.0
  26583. * @category Seq
  26584. * @returns {Object} Returns the new `lodash` wrapper instance.
  26585. * @example
  26586. *
  26587. * var array = [1, 2];
  26588. * var wrapped = _(array).push(3);
  26589. *
  26590. * console.log(array);
  26591. * // => [1, 2]
  26592. *
  26593. * wrapped = wrapped.commit();
  26594. * console.log(array);
  26595. * // => [1, 2, 3]
  26596. *
  26597. * wrapped.last();
  26598. * // => 3
  26599. *
  26600. * console.log(array);
  26601. * // => [1, 2, 3]
  26602. */
  26603. function wrapperCommit() {
  26604. return new LodashWrapper(this.value(), this.__chain__);
  26605. }
  26606. /**
  26607. * Gets the next value on a wrapped object following the
  26608. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26609. *
  26610. * @name next
  26611. * @memberOf _
  26612. * @since 4.0.0
  26613. * @category Seq
  26614. * @returns {Object} Returns the next iterator value.
  26615. * @example
  26616. *
  26617. * var wrapped = _([1, 2]);
  26618. *
  26619. * wrapped.next();
  26620. * // => { 'done': false, 'value': 1 }
  26621. *
  26622. * wrapped.next();
  26623. * // => { 'done': false, 'value': 2 }
  26624. *
  26625. * wrapped.next();
  26626. * // => { 'done': true, 'value': undefined }
  26627. */
  26628. function wrapperNext() {
  26629. if (this.__values__ === undefined) {
  26630. this.__values__ = toArray(this.value());
  26631. }
  26632. var done = this.__index__ >= this.__values__.length,
  26633. value = done ? undefined : this.__values__[this.__index__++];
  26634. return { 'done': done, 'value': value };
  26635. }
  26636. /**
  26637. * Enables the wrapper to be iterable.
  26638. *
  26639. * @name Symbol.iterator
  26640. * @memberOf _
  26641. * @since 4.0.0
  26642. * @category Seq
  26643. * @returns {Object} Returns the wrapper object.
  26644. * @example
  26645. *
  26646. * var wrapped = _([1, 2]);
  26647. *
  26648. * wrapped[Symbol.iterator]() === wrapped;
  26649. * // => true
  26650. *
  26651. * Array.from(wrapped);
  26652. * // => [1, 2]
  26653. */
  26654. function wrapperToIterator() {
  26655. return this;
  26656. }
  26657. /**
  26658. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26659. *
  26660. * @name plant
  26661. * @memberOf _
  26662. * @since 3.2.0
  26663. * @category Seq
  26664. * @param {*} value The value to plant.
  26665. * @returns {Object} Returns the new `lodash` wrapper instance.
  26666. * @example
  26667. *
  26668. * function square(n) {
  26669. * return n * n;
  26670. * }
  26671. *
  26672. * var wrapped = _([1, 2]).map(square);
  26673. * var other = wrapped.plant([3, 4]);
  26674. *
  26675. * other.value();
  26676. * // => [9, 16]
  26677. *
  26678. * wrapped.value();
  26679. * // => [1, 4]
  26680. */
  26681. function wrapperPlant(value) {
  26682. var result,
  26683. parent = this;
  26684. while (parent instanceof baseLodash) {
  26685. var clone = wrapperClone(parent);
  26686. clone.__index__ = 0;
  26687. clone.__values__ = undefined;
  26688. if (result) {
  26689. previous.__wrapped__ = clone;
  26690. } else {
  26691. result = clone;
  26692. }
  26693. var previous = clone;
  26694. parent = parent.__wrapped__;
  26695. }
  26696. previous.__wrapped__ = value;
  26697. return result;
  26698. }
  26699. /**
  26700. * This method is the wrapper version of `_.reverse`.
  26701. *
  26702. * **Note:** This method mutates the wrapped array.
  26703. *
  26704. * @name reverse
  26705. * @memberOf _
  26706. * @since 0.1.0
  26707. * @category Seq
  26708. * @returns {Object} Returns the new `lodash` wrapper instance.
  26709. * @example
  26710. *
  26711. * var array = [1, 2, 3];
  26712. *
  26713. * _(array).reverse().value()
  26714. * // => [3, 2, 1]
  26715. *
  26716. * console.log(array);
  26717. * // => [3, 2, 1]
  26718. */
  26719. function wrapperReverse() {
  26720. var value = this.__wrapped__;
  26721. if (value instanceof LazyWrapper) {
  26722. var wrapped = value;
  26723. if (this.__actions__.length) {
  26724. wrapped = new LazyWrapper(this);
  26725. }
  26726. wrapped = wrapped.reverse();
  26727. wrapped.__actions__.push({
  26728. 'func': thru,
  26729. 'args': [reverse],
  26730. 'thisArg': undefined
  26731. });
  26732. return new LodashWrapper(wrapped, this.__chain__);
  26733. }
  26734. return this.thru(reverse);
  26735. }
  26736. /**
  26737. * Executes the chain sequence to resolve the unwrapped value.
  26738. *
  26739. * @name value
  26740. * @memberOf _
  26741. * @since 0.1.0
  26742. * @alias toJSON, valueOf
  26743. * @category Seq
  26744. * @returns {*} Returns the resolved unwrapped value.
  26745. * @example
  26746. *
  26747. * _([1, 2, 3]).value();
  26748. * // => [1, 2, 3]
  26749. */
  26750. function wrapperValue() {
  26751. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26752. }
  26753. /*------------------------------------------------------------------------*/
  26754. /**
  26755. * Creates an object composed of keys generated from the results of running
  26756. * each element of `collection` thru `iteratee`. The corresponding value of
  26757. * each key is the number of times the key was returned by `iteratee`. The
  26758. * iteratee is invoked with one argument: (value).
  26759. *
  26760. * @static
  26761. * @memberOf _
  26762. * @since 0.5.0
  26763. * @category Collection
  26764. * @param {Array|Object} collection The collection to iterate over.
  26765. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26766. * @returns {Object} Returns the composed aggregate object.
  26767. * @example
  26768. *
  26769. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26770. * // => { '4': 1, '6': 2 }
  26771. *
  26772. * // The `_.property` iteratee shorthand.
  26773. * _.countBy(['one', 'two', 'three'], 'length');
  26774. * // => { '3': 2, '5': 1 }
  26775. */
  26776. var countBy = createAggregator(function(result, value, key) {
  26777. if (hasOwnProperty.call(result, key)) {
  26778. ++result[key];
  26779. } else {
  26780. baseAssignValue(result, key, 1);
  26781. }
  26782. });
  26783. /**
  26784. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26785. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26786. * invoked with three arguments: (value, index|key, collection).
  26787. *
  26788. * **Note:** This method returns `true` for
  26789. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26790. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26791. * elements of empty collections.
  26792. *
  26793. * @static
  26794. * @memberOf _
  26795. * @since 0.1.0
  26796. * @category Collection
  26797. * @param {Array|Object} collection The collection to iterate over.
  26798. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26799. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26800. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26801. * else `false`.
  26802. * @example
  26803. *
  26804. * _.every([true, 1, null, 'yes'], Boolean);
  26805. * // => false
  26806. *
  26807. * var users = [
  26808. * { 'user': 'barney', 'age': 36, 'active': false },
  26809. * { 'user': 'fred', 'age': 40, 'active': false }
  26810. * ];
  26811. *
  26812. * // The `_.matches` iteratee shorthand.
  26813. * _.every(users, { 'user': 'barney', 'active': false });
  26814. * // => false
  26815. *
  26816. * // The `_.matchesProperty` iteratee shorthand.
  26817. * _.every(users, ['active', false]);
  26818. * // => true
  26819. *
  26820. * // The `_.property` iteratee shorthand.
  26821. * _.every(users, 'active');
  26822. * // => false
  26823. */
  26824. function every(collection, predicate, guard) {
  26825. var func = isArray(collection) ? arrayEvery : baseEvery;
  26826. if (guard && isIterateeCall(collection, predicate, guard)) {
  26827. predicate = undefined;
  26828. }
  26829. return func(collection, getIteratee(predicate, 3));
  26830. }
  26831. /**
  26832. * Iterates over elements of `collection`, returning an array of all elements
  26833. * `predicate` returns truthy for. The predicate is invoked with three
  26834. * arguments: (value, index|key, collection).
  26835. *
  26836. * **Note:** Unlike `_.remove`, this method returns a new array.
  26837. *
  26838. * @static
  26839. * @memberOf _
  26840. * @since 0.1.0
  26841. * @category Collection
  26842. * @param {Array|Object} collection The collection to iterate over.
  26843. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26844. * @returns {Array} Returns the new filtered array.
  26845. * @see _.reject
  26846. * @example
  26847. *
  26848. * var users = [
  26849. * { 'user': 'barney', 'age': 36, 'active': true },
  26850. * { 'user': 'fred', 'age': 40, 'active': false }
  26851. * ];
  26852. *
  26853. * _.filter(users, function(o) { return !o.active; });
  26854. * // => objects for ['fred']
  26855. *
  26856. * // The `_.matches` iteratee shorthand.
  26857. * _.filter(users, { 'age': 36, 'active': true });
  26858. * // => objects for ['barney']
  26859. *
  26860. * // The `_.matchesProperty` iteratee shorthand.
  26861. * _.filter(users, ['active', false]);
  26862. * // => objects for ['fred']
  26863. *
  26864. * // The `_.property` iteratee shorthand.
  26865. * _.filter(users, 'active');
  26866. * // => objects for ['barney']
  26867. */
  26868. function filter(collection, predicate) {
  26869. var func = isArray(collection) ? arrayFilter : baseFilter;
  26870. return func(collection, getIteratee(predicate, 3));
  26871. }
  26872. /**
  26873. * Iterates over elements of `collection`, returning the first element
  26874. * `predicate` returns truthy for. The predicate is invoked with three
  26875. * arguments: (value, index|key, collection).
  26876. *
  26877. * @static
  26878. * @memberOf _
  26879. * @since 0.1.0
  26880. * @category Collection
  26881. * @param {Array|Object} collection The collection to inspect.
  26882. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26883. * @param {number} [fromIndex=0] The index to search from.
  26884. * @returns {*} Returns the matched element, else `undefined`.
  26885. * @example
  26886. *
  26887. * var users = [
  26888. * { 'user': 'barney', 'age': 36, 'active': true },
  26889. * { 'user': 'fred', 'age': 40, 'active': false },
  26890. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26891. * ];
  26892. *
  26893. * _.find(users, function(o) { return o.age < 40; });
  26894. * // => object for 'barney'
  26895. *
  26896. * // The `_.matches` iteratee shorthand.
  26897. * _.find(users, { 'age': 1, 'active': true });
  26898. * // => object for 'pebbles'
  26899. *
  26900. * // The `_.matchesProperty` iteratee shorthand.
  26901. * _.find(users, ['active', false]);
  26902. * // => object for 'fred'
  26903. *
  26904. * // The `_.property` iteratee shorthand.
  26905. * _.find(users, 'active');
  26906. * // => object for 'barney'
  26907. */
  26908. var find = createFind(findIndex);
  26909. /**
  26910. * This method is like `_.find` except that it iterates over elements of
  26911. * `collection` from right to left.
  26912. *
  26913. * @static
  26914. * @memberOf _
  26915. * @since 2.0.0
  26916. * @category Collection
  26917. * @param {Array|Object} collection The collection to inspect.
  26918. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26919. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26920. * @returns {*} Returns the matched element, else `undefined`.
  26921. * @example
  26922. *
  26923. * _.findLast([1, 2, 3, 4], function(n) {
  26924. * return n % 2 == 1;
  26925. * });
  26926. * // => 3
  26927. */
  26928. var findLast = createFind(findLastIndex);
  26929. /**
  26930. * Creates a flattened array of values by running each element in `collection`
  26931. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26932. * with three arguments: (value, index|key, collection).
  26933. *
  26934. * @static
  26935. * @memberOf _
  26936. * @since 4.0.0
  26937. * @category Collection
  26938. * @param {Array|Object} collection The collection to iterate over.
  26939. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26940. * @returns {Array} Returns the new flattened array.
  26941. * @example
  26942. *
  26943. * function duplicate(n) {
  26944. * return [n, n];
  26945. * }
  26946. *
  26947. * _.flatMap([1, 2], duplicate);
  26948. * // => [1, 1, 2, 2]
  26949. */
  26950. function flatMap(collection, iteratee) {
  26951. return baseFlatten(map(collection, iteratee), 1);
  26952. }
  26953. /**
  26954. * This method is like `_.flatMap` except that it recursively flattens the
  26955. * mapped results.
  26956. *
  26957. * @static
  26958. * @memberOf _
  26959. * @since 4.7.0
  26960. * @category Collection
  26961. * @param {Array|Object} collection The collection to iterate over.
  26962. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26963. * @returns {Array} Returns the new flattened array.
  26964. * @example
  26965. *
  26966. * function duplicate(n) {
  26967. * return [[[n, n]]];
  26968. * }
  26969. *
  26970. * _.flatMapDeep([1, 2], duplicate);
  26971. * // => [1, 1, 2, 2]
  26972. */
  26973. function flatMapDeep(collection, iteratee) {
  26974. return baseFlatten(map(collection, iteratee), INFINITY);
  26975. }
  26976. /**
  26977. * This method is like `_.flatMap` except that it recursively flattens the
  26978. * mapped results up to `depth` times.
  26979. *
  26980. * @static
  26981. * @memberOf _
  26982. * @since 4.7.0
  26983. * @category Collection
  26984. * @param {Array|Object} collection The collection to iterate over.
  26985. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26986. * @param {number} [depth=1] The maximum recursion depth.
  26987. * @returns {Array} Returns the new flattened array.
  26988. * @example
  26989. *
  26990. * function duplicate(n) {
  26991. * return [[[n, n]]];
  26992. * }
  26993. *
  26994. * _.flatMapDepth([1, 2], duplicate, 2);
  26995. * // => [[1, 1], [2, 2]]
  26996. */
  26997. function flatMapDepth(collection, iteratee, depth) {
  26998. depth = depth === undefined ? 1 : toInteger(depth);
  26999. return baseFlatten(map(collection, iteratee), depth);
  27000. }
  27001. /**
  27002. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27003. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27004. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27005. *
  27006. * **Note:** As with other "Collections" methods, objects with a "length"
  27007. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27008. * or `_.forOwn` for object iteration.
  27009. *
  27010. * @static
  27011. * @memberOf _
  27012. * @since 0.1.0
  27013. * @alias each
  27014. * @category Collection
  27015. * @param {Array|Object} collection The collection to iterate over.
  27016. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27017. * @returns {Array|Object} Returns `collection`.
  27018. * @see _.forEachRight
  27019. * @example
  27020. *
  27021. * _.forEach([1, 2], function(value) {
  27022. * console.log(value);
  27023. * });
  27024. * // => Logs `1` then `2`.
  27025. *
  27026. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27027. * console.log(key);
  27028. * });
  27029. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27030. */
  27031. function forEach(collection, iteratee) {
  27032. var func = isArray(collection) ? arrayEach : baseEach;
  27033. return func(collection, getIteratee(iteratee, 3));
  27034. }
  27035. /**
  27036. * This method is like `_.forEach` except that it iterates over elements of
  27037. * `collection` from right to left.
  27038. *
  27039. * @static
  27040. * @memberOf _
  27041. * @since 2.0.0
  27042. * @alias eachRight
  27043. * @category Collection
  27044. * @param {Array|Object} collection The collection to iterate over.
  27045. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27046. * @returns {Array|Object} Returns `collection`.
  27047. * @see _.forEach
  27048. * @example
  27049. *
  27050. * _.forEachRight([1, 2], function(value) {
  27051. * console.log(value);
  27052. * });
  27053. * // => Logs `2` then `1`.
  27054. */
  27055. function forEachRight(collection, iteratee) {
  27056. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27057. return func(collection, getIteratee(iteratee, 3));
  27058. }
  27059. /**
  27060. * Creates an object composed of keys generated from the results of running
  27061. * each element of `collection` thru `iteratee`. The order of grouped values
  27062. * is determined by the order they occur in `collection`. The corresponding
  27063. * value of each key is an array of elements responsible for generating the
  27064. * key. The iteratee is invoked with one argument: (value).
  27065. *
  27066. * @static
  27067. * @memberOf _
  27068. * @since 0.1.0
  27069. * @category Collection
  27070. * @param {Array|Object} collection The collection to iterate over.
  27071. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27072. * @returns {Object} Returns the composed aggregate object.
  27073. * @example
  27074. *
  27075. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27076. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27077. *
  27078. * // The `_.property` iteratee shorthand.
  27079. * _.groupBy(['one', 'two', 'three'], 'length');
  27080. * // => { '3': ['one', 'two'], '5': ['three'] }
  27081. */
  27082. var groupBy = createAggregator(function(result, value, key) {
  27083. if (hasOwnProperty.call(result, key)) {
  27084. result[key].push(value);
  27085. } else {
  27086. baseAssignValue(result, key, [value]);
  27087. }
  27088. });
  27089. /**
  27090. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27091. * checked for a substring of `value`, otherwise
  27092. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27093. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27094. * the offset from the end of `collection`.
  27095. *
  27096. * @static
  27097. * @memberOf _
  27098. * @since 0.1.0
  27099. * @category Collection
  27100. * @param {Array|Object|string} collection The collection to inspect.
  27101. * @param {*} value The value to search for.
  27102. * @param {number} [fromIndex=0] The index to search from.
  27103. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27104. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27105. * @example
  27106. *
  27107. * _.includes([1, 2, 3], 1);
  27108. * // => true
  27109. *
  27110. * _.includes([1, 2, 3], 1, 2);
  27111. * // => false
  27112. *
  27113. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27114. * // => true
  27115. *
  27116. * _.includes('abcd', 'bc');
  27117. * // => true
  27118. */
  27119. function includes(collection, value, fromIndex, guard) {
  27120. collection = isArrayLike(collection) ? collection : values(collection);
  27121. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27122. var length = collection.length;
  27123. if (fromIndex < 0) {
  27124. fromIndex = nativeMax(length + fromIndex, 0);
  27125. }
  27126. return isString(collection)
  27127. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27128. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27129. }
  27130. /**
  27131. * Invokes the method at `path` of each element in `collection`, returning
  27132. * an array of the results of each invoked method. Any additional arguments
  27133. * are provided to each invoked method. If `path` is a function, it's invoked
  27134. * for, and `this` bound to, each element in `collection`.
  27135. *
  27136. * @static
  27137. * @memberOf _
  27138. * @since 4.0.0
  27139. * @category Collection
  27140. * @param {Array|Object} collection The collection to iterate over.
  27141. * @param {Array|Function|string} path The path of the method to invoke or
  27142. * the function invoked per iteration.
  27143. * @param {...*} [args] The arguments to invoke each method with.
  27144. * @returns {Array} Returns the array of results.
  27145. * @example
  27146. *
  27147. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27148. * // => [[1, 5, 7], [1, 2, 3]]
  27149. *
  27150. * _.invokeMap([123, 456], String.prototype.split, '');
  27151. * // => [['1', '2', '3'], ['4', '5', '6']]
  27152. */
  27153. var invokeMap = baseRest(function(collection, path, args) {
  27154. var index = -1,
  27155. isFunc = typeof path == 'function',
  27156. result = isArrayLike(collection) ? Array(collection.length) : [];
  27157. baseEach(collection, function(value) {
  27158. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27159. });
  27160. return result;
  27161. });
  27162. /**
  27163. * Creates an object composed of keys generated from the results of running
  27164. * each element of `collection` thru `iteratee`. The corresponding value of
  27165. * each key is the last element responsible for generating the key. The
  27166. * iteratee is invoked with one argument: (value).
  27167. *
  27168. * @static
  27169. * @memberOf _
  27170. * @since 4.0.0
  27171. * @category Collection
  27172. * @param {Array|Object} collection The collection to iterate over.
  27173. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27174. * @returns {Object} Returns the composed aggregate object.
  27175. * @example
  27176. *
  27177. * var array = [
  27178. * { 'dir': 'left', 'code': 97 },
  27179. * { 'dir': 'right', 'code': 100 }
  27180. * ];
  27181. *
  27182. * _.keyBy(array, function(o) {
  27183. * return String.fromCharCode(o.code);
  27184. * });
  27185. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27186. *
  27187. * _.keyBy(array, 'dir');
  27188. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27189. */
  27190. var keyBy = createAggregator(function(result, value, key) {
  27191. baseAssignValue(result, key, value);
  27192. });
  27193. /**
  27194. * Creates an array of values by running each element in `collection` thru
  27195. * `iteratee`. The iteratee is invoked with three arguments:
  27196. * (value, index|key, collection).
  27197. *
  27198. * Many lodash methods are guarded to work as iteratees for methods like
  27199. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27200. *
  27201. * The guarded methods are:
  27202. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27203. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27204. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27205. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27206. *
  27207. * @static
  27208. * @memberOf _
  27209. * @since 0.1.0
  27210. * @category Collection
  27211. * @param {Array|Object} collection The collection to iterate over.
  27212. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27213. * @returns {Array} Returns the new mapped array.
  27214. * @example
  27215. *
  27216. * function square(n) {
  27217. * return n * n;
  27218. * }
  27219. *
  27220. * _.map([4, 8], square);
  27221. * // => [16, 64]
  27222. *
  27223. * _.map({ 'a': 4, 'b': 8 }, square);
  27224. * // => [16, 64] (iteration order is not guaranteed)
  27225. *
  27226. * var users = [
  27227. * { 'user': 'barney' },
  27228. * { 'user': 'fred' }
  27229. * ];
  27230. *
  27231. * // The `_.property` iteratee shorthand.
  27232. * _.map(users, 'user');
  27233. * // => ['barney', 'fred']
  27234. */
  27235. function map(collection, iteratee) {
  27236. var func = isArray(collection) ? arrayMap : baseMap;
  27237. return func(collection, getIteratee(iteratee, 3));
  27238. }
  27239. /**
  27240. * This method is like `_.sortBy` except that it allows specifying the sort
  27241. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27242. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27243. * descending or "asc" for ascending sort order of corresponding values.
  27244. *
  27245. * @static
  27246. * @memberOf _
  27247. * @since 4.0.0
  27248. * @category Collection
  27249. * @param {Array|Object} collection The collection to iterate over.
  27250. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27251. * The iteratees to sort by.
  27252. * @param {string[]} [orders] The sort orders of `iteratees`.
  27253. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27254. * @returns {Array} Returns the new sorted array.
  27255. * @example
  27256. *
  27257. * var users = [
  27258. * { 'user': 'fred', 'age': 48 },
  27259. * { 'user': 'barney', 'age': 34 },
  27260. * { 'user': 'fred', 'age': 40 },
  27261. * { 'user': 'barney', 'age': 36 }
  27262. * ];
  27263. *
  27264. * // Sort by `user` in ascending order and by `age` in descending order.
  27265. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27266. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27267. */
  27268. function orderBy(collection, iteratees, orders, guard) {
  27269. if (collection == null) {
  27270. return [];
  27271. }
  27272. if (!isArray(iteratees)) {
  27273. iteratees = iteratees == null ? [] : [iteratees];
  27274. }
  27275. orders = guard ? undefined : orders;
  27276. if (!isArray(orders)) {
  27277. orders = orders == null ? [] : [orders];
  27278. }
  27279. return baseOrderBy(collection, iteratees, orders);
  27280. }
  27281. /**
  27282. * Creates an array of elements split into two groups, the first of which
  27283. * contains elements `predicate` returns truthy for, the second of which
  27284. * contains elements `predicate` returns falsey for. The predicate is
  27285. * invoked with one argument: (value).
  27286. *
  27287. * @static
  27288. * @memberOf _
  27289. * @since 3.0.0
  27290. * @category Collection
  27291. * @param {Array|Object} collection The collection to iterate over.
  27292. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27293. * @returns {Array} Returns the array of grouped elements.
  27294. * @example
  27295. *
  27296. * var users = [
  27297. * { 'user': 'barney', 'age': 36, 'active': false },
  27298. * { 'user': 'fred', 'age': 40, 'active': true },
  27299. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27300. * ];
  27301. *
  27302. * _.partition(users, function(o) { return o.active; });
  27303. * // => objects for [['fred'], ['barney', 'pebbles']]
  27304. *
  27305. * // The `_.matches` iteratee shorthand.
  27306. * _.partition(users, { 'age': 1, 'active': false });
  27307. * // => objects for [['pebbles'], ['barney', 'fred']]
  27308. *
  27309. * // The `_.matchesProperty` iteratee shorthand.
  27310. * _.partition(users, ['active', false]);
  27311. * // => objects for [['barney', 'pebbles'], ['fred']]
  27312. *
  27313. * // The `_.property` iteratee shorthand.
  27314. * _.partition(users, 'active');
  27315. * // => objects for [['fred'], ['barney', 'pebbles']]
  27316. */
  27317. var partition = createAggregator(function(result, value, key) {
  27318. result[key ? 0 : 1].push(value);
  27319. }, function() { return [[], []]; });
  27320. /**
  27321. * Reduces `collection` to a value which is the accumulated result of running
  27322. * each element in `collection` thru `iteratee`, where each successive
  27323. * invocation is supplied the return value of the previous. If `accumulator`
  27324. * is not given, the first element of `collection` is used as the initial
  27325. * value. The iteratee is invoked with four arguments:
  27326. * (accumulator, value, index|key, collection).
  27327. *
  27328. * Many lodash methods are guarded to work as iteratees for methods like
  27329. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27330. *
  27331. * The guarded methods are:
  27332. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27333. * and `sortBy`
  27334. *
  27335. * @static
  27336. * @memberOf _
  27337. * @since 0.1.0
  27338. * @category Collection
  27339. * @param {Array|Object} collection The collection to iterate over.
  27340. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27341. * @param {*} [accumulator] The initial value.
  27342. * @returns {*} Returns the accumulated value.
  27343. * @see _.reduceRight
  27344. * @example
  27345. *
  27346. * _.reduce([1, 2], function(sum, n) {
  27347. * return sum + n;
  27348. * }, 0);
  27349. * // => 3
  27350. *
  27351. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27352. * (result[value] || (result[value] = [])).push(key);
  27353. * return result;
  27354. * }, {});
  27355. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27356. */
  27357. function reduce(collection, iteratee, accumulator) {
  27358. var func = isArray(collection) ? arrayReduce : baseReduce,
  27359. initAccum = arguments.length < 3;
  27360. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27361. }
  27362. /**
  27363. * This method is like `_.reduce` except that it iterates over elements of
  27364. * `collection` from right to left.
  27365. *
  27366. * @static
  27367. * @memberOf _
  27368. * @since 0.1.0
  27369. * @category Collection
  27370. * @param {Array|Object} collection The collection to iterate over.
  27371. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27372. * @param {*} [accumulator] The initial value.
  27373. * @returns {*} Returns the accumulated value.
  27374. * @see _.reduce
  27375. * @example
  27376. *
  27377. * var array = [[0, 1], [2, 3], [4, 5]];
  27378. *
  27379. * _.reduceRight(array, function(flattened, other) {
  27380. * return flattened.concat(other);
  27381. * }, []);
  27382. * // => [4, 5, 2, 3, 0, 1]
  27383. */
  27384. function reduceRight(collection, iteratee, accumulator) {
  27385. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27386. initAccum = arguments.length < 3;
  27387. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27388. }
  27389. /**
  27390. * The opposite of `_.filter`; this method returns the elements of `collection`
  27391. * that `predicate` does **not** return truthy for.
  27392. *
  27393. * @static
  27394. * @memberOf _
  27395. * @since 0.1.0
  27396. * @category Collection
  27397. * @param {Array|Object} collection The collection to iterate over.
  27398. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27399. * @returns {Array} Returns the new filtered array.
  27400. * @see _.filter
  27401. * @example
  27402. *
  27403. * var users = [
  27404. * { 'user': 'barney', 'age': 36, 'active': false },
  27405. * { 'user': 'fred', 'age': 40, 'active': true }
  27406. * ];
  27407. *
  27408. * _.reject(users, function(o) { return !o.active; });
  27409. * // => objects for ['fred']
  27410. *
  27411. * // The `_.matches` iteratee shorthand.
  27412. * _.reject(users, { 'age': 40, 'active': true });
  27413. * // => objects for ['barney']
  27414. *
  27415. * // The `_.matchesProperty` iteratee shorthand.
  27416. * _.reject(users, ['active', false]);
  27417. * // => objects for ['fred']
  27418. *
  27419. * // The `_.property` iteratee shorthand.
  27420. * _.reject(users, 'active');
  27421. * // => objects for ['barney']
  27422. */
  27423. function reject(collection, predicate) {
  27424. var func = isArray(collection) ? arrayFilter : baseFilter;
  27425. return func(collection, negate(getIteratee(predicate, 3)));
  27426. }
  27427. /**
  27428. * Gets a random element from `collection`.
  27429. *
  27430. * @static
  27431. * @memberOf _
  27432. * @since 2.0.0
  27433. * @category Collection
  27434. * @param {Array|Object} collection The collection to sample.
  27435. * @returns {*} Returns the random element.
  27436. * @example
  27437. *
  27438. * _.sample([1, 2, 3, 4]);
  27439. * // => 2
  27440. */
  27441. function sample(collection) {
  27442. var func = isArray(collection) ? arraySample : baseSample;
  27443. return func(collection);
  27444. }
  27445. /**
  27446. * Gets `n` random elements at unique keys from `collection` up to the
  27447. * size of `collection`.
  27448. *
  27449. * @static
  27450. * @memberOf _
  27451. * @since 4.0.0
  27452. * @category Collection
  27453. * @param {Array|Object} collection The collection to sample.
  27454. * @param {number} [n=1] The number of elements to sample.
  27455. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27456. * @returns {Array} Returns the random elements.
  27457. * @example
  27458. *
  27459. * _.sampleSize([1, 2, 3], 2);
  27460. * // => [3, 1]
  27461. *
  27462. * _.sampleSize([1, 2, 3], 4);
  27463. * // => [2, 3, 1]
  27464. */
  27465. function sampleSize(collection, n, guard) {
  27466. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27467. n = 1;
  27468. } else {
  27469. n = toInteger(n);
  27470. }
  27471. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27472. return func(collection, n);
  27473. }
  27474. /**
  27475. * Creates an array of shuffled values, using a version of the
  27476. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27477. *
  27478. * @static
  27479. * @memberOf _
  27480. * @since 0.1.0
  27481. * @category Collection
  27482. * @param {Array|Object} collection The collection to shuffle.
  27483. * @returns {Array} Returns the new shuffled array.
  27484. * @example
  27485. *
  27486. * _.shuffle([1, 2, 3, 4]);
  27487. * // => [4, 1, 3, 2]
  27488. */
  27489. function shuffle(collection) {
  27490. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27491. return func(collection);
  27492. }
  27493. /**
  27494. * Gets the size of `collection` by returning its length for array-like
  27495. * values or the number of own enumerable string keyed properties for objects.
  27496. *
  27497. * @static
  27498. * @memberOf _
  27499. * @since 0.1.0
  27500. * @category Collection
  27501. * @param {Array|Object|string} collection The collection to inspect.
  27502. * @returns {number} Returns the collection size.
  27503. * @example
  27504. *
  27505. * _.size([1, 2, 3]);
  27506. * // => 3
  27507. *
  27508. * _.size({ 'a': 1, 'b': 2 });
  27509. * // => 2
  27510. *
  27511. * _.size('pebbles');
  27512. * // => 7
  27513. */
  27514. function size(collection) {
  27515. if (collection == null) {
  27516. return 0;
  27517. }
  27518. if (isArrayLike(collection)) {
  27519. return isString(collection) ? stringSize(collection) : collection.length;
  27520. }
  27521. var tag = getTag(collection);
  27522. if (tag == mapTag || tag == setTag) {
  27523. return collection.size;
  27524. }
  27525. return baseKeys(collection).length;
  27526. }
  27527. /**
  27528. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27529. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27530. * invoked with three arguments: (value, index|key, collection).
  27531. *
  27532. * @static
  27533. * @memberOf _
  27534. * @since 0.1.0
  27535. * @category Collection
  27536. * @param {Array|Object} collection The collection to iterate over.
  27537. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27538. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27539. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27540. * else `false`.
  27541. * @example
  27542. *
  27543. * _.some([null, 0, 'yes', false], Boolean);
  27544. * // => true
  27545. *
  27546. * var users = [
  27547. * { 'user': 'barney', 'active': true },
  27548. * { 'user': 'fred', 'active': false }
  27549. * ];
  27550. *
  27551. * // The `_.matches` iteratee shorthand.
  27552. * _.some(users, { 'user': 'barney', 'active': false });
  27553. * // => false
  27554. *
  27555. * // The `_.matchesProperty` iteratee shorthand.
  27556. * _.some(users, ['active', false]);
  27557. * // => true
  27558. *
  27559. * // The `_.property` iteratee shorthand.
  27560. * _.some(users, 'active');
  27561. * // => true
  27562. */
  27563. function some(collection, predicate, guard) {
  27564. var func = isArray(collection) ? arraySome : baseSome;
  27565. if (guard && isIterateeCall(collection, predicate, guard)) {
  27566. predicate = undefined;
  27567. }
  27568. return func(collection, getIteratee(predicate, 3));
  27569. }
  27570. /**
  27571. * Creates an array of elements, sorted in ascending order by the results of
  27572. * running each element in a collection thru each iteratee. This method
  27573. * performs a stable sort, that is, it preserves the original sort order of
  27574. * equal elements. The iteratees are invoked with one argument: (value).
  27575. *
  27576. * @static
  27577. * @memberOf _
  27578. * @since 0.1.0
  27579. * @category Collection
  27580. * @param {Array|Object} collection The collection to iterate over.
  27581. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27582. * The iteratees to sort by.
  27583. * @returns {Array} Returns the new sorted array.
  27584. * @example
  27585. *
  27586. * var users = [
  27587. * { 'user': 'fred', 'age': 48 },
  27588. * { 'user': 'barney', 'age': 36 },
  27589. * { 'user': 'fred', 'age': 40 },
  27590. * { 'user': 'barney', 'age': 34 }
  27591. * ];
  27592. *
  27593. * _.sortBy(users, [function(o) { return o.user; }]);
  27594. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27595. *
  27596. * _.sortBy(users, ['user', 'age']);
  27597. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27598. */
  27599. var sortBy = baseRest(function(collection, iteratees) {
  27600. if (collection == null) {
  27601. return [];
  27602. }
  27603. var length = iteratees.length;
  27604. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27605. iteratees = [];
  27606. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27607. iteratees = [iteratees[0]];
  27608. }
  27609. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27610. });
  27611. /*------------------------------------------------------------------------*/
  27612. /**
  27613. * Gets the timestamp of the number of milliseconds that have elapsed since
  27614. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27615. *
  27616. * @static
  27617. * @memberOf _
  27618. * @since 2.4.0
  27619. * @category Date
  27620. * @returns {number} Returns the timestamp.
  27621. * @example
  27622. *
  27623. * _.defer(function(stamp) {
  27624. * console.log(_.now() - stamp);
  27625. * }, _.now());
  27626. * // => Logs the number of milliseconds it took for the deferred invocation.
  27627. */
  27628. var now = ctxNow || function() {
  27629. return root.Date.now();
  27630. };
  27631. /*------------------------------------------------------------------------*/
  27632. /**
  27633. * The opposite of `_.before`; this method creates a function that invokes
  27634. * `func` once it's called `n` or more times.
  27635. *
  27636. * @static
  27637. * @memberOf _
  27638. * @since 0.1.0
  27639. * @category Function
  27640. * @param {number} n The number of calls before `func` is invoked.
  27641. * @param {Function} func The function to restrict.
  27642. * @returns {Function} Returns the new restricted function.
  27643. * @example
  27644. *
  27645. * var saves = ['profile', 'settings'];
  27646. *
  27647. * var done = _.after(saves.length, function() {
  27648. * console.log('done saving!');
  27649. * });
  27650. *
  27651. * _.forEach(saves, function(type) {
  27652. * asyncSave({ 'type': type, 'complete': done });
  27653. * });
  27654. * // => Logs 'done saving!' after the two async saves have completed.
  27655. */
  27656. function after(n, func) {
  27657. if (typeof func != 'function') {
  27658. throw new TypeError(FUNC_ERROR_TEXT);
  27659. }
  27660. n = toInteger(n);
  27661. return function() {
  27662. if (--n < 1) {
  27663. return func.apply(this, arguments);
  27664. }
  27665. };
  27666. }
  27667. /**
  27668. * Creates a function that invokes `func`, with up to `n` arguments,
  27669. * ignoring any additional arguments.
  27670. *
  27671. * @static
  27672. * @memberOf _
  27673. * @since 3.0.0
  27674. * @category Function
  27675. * @param {Function} func The function to cap arguments for.
  27676. * @param {number} [n=func.length] The arity cap.
  27677. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27678. * @returns {Function} Returns the new capped function.
  27679. * @example
  27680. *
  27681. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27682. * // => [6, 8, 10]
  27683. */
  27684. function ary(func, n, guard) {
  27685. n = guard ? undefined : n;
  27686. n = (func && n == null) ? func.length : n;
  27687. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27688. }
  27689. /**
  27690. * Creates a function that invokes `func`, with the `this` binding and arguments
  27691. * of the created function, while it's called less than `n` times. Subsequent
  27692. * calls to the created function return the result of the last `func` invocation.
  27693. *
  27694. * @static
  27695. * @memberOf _
  27696. * @since 3.0.0
  27697. * @category Function
  27698. * @param {number} n The number of calls at which `func` is no longer invoked.
  27699. * @param {Function} func The function to restrict.
  27700. * @returns {Function} Returns the new restricted function.
  27701. * @example
  27702. *
  27703. * jQuery(element).on('click', _.before(5, addContactToList));
  27704. * // => Allows adding up to 4 contacts to the list.
  27705. */
  27706. function before(n, func) {
  27707. var result;
  27708. if (typeof func != 'function') {
  27709. throw new TypeError(FUNC_ERROR_TEXT);
  27710. }
  27711. n = toInteger(n);
  27712. return function() {
  27713. if (--n > 0) {
  27714. result = func.apply(this, arguments);
  27715. }
  27716. if (n <= 1) {
  27717. func = undefined;
  27718. }
  27719. return result;
  27720. };
  27721. }
  27722. /**
  27723. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27724. * and `partials` prepended to the arguments it receives.
  27725. *
  27726. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27727. * may be used as a placeholder for partially applied arguments.
  27728. *
  27729. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27730. * property of bound functions.
  27731. *
  27732. * @static
  27733. * @memberOf _
  27734. * @since 0.1.0
  27735. * @category Function
  27736. * @param {Function} func The function to bind.
  27737. * @param {*} thisArg The `this` binding of `func`.
  27738. * @param {...*} [partials] The arguments to be partially applied.
  27739. * @returns {Function} Returns the new bound function.
  27740. * @example
  27741. *
  27742. * function greet(greeting, punctuation) {
  27743. * return greeting + ' ' + this.user + punctuation;
  27744. * }
  27745. *
  27746. * var object = { 'user': 'fred' };
  27747. *
  27748. * var bound = _.bind(greet, object, 'hi');
  27749. * bound('!');
  27750. * // => 'hi fred!'
  27751. *
  27752. * // Bound with placeholders.
  27753. * var bound = _.bind(greet, object, _, '!');
  27754. * bound('hi');
  27755. * // => 'hi fred!'
  27756. */
  27757. var bind = baseRest(function(func, thisArg, partials) {
  27758. var bitmask = WRAP_BIND_FLAG;
  27759. if (partials.length) {
  27760. var holders = replaceHolders(partials, getHolder(bind));
  27761. bitmask |= WRAP_PARTIAL_FLAG;
  27762. }
  27763. return createWrap(func, bitmask, thisArg, partials, holders);
  27764. });
  27765. /**
  27766. * Creates a function that invokes the method at `object[key]` with `partials`
  27767. * prepended to the arguments it receives.
  27768. *
  27769. * This method differs from `_.bind` by allowing bound functions to reference
  27770. * methods that may be redefined or don't yet exist. See
  27771. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27772. * for more details.
  27773. *
  27774. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27775. * builds, may be used as a placeholder for partially applied arguments.
  27776. *
  27777. * @static
  27778. * @memberOf _
  27779. * @since 0.10.0
  27780. * @category Function
  27781. * @param {Object} object The object to invoke the method on.
  27782. * @param {string} key The key of the method.
  27783. * @param {...*} [partials] The arguments to be partially applied.
  27784. * @returns {Function} Returns the new bound function.
  27785. * @example
  27786. *
  27787. * var object = {
  27788. * 'user': 'fred',
  27789. * 'greet': function(greeting, punctuation) {
  27790. * return greeting + ' ' + this.user + punctuation;
  27791. * }
  27792. * };
  27793. *
  27794. * var bound = _.bindKey(object, 'greet', 'hi');
  27795. * bound('!');
  27796. * // => 'hi fred!'
  27797. *
  27798. * object.greet = function(greeting, punctuation) {
  27799. * return greeting + 'ya ' + this.user + punctuation;
  27800. * };
  27801. *
  27802. * bound('!');
  27803. * // => 'hiya fred!'
  27804. *
  27805. * // Bound with placeholders.
  27806. * var bound = _.bindKey(object, 'greet', _, '!');
  27807. * bound('hi');
  27808. * // => 'hiya fred!'
  27809. */
  27810. var bindKey = baseRest(function(object, key, partials) {
  27811. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27812. if (partials.length) {
  27813. var holders = replaceHolders(partials, getHolder(bindKey));
  27814. bitmask |= WRAP_PARTIAL_FLAG;
  27815. }
  27816. return createWrap(key, bitmask, object, partials, holders);
  27817. });
  27818. /**
  27819. * Creates a function that accepts arguments of `func` and either invokes
  27820. * `func` returning its result, if at least `arity` number of arguments have
  27821. * been provided, or returns a function that accepts the remaining `func`
  27822. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27823. * is not sufficient.
  27824. *
  27825. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27826. * may be used as a placeholder for provided arguments.
  27827. *
  27828. * **Note:** This method doesn't set the "length" property of curried functions.
  27829. *
  27830. * @static
  27831. * @memberOf _
  27832. * @since 2.0.0
  27833. * @category Function
  27834. * @param {Function} func The function to curry.
  27835. * @param {number} [arity=func.length] The arity of `func`.
  27836. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27837. * @returns {Function} Returns the new curried function.
  27838. * @example
  27839. *
  27840. * var abc = function(a, b, c) {
  27841. * return [a, b, c];
  27842. * };
  27843. *
  27844. * var curried = _.curry(abc);
  27845. *
  27846. * curried(1)(2)(3);
  27847. * // => [1, 2, 3]
  27848. *
  27849. * curried(1, 2)(3);
  27850. * // => [1, 2, 3]
  27851. *
  27852. * curried(1, 2, 3);
  27853. * // => [1, 2, 3]
  27854. *
  27855. * // Curried with placeholders.
  27856. * curried(1)(_, 3)(2);
  27857. * // => [1, 2, 3]
  27858. */
  27859. function curry(func, arity, guard) {
  27860. arity = guard ? undefined : arity;
  27861. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27862. result.placeholder = curry.placeholder;
  27863. return result;
  27864. }
  27865. /**
  27866. * This method is like `_.curry` except that arguments are applied to `func`
  27867. * in the manner of `_.partialRight` instead of `_.partial`.
  27868. *
  27869. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27870. * builds, may be used as a placeholder for provided arguments.
  27871. *
  27872. * **Note:** This method doesn't set the "length" property of curried functions.
  27873. *
  27874. * @static
  27875. * @memberOf _
  27876. * @since 3.0.0
  27877. * @category Function
  27878. * @param {Function} func The function to curry.
  27879. * @param {number} [arity=func.length] The arity of `func`.
  27880. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27881. * @returns {Function} Returns the new curried function.
  27882. * @example
  27883. *
  27884. * var abc = function(a, b, c) {
  27885. * return [a, b, c];
  27886. * };
  27887. *
  27888. * var curried = _.curryRight(abc);
  27889. *
  27890. * curried(3)(2)(1);
  27891. * // => [1, 2, 3]
  27892. *
  27893. * curried(2, 3)(1);
  27894. * // => [1, 2, 3]
  27895. *
  27896. * curried(1, 2, 3);
  27897. * // => [1, 2, 3]
  27898. *
  27899. * // Curried with placeholders.
  27900. * curried(3)(1, _)(2);
  27901. * // => [1, 2, 3]
  27902. */
  27903. function curryRight(func, arity, guard) {
  27904. arity = guard ? undefined : arity;
  27905. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27906. result.placeholder = curryRight.placeholder;
  27907. return result;
  27908. }
  27909. /**
  27910. * Creates a debounced function that delays invoking `func` until after `wait`
  27911. * milliseconds have elapsed since the last time the debounced function was
  27912. * invoked. The debounced function comes with a `cancel` method to cancel
  27913. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27914. * Provide `options` to indicate whether `func` should be invoked on the
  27915. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27916. * with the last arguments provided to the debounced function. Subsequent
  27917. * calls to the debounced function return the result of the last `func`
  27918. * invocation.
  27919. *
  27920. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27921. * invoked on the trailing edge of the timeout only if the debounced function
  27922. * is invoked more than once during the `wait` timeout.
  27923. *
  27924. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27925. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27926. *
  27927. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27928. * for details over the differences between `_.debounce` and `_.throttle`.
  27929. *
  27930. * @static
  27931. * @memberOf _
  27932. * @since 0.1.0
  27933. * @category Function
  27934. * @param {Function} func The function to debounce.
  27935. * @param {number} [wait=0] The number of milliseconds to delay.
  27936. * @param {Object} [options={}] The options object.
  27937. * @param {boolean} [options.leading=false]
  27938. * Specify invoking on the leading edge of the timeout.
  27939. * @param {number} [options.maxWait]
  27940. * The maximum time `func` is allowed to be delayed before it's invoked.
  27941. * @param {boolean} [options.trailing=true]
  27942. * Specify invoking on the trailing edge of the timeout.
  27943. * @returns {Function} Returns the new debounced function.
  27944. * @example
  27945. *
  27946. * // Avoid costly calculations while the window size is in flux.
  27947. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27948. *
  27949. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27950. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27951. * 'leading': true,
  27952. * 'trailing': false
  27953. * }));
  27954. *
  27955. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27956. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27957. * var source = new EventSource('/stream');
  27958. * jQuery(source).on('message', debounced);
  27959. *
  27960. * // Cancel the trailing debounced invocation.
  27961. * jQuery(window).on('popstate', debounced.cancel);
  27962. */
  27963. function debounce(func, wait, options) {
  27964. var lastArgs,
  27965. lastThis,
  27966. maxWait,
  27967. result,
  27968. timerId,
  27969. lastCallTime,
  27970. lastInvokeTime = 0,
  27971. leading = false,
  27972. maxing = false,
  27973. trailing = true;
  27974. if (typeof func != 'function') {
  27975. throw new TypeError(FUNC_ERROR_TEXT);
  27976. }
  27977. wait = toNumber(wait) || 0;
  27978. if (isObject(options)) {
  27979. leading = !!options.leading;
  27980. maxing = 'maxWait' in options;
  27981. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27982. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27983. }
  27984. function invokeFunc(time) {
  27985. var args = lastArgs,
  27986. thisArg = lastThis;
  27987. lastArgs = lastThis = undefined;
  27988. lastInvokeTime = time;
  27989. result = func.apply(thisArg, args);
  27990. return result;
  27991. }
  27992. function leadingEdge(time) {
  27993. // Reset any `maxWait` timer.
  27994. lastInvokeTime = time;
  27995. // Start the timer for the trailing edge.
  27996. timerId = setTimeout(timerExpired, wait);
  27997. // Invoke the leading edge.
  27998. return leading ? invokeFunc(time) : result;
  27999. }
  28000. function remainingWait(time) {
  28001. var timeSinceLastCall = time - lastCallTime,
  28002. timeSinceLastInvoke = time - lastInvokeTime,
  28003. timeWaiting = wait - timeSinceLastCall;
  28004. return maxing
  28005. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28006. : timeWaiting;
  28007. }
  28008. function shouldInvoke(time) {
  28009. var timeSinceLastCall = time - lastCallTime,
  28010. timeSinceLastInvoke = time - lastInvokeTime;
  28011. // Either this is the first call, activity has stopped and we're at the
  28012. // trailing edge, the system time has gone backwards and we're treating
  28013. // it as the trailing edge, or we've hit the `maxWait` limit.
  28014. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28015. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28016. }
  28017. function timerExpired() {
  28018. var time = now();
  28019. if (shouldInvoke(time)) {
  28020. return trailingEdge(time);
  28021. }
  28022. // Restart the timer.
  28023. timerId = setTimeout(timerExpired, remainingWait(time));
  28024. }
  28025. function trailingEdge(time) {
  28026. timerId = undefined;
  28027. // Only invoke if we have `lastArgs` which means `func` has been
  28028. // debounced at least once.
  28029. if (trailing && lastArgs) {
  28030. return invokeFunc(time);
  28031. }
  28032. lastArgs = lastThis = undefined;
  28033. return result;
  28034. }
  28035. function cancel() {
  28036. if (timerId !== undefined) {
  28037. clearTimeout(timerId);
  28038. }
  28039. lastInvokeTime = 0;
  28040. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28041. }
  28042. function flush() {
  28043. return timerId === undefined ? result : trailingEdge(now());
  28044. }
  28045. function debounced() {
  28046. var time = now(),
  28047. isInvoking = shouldInvoke(time);
  28048. lastArgs = arguments;
  28049. lastThis = this;
  28050. lastCallTime = time;
  28051. if (isInvoking) {
  28052. if (timerId === undefined) {
  28053. return leadingEdge(lastCallTime);
  28054. }
  28055. if (maxing) {
  28056. // Handle invocations in a tight loop.
  28057. clearTimeout(timerId);
  28058. timerId = setTimeout(timerExpired, wait);
  28059. return invokeFunc(lastCallTime);
  28060. }
  28061. }
  28062. if (timerId === undefined) {
  28063. timerId = setTimeout(timerExpired, wait);
  28064. }
  28065. return result;
  28066. }
  28067. debounced.cancel = cancel;
  28068. debounced.flush = flush;
  28069. return debounced;
  28070. }
  28071. /**
  28072. * Defers invoking the `func` until the current call stack has cleared. Any
  28073. * additional arguments are provided to `func` when it's invoked.
  28074. *
  28075. * @static
  28076. * @memberOf _
  28077. * @since 0.1.0
  28078. * @category Function
  28079. * @param {Function} func The function to defer.
  28080. * @param {...*} [args] The arguments to invoke `func` with.
  28081. * @returns {number} Returns the timer id.
  28082. * @example
  28083. *
  28084. * _.defer(function(text) {
  28085. * console.log(text);
  28086. * }, 'deferred');
  28087. * // => Logs 'deferred' after one millisecond.
  28088. */
  28089. var defer = baseRest(function(func, args) {
  28090. return baseDelay(func, 1, args);
  28091. });
  28092. /**
  28093. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28094. * provided to `func` when it's invoked.
  28095. *
  28096. * @static
  28097. * @memberOf _
  28098. * @since 0.1.0
  28099. * @category Function
  28100. * @param {Function} func The function to delay.
  28101. * @param {number} wait The number of milliseconds to delay invocation.
  28102. * @param {...*} [args] The arguments to invoke `func` with.
  28103. * @returns {number} Returns the timer id.
  28104. * @example
  28105. *
  28106. * _.delay(function(text) {
  28107. * console.log(text);
  28108. * }, 1000, 'later');
  28109. * // => Logs 'later' after one second.
  28110. */
  28111. var delay = baseRest(function(func, wait, args) {
  28112. return baseDelay(func, toNumber(wait) || 0, args);
  28113. });
  28114. /**
  28115. * Creates a function that invokes `func` with arguments reversed.
  28116. *
  28117. * @static
  28118. * @memberOf _
  28119. * @since 4.0.0
  28120. * @category Function
  28121. * @param {Function} func The function to flip arguments for.
  28122. * @returns {Function} Returns the new flipped function.
  28123. * @example
  28124. *
  28125. * var flipped = _.flip(function() {
  28126. * return _.toArray(arguments);
  28127. * });
  28128. *
  28129. * flipped('a', 'b', 'c', 'd');
  28130. * // => ['d', 'c', 'b', 'a']
  28131. */
  28132. function flip(func) {
  28133. return createWrap(func, WRAP_FLIP_FLAG);
  28134. }
  28135. /**
  28136. * Creates a function that memoizes the result of `func`. If `resolver` is
  28137. * provided, it determines the cache key for storing the result based on the
  28138. * arguments provided to the memoized function. By default, the first argument
  28139. * provided to the memoized function is used as the map cache key. The `func`
  28140. * is invoked with the `this` binding of the memoized function.
  28141. *
  28142. * **Note:** The cache is exposed as the `cache` property on the memoized
  28143. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28144. * constructor with one whose instances implement the
  28145. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28146. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28147. *
  28148. * @static
  28149. * @memberOf _
  28150. * @since 0.1.0
  28151. * @category Function
  28152. * @param {Function} func The function to have its output memoized.
  28153. * @param {Function} [resolver] The function to resolve the cache key.
  28154. * @returns {Function} Returns the new memoized function.
  28155. * @example
  28156. *
  28157. * var object = { 'a': 1, 'b': 2 };
  28158. * var other = { 'c': 3, 'd': 4 };
  28159. *
  28160. * var values = _.memoize(_.values);
  28161. * values(object);
  28162. * // => [1, 2]
  28163. *
  28164. * values(other);
  28165. * // => [3, 4]
  28166. *
  28167. * object.a = 2;
  28168. * values(object);
  28169. * // => [1, 2]
  28170. *
  28171. * // Modify the result cache.
  28172. * values.cache.set(object, ['a', 'b']);
  28173. * values(object);
  28174. * // => ['a', 'b']
  28175. *
  28176. * // Replace `_.memoize.Cache`.
  28177. * _.memoize.Cache = WeakMap;
  28178. */
  28179. function memoize(func, resolver) {
  28180. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28181. throw new TypeError(FUNC_ERROR_TEXT);
  28182. }
  28183. var memoized = function() {
  28184. var args = arguments,
  28185. key = resolver ? resolver.apply(this, args) : args[0],
  28186. cache = memoized.cache;
  28187. if (cache.has(key)) {
  28188. return cache.get(key);
  28189. }
  28190. var result = func.apply(this, args);
  28191. memoized.cache = cache.set(key, result) || cache;
  28192. return result;
  28193. };
  28194. memoized.cache = new (memoize.Cache || MapCache);
  28195. return memoized;
  28196. }
  28197. // Expose `MapCache`.
  28198. memoize.Cache = MapCache;
  28199. /**
  28200. * Creates a function that negates the result of the predicate `func`. The
  28201. * `func` predicate is invoked with the `this` binding and arguments of the
  28202. * created function.
  28203. *
  28204. * @static
  28205. * @memberOf _
  28206. * @since 3.0.0
  28207. * @category Function
  28208. * @param {Function} predicate The predicate to negate.
  28209. * @returns {Function} Returns the new negated function.
  28210. * @example
  28211. *
  28212. * function isEven(n) {
  28213. * return n % 2 == 0;
  28214. * }
  28215. *
  28216. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28217. * // => [1, 3, 5]
  28218. */
  28219. function negate(predicate) {
  28220. if (typeof predicate != 'function') {
  28221. throw new TypeError(FUNC_ERROR_TEXT);
  28222. }
  28223. return function() {
  28224. var args = arguments;
  28225. switch (args.length) {
  28226. case 0: return !predicate.call(this);
  28227. case 1: return !predicate.call(this, args[0]);
  28228. case 2: return !predicate.call(this, args[0], args[1]);
  28229. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28230. }
  28231. return !predicate.apply(this, args);
  28232. };
  28233. }
  28234. /**
  28235. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28236. * to the function return the value of the first invocation. The `func` is
  28237. * invoked with the `this` binding and arguments of the created function.
  28238. *
  28239. * @static
  28240. * @memberOf _
  28241. * @since 0.1.0
  28242. * @category Function
  28243. * @param {Function} func The function to restrict.
  28244. * @returns {Function} Returns the new restricted function.
  28245. * @example
  28246. *
  28247. * var initialize = _.once(createApplication);
  28248. * initialize();
  28249. * initialize();
  28250. * // => `createApplication` is invoked once
  28251. */
  28252. function once(func) {
  28253. return before(2, func);
  28254. }
  28255. /**
  28256. * Creates a function that invokes `func` with its arguments transformed.
  28257. *
  28258. * @static
  28259. * @since 4.0.0
  28260. * @memberOf _
  28261. * @category Function
  28262. * @param {Function} func The function to wrap.
  28263. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28264. * The argument transforms.
  28265. * @returns {Function} Returns the new function.
  28266. * @example
  28267. *
  28268. * function doubled(n) {
  28269. * return n * 2;
  28270. * }
  28271. *
  28272. * function square(n) {
  28273. * return n * n;
  28274. * }
  28275. *
  28276. * var func = _.overArgs(function(x, y) {
  28277. * return [x, y];
  28278. * }, [square, doubled]);
  28279. *
  28280. * func(9, 3);
  28281. * // => [81, 6]
  28282. *
  28283. * func(10, 5);
  28284. * // => [100, 10]
  28285. */
  28286. var overArgs = castRest(function(func, transforms) {
  28287. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28288. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28289. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28290. var funcsLength = transforms.length;
  28291. return baseRest(function(args) {
  28292. var index = -1,
  28293. length = nativeMin(args.length, funcsLength);
  28294. while (++index < length) {
  28295. args[index] = transforms[index].call(this, args[index]);
  28296. }
  28297. return apply(func, this, args);
  28298. });
  28299. });
  28300. /**
  28301. * Creates a function that invokes `func` with `partials` prepended to the
  28302. * arguments it receives. This method is like `_.bind` except it does **not**
  28303. * alter the `this` binding.
  28304. *
  28305. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28306. * builds, may be used as a placeholder for partially applied arguments.
  28307. *
  28308. * **Note:** This method doesn't set the "length" property of partially
  28309. * applied functions.
  28310. *
  28311. * @static
  28312. * @memberOf _
  28313. * @since 0.2.0
  28314. * @category Function
  28315. * @param {Function} func The function to partially apply arguments to.
  28316. * @param {...*} [partials] The arguments to be partially applied.
  28317. * @returns {Function} Returns the new partially applied function.
  28318. * @example
  28319. *
  28320. * function greet(greeting, name) {
  28321. * return greeting + ' ' + name;
  28322. * }
  28323. *
  28324. * var sayHelloTo = _.partial(greet, 'hello');
  28325. * sayHelloTo('fred');
  28326. * // => 'hello fred'
  28327. *
  28328. * // Partially applied with placeholders.
  28329. * var greetFred = _.partial(greet, _, 'fred');
  28330. * greetFred('hi');
  28331. * // => 'hi fred'
  28332. */
  28333. var partial = baseRest(function(func, partials) {
  28334. var holders = replaceHolders(partials, getHolder(partial));
  28335. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28336. });
  28337. /**
  28338. * This method is like `_.partial` except that partially applied arguments
  28339. * are appended to the arguments it receives.
  28340. *
  28341. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28342. * builds, may be used as a placeholder for partially applied arguments.
  28343. *
  28344. * **Note:** This method doesn't set the "length" property of partially
  28345. * applied functions.
  28346. *
  28347. * @static
  28348. * @memberOf _
  28349. * @since 1.0.0
  28350. * @category Function
  28351. * @param {Function} func The function to partially apply arguments to.
  28352. * @param {...*} [partials] The arguments to be partially applied.
  28353. * @returns {Function} Returns the new partially applied function.
  28354. * @example
  28355. *
  28356. * function greet(greeting, name) {
  28357. * return greeting + ' ' + name;
  28358. * }
  28359. *
  28360. * var greetFred = _.partialRight(greet, 'fred');
  28361. * greetFred('hi');
  28362. * // => 'hi fred'
  28363. *
  28364. * // Partially applied with placeholders.
  28365. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28366. * sayHelloTo('fred');
  28367. * // => 'hello fred'
  28368. */
  28369. var partialRight = baseRest(function(func, partials) {
  28370. var holders = replaceHolders(partials, getHolder(partialRight));
  28371. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28372. });
  28373. /**
  28374. * Creates a function that invokes `func` with arguments arranged according
  28375. * to the specified `indexes` where the argument value at the first index is
  28376. * provided as the first argument, the argument value at the second index is
  28377. * provided as the second argument, and so on.
  28378. *
  28379. * @static
  28380. * @memberOf _
  28381. * @since 3.0.0
  28382. * @category Function
  28383. * @param {Function} func The function to rearrange arguments for.
  28384. * @param {...(number|number[])} indexes The arranged argument indexes.
  28385. * @returns {Function} Returns the new function.
  28386. * @example
  28387. *
  28388. * var rearged = _.rearg(function(a, b, c) {
  28389. * return [a, b, c];
  28390. * }, [2, 0, 1]);
  28391. *
  28392. * rearged('b', 'c', 'a')
  28393. * // => ['a', 'b', 'c']
  28394. */
  28395. var rearg = flatRest(function(func, indexes) {
  28396. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28397. });
  28398. /**
  28399. * Creates a function that invokes `func` with the `this` binding of the
  28400. * created function and arguments from `start` and beyond provided as
  28401. * an array.
  28402. *
  28403. * **Note:** This method is based on the
  28404. * [rest parameter](https://mdn.io/rest_parameters).
  28405. *
  28406. * @static
  28407. * @memberOf _
  28408. * @since 4.0.0
  28409. * @category Function
  28410. * @param {Function} func The function to apply a rest parameter to.
  28411. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28412. * @returns {Function} Returns the new function.
  28413. * @example
  28414. *
  28415. * var say = _.rest(function(what, names) {
  28416. * return what + ' ' + _.initial(names).join(', ') +
  28417. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28418. * });
  28419. *
  28420. * say('hello', 'fred', 'barney', 'pebbles');
  28421. * // => 'hello fred, barney, & pebbles'
  28422. */
  28423. function rest(func, start) {
  28424. if (typeof func != 'function') {
  28425. throw new TypeError(FUNC_ERROR_TEXT);
  28426. }
  28427. start = start === undefined ? start : toInteger(start);
  28428. return baseRest(func, start);
  28429. }
  28430. /**
  28431. * Creates a function that invokes `func` with the `this` binding of the
  28432. * create function and an array of arguments much like
  28433. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28434. *
  28435. * **Note:** This method is based on the
  28436. * [spread operator](https://mdn.io/spread_operator).
  28437. *
  28438. * @static
  28439. * @memberOf _
  28440. * @since 3.2.0
  28441. * @category Function
  28442. * @param {Function} func The function to spread arguments over.
  28443. * @param {number} [start=0] The start position of the spread.
  28444. * @returns {Function} Returns the new function.
  28445. * @example
  28446. *
  28447. * var say = _.spread(function(who, what) {
  28448. * return who + ' says ' + what;
  28449. * });
  28450. *
  28451. * say(['fred', 'hello']);
  28452. * // => 'fred says hello'
  28453. *
  28454. * var numbers = Promise.all([
  28455. * Promise.resolve(40),
  28456. * Promise.resolve(36)
  28457. * ]);
  28458. *
  28459. * numbers.then(_.spread(function(x, y) {
  28460. * return x + y;
  28461. * }));
  28462. * // => a Promise of 76
  28463. */
  28464. function spread(func, start) {
  28465. if (typeof func != 'function') {
  28466. throw new TypeError(FUNC_ERROR_TEXT);
  28467. }
  28468. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28469. return baseRest(function(args) {
  28470. var array = args[start],
  28471. otherArgs = castSlice(args, 0, start);
  28472. if (array) {
  28473. arrayPush(otherArgs, array);
  28474. }
  28475. return apply(func, this, otherArgs);
  28476. });
  28477. }
  28478. /**
  28479. * Creates a throttled function that only invokes `func` at most once per
  28480. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28481. * method to cancel delayed `func` invocations and a `flush` method to
  28482. * immediately invoke them. Provide `options` to indicate whether `func`
  28483. * should be invoked on the leading and/or trailing edge of the `wait`
  28484. * timeout. The `func` is invoked with the last arguments provided to the
  28485. * throttled function. Subsequent calls to the throttled function return the
  28486. * result of the last `func` invocation.
  28487. *
  28488. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28489. * invoked on the trailing edge of the timeout only if the throttled function
  28490. * is invoked more than once during the `wait` timeout.
  28491. *
  28492. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28493. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28494. *
  28495. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28496. * for details over the differences between `_.throttle` and `_.debounce`.
  28497. *
  28498. * @static
  28499. * @memberOf _
  28500. * @since 0.1.0
  28501. * @category Function
  28502. * @param {Function} func The function to throttle.
  28503. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28504. * @param {Object} [options={}] The options object.
  28505. * @param {boolean} [options.leading=true]
  28506. * Specify invoking on the leading edge of the timeout.
  28507. * @param {boolean} [options.trailing=true]
  28508. * Specify invoking on the trailing edge of the timeout.
  28509. * @returns {Function} Returns the new throttled function.
  28510. * @example
  28511. *
  28512. * // Avoid excessively updating the position while scrolling.
  28513. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28514. *
  28515. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28516. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28517. * jQuery(element).on('click', throttled);
  28518. *
  28519. * // Cancel the trailing throttled invocation.
  28520. * jQuery(window).on('popstate', throttled.cancel);
  28521. */
  28522. function throttle(func, wait, options) {
  28523. var leading = true,
  28524. trailing = true;
  28525. if (typeof func != 'function') {
  28526. throw new TypeError(FUNC_ERROR_TEXT);
  28527. }
  28528. if (isObject(options)) {
  28529. leading = 'leading' in options ? !!options.leading : leading;
  28530. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28531. }
  28532. return debounce(func, wait, {
  28533. 'leading': leading,
  28534. 'maxWait': wait,
  28535. 'trailing': trailing
  28536. });
  28537. }
  28538. /**
  28539. * Creates a function that accepts up to one argument, ignoring any
  28540. * additional arguments.
  28541. *
  28542. * @static
  28543. * @memberOf _
  28544. * @since 4.0.0
  28545. * @category Function
  28546. * @param {Function} func The function to cap arguments for.
  28547. * @returns {Function} Returns the new capped function.
  28548. * @example
  28549. *
  28550. * _.map(['6', '8', '10'], _.unary(parseInt));
  28551. * // => [6, 8, 10]
  28552. */
  28553. function unary(func) {
  28554. return ary(func, 1);
  28555. }
  28556. /**
  28557. * Creates a function that provides `value` to `wrapper` as its first
  28558. * argument. Any additional arguments provided to the function are appended
  28559. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28560. * binding of the created function.
  28561. *
  28562. * @static
  28563. * @memberOf _
  28564. * @since 0.1.0
  28565. * @category Function
  28566. * @param {*} value The value to wrap.
  28567. * @param {Function} [wrapper=identity] The wrapper function.
  28568. * @returns {Function} Returns the new function.
  28569. * @example
  28570. *
  28571. * var p = _.wrap(_.escape, function(func, text) {
  28572. * return '<p>' + func(text) + '</p>';
  28573. * });
  28574. *
  28575. * p('fred, barney, & pebbles');
  28576. * // => '<p>fred, barney, &amp; pebbles</p>'
  28577. */
  28578. function wrap(value, wrapper) {
  28579. return partial(castFunction(wrapper), value);
  28580. }
  28581. /*------------------------------------------------------------------------*/
  28582. /**
  28583. * Casts `value` as an array if it's not one.
  28584. *
  28585. * @static
  28586. * @memberOf _
  28587. * @since 4.4.0
  28588. * @category Lang
  28589. * @param {*} value The value to inspect.
  28590. * @returns {Array} Returns the cast array.
  28591. * @example
  28592. *
  28593. * _.castArray(1);
  28594. * // => [1]
  28595. *
  28596. * _.castArray({ 'a': 1 });
  28597. * // => [{ 'a': 1 }]
  28598. *
  28599. * _.castArray('abc');
  28600. * // => ['abc']
  28601. *
  28602. * _.castArray(null);
  28603. * // => [null]
  28604. *
  28605. * _.castArray(undefined);
  28606. * // => [undefined]
  28607. *
  28608. * _.castArray();
  28609. * // => []
  28610. *
  28611. * var array = [1, 2, 3];
  28612. * console.log(_.castArray(array) === array);
  28613. * // => true
  28614. */
  28615. function castArray() {
  28616. if (!arguments.length) {
  28617. return [];
  28618. }
  28619. var value = arguments[0];
  28620. return isArray(value) ? value : [value];
  28621. }
  28622. /**
  28623. * Creates a shallow clone of `value`.
  28624. *
  28625. * **Note:** This method is loosely based on the
  28626. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28627. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28628. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28629. * arrays. The own enumerable properties of `arguments` objects are cloned
  28630. * as plain objects. An empty object is returned for uncloneable values such
  28631. * as error objects, functions, DOM nodes, and WeakMaps.
  28632. *
  28633. * @static
  28634. * @memberOf _
  28635. * @since 0.1.0
  28636. * @category Lang
  28637. * @param {*} value The value to clone.
  28638. * @returns {*} Returns the cloned value.
  28639. * @see _.cloneDeep
  28640. * @example
  28641. *
  28642. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28643. *
  28644. * var shallow = _.clone(objects);
  28645. * console.log(shallow[0] === objects[0]);
  28646. * // => true
  28647. */
  28648. function clone(value) {
  28649. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28650. }
  28651. /**
  28652. * This method is like `_.clone` except that it accepts `customizer` which
  28653. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28654. * cloning is handled by the method instead. The `customizer` is invoked with
  28655. * up to four arguments; (value [, index|key, object, stack]).
  28656. *
  28657. * @static
  28658. * @memberOf _
  28659. * @since 4.0.0
  28660. * @category Lang
  28661. * @param {*} value The value to clone.
  28662. * @param {Function} [customizer] The function to customize cloning.
  28663. * @returns {*} Returns the cloned value.
  28664. * @see _.cloneDeepWith
  28665. * @example
  28666. *
  28667. * function customizer(value) {
  28668. * if (_.isElement(value)) {
  28669. * return value.cloneNode(false);
  28670. * }
  28671. * }
  28672. *
  28673. * var el = _.cloneWith(document.body, customizer);
  28674. *
  28675. * console.log(el === document.body);
  28676. * // => false
  28677. * console.log(el.nodeName);
  28678. * // => 'BODY'
  28679. * console.log(el.childNodes.length);
  28680. * // => 0
  28681. */
  28682. function cloneWith(value, customizer) {
  28683. customizer = typeof customizer == 'function' ? customizer : undefined;
  28684. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28685. }
  28686. /**
  28687. * This method is like `_.clone` except that it recursively clones `value`.
  28688. *
  28689. * @static
  28690. * @memberOf _
  28691. * @since 1.0.0
  28692. * @category Lang
  28693. * @param {*} value The value to recursively clone.
  28694. * @returns {*} Returns the deep cloned value.
  28695. * @see _.clone
  28696. * @example
  28697. *
  28698. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28699. *
  28700. * var deep = _.cloneDeep(objects);
  28701. * console.log(deep[0] === objects[0]);
  28702. * // => false
  28703. */
  28704. function cloneDeep(value) {
  28705. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28706. }
  28707. /**
  28708. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28709. *
  28710. * @static
  28711. * @memberOf _
  28712. * @since 4.0.0
  28713. * @category Lang
  28714. * @param {*} value The value to recursively clone.
  28715. * @param {Function} [customizer] The function to customize cloning.
  28716. * @returns {*} Returns the deep cloned value.
  28717. * @see _.cloneWith
  28718. * @example
  28719. *
  28720. * function customizer(value) {
  28721. * if (_.isElement(value)) {
  28722. * return value.cloneNode(true);
  28723. * }
  28724. * }
  28725. *
  28726. * var el = _.cloneDeepWith(document.body, customizer);
  28727. *
  28728. * console.log(el === document.body);
  28729. * // => false
  28730. * console.log(el.nodeName);
  28731. * // => 'BODY'
  28732. * console.log(el.childNodes.length);
  28733. * // => 20
  28734. */
  28735. function cloneDeepWith(value, customizer) {
  28736. customizer = typeof customizer == 'function' ? customizer : undefined;
  28737. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28738. }
  28739. /**
  28740. * Checks if `object` conforms to `source` by invoking the predicate
  28741. * properties of `source` with the corresponding property values of `object`.
  28742. *
  28743. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28744. * partially applied.
  28745. *
  28746. * @static
  28747. * @memberOf _
  28748. * @since 4.14.0
  28749. * @category Lang
  28750. * @param {Object} object The object to inspect.
  28751. * @param {Object} source The object of property predicates to conform to.
  28752. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28753. * @example
  28754. *
  28755. * var object = { 'a': 1, 'b': 2 };
  28756. *
  28757. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28758. * // => true
  28759. *
  28760. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28761. * // => false
  28762. */
  28763. function conformsTo(object, source) {
  28764. return source == null || baseConformsTo(object, source, keys(source));
  28765. }
  28766. /**
  28767. * Performs a
  28768. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28769. * comparison between two values to determine if they are equivalent.
  28770. *
  28771. * @static
  28772. * @memberOf _
  28773. * @since 4.0.0
  28774. * @category Lang
  28775. * @param {*} value The value to compare.
  28776. * @param {*} other The other value to compare.
  28777. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28778. * @example
  28779. *
  28780. * var object = { 'a': 1 };
  28781. * var other = { 'a': 1 };
  28782. *
  28783. * _.eq(object, object);
  28784. * // => true
  28785. *
  28786. * _.eq(object, other);
  28787. * // => false
  28788. *
  28789. * _.eq('a', 'a');
  28790. * // => true
  28791. *
  28792. * _.eq('a', Object('a'));
  28793. * // => false
  28794. *
  28795. * _.eq(NaN, NaN);
  28796. * // => true
  28797. */
  28798. function eq(value, other) {
  28799. return value === other || (value !== value && other !== other);
  28800. }
  28801. /**
  28802. * Checks if `value` is greater than `other`.
  28803. *
  28804. * @static
  28805. * @memberOf _
  28806. * @since 3.9.0
  28807. * @category Lang
  28808. * @param {*} value The value to compare.
  28809. * @param {*} other The other value to compare.
  28810. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28811. * else `false`.
  28812. * @see _.lt
  28813. * @example
  28814. *
  28815. * _.gt(3, 1);
  28816. * // => true
  28817. *
  28818. * _.gt(3, 3);
  28819. * // => false
  28820. *
  28821. * _.gt(1, 3);
  28822. * // => false
  28823. */
  28824. var gt = createRelationalOperation(baseGt);
  28825. /**
  28826. * Checks if `value` is greater than or equal to `other`.
  28827. *
  28828. * @static
  28829. * @memberOf _
  28830. * @since 3.9.0
  28831. * @category Lang
  28832. * @param {*} value The value to compare.
  28833. * @param {*} other The other value to compare.
  28834. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28835. * `other`, else `false`.
  28836. * @see _.lte
  28837. * @example
  28838. *
  28839. * _.gte(3, 1);
  28840. * // => true
  28841. *
  28842. * _.gte(3, 3);
  28843. * // => true
  28844. *
  28845. * _.gte(1, 3);
  28846. * // => false
  28847. */
  28848. var gte = createRelationalOperation(function(value, other) {
  28849. return value >= other;
  28850. });
  28851. /**
  28852. * Checks if `value` is likely an `arguments` object.
  28853. *
  28854. * @static
  28855. * @memberOf _
  28856. * @since 0.1.0
  28857. * @category Lang
  28858. * @param {*} value The value to check.
  28859. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28860. * else `false`.
  28861. * @example
  28862. *
  28863. * _.isArguments(function() { return arguments; }());
  28864. * // => true
  28865. *
  28866. * _.isArguments([1, 2, 3]);
  28867. * // => false
  28868. */
  28869. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28870. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28871. !propertyIsEnumerable.call(value, 'callee');
  28872. };
  28873. /**
  28874. * Checks if `value` is classified as an `Array` object.
  28875. *
  28876. * @static
  28877. * @memberOf _
  28878. * @since 0.1.0
  28879. * @category Lang
  28880. * @param {*} value The value to check.
  28881. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28882. * @example
  28883. *
  28884. * _.isArray([1, 2, 3]);
  28885. * // => true
  28886. *
  28887. * _.isArray(document.body.children);
  28888. * // => false
  28889. *
  28890. * _.isArray('abc');
  28891. * // => false
  28892. *
  28893. * _.isArray(_.noop);
  28894. * // => false
  28895. */
  28896. var isArray = Array.isArray;
  28897. /**
  28898. * Checks if `value` is classified as an `ArrayBuffer` object.
  28899. *
  28900. * @static
  28901. * @memberOf _
  28902. * @since 4.3.0
  28903. * @category Lang
  28904. * @param {*} value The value to check.
  28905. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28906. * @example
  28907. *
  28908. * _.isArrayBuffer(new ArrayBuffer(2));
  28909. * // => true
  28910. *
  28911. * _.isArrayBuffer(new Array(2));
  28912. * // => false
  28913. */
  28914. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28915. /**
  28916. * Checks if `value` is array-like. A value is considered array-like if it's
  28917. * not a function and has a `value.length` that's an integer greater than or
  28918. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28919. *
  28920. * @static
  28921. * @memberOf _
  28922. * @since 4.0.0
  28923. * @category Lang
  28924. * @param {*} value The value to check.
  28925. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28926. * @example
  28927. *
  28928. * _.isArrayLike([1, 2, 3]);
  28929. * // => true
  28930. *
  28931. * _.isArrayLike(document.body.children);
  28932. * // => true
  28933. *
  28934. * _.isArrayLike('abc');
  28935. * // => true
  28936. *
  28937. * _.isArrayLike(_.noop);
  28938. * // => false
  28939. */
  28940. function isArrayLike(value) {
  28941. return value != null && isLength(value.length) && !isFunction(value);
  28942. }
  28943. /**
  28944. * This method is like `_.isArrayLike` except that it also checks if `value`
  28945. * is an object.
  28946. *
  28947. * @static
  28948. * @memberOf _
  28949. * @since 4.0.0
  28950. * @category Lang
  28951. * @param {*} value The value to check.
  28952. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28953. * else `false`.
  28954. * @example
  28955. *
  28956. * _.isArrayLikeObject([1, 2, 3]);
  28957. * // => true
  28958. *
  28959. * _.isArrayLikeObject(document.body.children);
  28960. * // => true
  28961. *
  28962. * _.isArrayLikeObject('abc');
  28963. * // => false
  28964. *
  28965. * _.isArrayLikeObject(_.noop);
  28966. * // => false
  28967. */
  28968. function isArrayLikeObject(value) {
  28969. return isObjectLike(value) && isArrayLike(value);
  28970. }
  28971. /**
  28972. * Checks if `value` is classified as a boolean primitive or object.
  28973. *
  28974. * @static
  28975. * @memberOf _
  28976. * @since 0.1.0
  28977. * @category Lang
  28978. * @param {*} value The value to check.
  28979. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28980. * @example
  28981. *
  28982. * _.isBoolean(false);
  28983. * // => true
  28984. *
  28985. * _.isBoolean(null);
  28986. * // => false
  28987. */
  28988. function isBoolean(value) {
  28989. return value === true || value === false ||
  28990. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28991. }
  28992. /**
  28993. * Checks if `value` is a buffer.
  28994. *
  28995. * @static
  28996. * @memberOf _
  28997. * @since 4.3.0
  28998. * @category Lang
  28999. * @param {*} value The value to check.
  29000. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29001. * @example
  29002. *
  29003. * _.isBuffer(new Buffer(2));
  29004. * // => true
  29005. *
  29006. * _.isBuffer(new Uint8Array(2));
  29007. * // => false
  29008. */
  29009. var isBuffer = nativeIsBuffer || stubFalse;
  29010. /**
  29011. * Checks if `value` is classified as a `Date` object.
  29012. *
  29013. * @static
  29014. * @memberOf _
  29015. * @since 0.1.0
  29016. * @category Lang
  29017. * @param {*} value The value to check.
  29018. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29019. * @example
  29020. *
  29021. * _.isDate(new Date);
  29022. * // => true
  29023. *
  29024. * _.isDate('Mon April 23 2012');
  29025. * // => false
  29026. */
  29027. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29028. /**
  29029. * Checks if `value` is likely a DOM element.
  29030. *
  29031. * @static
  29032. * @memberOf _
  29033. * @since 0.1.0
  29034. * @category Lang
  29035. * @param {*} value The value to check.
  29036. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29037. * @example
  29038. *
  29039. * _.isElement(document.body);
  29040. * // => true
  29041. *
  29042. * _.isElement('<body>');
  29043. * // => false
  29044. */
  29045. function isElement(value) {
  29046. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29047. }
  29048. /**
  29049. * Checks if `value` is an empty object, collection, map, or set.
  29050. *
  29051. * Objects are considered empty if they have no own enumerable string keyed
  29052. * properties.
  29053. *
  29054. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29055. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29056. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29057. *
  29058. * @static
  29059. * @memberOf _
  29060. * @since 0.1.0
  29061. * @category Lang
  29062. * @param {*} value The value to check.
  29063. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29064. * @example
  29065. *
  29066. * _.isEmpty(null);
  29067. * // => true
  29068. *
  29069. * _.isEmpty(true);
  29070. * // => true
  29071. *
  29072. * _.isEmpty(1);
  29073. * // => true
  29074. *
  29075. * _.isEmpty([1, 2, 3]);
  29076. * // => false
  29077. *
  29078. * _.isEmpty({ 'a': 1 });
  29079. * // => false
  29080. */
  29081. function isEmpty(value) {
  29082. if (value == null) {
  29083. return true;
  29084. }
  29085. if (isArrayLike(value) &&
  29086. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29087. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29088. return !value.length;
  29089. }
  29090. var tag = getTag(value);
  29091. if (tag == mapTag || tag == setTag) {
  29092. return !value.size;
  29093. }
  29094. if (isPrototype(value)) {
  29095. return !baseKeys(value).length;
  29096. }
  29097. for (var key in value) {
  29098. if (hasOwnProperty.call(value, key)) {
  29099. return false;
  29100. }
  29101. }
  29102. return true;
  29103. }
  29104. /**
  29105. * Performs a deep comparison between two values to determine if they are
  29106. * equivalent.
  29107. *
  29108. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29109. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29110. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29111. * by their own, not inherited, enumerable properties. Functions and DOM
  29112. * nodes are compared by strict equality, i.e. `===`.
  29113. *
  29114. * @static
  29115. * @memberOf _
  29116. * @since 0.1.0
  29117. * @category Lang
  29118. * @param {*} value The value to compare.
  29119. * @param {*} other The other value to compare.
  29120. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29121. * @example
  29122. *
  29123. * var object = { 'a': 1 };
  29124. * var other = { 'a': 1 };
  29125. *
  29126. * _.isEqual(object, other);
  29127. * // => true
  29128. *
  29129. * object === other;
  29130. * // => false
  29131. */
  29132. function isEqual(value, other) {
  29133. return baseIsEqual(value, other);
  29134. }
  29135. /**
  29136. * This method is like `_.isEqual` except that it accepts `customizer` which
  29137. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29138. * are handled by the method instead. The `customizer` is invoked with up to
  29139. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29140. *
  29141. * @static
  29142. * @memberOf _
  29143. * @since 4.0.0
  29144. * @category Lang
  29145. * @param {*} value The value to compare.
  29146. * @param {*} other The other value to compare.
  29147. * @param {Function} [customizer] The function to customize comparisons.
  29148. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29149. * @example
  29150. *
  29151. * function isGreeting(value) {
  29152. * return /^h(?:i|ello)$/.test(value);
  29153. * }
  29154. *
  29155. * function customizer(objValue, othValue) {
  29156. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29157. * return true;
  29158. * }
  29159. * }
  29160. *
  29161. * var array = ['hello', 'goodbye'];
  29162. * var other = ['hi', 'goodbye'];
  29163. *
  29164. * _.isEqualWith(array, other, customizer);
  29165. * // => true
  29166. */
  29167. function isEqualWith(value, other, customizer) {
  29168. customizer = typeof customizer == 'function' ? customizer : undefined;
  29169. var result = customizer ? customizer(value, other) : undefined;
  29170. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29171. }
  29172. /**
  29173. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29174. * `SyntaxError`, `TypeError`, or `URIError` object.
  29175. *
  29176. * @static
  29177. * @memberOf _
  29178. * @since 3.0.0
  29179. * @category Lang
  29180. * @param {*} value The value to check.
  29181. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29182. * @example
  29183. *
  29184. * _.isError(new Error);
  29185. * // => true
  29186. *
  29187. * _.isError(Error);
  29188. * // => false
  29189. */
  29190. function isError(value) {
  29191. if (!isObjectLike(value)) {
  29192. return false;
  29193. }
  29194. var tag = baseGetTag(value);
  29195. return tag == errorTag || tag == domExcTag ||
  29196. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29197. }
  29198. /**
  29199. * Checks if `value` is a finite primitive number.
  29200. *
  29201. * **Note:** This method is based on
  29202. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29203. *
  29204. * @static
  29205. * @memberOf _
  29206. * @since 0.1.0
  29207. * @category Lang
  29208. * @param {*} value The value to check.
  29209. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29210. * @example
  29211. *
  29212. * _.isFinite(3);
  29213. * // => true
  29214. *
  29215. * _.isFinite(Number.MIN_VALUE);
  29216. * // => true
  29217. *
  29218. * _.isFinite(Infinity);
  29219. * // => false
  29220. *
  29221. * _.isFinite('3');
  29222. * // => false
  29223. */
  29224. function isFinite(value) {
  29225. return typeof value == 'number' && nativeIsFinite(value);
  29226. }
  29227. /**
  29228. * Checks if `value` is classified as a `Function` object.
  29229. *
  29230. * @static
  29231. * @memberOf _
  29232. * @since 0.1.0
  29233. * @category Lang
  29234. * @param {*} value The value to check.
  29235. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29236. * @example
  29237. *
  29238. * _.isFunction(_);
  29239. * // => true
  29240. *
  29241. * _.isFunction(/abc/);
  29242. * // => false
  29243. */
  29244. function isFunction(value) {
  29245. if (!isObject(value)) {
  29246. return false;
  29247. }
  29248. // The use of `Object#toString` avoids issues with the `typeof` operator
  29249. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29250. var tag = baseGetTag(value);
  29251. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29252. }
  29253. /**
  29254. * Checks if `value` is an integer.
  29255. *
  29256. * **Note:** This method is based on
  29257. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29258. *
  29259. * @static
  29260. * @memberOf _
  29261. * @since 4.0.0
  29262. * @category Lang
  29263. * @param {*} value The value to check.
  29264. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29265. * @example
  29266. *
  29267. * _.isInteger(3);
  29268. * // => true
  29269. *
  29270. * _.isInteger(Number.MIN_VALUE);
  29271. * // => false
  29272. *
  29273. * _.isInteger(Infinity);
  29274. * // => false
  29275. *
  29276. * _.isInteger('3');
  29277. * // => false
  29278. */
  29279. function isInteger(value) {
  29280. return typeof value == 'number' && value == toInteger(value);
  29281. }
  29282. /**
  29283. * Checks if `value` is a valid array-like length.
  29284. *
  29285. * **Note:** This method is loosely based on
  29286. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29287. *
  29288. * @static
  29289. * @memberOf _
  29290. * @since 4.0.0
  29291. * @category Lang
  29292. * @param {*} value The value to check.
  29293. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29294. * @example
  29295. *
  29296. * _.isLength(3);
  29297. * // => true
  29298. *
  29299. * _.isLength(Number.MIN_VALUE);
  29300. * // => false
  29301. *
  29302. * _.isLength(Infinity);
  29303. * // => false
  29304. *
  29305. * _.isLength('3');
  29306. * // => false
  29307. */
  29308. function isLength(value) {
  29309. return typeof value == 'number' &&
  29310. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29311. }
  29312. /**
  29313. * Checks if `value` is the
  29314. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29315. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29316. *
  29317. * @static
  29318. * @memberOf _
  29319. * @since 0.1.0
  29320. * @category Lang
  29321. * @param {*} value The value to check.
  29322. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29323. * @example
  29324. *
  29325. * _.isObject({});
  29326. * // => true
  29327. *
  29328. * _.isObject([1, 2, 3]);
  29329. * // => true
  29330. *
  29331. * _.isObject(_.noop);
  29332. * // => true
  29333. *
  29334. * _.isObject(null);
  29335. * // => false
  29336. */
  29337. function isObject(value) {
  29338. var type = typeof value;
  29339. return value != null && (type == 'object' || type == 'function');
  29340. }
  29341. /**
  29342. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29343. * and has a `typeof` result of "object".
  29344. *
  29345. * @static
  29346. * @memberOf _
  29347. * @since 4.0.0
  29348. * @category Lang
  29349. * @param {*} value The value to check.
  29350. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29351. * @example
  29352. *
  29353. * _.isObjectLike({});
  29354. * // => true
  29355. *
  29356. * _.isObjectLike([1, 2, 3]);
  29357. * // => true
  29358. *
  29359. * _.isObjectLike(_.noop);
  29360. * // => false
  29361. *
  29362. * _.isObjectLike(null);
  29363. * // => false
  29364. */
  29365. function isObjectLike(value) {
  29366. return value != null && typeof value == 'object';
  29367. }
  29368. /**
  29369. * Checks if `value` is classified as a `Map` object.
  29370. *
  29371. * @static
  29372. * @memberOf _
  29373. * @since 4.3.0
  29374. * @category Lang
  29375. * @param {*} value The value to check.
  29376. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29377. * @example
  29378. *
  29379. * _.isMap(new Map);
  29380. * // => true
  29381. *
  29382. * _.isMap(new WeakMap);
  29383. * // => false
  29384. */
  29385. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29386. /**
  29387. * Performs a partial deep comparison between `object` and `source` to
  29388. * determine if `object` contains equivalent property values.
  29389. *
  29390. * **Note:** This method is equivalent to `_.matches` when `source` is
  29391. * partially applied.
  29392. *
  29393. * Partial comparisons will match empty array and empty object `source`
  29394. * values against any array or object value, respectively. See `_.isEqual`
  29395. * for a list of supported value comparisons.
  29396. *
  29397. * @static
  29398. * @memberOf _
  29399. * @since 3.0.0
  29400. * @category Lang
  29401. * @param {Object} object The object to inspect.
  29402. * @param {Object} source The object of property values to match.
  29403. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29404. * @example
  29405. *
  29406. * var object = { 'a': 1, 'b': 2 };
  29407. *
  29408. * _.isMatch(object, { 'b': 2 });
  29409. * // => true
  29410. *
  29411. * _.isMatch(object, { 'b': 1 });
  29412. * // => false
  29413. */
  29414. function isMatch(object, source) {
  29415. return object === source || baseIsMatch(object, source, getMatchData(source));
  29416. }
  29417. /**
  29418. * This method is like `_.isMatch` except that it accepts `customizer` which
  29419. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29420. * are handled by the method instead. The `customizer` is invoked with five
  29421. * arguments: (objValue, srcValue, index|key, object, source).
  29422. *
  29423. * @static
  29424. * @memberOf _
  29425. * @since 4.0.0
  29426. * @category Lang
  29427. * @param {Object} object The object to inspect.
  29428. * @param {Object} source The object of property values to match.
  29429. * @param {Function} [customizer] The function to customize comparisons.
  29430. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29431. * @example
  29432. *
  29433. * function isGreeting(value) {
  29434. * return /^h(?:i|ello)$/.test(value);
  29435. * }
  29436. *
  29437. * function customizer(objValue, srcValue) {
  29438. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29439. * return true;
  29440. * }
  29441. * }
  29442. *
  29443. * var object = { 'greeting': 'hello' };
  29444. * var source = { 'greeting': 'hi' };
  29445. *
  29446. * _.isMatchWith(object, source, customizer);
  29447. * // => true
  29448. */
  29449. function isMatchWith(object, source, customizer) {
  29450. customizer = typeof customizer == 'function' ? customizer : undefined;
  29451. return baseIsMatch(object, source, getMatchData(source), customizer);
  29452. }
  29453. /**
  29454. * Checks if `value` is `NaN`.
  29455. *
  29456. * **Note:** This method is based on
  29457. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29458. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29459. * `undefined` and other non-number values.
  29460. *
  29461. * @static
  29462. * @memberOf _
  29463. * @since 0.1.0
  29464. * @category Lang
  29465. * @param {*} value The value to check.
  29466. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29467. * @example
  29468. *
  29469. * _.isNaN(NaN);
  29470. * // => true
  29471. *
  29472. * _.isNaN(new Number(NaN));
  29473. * // => true
  29474. *
  29475. * isNaN(undefined);
  29476. * // => true
  29477. *
  29478. * _.isNaN(undefined);
  29479. * // => false
  29480. */
  29481. function isNaN(value) {
  29482. // An `NaN` primitive is the only value that is not equal to itself.
  29483. // Perform the `toStringTag` check first to avoid errors with some
  29484. // ActiveX objects in IE.
  29485. return isNumber(value) && value != +value;
  29486. }
  29487. /**
  29488. * Checks if `value` is a pristine native function.
  29489. *
  29490. * **Note:** This method can't reliably detect native functions in the presence
  29491. * of the core-js package because core-js circumvents this kind of detection.
  29492. * Despite multiple requests, the core-js maintainer has made it clear: any
  29493. * attempt to fix the detection will be obstructed. As a result, we're left
  29494. * with little choice but to throw an error. Unfortunately, this also affects
  29495. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29496. * which rely on core-js.
  29497. *
  29498. * @static
  29499. * @memberOf _
  29500. * @since 3.0.0
  29501. * @category Lang
  29502. * @param {*} value The value to check.
  29503. * @returns {boolean} Returns `true` if `value` is a native function,
  29504. * else `false`.
  29505. * @example
  29506. *
  29507. * _.isNative(Array.prototype.push);
  29508. * // => true
  29509. *
  29510. * _.isNative(_);
  29511. * // => false
  29512. */
  29513. function isNative(value) {
  29514. if (isMaskable(value)) {
  29515. throw new Error(CORE_ERROR_TEXT);
  29516. }
  29517. return baseIsNative(value);
  29518. }
  29519. /**
  29520. * Checks if `value` is `null`.
  29521. *
  29522. * @static
  29523. * @memberOf _
  29524. * @since 0.1.0
  29525. * @category Lang
  29526. * @param {*} value The value to check.
  29527. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29528. * @example
  29529. *
  29530. * _.isNull(null);
  29531. * // => true
  29532. *
  29533. * _.isNull(void 0);
  29534. * // => false
  29535. */
  29536. function isNull(value) {
  29537. return value === null;
  29538. }
  29539. /**
  29540. * Checks if `value` is `null` or `undefined`.
  29541. *
  29542. * @static
  29543. * @memberOf _
  29544. * @since 4.0.0
  29545. * @category Lang
  29546. * @param {*} value The value to check.
  29547. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29548. * @example
  29549. *
  29550. * _.isNil(null);
  29551. * // => true
  29552. *
  29553. * _.isNil(void 0);
  29554. * // => true
  29555. *
  29556. * _.isNil(NaN);
  29557. * // => false
  29558. */
  29559. function isNil(value) {
  29560. return value == null;
  29561. }
  29562. /**
  29563. * Checks if `value` is classified as a `Number` primitive or object.
  29564. *
  29565. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29566. * classified as numbers, use the `_.isFinite` method.
  29567. *
  29568. * @static
  29569. * @memberOf _
  29570. * @since 0.1.0
  29571. * @category Lang
  29572. * @param {*} value The value to check.
  29573. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29574. * @example
  29575. *
  29576. * _.isNumber(3);
  29577. * // => true
  29578. *
  29579. * _.isNumber(Number.MIN_VALUE);
  29580. * // => true
  29581. *
  29582. * _.isNumber(Infinity);
  29583. * // => true
  29584. *
  29585. * _.isNumber('3');
  29586. * // => false
  29587. */
  29588. function isNumber(value) {
  29589. return typeof value == 'number' ||
  29590. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29591. }
  29592. /**
  29593. * Checks if `value` is a plain object, that is, an object created by the
  29594. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29595. *
  29596. * @static
  29597. * @memberOf _
  29598. * @since 0.8.0
  29599. * @category Lang
  29600. * @param {*} value The value to check.
  29601. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29602. * @example
  29603. *
  29604. * function Foo() {
  29605. * this.a = 1;
  29606. * }
  29607. *
  29608. * _.isPlainObject(new Foo);
  29609. * // => false
  29610. *
  29611. * _.isPlainObject([1, 2, 3]);
  29612. * // => false
  29613. *
  29614. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29615. * // => true
  29616. *
  29617. * _.isPlainObject(Object.create(null));
  29618. * // => true
  29619. */
  29620. function isPlainObject(value) {
  29621. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29622. return false;
  29623. }
  29624. var proto = getPrototype(value);
  29625. if (proto === null) {
  29626. return true;
  29627. }
  29628. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29629. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29630. funcToString.call(Ctor) == objectCtorString;
  29631. }
  29632. /**
  29633. * Checks if `value` is classified as a `RegExp` object.
  29634. *
  29635. * @static
  29636. * @memberOf _
  29637. * @since 0.1.0
  29638. * @category Lang
  29639. * @param {*} value The value to check.
  29640. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29641. * @example
  29642. *
  29643. * _.isRegExp(/abc/);
  29644. * // => true
  29645. *
  29646. * _.isRegExp('/abc/');
  29647. * // => false
  29648. */
  29649. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29650. /**
  29651. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29652. * double precision number which isn't the result of a rounded unsafe integer.
  29653. *
  29654. * **Note:** This method is based on
  29655. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29656. *
  29657. * @static
  29658. * @memberOf _
  29659. * @since 4.0.0
  29660. * @category Lang
  29661. * @param {*} value The value to check.
  29662. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29663. * @example
  29664. *
  29665. * _.isSafeInteger(3);
  29666. * // => true
  29667. *
  29668. * _.isSafeInteger(Number.MIN_VALUE);
  29669. * // => false
  29670. *
  29671. * _.isSafeInteger(Infinity);
  29672. * // => false
  29673. *
  29674. * _.isSafeInteger('3');
  29675. * // => false
  29676. */
  29677. function isSafeInteger(value) {
  29678. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29679. }
  29680. /**
  29681. * Checks if `value` is classified as a `Set` object.
  29682. *
  29683. * @static
  29684. * @memberOf _
  29685. * @since 4.3.0
  29686. * @category Lang
  29687. * @param {*} value The value to check.
  29688. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29689. * @example
  29690. *
  29691. * _.isSet(new Set);
  29692. * // => true
  29693. *
  29694. * _.isSet(new WeakSet);
  29695. * // => false
  29696. */
  29697. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29698. /**
  29699. * Checks if `value` is classified as a `String` primitive or object.
  29700. *
  29701. * @static
  29702. * @since 0.1.0
  29703. * @memberOf _
  29704. * @category Lang
  29705. * @param {*} value The value to check.
  29706. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29707. * @example
  29708. *
  29709. * _.isString('abc');
  29710. * // => true
  29711. *
  29712. * _.isString(1);
  29713. * // => false
  29714. */
  29715. function isString(value) {
  29716. return typeof value == 'string' ||
  29717. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29718. }
  29719. /**
  29720. * Checks if `value` is classified as a `Symbol` primitive or object.
  29721. *
  29722. * @static
  29723. * @memberOf _
  29724. * @since 4.0.0
  29725. * @category Lang
  29726. * @param {*} value The value to check.
  29727. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29728. * @example
  29729. *
  29730. * _.isSymbol(Symbol.iterator);
  29731. * // => true
  29732. *
  29733. * _.isSymbol('abc');
  29734. * // => false
  29735. */
  29736. function isSymbol(value) {
  29737. return typeof value == 'symbol' ||
  29738. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29739. }
  29740. /**
  29741. * Checks if `value` is classified as a typed array.
  29742. *
  29743. * @static
  29744. * @memberOf _
  29745. * @since 3.0.0
  29746. * @category Lang
  29747. * @param {*} value The value to check.
  29748. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29749. * @example
  29750. *
  29751. * _.isTypedArray(new Uint8Array);
  29752. * // => true
  29753. *
  29754. * _.isTypedArray([]);
  29755. * // => false
  29756. */
  29757. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29758. /**
  29759. * Checks if `value` is `undefined`.
  29760. *
  29761. * @static
  29762. * @since 0.1.0
  29763. * @memberOf _
  29764. * @category Lang
  29765. * @param {*} value The value to check.
  29766. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29767. * @example
  29768. *
  29769. * _.isUndefined(void 0);
  29770. * // => true
  29771. *
  29772. * _.isUndefined(null);
  29773. * // => false
  29774. */
  29775. function isUndefined(value) {
  29776. return value === undefined;
  29777. }
  29778. /**
  29779. * Checks if `value` is classified as a `WeakMap` object.
  29780. *
  29781. * @static
  29782. * @memberOf _
  29783. * @since 4.3.0
  29784. * @category Lang
  29785. * @param {*} value The value to check.
  29786. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29787. * @example
  29788. *
  29789. * _.isWeakMap(new WeakMap);
  29790. * // => true
  29791. *
  29792. * _.isWeakMap(new Map);
  29793. * // => false
  29794. */
  29795. function isWeakMap(value) {
  29796. return isObjectLike(value) && getTag(value) == weakMapTag;
  29797. }
  29798. /**
  29799. * Checks if `value` is classified as a `WeakSet` object.
  29800. *
  29801. * @static
  29802. * @memberOf _
  29803. * @since 4.3.0
  29804. * @category Lang
  29805. * @param {*} value The value to check.
  29806. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29807. * @example
  29808. *
  29809. * _.isWeakSet(new WeakSet);
  29810. * // => true
  29811. *
  29812. * _.isWeakSet(new Set);
  29813. * // => false
  29814. */
  29815. function isWeakSet(value) {
  29816. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29817. }
  29818. /**
  29819. * Checks if `value` is less than `other`.
  29820. *
  29821. * @static
  29822. * @memberOf _
  29823. * @since 3.9.0
  29824. * @category Lang
  29825. * @param {*} value The value to compare.
  29826. * @param {*} other The other value to compare.
  29827. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29828. * else `false`.
  29829. * @see _.gt
  29830. * @example
  29831. *
  29832. * _.lt(1, 3);
  29833. * // => true
  29834. *
  29835. * _.lt(3, 3);
  29836. * // => false
  29837. *
  29838. * _.lt(3, 1);
  29839. * // => false
  29840. */
  29841. var lt = createRelationalOperation(baseLt);
  29842. /**
  29843. * Checks if `value` is less than or equal to `other`.
  29844. *
  29845. * @static
  29846. * @memberOf _
  29847. * @since 3.9.0
  29848. * @category Lang
  29849. * @param {*} value The value to compare.
  29850. * @param {*} other The other value to compare.
  29851. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29852. * `other`, else `false`.
  29853. * @see _.gte
  29854. * @example
  29855. *
  29856. * _.lte(1, 3);
  29857. * // => true
  29858. *
  29859. * _.lte(3, 3);
  29860. * // => true
  29861. *
  29862. * _.lte(3, 1);
  29863. * // => false
  29864. */
  29865. var lte = createRelationalOperation(function(value, other) {
  29866. return value <= other;
  29867. });
  29868. /**
  29869. * Converts `value` to an array.
  29870. *
  29871. * @static
  29872. * @since 0.1.0
  29873. * @memberOf _
  29874. * @category Lang
  29875. * @param {*} value The value to convert.
  29876. * @returns {Array} Returns the converted array.
  29877. * @example
  29878. *
  29879. * _.toArray({ 'a': 1, 'b': 2 });
  29880. * // => [1, 2]
  29881. *
  29882. * _.toArray('abc');
  29883. * // => ['a', 'b', 'c']
  29884. *
  29885. * _.toArray(1);
  29886. * // => []
  29887. *
  29888. * _.toArray(null);
  29889. * // => []
  29890. */
  29891. function toArray(value) {
  29892. if (!value) {
  29893. return [];
  29894. }
  29895. if (isArrayLike(value)) {
  29896. return isString(value) ? stringToArray(value) : copyArray(value);
  29897. }
  29898. if (symIterator && value[symIterator]) {
  29899. return iteratorToArray(value[symIterator]());
  29900. }
  29901. var tag = getTag(value),
  29902. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29903. return func(value);
  29904. }
  29905. /**
  29906. * Converts `value` to a finite number.
  29907. *
  29908. * @static
  29909. * @memberOf _
  29910. * @since 4.12.0
  29911. * @category Lang
  29912. * @param {*} value The value to convert.
  29913. * @returns {number} Returns the converted number.
  29914. * @example
  29915. *
  29916. * _.toFinite(3.2);
  29917. * // => 3.2
  29918. *
  29919. * _.toFinite(Number.MIN_VALUE);
  29920. * // => 5e-324
  29921. *
  29922. * _.toFinite(Infinity);
  29923. * // => 1.7976931348623157e+308
  29924. *
  29925. * _.toFinite('3.2');
  29926. * // => 3.2
  29927. */
  29928. function toFinite(value) {
  29929. if (!value) {
  29930. return value === 0 ? value : 0;
  29931. }
  29932. value = toNumber(value);
  29933. if (value === INFINITY || value === -INFINITY) {
  29934. var sign = (value < 0 ? -1 : 1);
  29935. return sign * MAX_INTEGER;
  29936. }
  29937. return value === value ? value : 0;
  29938. }
  29939. /**
  29940. * Converts `value` to an integer.
  29941. *
  29942. * **Note:** This method is loosely based on
  29943. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29944. *
  29945. * @static
  29946. * @memberOf _
  29947. * @since 4.0.0
  29948. * @category Lang
  29949. * @param {*} value The value to convert.
  29950. * @returns {number} Returns the converted integer.
  29951. * @example
  29952. *
  29953. * _.toInteger(3.2);
  29954. * // => 3
  29955. *
  29956. * _.toInteger(Number.MIN_VALUE);
  29957. * // => 0
  29958. *
  29959. * _.toInteger(Infinity);
  29960. * // => 1.7976931348623157e+308
  29961. *
  29962. * _.toInteger('3.2');
  29963. * // => 3
  29964. */
  29965. function toInteger(value) {
  29966. var result = toFinite(value),
  29967. remainder = result % 1;
  29968. return result === result ? (remainder ? result - remainder : result) : 0;
  29969. }
  29970. /**
  29971. * Converts `value` to an integer suitable for use as the length of an
  29972. * array-like object.
  29973. *
  29974. * **Note:** This method is based on
  29975. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29976. *
  29977. * @static
  29978. * @memberOf _
  29979. * @since 4.0.0
  29980. * @category Lang
  29981. * @param {*} value The value to convert.
  29982. * @returns {number} Returns the converted integer.
  29983. * @example
  29984. *
  29985. * _.toLength(3.2);
  29986. * // => 3
  29987. *
  29988. * _.toLength(Number.MIN_VALUE);
  29989. * // => 0
  29990. *
  29991. * _.toLength(Infinity);
  29992. * // => 4294967295
  29993. *
  29994. * _.toLength('3.2');
  29995. * // => 3
  29996. */
  29997. function toLength(value) {
  29998. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29999. }
  30000. /**
  30001. * Converts `value` to a number.
  30002. *
  30003. * @static
  30004. * @memberOf _
  30005. * @since 4.0.0
  30006. * @category Lang
  30007. * @param {*} value The value to process.
  30008. * @returns {number} Returns the number.
  30009. * @example
  30010. *
  30011. * _.toNumber(3.2);
  30012. * // => 3.2
  30013. *
  30014. * _.toNumber(Number.MIN_VALUE);
  30015. * // => 5e-324
  30016. *
  30017. * _.toNumber(Infinity);
  30018. * // => Infinity
  30019. *
  30020. * _.toNumber('3.2');
  30021. * // => 3.2
  30022. */
  30023. function toNumber(value) {
  30024. if (typeof value == 'number') {
  30025. return value;
  30026. }
  30027. if (isSymbol(value)) {
  30028. return NAN;
  30029. }
  30030. if (isObject(value)) {
  30031. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30032. value = isObject(other) ? (other + '') : other;
  30033. }
  30034. if (typeof value != 'string') {
  30035. return value === 0 ? value : +value;
  30036. }
  30037. value = value.replace(reTrim, '');
  30038. var isBinary = reIsBinary.test(value);
  30039. return (isBinary || reIsOctal.test(value))
  30040. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30041. : (reIsBadHex.test(value) ? NAN : +value);
  30042. }
  30043. /**
  30044. * Converts `value` to a plain object flattening inherited enumerable string
  30045. * keyed properties of `value` to own properties of the plain object.
  30046. *
  30047. * @static
  30048. * @memberOf _
  30049. * @since 3.0.0
  30050. * @category Lang
  30051. * @param {*} value The value to convert.
  30052. * @returns {Object} Returns the converted plain object.
  30053. * @example
  30054. *
  30055. * function Foo() {
  30056. * this.b = 2;
  30057. * }
  30058. *
  30059. * Foo.prototype.c = 3;
  30060. *
  30061. * _.assign({ 'a': 1 }, new Foo);
  30062. * // => { 'a': 1, 'b': 2 }
  30063. *
  30064. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30065. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30066. */
  30067. function toPlainObject(value) {
  30068. return copyObject(value, keysIn(value));
  30069. }
  30070. /**
  30071. * Converts `value` to a safe integer. A safe integer can be compared and
  30072. * represented correctly.
  30073. *
  30074. * @static
  30075. * @memberOf _
  30076. * @since 4.0.0
  30077. * @category Lang
  30078. * @param {*} value The value to convert.
  30079. * @returns {number} Returns the converted integer.
  30080. * @example
  30081. *
  30082. * _.toSafeInteger(3.2);
  30083. * // => 3
  30084. *
  30085. * _.toSafeInteger(Number.MIN_VALUE);
  30086. * // => 0
  30087. *
  30088. * _.toSafeInteger(Infinity);
  30089. * // => 9007199254740991
  30090. *
  30091. * _.toSafeInteger('3.2');
  30092. * // => 3
  30093. */
  30094. function toSafeInteger(value) {
  30095. return value
  30096. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30097. : (value === 0 ? value : 0);
  30098. }
  30099. /**
  30100. * Converts `value` to a string. An empty string is returned for `null`
  30101. * and `undefined` values. The sign of `-0` is preserved.
  30102. *
  30103. * @static
  30104. * @memberOf _
  30105. * @since 4.0.0
  30106. * @category Lang
  30107. * @param {*} value The value to convert.
  30108. * @returns {string} Returns the converted string.
  30109. * @example
  30110. *
  30111. * _.toString(null);
  30112. * // => ''
  30113. *
  30114. * _.toString(-0);
  30115. * // => '-0'
  30116. *
  30117. * _.toString([1, 2, 3]);
  30118. * // => '1,2,3'
  30119. */
  30120. function toString(value) {
  30121. return value == null ? '' : baseToString(value);
  30122. }
  30123. /*------------------------------------------------------------------------*/
  30124. /**
  30125. * Assigns own enumerable string keyed properties of source objects to the
  30126. * destination object. Source objects are applied from left to right.
  30127. * Subsequent sources overwrite property assignments of previous sources.
  30128. *
  30129. * **Note:** This method mutates `object` and is loosely based on
  30130. * [`Object.assign`](https://mdn.io/Object/assign).
  30131. *
  30132. * @static
  30133. * @memberOf _
  30134. * @since 0.10.0
  30135. * @category Object
  30136. * @param {Object} object The destination object.
  30137. * @param {...Object} [sources] The source objects.
  30138. * @returns {Object} Returns `object`.
  30139. * @see _.assignIn
  30140. * @example
  30141. *
  30142. * function Foo() {
  30143. * this.a = 1;
  30144. * }
  30145. *
  30146. * function Bar() {
  30147. * this.c = 3;
  30148. * }
  30149. *
  30150. * Foo.prototype.b = 2;
  30151. * Bar.prototype.d = 4;
  30152. *
  30153. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30154. * // => { 'a': 1, 'c': 3 }
  30155. */
  30156. var assign = createAssigner(function(object, source) {
  30157. if (isPrototype(source) || isArrayLike(source)) {
  30158. copyObject(source, keys(source), object);
  30159. return;
  30160. }
  30161. for (var key in source) {
  30162. if (hasOwnProperty.call(source, key)) {
  30163. assignValue(object, key, source[key]);
  30164. }
  30165. }
  30166. });
  30167. /**
  30168. * This method is like `_.assign` except that it iterates over own and
  30169. * inherited source properties.
  30170. *
  30171. * **Note:** This method mutates `object`.
  30172. *
  30173. * @static
  30174. * @memberOf _
  30175. * @since 4.0.0
  30176. * @alias extend
  30177. * @category Object
  30178. * @param {Object} object The destination object.
  30179. * @param {...Object} [sources] The source objects.
  30180. * @returns {Object} Returns `object`.
  30181. * @see _.assign
  30182. * @example
  30183. *
  30184. * function Foo() {
  30185. * this.a = 1;
  30186. * }
  30187. *
  30188. * function Bar() {
  30189. * this.c = 3;
  30190. * }
  30191. *
  30192. * Foo.prototype.b = 2;
  30193. * Bar.prototype.d = 4;
  30194. *
  30195. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30196. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30197. */
  30198. var assignIn = createAssigner(function(object, source) {
  30199. copyObject(source, keysIn(source), object);
  30200. });
  30201. /**
  30202. * This method is like `_.assignIn` except that it accepts `customizer`
  30203. * which is invoked to produce the assigned values. If `customizer` returns
  30204. * `undefined`, assignment is handled by the method instead. The `customizer`
  30205. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30206. *
  30207. * **Note:** This method mutates `object`.
  30208. *
  30209. * @static
  30210. * @memberOf _
  30211. * @since 4.0.0
  30212. * @alias extendWith
  30213. * @category Object
  30214. * @param {Object} object The destination object.
  30215. * @param {...Object} sources The source objects.
  30216. * @param {Function} [customizer] The function to customize assigned values.
  30217. * @returns {Object} Returns `object`.
  30218. * @see _.assignWith
  30219. * @example
  30220. *
  30221. * function customizer(objValue, srcValue) {
  30222. * return _.isUndefined(objValue) ? srcValue : objValue;
  30223. * }
  30224. *
  30225. * var defaults = _.partialRight(_.assignInWith, customizer);
  30226. *
  30227. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30228. * // => { 'a': 1, 'b': 2 }
  30229. */
  30230. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30231. copyObject(source, keysIn(source), object, customizer);
  30232. });
  30233. /**
  30234. * This method is like `_.assign` except that it accepts `customizer`
  30235. * which is invoked to produce the assigned values. If `customizer` returns
  30236. * `undefined`, assignment is handled by the method instead. The `customizer`
  30237. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30238. *
  30239. * **Note:** This method mutates `object`.
  30240. *
  30241. * @static
  30242. * @memberOf _
  30243. * @since 4.0.0
  30244. * @category Object
  30245. * @param {Object} object The destination object.
  30246. * @param {...Object} sources The source objects.
  30247. * @param {Function} [customizer] The function to customize assigned values.
  30248. * @returns {Object} Returns `object`.
  30249. * @see _.assignInWith
  30250. * @example
  30251. *
  30252. * function customizer(objValue, srcValue) {
  30253. * return _.isUndefined(objValue) ? srcValue : objValue;
  30254. * }
  30255. *
  30256. * var defaults = _.partialRight(_.assignWith, customizer);
  30257. *
  30258. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30259. * // => { 'a': 1, 'b': 2 }
  30260. */
  30261. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30262. copyObject(source, keys(source), object, customizer);
  30263. });
  30264. /**
  30265. * Creates an array of values corresponding to `paths` of `object`.
  30266. *
  30267. * @static
  30268. * @memberOf _
  30269. * @since 1.0.0
  30270. * @category Object
  30271. * @param {Object} object The object to iterate over.
  30272. * @param {...(string|string[])} [paths] The property paths to pick.
  30273. * @returns {Array} Returns the picked values.
  30274. * @example
  30275. *
  30276. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30277. *
  30278. * _.at(object, ['a[0].b.c', 'a[1]']);
  30279. * // => [3, 4]
  30280. */
  30281. var at = flatRest(baseAt);
  30282. /**
  30283. * Creates an object that inherits from the `prototype` object. If a
  30284. * `properties` object is given, its own enumerable string keyed properties
  30285. * are assigned to the created object.
  30286. *
  30287. * @static
  30288. * @memberOf _
  30289. * @since 2.3.0
  30290. * @category Object
  30291. * @param {Object} prototype The object to inherit from.
  30292. * @param {Object} [properties] The properties to assign to the object.
  30293. * @returns {Object} Returns the new object.
  30294. * @example
  30295. *
  30296. * function Shape() {
  30297. * this.x = 0;
  30298. * this.y = 0;
  30299. * }
  30300. *
  30301. * function Circle() {
  30302. * Shape.call(this);
  30303. * }
  30304. *
  30305. * Circle.prototype = _.create(Shape.prototype, {
  30306. * 'constructor': Circle
  30307. * });
  30308. *
  30309. * var circle = new Circle;
  30310. * circle instanceof Circle;
  30311. * // => true
  30312. *
  30313. * circle instanceof Shape;
  30314. * // => true
  30315. */
  30316. function create(prototype, properties) {
  30317. var result = baseCreate(prototype);
  30318. return properties == null ? result : baseAssign(result, properties);
  30319. }
  30320. /**
  30321. * Assigns own and inherited enumerable string keyed properties of source
  30322. * objects to the destination object for all destination properties that
  30323. * resolve to `undefined`. Source objects are applied from left to right.
  30324. * Once a property is set, additional values of the same property are ignored.
  30325. *
  30326. * **Note:** This method mutates `object`.
  30327. *
  30328. * @static
  30329. * @since 0.1.0
  30330. * @memberOf _
  30331. * @category Object
  30332. * @param {Object} object The destination object.
  30333. * @param {...Object} [sources] The source objects.
  30334. * @returns {Object} Returns `object`.
  30335. * @see _.defaultsDeep
  30336. * @example
  30337. *
  30338. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30339. * // => { 'a': 1, 'b': 2 }
  30340. */
  30341. var defaults = baseRest(function(object, sources) {
  30342. object = Object(object);
  30343. var index = -1;
  30344. var length = sources.length;
  30345. var guard = length > 2 ? sources[2] : undefined;
  30346. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30347. length = 1;
  30348. }
  30349. while (++index < length) {
  30350. var source = sources[index];
  30351. var props = keysIn(source);
  30352. var propsIndex = -1;
  30353. var propsLength = props.length;
  30354. while (++propsIndex < propsLength) {
  30355. var key = props[propsIndex];
  30356. var value = object[key];
  30357. if (value === undefined ||
  30358. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30359. object[key] = source[key];
  30360. }
  30361. }
  30362. }
  30363. return object;
  30364. });
  30365. /**
  30366. * This method is like `_.defaults` except that it recursively assigns
  30367. * default properties.
  30368. *
  30369. * **Note:** This method mutates `object`.
  30370. *
  30371. * @static
  30372. * @memberOf _
  30373. * @since 3.10.0
  30374. * @category Object
  30375. * @param {Object} object The destination object.
  30376. * @param {...Object} [sources] The source objects.
  30377. * @returns {Object} Returns `object`.
  30378. * @see _.defaults
  30379. * @example
  30380. *
  30381. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30382. * // => { 'a': { 'b': 2, 'c': 3 } }
  30383. */
  30384. var defaultsDeep = baseRest(function(args) {
  30385. args.push(undefined, customDefaultsMerge);
  30386. return apply(mergeWith, undefined, args);
  30387. });
  30388. /**
  30389. * This method is like `_.find` except that it returns the key of the first
  30390. * element `predicate` returns truthy for instead of the element itself.
  30391. *
  30392. * @static
  30393. * @memberOf _
  30394. * @since 1.1.0
  30395. * @category Object
  30396. * @param {Object} object The object to inspect.
  30397. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30398. * @returns {string|undefined} Returns the key of the matched element,
  30399. * else `undefined`.
  30400. * @example
  30401. *
  30402. * var users = {
  30403. * 'barney': { 'age': 36, 'active': true },
  30404. * 'fred': { 'age': 40, 'active': false },
  30405. * 'pebbles': { 'age': 1, 'active': true }
  30406. * };
  30407. *
  30408. * _.findKey(users, function(o) { return o.age < 40; });
  30409. * // => 'barney' (iteration order is not guaranteed)
  30410. *
  30411. * // The `_.matches` iteratee shorthand.
  30412. * _.findKey(users, { 'age': 1, 'active': true });
  30413. * // => 'pebbles'
  30414. *
  30415. * // The `_.matchesProperty` iteratee shorthand.
  30416. * _.findKey(users, ['active', false]);
  30417. * // => 'fred'
  30418. *
  30419. * // The `_.property` iteratee shorthand.
  30420. * _.findKey(users, 'active');
  30421. * // => 'barney'
  30422. */
  30423. function findKey(object, predicate) {
  30424. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30425. }
  30426. /**
  30427. * This method is like `_.findKey` except that it iterates over elements of
  30428. * a collection in the opposite order.
  30429. *
  30430. * @static
  30431. * @memberOf _
  30432. * @since 2.0.0
  30433. * @category Object
  30434. * @param {Object} object The object to inspect.
  30435. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30436. * @returns {string|undefined} Returns the key of the matched element,
  30437. * else `undefined`.
  30438. * @example
  30439. *
  30440. * var users = {
  30441. * 'barney': { 'age': 36, 'active': true },
  30442. * 'fred': { 'age': 40, 'active': false },
  30443. * 'pebbles': { 'age': 1, 'active': true }
  30444. * };
  30445. *
  30446. * _.findLastKey(users, function(o) { return o.age < 40; });
  30447. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30448. *
  30449. * // The `_.matches` iteratee shorthand.
  30450. * _.findLastKey(users, { 'age': 36, 'active': true });
  30451. * // => 'barney'
  30452. *
  30453. * // The `_.matchesProperty` iteratee shorthand.
  30454. * _.findLastKey(users, ['active', false]);
  30455. * // => 'fred'
  30456. *
  30457. * // The `_.property` iteratee shorthand.
  30458. * _.findLastKey(users, 'active');
  30459. * // => 'pebbles'
  30460. */
  30461. function findLastKey(object, predicate) {
  30462. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30463. }
  30464. /**
  30465. * Iterates over own and inherited enumerable string keyed properties of an
  30466. * object and invokes `iteratee` for each property. The iteratee is invoked
  30467. * with three arguments: (value, key, object). Iteratee functions may exit
  30468. * iteration early by explicitly returning `false`.
  30469. *
  30470. * @static
  30471. * @memberOf _
  30472. * @since 0.3.0
  30473. * @category Object
  30474. * @param {Object} object The object to iterate over.
  30475. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30476. * @returns {Object} Returns `object`.
  30477. * @see _.forInRight
  30478. * @example
  30479. *
  30480. * function Foo() {
  30481. * this.a = 1;
  30482. * this.b = 2;
  30483. * }
  30484. *
  30485. * Foo.prototype.c = 3;
  30486. *
  30487. * _.forIn(new Foo, function(value, key) {
  30488. * console.log(key);
  30489. * });
  30490. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30491. */
  30492. function forIn(object, iteratee) {
  30493. return object == null
  30494. ? object
  30495. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30496. }
  30497. /**
  30498. * This method is like `_.forIn` except that it iterates over properties of
  30499. * `object` in the opposite order.
  30500. *
  30501. * @static
  30502. * @memberOf _
  30503. * @since 2.0.0
  30504. * @category Object
  30505. * @param {Object} object The object to iterate over.
  30506. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30507. * @returns {Object} Returns `object`.
  30508. * @see _.forIn
  30509. * @example
  30510. *
  30511. * function Foo() {
  30512. * this.a = 1;
  30513. * this.b = 2;
  30514. * }
  30515. *
  30516. * Foo.prototype.c = 3;
  30517. *
  30518. * _.forInRight(new Foo, function(value, key) {
  30519. * console.log(key);
  30520. * });
  30521. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30522. */
  30523. function forInRight(object, iteratee) {
  30524. return object == null
  30525. ? object
  30526. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30527. }
  30528. /**
  30529. * Iterates over own enumerable string keyed properties of an object and
  30530. * invokes `iteratee` for each property. The iteratee is invoked with three
  30531. * arguments: (value, key, object). Iteratee functions may exit iteration
  30532. * early by explicitly returning `false`.
  30533. *
  30534. * @static
  30535. * @memberOf _
  30536. * @since 0.3.0
  30537. * @category Object
  30538. * @param {Object} object The object to iterate over.
  30539. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30540. * @returns {Object} Returns `object`.
  30541. * @see _.forOwnRight
  30542. * @example
  30543. *
  30544. * function Foo() {
  30545. * this.a = 1;
  30546. * this.b = 2;
  30547. * }
  30548. *
  30549. * Foo.prototype.c = 3;
  30550. *
  30551. * _.forOwn(new Foo, function(value, key) {
  30552. * console.log(key);
  30553. * });
  30554. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30555. */
  30556. function forOwn(object, iteratee) {
  30557. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30558. }
  30559. /**
  30560. * This method is like `_.forOwn` except that it iterates over properties of
  30561. * `object` in the opposite order.
  30562. *
  30563. * @static
  30564. * @memberOf _
  30565. * @since 2.0.0
  30566. * @category Object
  30567. * @param {Object} object The object to iterate over.
  30568. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30569. * @returns {Object} Returns `object`.
  30570. * @see _.forOwn
  30571. * @example
  30572. *
  30573. * function Foo() {
  30574. * this.a = 1;
  30575. * this.b = 2;
  30576. * }
  30577. *
  30578. * Foo.prototype.c = 3;
  30579. *
  30580. * _.forOwnRight(new Foo, function(value, key) {
  30581. * console.log(key);
  30582. * });
  30583. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30584. */
  30585. function forOwnRight(object, iteratee) {
  30586. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30587. }
  30588. /**
  30589. * Creates an array of function property names from own enumerable properties
  30590. * of `object`.
  30591. *
  30592. * @static
  30593. * @since 0.1.0
  30594. * @memberOf _
  30595. * @category Object
  30596. * @param {Object} object The object to inspect.
  30597. * @returns {Array} Returns the function names.
  30598. * @see _.functionsIn
  30599. * @example
  30600. *
  30601. * function Foo() {
  30602. * this.a = _.constant('a');
  30603. * this.b = _.constant('b');
  30604. * }
  30605. *
  30606. * Foo.prototype.c = _.constant('c');
  30607. *
  30608. * _.functions(new Foo);
  30609. * // => ['a', 'b']
  30610. */
  30611. function functions(object) {
  30612. return object == null ? [] : baseFunctions(object, keys(object));
  30613. }
  30614. /**
  30615. * Creates an array of function property names from own and inherited
  30616. * enumerable properties of `object`.
  30617. *
  30618. * @static
  30619. * @memberOf _
  30620. * @since 4.0.0
  30621. * @category Object
  30622. * @param {Object} object The object to inspect.
  30623. * @returns {Array} Returns the function names.
  30624. * @see _.functions
  30625. * @example
  30626. *
  30627. * function Foo() {
  30628. * this.a = _.constant('a');
  30629. * this.b = _.constant('b');
  30630. * }
  30631. *
  30632. * Foo.prototype.c = _.constant('c');
  30633. *
  30634. * _.functionsIn(new Foo);
  30635. * // => ['a', 'b', 'c']
  30636. */
  30637. function functionsIn(object) {
  30638. return object == null ? [] : baseFunctions(object, keysIn(object));
  30639. }
  30640. /**
  30641. * Gets the value at `path` of `object`. If the resolved value is
  30642. * `undefined`, the `defaultValue` is returned in its place.
  30643. *
  30644. * @static
  30645. * @memberOf _
  30646. * @since 3.7.0
  30647. * @category Object
  30648. * @param {Object} object The object to query.
  30649. * @param {Array|string} path The path of the property to get.
  30650. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30651. * @returns {*} Returns the resolved value.
  30652. * @example
  30653. *
  30654. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30655. *
  30656. * _.get(object, 'a[0].b.c');
  30657. * // => 3
  30658. *
  30659. * _.get(object, ['a', '0', 'b', 'c']);
  30660. * // => 3
  30661. *
  30662. * _.get(object, 'a.b.c', 'default');
  30663. * // => 'default'
  30664. */
  30665. function get(object, path, defaultValue) {
  30666. var result = object == null ? undefined : baseGet(object, path);
  30667. return result === undefined ? defaultValue : result;
  30668. }
  30669. /**
  30670. * Checks if `path` is a direct property of `object`.
  30671. *
  30672. * @static
  30673. * @since 0.1.0
  30674. * @memberOf _
  30675. * @category Object
  30676. * @param {Object} object The object to query.
  30677. * @param {Array|string} path The path to check.
  30678. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30679. * @example
  30680. *
  30681. * var object = { 'a': { 'b': 2 } };
  30682. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30683. *
  30684. * _.has(object, 'a');
  30685. * // => true
  30686. *
  30687. * _.has(object, 'a.b');
  30688. * // => true
  30689. *
  30690. * _.has(object, ['a', 'b']);
  30691. * // => true
  30692. *
  30693. * _.has(other, 'a');
  30694. * // => false
  30695. */
  30696. function has(object, path) {
  30697. return object != null && hasPath(object, path, baseHas);
  30698. }
  30699. /**
  30700. * Checks if `path` is a direct or inherited property of `object`.
  30701. *
  30702. * @static
  30703. * @memberOf _
  30704. * @since 4.0.0
  30705. * @category Object
  30706. * @param {Object} object The object to query.
  30707. * @param {Array|string} path The path to check.
  30708. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30709. * @example
  30710. *
  30711. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30712. *
  30713. * _.hasIn(object, 'a');
  30714. * // => true
  30715. *
  30716. * _.hasIn(object, 'a.b');
  30717. * // => true
  30718. *
  30719. * _.hasIn(object, ['a', 'b']);
  30720. * // => true
  30721. *
  30722. * _.hasIn(object, 'b');
  30723. * // => false
  30724. */
  30725. function hasIn(object, path) {
  30726. return object != null && hasPath(object, path, baseHasIn);
  30727. }
  30728. /**
  30729. * Creates an object composed of the inverted keys and values of `object`.
  30730. * If `object` contains duplicate values, subsequent values overwrite
  30731. * property assignments of previous values.
  30732. *
  30733. * @static
  30734. * @memberOf _
  30735. * @since 0.7.0
  30736. * @category Object
  30737. * @param {Object} object The object to invert.
  30738. * @returns {Object} Returns the new inverted object.
  30739. * @example
  30740. *
  30741. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30742. *
  30743. * _.invert(object);
  30744. * // => { '1': 'c', '2': 'b' }
  30745. */
  30746. var invert = createInverter(function(result, value, key) {
  30747. if (value != null &&
  30748. typeof value.toString != 'function') {
  30749. value = nativeObjectToString.call(value);
  30750. }
  30751. result[value] = key;
  30752. }, constant(identity));
  30753. /**
  30754. * This method is like `_.invert` except that the inverted object is generated
  30755. * from the results of running each element of `object` thru `iteratee`. The
  30756. * corresponding inverted value of each inverted key is an array of keys
  30757. * responsible for generating the inverted value. The iteratee is invoked
  30758. * with one argument: (value).
  30759. *
  30760. * @static
  30761. * @memberOf _
  30762. * @since 4.1.0
  30763. * @category Object
  30764. * @param {Object} object The object to invert.
  30765. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30766. * @returns {Object} Returns the new inverted object.
  30767. * @example
  30768. *
  30769. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30770. *
  30771. * _.invertBy(object);
  30772. * // => { '1': ['a', 'c'], '2': ['b'] }
  30773. *
  30774. * _.invertBy(object, function(value) {
  30775. * return 'group' + value;
  30776. * });
  30777. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30778. */
  30779. var invertBy = createInverter(function(result, value, key) {
  30780. if (value != null &&
  30781. typeof value.toString != 'function') {
  30782. value = nativeObjectToString.call(value);
  30783. }
  30784. if (hasOwnProperty.call(result, value)) {
  30785. result[value].push(key);
  30786. } else {
  30787. result[value] = [key];
  30788. }
  30789. }, getIteratee);
  30790. /**
  30791. * Invokes the method at `path` of `object`.
  30792. *
  30793. * @static
  30794. * @memberOf _
  30795. * @since 4.0.0
  30796. * @category Object
  30797. * @param {Object} object The object to query.
  30798. * @param {Array|string} path The path of the method to invoke.
  30799. * @param {...*} [args] The arguments to invoke the method with.
  30800. * @returns {*} Returns the result of the invoked method.
  30801. * @example
  30802. *
  30803. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30804. *
  30805. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30806. * // => [2, 3]
  30807. */
  30808. var invoke = baseRest(baseInvoke);
  30809. /**
  30810. * Creates an array of the own enumerable property names of `object`.
  30811. *
  30812. * **Note:** Non-object values are coerced to objects. See the
  30813. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30814. * for more details.
  30815. *
  30816. * @static
  30817. * @since 0.1.0
  30818. * @memberOf _
  30819. * @category Object
  30820. * @param {Object} object The object to query.
  30821. * @returns {Array} Returns the array of property names.
  30822. * @example
  30823. *
  30824. * function Foo() {
  30825. * this.a = 1;
  30826. * this.b = 2;
  30827. * }
  30828. *
  30829. * Foo.prototype.c = 3;
  30830. *
  30831. * _.keys(new Foo);
  30832. * // => ['a', 'b'] (iteration order is not guaranteed)
  30833. *
  30834. * _.keys('hi');
  30835. * // => ['0', '1']
  30836. */
  30837. function keys(object) {
  30838. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30839. }
  30840. /**
  30841. * Creates an array of the own and inherited enumerable property names of `object`.
  30842. *
  30843. * **Note:** Non-object values are coerced to objects.
  30844. *
  30845. * @static
  30846. * @memberOf _
  30847. * @since 3.0.0
  30848. * @category Object
  30849. * @param {Object} object The object to query.
  30850. * @returns {Array} Returns the array of property names.
  30851. * @example
  30852. *
  30853. * function Foo() {
  30854. * this.a = 1;
  30855. * this.b = 2;
  30856. * }
  30857. *
  30858. * Foo.prototype.c = 3;
  30859. *
  30860. * _.keysIn(new Foo);
  30861. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30862. */
  30863. function keysIn(object) {
  30864. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30865. }
  30866. /**
  30867. * The opposite of `_.mapValues`; this method creates an object with the
  30868. * same values as `object` and keys generated by running each own enumerable
  30869. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30870. * with three arguments: (value, key, object).
  30871. *
  30872. * @static
  30873. * @memberOf _
  30874. * @since 3.8.0
  30875. * @category Object
  30876. * @param {Object} object The object to iterate over.
  30877. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30878. * @returns {Object} Returns the new mapped object.
  30879. * @see _.mapValues
  30880. * @example
  30881. *
  30882. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30883. * return key + value;
  30884. * });
  30885. * // => { 'a1': 1, 'b2': 2 }
  30886. */
  30887. function mapKeys(object, iteratee) {
  30888. var result = {};
  30889. iteratee = getIteratee(iteratee, 3);
  30890. baseForOwn(object, function(value, key, object) {
  30891. baseAssignValue(result, iteratee(value, key, object), value);
  30892. });
  30893. return result;
  30894. }
  30895. /**
  30896. * Creates an object with the same keys as `object` and values generated
  30897. * by running each own enumerable string keyed property of `object` thru
  30898. * `iteratee`. The iteratee is invoked with three arguments:
  30899. * (value, key, object).
  30900. *
  30901. * @static
  30902. * @memberOf _
  30903. * @since 2.4.0
  30904. * @category Object
  30905. * @param {Object} object The object to iterate over.
  30906. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30907. * @returns {Object} Returns the new mapped object.
  30908. * @see _.mapKeys
  30909. * @example
  30910. *
  30911. * var users = {
  30912. * 'fred': { 'user': 'fred', 'age': 40 },
  30913. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30914. * };
  30915. *
  30916. * _.mapValues(users, function(o) { return o.age; });
  30917. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30918. *
  30919. * // The `_.property` iteratee shorthand.
  30920. * _.mapValues(users, 'age');
  30921. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30922. */
  30923. function mapValues(object, iteratee) {
  30924. var result = {};
  30925. iteratee = getIteratee(iteratee, 3);
  30926. baseForOwn(object, function(value, key, object) {
  30927. baseAssignValue(result, key, iteratee(value, key, object));
  30928. });
  30929. return result;
  30930. }
  30931. /**
  30932. * This method is like `_.assign` except that it recursively merges own and
  30933. * inherited enumerable string keyed properties of source objects into the
  30934. * destination object. Source properties that resolve to `undefined` are
  30935. * skipped if a destination value exists. Array and plain object properties
  30936. * are merged recursively. Other objects and value types are overridden by
  30937. * assignment. Source objects are applied from left to right. Subsequent
  30938. * sources overwrite property assignments of previous sources.
  30939. *
  30940. * **Note:** This method mutates `object`.
  30941. *
  30942. * @static
  30943. * @memberOf _
  30944. * @since 0.5.0
  30945. * @category Object
  30946. * @param {Object} object The destination object.
  30947. * @param {...Object} [sources] The source objects.
  30948. * @returns {Object} Returns `object`.
  30949. * @example
  30950. *
  30951. * var object = {
  30952. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30953. * };
  30954. *
  30955. * var other = {
  30956. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30957. * };
  30958. *
  30959. * _.merge(object, other);
  30960. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30961. */
  30962. var merge = createAssigner(function(object, source, srcIndex) {
  30963. baseMerge(object, source, srcIndex);
  30964. });
  30965. /**
  30966. * This method is like `_.merge` except that it accepts `customizer` which
  30967. * is invoked to produce the merged values of the destination and source
  30968. * properties. If `customizer` returns `undefined`, merging is handled by the
  30969. * method instead. The `customizer` is invoked with six arguments:
  30970. * (objValue, srcValue, key, object, source, stack).
  30971. *
  30972. * **Note:** This method mutates `object`.
  30973. *
  30974. * @static
  30975. * @memberOf _
  30976. * @since 4.0.0
  30977. * @category Object
  30978. * @param {Object} object The destination object.
  30979. * @param {...Object} sources The source objects.
  30980. * @param {Function} customizer The function to customize assigned values.
  30981. * @returns {Object} Returns `object`.
  30982. * @example
  30983. *
  30984. * function customizer(objValue, srcValue) {
  30985. * if (_.isArray(objValue)) {
  30986. * return objValue.concat(srcValue);
  30987. * }
  30988. * }
  30989. *
  30990. * var object = { 'a': [1], 'b': [2] };
  30991. * var other = { 'a': [3], 'b': [4] };
  30992. *
  30993. * _.mergeWith(object, other, customizer);
  30994. * // => { 'a': [1, 3], 'b': [2, 4] }
  30995. */
  30996. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30997. baseMerge(object, source, srcIndex, customizer);
  30998. });
  30999. /**
  31000. * The opposite of `_.pick`; this method creates an object composed of the
  31001. * own and inherited enumerable property paths of `object` that are not omitted.
  31002. *
  31003. * **Note:** This method is considerably slower than `_.pick`.
  31004. *
  31005. * @static
  31006. * @since 0.1.0
  31007. * @memberOf _
  31008. * @category Object
  31009. * @param {Object} object The source object.
  31010. * @param {...(string|string[])} [paths] The property paths to omit.
  31011. * @returns {Object} Returns the new object.
  31012. * @example
  31013. *
  31014. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31015. *
  31016. * _.omit(object, ['a', 'c']);
  31017. * // => { 'b': '2' }
  31018. */
  31019. var omit = flatRest(function(object, paths) {
  31020. var result = {};
  31021. if (object == null) {
  31022. return result;
  31023. }
  31024. var isDeep = false;
  31025. paths = arrayMap(paths, function(path) {
  31026. path = castPath(path, object);
  31027. isDeep || (isDeep = path.length > 1);
  31028. return path;
  31029. });
  31030. copyObject(object, getAllKeysIn(object), result);
  31031. if (isDeep) {
  31032. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31033. }
  31034. var length = paths.length;
  31035. while (length--) {
  31036. baseUnset(result, paths[length]);
  31037. }
  31038. return result;
  31039. });
  31040. /**
  31041. * The opposite of `_.pickBy`; this method creates an object composed of
  31042. * the own and inherited enumerable string keyed properties of `object` that
  31043. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31044. * arguments: (value, key).
  31045. *
  31046. * @static
  31047. * @memberOf _
  31048. * @since 4.0.0
  31049. * @category Object
  31050. * @param {Object} object The source object.
  31051. * @param {Function} [predicate=_.identity] The function invoked per property.
  31052. * @returns {Object} Returns the new object.
  31053. * @example
  31054. *
  31055. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31056. *
  31057. * _.omitBy(object, _.isNumber);
  31058. * // => { 'b': '2' }
  31059. */
  31060. function omitBy(object, predicate) {
  31061. return pickBy(object, negate(getIteratee(predicate)));
  31062. }
  31063. /**
  31064. * Creates an object composed of the picked `object` properties.
  31065. *
  31066. * @static
  31067. * @since 0.1.0
  31068. * @memberOf _
  31069. * @category Object
  31070. * @param {Object} object The source object.
  31071. * @param {...(string|string[])} [paths] The property paths to pick.
  31072. * @returns {Object} Returns the new object.
  31073. * @example
  31074. *
  31075. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31076. *
  31077. * _.pick(object, ['a', 'c']);
  31078. * // => { 'a': 1, 'c': 3 }
  31079. */
  31080. var pick = flatRest(function(object, paths) {
  31081. return object == null ? {} : basePick(object, paths);
  31082. });
  31083. /**
  31084. * Creates an object composed of the `object` properties `predicate` returns
  31085. * truthy for. The predicate is invoked with two arguments: (value, key).
  31086. *
  31087. * @static
  31088. * @memberOf _
  31089. * @since 4.0.0
  31090. * @category Object
  31091. * @param {Object} object The source object.
  31092. * @param {Function} [predicate=_.identity] The function invoked per property.
  31093. * @returns {Object} Returns the new object.
  31094. * @example
  31095. *
  31096. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31097. *
  31098. * _.pickBy(object, _.isNumber);
  31099. * // => { 'a': 1, 'c': 3 }
  31100. */
  31101. function pickBy(object, predicate) {
  31102. if (object == null) {
  31103. return {};
  31104. }
  31105. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31106. return [prop];
  31107. });
  31108. predicate = getIteratee(predicate);
  31109. return basePickBy(object, props, function(value, path) {
  31110. return predicate(value, path[0]);
  31111. });
  31112. }
  31113. /**
  31114. * This method is like `_.get` except that if the resolved value is a
  31115. * function it's invoked with the `this` binding of its parent object and
  31116. * its result is returned.
  31117. *
  31118. * @static
  31119. * @since 0.1.0
  31120. * @memberOf _
  31121. * @category Object
  31122. * @param {Object} object The object to query.
  31123. * @param {Array|string} path The path of the property to resolve.
  31124. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31125. * @returns {*} Returns the resolved value.
  31126. * @example
  31127. *
  31128. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31129. *
  31130. * _.result(object, 'a[0].b.c1');
  31131. * // => 3
  31132. *
  31133. * _.result(object, 'a[0].b.c2');
  31134. * // => 4
  31135. *
  31136. * _.result(object, 'a[0].b.c3', 'default');
  31137. * // => 'default'
  31138. *
  31139. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31140. * // => 'default'
  31141. */
  31142. function result(object, path, defaultValue) {
  31143. path = castPath(path, object);
  31144. var index = -1,
  31145. length = path.length;
  31146. // Ensure the loop is entered when path is empty.
  31147. if (!length) {
  31148. length = 1;
  31149. object = undefined;
  31150. }
  31151. while (++index < length) {
  31152. var value = object == null ? undefined : object[toKey(path[index])];
  31153. if (value === undefined) {
  31154. index = length;
  31155. value = defaultValue;
  31156. }
  31157. object = isFunction(value) ? value.call(object) : value;
  31158. }
  31159. return object;
  31160. }
  31161. /**
  31162. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31163. * it's created. Arrays are created for missing index properties while objects
  31164. * are created for all other missing properties. Use `_.setWith` to customize
  31165. * `path` creation.
  31166. *
  31167. * **Note:** This method mutates `object`.
  31168. *
  31169. * @static
  31170. * @memberOf _
  31171. * @since 3.7.0
  31172. * @category Object
  31173. * @param {Object} object The object to modify.
  31174. * @param {Array|string} path The path of the property to set.
  31175. * @param {*} value The value to set.
  31176. * @returns {Object} Returns `object`.
  31177. * @example
  31178. *
  31179. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31180. *
  31181. * _.set(object, 'a[0].b.c', 4);
  31182. * console.log(object.a[0].b.c);
  31183. * // => 4
  31184. *
  31185. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31186. * console.log(object.x[0].y.z);
  31187. * // => 5
  31188. */
  31189. function set(object, path, value) {
  31190. return object == null ? object : baseSet(object, path, value);
  31191. }
  31192. /**
  31193. * This method is like `_.set` except that it accepts `customizer` which is
  31194. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31195. * path creation is handled by the method instead. The `customizer` is invoked
  31196. * with three arguments: (nsValue, key, nsObject).
  31197. *
  31198. * **Note:** This method mutates `object`.
  31199. *
  31200. * @static
  31201. * @memberOf _
  31202. * @since 4.0.0
  31203. * @category Object
  31204. * @param {Object} object The object to modify.
  31205. * @param {Array|string} path The path of the property to set.
  31206. * @param {*} value The value to set.
  31207. * @param {Function} [customizer] The function to customize assigned values.
  31208. * @returns {Object} Returns `object`.
  31209. * @example
  31210. *
  31211. * var object = {};
  31212. *
  31213. * _.setWith(object, '[0][1]', 'a', Object);
  31214. * // => { '0': { '1': 'a' } }
  31215. */
  31216. function setWith(object, path, value, customizer) {
  31217. customizer = typeof customizer == 'function' ? customizer : undefined;
  31218. return object == null ? object : baseSet(object, path, value, customizer);
  31219. }
  31220. /**
  31221. * Creates an array of own enumerable string keyed-value pairs for `object`
  31222. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31223. * entries are returned.
  31224. *
  31225. * @static
  31226. * @memberOf _
  31227. * @since 4.0.0
  31228. * @alias entries
  31229. * @category Object
  31230. * @param {Object} object The object to query.
  31231. * @returns {Array} Returns the key-value pairs.
  31232. * @example
  31233. *
  31234. * function Foo() {
  31235. * this.a = 1;
  31236. * this.b = 2;
  31237. * }
  31238. *
  31239. * Foo.prototype.c = 3;
  31240. *
  31241. * _.toPairs(new Foo);
  31242. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31243. */
  31244. var toPairs = createToPairs(keys);
  31245. /**
  31246. * Creates an array of own and inherited enumerable string keyed-value pairs
  31247. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31248. * or set, its entries are returned.
  31249. *
  31250. * @static
  31251. * @memberOf _
  31252. * @since 4.0.0
  31253. * @alias entriesIn
  31254. * @category Object
  31255. * @param {Object} object The object to query.
  31256. * @returns {Array} Returns the key-value pairs.
  31257. * @example
  31258. *
  31259. * function Foo() {
  31260. * this.a = 1;
  31261. * this.b = 2;
  31262. * }
  31263. *
  31264. * Foo.prototype.c = 3;
  31265. *
  31266. * _.toPairsIn(new Foo);
  31267. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31268. */
  31269. var toPairsIn = createToPairs(keysIn);
  31270. /**
  31271. * An alternative to `_.reduce`; this method transforms `object` to a new
  31272. * `accumulator` object which is the result of running each of its own
  31273. * enumerable string keyed properties thru `iteratee`, with each invocation
  31274. * potentially mutating the `accumulator` object. If `accumulator` is not
  31275. * provided, a new object with the same `[[Prototype]]` will be used. The
  31276. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31277. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31278. *
  31279. * @static
  31280. * @memberOf _
  31281. * @since 1.3.0
  31282. * @category Object
  31283. * @param {Object} object The object to iterate over.
  31284. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31285. * @param {*} [accumulator] The custom accumulator value.
  31286. * @returns {*} Returns the accumulated value.
  31287. * @example
  31288. *
  31289. * _.transform([2, 3, 4], function(result, n) {
  31290. * result.push(n *= n);
  31291. * return n % 2 == 0;
  31292. * }, []);
  31293. * // => [4, 9]
  31294. *
  31295. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31296. * (result[value] || (result[value] = [])).push(key);
  31297. * }, {});
  31298. * // => { '1': ['a', 'c'], '2': ['b'] }
  31299. */
  31300. function transform(object, iteratee, accumulator) {
  31301. var isArr = isArray(object),
  31302. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31303. iteratee = getIteratee(iteratee, 4);
  31304. if (accumulator == null) {
  31305. var Ctor = object && object.constructor;
  31306. if (isArrLike) {
  31307. accumulator = isArr ? new Ctor : [];
  31308. }
  31309. else if (isObject(object)) {
  31310. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31311. }
  31312. else {
  31313. accumulator = {};
  31314. }
  31315. }
  31316. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31317. return iteratee(accumulator, value, index, object);
  31318. });
  31319. return accumulator;
  31320. }
  31321. /**
  31322. * Removes the property at `path` of `object`.
  31323. *
  31324. * **Note:** This method mutates `object`.
  31325. *
  31326. * @static
  31327. * @memberOf _
  31328. * @since 4.0.0
  31329. * @category Object
  31330. * @param {Object} object The object to modify.
  31331. * @param {Array|string} path The path of the property to unset.
  31332. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31333. * @example
  31334. *
  31335. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31336. * _.unset(object, 'a[0].b.c');
  31337. * // => true
  31338. *
  31339. * console.log(object);
  31340. * // => { 'a': [{ 'b': {} }] };
  31341. *
  31342. * _.unset(object, ['a', '0', 'b', 'c']);
  31343. * // => true
  31344. *
  31345. * console.log(object);
  31346. * // => { 'a': [{ 'b': {} }] };
  31347. */
  31348. function unset(object, path) {
  31349. return object == null ? true : baseUnset(object, path);
  31350. }
  31351. /**
  31352. * This method is like `_.set` except that accepts `updater` to produce the
  31353. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31354. * is invoked with one argument: (value).
  31355. *
  31356. * **Note:** This method mutates `object`.
  31357. *
  31358. * @static
  31359. * @memberOf _
  31360. * @since 4.6.0
  31361. * @category Object
  31362. * @param {Object} object The object to modify.
  31363. * @param {Array|string} path The path of the property to set.
  31364. * @param {Function} updater The function to produce the updated value.
  31365. * @returns {Object} Returns `object`.
  31366. * @example
  31367. *
  31368. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31369. *
  31370. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31371. * console.log(object.a[0].b.c);
  31372. * // => 9
  31373. *
  31374. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31375. * console.log(object.x[0].y.z);
  31376. * // => 0
  31377. */
  31378. function update(object, path, updater) {
  31379. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31380. }
  31381. /**
  31382. * This method is like `_.update` except that it accepts `customizer` which is
  31383. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31384. * path creation is handled by the method instead. The `customizer` is invoked
  31385. * with three arguments: (nsValue, key, nsObject).
  31386. *
  31387. * **Note:** This method mutates `object`.
  31388. *
  31389. * @static
  31390. * @memberOf _
  31391. * @since 4.6.0
  31392. * @category Object
  31393. * @param {Object} object The object to modify.
  31394. * @param {Array|string} path The path of the property to set.
  31395. * @param {Function} updater The function to produce the updated value.
  31396. * @param {Function} [customizer] The function to customize assigned values.
  31397. * @returns {Object} Returns `object`.
  31398. * @example
  31399. *
  31400. * var object = {};
  31401. *
  31402. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31403. * // => { '0': { '1': 'a' } }
  31404. */
  31405. function updateWith(object, path, updater, customizer) {
  31406. customizer = typeof customizer == 'function' ? customizer : undefined;
  31407. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31408. }
  31409. /**
  31410. * Creates an array of the own enumerable string keyed property values of `object`.
  31411. *
  31412. * **Note:** Non-object values are coerced to objects.
  31413. *
  31414. * @static
  31415. * @since 0.1.0
  31416. * @memberOf _
  31417. * @category Object
  31418. * @param {Object} object The object to query.
  31419. * @returns {Array} Returns the array of property values.
  31420. * @example
  31421. *
  31422. * function Foo() {
  31423. * this.a = 1;
  31424. * this.b = 2;
  31425. * }
  31426. *
  31427. * Foo.prototype.c = 3;
  31428. *
  31429. * _.values(new Foo);
  31430. * // => [1, 2] (iteration order is not guaranteed)
  31431. *
  31432. * _.values('hi');
  31433. * // => ['h', 'i']
  31434. */
  31435. function values(object) {
  31436. return object == null ? [] : baseValues(object, keys(object));
  31437. }
  31438. /**
  31439. * Creates an array of the own and inherited enumerable string keyed property
  31440. * values of `object`.
  31441. *
  31442. * **Note:** Non-object values are coerced to objects.
  31443. *
  31444. * @static
  31445. * @memberOf _
  31446. * @since 3.0.0
  31447. * @category Object
  31448. * @param {Object} object The object to query.
  31449. * @returns {Array} Returns the array of property values.
  31450. * @example
  31451. *
  31452. * function Foo() {
  31453. * this.a = 1;
  31454. * this.b = 2;
  31455. * }
  31456. *
  31457. * Foo.prototype.c = 3;
  31458. *
  31459. * _.valuesIn(new Foo);
  31460. * // => [1, 2, 3] (iteration order is not guaranteed)
  31461. */
  31462. function valuesIn(object) {
  31463. return object == null ? [] : baseValues(object, keysIn(object));
  31464. }
  31465. /*------------------------------------------------------------------------*/
  31466. /**
  31467. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31468. *
  31469. * @static
  31470. * @memberOf _
  31471. * @since 4.0.0
  31472. * @category Number
  31473. * @param {number} number The number to clamp.
  31474. * @param {number} [lower] The lower bound.
  31475. * @param {number} upper The upper bound.
  31476. * @returns {number} Returns the clamped number.
  31477. * @example
  31478. *
  31479. * _.clamp(-10, -5, 5);
  31480. * // => -5
  31481. *
  31482. * _.clamp(10, -5, 5);
  31483. * // => 5
  31484. */
  31485. function clamp(number, lower, upper) {
  31486. if (upper === undefined) {
  31487. upper = lower;
  31488. lower = undefined;
  31489. }
  31490. if (upper !== undefined) {
  31491. upper = toNumber(upper);
  31492. upper = upper === upper ? upper : 0;
  31493. }
  31494. if (lower !== undefined) {
  31495. lower = toNumber(lower);
  31496. lower = lower === lower ? lower : 0;
  31497. }
  31498. return baseClamp(toNumber(number), lower, upper);
  31499. }
  31500. /**
  31501. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31502. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31503. * If `start` is greater than `end` the params are swapped to support
  31504. * negative ranges.
  31505. *
  31506. * @static
  31507. * @memberOf _
  31508. * @since 3.3.0
  31509. * @category Number
  31510. * @param {number} number The number to check.
  31511. * @param {number} [start=0] The start of the range.
  31512. * @param {number} end The end of the range.
  31513. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31514. * @see _.range, _.rangeRight
  31515. * @example
  31516. *
  31517. * _.inRange(3, 2, 4);
  31518. * // => true
  31519. *
  31520. * _.inRange(4, 8);
  31521. * // => true
  31522. *
  31523. * _.inRange(4, 2);
  31524. * // => false
  31525. *
  31526. * _.inRange(2, 2);
  31527. * // => false
  31528. *
  31529. * _.inRange(1.2, 2);
  31530. * // => true
  31531. *
  31532. * _.inRange(5.2, 4);
  31533. * // => false
  31534. *
  31535. * _.inRange(-3, -2, -6);
  31536. * // => true
  31537. */
  31538. function inRange(number, start, end) {
  31539. start = toFinite(start);
  31540. if (end === undefined) {
  31541. end = start;
  31542. start = 0;
  31543. } else {
  31544. end = toFinite(end);
  31545. }
  31546. number = toNumber(number);
  31547. return baseInRange(number, start, end);
  31548. }
  31549. /**
  31550. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31551. * If only one argument is provided a number between `0` and the given number
  31552. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31553. * floats, a floating-point number is returned instead of an integer.
  31554. *
  31555. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31556. * floating-point values which can produce unexpected results.
  31557. *
  31558. * @static
  31559. * @memberOf _
  31560. * @since 0.7.0
  31561. * @category Number
  31562. * @param {number} [lower=0] The lower bound.
  31563. * @param {number} [upper=1] The upper bound.
  31564. * @param {boolean} [floating] Specify returning a floating-point number.
  31565. * @returns {number} Returns the random number.
  31566. * @example
  31567. *
  31568. * _.random(0, 5);
  31569. * // => an integer between 0 and 5
  31570. *
  31571. * _.random(5);
  31572. * // => also an integer between 0 and 5
  31573. *
  31574. * _.random(5, true);
  31575. * // => a floating-point number between 0 and 5
  31576. *
  31577. * _.random(1.2, 5.2);
  31578. * // => a floating-point number between 1.2 and 5.2
  31579. */
  31580. function random(lower, upper, floating) {
  31581. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31582. upper = floating = undefined;
  31583. }
  31584. if (floating === undefined) {
  31585. if (typeof upper == 'boolean') {
  31586. floating = upper;
  31587. upper = undefined;
  31588. }
  31589. else if (typeof lower == 'boolean') {
  31590. floating = lower;
  31591. lower = undefined;
  31592. }
  31593. }
  31594. if (lower === undefined && upper === undefined) {
  31595. lower = 0;
  31596. upper = 1;
  31597. }
  31598. else {
  31599. lower = toFinite(lower);
  31600. if (upper === undefined) {
  31601. upper = lower;
  31602. lower = 0;
  31603. } else {
  31604. upper = toFinite(upper);
  31605. }
  31606. }
  31607. if (lower > upper) {
  31608. var temp = lower;
  31609. lower = upper;
  31610. upper = temp;
  31611. }
  31612. if (floating || lower % 1 || upper % 1) {
  31613. var rand = nativeRandom();
  31614. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31615. }
  31616. return baseRandom(lower, upper);
  31617. }
  31618. /*------------------------------------------------------------------------*/
  31619. /**
  31620. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31621. *
  31622. * @static
  31623. * @memberOf _
  31624. * @since 3.0.0
  31625. * @category String
  31626. * @param {string} [string=''] The string to convert.
  31627. * @returns {string} Returns the camel cased string.
  31628. * @example
  31629. *
  31630. * _.camelCase('Foo Bar');
  31631. * // => 'fooBar'
  31632. *
  31633. * _.camelCase('--foo-bar--');
  31634. * // => 'fooBar'
  31635. *
  31636. * _.camelCase('__FOO_BAR__');
  31637. * // => 'fooBar'
  31638. */
  31639. var camelCase = createCompounder(function(result, word, index) {
  31640. word = word.toLowerCase();
  31641. return result + (index ? capitalize(word) : word);
  31642. });
  31643. /**
  31644. * Converts the first character of `string` to upper case and the remaining
  31645. * to lower case.
  31646. *
  31647. * @static
  31648. * @memberOf _
  31649. * @since 3.0.0
  31650. * @category String
  31651. * @param {string} [string=''] The string to capitalize.
  31652. * @returns {string} Returns the capitalized string.
  31653. * @example
  31654. *
  31655. * _.capitalize('FRED');
  31656. * // => 'Fred'
  31657. */
  31658. function capitalize(string) {
  31659. return upperFirst(toString(string).toLowerCase());
  31660. }
  31661. /**
  31662. * Deburrs `string` by converting
  31663. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31664. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31665. * letters to basic Latin letters and removing
  31666. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31667. *
  31668. * @static
  31669. * @memberOf _
  31670. * @since 3.0.0
  31671. * @category String
  31672. * @param {string} [string=''] The string to deburr.
  31673. * @returns {string} Returns the deburred string.
  31674. * @example
  31675. *
  31676. * _.deburr('déjà vu');
  31677. * // => 'deja vu'
  31678. */
  31679. function deburr(string) {
  31680. string = toString(string);
  31681. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31682. }
  31683. /**
  31684. * Checks if `string` ends with the given target string.
  31685. *
  31686. * @static
  31687. * @memberOf _
  31688. * @since 3.0.0
  31689. * @category String
  31690. * @param {string} [string=''] The string to inspect.
  31691. * @param {string} [target] The string to search for.
  31692. * @param {number} [position=string.length] The position to search up to.
  31693. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31694. * else `false`.
  31695. * @example
  31696. *
  31697. * _.endsWith('abc', 'c');
  31698. * // => true
  31699. *
  31700. * _.endsWith('abc', 'b');
  31701. * // => false
  31702. *
  31703. * _.endsWith('abc', 'b', 2);
  31704. * // => true
  31705. */
  31706. function endsWith(string, target, position) {
  31707. string = toString(string);
  31708. target = baseToString(target);
  31709. var length = string.length;
  31710. position = position === undefined
  31711. ? length
  31712. : baseClamp(toInteger(position), 0, length);
  31713. var end = position;
  31714. position -= target.length;
  31715. return position >= 0 && string.slice(position, end) == target;
  31716. }
  31717. /**
  31718. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31719. * corresponding HTML entities.
  31720. *
  31721. * **Note:** No other characters are escaped. To escape additional
  31722. * characters use a third-party library like [_he_](https://mths.be/he).
  31723. *
  31724. * Though the ">" character is escaped for symmetry, characters like
  31725. * ">" and "/" don't need escaping in HTML and have no special meaning
  31726. * unless they're part of a tag or unquoted attribute value. See
  31727. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31728. * (under "semi-related fun fact") for more details.
  31729. *
  31730. * When working with HTML you should always
  31731. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31732. * XSS vectors.
  31733. *
  31734. * @static
  31735. * @since 0.1.0
  31736. * @memberOf _
  31737. * @category String
  31738. * @param {string} [string=''] The string to escape.
  31739. * @returns {string} Returns the escaped string.
  31740. * @example
  31741. *
  31742. * _.escape('fred, barney, & pebbles');
  31743. * // => 'fred, barney, &amp; pebbles'
  31744. */
  31745. function escape(string) {
  31746. string = toString(string);
  31747. return (string && reHasUnescapedHtml.test(string))
  31748. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31749. : string;
  31750. }
  31751. /**
  31752. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31753. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31754. *
  31755. * @static
  31756. * @memberOf _
  31757. * @since 3.0.0
  31758. * @category String
  31759. * @param {string} [string=''] The string to escape.
  31760. * @returns {string} Returns the escaped string.
  31761. * @example
  31762. *
  31763. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31764. * // => '\[lodash\]\(https://lodash\.com/\)'
  31765. */
  31766. function escapeRegExp(string) {
  31767. string = toString(string);
  31768. return (string && reHasRegExpChar.test(string))
  31769. ? string.replace(reRegExpChar, '\\$&')
  31770. : string;
  31771. }
  31772. /**
  31773. * Converts `string` to
  31774. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31775. *
  31776. * @static
  31777. * @memberOf _
  31778. * @since 3.0.0
  31779. * @category String
  31780. * @param {string} [string=''] The string to convert.
  31781. * @returns {string} Returns the kebab cased string.
  31782. * @example
  31783. *
  31784. * _.kebabCase('Foo Bar');
  31785. * // => 'foo-bar'
  31786. *
  31787. * _.kebabCase('fooBar');
  31788. * // => 'foo-bar'
  31789. *
  31790. * _.kebabCase('__FOO_BAR__');
  31791. * // => 'foo-bar'
  31792. */
  31793. var kebabCase = createCompounder(function(result, word, index) {
  31794. return result + (index ? '-' : '') + word.toLowerCase();
  31795. });
  31796. /**
  31797. * Converts `string`, as space separated words, to lower case.
  31798. *
  31799. * @static
  31800. * @memberOf _
  31801. * @since 4.0.0
  31802. * @category String
  31803. * @param {string} [string=''] The string to convert.
  31804. * @returns {string} Returns the lower cased string.
  31805. * @example
  31806. *
  31807. * _.lowerCase('--Foo-Bar--');
  31808. * // => 'foo bar'
  31809. *
  31810. * _.lowerCase('fooBar');
  31811. * // => 'foo bar'
  31812. *
  31813. * _.lowerCase('__FOO_BAR__');
  31814. * // => 'foo bar'
  31815. */
  31816. var lowerCase = createCompounder(function(result, word, index) {
  31817. return result + (index ? ' ' : '') + word.toLowerCase();
  31818. });
  31819. /**
  31820. * Converts the first character of `string` to lower case.
  31821. *
  31822. * @static
  31823. * @memberOf _
  31824. * @since 4.0.0
  31825. * @category String
  31826. * @param {string} [string=''] The string to convert.
  31827. * @returns {string} Returns the converted string.
  31828. * @example
  31829. *
  31830. * _.lowerFirst('Fred');
  31831. * // => 'fred'
  31832. *
  31833. * _.lowerFirst('FRED');
  31834. * // => 'fRED'
  31835. */
  31836. var lowerFirst = createCaseFirst('toLowerCase');
  31837. /**
  31838. * Pads `string` on the left and right sides if it's shorter than `length`.
  31839. * Padding characters are truncated if they can't be evenly divided by `length`.
  31840. *
  31841. * @static
  31842. * @memberOf _
  31843. * @since 3.0.0
  31844. * @category String
  31845. * @param {string} [string=''] The string to pad.
  31846. * @param {number} [length=0] The padding length.
  31847. * @param {string} [chars=' '] The string used as padding.
  31848. * @returns {string} Returns the padded string.
  31849. * @example
  31850. *
  31851. * _.pad('abc', 8);
  31852. * // => ' abc '
  31853. *
  31854. * _.pad('abc', 8, '_-');
  31855. * // => '_-abc_-_'
  31856. *
  31857. * _.pad('abc', 3);
  31858. * // => 'abc'
  31859. */
  31860. function pad(string, length, chars) {
  31861. string = toString(string);
  31862. length = toInteger(length);
  31863. var strLength = length ? stringSize(string) : 0;
  31864. if (!length || strLength >= length) {
  31865. return string;
  31866. }
  31867. var mid = (length - strLength) / 2;
  31868. return (
  31869. createPadding(nativeFloor(mid), chars) +
  31870. string +
  31871. createPadding(nativeCeil(mid), chars)
  31872. );
  31873. }
  31874. /**
  31875. * Pads `string` on the right side if it's shorter than `length`. Padding
  31876. * characters are truncated if they exceed `length`.
  31877. *
  31878. * @static
  31879. * @memberOf _
  31880. * @since 4.0.0
  31881. * @category String
  31882. * @param {string} [string=''] The string to pad.
  31883. * @param {number} [length=0] The padding length.
  31884. * @param {string} [chars=' '] The string used as padding.
  31885. * @returns {string} Returns the padded string.
  31886. * @example
  31887. *
  31888. * _.padEnd('abc', 6);
  31889. * // => 'abc '
  31890. *
  31891. * _.padEnd('abc', 6, '_-');
  31892. * // => 'abc_-_'
  31893. *
  31894. * _.padEnd('abc', 3);
  31895. * // => 'abc'
  31896. */
  31897. function padEnd(string, length, chars) {
  31898. string = toString(string);
  31899. length = toInteger(length);
  31900. var strLength = length ? stringSize(string) : 0;
  31901. return (length && strLength < length)
  31902. ? (string + createPadding(length - strLength, chars))
  31903. : string;
  31904. }
  31905. /**
  31906. * Pads `string` on the left side if it's shorter than `length`. Padding
  31907. * characters are truncated if they exceed `length`.
  31908. *
  31909. * @static
  31910. * @memberOf _
  31911. * @since 4.0.0
  31912. * @category String
  31913. * @param {string} [string=''] The string to pad.
  31914. * @param {number} [length=0] The padding length.
  31915. * @param {string} [chars=' '] The string used as padding.
  31916. * @returns {string} Returns the padded string.
  31917. * @example
  31918. *
  31919. * _.padStart('abc', 6);
  31920. * // => ' abc'
  31921. *
  31922. * _.padStart('abc', 6, '_-');
  31923. * // => '_-_abc'
  31924. *
  31925. * _.padStart('abc', 3);
  31926. * // => 'abc'
  31927. */
  31928. function padStart(string, length, chars) {
  31929. string = toString(string);
  31930. length = toInteger(length);
  31931. var strLength = length ? stringSize(string) : 0;
  31932. return (length && strLength < length)
  31933. ? (createPadding(length - strLength, chars) + string)
  31934. : string;
  31935. }
  31936. /**
  31937. * Converts `string` to an integer of the specified radix. If `radix` is
  31938. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31939. * hexadecimal, in which case a `radix` of `16` is used.
  31940. *
  31941. * **Note:** This method aligns with the
  31942. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31943. *
  31944. * @static
  31945. * @memberOf _
  31946. * @since 1.1.0
  31947. * @category String
  31948. * @param {string} string The string to convert.
  31949. * @param {number} [radix=10] The radix to interpret `value` by.
  31950. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31951. * @returns {number} Returns the converted integer.
  31952. * @example
  31953. *
  31954. * _.parseInt('08');
  31955. * // => 8
  31956. *
  31957. * _.map(['6', '08', '10'], _.parseInt);
  31958. * // => [6, 8, 10]
  31959. */
  31960. function parseInt(string, radix, guard) {
  31961. if (guard || radix == null) {
  31962. radix = 0;
  31963. } else if (radix) {
  31964. radix = +radix;
  31965. }
  31966. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31967. }
  31968. /**
  31969. * Repeats the given string `n` times.
  31970. *
  31971. * @static
  31972. * @memberOf _
  31973. * @since 3.0.0
  31974. * @category String
  31975. * @param {string} [string=''] The string to repeat.
  31976. * @param {number} [n=1] The number of times to repeat the string.
  31977. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31978. * @returns {string} Returns the repeated string.
  31979. * @example
  31980. *
  31981. * _.repeat('*', 3);
  31982. * // => '***'
  31983. *
  31984. * _.repeat('abc', 2);
  31985. * // => 'abcabc'
  31986. *
  31987. * _.repeat('abc', 0);
  31988. * // => ''
  31989. */
  31990. function repeat(string, n, guard) {
  31991. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31992. n = 1;
  31993. } else {
  31994. n = toInteger(n);
  31995. }
  31996. return baseRepeat(toString(string), n);
  31997. }
  31998. /**
  31999. * Replaces matches for `pattern` in `string` with `replacement`.
  32000. *
  32001. * **Note:** This method is based on
  32002. * [`String#replace`](https://mdn.io/String/replace).
  32003. *
  32004. * @static
  32005. * @memberOf _
  32006. * @since 4.0.0
  32007. * @category String
  32008. * @param {string} [string=''] The string to modify.
  32009. * @param {RegExp|string} pattern The pattern to replace.
  32010. * @param {Function|string} replacement The match replacement.
  32011. * @returns {string} Returns the modified string.
  32012. * @example
  32013. *
  32014. * _.replace('Hi Fred', 'Fred', 'Barney');
  32015. * // => 'Hi Barney'
  32016. */
  32017. function replace() {
  32018. var args = arguments,
  32019. string = toString(args[0]);
  32020. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32021. }
  32022. /**
  32023. * Converts `string` to
  32024. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32025. *
  32026. * @static
  32027. * @memberOf _
  32028. * @since 3.0.0
  32029. * @category String
  32030. * @param {string} [string=''] The string to convert.
  32031. * @returns {string} Returns the snake cased string.
  32032. * @example
  32033. *
  32034. * _.snakeCase('Foo Bar');
  32035. * // => 'foo_bar'
  32036. *
  32037. * _.snakeCase('fooBar');
  32038. * // => 'foo_bar'
  32039. *
  32040. * _.snakeCase('--FOO-BAR--');
  32041. * // => 'foo_bar'
  32042. */
  32043. var snakeCase = createCompounder(function(result, word, index) {
  32044. return result + (index ? '_' : '') + word.toLowerCase();
  32045. });
  32046. /**
  32047. * Splits `string` by `separator`.
  32048. *
  32049. * **Note:** This method is based on
  32050. * [`String#split`](https://mdn.io/String/split).
  32051. *
  32052. * @static
  32053. * @memberOf _
  32054. * @since 4.0.0
  32055. * @category String
  32056. * @param {string} [string=''] The string to split.
  32057. * @param {RegExp|string} separator The separator pattern to split by.
  32058. * @param {number} [limit] The length to truncate results to.
  32059. * @returns {Array} Returns the string segments.
  32060. * @example
  32061. *
  32062. * _.split('a-b-c', '-', 2);
  32063. * // => ['a', 'b']
  32064. */
  32065. function split(string, separator, limit) {
  32066. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32067. separator = limit = undefined;
  32068. }
  32069. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32070. if (!limit) {
  32071. return [];
  32072. }
  32073. string = toString(string);
  32074. if (string && (
  32075. typeof separator == 'string' ||
  32076. (separator != null && !isRegExp(separator))
  32077. )) {
  32078. separator = baseToString(separator);
  32079. if (!separator && hasUnicode(string)) {
  32080. return castSlice(stringToArray(string), 0, limit);
  32081. }
  32082. }
  32083. return string.split(separator, limit);
  32084. }
  32085. /**
  32086. * Converts `string` to
  32087. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32088. *
  32089. * @static
  32090. * @memberOf _
  32091. * @since 3.1.0
  32092. * @category String
  32093. * @param {string} [string=''] The string to convert.
  32094. * @returns {string} Returns the start cased string.
  32095. * @example
  32096. *
  32097. * _.startCase('--foo-bar--');
  32098. * // => 'Foo Bar'
  32099. *
  32100. * _.startCase('fooBar');
  32101. * // => 'Foo Bar'
  32102. *
  32103. * _.startCase('__FOO_BAR__');
  32104. * // => 'FOO BAR'
  32105. */
  32106. var startCase = createCompounder(function(result, word, index) {
  32107. return result + (index ? ' ' : '') + upperFirst(word);
  32108. });
  32109. /**
  32110. * Checks if `string` starts with the given target string.
  32111. *
  32112. * @static
  32113. * @memberOf _
  32114. * @since 3.0.0
  32115. * @category String
  32116. * @param {string} [string=''] The string to inspect.
  32117. * @param {string} [target] The string to search for.
  32118. * @param {number} [position=0] The position to search from.
  32119. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32120. * else `false`.
  32121. * @example
  32122. *
  32123. * _.startsWith('abc', 'a');
  32124. * // => true
  32125. *
  32126. * _.startsWith('abc', 'b');
  32127. * // => false
  32128. *
  32129. * _.startsWith('abc', 'b', 1);
  32130. * // => true
  32131. */
  32132. function startsWith(string, target, position) {
  32133. string = toString(string);
  32134. position = position == null
  32135. ? 0
  32136. : baseClamp(toInteger(position), 0, string.length);
  32137. target = baseToString(target);
  32138. return string.slice(position, position + target.length) == target;
  32139. }
  32140. /**
  32141. * Creates a compiled template function that can interpolate data properties
  32142. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32143. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32144. * properties may be accessed as free variables in the template. If a setting
  32145. * object is given, it takes precedence over `_.templateSettings` values.
  32146. *
  32147. * **Note:** In the development build `_.template` utilizes
  32148. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32149. * for easier debugging.
  32150. *
  32151. * For more information on precompiling templates see
  32152. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32153. *
  32154. * For more information on Chrome extension sandboxes see
  32155. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32156. *
  32157. * @static
  32158. * @since 0.1.0
  32159. * @memberOf _
  32160. * @category String
  32161. * @param {string} [string=''] The template string.
  32162. * @param {Object} [options={}] The options object.
  32163. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32164. * The HTML "escape" delimiter.
  32165. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32166. * The "evaluate" delimiter.
  32167. * @param {Object} [options.imports=_.templateSettings.imports]
  32168. * An object to import into the template as free variables.
  32169. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32170. * The "interpolate" delimiter.
  32171. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32172. * The sourceURL of the compiled template.
  32173. * @param {string} [options.variable='obj']
  32174. * The data object variable name.
  32175. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32176. * @returns {Function} Returns the compiled template function.
  32177. * @example
  32178. *
  32179. * // Use the "interpolate" delimiter to create a compiled template.
  32180. * var compiled = _.template('hello <%= user %>!');
  32181. * compiled({ 'user': 'fred' });
  32182. * // => 'hello fred!'
  32183. *
  32184. * // Use the HTML "escape" delimiter to escape data property values.
  32185. * var compiled = _.template('<b><%- value %></b>');
  32186. * compiled({ 'value': '<script>' });
  32187. * // => '<b>&lt;script&gt;</b>'
  32188. *
  32189. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32190. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32191. * compiled({ 'users': ['fred', 'barney'] });
  32192. * // => '<li>fred</li><li>barney</li>'
  32193. *
  32194. * // Use the internal `print` function in "evaluate" delimiters.
  32195. * var compiled = _.template('<% print("hello " + user); %>!');
  32196. * compiled({ 'user': 'barney' });
  32197. * // => 'hello barney!'
  32198. *
  32199. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32200. * // Disable support by replacing the "interpolate" delimiter.
  32201. * var compiled = _.template('hello ${ user }!');
  32202. * compiled({ 'user': 'pebbles' });
  32203. * // => 'hello pebbles!'
  32204. *
  32205. * // Use backslashes to treat delimiters as plain text.
  32206. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32207. * compiled({ 'value': 'ignored' });
  32208. * // => '<%- value %>'
  32209. *
  32210. * // Use the `imports` option to import `jQuery` as `jq`.
  32211. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32212. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32213. * compiled({ 'users': ['fred', 'barney'] });
  32214. * // => '<li>fred</li><li>barney</li>'
  32215. *
  32216. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32217. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32218. * compiled(data);
  32219. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32220. *
  32221. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32222. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32223. * compiled.source;
  32224. * // => function(data) {
  32225. * // var __t, __p = '';
  32226. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32227. * // return __p;
  32228. * // }
  32229. *
  32230. * // Use custom template delimiters.
  32231. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32232. * var compiled = _.template('hello {{ user }}!');
  32233. * compiled({ 'user': 'mustache' });
  32234. * // => 'hello mustache!'
  32235. *
  32236. * // Use the `source` property to inline compiled templates for meaningful
  32237. * // line numbers in error messages and stack traces.
  32238. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32239. * var JST = {\
  32240. * "main": ' + _.template(mainText).source + '\
  32241. * };\
  32242. * ');
  32243. */
  32244. function template(string, options, guard) {
  32245. // Based on John Resig's `tmpl` implementation
  32246. // (http://ejohn.org/blog/javascript-micro-templating/)
  32247. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32248. var settings = lodash.templateSettings;
  32249. if (guard && isIterateeCall(string, options, guard)) {
  32250. options = undefined;
  32251. }
  32252. string = toString(string);
  32253. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32254. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32255. importsKeys = keys(imports),
  32256. importsValues = baseValues(imports, importsKeys);
  32257. var isEscaping,
  32258. isEvaluating,
  32259. index = 0,
  32260. interpolate = options.interpolate || reNoMatch,
  32261. source = "__p += '";
  32262. // Compile the regexp to match each delimiter.
  32263. var reDelimiters = RegExp(
  32264. (options.escape || reNoMatch).source + '|' +
  32265. interpolate.source + '|' +
  32266. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32267. (options.evaluate || reNoMatch).source + '|$'
  32268. , 'g');
  32269. // Use a sourceURL for easier debugging.
  32270. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32271. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32272. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32273. var sourceURL = '//# sourceURL=' +
  32274. (hasOwnProperty.call(options, 'sourceURL')
  32275. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32276. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32277. ) + '\n';
  32278. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32279. interpolateValue || (interpolateValue = esTemplateValue);
  32280. // Escape characters that can't be included in string literals.
  32281. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32282. // Replace delimiters with snippets.
  32283. if (escapeValue) {
  32284. isEscaping = true;
  32285. source += "' +\n__e(" + escapeValue + ") +\n'";
  32286. }
  32287. if (evaluateValue) {
  32288. isEvaluating = true;
  32289. source += "';\n" + evaluateValue + ";\n__p += '";
  32290. }
  32291. if (interpolateValue) {
  32292. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32293. }
  32294. index = offset + match.length;
  32295. // The JS engine embedded in Adobe products needs `match` returned in
  32296. // order to produce the correct `offset` value.
  32297. return match;
  32298. });
  32299. source += "';\n";
  32300. // If `variable` is not specified wrap a with-statement around the generated
  32301. // code to add the data object to the top of the scope chain.
  32302. // Like with sourceURL, we take care to not check the option's prototype,
  32303. // as this configuration is a code injection vector.
  32304. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32305. if (!variable) {
  32306. source = 'with (obj) {\n' + source + '\n}\n';
  32307. }
  32308. // Cleanup code by stripping empty strings.
  32309. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32310. .replace(reEmptyStringMiddle, '$1')
  32311. .replace(reEmptyStringTrailing, '$1;');
  32312. // Frame code as the function body.
  32313. source = 'function(' + (variable || 'obj') + ') {\n' +
  32314. (variable
  32315. ? ''
  32316. : 'obj || (obj = {});\n'
  32317. ) +
  32318. "var __t, __p = ''" +
  32319. (isEscaping
  32320. ? ', __e = _.escape'
  32321. : ''
  32322. ) +
  32323. (isEvaluating
  32324. ? ', __j = Array.prototype.join;\n' +
  32325. "function print() { __p += __j.call(arguments, '') }\n"
  32326. : ';\n'
  32327. ) +
  32328. source +
  32329. 'return __p\n}';
  32330. var result = attempt(function() {
  32331. return Function(importsKeys, sourceURL + 'return ' + source)
  32332. .apply(undefined, importsValues);
  32333. });
  32334. // Provide the compiled function's source by its `toString` method or
  32335. // the `source` property as a convenience for inlining compiled templates.
  32336. result.source = source;
  32337. if (isError(result)) {
  32338. throw result;
  32339. }
  32340. return result;
  32341. }
  32342. /**
  32343. * Converts `string`, as a whole, to lower case just like
  32344. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32345. *
  32346. * @static
  32347. * @memberOf _
  32348. * @since 4.0.0
  32349. * @category String
  32350. * @param {string} [string=''] The string to convert.
  32351. * @returns {string} Returns the lower cased string.
  32352. * @example
  32353. *
  32354. * _.toLower('--Foo-Bar--');
  32355. * // => '--foo-bar--'
  32356. *
  32357. * _.toLower('fooBar');
  32358. * // => 'foobar'
  32359. *
  32360. * _.toLower('__FOO_BAR__');
  32361. * // => '__foo_bar__'
  32362. */
  32363. function toLower(value) {
  32364. return toString(value).toLowerCase();
  32365. }
  32366. /**
  32367. * Converts `string`, as a whole, to upper case just like
  32368. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32369. *
  32370. * @static
  32371. * @memberOf _
  32372. * @since 4.0.0
  32373. * @category String
  32374. * @param {string} [string=''] The string to convert.
  32375. * @returns {string} Returns the upper cased string.
  32376. * @example
  32377. *
  32378. * _.toUpper('--foo-bar--');
  32379. * // => '--FOO-BAR--'
  32380. *
  32381. * _.toUpper('fooBar');
  32382. * // => 'FOOBAR'
  32383. *
  32384. * _.toUpper('__foo_bar__');
  32385. * // => '__FOO_BAR__'
  32386. */
  32387. function toUpper(value) {
  32388. return toString(value).toUpperCase();
  32389. }
  32390. /**
  32391. * Removes leading and trailing whitespace or specified characters from `string`.
  32392. *
  32393. * @static
  32394. * @memberOf _
  32395. * @since 3.0.0
  32396. * @category String
  32397. * @param {string} [string=''] The string to trim.
  32398. * @param {string} [chars=whitespace] The characters to trim.
  32399. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32400. * @returns {string} Returns the trimmed string.
  32401. * @example
  32402. *
  32403. * _.trim(' abc ');
  32404. * // => 'abc'
  32405. *
  32406. * _.trim('-_-abc-_-', '_-');
  32407. * // => 'abc'
  32408. *
  32409. * _.map([' foo ', ' bar '], _.trim);
  32410. * // => ['foo', 'bar']
  32411. */
  32412. function trim(string, chars, guard) {
  32413. string = toString(string);
  32414. if (string && (guard || chars === undefined)) {
  32415. return string.replace(reTrim, '');
  32416. }
  32417. if (!string || !(chars = baseToString(chars))) {
  32418. return string;
  32419. }
  32420. var strSymbols = stringToArray(string),
  32421. chrSymbols = stringToArray(chars),
  32422. start = charsStartIndex(strSymbols, chrSymbols),
  32423. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32424. return castSlice(strSymbols, start, end).join('');
  32425. }
  32426. /**
  32427. * Removes trailing whitespace or specified characters from `string`.
  32428. *
  32429. * @static
  32430. * @memberOf _
  32431. * @since 4.0.0
  32432. * @category String
  32433. * @param {string} [string=''] The string to trim.
  32434. * @param {string} [chars=whitespace] The characters to trim.
  32435. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32436. * @returns {string} Returns the trimmed string.
  32437. * @example
  32438. *
  32439. * _.trimEnd(' abc ');
  32440. * // => ' abc'
  32441. *
  32442. * _.trimEnd('-_-abc-_-', '_-');
  32443. * // => '-_-abc'
  32444. */
  32445. function trimEnd(string, chars, guard) {
  32446. string = toString(string);
  32447. if (string && (guard || chars === undefined)) {
  32448. return string.replace(reTrimEnd, '');
  32449. }
  32450. if (!string || !(chars = baseToString(chars))) {
  32451. return string;
  32452. }
  32453. var strSymbols = stringToArray(string),
  32454. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32455. return castSlice(strSymbols, 0, end).join('');
  32456. }
  32457. /**
  32458. * Removes leading whitespace or specified characters from `string`.
  32459. *
  32460. * @static
  32461. * @memberOf _
  32462. * @since 4.0.0
  32463. * @category String
  32464. * @param {string} [string=''] The string to trim.
  32465. * @param {string} [chars=whitespace] The characters to trim.
  32466. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32467. * @returns {string} Returns the trimmed string.
  32468. * @example
  32469. *
  32470. * _.trimStart(' abc ');
  32471. * // => 'abc '
  32472. *
  32473. * _.trimStart('-_-abc-_-', '_-');
  32474. * // => 'abc-_-'
  32475. */
  32476. function trimStart(string, chars, guard) {
  32477. string = toString(string);
  32478. if (string && (guard || chars === undefined)) {
  32479. return string.replace(reTrimStart, '');
  32480. }
  32481. if (!string || !(chars = baseToString(chars))) {
  32482. return string;
  32483. }
  32484. var strSymbols = stringToArray(string),
  32485. start = charsStartIndex(strSymbols, stringToArray(chars));
  32486. return castSlice(strSymbols, start).join('');
  32487. }
  32488. /**
  32489. * Truncates `string` if it's longer than the given maximum string length.
  32490. * The last characters of the truncated string are replaced with the omission
  32491. * string which defaults to "...".
  32492. *
  32493. * @static
  32494. * @memberOf _
  32495. * @since 4.0.0
  32496. * @category String
  32497. * @param {string} [string=''] The string to truncate.
  32498. * @param {Object} [options={}] The options object.
  32499. * @param {number} [options.length=30] The maximum string length.
  32500. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32501. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32502. * @returns {string} Returns the truncated string.
  32503. * @example
  32504. *
  32505. * _.truncate('hi-diddly-ho there, neighborino');
  32506. * // => 'hi-diddly-ho there, neighbo...'
  32507. *
  32508. * _.truncate('hi-diddly-ho there, neighborino', {
  32509. * 'length': 24,
  32510. * 'separator': ' '
  32511. * });
  32512. * // => 'hi-diddly-ho there,...'
  32513. *
  32514. * _.truncate('hi-diddly-ho there, neighborino', {
  32515. * 'length': 24,
  32516. * 'separator': /,? +/
  32517. * });
  32518. * // => 'hi-diddly-ho there...'
  32519. *
  32520. * _.truncate('hi-diddly-ho there, neighborino', {
  32521. * 'omission': ' [...]'
  32522. * });
  32523. * // => 'hi-diddly-ho there, neig [...]'
  32524. */
  32525. function truncate(string, options) {
  32526. var length = DEFAULT_TRUNC_LENGTH,
  32527. omission = DEFAULT_TRUNC_OMISSION;
  32528. if (isObject(options)) {
  32529. var separator = 'separator' in options ? options.separator : separator;
  32530. length = 'length' in options ? toInteger(options.length) : length;
  32531. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32532. }
  32533. string = toString(string);
  32534. var strLength = string.length;
  32535. if (hasUnicode(string)) {
  32536. var strSymbols = stringToArray(string);
  32537. strLength = strSymbols.length;
  32538. }
  32539. if (length >= strLength) {
  32540. return string;
  32541. }
  32542. var end = length - stringSize(omission);
  32543. if (end < 1) {
  32544. return omission;
  32545. }
  32546. var result = strSymbols
  32547. ? castSlice(strSymbols, 0, end).join('')
  32548. : string.slice(0, end);
  32549. if (separator === undefined) {
  32550. return result + omission;
  32551. }
  32552. if (strSymbols) {
  32553. end += (result.length - end);
  32554. }
  32555. if (isRegExp(separator)) {
  32556. if (string.slice(end).search(separator)) {
  32557. var match,
  32558. substring = result;
  32559. if (!separator.global) {
  32560. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32561. }
  32562. separator.lastIndex = 0;
  32563. while ((match = separator.exec(substring))) {
  32564. var newEnd = match.index;
  32565. }
  32566. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32567. }
  32568. } else if (string.indexOf(baseToString(separator), end) != end) {
  32569. var index = result.lastIndexOf(separator);
  32570. if (index > -1) {
  32571. result = result.slice(0, index);
  32572. }
  32573. }
  32574. return result + omission;
  32575. }
  32576. /**
  32577. * The inverse of `_.escape`; this method converts the HTML entities
  32578. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32579. * their corresponding characters.
  32580. *
  32581. * **Note:** No other HTML entities are unescaped. To unescape additional
  32582. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32583. *
  32584. * @static
  32585. * @memberOf _
  32586. * @since 0.6.0
  32587. * @category String
  32588. * @param {string} [string=''] The string to unescape.
  32589. * @returns {string} Returns the unescaped string.
  32590. * @example
  32591. *
  32592. * _.unescape('fred, barney, &amp; pebbles');
  32593. * // => 'fred, barney, & pebbles'
  32594. */
  32595. function unescape(string) {
  32596. string = toString(string);
  32597. return (string && reHasEscapedHtml.test(string))
  32598. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32599. : string;
  32600. }
  32601. /**
  32602. * Converts `string`, as space separated words, to upper case.
  32603. *
  32604. * @static
  32605. * @memberOf _
  32606. * @since 4.0.0
  32607. * @category String
  32608. * @param {string} [string=''] The string to convert.
  32609. * @returns {string} Returns the upper cased string.
  32610. * @example
  32611. *
  32612. * _.upperCase('--foo-bar');
  32613. * // => 'FOO BAR'
  32614. *
  32615. * _.upperCase('fooBar');
  32616. * // => 'FOO BAR'
  32617. *
  32618. * _.upperCase('__foo_bar__');
  32619. * // => 'FOO BAR'
  32620. */
  32621. var upperCase = createCompounder(function(result, word, index) {
  32622. return result + (index ? ' ' : '') + word.toUpperCase();
  32623. });
  32624. /**
  32625. * Converts the first character of `string` to upper case.
  32626. *
  32627. * @static
  32628. * @memberOf _
  32629. * @since 4.0.0
  32630. * @category String
  32631. * @param {string} [string=''] The string to convert.
  32632. * @returns {string} Returns the converted string.
  32633. * @example
  32634. *
  32635. * _.upperFirst('fred');
  32636. * // => 'Fred'
  32637. *
  32638. * _.upperFirst('FRED');
  32639. * // => 'FRED'
  32640. */
  32641. var upperFirst = createCaseFirst('toUpperCase');
  32642. /**
  32643. * Splits `string` into an array of its words.
  32644. *
  32645. * @static
  32646. * @memberOf _
  32647. * @since 3.0.0
  32648. * @category String
  32649. * @param {string} [string=''] The string to inspect.
  32650. * @param {RegExp|string} [pattern] The pattern to match words.
  32651. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32652. * @returns {Array} Returns the words of `string`.
  32653. * @example
  32654. *
  32655. * _.words('fred, barney, & pebbles');
  32656. * // => ['fred', 'barney', 'pebbles']
  32657. *
  32658. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32659. * // => ['fred', 'barney', '&', 'pebbles']
  32660. */
  32661. function words(string, pattern, guard) {
  32662. string = toString(string);
  32663. pattern = guard ? undefined : pattern;
  32664. if (pattern === undefined) {
  32665. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32666. }
  32667. return string.match(pattern) || [];
  32668. }
  32669. /*------------------------------------------------------------------------*/
  32670. /**
  32671. * Attempts to invoke `func`, returning either the result or the caught error
  32672. * object. Any additional arguments are provided to `func` when it's invoked.
  32673. *
  32674. * @static
  32675. * @memberOf _
  32676. * @since 3.0.0
  32677. * @category Util
  32678. * @param {Function} func The function to attempt.
  32679. * @param {...*} [args] The arguments to invoke `func` with.
  32680. * @returns {*} Returns the `func` result or error object.
  32681. * @example
  32682. *
  32683. * // Avoid throwing errors for invalid selectors.
  32684. * var elements = _.attempt(function(selector) {
  32685. * return document.querySelectorAll(selector);
  32686. * }, '>_>');
  32687. *
  32688. * if (_.isError(elements)) {
  32689. * elements = [];
  32690. * }
  32691. */
  32692. var attempt = baseRest(function(func, args) {
  32693. try {
  32694. return apply(func, undefined, args);
  32695. } catch (e) {
  32696. return isError(e) ? e : new Error(e);
  32697. }
  32698. });
  32699. /**
  32700. * Binds methods of an object to the object itself, overwriting the existing
  32701. * method.
  32702. *
  32703. * **Note:** This method doesn't set the "length" property of bound functions.
  32704. *
  32705. * @static
  32706. * @since 0.1.0
  32707. * @memberOf _
  32708. * @category Util
  32709. * @param {Object} object The object to bind and assign the bound methods to.
  32710. * @param {...(string|string[])} methodNames The object method names to bind.
  32711. * @returns {Object} Returns `object`.
  32712. * @example
  32713. *
  32714. * var view = {
  32715. * 'label': 'docs',
  32716. * 'click': function() {
  32717. * console.log('clicked ' + this.label);
  32718. * }
  32719. * };
  32720. *
  32721. * _.bindAll(view, ['click']);
  32722. * jQuery(element).on('click', view.click);
  32723. * // => Logs 'clicked docs' when clicked.
  32724. */
  32725. var bindAll = flatRest(function(object, methodNames) {
  32726. arrayEach(methodNames, function(key) {
  32727. key = toKey(key);
  32728. baseAssignValue(object, key, bind(object[key], object));
  32729. });
  32730. return object;
  32731. });
  32732. /**
  32733. * Creates a function that iterates over `pairs` and invokes the corresponding
  32734. * function of the first predicate to return truthy. The predicate-function
  32735. * pairs are invoked with the `this` binding and arguments of the created
  32736. * function.
  32737. *
  32738. * @static
  32739. * @memberOf _
  32740. * @since 4.0.0
  32741. * @category Util
  32742. * @param {Array} pairs The predicate-function pairs.
  32743. * @returns {Function} Returns the new composite function.
  32744. * @example
  32745. *
  32746. * var func = _.cond([
  32747. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32748. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32749. * [_.stubTrue, _.constant('no match')]
  32750. * ]);
  32751. *
  32752. * func({ 'a': 1, 'b': 2 });
  32753. * // => 'matches A'
  32754. *
  32755. * func({ 'a': 0, 'b': 1 });
  32756. * // => 'matches B'
  32757. *
  32758. * func({ 'a': '1', 'b': '2' });
  32759. * // => 'no match'
  32760. */
  32761. function cond(pairs) {
  32762. var length = pairs == null ? 0 : pairs.length,
  32763. toIteratee = getIteratee();
  32764. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32765. if (typeof pair[1] != 'function') {
  32766. throw new TypeError(FUNC_ERROR_TEXT);
  32767. }
  32768. return [toIteratee(pair[0]), pair[1]];
  32769. });
  32770. return baseRest(function(args) {
  32771. var index = -1;
  32772. while (++index < length) {
  32773. var pair = pairs[index];
  32774. if (apply(pair[0], this, args)) {
  32775. return apply(pair[1], this, args);
  32776. }
  32777. }
  32778. });
  32779. }
  32780. /**
  32781. * Creates a function that invokes the predicate properties of `source` with
  32782. * the corresponding property values of a given object, returning `true` if
  32783. * all predicates return truthy, else `false`.
  32784. *
  32785. * **Note:** The created function is equivalent to `_.conformsTo` with
  32786. * `source` partially applied.
  32787. *
  32788. * @static
  32789. * @memberOf _
  32790. * @since 4.0.0
  32791. * @category Util
  32792. * @param {Object} source The object of property predicates to conform to.
  32793. * @returns {Function} Returns the new spec function.
  32794. * @example
  32795. *
  32796. * var objects = [
  32797. * { 'a': 2, 'b': 1 },
  32798. * { 'a': 1, 'b': 2 }
  32799. * ];
  32800. *
  32801. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32802. * // => [{ 'a': 1, 'b': 2 }]
  32803. */
  32804. function conforms(source) {
  32805. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32806. }
  32807. /**
  32808. * Creates a function that returns `value`.
  32809. *
  32810. * @static
  32811. * @memberOf _
  32812. * @since 2.4.0
  32813. * @category Util
  32814. * @param {*} value The value to return from the new function.
  32815. * @returns {Function} Returns the new constant function.
  32816. * @example
  32817. *
  32818. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32819. *
  32820. * console.log(objects);
  32821. * // => [{ 'a': 1 }, { 'a': 1 }]
  32822. *
  32823. * console.log(objects[0] === objects[1]);
  32824. * // => true
  32825. */
  32826. function constant(value) {
  32827. return function() {
  32828. return value;
  32829. };
  32830. }
  32831. /**
  32832. * Checks `value` to determine whether a default value should be returned in
  32833. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32834. * or `undefined`.
  32835. *
  32836. * @static
  32837. * @memberOf _
  32838. * @since 4.14.0
  32839. * @category Util
  32840. * @param {*} value The value to check.
  32841. * @param {*} defaultValue The default value.
  32842. * @returns {*} Returns the resolved value.
  32843. * @example
  32844. *
  32845. * _.defaultTo(1, 10);
  32846. * // => 1
  32847. *
  32848. * _.defaultTo(undefined, 10);
  32849. * // => 10
  32850. */
  32851. function defaultTo(value, defaultValue) {
  32852. return (value == null || value !== value) ? defaultValue : value;
  32853. }
  32854. /**
  32855. * Creates a function that returns the result of invoking the given functions
  32856. * with the `this` binding of the created function, where each successive
  32857. * invocation is supplied the return value of the previous.
  32858. *
  32859. * @static
  32860. * @memberOf _
  32861. * @since 3.0.0
  32862. * @category Util
  32863. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32864. * @returns {Function} Returns the new composite function.
  32865. * @see _.flowRight
  32866. * @example
  32867. *
  32868. * function square(n) {
  32869. * return n * n;
  32870. * }
  32871. *
  32872. * var addSquare = _.flow([_.add, square]);
  32873. * addSquare(1, 2);
  32874. * // => 9
  32875. */
  32876. var flow = createFlow();
  32877. /**
  32878. * This method is like `_.flow` except that it creates a function that
  32879. * invokes the given functions from right to left.
  32880. *
  32881. * @static
  32882. * @since 3.0.0
  32883. * @memberOf _
  32884. * @category Util
  32885. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32886. * @returns {Function} Returns the new composite function.
  32887. * @see _.flow
  32888. * @example
  32889. *
  32890. * function square(n) {
  32891. * return n * n;
  32892. * }
  32893. *
  32894. * var addSquare = _.flowRight([square, _.add]);
  32895. * addSquare(1, 2);
  32896. * // => 9
  32897. */
  32898. var flowRight = createFlow(true);
  32899. /**
  32900. * This method returns the first argument it receives.
  32901. *
  32902. * @static
  32903. * @since 0.1.0
  32904. * @memberOf _
  32905. * @category Util
  32906. * @param {*} value Any value.
  32907. * @returns {*} Returns `value`.
  32908. * @example
  32909. *
  32910. * var object = { 'a': 1 };
  32911. *
  32912. * console.log(_.identity(object) === object);
  32913. * // => true
  32914. */
  32915. function identity(value) {
  32916. return value;
  32917. }
  32918. /**
  32919. * Creates a function that invokes `func` with the arguments of the created
  32920. * function. If `func` is a property name, the created function returns the
  32921. * property value for a given element. If `func` is an array or object, the
  32922. * created function returns `true` for elements that contain the equivalent
  32923. * source properties, otherwise it returns `false`.
  32924. *
  32925. * @static
  32926. * @since 4.0.0
  32927. * @memberOf _
  32928. * @category Util
  32929. * @param {*} [func=_.identity] The value to convert to a callback.
  32930. * @returns {Function} Returns the callback.
  32931. * @example
  32932. *
  32933. * var users = [
  32934. * { 'user': 'barney', 'age': 36, 'active': true },
  32935. * { 'user': 'fred', 'age': 40, 'active': false }
  32936. * ];
  32937. *
  32938. * // The `_.matches` iteratee shorthand.
  32939. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32940. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32941. *
  32942. * // The `_.matchesProperty` iteratee shorthand.
  32943. * _.filter(users, _.iteratee(['user', 'fred']));
  32944. * // => [{ 'user': 'fred', 'age': 40 }]
  32945. *
  32946. * // The `_.property` iteratee shorthand.
  32947. * _.map(users, _.iteratee('user'));
  32948. * // => ['barney', 'fred']
  32949. *
  32950. * // Create custom iteratee shorthands.
  32951. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32952. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32953. * return func.test(string);
  32954. * };
  32955. * });
  32956. *
  32957. * _.filter(['abc', 'def'], /ef/);
  32958. * // => ['def']
  32959. */
  32960. function iteratee(func) {
  32961. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32962. }
  32963. /**
  32964. * Creates a function that performs a partial deep comparison between a given
  32965. * object and `source`, returning `true` if the given object has equivalent
  32966. * property values, else `false`.
  32967. *
  32968. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32969. * partially applied.
  32970. *
  32971. * Partial comparisons will match empty array and empty object `source`
  32972. * values against any array or object value, respectively. See `_.isEqual`
  32973. * for a list of supported value comparisons.
  32974. *
  32975. * @static
  32976. * @memberOf _
  32977. * @since 3.0.0
  32978. * @category Util
  32979. * @param {Object} source The object of property values to match.
  32980. * @returns {Function} Returns the new spec function.
  32981. * @example
  32982. *
  32983. * var objects = [
  32984. * { 'a': 1, 'b': 2, 'c': 3 },
  32985. * { 'a': 4, 'b': 5, 'c': 6 }
  32986. * ];
  32987. *
  32988. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32989. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32990. */
  32991. function matches(source) {
  32992. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32993. }
  32994. /**
  32995. * Creates a function that performs a partial deep comparison between the
  32996. * value at `path` of a given object to `srcValue`, returning `true` if the
  32997. * object value is equivalent, else `false`.
  32998. *
  32999. * **Note:** Partial comparisons will match empty array and empty object
  33000. * `srcValue` values against any array or object value, respectively. See
  33001. * `_.isEqual` for a list of supported value comparisons.
  33002. *
  33003. * @static
  33004. * @memberOf _
  33005. * @since 3.2.0
  33006. * @category Util
  33007. * @param {Array|string} path The path of the property to get.
  33008. * @param {*} srcValue The value to match.
  33009. * @returns {Function} Returns the new spec function.
  33010. * @example
  33011. *
  33012. * var objects = [
  33013. * { 'a': 1, 'b': 2, 'c': 3 },
  33014. * { 'a': 4, 'b': 5, 'c': 6 }
  33015. * ];
  33016. *
  33017. * _.find(objects, _.matchesProperty('a', 4));
  33018. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33019. */
  33020. function matchesProperty(path, srcValue) {
  33021. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33022. }
  33023. /**
  33024. * Creates a function that invokes the method at `path` of a given object.
  33025. * Any additional arguments are provided to the invoked method.
  33026. *
  33027. * @static
  33028. * @memberOf _
  33029. * @since 3.7.0
  33030. * @category Util
  33031. * @param {Array|string} path The path of the method to invoke.
  33032. * @param {...*} [args] The arguments to invoke the method with.
  33033. * @returns {Function} Returns the new invoker function.
  33034. * @example
  33035. *
  33036. * var objects = [
  33037. * { 'a': { 'b': _.constant(2) } },
  33038. * { 'a': { 'b': _.constant(1) } }
  33039. * ];
  33040. *
  33041. * _.map(objects, _.method('a.b'));
  33042. * // => [2, 1]
  33043. *
  33044. * _.map(objects, _.method(['a', 'b']));
  33045. * // => [2, 1]
  33046. */
  33047. var method = baseRest(function(path, args) {
  33048. return function(object) {
  33049. return baseInvoke(object, path, args);
  33050. };
  33051. });
  33052. /**
  33053. * The opposite of `_.method`; this method creates a function that invokes
  33054. * the method at a given path of `object`. Any additional arguments are
  33055. * provided to the invoked method.
  33056. *
  33057. * @static
  33058. * @memberOf _
  33059. * @since 3.7.0
  33060. * @category Util
  33061. * @param {Object} object The object to query.
  33062. * @param {...*} [args] The arguments to invoke the method with.
  33063. * @returns {Function} Returns the new invoker function.
  33064. * @example
  33065. *
  33066. * var array = _.times(3, _.constant),
  33067. * object = { 'a': array, 'b': array, 'c': array };
  33068. *
  33069. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33070. * // => [2, 0]
  33071. *
  33072. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33073. * // => [2, 0]
  33074. */
  33075. var methodOf = baseRest(function(object, args) {
  33076. return function(path) {
  33077. return baseInvoke(object, path, args);
  33078. };
  33079. });
  33080. /**
  33081. * Adds all own enumerable string keyed function properties of a source
  33082. * object to the destination object. If `object` is a function, then methods
  33083. * are added to its prototype as well.
  33084. *
  33085. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33086. * avoid conflicts caused by modifying the original.
  33087. *
  33088. * @static
  33089. * @since 0.1.0
  33090. * @memberOf _
  33091. * @category Util
  33092. * @param {Function|Object} [object=lodash] The destination object.
  33093. * @param {Object} source The object of functions to add.
  33094. * @param {Object} [options={}] The options object.
  33095. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33096. * @returns {Function|Object} Returns `object`.
  33097. * @example
  33098. *
  33099. * function vowels(string) {
  33100. * return _.filter(string, function(v) {
  33101. * return /[aeiou]/i.test(v);
  33102. * });
  33103. * }
  33104. *
  33105. * _.mixin({ 'vowels': vowels });
  33106. * _.vowels('fred');
  33107. * // => ['e']
  33108. *
  33109. * _('fred').vowels().value();
  33110. * // => ['e']
  33111. *
  33112. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33113. * _('fred').vowels();
  33114. * // => ['e']
  33115. */
  33116. function mixin(object, source, options) {
  33117. var props = keys(source),
  33118. methodNames = baseFunctions(source, props);
  33119. if (options == null &&
  33120. !(isObject(source) && (methodNames.length || !props.length))) {
  33121. options = source;
  33122. source = object;
  33123. object = this;
  33124. methodNames = baseFunctions(source, keys(source));
  33125. }
  33126. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33127. isFunc = isFunction(object);
  33128. arrayEach(methodNames, function(methodName) {
  33129. var func = source[methodName];
  33130. object[methodName] = func;
  33131. if (isFunc) {
  33132. object.prototype[methodName] = function() {
  33133. var chainAll = this.__chain__;
  33134. if (chain || chainAll) {
  33135. var result = object(this.__wrapped__),
  33136. actions = result.__actions__ = copyArray(this.__actions__);
  33137. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33138. result.__chain__ = chainAll;
  33139. return result;
  33140. }
  33141. return func.apply(object, arrayPush([this.value()], arguments));
  33142. };
  33143. }
  33144. });
  33145. return object;
  33146. }
  33147. /**
  33148. * Reverts the `_` variable to its previous value and returns a reference to
  33149. * the `lodash` function.
  33150. *
  33151. * @static
  33152. * @since 0.1.0
  33153. * @memberOf _
  33154. * @category Util
  33155. * @returns {Function} Returns the `lodash` function.
  33156. * @example
  33157. *
  33158. * var lodash = _.noConflict();
  33159. */
  33160. function noConflict() {
  33161. if (root._ === this) {
  33162. root._ = oldDash;
  33163. }
  33164. return this;
  33165. }
  33166. /**
  33167. * This method returns `undefined`.
  33168. *
  33169. * @static
  33170. * @memberOf _
  33171. * @since 2.3.0
  33172. * @category Util
  33173. * @example
  33174. *
  33175. * _.times(2, _.noop);
  33176. * // => [undefined, undefined]
  33177. */
  33178. function noop() {
  33179. // No operation performed.
  33180. }
  33181. /**
  33182. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33183. * the nth argument from the end is returned.
  33184. *
  33185. * @static
  33186. * @memberOf _
  33187. * @since 4.0.0
  33188. * @category Util
  33189. * @param {number} [n=0] The index of the argument to return.
  33190. * @returns {Function} Returns the new pass-thru function.
  33191. * @example
  33192. *
  33193. * var func = _.nthArg(1);
  33194. * func('a', 'b', 'c', 'd');
  33195. * // => 'b'
  33196. *
  33197. * var func = _.nthArg(-2);
  33198. * func('a', 'b', 'c', 'd');
  33199. * // => 'c'
  33200. */
  33201. function nthArg(n) {
  33202. n = toInteger(n);
  33203. return baseRest(function(args) {
  33204. return baseNth(args, n);
  33205. });
  33206. }
  33207. /**
  33208. * Creates a function that invokes `iteratees` with the arguments it receives
  33209. * and returns their results.
  33210. *
  33211. * @static
  33212. * @memberOf _
  33213. * @since 4.0.0
  33214. * @category Util
  33215. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33216. * The iteratees to invoke.
  33217. * @returns {Function} Returns the new function.
  33218. * @example
  33219. *
  33220. * var func = _.over([Math.max, Math.min]);
  33221. *
  33222. * func(1, 2, 3, 4);
  33223. * // => [4, 1]
  33224. */
  33225. var over = createOver(arrayMap);
  33226. /**
  33227. * Creates a function that checks if **all** of the `predicates` return
  33228. * truthy when invoked with the arguments it receives.
  33229. *
  33230. * @static
  33231. * @memberOf _
  33232. * @since 4.0.0
  33233. * @category Util
  33234. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33235. * The predicates to check.
  33236. * @returns {Function} Returns the new function.
  33237. * @example
  33238. *
  33239. * var func = _.overEvery([Boolean, isFinite]);
  33240. *
  33241. * func('1');
  33242. * // => true
  33243. *
  33244. * func(null);
  33245. * // => false
  33246. *
  33247. * func(NaN);
  33248. * // => false
  33249. */
  33250. var overEvery = createOver(arrayEvery);
  33251. /**
  33252. * Creates a function that checks if **any** of the `predicates` return
  33253. * truthy when invoked with the arguments it receives.
  33254. *
  33255. * @static
  33256. * @memberOf _
  33257. * @since 4.0.0
  33258. * @category Util
  33259. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33260. * The predicates to check.
  33261. * @returns {Function} Returns the new function.
  33262. * @example
  33263. *
  33264. * var func = _.overSome([Boolean, isFinite]);
  33265. *
  33266. * func('1');
  33267. * // => true
  33268. *
  33269. * func(null);
  33270. * // => true
  33271. *
  33272. * func(NaN);
  33273. * // => false
  33274. */
  33275. var overSome = createOver(arraySome);
  33276. /**
  33277. * Creates a function that returns the value at `path` of a given object.
  33278. *
  33279. * @static
  33280. * @memberOf _
  33281. * @since 2.4.0
  33282. * @category Util
  33283. * @param {Array|string} path The path of the property to get.
  33284. * @returns {Function} Returns the new accessor function.
  33285. * @example
  33286. *
  33287. * var objects = [
  33288. * { 'a': { 'b': 2 } },
  33289. * { 'a': { 'b': 1 } }
  33290. * ];
  33291. *
  33292. * _.map(objects, _.property('a.b'));
  33293. * // => [2, 1]
  33294. *
  33295. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33296. * // => [1, 2]
  33297. */
  33298. function property(path) {
  33299. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33300. }
  33301. /**
  33302. * The opposite of `_.property`; this method creates a function that returns
  33303. * the value at a given path of `object`.
  33304. *
  33305. * @static
  33306. * @memberOf _
  33307. * @since 3.0.0
  33308. * @category Util
  33309. * @param {Object} object The object to query.
  33310. * @returns {Function} Returns the new accessor function.
  33311. * @example
  33312. *
  33313. * var array = [0, 1, 2],
  33314. * object = { 'a': array, 'b': array, 'c': array };
  33315. *
  33316. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33317. * // => [2, 0]
  33318. *
  33319. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33320. * // => [2, 0]
  33321. */
  33322. function propertyOf(object) {
  33323. return function(path) {
  33324. return object == null ? undefined : baseGet(object, path);
  33325. };
  33326. }
  33327. /**
  33328. * Creates an array of numbers (positive and/or negative) progressing from
  33329. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33330. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33331. * it's set to `start` with `start` then set to `0`.
  33332. *
  33333. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33334. * floating-point values which can produce unexpected results.
  33335. *
  33336. * @static
  33337. * @since 0.1.0
  33338. * @memberOf _
  33339. * @category Util
  33340. * @param {number} [start=0] The start of the range.
  33341. * @param {number} end The end of the range.
  33342. * @param {number} [step=1] The value to increment or decrement by.
  33343. * @returns {Array} Returns the range of numbers.
  33344. * @see _.inRange, _.rangeRight
  33345. * @example
  33346. *
  33347. * _.range(4);
  33348. * // => [0, 1, 2, 3]
  33349. *
  33350. * _.range(-4);
  33351. * // => [0, -1, -2, -3]
  33352. *
  33353. * _.range(1, 5);
  33354. * // => [1, 2, 3, 4]
  33355. *
  33356. * _.range(0, 20, 5);
  33357. * // => [0, 5, 10, 15]
  33358. *
  33359. * _.range(0, -4, -1);
  33360. * // => [0, -1, -2, -3]
  33361. *
  33362. * _.range(1, 4, 0);
  33363. * // => [1, 1, 1]
  33364. *
  33365. * _.range(0);
  33366. * // => []
  33367. */
  33368. var range = createRange();
  33369. /**
  33370. * This method is like `_.range` except that it populates values in
  33371. * descending order.
  33372. *
  33373. * @static
  33374. * @memberOf _
  33375. * @since 4.0.0
  33376. * @category Util
  33377. * @param {number} [start=0] The start of the range.
  33378. * @param {number} end The end of the range.
  33379. * @param {number} [step=1] The value to increment or decrement by.
  33380. * @returns {Array} Returns the range of numbers.
  33381. * @see _.inRange, _.range
  33382. * @example
  33383. *
  33384. * _.rangeRight(4);
  33385. * // => [3, 2, 1, 0]
  33386. *
  33387. * _.rangeRight(-4);
  33388. * // => [-3, -2, -1, 0]
  33389. *
  33390. * _.rangeRight(1, 5);
  33391. * // => [4, 3, 2, 1]
  33392. *
  33393. * _.rangeRight(0, 20, 5);
  33394. * // => [15, 10, 5, 0]
  33395. *
  33396. * _.rangeRight(0, -4, -1);
  33397. * // => [-3, -2, -1, 0]
  33398. *
  33399. * _.rangeRight(1, 4, 0);
  33400. * // => [1, 1, 1]
  33401. *
  33402. * _.rangeRight(0);
  33403. * // => []
  33404. */
  33405. var rangeRight = createRange(true);
  33406. /**
  33407. * This method returns a new empty array.
  33408. *
  33409. * @static
  33410. * @memberOf _
  33411. * @since 4.13.0
  33412. * @category Util
  33413. * @returns {Array} Returns the new empty array.
  33414. * @example
  33415. *
  33416. * var arrays = _.times(2, _.stubArray);
  33417. *
  33418. * console.log(arrays);
  33419. * // => [[], []]
  33420. *
  33421. * console.log(arrays[0] === arrays[1]);
  33422. * // => false
  33423. */
  33424. function stubArray() {
  33425. return [];
  33426. }
  33427. /**
  33428. * This method returns `false`.
  33429. *
  33430. * @static
  33431. * @memberOf _
  33432. * @since 4.13.0
  33433. * @category Util
  33434. * @returns {boolean} Returns `false`.
  33435. * @example
  33436. *
  33437. * _.times(2, _.stubFalse);
  33438. * // => [false, false]
  33439. */
  33440. function stubFalse() {
  33441. return false;
  33442. }
  33443. /**
  33444. * This method returns a new empty object.
  33445. *
  33446. * @static
  33447. * @memberOf _
  33448. * @since 4.13.0
  33449. * @category Util
  33450. * @returns {Object} Returns the new empty object.
  33451. * @example
  33452. *
  33453. * var objects = _.times(2, _.stubObject);
  33454. *
  33455. * console.log(objects);
  33456. * // => [{}, {}]
  33457. *
  33458. * console.log(objects[0] === objects[1]);
  33459. * // => false
  33460. */
  33461. function stubObject() {
  33462. return {};
  33463. }
  33464. /**
  33465. * This method returns an empty string.
  33466. *
  33467. * @static
  33468. * @memberOf _
  33469. * @since 4.13.0
  33470. * @category Util
  33471. * @returns {string} Returns the empty string.
  33472. * @example
  33473. *
  33474. * _.times(2, _.stubString);
  33475. * // => ['', '']
  33476. */
  33477. function stubString() {
  33478. return '';
  33479. }
  33480. /**
  33481. * This method returns `true`.
  33482. *
  33483. * @static
  33484. * @memberOf _
  33485. * @since 4.13.0
  33486. * @category Util
  33487. * @returns {boolean} Returns `true`.
  33488. * @example
  33489. *
  33490. * _.times(2, _.stubTrue);
  33491. * // => [true, true]
  33492. */
  33493. function stubTrue() {
  33494. return true;
  33495. }
  33496. /**
  33497. * Invokes the iteratee `n` times, returning an array of the results of
  33498. * each invocation. The iteratee is invoked with one argument; (index).
  33499. *
  33500. * @static
  33501. * @since 0.1.0
  33502. * @memberOf _
  33503. * @category Util
  33504. * @param {number} n The number of times to invoke `iteratee`.
  33505. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33506. * @returns {Array} Returns the array of results.
  33507. * @example
  33508. *
  33509. * _.times(3, String);
  33510. * // => ['0', '1', '2']
  33511. *
  33512. * _.times(4, _.constant(0));
  33513. * // => [0, 0, 0, 0]
  33514. */
  33515. function times(n, iteratee) {
  33516. n = toInteger(n);
  33517. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33518. return [];
  33519. }
  33520. var index = MAX_ARRAY_LENGTH,
  33521. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33522. iteratee = getIteratee(iteratee);
  33523. n -= MAX_ARRAY_LENGTH;
  33524. var result = baseTimes(length, iteratee);
  33525. while (++index < n) {
  33526. iteratee(index);
  33527. }
  33528. return result;
  33529. }
  33530. /**
  33531. * Converts `value` to a property path array.
  33532. *
  33533. * @static
  33534. * @memberOf _
  33535. * @since 4.0.0
  33536. * @category Util
  33537. * @param {*} value The value to convert.
  33538. * @returns {Array} Returns the new property path array.
  33539. * @example
  33540. *
  33541. * _.toPath('a.b.c');
  33542. * // => ['a', 'b', 'c']
  33543. *
  33544. * _.toPath('a[0].b.c');
  33545. * // => ['a', '0', 'b', 'c']
  33546. */
  33547. function toPath(value) {
  33548. if (isArray(value)) {
  33549. return arrayMap(value, toKey);
  33550. }
  33551. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33552. }
  33553. /**
  33554. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33555. *
  33556. * @static
  33557. * @since 0.1.0
  33558. * @memberOf _
  33559. * @category Util
  33560. * @param {string} [prefix=''] The value to prefix the ID with.
  33561. * @returns {string} Returns the unique ID.
  33562. * @example
  33563. *
  33564. * _.uniqueId('contact_');
  33565. * // => 'contact_104'
  33566. *
  33567. * _.uniqueId();
  33568. * // => '105'
  33569. */
  33570. function uniqueId(prefix) {
  33571. var id = ++idCounter;
  33572. return toString(prefix) + id;
  33573. }
  33574. /*------------------------------------------------------------------------*/
  33575. /**
  33576. * Adds two numbers.
  33577. *
  33578. * @static
  33579. * @memberOf _
  33580. * @since 3.4.0
  33581. * @category Math
  33582. * @param {number} augend The first number in an addition.
  33583. * @param {number} addend The second number in an addition.
  33584. * @returns {number} Returns the total.
  33585. * @example
  33586. *
  33587. * _.add(6, 4);
  33588. * // => 10
  33589. */
  33590. var add = createMathOperation(function(augend, addend) {
  33591. return augend + addend;
  33592. }, 0);
  33593. /**
  33594. * Computes `number` rounded up to `precision`.
  33595. *
  33596. * @static
  33597. * @memberOf _
  33598. * @since 3.10.0
  33599. * @category Math
  33600. * @param {number} number The number to round up.
  33601. * @param {number} [precision=0] The precision to round up to.
  33602. * @returns {number} Returns the rounded up number.
  33603. * @example
  33604. *
  33605. * _.ceil(4.006);
  33606. * // => 5
  33607. *
  33608. * _.ceil(6.004, 2);
  33609. * // => 6.01
  33610. *
  33611. * _.ceil(6040, -2);
  33612. * // => 6100
  33613. */
  33614. var ceil = createRound('ceil');
  33615. /**
  33616. * Divide two numbers.
  33617. *
  33618. * @static
  33619. * @memberOf _
  33620. * @since 4.7.0
  33621. * @category Math
  33622. * @param {number} dividend The first number in a division.
  33623. * @param {number} divisor The second number in a division.
  33624. * @returns {number} Returns the quotient.
  33625. * @example
  33626. *
  33627. * _.divide(6, 4);
  33628. * // => 1.5
  33629. */
  33630. var divide = createMathOperation(function(dividend, divisor) {
  33631. return dividend / divisor;
  33632. }, 1);
  33633. /**
  33634. * Computes `number` rounded down to `precision`.
  33635. *
  33636. * @static
  33637. * @memberOf _
  33638. * @since 3.10.0
  33639. * @category Math
  33640. * @param {number} number The number to round down.
  33641. * @param {number} [precision=0] The precision to round down to.
  33642. * @returns {number} Returns the rounded down number.
  33643. * @example
  33644. *
  33645. * _.floor(4.006);
  33646. * // => 4
  33647. *
  33648. * _.floor(0.046, 2);
  33649. * // => 0.04
  33650. *
  33651. * _.floor(4060, -2);
  33652. * // => 4000
  33653. */
  33654. var floor = createRound('floor');
  33655. /**
  33656. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33657. * `undefined` is returned.
  33658. *
  33659. * @static
  33660. * @since 0.1.0
  33661. * @memberOf _
  33662. * @category Math
  33663. * @param {Array} array The array to iterate over.
  33664. * @returns {*} Returns the maximum value.
  33665. * @example
  33666. *
  33667. * _.max([4, 2, 8, 6]);
  33668. * // => 8
  33669. *
  33670. * _.max([]);
  33671. * // => undefined
  33672. */
  33673. function max(array) {
  33674. return (array && array.length)
  33675. ? baseExtremum(array, identity, baseGt)
  33676. : undefined;
  33677. }
  33678. /**
  33679. * This method is like `_.max` except that it accepts `iteratee` which is
  33680. * invoked for each element in `array` to generate the criterion by which
  33681. * the value is ranked. The iteratee is invoked with one argument: (value).
  33682. *
  33683. * @static
  33684. * @memberOf _
  33685. * @since 4.0.0
  33686. * @category Math
  33687. * @param {Array} array The array to iterate over.
  33688. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33689. * @returns {*} Returns the maximum value.
  33690. * @example
  33691. *
  33692. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33693. *
  33694. * _.maxBy(objects, function(o) { return o.n; });
  33695. * // => { 'n': 2 }
  33696. *
  33697. * // The `_.property` iteratee shorthand.
  33698. * _.maxBy(objects, 'n');
  33699. * // => { 'n': 2 }
  33700. */
  33701. function maxBy(array, iteratee) {
  33702. return (array && array.length)
  33703. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33704. : undefined;
  33705. }
  33706. /**
  33707. * Computes the mean of the values in `array`.
  33708. *
  33709. * @static
  33710. * @memberOf _
  33711. * @since 4.0.0
  33712. * @category Math
  33713. * @param {Array} array The array to iterate over.
  33714. * @returns {number} Returns the mean.
  33715. * @example
  33716. *
  33717. * _.mean([4, 2, 8, 6]);
  33718. * // => 5
  33719. */
  33720. function mean(array) {
  33721. return baseMean(array, identity);
  33722. }
  33723. /**
  33724. * This method is like `_.mean` except that it accepts `iteratee` which is
  33725. * invoked for each element in `array` to generate the value to be averaged.
  33726. * The iteratee is invoked with one argument: (value).
  33727. *
  33728. * @static
  33729. * @memberOf _
  33730. * @since 4.7.0
  33731. * @category Math
  33732. * @param {Array} array The array to iterate over.
  33733. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33734. * @returns {number} Returns the mean.
  33735. * @example
  33736. *
  33737. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33738. *
  33739. * _.meanBy(objects, function(o) { return o.n; });
  33740. * // => 5
  33741. *
  33742. * // The `_.property` iteratee shorthand.
  33743. * _.meanBy(objects, 'n');
  33744. * // => 5
  33745. */
  33746. function meanBy(array, iteratee) {
  33747. return baseMean(array, getIteratee(iteratee, 2));
  33748. }
  33749. /**
  33750. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33751. * `undefined` is returned.
  33752. *
  33753. * @static
  33754. * @since 0.1.0
  33755. * @memberOf _
  33756. * @category Math
  33757. * @param {Array} array The array to iterate over.
  33758. * @returns {*} Returns the minimum value.
  33759. * @example
  33760. *
  33761. * _.min([4, 2, 8, 6]);
  33762. * // => 2
  33763. *
  33764. * _.min([]);
  33765. * // => undefined
  33766. */
  33767. function min(array) {
  33768. return (array && array.length)
  33769. ? baseExtremum(array, identity, baseLt)
  33770. : undefined;
  33771. }
  33772. /**
  33773. * This method is like `_.min` except that it accepts `iteratee` which is
  33774. * invoked for each element in `array` to generate the criterion by which
  33775. * the value is ranked. The iteratee is invoked with one argument: (value).
  33776. *
  33777. * @static
  33778. * @memberOf _
  33779. * @since 4.0.0
  33780. * @category Math
  33781. * @param {Array} array The array to iterate over.
  33782. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33783. * @returns {*} Returns the minimum value.
  33784. * @example
  33785. *
  33786. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33787. *
  33788. * _.minBy(objects, function(o) { return o.n; });
  33789. * // => { 'n': 1 }
  33790. *
  33791. * // The `_.property` iteratee shorthand.
  33792. * _.minBy(objects, 'n');
  33793. * // => { 'n': 1 }
  33794. */
  33795. function minBy(array, iteratee) {
  33796. return (array && array.length)
  33797. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33798. : undefined;
  33799. }
  33800. /**
  33801. * Multiply two numbers.
  33802. *
  33803. * @static
  33804. * @memberOf _
  33805. * @since 4.7.0
  33806. * @category Math
  33807. * @param {number} multiplier The first number in a multiplication.
  33808. * @param {number} multiplicand The second number in a multiplication.
  33809. * @returns {number} Returns the product.
  33810. * @example
  33811. *
  33812. * _.multiply(6, 4);
  33813. * // => 24
  33814. */
  33815. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33816. return multiplier * multiplicand;
  33817. }, 1);
  33818. /**
  33819. * Computes `number` rounded to `precision`.
  33820. *
  33821. * @static
  33822. * @memberOf _
  33823. * @since 3.10.0
  33824. * @category Math
  33825. * @param {number} number The number to round.
  33826. * @param {number} [precision=0] The precision to round to.
  33827. * @returns {number} Returns the rounded number.
  33828. * @example
  33829. *
  33830. * _.round(4.006);
  33831. * // => 4
  33832. *
  33833. * _.round(4.006, 2);
  33834. * // => 4.01
  33835. *
  33836. * _.round(4060, -2);
  33837. * // => 4100
  33838. */
  33839. var round = createRound('round');
  33840. /**
  33841. * Subtract two numbers.
  33842. *
  33843. * @static
  33844. * @memberOf _
  33845. * @since 4.0.0
  33846. * @category Math
  33847. * @param {number} minuend The first number in a subtraction.
  33848. * @param {number} subtrahend The second number in a subtraction.
  33849. * @returns {number} Returns the difference.
  33850. * @example
  33851. *
  33852. * _.subtract(6, 4);
  33853. * // => 2
  33854. */
  33855. var subtract = createMathOperation(function(minuend, subtrahend) {
  33856. return minuend - subtrahend;
  33857. }, 0);
  33858. /**
  33859. * Computes the sum of the values in `array`.
  33860. *
  33861. * @static
  33862. * @memberOf _
  33863. * @since 3.4.0
  33864. * @category Math
  33865. * @param {Array} array The array to iterate over.
  33866. * @returns {number} Returns the sum.
  33867. * @example
  33868. *
  33869. * _.sum([4, 2, 8, 6]);
  33870. * // => 20
  33871. */
  33872. function sum(array) {
  33873. return (array && array.length)
  33874. ? baseSum(array, identity)
  33875. : 0;
  33876. }
  33877. /**
  33878. * This method is like `_.sum` except that it accepts `iteratee` which is
  33879. * invoked for each element in `array` to generate the value to be summed.
  33880. * The iteratee is invoked with one argument: (value).
  33881. *
  33882. * @static
  33883. * @memberOf _
  33884. * @since 4.0.0
  33885. * @category Math
  33886. * @param {Array} array The array to iterate over.
  33887. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33888. * @returns {number} Returns the sum.
  33889. * @example
  33890. *
  33891. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33892. *
  33893. * _.sumBy(objects, function(o) { return o.n; });
  33894. * // => 20
  33895. *
  33896. * // The `_.property` iteratee shorthand.
  33897. * _.sumBy(objects, 'n');
  33898. * // => 20
  33899. */
  33900. function sumBy(array, iteratee) {
  33901. return (array && array.length)
  33902. ? baseSum(array, getIteratee(iteratee, 2))
  33903. : 0;
  33904. }
  33905. /*------------------------------------------------------------------------*/
  33906. // Add methods that return wrapped values in chain sequences.
  33907. lodash.after = after;
  33908. lodash.ary = ary;
  33909. lodash.assign = assign;
  33910. lodash.assignIn = assignIn;
  33911. lodash.assignInWith = assignInWith;
  33912. lodash.assignWith = assignWith;
  33913. lodash.at = at;
  33914. lodash.before = before;
  33915. lodash.bind = bind;
  33916. lodash.bindAll = bindAll;
  33917. lodash.bindKey = bindKey;
  33918. lodash.castArray = castArray;
  33919. lodash.chain = chain;
  33920. lodash.chunk = chunk;
  33921. lodash.compact = compact;
  33922. lodash.concat = concat;
  33923. lodash.cond = cond;
  33924. lodash.conforms = conforms;
  33925. lodash.constant = constant;
  33926. lodash.countBy = countBy;
  33927. lodash.create = create;
  33928. lodash.curry = curry;
  33929. lodash.curryRight = curryRight;
  33930. lodash.debounce = debounce;
  33931. lodash.defaults = defaults;
  33932. lodash.defaultsDeep = defaultsDeep;
  33933. lodash.defer = defer;
  33934. lodash.delay = delay;
  33935. lodash.difference = difference;
  33936. lodash.differenceBy = differenceBy;
  33937. lodash.differenceWith = differenceWith;
  33938. lodash.drop = drop;
  33939. lodash.dropRight = dropRight;
  33940. lodash.dropRightWhile = dropRightWhile;
  33941. lodash.dropWhile = dropWhile;
  33942. lodash.fill = fill;
  33943. lodash.filter = filter;
  33944. lodash.flatMap = flatMap;
  33945. lodash.flatMapDeep = flatMapDeep;
  33946. lodash.flatMapDepth = flatMapDepth;
  33947. lodash.flatten = flatten;
  33948. lodash.flattenDeep = flattenDeep;
  33949. lodash.flattenDepth = flattenDepth;
  33950. lodash.flip = flip;
  33951. lodash.flow = flow;
  33952. lodash.flowRight = flowRight;
  33953. lodash.fromPairs = fromPairs;
  33954. lodash.functions = functions;
  33955. lodash.functionsIn = functionsIn;
  33956. lodash.groupBy = groupBy;
  33957. lodash.initial = initial;
  33958. lodash.intersection = intersection;
  33959. lodash.intersectionBy = intersectionBy;
  33960. lodash.intersectionWith = intersectionWith;
  33961. lodash.invert = invert;
  33962. lodash.invertBy = invertBy;
  33963. lodash.invokeMap = invokeMap;
  33964. lodash.iteratee = iteratee;
  33965. lodash.keyBy = keyBy;
  33966. lodash.keys = keys;
  33967. lodash.keysIn = keysIn;
  33968. lodash.map = map;
  33969. lodash.mapKeys = mapKeys;
  33970. lodash.mapValues = mapValues;
  33971. lodash.matches = matches;
  33972. lodash.matchesProperty = matchesProperty;
  33973. lodash.memoize = memoize;
  33974. lodash.merge = merge;
  33975. lodash.mergeWith = mergeWith;
  33976. lodash.method = method;
  33977. lodash.methodOf = methodOf;
  33978. lodash.mixin = mixin;
  33979. lodash.negate = negate;
  33980. lodash.nthArg = nthArg;
  33981. lodash.omit = omit;
  33982. lodash.omitBy = omitBy;
  33983. lodash.once = once;
  33984. lodash.orderBy = orderBy;
  33985. lodash.over = over;
  33986. lodash.overArgs = overArgs;
  33987. lodash.overEvery = overEvery;
  33988. lodash.overSome = overSome;
  33989. lodash.partial = partial;
  33990. lodash.partialRight = partialRight;
  33991. lodash.partition = partition;
  33992. lodash.pick = pick;
  33993. lodash.pickBy = pickBy;
  33994. lodash.property = property;
  33995. lodash.propertyOf = propertyOf;
  33996. lodash.pull = pull;
  33997. lodash.pullAll = pullAll;
  33998. lodash.pullAllBy = pullAllBy;
  33999. lodash.pullAllWith = pullAllWith;
  34000. lodash.pullAt = pullAt;
  34001. lodash.range = range;
  34002. lodash.rangeRight = rangeRight;
  34003. lodash.rearg = rearg;
  34004. lodash.reject = reject;
  34005. lodash.remove = remove;
  34006. lodash.rest = rest;
  34007. lodash.reverse = reverse;
  34008. lodash.sampleSize = sampleSize;
  34009. lodash.set = set;
  34010. lodash.setWith = setWith;
  34011. lodash.shuffle = shuffle;
  34012. lodash.slice = slice;
  34013. lodash.sortBy = sortBy;
  34014. lodash.sortedUniq = sortedUniq;
  34015. lodash.sortedUniqBy = sortedUniqBy;
  34016. lodash.split = split;
  34017. lodash.spread = spread;
  34018. lodash.tail = tail;
  34019. lodash.take = take;
  34020. lodash.takeRight = takeRight;
  34021. lodash.takeRightWhile = takeRightWhile;
  34022. lodash.takeWhile = takeWhile;
  34023. lodash.tap = tap;
  34024. lodash.throttle = throttle;
  34025. lodash.thru = thru;
  34026. lodash.toArray = toArray;
  34027. lodash.toPairs = toPairs;
  34028. lodash.toPairsIn = toPairsIn;
  34029. lodash.toPath = toPath;
  34030. lodash.toPlainObject = toPlainObject;
  34031. lodash.transform = transform;
  34032. lodash.unary = unary;
  34033. lodash.union = union;
  34034. lodash.unionBy = unionBy;
  34035. lodash.unionWith = unionWith;
  34036. lodash.uniq = uniq;
  34037. lodash.uniqBy = uniqBy;
  34038. lodash.uniqWith = uniqWith;
  34039. lodash.unset = unset;
  34040. lodash.unzip = unzip;
  34041. lodash.unzipWith = unzipWith;
  34042. lodash.update = update;
  34043. lodash.updateWith = updateWith;
  34044. lodash.values = values;
  34045. lodash.valuesIn = valuesIn;
  34046. lodash.without = without;
  34047. lodash.words = words;
  34048. lodash.wrap = wrap;
  34049. lodash.xor = xor;
  34050. lodash.xorBy = xorBy;
  34051. lodash.xorWith = xorWith;
  34052. lodash.zip = zip;
  34053. lodash.zipObject = zipObject;
  34054. lodash.zipObjectDeep = zipObjectDeep;
  34055. lodash.zipWith = zipWith;
  34056. // Add aliases.
  34057. lodash.entries = toPairs;
  34058. lodash.entriesIn = toPairsIn;
  34059. lodash.extend = assignIn;
  34060. lodash.extendWith = assignInWith;
  34061. // Add methods to `lodash.prototype`.
  34062. mixin(lodash, lodash);
  34063. /*------------------------------------------------------------------------*/
  34064. // Add methods that return unwrapped values in chain sequences.
  34065. lodash.add = add;
  34066. lodash.attempt = attempt;
  34067. lodash.camelCase = camelCase;
  34068. lodash.capitalize = capitalize;
  34069. lodash.ceil = ceil;
  34070. lodash.clamp = clamp;
  34071. lodash.clone = clone;
  34072. lodash.cloneDeep = cloneDeep;
  34073. lodash.cloneDeepWith = cloneDeepWith;
  34074. lodash.cloneWith = cloneWith;
  34075. lodash.conformsTo = conformsTo;
  34076. lodash.deburr = deburr;
  34077. lodash.defaultTo = defaultTo;
  34078. lodash.divide = divide;
  34079. lodash.endsWith = endsWith;
  34080. lodash.eq = eq;
  34081. lodash.escape = escape;
  34082. lodash.escapeRegExp = escapeRegExp;
  34083. lodash.every = every;
  34084. lodash.find = find;
  34085. lodash.findIndex = findIndex;
  34086. lodash.findKey = findKey;
  34087. lodash.findLast = findLast;
  34088. lodash.findLastIndex = findLastIndex;
  34089. lodash.findLastKey = findLastKey;
  34090. lodash.floor = floor;
  34091. lodash.forEach = forEach;
  34092. lodash.forEachRight = forEachRight;
  34093. lodash.forIn = forIn;
  34094. lodash.forInRight = forInRight;
  34095. lodash.forOwn = forOwn;
  34096. lodash.forOwnRight = forOwnRight;
  34097. lodash.get = get;
  34098. lodash.gt = gt;
  34099. lodash.gte = gte;
  34100. lodash.has = has;
  34101. lodash.hasIn = hasIn;
  34102. lodash.head = head;
  34103. lodash.identity = identity;
  34104. lodash.includes = includes;
  34105. lodash.indexOf = indexOf;
  34106. lodash.inRange = inRange;
  34107. lodash.invoke = invoke;
  34108. lodash.isArguments = isArguments;
  34109. lodash.isArray = isArray;
  34110. lodash.isArrayBuffer = isArrayBuffer;
  34111. lodash.isArrayLike = isArrayLike;
  34112. lodash.isArrayLikeObject = isArrayLikeObject;
  34113. lodash.isBoolean = isBoolean;
  34114. lodash.isBuffer = isBuffer;
  34115. lodash.isDate = isDate;
  34116. lodash.isElement = isElement;
  34117. lodash.isEmpty = isEmpty;
  34118. lodash.isEqual = isEqual;
  34119. lodash.isEqualWith = isEqualWith;
  34120. lodash.isError = isError;
  34121. lodash.isFinite = isFinite;
  34122. lodash.isFunction = isFunction;
  34123. lodash.isInteger = isInteger;
  34124. lodash.isLength = isLength;
  34125. lodash.isMap = isMap;
  34126. lodash.isMatch = isMatch;
  34127. lodash.isMatchWith = isMatchWith;
  34128. lodash.isNaN = isNaN;
  34129. lodash.isNative = isNative;
  34130. lodash.isNil = isNil;
  34131. lodash.isNull = isNull;
  34132. lodash.isNumber = isNumber;
  34133. lodash.isObject = isObject;
  34134. lodash.isObjectLike = isObjectLike;
  34135. lodash.isPlainObject = isPlainObject;
  34136. lodash.isRegExp = isRegExp;
  34137. lodash.isSafeInteger = isSafeInteger;
  34138. lodash.isSet = isSet;
  34139. lodash.isString = isString;
  34140. lodash.isSymbol = isSymbol;
  34141. lodash.isTypedArray = isTypedArray;
  34142. lodash.isUndefined = isUndefined;
  34143. lodash.isWeakMap = isWeakMap;
  34144. lodash.isWeakSet = isWeakSet;
  34145. lodash.join = join;
  34146. lodash.kebabCase = kebabCase;
  34147. lodash.last = last;
  34148. lodash.lastIndexOf = lastIndexOf;
  34149. lodash.lowerCase = lowerCase;
  34150. lodash.lowerFirst = lowerFirst;
  34151. lodash.lt = lt;
  34152. lodash.lte = lte;
  34153. lodash.max = max;
  34154. lodash.maxBy = maxBy;
  34155. lodash.mean = mean;
  34156. lodash.meanBy = meanBy;
  34157. lodash.min = min;
  34158. lodash.minBy = minBy;
  34159. lodash.stubArray = stubArray;
  34160. lodash.stubFalse = stubFalse;
  34161. lodash.stubObject = stubObject;
  34162. lodash.stubString = stubString;
  34163. lodash.stubTrue = stubTrue;
  34164. lodash.multiply = multiply;
  34165. lodash.nth = nth;
  34166. lodash.noConflict = noConflict;
  34167. lodash.noop = noop;
  34168. lodash.now = now;
  34169. lodash.pad = pad;
  34170. lodash.padEnd = padEnd;
  34171. lodash.padStart = padStart;
  34172. lodash.parseInt = parseInt;
  34173. lodash.random = random;
  34174. lodash.reduce = reduce;
  34175. lodash.reduceRight = reduceRight;
  34176. lodash.repeat = repeat;
  34177. lodash.replace = replace;
  34178. lodash.result = result;
  34179. lodash.round = round;
  34180. lodash.runInContext = runInContext;
  34181. lodash.sample = sample;
  34182. lodash.size = size;
  34183. lodash.snakeCase = snakeCase;
  34184. lodash.some = some;
  34185. lodash.sortedIndex = sortedIndex;
  34186. lodash.sortedIndexBy = sortedIndexBy;
  34187. lodash.sortedIndexOf = sortedIndexOf;
  34188. lodash.sortedLastIndex = sortedLastIndex;
  34189. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34190. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34191. lodash.startCase = startCase;
  34192. lodash.startsWith = startsWith;
  34193. lodash.subtract = subtract;
  34194. lodash.sum = sum;
  34195. lodash.sumBy = sumBy;
  34196. lodash.template = template;
  34197. lodash.times = times;
  34198. lodash.toFinite = toFinite;
  34199. lodash.toInteger = toInteger;
  34200. lodash.toLength = toLength;
  34201. lodash.toLower = toLower;
  34202. lodash.toNumber = toNumber;
  34203. lodash.toSafeInteger = toSafeInteger;
  34204. lodash.toString = toString;
  34205. lodash.toUpper = toUpper;
  34206. lodash.trim = trim;
  34207. lodash.trimEnd = trimEnd;
  34208. lodash.trimStart = trimStart;
  34209. lodash.truncate = truncate;
  34210. lodash.unescape = unescape;
  34211. lodash.uniqueId = uniqueId;
  34212. lodash.upperCase = upperCase;
  34213. lodash.upperFirst = upperFirst;
  34214. // Add aliases.
  34215. lodash.each = forEach;
  34216. lodash.eachRight = forEachRight;
  34217. lodash.first = head;
  34218. mixin(lodash, (function() {
  34219. var source = {};
  34220. baseForOwn(lodash, function(func, methodName) {
  34221. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34222. source[methodName] = func;
  34223. }
  34224. });
  34225. return source;
  34226. }()), { 'chain': false });
  34227. /*------------------------------------------------------------------------*/
  34228. /**
  34229. * The semantic version number.
  34230. *
  34231. * @static
  34232. * @memberOf _
  34233. * @type {string}
  34234. */
  34235. lodash.VERSION = VERSION;
  34236. // Assign default placeholders.
  34237. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34238. lodash[methodName].placeholder = lodash;
  34239. });
  34240. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34241. arrayEach(['drop', 'take'], function(methodName, index) {
  34242. LazyWrapper.prototype[methodName] = function(n) {
  34243. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34244. var result = (this.__filtered__ && !index)
  34245. ? new LazyWrapper(this)
  34246. : this.clone();
  34247. if (result.__filtered__) {
  34248. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34249. } else {
  34250. result.__views__.push({
  34251. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34252. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34253. });
  34254. }
  34255. return result;
  34256. };
  34257. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34258. return this.reverse()[methodName](n).reverse();
  34259. };
  34260. });
  34261. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34262. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34263. var type = index + 1,
  34264. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34265. LazyWrapper.prototype[methodName] = function(iteratee) {
  34266. var result = this.clone();
  34267. result.__iteratees__.push({
  34268. 'iteratee': getIteratee(iteratee, 3),
  34269. 'type': type
  34270. });
  34271. result.__filtered__ = result.__filtered__ || isFilter;
  34272. return result;
  34273. };
  34274. });
  34275. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34276. arrayEach(['head', 'last'], function(methodName, index) {
  34277. var takeName = 'take' + (index ? 'Right' : '');
  34278. LazyWrapper.prototype[methodName] = function() {
  34279. return this[takeName](1).value()[0];
  34280. };
  34281. });
  34282. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34283. arrayEach(['initial', 'tail'], function(methodName, index) {
  34284. var dropName = 'drop' + (index ? '' : 'Right');
  34285. LazyWrapper.prototype[methodName] = function() {
  34286. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34287. };
  34288. });
  34289. LazyWrapper.prototype.compact = function() {
  34290. return this.filter(identity);
  34291. };
  34292. LazyWrapper.prototype.find = function(predicate) {
  34293. return this.filter(predicate).head();
  34294. };
  34295. LazyWrapper.prototype.findLast = function(predicate) {
  34296. return this.reverse().find(predicate);
  34297. };
  34298. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34299. if (typeof path == 'function') {
  34300. return new LazyWrapper(this);
  34301. }
  34302. return this.map(function(value) {
  34303. return baseInvoke(value, path, args);
  34304. });
  34305. });
  34306. LazyWrapper.prototype.reject = function(predicate) {
  34307. return this.filter(negate(getIteratee(predicate)));
  34308. };
  34309. LazyWrapper.prototype.slice = function(start, end) {
  34310. start = toInteger(start);
  34311. var result = this;
  34312. if (result.__filtered__ && (start > 0 || end < 0)) {
  34313. return new LazyWrapper(result);
  34314. }
  34315. if (start < 0) {
  34316. result = result.takeRight(-start);
  34317. } else if (start) {
  34318. result = result.drop(start);
  34319. }
  34320. if (end !== undefined) {
  34321. end = toInteger(end);
  34322. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34323. }
  34324. return result;
  34325. };
  34326. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34327. return this.reverse().takeWhile(predicate).reverse();
  34328. };
  34329. LazyWrapper.prototype.toArray = function() {
  34330. return this.take(MAX_ARRAY_LENGTH);
  34331. };
  34332. // Add `LazyWrapper` methods to `lodash.prototype`.
  34333. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34334. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34335. isTaker = /^(?:head|last)$/.test(methodName),
  34336. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34337. retUnwrapped = isTaker || /^find/.test(methodName);
  34338. if (!lodashFunc) {
  34339. return;
  34340. }
  34341. lodash.prototype[methodName] = function() {
  34342. var value = this.__wrapped__,
  34343. args = isTaker ? [1] : arguments,
  34344. isLazy = value instanceof LazyWrapper,
  34345. iteratee = args[0],
  34346. useLazy = isLazy || isArray(value);
  34347. var interceptor = function(value) {
  34348. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34349. return (isTaker && chainAll) ? result[0] : result;
  34350. };
  34351. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34352. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34353. isLazy = useLazy = false;
  34354. }
  34355. var chainAll = this.__chain__,
  34356. isHybrid = !!this.__actions__.length,
  34357. isUnwrapped = retUnwrapped && !chainAll,
  34358. onlyLazy = isLazy && !isHybrid;
  34359. if (!retUnwrapped && useLazy) {
  34360. value = onlyLazy ? value : new LazyWrapper(this);
  34361. var result = func.apply(value, args);
  34362. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34363. return new LodashWrapper(result, chainAll);
  34364. }
  34365. if (isUnwrapped && onlyLazy) {
  34366. return func.apply(this, args);
  34367. }
  34368. result = this.thru(interceptor);
  34369. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34370. };
  34371. });
  34372. // Add `Array` methods to `lodash.prototype`.
  34373. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34374. var func = arrayProto[methodName],
  34375. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34376. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34377. lodash.prototype[methodName] = function() {
  34378. var args = arguments;
  34379. if (retUnwrapped && !this.__chain__) {
  34380. var value = this.value();
  34381. return func.apply(isArray(value) ? value : [], args);
  34382. }
  34383. return this[chainName](function(value) {
  34384. return func.apply(isArray(value) ? value : [], args);
  34385. });
  34386. };
  34387. });
  34388. // Map minified method names to their real names.
  34389. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34390. var lodashFunc = lodash[methodName];
  34391. if (lodashFunc) {
  34392. var key = lodashFunc.name + '';
  34393. if (!hasOwnProperty.call(realNames, key)) {
  34394. realNames[key] = [];
  34395. }
  34396. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34397. }
  34398. });
  34399. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34400. 'name': 'wrapper',
  34401. 'func': undefined
  34402. }];
  34403. // Add methods to `LazyWrapper`.
  34404. LazyWrapper.prototype.clone = lazyClone;
  34405. LazyWrapper.prototype.reverse = lazyReverse;
  34406. LazyWrapper.prototype.value = lazyValue;
  34407. // Add chain sequence methods to the `lodash` wrapper.
  34408. lodash.prototype.at = wrapperAt;
  34409. lodash.prototype.chain = wrapperChain;
  34410. lodash.prototype.commit = wrapperCommit;
  34411. lodash.prototype.next = wrapperNext;
  34412. lodash.prototype.plant = wrapperPlant;
  34413. lodash.prototype.reverse = wrapperReverse;
  34414. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34415. // Add lazy aliases.
  34416. lodash.prototype.first = lodash.prototype.head;
  34417. if (symIterator) {
  34418. lodash.prototype[symIterator] = wrapperToIterator;
  34419. }
  34420. return lodash;
  34421. });
  34422. /*--------------------------------------------------------------------------*/
  34423. // Export lodash.
  34424. var _ = runInContext();
  34425. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34426. if (true) {
  34427. // Expose Lodash on the global object to prevent errors when Lodash is
  34428. // loaded by a script tag in the presence of an AMD loader.
  34429. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34430. // Use `_.noConflict` to remove Lodash from the global object.
  34431. root._ = _;
  34432. // Define as an anonymous module so, through path mapping, it can be
  34433. // referenced as the "underscore" module.
  34434. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34435. return _;
  34436. }).call(exports, __webpack_require__, exports, module),
  34437. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34438. }
  34439. // Check for `exports` after `define` in case a build optimizer adds it.
  34440. else {}
  34441. }.call(this));
  34442. /* 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)))
  34443. /***/ }),
  34444. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34445. /*!***************************************************!*\
  34446. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34447. \***************************************************/
  34448. /*! exports provided: default */
  34449. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34450. "use strict";
  34451. __webpack_require__.r(__webpack_exports__);
  34452. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34453. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34454. * @version 1.16.1
  34455. * @license
  34456. * Copyright (c) 2016 Federico Zivolo and contributors
  34457. *
  34458. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34459. * of this software and associated documentation files (the "Software"), to deal
  34460. * in the Software without restriction, including without limitation the rights
  34461. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34462. * copies of the Software, and to permit persons to whom the Software is
  34463. * furnished to do so, subject to the following conditions:
  34464. *
  34465. * The above copyright notice and this permission notice shall be included in all
  34466. * copies or substantial portions of the Software.
  34467. *
  34468. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34469. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34470. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34471. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34472. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34473. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34474. * SOFTWARE.
  34475. */
  34476. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34477. var timeoutDuration = function () {
  34478. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34479. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34480. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34481. return 1;
  34482. }
  34483. }
  34484. return 0;
  34485. }();
  34486. function microtaskDebounce(fn) {
  34487. var called = false;
  34488. return function () {
  34489. if (called) {
  34490. return;
  34491. }
  34492. called = true;
  34493. window.Promise.resolve().then(function () {
  34494. called = false;
  34495. fn();
  34496. });
  34497. };
  34498. }
  34499. function taskDebounce(fn) {
  34500. var scheduled = false;
  34501. return function () {
  34502. if (!scheduled) {
  34503. scheduled = true;
  34504. setTimeout(function () {
  34505. scheduled = false;
  34506. fn();
  34507. }, timeoutDuration);
  34508. }
  34509. };
  34510. }
  34511. var supportsMicroTasks = isBrowser && window.Promise;
  34512. /**
  34513. * Create a debounced version of a method, that's asynchronously deferred
  34514. * but called in the minimum time possible.
  34515. *
  34516. * @method
  34517. * @memberof Popper.Utils
  34518. * @argument {Function} fn
  34519. * @returns {Function}
  34520. */
  34521. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34522. /**
  34523. * Check if the given variable is a function
  34524. * @method
  34525. * @memberof Popper.Utils
  34526. * @argument {Any} functionToCheck - variable to check
  34527. * @returns {Boolean} answer to: is a function?
  34528. */
  34529. function isFunction(functionToCheck) {
  34530. var getType = {};
  34531. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34532. }
  34533. /**
  34534. * Get CSS computed property of the given element
  34535. * @method
  34536. * @memberof Popper.Utils
  34537. * @argument {Eement} element
  34538. * @argument {String} property
  34539. */
  34540. function getStyleComputedProperty(element, property) {
  34541. if (element.nodeType !== 1) {
  34542. return [];
  34543. }
  34544. // NOTE: 1 DOM access here
  34545. var window = element.ownerDocument.defaultView;
  34546. var css = window.getComputedStyle(element, null);
  34547. return property ? css[property] : css;
  34548. }
  34549. /**
  34550. * Returns the parentNode or the host of the element
  34551. * @method
  34552. * @memberof Popper.Utils
  34553. * @argument {Element} element
  34554. * @returns {Element} parent
  34555. */
  34556. function getParentNode(element) {
  34557. if (element.nodeName === 'HTML') {
  34558. return element;
  34559. }
  34560. return element.parentNode || element.host;
  34561. }
  34562. /**
  34563. * Returns the scrolling parent of the given element
  34564. * @method
  34565. * @memberof Popper.Utils
  34566. * @argument {Element} element
  34567. * @returns {Element} scroll parent
  34568. */
  34569. function getScrollParent(element) {
  34570. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34571. if (!element) {
  34572. return document.body;
  34573. }
  34574. switch (element.nodeName) {
  34575. case 'HTML':
  34576. case 'BODY':
  34577. return element.ownerDocument.body;
  34578. case '#document':
  34579. return element.body;
  34580. }
  34581. // Firefox want us to check `-x` and `-y` variations as well
  34582. var _getStyleComputedProp = getStyleComputedProperty(element),
  34583. overflow = _getStyleComputedProp.overflow,
  34584. overflowX = _getStyleComputedProp.overflowX,
  34585. overflowY = _getStyleComputedProp.overflowY;
  34586. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34587. return element;
  34588. }
  34589. return getScrollParent(getParentNode(element));
  34590. }
  34591. /**
  34592. * Returns the reference node of the reference object, or the reference object itself.
  34593. * @method
  34594. * @memberof Popper.Utils
  34595. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34596. * @returns {Element} parent
  34597. */
  34598. function getReferenceNode(reference) {
  34599. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34600. }
  34601. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34602. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34603. /**
  34604. * Determines if the browser is Internet Explorer
  34605. * @method
  34606. * @memberof Popper.Utils
  34607. * @param {Number} version to check
  34608. * @returns {Boolean} isIE
  34609. */
  34610. function isIE(version) {
  34611. if (version === 11) {
  34612. return isIE11;
  34613. }
  34614. if (version === 10) {
  34615. return isIE10;
  34616. }
  34617. return isIE11 || isIE10;
  34618. }
  34619. /**
  34620. * Returns the offset parent of the given element
  34621. * @method
  34622. * @memberof Popper.Utils
  34623. * @argument {Element} element
  34624. * @returns {Element} offset parent
  34625. */
  34626. function getOffsetParent(element) {
  34627. if (!element) {
  34628. return document.documentElement;
  34629. }
  34630. var noOffsetParent = isIE(10) ? document.body : null;
  34631. // NOTE: 1 DOM access here
  34632. var offsetParent = element.offsetParent || null;
  34633. // Skip hidden elements which don't have an offsetParent
  34634. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34635. offsetParent = (element = element.nextElementSibling).offsetParent;
  34636. }
  34637. var nodeName = offsetParent && offsetParent.nodeName;
  34638. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34639. return element ? element.ownerDocument.documentElement : document.documentElement;
  34640. }
  34641. // .offsetParent will return the closest TH, TD or TABLE in case
  34642. // no offsetParent is present, I hate this job...
  34643. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34644. return getOffsetParent(offsetParent);
  34645. }
  34646. return offsetParent;
  34647. }
  34648. function isOffsetContainer(element) {
  34649. var nodeName = element.nodeName;
  34650. if (nodeName === 'BODY') {
  34651. return false;
  34652. }
  34653. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34654. }
  34655. /**
  34656. * Finds the root node (document, shadowDOM root) of the given element
  34657. * @method
  34658. * @memberof Popper.Utils
  34659. * @argument {Element} node
  34660. * @returns {Element} root node
  34661. */
  34662. function getRoot(node) {
  34663. if (node.parentNode !== null) {
  34664. return getRoot(node.parentNode);
  34665. }
  34666. return node;
  34667. }
  34668. /**
  34669. * Finds the offset parent common to the two provided nodes
  34670. * @method
  34671. * @memberof Popper.Utils
  34672. * @argument {Element} element1
  34673. * @argument {Element} element2
  34674. * @returns {Element} common offset parent
  34675. */
  34676. function findCommonOffsetParent(element1, element2) {
  34677. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34678. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34679. return document.documentElement;
  34680. }
  34681. // Here we make sure to give as "start" the element that comes first in the DOM
  34682. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34683. var start = order ? element1 : element2;
  34684. var end = order ? element2 : element1;
  34685. // Get common ancestor container
  34686. var range = document.createRange();
  34687. range.setStart(start, 0);
  34688. range.setEnd(end, 0);
  34689. var commonAncestorContainer = range.commonAncestorContainer;
  34690. // Both nodes are inside #document
  34691. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34692. if (isOffsetContainer(commonAncestorContainer)) {
  34693. return commonAncestorContainer;
  34694. }
  34695. return getOffsetParent(commonAncestorContainer);
  34696. }
  34697. // one of the nodes is inside shadowDOM, find which one
  34698. var element1root = getRoot(element1);
  34699. if (element1root.host) {
  34700. return findCommonOffsetParent(element1root.host, element2);
  34701. } else {
  34702. return findCommonOffsetParent(element1, getRoot(element2).host);
  34703. }
  34704. }
  34705. /**
  34706. * Gets the scroll value of the given element in the given side (top and left)
  34707. * @method
  34708. * @memberof Popper.Utils
  34709. * @argument {Element} element
  34710. * @argument {String} side `top` or `left`
  34711. * @returns {number} amount of scrolled pixels
  34712. */
  34713. function getScroll(element) {
  34714. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34715. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34716. var nodeName = element.nodeName;
  34717. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34718. var html = element.ownerDocument.documentElement;
  34719. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34720. return scrollingElement[upperSide];
  34721. }
  34722. return element[upperSide];
  34723. }
  34724. /*
  34725. * Sum or subtract the element scroll values (left and top) from a given rect object
  34726. * @method
  34727. * @memberof Popper.Utils
  34728. * @param {Object} rect - Rect object you want to change
  34729. * @param {HTMLElement} element - The element from the function reads the scroll values
  34730. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34731. * @return {Object} rect - The modifier rect object
  34732. */
  34733. function includeScroll(rect, element) {
  34734. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34735. var scrollTop = getScroll(element, 'top');
  34736. var scrollLeft = getScroll(element, 'left');
  34737. var modifier = subtract ? -1 : 1;
  34738. rect.top += scrollTop * modifier;
  34739. rect.bottom += scrollTop * modifier;
  34740. rect.left += scrollLeft * modifier;
  34741. rect.right += scrollLeft * modifier;
  34742. return rect;
  34743. }
  34744. /*
  34745. * Helper to detect borders of a given element
  34746. * @method
  34747. * @memberof Popper.Utils
  34748. * @param {CSSStyleDeclaration} styles
  34749. * Result of `getStyleComputedProperty` on the given element
  34750. * @param {String} axis - `x` or `y`
  34751. * @return {number} borders - The borders size of the given axis
  34752. */
  34753. function getBordersSize(styles, axis) {
  34754. var sideA = axis === 'x' ? 'Left' : 'Top';
  34755. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34756. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34757. }
  34758. function getSize(axis, body, html, computedStyle) {
  34759. 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);
  34760. }
  34761. function getWindowSizes(document) {
  34762. var body = document.body;
  34763. var html = document.documentElement;
  34764. var computedStyle = isIE(10) && getComputedStyle(html);
  34765. return {
  34766. height: getSize('Height', body, html, computedStyle),
  34767. width: getSize('Width', body, html, computedStyle)
  34768. };
  34769. }
  34770. var classCallCheck = function (instance, Constructor) {
  34771. if (!(instance instanceof Constructor)) {
  34772. throw new TypeError("Cannot call a class as a function");
  34773. }
  34774. };
  34775. var createClass = function () {
  34776. function defineProperties(target, props) {
  34777. for (var i = 0; i < props.length; i++) {
  34778. var descriptor = props[i];
  34779. descriptor.enumerable = descriptor.enumerable || false;
  34780. descriptor.configurable = true;
  34781. if ("value" in descriptor) descriptor.writable = true;
  34782. Object.defineProperty(target, descriptor.key, descriptor);
  34783. }
  34784. }
  34785. return function (Constructor, protoProps, staticProps) {
  34786. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34787. if (staticProps) defineProperties(Constructor, staticProps);
  34788. return Constructor;
  34789. };
  34790. }();
  34791. var defineProperty = function (obj, key, value) {
  34792. if (key in obj) {
  34793. Object.defineProperty(obj, key, {
  34794. value: value,
  34795. enumerable: true,
  34796. configurable: true,
  34797. writable: true
  34798. });
  34799. } else {
  34800. obj[key] = value;
  34801. }
  34802. return obj;
  34803. };
  34804. var _extends = Object.assign || function (target) {
  34805. for (var i = 1; i < arguments.length; i++) {
  34806. var source = arguments[i];
  34807. for (var key in source) {
  34808. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34809. target[key] = source[key];
  34810. }
  34811. }
  34812. }
  34813. return target;
  34814. };
  34815. /**
  34816. * Given element offsets, generate an output similar to getBoundingClientRect
  34817. * @method
  34818. * @memberof Popper.Utils
  34819. * @argument {Object} offsets
  34820. * @returns {Object} ClientRect like output
  34821. */
  34822. function getClientRect(offsets) {
  34823. return _extends({}, offsets, {
  34824. right: offsets.left + offsets.width,
  34825. bottom: offsets.top + offsets.height
  34826. });
  34827. }
  34828. /**
  34829. * Get bounding client rect of given element
  34830. * @method
  34831. * @memberof Popper.Utils
  34832. * @param {HTMLElement} element
  34833. * @return {Object} client rect
  34834. */
  34835. function getBoundingClientRect(element) {
  34836. var rect = {};
  34837. // IE10 10 FIX: Please, don't ask, the element isn't
  34838. // considered in DOM in some circumstances...
  34839. // This isn't reproducible in IE10 compatibility mode of IE11
  34840. try {
  34841. if (isIE(10)) {
  34842. rect = element.getBoundingClientRect();
  34843. var scrollTop = getScroll(element, 'top');
  34844. var scrollLeft = getScroll(element, 'left');
  34845. rect.top += scrollTop;
  34846. rect.left += scrollLeft;
  34847. rect.bottom += scrollTop;
  34848. rect.right += scrollLeft;
  34849. } else {
  34850. rect = element.getBoundingClientRect();
  34851. }
  34852. } catch (e) {}
  34853. var result = {
  34854. left: rect.left,
  34855. top: rect.top,
  34856. width: rect.right - rect.left,
  34857. height: rect.bottom - rect.top
  34858. };
  34859. // subtract scrollbar size from sizes
  34860. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34861. var width = sizes.width || element.clientWidth || result.width;
  34862. var height = sizes.height || element.clientHeight || result.height;
  34863. var horizScrollbar = element.offsetWidth - width;
  34864. var vertScrollbar = element.offsetHeight - height;
  34865. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34866. // we make this check conditional for performance reasons
  34867. if (horizScrollbar || vertScrollbar) {
  34868. var styles = getStyleComputedProperty(element);
  34869. horizScrollbar -= getBordersSize(styles, 'x');
  34870. vertScrollbar -= getBordersSize(styles, 'y');
  34871. result.width -= horizScrollbar;
  34872. result.height -= vertScrollbar;
  34873. }
  34874. return getClientRect(result);
  34875. }
  34876. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34877. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34878. var isIE10 = isIE(10);
  34879. var isHTML = parent.nodeName === 'HTML';
  34880. var childrenRect = getBoundingClientRect(children);
  34881. var parentRect = getBoundingClientRect(parent);
  34882. var scrollParent = getScrollParent(children);
  34883. var styles = getStyleComputedProperty(parent);
  34884. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34885. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34886. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34887. if (fixedPosition && isHTML) {
  34888. parentRect.top = Math.max(parentRect.top, 0);
  34889. parentRect.left = Math.max(parentRect.left, 0);
  34890. }
  34891. var offsets = getClientRect({
  34892. top: childrenRect.top - parentRect.top - borderTopWidth,
  34893. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34894. width: childrenRect.width,
  34895. height: childrenRect.height
  34896. });
  34897. offsets.marginTop = 0;
  34898. offsets.marginLeft = 0;
  34899. // Subtract margins of documentElement in case it's being used as parent
  34900. // we do this only on HTML because it's the only element that behaves
  34901. // differently when margins are applied to it. The margins are included in
  34902. // the box of the documentElement, in the other cases not.
  34903. if (!isIE10 && isHTML) {
  34904. var marginTop = parseFloat(styles.marginTop);
  34905. var marginLeft = parseFloat(styles.marginLeft);
  34906. offsets.top -= borderTopWidth - marginTop;
  34907. offsets.bottom -= borderTopWidth - marginTop;
  34908. offsets.left -= borderLeftWidth - marginLeft;
  34909. offsets.right -= borderLeftWidth - marginLeft;
  34910. // Attach marginTop and marginLeft because in some circumstances we may need them
  34911. offsets.marginTop = marginTop;
  34912. offsets.marginLeft = marginLeft;
  34913. }
  34914. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34915. offsets = includeScroll(offsets, parent);
  34916. }
  34917. return offsets;
  34918. }
  34919. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34920. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34921. var html = element.ownerDocument.documentElement;
  34922. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34923. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34924. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34925. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34926. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34927. var offset = {
  34928. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34929. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34930. width: width,
  34931. height: height
  34932. };
  34933. return getClientRect(offset);
  34934. }
  34935. /**
  34936. * Check if the given element is fixed or is inside a fixed parent
  34937. * @method
  34938. * @memberof Popper.Utils
  34939. * @argument {Element} element
  34940. * @argument {Element} customContainer
  34941. * @returns {Boolean} answer to "isFixed?"
  34942. */
  34943. function isFixed(element) {
  34944. var nodeName = element.nodeName;
  34945. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34946. return false;
  34947. }
  34948. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34949. return true;
  34950. }
  34951. var parentNode = getParentNode(element);
  34952. if (!parentNode) {
  34953. return false;
  34954. }
  34955. return isFixed(parentNode);
  34956. }
  34957. /**
  34958. * Finds the first parent of an element that has a transformed property defined
  34959. * @method
  34960. * @memberof Popper.Utils
  34961. * @argument {Element} element
  34962. * @returns {Element} first transformed parent or documentElement
  34963. */
  34964. function getFixedPositionOffsetParent(element) {
  34965. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34966. if (!element || !element.parentElement || isIE()) {
  34967. return document.documentElement;
  34968. }
  34969. var el = element.parentElement;
  34970. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34971. el = el.parentElement;
  34972. }
  34973. return el || document.documentElement;
  34974. }
  34975. /**
  34976. * Computed the boundaries limits and return them
  34977. * @method
  34978. * @memberof Popper.Utils
  34979. * @param {HTMLElement} popper
  34980. * @param {HTMLElement} reference
  34981. * @param {number} padding
  34982. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34983. * @param {Boolean} fixedPosition - Is in fixed position mode
  34984. * @returns {Object} Coordinates of the boundaries
  34985. */
  34986. function getBoundaries(popper, reference, padding, boundariesElement) {
  34987. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34988. // NOTE: 1 DOM access here
  34989. var boundaries = { top: 0, left: 0 };
  34990. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34991. // Handle viewport case
  34992. if (boundariesElement === 'viewport') {
  34993. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34994. } else {
  34995. // Handle other cases based on DOM element used as boundaries
  34996. var boundariesNode = void 0;
  34997. if (boundariesElement === 'scrollParent') {
  34998. boundariesNode = getScrollParent(getParentNode(reference));
  34999. if (boundariesNode.nodeName === 'BODY') {
  35000. boundariesNode = popper.ownerDocument.documentElement;
  35001. }
  35002. } else if (boundariesElement === 'window') {
  35003. boundariesNode = popper.ownerDocument.documentElement;
  35004. } else {
  35005. boundariesNode = boundariesElement;
  35006. }
  35007. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35008. // In case of HTML, we need a different computation
  35009. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35010. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35011. height = _getWindowSizes.height,
  35012. width = _getWindowSizes.width;
  35013. boundaries.top += offsets.top - offsets.marginTop;
  35014. boundaries.bottom = height + offsets.top;
  35015. boundaries.left += offsets.left - offsets.marginLeft;
  35016. boundaries.right = width + offsets.left;
  35017. } else {
  35018. // for all the other DOM elements, this one is good
  35019. boundaries = offsets;
  35020. }
  35021. }
  35022. // Add paddings
  35023. padding = padding || 0;
  35024. var isPaddingNumber = typeof padding === 'number';
  35025. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35026. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35027. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35028. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35029. return boundaries;
  35030. }
  35031. function getArea(_ref) {
  35032. var width = _ref.width,
  35033. height = _ref.height;
  35034. return width * height;
  35035. }
  35036. /**
  35037. * Utility used to transform the `auto` placement to the placement with more
  35038. * available space.
  35039. * @method
  35040. * @memberof Popper.Utils
  35041. * @argument {Object} data - The data object generated by update method
  35042. * @argument {Object} options - Modifiers configuration and options
  35043. * @returns {Object} The data object, properly modified
  35044. */
  35045. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35046. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35047. if (placement.indexOf('auto') === -1) {
  35048. return placement;
  35049. }
  35050. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35051. var rects = {
  35052. top: {
  35053. width: boundaries.width,
  35054. height: refRect.top - boundaries.top
  35055. },
  35056. right: {
  35057. width: boundaries.right - refRect.right,
  35058. height: boundaries.height
  35059. },
  35060. bottom: {
  35061. width: boundaries.width,
  35062. height: boundaries.bottom - refRect.bottom
  35063. },
  35064. left: {
  35065. width: refRect.left - boundaries.left,
  35066. height: boundaries.height
  35067. }
  35068. };
  35069. var sortedAreas = Object.keys(rects).map(function (key) {
  35070. return _extends({
  35071. key: key
  35072. }, rects[key], {
  35073. area: getArea(rects[key])
  35074. });
  35075. }).sort(function (a, b) {
  35076. return b.area - a.area;
  35077. });
  35078. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35079. var width = _ref2.width,
  35080. height = _ref2.height;
  35081. return width >= popper.clientWidth && height >= popper.clientHeight;
  35082. });
  35083. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35084. var variation = placement.split('-')[1];
  35085. return computedPlacement + (variation ? '-' + variation : '');
  35086. }
  35087. /**
  35088. * Get offsets to the reference element
  35089. * @method
  35090. * @memberof Popper.Utils
  35091. * @param {Object} state
  35092. * @param {Element} popper - the popper element
  35093. * @param {Element} reference - the reference element (the popper will be relative to this)
  35094. * @param {Element} fixedPosition - is in fixed position mode
  35095. * @returns {Object} An object containing the offsets which will be applied to the popper
  35096. */
  35097. function getReferenceOffsets(state, popper, reference) {
  35098. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35099. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35100. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35101. }
  35102. /**
  35103. * Get the outer sizes of the given element (offset size + margins)
  35104. * @method
  35105. * @memberof Popper.Utils
  35106. * @argument {Element} element
  35107. * @returns {Object} object containing width and height properties
  35108. */
  35109. function getOuterSizes(element) {
  35110. var window = element.ownerDocument.defaultView;
  35111. var styles = window.getComputedStyle(element);
  35112. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35113. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35114. var result = {
  35115. width: element.offsetWidth + y,
  35116. height: element.offsetHeight + x
  35117. };
  35118. return result;
  35119. }
  35120. /**
  35121. * Get the opposite placement of the given one
  35122. * @method
  35123. * @memberof Popper.Utils
  35124. * @argument {String} placement
  35125. * @returns {String} flipped placement
  35126. */
  35127. function getOppositePlacement(placement) {
  35128. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35129. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35130. return hash[matched];
  35131. });
  35132. }
  35133. /**
  35134. * Get offsets to the popper
  35135. * @method
  35136. * @memberof Popper.Utils
  35137. * @param {Object} position - CSS position the Popper will get applied
  35138. * @param {HTMLElement} popper - the popper element
  35139. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35140. * @param {String} placement - one of the valid placement options
  35141. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35142. */
  35143. function getPopperOffsets(popper, referenceOffsets, placement) {
  35144. placement = placement.split('-')[0];
  35145. // Get popper node sizes
  35146. var popperRect = getOuterSizes(popper);
  35147. // Add position, width and height to our offsets object
  35148. var popperOffsets = {
  35149. width: popperRect.width,
  35150. height: popperRect.height
  35151. };
  35152. // depending by the popper placement we have to compute its offsets slightly differently
  35153. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35154. var mainSide = isHoriz ? 'top' : 'left';
  35155. var secondarySide = isHoriz ? 'left' : 'top';
  35156. var measurement = isHoriz ? 'height' : 'width';
  35157. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35158. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35159. if (placement === secondarySide) {
  35160. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35161. } else {
  35162. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35163. }
  35164. return popperOffsets;
  35165. }
  35166. /**
  35167. * Mimics the `find` method of Array
  35168. * @method
  35169. * @memberof Popper.Utils
  35170. * @argument {Array} arr
  35171. * @argument prop
  35172. * @argument value
  35173. * @returns index or -1
  35174. */
  35175. function find(arr, check) {
  35176. // use native find if supported
  35177. if (Array.prototype.find) {
  35178. return arr.find(check);
  35179. }
  35180. // use `filter` to obtain the same behavior of `find`
  35181. return arr.filter(check)[0];
  35182. }
  35183. /**
  35184. * Return the index of the matching object
  35185. * @method
  35186. * @memberof Popper.Utils
  35187. * @argument {Array} arr
  35188. * @argument prop
  35189. * @argument value
  35190. * @returns index or -1
  35191. */
  35192. function findIndex(arr, prop, value) {
  35193. // use native findIndex if supported
  35194. if (Array.prototype.findIndex) {
  35195. return arr.findIndex(function (cur) {
  35196. return cur[prop] === value;
  35197. });
  35198. }
  35199. // use `find` + `indexOf` if `findIndex` isn't supported
  35200. var match = find(arr, function (obj) {
  35201. return obj[prop] === value;
  35202. });
  35203. return arr.indexOf(match);
  35204. }
  35205. /**
  35206. * Loop trough the list of modifiers and run them in order,
  35207. * each of them will then edit the data object.
  35208. * @method
  35209. * @memberof Popper.Utils
  35210. * @param {dataObject} data
  35211. * @param {Array} modifiers
  35212. * @param {String} ends - Optional modifier name used as stopper
  35213. * @returns {dataObject}
  35214. */
  35215. function runModifiers(modifiers, data, ends) {
  35216. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35217. modifiersToRun.forEach(function (modifier) {
  35218. if (modifier['function']) {
  35219. // eslint-disable-line dot-notation
  35220. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35221. }
  35222. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35223. if (modifier.enabled && isFunction(fn)) {
  35224. // Add properties to offsets to make them a complete clientRect object
  35225. // we do this before each modifier to make sure the previous one doesn't
  35226. // mess with these values
  35227. data.offsets.popper = getClientRect(data.offsets.popper);
  35228. data.offsets.reference = getClientRect(data.offsets.reference);
  35229. data = fn(data, modifier);
  35230. }
  35231. });
  35232. return data;
  35233. }
  35234. /**
  35235. * Updates the position of the popper, computing the new offsets and applying
  35236. * the new style.<br />
  35237. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35238. * @method
  35239. * @memberof Popper
  35240. */
  35241. function update() {
  35242. // if popper is destroyed, don't perform any further update
  35243. if (this.state.isDestroyed) {
  35244. return;
  35245. }
  35246. var data = {
  35247. instance: this,
  35248. styles: {},
  35249. arrowStyles: {},
  35250. attributes: {},
  35251. flipped: false,
  35252. offsets: {}
  35253. };
  35254. // compute reference element offsets
  35255. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35256. // compute auto placement, store placement inside the data object,
  35257. // modifiers will be able to edit `placement` if needed
  35258. // and refer to originalPlacement to know the original value
  35259. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35260. // store the computed placement inside `originalPlacement`
  35261. data.originalPlacement = data.placement;
  35262. data.positionFixed = this.options.positionFixed;
  35263. // compute the popper offsets
  35264. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35265. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35266. // run the modifiers
  35267. data = runModifiers(this.modifiers, data);
  35268. // the first `update` will call `onCreate` callback
  35269. // the other ones will call `onUpdate` callback
  35270. if (!this.state.isCreated) {
  35271. this.state.isCreated = true;
  35272. this.options.onCreate(data);
  35273. } else {
  35274. this.options.onUpdate(data);
  35275. }
  35276. }
  35277. /**
  35278. * Helper used to know if the given modifier is enabled.
  35279. * @method
  35280. * @memberof Popper.Utils
  35281. * @returns {Boolean}
  35282. */
  35283. function isModifierEnabled(modifiers, modifierName) {
  35284. return modifiers.some(function (_ref) {
  35285. var name = _ref.name,
  35286. enabled = _ref.enabled;
  35287. return enabled && name === modifierName;
  35288. });
  35289. }
  35290. /**
  35291. * Get the prefixed supported property name
  35292. * @method
  35293. * @memberof Popper.Utils
  35294. * @argument {String} property (camelCase)
  35295. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35296. */
  35297. function getSupportedPropertyName(property) {
  35298. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35299. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35300. for (var i = 0; i < prefixes.length; i++) {
  35301. var prefix = prefixes[i];
  35302. var toCheck = prefix ? '' + prefix + upperProp : property;
  35303. if (typeof document.body.style[toCheck] !== 'undefined') {
  35304. return toCheck;
  35305. }
  35306. }
  35307. return null;
  35308. }
  35309. /**
  35310. * Destroys the popper.
  35311. * @method
  35312. * @memberof Popper
  35313. */
  35314. function destroy() {
  35315. this.state.isDestroyed = true;
  35316. // touch DOM only if `applyStyle` modifier is enabled
  35317. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35318. this.popper.removeAttribute('x-placement');
  35319. this.popper.style.position = '';
  35320. this.popper.style.top = '';
  35321. this.popper.style.left = '';
  35322. this.popper.style.right = '';
  35323. this.popper.style.bottom = '';
  35324. this.popper.style.willChange = '';
  35325. this.popper.style[getSupportedPropertyName('transform')] = '';
  35326. }
  35327. this.disableEventListeners();
  35328. // remove the popper if user explicitly asked for the deletion on destroy
  35329. // do not use `remove` because IE11 doesn't support it
  35330. if (this.options.removeOnDestroy) {
  35331. this.popper.parentNode.removeChild(this.popper);
  35332. }
  35333. return this;
  35334. }
  35335. /**
  35336. * Get the window associated with the element
  35337. * @argument {Element} element
  35338. * @returns {Window}
  35339. */
  35340. function getWindow(element) {
  35341. var ownerDocument = element.ownerDocument;
  35342. return ownerDocument ? ownerDocument.defaultView : window;
  35343. }
  35344. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35345. var isBody = scrollParent.nodeName === 'BODY';
  35346. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35347. target.addEventListener(event, callback, { passive: true });
  35348. if (!isBody) {
  35349. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35350. }
  35351. scrollParents.push(target);
  35352. }
  35353. /**
  35354. * Setup needed event listeners used to update the popper position
  35355. * @method
  35356. * @memberof Popper.Utils
  35357. * @private
  35358. */
  35359. function setupEventListeners(reference, options, state, updateBound) {
  35360. // Resize event listener on window
  35361. state.updateBound = updateBound;
  35362. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35363. // Scroll event listener on scroll parents
  35364. var scrollElement = getScrollParent(reference);
  35365. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35366. state.scrollElement = scrollElement;
  35367. state.eventsEnabled = true;
  35368. return state;
  35369. }
  35370. /**
  35371. * It will add resize/scroll events and start recalculating
  35372. * position of the popper element when they are triggered.
  35373. * @method
  35374. * @memberof Popper
  35375. */
  35376. function enableEventListeners() {
  35377. if (!this.state.eventsEnabled) {
  35378. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35379. }
  35380. }
  35381. /**
  35382. * Remove event listeners used to update the popper position
  35383. * @method
  35384. * @memberof Popper.Utils
  35385. * @private
  35386. */
  35387. function removeEventListeners(reference, state) {
  35388. // Remove resize event listener on window
  35389. getWindow(reference).removeEventListener('resize', state.updateBound);
  35390. // Remove scroll event listener on scroll parents
  35391. state.scrollParents.forEach(function (target) {
  35392. target.removeEventListener('scroll', state.updateBound);
  35393. });
  35394. // Reset state
  35395. state.updateBound = null;
  35396. state.scrollParents = [];
  35397. state.scrollElement = null;
  35398. state.eventsEnabled = false;
  35399. return state;
  35400. }
  35401. /**
  35402. * It will remove resize/scroll events and won't recalculate popper position
  35403. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35404. * unless you call `update` method manually.
  35405. * @method
  35406. * @memberof Popper
  35407. */
  35408. function disableEventListeners() {
  35409. if (this.state.eventsEnabled) {
  35410. cancelAnimationFrame(this.scheduleUpdate);
  35411. this.state = removeEventListeners(this.reference, this.state);
  35412. }
  35413. }
  35414. /**
  35415. * Tells if a given input is a number
  35416. * @method
  35417. * @memberof Popper.Utils
  35418. * @param {*} input to check
  35419. * @return {Boolean}
  35420. */
  35421. function isNumeric(n) {
  35422. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35423. }
  35424. /**
  35425. * Set the style to the given popper
  35426. * @method
  35427. * @memberof Popper.Utils
  35428. * @argument {Element} element - Element to apply the style to
  35429. * @argument {Object} styles
  35430. * Object with a list of properties and values which will be applied to the element
  35431. */
  35432. function setStyles(element, styles) {
  35433. Object.keys(styles).forEach(function (prop) {
  35434. var unit = '';
  35435. // add unit if the value is numeric and is one of the following
  35436. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35437. unit = 'px';
  35438. }
  35439. element.style[prop] = styles[prop] + unit;
  35440. });
  35441. }
  35442. /**
  35443. * Set the attributes to the given popper
  35444. * @method
  35445. * @memberof Popper.Utils
  35446. * @argument {Element} element - Element to apply the attributes to
  35447. * @argument {Object} styles
  35448. * Object with a list of properties and values which will be applied to the element
  35449. */
  35450. function setAttributes(element, attributes) {
  35451. Object.keys(attributes).forEach(function (prop) {
  35452. var value = attributes[prop];
  35453. if (value !== false) {
  35454. element.setAttribute(prop, attributes[prop]);
  35455. } else {
  35456. element.removeAttribute(prop);
  35457. }
  35458. });
  35459. }
  35460. /**
  35461. * @function
  35462. * @memberof Modifiers
  35463. * @argument {Object} data - The data object generated by `update` method
  35464. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35465. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35466. * @argument {Object} options - Modifiers configuration and options
  35467. * @returns {Object} The same data object
  35468. */
  35469. function applyStyle(data) {
  35470. // any property present in `data.styles` will be applied to the popper,
  35471. // in this way we can make the 3rd party modifiers add custom styles to it
  35472. // Be aware, modifiers could override the properties defined in the previous
  35473. // lines of this modifier!
  35474. setStyles(data.instance.popper, data.styles);
  35475. // any property present in `data.attributes` will be applied to the popper,
  35476. // they will be set as HTML attributes of the element
  35477. setAttributes(data.instance.popper, data.attributes);
  35478. // if arrowElement is defined and arrowStyles has some properties
  35479. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35480. setStyles(data.arrowElement, data.arrowStyles);
  35481. }
  35482. return data;
  35483. }
  35484. /**
  35485. * Set the x-placement attribute before everything else because it could be used
  35486. * to add margins to the popper margins needs to be calculated to get the
  35487. * correct popper offsets.
  35488. * @method
  35489. * @memberof Popper.modifiers
  35490. * @param {HTMLElement} reference - The reference element used to position the popper
  35491. * @param {HTMLElement} popper - The HTML element used as popper
  35492. * @param {Object} options - Popper.js options
  35493. */
  35494. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35495. // compute reference element offsets
  35496. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35497. // compute auto placement, store placement inside the data object,
  35498. // modifiers will be able to edit `placement` if needed
  35499. // and refer to originalPlacement to know the original value
  35500. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35501. popper.setAttribute('x-placement', placement);
  35502. // Apply `position` to popper before anything else because
  35503. // without the position applied we can't guarantee correct computations
  35504. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35505. return options;
  35506. }
  35507. /**
  35508. * @function
  35509. * @memberof Popper.Utils
  35510. * @argument {Object} data - The data object generated by `update` method
  35511. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35512. * @returns {Object} The popper's position offsets rounded
  35513. *
  35514. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35515. * good as it can be within reason.
  35516. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35517. *
  35518. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35519. * as well on High DPI screens).
  35520. *
  35521. * Firefox prefers no rounding for positioning and does not have blurriness on
  35522. * high DPI screens.
  35523. *
  35524. * Only horizontal placement and left/right values need to be considered.
  35525. */
  35526. function getRoundedOffsets(data, shouldRound) {
  35527. var _data$offsets = data.offsets,
  35528. popper = _data$offsets.popper,
  35529. reference = _data$offsets.reference;
  35530. var round = Math.round,
  35531. floor = Math.floor;
  35532. var noRound = function noRound(v) {
  35533. return v;
  35534. };
  35535. var referenceWidth = round(reference.width);
  35536. var popperWidth = round(popper.width);
  35537. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35538. var isVariation = data.placement.indexOf('-') !== -1;
  35539. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35540. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35541. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35542. var verticalToInteger = !shouldRound ? noRound : round;
  35543. return {
  35544. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35545. top: verticalToInteger(popper.top),
  35546. bottom: verticalToInteger(popper.bottom),
  35547. right: horizontalToInteger(popper.right)
  35548. };
  35549. }
  35550. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35551. /**
  35552. * @function
  35553. * @memberof Modifiers
  35554. * @argument {Object} data - The data object generated by `update` method
  35555. * @argument {Object} options - Modifiers configuration and options
  35556. * @returns {Object} The data object, properly modified
  35557. */
  35558. function computeStyle(data, options) {
  35559. var x = options.x,
  35560. y = options.y;
  35561. var popper = data.offsets.popper;
  35562. // Remove this legacy support in Popper.js v2
  35563. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35564. return modifier.name === 'applyStyle';
  35565. }).gpuAcceleration;
  35566. if (legacyGpuAccelerationOption !== undefined) {
  35567. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35568. }
  35569. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35570. var offsetParent = getOffsetParent(data.instance.popper);
  35571. var offsetParentRect = getBoundingClientRect(offsetParent);
  35572. // Styles
  35573. var styles = {
  35574. position: popper.position
  35575. };
  35576. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35577. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35578. var sideB = y === 'right' ? 'left' : 'right';
  35579. // if gpuAcceleration is set to `true` and transform is supported,
  35580. // we use `translate3d` to apply the position to the popper we
  35581. // automatically use the supported prefixed version if needed
  35582. var prefixedProperty = getSupportedPropertyName('transform');
  35583. // now, let's make a step back and look at this code closely (wtf?)
  35584. // If the content of the popper grows once it's been positioned, it
  35585. // may happen that the popper gets misplaced because of the new content
  35586. // overflowing its reference element
  35587. // To avoid this problem, we provide two options (x and y), which allow
  35588. // the consumer to define the offset origin.
  35589. // If we position a popper on top of a reference element, we can set
  35590. // `x` to `top` to make the popper grow towards its top instead of
  35591. // its bottom.
  35592. var left = void 0,
  35593. top = void 0;
  35594. if (sideA === 'bottom') {
  35595. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35596. // and not the bottom of the html element
  35597. if (offsetParent.nodeName === 'HTML') {
  35598. top = -offsetParent.clientHeight + offsets.bottom;
  35599. } else {
  35600. top = -offsetParentRect.height + offsets.bottom;
  35601. }
  35602. } else {
  35603. top = offsets.top;
  35604. }
  35605. if (sideB === 'right') {
  35606. if (offsetParent.nodeName === 'HTML') {
  35607. left = -offsetParent.clientWidth + offsets.right;
  35608. } else {
  35609. left = -offsetParentRect.width + offsets.right;
  35610. }
  35611. } else {
  35612. left = offsets.left;
  35613. }
  35614. if (gpuAcceleration && prefixedProperty) {
  35615. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35616. styles[sideA] = 0;
  35617. styles[sideB] = 0;
  35618. styles.willChange = 'transform';
  35619. } else {
  35620. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35621. var invertTop = sideA === 'bottom' ? -1 : 1;
  35622. var invertLeft = sideB === 'right' ? -1 : 1;
  35623. styles[sideA] = top * invertTop;
  35624. styles[sideB] = left * invertLeft;
  35625. styles.willChange = sideA + ', ' + sideB;
  35626. }
  35627. // Attributes
  35628. var attributes = {
  35629. 'x-placement': data.placement
  35630. };
  35631. // Update `data` attributes, styles and arrowStyles
  35632. data.attributes = _extends({}, attributes, data.attributes);
  35633. data.styles = _extends({}, styles, data.styles);
  35634. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35635. return data;
  35636. }
  35637. /**
  35638. * Helper used to know if the given modifier depends from another one.<br />
  35639. * It checks if the needed modifier is listed and enabled.
  35640. * @method
  35641. * @memberof Popper.Utils
  35642. * @param {Array} modifiers - list of modifiers
  35643. * @param {String} requestingName - name of requesting modifier
  35644. * @param {String} requestedName - name of requested modifier
  35645. * @returns {Boolean}
  35646. */
  35647. function isModifierRequired(modifiers, requestingName, requestedName) {
  35648. var requesting = find(modifiers, function (_ref) {
  35649. var name = _ref.name;
  35650. return name === requestingName;
  35651. });
  35652. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35653. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35654. });
  35655. if (!isRequired) {
  35656. var _requesting = '`' + requestingName + '`';
  35657. var requested = '`' + requestedName + '`';
  35658. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35659. }
  35660. return isRequired;
  35661. }
  35662. /**
  35663. * @function
  35664. * @memberof Modifiers
  35665. * @argument {Object} data - The data object generated by update method
  35666. * @argument {Object} options - Modifiers configuration and options
  35667. * @returns {Object} The data object, properly modified
  35668. */
  35669. function arrow(data, options) {
  35670. var _data$offsets$arrow;
  35671. // arrow depends on keepTogether in order to work
  35672. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35673. return data;
  35674. }
  35675. var arrowElement = options.element;
  35676. // if arrowElement is a string, suppose it's a CSS selector
  35677. if (typeof arrowElement === 'string') {
  35678. arrowElement = data.instance.popper.querySelector(arrowElement);
  35679. // if arrowElement is not found, don't run the modifier
  35680. if (!arrowElement) {
  35681. return data;
  35682. }
  35683. } else {
  35684. // if the arrowElement isn't a query selector we must check that the
  35685. // provided DOM node is child of its popper node
  35686. if (!data.instance.popper.contains(arrowElement)) {
  35687. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35688. return data;
  35689. }
  35690. }
  35691. var placement = data.placement.split('-')[0];
  35692. var _data$offsets = data.offsets,
  35693. popper = _data$offsets.popper,
  35694. reference = _data$offsets.reference;
  35695. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35696. var len = isVertical ? 'height' : 'width';
  35697. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35698. var side = sideCapitalized.toLowerCase();
  35699. var altSide = isVertical ? 'left' : 'top';
  35700. var opSide = isVertical ? 'bottom' : 'right';
  35701. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35702. //
  35703. // extends keepTogether behavior making sure the popper and its
  35704. // reference have enough pixels in conjunction
  35705. //
  35706. // top/left side
  35707. if (reference[opSide] - arrowElementSize < popper[side]) {
  35708. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35709. }
  35710. // bottom/right side
  35711. if (reference[side] + arrowElementSize > popper[opSide]) {
  35712. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35713. }
  35714. data.offsets.popper = getClientRect(data.offsets.popper);
  35715. // compute center of the popper
  35716. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35717. // Compute the sideValue using the updated popper offsets
  35718. // take popper margin in account because we don't have this info available
  35719. var css = getStyleComputedProperty(data.instance.popper);
  35720. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35721. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35722. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35723. // prevent arrowElement from being placed not contiguously to its popper
  35724. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35725. data.arrowElement = arrowElement;
  35726. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35727. return data;
  35728. }
  35729. /**
  35730. * Get the opposite placement variation of the given one
  35731. * @method
  35732. * @memberof Popper.Utils
  35733. * @argument {String} placement variation
  35734. * @returns {String} flipped placement variation
  35735. */
  35736. function getOppositeVariation(variation) {
  35737. if (variation === 'end') {
  35738. return 'start';
  35739. } else if (variation === 'start') {
  35740. return 'end';
  35741. }
  35742. return variation;
  35743. }
  35744. /**
  35745. * List of accepted placements to use as values of the `placement` option.<br />
  35746. * Valid placements are:
  35747. * - `auto`
  35748. * - `top`
  35749. * - `right`
  35750. * - `bottom`
  35751. * - `left`
  35752. *
  35753. * Each placement can have a variation from this list:
  35754. * - `-start`
  35755. * - `-end`
  35756. *
  35757. * Variations are interpreted easily if you think of them as the left to right
  35758. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35759. * is right.<br />
  35760. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35761. *
  35762. * Some valid examples are:
  35763. * - `top-end` (on top of reference, right aligned)
  35764. * - `right-start` (on right of reference, top aligned)
  35765. * - `bottom` (on bottom, centered)
  35766. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35767. *
  35768. * @static
  35769. * @type {Array}
  35770. * @enum {String}
  35771. * @readonly
  35772. * @method placements
  35773. * @memberof Popper
  35774. */
  35775. 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'];
  35776. // Get rid of `auto` `auto-start` and `auto-end`
  35777. var validPlacements = placements.slice(3);
  35778. /**
  35779. * Given an initial placement, returns all the subsequent placements
  35780. * clockwise (or counter-clockwise).
  35781. *
  35782. * @method
  35783. * @memberof Popper.Utils
  35784. * @argument {String} placement - A valid placement (it accepts variations)
  35785. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35786. * @returns {Array} placements including their variations
  35787. */
  35788. function clockwise(placement) {
  35789. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35790. var index = validPlacements.indexOf(placement);
  35791. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35792. return counter ? arr.reverse() : arr;
  35793. }
  35794. var BEHAVIORS = {
  35795. FLIP: 'flip',
  35796. CLOCKWISE: 'clockwise',
  35797. COUNTERCLOCKWISE: 'counterclockwise'
  35798. };
  35799. /**
  35800. * @function
  35801. * @memberof Modifiers
  35802. * @argument {Object} data - The data object generated by update method
  35803. * @argument {Object} options - Modifiers configuration and options
  35804. * @returns {Object} The data object, properly modified
  35805. */
  35806. function flip(data, options) {
  35807. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35808. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35809. return data;
  35810. }
  35811. if (data.flipped && data.placement === data.originalPlacement) {
  35812. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35813. return data;
  35814. }
  35815. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35816. var placement = data.placement.split('-')[0];
  35817. var placementOpposite = getOppositePlacement(placement);
  35818. var variation = data.placement.split('-')[1] || '';
  35819. var flipOrder = [];
  35820. switch (options.behavior) {
  35821. case BEHAVIORS.FLIP:
  35822. flipOrder = [placement, placementOpposite];
  35823. break;
  35824. case BEHAVIORS.CLOCKWISE:
  35825. flipOrder = clockwise(placement);
  35826. break;
  35827. case BEHAVIORS.COUNTERCLOCKWISE:
  35828. flipOrder = clockwise(placement, true);
  35829. break;
  35830. default:
  35831. flipOrder = options.behavior;
  35832. }
  35833. flipOrder.forEach(function (step, index) {
  35834. if (placement !== step || flipOrder.length === index + 1) {
  35835. return data;
  35836. }
  35837. placement = data.placement.split('-')[0];
  35838. placementOpposite = getOppositePlacement(placement);
  35839. var popperOffsets = data.offsets.popper;
  35840. var refOffsets = data.offsets.reference;
  35841. // using floor because the reference offsets may contain decimals we are not going to consider here
  35842. var floor = Math.floor;
  35843. 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);
  35844. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35845. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35846. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35847. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35848. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35849. // flip the variation if required
  35850. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35851. // flips variation if reference element overflows boundaries
  35852. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35853. // flips variation if popper content overflows boundaries
  35854. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35855. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35856. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35857. // this boolean to detect any flip loop
  35858. data.flipped = true;
  35859. if (overlapsRef || overflowsBoundaries) {
  35860. placement = flipOrder[index + 1];
  35861. }
  35862. if (flippedVariation) {
  35863. variation = getOppositeVariation(variation);
  35864. }
  35865. data.placement = placement + (variation ? '-' + variation : '');
  35866. // this object contains `position`, we want to preserve it along with
  35867. // any additional property we may add in the future
  35868. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35869. data = runModifiers(data.instance.modifiers, data, 'flip');
  35870. }
  35871. });
  35872. return data;
  35873. }
  35874. /**
  35875. * @function
  35876. * @memberof Modifiers
  35877. * @argument {Object} data - The data object generated by update method
  35878. * @argument {Object} options - Modifiers configuration and options
  35879. * @returns {Object} The data object, properly modified
  35880. */
  35881. function keepTogether(data) {
  35882. var _data$offsets = data.offsets,
  35883. popper = _data$offsets.popper,
  35884. reference = _data$offsets.reference;
  35885. var placement = data.placement.split('-')[0];
  35886. var floor = Math.floor;
  35887. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35888. var side = isVertical ? 'right' : 'bottom';
  35889. var opSide = isVertical ? 'left' : 'top';
  35890. var measurement = isVertical ? 'width' : 'height';
  35891. if (popper[side] < floor(reference[opSide])) {
  35892. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35893. }
  35894. if (popper[opSide] > floor(reference[side])) {
  35895. data.offsets.popper[opSide] = floor(reference[side]);
  35896. }
  35897. return data;
  35898. }
  35899. /**
  35900. * Converts a string containing value + unit into a px value number
  35901. * @function
  35902. * @memberof {modifiers~offset}
  35903. * @private
  35904. * @argument {String} str - Value + unit string
  35905. * @argument {String} measurement - `height` or `width`
  35906. * @argument {Object} popperOffsets
  35907. * @argument {Object} referenceOffsets
  35908. * @returns {Number|String}
  35909. * Value in pixels, or original string if no values were extracted
  35910. */
  35911. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35912. // separate value from unit
  35913. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35914. var value = +split[1];
  35915. var unit = split[2];
  35916. // If it's not a number it's an operator, I guess
  35917. if (!value) {
  35918. return str;
  35919. }
  35920. if (unit.indexOf('%') === 0) {
  35921. var element = void 0;
  35922. switch (unit) {
  35923. case '%p':
  35924. element = popperOffsets;
  35925. break;
  35926. case '%':
  35927. case '%r':
  35928. default:
  35929. element = referenceOffsets;
  35930. }
  35931. var rect = getClientRect(element);
  35932. return rect[measurement] / 100 * value;
  35933. } else if (unit === 'vh' || unit === 'vw') {
  35934. // if is a vh or vw, we calculate the size based on the viewport
  35935. var size = void 0;
  35936. if (unit === 'vh') {
  35937. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35938. } else {
  35939. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35940. }
  35941. return size / 100 * value;
  35942. } else {
  35943. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35944. // if is an implicit unit, it's px, and we return just the value
  35945. return value;
  35946. }
  35947. }
  35948. /**
  35949. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35950. * @function
  35951. * @memberof {modifiers~offset}
  35952. * @private
  35953. * @argument {String} offset
  35954. * @argument {Object} popperOffsets
  35955. * @argument {Object} referenceOffsets
  35956. * @argument {String} basePlacement
  35957. * @returns {Array} a two cells array with x and y offsets in numbers
  35958. */
  35959. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35960. var offsets = [0, 0];
  35961. // Use height if placement is left or right and index is 0 otherwise use width
  35962. // in this way the first offset will use an axis and the second one
  35963. // will use the other one
  35964. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35965. // Split the offset string to obtain a list of values and operands
  35966. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35967. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35968. return frag.trim();
  35969. });
  35970. // Detect if the offset string contains a pair of values or a single one
  35971. // they could be separated by comma or space
  35972. var divider = fragments.indexOf(find(fragments, function (frag) {
  35973. return frag.search(/,|\s/) !== -1;
  35974. }));
  35975. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35976. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35977. }
  35978. // If divider is found, we divide the list of values and operands to divide
  35979. // them by ofset X and Y.
  35980. var splitRegex = /\s*,\s*|\s+/;
  35981. 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];
  35982. // Convert the values with units to absolute pixels to allow our computations
  35983. ops = ops.map(function (op, index) {
  35984. // Most of the units rely on the orientation of the popper
  35985. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35986. var mergeWithPrevious = false;
  35987. return op
  35988. // This aggregates any `+` or `-` sign that aren't considered operators
  35989. // e.g.: 10 + +5 => [10, +, +5]
  35990. .reduce(function (a, b) {
  35991. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35992. a[a.length - 1] = b;
  35993. mergeWithPrevious = true;
  35994. return a;
  35995. } else if (mergeWithPrevious) {
  35996. a[a.length - 1] += b;
  35997. mergeWithPrevious = false;
  35998. return a;
  35999. } else {
  36000. return a.concat(b);
  36001. }
  36002. }, [])
  36003. // Here we convert the string values into number values (in px)
  36004. .map(function (str) {
  36005. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36006. });
  36007. });
  36008. // Loop trough the offsets arrays and execute the operations
  36009. ops.forEach(function (op, index) {
  36010. op.forEach(function (frag, index2) {
  36011. if (isNumeric(frag)) {
  36012. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36013. }
  36014. });
  36015. });
  36016. return offsets;
  36017. }
  36018. /**
  36019. * @function
  36020. * @memberof Modifiers
  36021. * @argument {Object} data - The data object generated by update method
  36022. * @argument {Object} options - Modifiers configuration and options
  36023. * @argument {Number|String} options.offset=0
  36024. * The offset value as described in the modifier description
  36025. * @returns {Object} The data object, properly modified
  36026. */
  36027. function offset(data, _ref) {
  36028. var offset = _ref.offset;
  36029. var placement = data.placement,
  36030. _data$offsets = data.offsets,
  36031. popper = _data$offsets.popper,
  36032. reference = _data$offsets.reference;
  36033. var basePlacement = placement.split('-')[0];
  36034. var offsets = void 0;
  36035. if (isNumeric(+offset)) {
  36036. offsets = [+offset, 0];
  36037. } else {
  36038. offsets = parseOffset(offset, popper, reference, basePlacement);
  36039. }
  36040. if (basePlacement === 'left') {
  36041. popper.top += offsets[0];
  36042. popper.left -= offsets[1];
  36043. } else if (basePlacement === 'right') {
  36044. popper.top += offsets[0];
  36045. popper.left += offsets[1];
  36046. } else if (basePlacement === 'top') {
  36047. popper.left += offsets[0];
  36048. popper.top -= offsets[1];
  36049. } else if (basePlacement === 'bottom') {
  36050. popper.left += offsets[0];
  36051. popper.top += offsets[1];
  36052. }
  36053. data.popper = popper;
  36054. return data;
  36055. }
  36056. /**
  36057. * @function
  36058. * @memberof Modifiers
  36059. * @argument {Object} data - The data object generated by `update` method
  36060. * @argument {Object} options - Modifiers configuration and options
  36061. * @returns {Object} The data object, properly modified
  36062. */
  36063. function preventOverflow(data, options) {
  36064. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36065. // If offsetParent is the reference element, we really want to
  36066. // go one step up and use the next offsetParent as reference to
  36067. // avoid to make this modifier completely useless and look like broken
  36068. if (data.instance.reference === boundariesElement) {
  36069. boundariesElement = getOffsetParent(boundariesElement);
  36070. }
  36071. // NOTE: DOM access here
  36072. // resets the popper's position so that the document size can be calculated excluding
  36073. // the size of the popper element itself
  36074. var transformProp = getSupportedPropertyName('transform');
  36075. var popperStyles = data.instance.popper.style; // assignment to help minification
  36076. var top = popperStyles.top,
  36077. left = popperStyles.left,
  36078. transform = popperStyles[transformProp];
  36079. popperStyles.top = '';
  36080. popperStyles.left = '';
  36081. popperStyles[transformProp] = '';
  36082. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36083. // NOTE: DOM access here
  36084. // restores the original style properties after the offsets have been computed
  36085. popperStyles.top = top;
  36086. popperStyles.left = left;
  36087. popperStyles[transformProp] = transform;
  36088. options.boundaries = boundaries;
  36089. var order = options.priority;
  36090. var popper = data.offsets.popper;
  36091. var check = {
  36092. primary: function primary(placement) {
  36093. var value = popper[placement];
  36094. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36095. value = Math.max(popper[placement], boundaries[placement]);
  36096. }
  36097. return defineProperty({}, placement, value);
  36098. },
  36099. secondary: function secondary(placement) {
  36100. var mainSide = placement === 'right' ? 'left' : 'top';
  36101. var value = popper[mainSide];
  36102. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36103. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36104. }
  36105. return defineProperty({}, mainSide, value);
  36106. }
  36107. };
  36108. order.forEach(function (placement) {
  36109. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36110. popper = _extends({}, popper, check[side](placement));
  36111. });
  36112. data.offsets.popper = popper;
  36113. return data;
  36114. }
  36115. /**
  36116. * @function
  36117. * @memberof Modifiers
  36118. * @argument {Object} data - The data object generated by `update` method
  36119. * @argument {Object} options - Modifiers configuration and options
  36120. * @returns {Object} The data object, properly modified
  36121. */
  36122. function shift(data) {
  36123. var placement = data.placement;
  36124. var basePlacement = placement.split('-')[0];
  36125. var shiftvariation = placement.split('-')[1];
  36126. // if shift shiftvariation is specified, run the modifier
  36127. if (shiftvariation) {
  36128. var _data$offsets = data.offsets,
  36129. reference = _data$offsets.reference,
  36130. popper = _data$offsets.popper;
  36131. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36132. var side = isVertical ? 'left' : 'top';
  36133. var measurement = isVertical ? 'width' : 'height';
  36134. var shiftOffsets = {
  36135. start: defineProperty({}, side, reference[side]),
  36136. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36137. };
  36138. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36139. }
  36140. return data;
  36141. }
  36142. /**
  36143. * @function
  36144. * @memberof Modifiers
  36145. * @argument {Object} data - The data object generated by update method
  36146. * @argument {Object} options - Modifiers configuration and options
  36147. * @returns {Object} The data object, properly modified
  36148. */
  36149. function hide(data) {
  36150. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36151. return data;
  36152. }
  36153. var refRect = data.offsets.reference;
  36154. var bound = find(data.instance.modifiers, function (modifier) {
  36155. return modifier.name === 'preventOverflow';
  36156. }).boundaries;
  36157. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36158. // Avoid unnecessary DOM access if visibility hasn't changed
  36159. if (data.hide === true) {
  36160. return data;
  36161. }
  36162. data.hide = true;
  36163. data.attributes['x-out-of-boundaries'] = '';
  36164. } else {
  36165. // Avoid unnecessary DOM access if visibility hasn't changed
  36166. if (data.hide === false) {
  36167. return data;
  36168. }
  36169. data.hide = false;
  36170. data.attributes['x-out-of-boundaries'] = false;
  36171. }
  36172. return data;
  36173. }
  36174. /**
  36175. * @function
  36176. * @memberof Modifiers
  36177. * @argument {Object} data - The data object generated by `update` method
  36178. * @argument {Object} options - Modifiers configuration and options
  36179. * @returns {Object} The data object, properly modified
  36180. */
  36181. function inner(data) {
  36182. var placement = data.placement;
  36183. var basePlacement = placement.split('-')[0];
  36184. var _data$offsets = data.offsets,
  36185. popper = _data$offsets.popper,
  36186. reference = _data$offsets.reference;
  36187. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36188. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36189. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36190. data.placement = getOppositePlacement(placement);
  36191. data.offsets.popper = getClientRect(popper);
  36192. return data;
  36193. }
  36194. /**
  36195. * Modifier function, each modifier can have a function of this type assigned
  36196. * to its `fn` property.<br />
  36197. * These functions will be called on each update, this means that you must
  36198. * make sure they are performant enough to avoid performance bottlenecks.
  36199. *
  36200. * @function ModifierFn
  36201. * @argument {dataObject} data - The data object generated by `update` method
  36202. * @argument {Object} options - Modifiers configuration and options
  36203. * @returns {dataObject} The data object, properly modified
  36204. */
  36205. /**
  36206. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36207. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36208. * needed by the library.
  36209. *
  36210. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36211. * All the other properties are configurations that could be tweaked.
  36212. * @namespace modifiers
  36213. */
  36214. var modifiers = {
  36215. /**
  36216. * Modifier used to shift the popper on the start or end of its reference
  36217. * element.<br />
  36218. * It will read the variation of the `placement` property.<br />
  36219. * It can be one either `-end` or `-start`.
  36220. * @memberof modifiers
  36221. * @inner
  36222. */
  36223. shift: {
  36224. /** @prop {number} order=100 - Index used to define the order of execution */
  36225. order: 100,
  36226. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36227. enabled: true,
  36228. /** @prop {ModifierFn} */
  36229. fn: shift
  36230. },
  36231. /**
  36232. * The `offset` modifier can shift your popper on both its axis.
  36233. *
  36234. * It accepts the following units:
  36235. * - `px` or unit-less, interpreted as pixels
  36236. * - `%` or `%r`, percentage relative to the length of the reference element
  36237. * - `%p`, percentage relative to the length of the popper element
  36238. * - `vw`, CSS viewport width unit
  36239. * - `vh`, CSS viewport height unit
  36240. *
  36241. * For length is intended the main axis relative to the placement of the popper.<br />
  36242. * This means that if the placement is `top` or `bottom`, the length will be the
  36243. * `width`. In case of `left` or `right`, it will be the `height`.
  36244. *
  36245. * You can provide a single value (as `Number` or `String`), or a pair of values
  36246. * as `String` divided by a comma or one (or more) white spaces.<br />
  36247. * The latter is a deprecated method because it leads to confusion and will be
  36248. * removed in v2.<br />
  36249. * Additionally, it accepts additions and subtractions between different units.
  36250. * Note that multiplications and divisions aren't supported.
  36251. *
  36252. * Valid examples are:
  36253. * ```
  36254. * 10
  36255. * '10%'
  36256. * '10, 10'
  36257. * '10%, 10'
  36258. * '10 + 10%'
  36259. * '10 - 5vh + 3%'
  36260. * '-10px + 5vh, 5px - 6%'
  36261. * ```
  36262. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36263. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36264. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36265. *
  36266. * @memberof modifiers
  36267. * @inner
  36268. */
  36269. offset: {
  36270. /** @prop {number} order=200 - Index used to define the order of execution */
  36271. order: 200,
  36272. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36273. enabled: true,
  36274. /** @prop {ModifierFn} */
  36275. fn: offset,
  36276. /** @prop {Number|String} offset=0
  36277. * The offset value as described in the modifier description
  36278. */
  36279. offset: 0
  36280. },
  36281. /**
  36282. * Modifier used to prevent the popper from being positioned outside the boundary.
  36283. *
  36284. * A scenario exists where the reference itself is not within the boundaries.<br />
  36285. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36286. * In this case we need to decide whether the popper should either:
  36287. *
  36288. * - detach from the reference and remain "trapped" in the boundaries, or
  36289. * - if it should ignore the boundary and "escape with its reference"
  36290. *
  36291. * When `escapeWithReference` is set to`true` and reference is completely
  36292. * outside its boundaries, the popper will overflow (or completely leave)
  36293. * the boundaries in order to remain attached to the edge of the reference.
  36294. *
  36295. * @memberof modifiers
  36296. * @inner
  36297. */
  36298. preventOverflow: {
  36299. /** @prop {number} order=300 - Index used to define the order of execution */
  36300. order: 300,
  36301. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36302. enabled: true,
  36303. /** @prop {ModifierFn} */
  36304. fn: preventOverflow,
  36305. /**
  36306. * @prop {Array} [priority=['left','right','top','bottom']]
  36307. * Popper will try to prevent overflow following these priorities by default,
  36308. * then, it could overflow on the left and on top of the `boundariesElement`
  36309. */
  36310. priority: ['left', 'right', 'top', 'bottom'],
  36311. /**
  36312. * @prop {number} padding=5
  36313. * Amount of pixel used to define a minimum distance between the boundaries
  36314. * and the popper. This makes sure the popper always has a little padding
  36315. * between the edges of its container
  36316. */
  36317. padding: 5,
  36318. /**
  36319. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36320. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36321. * `viewport` or any DOM element.
  36322. */
  36323. boundariesElement: 'scrollParent'
  36324. },
  36325. /**
  36326. * Modifier used to make sure the reference and its popper stay near each other
  36327. * without leaving any gap between the two. Especially useful when the arrow is
  36328. * enabled and you want to ensure that it points to its reference element.
  36329. * It cares only about the first axis. You can still have poppers with margin
  36330. * between the popper and its reference element.
  36331. * @memberof modifiers
  36332. * @inner
  36333. */
  36334. keepTogether: {
  36335. /** @prop {number} order=400 - Index used to define the order of execution */
  36336. order: 400,
  36337. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36338. enabled: true,
  36339. /** @prop {ModifierFn} */
  36340. fn: keepTogether
  36341. },
  36342. /**
  36343. * This modifier is used to move the `arrowElement` of the popper to make
  36344. * sure it is positioned between the reference element and its popper element.
  36345. * It will read the outer size of the `arrowElement` node to detect how many
  36346. * pixels of conjunction are needed.
  36347. *
  36348. * It has no effect if no `arrowElement` is provided.
  36349. * @memberof modifiers
  36350. * @inner
  36351. */
  36352. arrow: {
  36353. /** @prop {number} order=500 - Index used to define the order of execution */
  36354. order: 500,
  36355. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36356. enabled: true,
  36357. /** @prop {ModifierFn} */
  36358. fn: arrow,
  36359. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36360. element: '[x-arrow]'
  36361. },
  36362. /**
  36363. * Modifier used to flip the popper's placement when it starts to overlap its
  36364. * reference element.
  36365. *
  36366. * Requires the `preventOverflow` modifier before it in order to work.
  36367. *
  36368. * **NOTE:** this modifier will interrupt the current update cycle and will
  36369. * restart it if it detects the need to flip the placement.
  36370. * @memberof modifiers
  36371. * @inner
  36372. */
  36373. flip: {
  36374. /** @prop {number} order=600 - Index used to define the order of execution */
  36375. order: 600,
  36376. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36377. enabled: true,
  36378. /** @prop {ModifierFn} */
  36379. fn: flip,
  36380. /**
  36381. * @prop {String|Array} behavior='flip'
  36382. * The behavior used to change the popper's placement. It can be one of
  36383. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36384. * placements (with optional variations)
  36385. */
  36386. behavior: 'flip',
  36387. /**
  36388. * @prop {number} padding=5
  36389. * The popper will flip if it hits the edges of the `boundariesElement`
  36390. */
  36391. padding: 5,
  36392. /**
  36393. * @prop {String|HTMLElement} boundariesElement='viewport'
  36394. * The element which will define the boundaries of the popper position.
  36395. * The popper will never be placed outside of the defined boundaries
  36396. * (except if `keepTogether` is enabled)
  36397. */
  36398. boundariesElement: 'viewport',
  36399. /**
  36400. * @prop {Boolean} flipVariations=false
  36401. * The popper will switch placement variation between `-start` and `-end` when
  36402. * the reference element overlaps its boundaries.
  36403. *
  36404. * The original placement should have a set variation.
  36405. */
  36406. flipVariations: false,
  36407. /**
  36408. * @prop {Boolean} flipVariationsByContent=false
  36409. * The popper will switch placement variation between `-start` and `-end` when
  36410. * the popper element overlaps its reference boundaries.
  36411. *
  36412. * The original placement should have a set variation.
  36413. */
  36414. flipVariationsByContent: false
  36415. },
  36416. /**
  36417. * Modifier used to make the popper flow toward the inner of the reference element.
  36418. * By default, when this modifier is disabled, the popper will be placed outside
  36419. * the reference element.
  36420. * @memberof modifiers
  36421. * @inner
  36422. */
  36423. inner: {
  36424. /** @prop {number} order=700 - Index used to define the order of execution */
  36425. order: 700,
  36426. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36427. enabled: false,
  36428. /** @prop {ModifierFn} */
  36429. fn: inner
  36430. },
  36431. /**
  36432. * Modifier used to hide the popper when its reference element is outside of the
  36433. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36434. * be used to hide with a CSS selector the popper when its reference is
  36435. * out of boundaries.
  36436. *
  36437. * Requires the `preventOverflow` modifier before it in order to work.
  36438. * @memberof modifiers
  36439. * @inner
  36440. */
  36441. hide: {
  36442. /** @prop {number} order=800 - Index used to define the order of execution */
  36443. order: 800,
  36444. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36445. enabled: true,
  36446. /** @prop {ModifierFn} */
  36447. fn: hide
  36448. },
  36449. /**
  36450. * Computes the style that will be applied to the popper element to gets
  36451. * properly positioned.
  36452. *
  36453. * Note that this modifier will not touch the DOM, it just prepares the styles
  36454. * so that `applyStyle` modifier can apply it. This separation is useful
  36455. * in case you need to replace `applyStyle` with a custom implementation.
  36456. *
  36457. * This modifier has `850` as `order` value to maintain backward compatibility
  36458. * with previous versions of Popper.js. Expect the modifiers ordering method
  36459. * to change in future major versions of the library.
  36460. *
  36461. * @memberof modifiers
  36462. * @inner
  36463. */
  36464. computeStyle: {
  36465. /** @prop {number} order=850 - Index used to define the order of execution */
  36466. order: 850,
  36467. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36468. enabled: true,
  36469. /** @prop {ModifierFn} */
  36470. fn: computeStyle,
  36471. /**
  36472. * @prop {Boolean} gpuAcceleration=true
  36473. * If true, it uses the CSS 3D transformation to position the popper.
  36474. * Otherwise, it will use the `top` and `left` properties
  36475. */
  36476. gpuAcceleration: true,
  36477. /**
  36478. * @prop {string} [x='bottom']
  36479. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36480. * Change this if your popper should grow in a direction different from `bottom`
  36481. */
  36482. x: 'bottom',
  36483. /**
  36484. * @prop {string} [x='left']
  36485. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36486. * Change this if your popper should grow in a direction different from `right`
  36487. */
  36488. y: 'right'
  36489. },
  36490. /**
  36491. * Applies the computed styles to the popper element.
  36492. *
  36493. * All the DOM manipulations are limited to this modifier. This is useful in case
  36494. * you want to integrate Popper.js inside a framework or view library and you
  36495. * want to delegate all the DOM manipulations to it.
  36496. *
  36497. * Note that if you disable this modifier, you must make sure the popper element
  36498. * has its position set to `absolute` before Popper.js can do its work!
  36499. *
  36500. * Just disable this modifier and define your own to achieve the desired effect.
  36501. *
  36502. * @memberof modifiers
  36503. * @inner
  36504. */
  36505. applyStyle: {
  36506. /** @prop {number} order=900 - Index used to define the order of execution */
  36507. order: 900,
  36508. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36509. enabled: true,
  36510. /** @prop {ModifierFn} */
  36511. fn: applyStyle,
  36512. /** @prop {Function} */
  36513. onLoad: applyStyleOnLoad,
  36514. /**
  36515. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36516. * @prop {Boolean} gpuAcceleration=true
  36517. * If true, it uses the CSS 3D transformation to position the popper.
  36518. * Otherwise, it will use the `top` and `left` properties
  36519. */
  36520. gpuAcceleration: undefined
  36521. }
  36522. };
  36523. /**
  36524. * The `dataObject` is an object containing all the information used by Popper.js.
  36525. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36526. * @name dataObject
  36527. * @property {Object} data.instance The Popper.js instance
  36528. * @property {String} data.placement Placement applied to popper
  36529. * @property {String} data.originalPlacement Placement originally defined on init
  36530. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36531. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36532. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36533. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36534. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36535. * @property {Object} data.boundaries Offsets of the popper boundaries
  36536. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36537. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36538. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36539. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36540. */
  36541. /**
  36542. * Default options provided to Popper.js constructor.<br />
  36543. * These can be overridden using the `options` argument of Popper.js.<br />
  36544. * To override an option, simply pass an object with the same
  36545. * structure of the `options` object, as the 3rd argument. For example:
  36546. * ```
  36547. * new Popper(ref, pop, {
  36548. * modifiers: {
  36549. * preventOverflow: { enabled: false }
  36550. * }
  36551. * })
  36552. * ```
  36553. * @type {Object}
  36554. * @static
  36555. * @memberof Popper
  36556. */
  36557. var Defaults = {
  36558. /**
  36559. * Popper's placement.
  36560. * @prop {Popper.placements} placement='bottom'
  36561. */
  36562. placement: 'bottom',
  36563. /**
  36564. * Set this to true if you want popper to position it self in 'fixed' mode
  36565. * @prop {Boolean} positionFixed=false
  36566. */
  36567. positionFixed: false,
  36568. /**
  36569. * Whether events (resize, scroll) are initially enabled.
  36570. * @prop {Boolean} eventsEnabled=true
  36571. */
  36572. eventsEnabled: true,
  36573. /**
  36574. * Set to true if you want to automatically remove the popper when
  36575. * you call the `destroy` method.
  36576. * @prop {Boolean} removeOnDestroy=false
  36577. */
  36578. removeOnDestroy: false,
  36579. /**
  36580. * Callback called when the popper is created.<br />
  36581. * By default, it is set to no-op.<br />
  36582. * Access Popper.js instance with `data.instance`.
  36583. * @prop {onCreate}
  36584. */
  36585. onCreate: function onCreate() {},
  36586. /**
  36587. * Callback called when the popper is updated. This callback is not called
  36588. * on the initialization/creation of the popper, but only on subsequent
  36589. * updates.<br />
  36590. * By default, it is set to no-op.<br />
  36591. * Access Popper.js instance with `data.instance`.
  36592. * @prop {onUpdate}
  36593. */
  36594. onUpdate: function onUpdate() {},
  36595. /**
  36596. * List of modifiers used to modify the offsets before they are applied to the popper.
  36597. * They provide most of the functionalities of Popper.js.
  36598. * @prop {modifiers}
  36599. */
  36600. modifiers: modifiers
  36601. };
  36602. /**
  36603. * @callback onCreate
  36604. * @param {dataObject} data
  36605. */
  36606. /**
  36607. * @callback onUpdate
  36608. * @param {dataObject} data
  36609. */
  36610. // Utils
  36611. // Methods
  36612. var Popper = function () {
  36613. /**
  36614. * Creates a new Popper.js instance.
  36615. * @class Popper
  36616. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36617. * @param {Element} popper - The HTML / XML element used as the popper
  36618. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36619. * @return {Object} instance - The generated Popper.js instance
  36620. */
  36621. function Popper(reference, popper) {
  36622. var _this = this;
  36623. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36624. classCallCheck(this, Popper);
  36625. this.scheduleUpdate = function () {
  36626. return requestAnimationFrame(_this.update);
  36627. };
  36628. // make update() debounced, so that it only runs at most once-per-tick
  36629. this.update = debounce(this.update.bind(this));
  36630. // with {} we create a new object with the options inside it
  36631. this.options = _extends({}, Popper.Defaults, options);
  36632. // init state
  36633. this.state = {
  36634. isDestroyed: false,
  36635. isCreated: false,
  36636. scrollParents: []
  36637. };
  36638. // get reference and popper elements (allow jQuery wrappers)
  36639. this.reference = reference && reference.jquery ? reference[0] : reference;
  36640. this.popper = popper && popper.jquery ? popper[0] : popper;
  36641. // Deep merge modifiers options
  36642. this.options.modifiers = {};
  36643. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36644. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36645. });
  36646. // Refactoring modifiers' list (Object => Array)
  36647. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36648. return _extends({
  36649. name: name
  36650. }, _this.options.modifiers[name]);
  36651. })
  36652. // sort the modifiers by order
  36653. .sort(function (a, b) {
  36654. return a.order - b.order;
  36655. });
  36656. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36657. // such code is executed in the same order of its modifier
  36658. // they could add new properties to their options configuration
  36659. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36660. this.modifiers.forEach(function (modifierOptions) {
  36661. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36662. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36663. }
  36664. });
  36665. // fire the first update to position the popper in the right place
  36666. this.update();
  36667. var eventsEnabled = this.options.eventsEnabled;
  36668. if (eventsEnabled) {
  36669. // setup event listeners, they will take care of update the position in specific situations
  36670. this.enableEventListeners();
  36671. }
  36672. this.state.eventsEnabled = eventsEnabled;
  36673. }
  36674. // We can't use class properties because they don't get listed in the
  36675. // class prototype and break stuff like Sinon stubs
  36676. createClass(Popper, [{
  36677. key: 'update',
  36678. value: function update$$1() {
  36679. return update.call(this);
  36680. }
  36681. }, {
  36682. key: 'destroy',
  36683. value: function destroy$$1() {
  36684. return destroy.call(this);
  36685. }
  36686. }, {
  36687. key: 'enableEventListeners',
  36688. value: function enableEventListeners$$1() {
  36689. return enableEventListeners.call(this);
  36690. }
  36691. }, {
  36692. key: 'disableEventListeners',
  36693. value: function disableEventListeners$$1() {
  36694. return disableEventListeners.call(this);
  36695. }
  36696. /**
  36697. * Schedules an update. It will run on the next UI update available.
  36698. * @method scheduleUpdate
  36699. * @memberof Popper
  36700. */
  36701. /**
  36702. * Collection of utilities useful when writing custom modifiers.
  36703. * Starting from version 1.7, this method is available only if you
  36704. * include `popper-utils.js` before `popper.js`.
  36705. *
  36706. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36707. * and will be removed in v2! Use the PopperUtils module directly instead.
  36708. * Due to the high instability of the methods contained in Utils, we can't
  36709. * guarantee them to follow semver. Use them at your own risk!
  36710. * @static
  36711. * @private
  36712. * @type {Object}
  36713. * @deprecated since version 1.8
  36714. * @member Utils
  36715. * @memberof Popper
  36716. */
  36717. }]);
  36718. return Popper;
  36719. }();
  36720. /**
  36721. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36722. * and lets you use it as replacement of a real DOM node.<br />
  36723. * You can use this method to position a popper relatively to a set of coordinates
  36724. * in case you don't have a DOM node to use as reference.
  36725. *
  36726. * ```
  36727. * new Popper(referenceObject, popperNode);
  36728. * ```
  36729. *
  36730. * NB: This feature isn't supported in Internet Explorer 10.
  36731. * @name referenceObject
  36732. * @property {Function} data.getBoundingClientRect
  36733. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36734. * @property {number} data.clientWidth
  36735. * An ES6 getter that will return the width of the virtual reference element.
  36736. * @property {number} data.clientHeight
  36737. * An ES6 getter that will return the height of the virtual reference element.
  36738. */
  36739. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36740. Popper.placements = placements;
  36741. Popper.Defaults = Defaults;
  36742. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36743. //# sourceMappingURL=popper.js.map
  36744. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36745. /***/ }),
  36746. /***/ "./node_modules/process/browser.js":
  36747. /*!*****************************************!*\
  36748. !*** ./node_modules/process/browser.js ***!
  36749. \*****************************************/
  36750. /*! no static exports found */
  36751. /***/ (function(module, exports) {
  36752. // shim for using process in browser
  36753. var process = module.exports = {};
  36754. // cached from whatever global is present so that test runners that stub it
  36755. // don't break things. But we need to wrap it in a try catch in case it is
  36756. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36757. // function because try/catches deoptimize in certain engines.
  36758. var cachedSetTimeout;
  36759. var cachedClearTimeout;
  36760. function defaultSetTimout() {
  36761. throw new Error('setTimeout has not been defined');
  36762. }
  36763. function defaultClearTimeout () {
  36764. throw new Error('clearTimeout has not been defined');
  36765. }
  36766. (function () {
  36767. try {
  36768. if (typeof setTimeout === 'function') {
  36769. cachedSetTimeout = setTimeout;
  36770. } else {
  36771. cachedSetTimeout = defaultSetTimout;
  36772. }
  36773. } catch (e) {
  36774. cachedSetTimeout = defaultSetTimout;
  36775. }
  36776. try {
  36777. if (typeof clearTimeout === 'function') {
  36778. cachedClearTimeout = clearTimeout;
  36779. } else {
  36780. cachedClearTimeout = defaultClearTimeout;
  36781. }
  36782. } catch (e) {
  36783. cachedClearTimeout = defaultClearTimeout;
  36784. }
  36785. } ())
  36786. function runTimeout(fun) {
  36787. if (cachedSetTimeout === setTimeout) {
  36788. //normal enviroments in sane situations
  36789. return setTimeout(fun, 0);
  36790. }
  36791. // if setTimeout wasn't available but was latter defined
  36792. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36793. cachedSetTimeout = setTimeout;
  36794. return setTimeout(fun, 0);
  36795. }
  36796. try {
  36797. // when when somebody has screwed with setTimeout but no I.E. maddness
  36798. return cachedSetTimeout(fun, 0);
  36799. } catch(e){
  36800. try {
  36801. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36802. return cachedSetTimeout.call(null, fun, 0);
  36803. } catch(e){
  36804. // 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
  36805. return cachedSetTimeout.call(this, fun, 0);
  36806. }
  36807. }
  36808. }
  36809. function runClearTimeout(marker) {
  36810. if (cachedClearTimeout === clearTimeout) {
  36811. //normal enviroments in sane situations
  36812. return clearTimeout(marker);
  36813. }
  36814. // if clearTimeout wasn't available but was latter defined
  36815. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36816. cachedClearTimeout = clearTimeout;
  36817. return clearTimeout(marker);
  36818. }
  36819. try {
  36820. // when when somebody has screwed with setTimeout but no I.E. maddness
  36821. return cachedClearTimeout(marker);
  36822. } catch (e){
  36823. try {
  36824. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36825. return cachedClearTimeout.call(null, marker);
  36826. } catch (e){
  36827. // 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.
  36828. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36829. return cachedClearTimeout.call(this, marker);
  36830. }
  36831. }
  36832. }
  36833. var queue = [];
  36834. var draining = false;
  36835. var currentQueue;
  36836. var queueIndex = -1;
  36837. function cleanUpNextTick() {
  36838. if (!draining || !currentQueue) {
  36839. return;
  36840. }
  36841. draining = false;
  36842. if (currentQueue.length) {
  36843. queue = currentQueue.concat(queue);
  36844. } else {
  36845. queueIndex = -1;
  36846. }
  36847. if (queue.length) {
  36848. drainQueue();
  36849. }
  36850. }
  36851. function drainQueue() {
  36852. if (draining) {
  36853. return;
  36854. }
  36855. var timeout = runTimeout(cleanUpNextTick);
  36856. draining = true;
  36857. var len = queue.length;
  36858. while(len) {
  36859. currentQueue = queue;
  36860. queue = [];
  36861. while (++queueIndex < len) {
  36862. if (currentQueue) {
  36863. currentQueue[queueIndex].run();
  36864. }
  36865. }
  36866. queueIndex = -1;
  36867. len = queue.length;
  36868. }
  36869. currentQueue = null;
  36870. draining = false;
  36871. runClearTimeout(timeout);
  36872. }
  36873. process.nextTick = function (fun) {
  36874. var args = new Array(arguments.length - 1);
  36875. if (arguments.length > 1) {
  36876. for (var i = 1; i < arguments.length; i++) {
  36877. args[i - 1] = arguments[i];
  36878. }
  36879. }
  36880. queue.push(new Item(fun, args));
  36881. if (queue.length === 1 && !draining) {
  36882. runTimeout(drainQueue);
  36883. }
  36884. };
  36885. // v8 likes predictible objects
  36886. function Item(fun, array) {
  36887. this.fun = fun;
  36888. this.array = array;
  36889. }
  36890. Item.prototype.run = function () {
  36891. this.fun.apply(null, this.array);
  36892. };
  36893. process.title = 'browser';
  36894. process.browser = true;
  36895. process.env = {};
  36896. process.argv = [];
  36897. process.version = ''; // empty string to avoid regexp issues
  36898. process.versions = {};
  36899. function noop() {}
  36900. process.on = noop;
  36901. process.addListener = noop;
  36902. process.once = noop;
  36903. process.off = noop;
  36904. process.removeListener = noop;
  36905. process.removeAllListeners = noop;
  36906. process.emit = noop;
  36907. process.prependListener = noop;
  36908. process.prependOnceListener = noop;
  36909. process.listeners = function (name) { return [] }
  36910. process.binding = function (name) {
  36911. throw new Error('process.binding is not supported');
  36912. };
  36913. process.cwd = function () { return '/' };
  36914. process.chdir = function (dir) {
  36915. throw new Error('process.chdir is not supported');
  36916. };
  36917. process.umask = function() { return 0; };
  36918. /***/ }),
  36919. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36920. /*!***************************************************!*\
  36921. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36922. \***************************************************/
  36923. /*! no static exports found */
  36924. /***/ (function(module, exports, __webpack_require__) {
  36925. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36926. * Pusher JavaScript Library v5.0.3
  36927. * https://pusher.com/
  36928. *
  36929. * Copyright 2017, Pusher
  36930. * Released under the MIT licence.
  36931. */
  36932. (function webpackUniversalModuleDefinition(root, factory) {
  36933. if(true)
  36934. module.exports = factory();
  36935. else {}
  36936. })(window, function() {
  36937. return /******/ (function(modules) { // webpackBootstrap
  36938. /******/ // The module cache
  36939. /******/ var installedModules = {};
  36940. /******/
  36941. /******/ // The require function
  36942. /******/ function __webpack_require__(moduleId) {
  36943. /******/
  36944. /******/ // Check if module is in cache
  36945. /******/ if(installedModules[moduleId]) {
  36946. /******/ return installedModules[moduleId].exports;
  36947. /******/ }
  36948. /******/ // Create a new module (and put it into the cache)
  36949. /******/ var module = installedModules[moduleId] = {
  36950. /******/ i: moduleId,
  36951. /******/ l: false,
  36952. /******/ exports: {}
  36953. /******/ };
  36954. /******/
  36955. /******/ // Execute the module function
  36956. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36957. /******/
  36958. /******/ // Flag the module as loaded
  36959. /******/ module.l = true;
  36960. /******/
  36961. /******/ // Return the exports of the module
  36962. /******/ return module.exports;
  36963. /******/ }
  36964. /******/
  36965. /******/
  36966. /******/ // expose the modules object (__webpack_modules__)
  36967. /******/ __webpack_require__.m = modules;
  36968. /******/
  36969. /******/ // expose the module cache
  36970. /******/ __webpack_require__.c = installedModules;
  36971. /******/
  36972. /******/ // define getter function for harmony exports
  36973. /******/ __webpack_require__.d = function(exports, name, getter) {
  36974. /******/ if(!__webpack_require__.o(exports, name)) {
  36975. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36976. /******/ }
  36977. /******/ };
  36978. /******/
  36979. /******/ // define __esModule on exports
  36980. /******/ __webpack_require__.r = function(exports) {
  36981. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36982. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36983. /******/ }
  36984. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36985. /******/ };
  36986. /******/
  36987. /******/ // create a fake namespace object
  36988. /******/ // mode & 1: value is a module id, require it
  36989. /******/ // mode & 2: merge all properties of value into the ns
  36990. /******/ // mode & 4: return value when already ns object
  36991. /******/ // mode & 8|1: behave like require
  36992. /******/ __webpack_require__.t = function(value, mode) {
  36993. /******/ if(mode & 1) value = __webpack_require__(value);
  36994. /******/ if(mode & 8) return value;
  36995. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36996. /******/ var ns = Object.create(null);
  36997. /******/ __webpack_require__.r(ns);
  36998. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36999. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37000. /******/ return ns;
  37001. /******/ };
  37002. /******/
  37003. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37004. /******/ __webpack_require__.n = function(module) {
  37005. /******/ var getter = module && module.__esModule ?
  37006. /******/ function getDefault() { return module['default']; } :
  37007. /******/ function getModuleExports() { return module; };
  37008. /******/ __webpack_require__.d(getter, 'a', getter);
  37009. /******/ return getter;
  37010. /******/ };
  37011. /******/
  37012. /******/ // Object.prototype.hasOwnProperty.call
  37013. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37014. /******/
  37015. /******/ // __webpack_public_path__
  37016. /******/ __webpack_require__.p = "";
  37017. /******/
  37018. /******/
  37019. /******/ // Load entry module and return exports
  37020. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37021. /******/ })
  37022. /************************************************************************/
  37023. /******/ ([
  37024. /* 0 */
  37025. /***/ (function(module, exports, __webpack_require__) {
  37026. (function(nacl) {
  37027. 'use strict';
  37028. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37029. // Public domain.
  37030. //
  37031. // Implementation derived from TweetNaCl version 20140427.
  37032. // See for details: http://tweetnacl.cr.yp.to/
  37033. var gf = function(init) {
  37034. var i, r = new Float64Array(16);
  37035. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37036. return r;
  37037. };
  37038. // Pluggable, initialized in high-level API below.
  37039. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37040. var _0 = new Uint8Array(16);
  37041. var _9 = new Uint8Array(32); _9[0] = 9;
  37042. var gf0 = gf(),
  37043. gf1 = gf([1]),
  37044. _121665 = gf([0xdb41, 1]),
  37045. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37046. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37047. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37048. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37049. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37050. function ts64(x, i, h, l) {
  37051. x[i] = (h >> 24) & 0xff;
  37052. x[i+1] = (h >> 16) & 0xff;
  37053. x[i+2] = (h >> 8) & 0xff;
  37054. x[i+3] = h & 0xff;
  37055. x[i+4] = (l >> 24) & 0xff;
  37056. x[i+5] = (l >> 16) & 0xff;
  37057. x[i+6] = (l >> 8) & 0xff;
  37058. x[i+7] = l & 0xff;
  37059. }
  37060. function vn(x, xi, y, yi, n) {
  37061. var i,d = 0;
  37062. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37063. return (1 & ((d - 1) >>> 8)) - 1;
  37064. }
  37065. function crypto_verify_16(x, xi, y, yi) {
  37066. return vn(x,xi,y,yi,16);
  37067. }
  37068. function crypto_verify_32(x, xi, y, yi) {
  37069. return vn(x,xi,y,yi,32);
  37070. }
  37071. function core_salsa20(o, p, k, c) {
  37072. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37073. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37074. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37075. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37076. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37077. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37078. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37079. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37080. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37081. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37082. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37083. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37084. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37085. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37086. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37087. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37088. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37089. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37090. x15 = j15, u;
  37091. for (var i = 0; i < 20; i += 2) {
  37092. u = x0 + x12 | 0;
  37093. x4 ^= u<<7 | u>>>(32-7);
  37094. u = x4 + x0 | 0;
  37095. x8 ^= u<<9 | u>>>(32-9);
  37096. u = x8 + x4 | 0;
  37097. x12 ^= u<<13 | u>>>(32-13);
  37098. u = x12 + x8 | 0;
  37099. x0 ^= u<<18 | u>>>(32-18);
  37100. u = x5 + x1 | 0;
  37101. x9 ^= u<<7 | u>>>(32-7);
  37102. u = x9 + x5 | 0;
  37103. x13 ^= u<<9 | u>>>(32-9);
  37104. u = x13 + x9 | 0;
  37105. x1 ^= u<<13 | u>>>(32-13);
  37106. u = x1 + x13 | 0;
  37107. x5 ^= u<<18 | u>>>(32-18);
  37108. u = x10 + x6 | 0;
  37109. x14 ^= u<<7 | u>>>(32-7);
  37110. u = x14 + x10 | 0;
  37111. x2 ^= u<<9 | u>>>(32-9);
  37112. u = x2 + x14 | 0;
  37113. x6 ^= u<<13 | u>>>(32-13);
  37114. u = x6 + x2 | 0;
  37115. x10 ^= u<<18 | u>>>(32-18);
  37116. u = x15 + x11 | 0;
  37117. x3 ^= u<<7 | u>>>(32-7);
  37118. u = x3 + x15 | 0;
  37119. x7 ^= u<<9 | u>>>(32-9);
  37120. u = x7 + x3 | 0;
  37121. x11 ^= u<<13 | u>>>(32-13);
  37122. u = x11 + x7 | 0;
  37123. x15 ^= u<<18 | u>>>(32-18);
  37124. u = x0 + x3 | 0;
  37125. x1 ^= u<<7 | u>>>(32-7);
  37126. u = x1 + x0 | 0;
  37127. x2 ^= u<<9 | u>>>(32-9);
  37128. u = x2 + x1 | 0;
  37129. x3 ^= u<<13 | u>>>(32-13);
  37130. u = x3 + x2 | 0;
  37131. x0 ^= u<<18 | u>>>(32-18);
  37132. u = x5 + x4 | 0;
  37133. x6 ^= u<<7 | u>>>(32-7);
  37134. u = x6 + x5 | 0;
  37135. x7 ^= u<<9 | u>>>(32-9);
  37136. u = x7 + x6 | 0;
  37137. x4 ^= u<<13 | u>>>(32-13);
  37138. u = x4 + x7 | 0;
  37139. x5 ^= u<<18 | u>>>(32-18);
  37140. u = x10 + x9 | 0;
  37141. x11 ^= u<<7 | u>>>(32-7);
  37142. u = x11 + x10 | 0;
  37143. x8 ^= u<<9 | u>>>(32-9);
  37144. u = x8 + x11 | 0;
  37145. x9 ^= u<<13 | u>>>(32-13);
  37146. u = x9 + x8 | 0;
  37147. x10 ^= u<<18 | u>>>(32-18);
  37148. u = x15 + x14 | 0;
  37149. x12 ^= u<<7 | u>>>(32-7);
  37150. u = x12 + x15 | 0;
  37151. x13 ^= u<<9 | u>>>(32-9);
  37152. u = x13 + x12 | 0;
  37153. x14 ^= u<<13 | u>>>(32-13);
  37154. u = x14 + x13 | 0;
  37155. x15 ^= u<<18 | u>>>(32-18);
  37156. }
  37157. x0 = x0 + j0 | 0;
  37158. x1 = x1 + j1 | 0;
  37159. x2 = x2 + j2 | 0;
  37160. x3 = x3 + j3 | 0;
  37161. x4 = x4 + j4 | 0;
  37162. x5 = x5 + j5 | 0;
  37163. x6 = x6 + j6 | 0;
  37164. x7 = x7 + j7 | 0;
  37165. x8 = x8 + j8 | 0;
  37166. x9 = x9 + j9 | 0;
  37167. x10 = x10 + j10 | 0;
  37168. x11 = x11 + j11 | 0;
  37169. x12 = x12 + j12 | 0;
  37170. x13 = x13 + j13 | 0;
  37171. x14 = x14 + j14 | 0;
  37172. x15 = x15 + j15 | 0;
  37173. o[ 0] = x0 >>> 0 & 0xff;
  37174. o[ 1] = x0 >>> 8 & 0xff;
  37175. o[ 2] = x0 >>> 16 & 0xff;
  37176. o[ 3] = x0 >>> 24 & 0xff;
  37177. o[ 4] = x1 >>> 0 & 0xff;
  37178. o[ 5] = x1 >>> 8 & 0xff;
  37179. o[ 6] = x1 >>> 16 & 0xff;
  37180. o[ 7] = x1 >>> 24 & 0xff;
  37181. o[ 8] = x2 >>> 0 & 0xff;
  37182. o[ 9] = x2 >>> 8 & 0xff;
  37183. o[10] = x2 >>> 16 & 0xff;
  37184. o[11] = x2 >>> 24 & 0xff;
  37185. o[12] = x3 >>> 0 & 0xff;
  37186. o[13] = x3 >>> 8 & 0xff;
  37187. o[14] = x3 >>> 16 & 0xff;
  37188. o[15] = x3 >>> 24 & 0xff;
  37189. o[16] = x4 >>> 0 & 0xff;
  37190. o[17] = x4 >>> 8 & 0xff;
  37191. o[18] = x4 >>> 16 & 0xff;
  37192. o[19] = x4 >>> 24 & 0xff;
  37193. o[20] = x5 >>> 0 & 0xff;
  37194. o[21] = x5 >>> 8 & 0xff;
  37195. o[22] = x5 >>> 16 & 0xff;
  37196. o[23] = x5 >>> 24 & 0xff;
  37197. o[24] = x6 >>> 0 & 0xff;
  37198. o[25] = x6 >>> 8 & 0xff;
  37199. o[26] = x6 >>> 16 & 0xff;
  37200. o[27] = x6 >>> 24 & 0xff;
  37201. o[28] = x7 >>> 0 & 0xff;
  37202. o[29] = x7 >>> 8 & 0xff;
  37203. o[30] = x7 >>> 16 & 0xff;
  37204. o[31] = x7 >>> 24 & 0xff;
  37205. o[32] = x8 >>> 0 & 0xff;
  37206. o[33] = x8 >>> 8 & 0xff;
  37207. o[34] = x8 >>> 16 & 0xff;
  37208. o[35] = x8 >>> 24 & 0xff;
  37209. o[36] = x9 >>> 0 & 0xff;
  37210. o[37] = x9 >>> 8 & 0xff;
  37211. o[38] = x9 >>> 16 & 0xff;
  37212. o[39] = x9 >>> 24 & 0xff;
  37213. o[40] = x10 >>> 0 & 0xff;
  37214. o[41] = x10 >>> 8 & 0xff;
  37215. o[42] = x10 >>> 16 & 0xff;
  37216. o[43] = x10 >>> 24 & 0xff;
  37217. o[44] = x11 >>> 0 & 0xff;
  37218. o[45] = x11 >>> 8 & 0xff;
  37219. o[46] = x11 >>> 16 & 0xff;
  37220. o[47] = x11 >>> 24 & 0xff;
  37221. o[48] = x12 >>> 0 & 0xff;
  37222. o[49] = x12 >>> 8 & 0xff;
  37223. o[50] = x12 >>> 16 & 0xff;
  37224. o[51] = x12 >>> 24 & 0xff;
  37225. o[52] = x13 >>> 0 & 0xff;
  37226. o[53] = x13 >>> 8 & 0xff;
  37227. o[54] = x13 >>> 16 & 0xff;
  37228. o[55] = x13 >>> 24 & 0xff;
  37229. o[56] = x14 >>> 0 & 0xff;
  37230. o[57] = x14 >>> 8 & 0xff;
  37231. o[58] = x14 >>> 16 & 0xff;
  37232. o[59] = x14 >>> 24 & 0xff;
  37233. o[60] = x15 >>> 0 & 0xff;
  37234. o[61] = x15 >>> 8 & 0xff;
  37235. o[62] = x15 >>> 16 & 0xff;
  37236. o[63] = x15 >>> 24 & 0xff;
  37237. }
  37238. function core_hsalsa20(o,p,k,c) {
  37239. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37240. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37241. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37242. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37243. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37244. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37245. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37246. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37247. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37248. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37249. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37250. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37251. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37252. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37253. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37254. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37255. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37256. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37257. x15 = j15, u;
  37258. for (var i = 0; i < 20; i += 2) {
  37259. u = x0 + x12 | 0;
  37260. x4 ^= u<<7 | u>>>(32-7);
  37261. u = x4 + x0 | 0;
  37262. x8 ^= u<<9 | u>>>(32-9);
  37263. u = x8 + x4 | 0;
  37264. x12 ^= u<<13 | u>>>(32-13);
  37265. u = x12 + x8 | 0;
  37266. x0 ^= u<<18 | u>>>(32-18);
  37267. u = x5 + x1 | 0;
  37268. x9 ^= u<<7 | u>>>(32-7);
  37269. u = x9 + x5 | 0;
  37270. x13 ^= u<<9 | u>>>(32-9);
  37271. u = x13 + x9 | 0;
  37272. x1 ^= u<<13 | u>>>(32-13);
  37273. u = x1 + x13 | 0;
  37274. x5 ^= u<<18 | u>>>(32-18);
  37275. u = x10 + x6 | 0;
  37276. x14 ^= u<<7 | u>>>(32-7);
  37277. u = x14 + x10 | 0;
  37278. x2 ^= u<<9 | u>>>(32-9);
  37279. u = x2 + x14 | 0;
  37280. x6 ^= u<<13 | u>>>(32-13);
  37281. u = x6 + x2 | 0;
  37282. x10 ^= u<<18 | u>>>(32-18);
  37283. u = x15 + x11 | 0;
  37284. x3 ^= u<<7 | u>>>(32-7);
  37285. u = x3 + x15 | 0;
  37286. x7 ^= u<<9 | u>>>(32-9);
  37287. u = x7 + x3 | 0;
  37288. x11 ^= u<<13 | u>>>(32-13);
  37289. u = x11 + x7 | 0;
  37290. x15 ^= u<<18 | u>>>(32-18);
  37291. u = x0 + x3 | 0;
  37292. x1 ^= u<<7 | u>>>(32-7);
  37293. u = x1 + x0 | 0;
  37294. x2 ^= u<<9 | u>>>(32-9);
  37295. u = x2 + x1 | 0;
  37296. x3 ^= u<<13 | u>>>(32-13);
  37297. u = x3 + x2 | 0;
  37298. x0 ^= u<<18 | u>>>(32-18);
  37299. u = x5 + x4 | 0;
  37300. x6 ^= u<<7 | u>>>(32-7);
  37301. u = x6 + x5 | 0;
  37302. x7 ^= u<<9 | u>>>(32-9);
  37303. u = x7 + x6 | 0;
  37304. x4 ^= u<<13 | u>>>(32-13);
  37305. u = x4 + x7 | 0;
  37306. x5 ^= u<<18 | u>>>(32-18);
  37307. u = x10 + x9 | 0;
  37308. x11 ^= u<<7 | u>>>(32-7);
  37309. u = x11 + x10 | 0;
  37310. x8 ^= u<<9 | u>>>(32-9);
  37311. u = x8 + x11 | 0;
  37312. x9 ^= u<<13 | u>>>(32-13);
  37313. u = x9 + x8 | 0;
  37314. x10 ^= u<<18 | u>>>(32-18);
  37315. u = x15 + x14 | 0;
  37316. x12 ^= u<<7 | u>>>(32-7);
  37317. u = x12 + x15 | 0;
  37318. x13 ^= u<<9 | u>>>(32-9);
  37319. u = x13 + x12 | 0;
  37320. x14 ^= u<<13 | u>>>(32-13);
  37321. u = x14 + x13 | 0;
  37322. x15 ^= u<<18 | u>>>(32-18);
  37323. }
  37324. o[ 0] = x0 >>> 0 & 0xff;
  37325. o[ 1] = x0 >>> 8 & 0xff;
  37326. o[ 2] = x0 >>> 16 & 0xff;
  37327. o[ 3] = x0 >>> 24 & 0xff;
  37328. o[ 4] = x5 >>> 0 & 0xff;
  37329. o[ 5] = x5 >>> 8 & 0xff;
  37330. o[ 6] = x5 >>> 16 & 0xff;
  37331. o[ 7] = x5 >>> 24 & 0xff;
  37332. o[ 8] = x10 >>> 0 & 0xff;
  37333. o[ 9] = x10 >>> 8 & 0xff;
  37334. o[10] = x10 >>> 16 & 0xff;
  37335. o[11] = x10 >>> 24 & 0xff;
  37336. o[12] = x15 >>> 0 & 0xff;
  37337. o[13] = x15 >>> 8 & 0xff;
  37338. o[14] = x15 >>> 16 & 0xff;
  37339. o[15] = x15 >>> 24 & 0xff;
  37340. o[16] = x6 >>> 0 & 0xff;
  37341. o[17] = x6 >>> 8 & 0xff;
  37342. o[18] = x6 >>> 16 & 0xff;
  37343. o[19] = x6 >>> 24 & 0xff;
  37344. o[20] = x7 >>> 0 & 0xff;
  37345. o[21] = x7 >>> 8 & 0xff;
  37346. o[22] = x7 >>> 16 & 0xff;
  37347. o[23] = x7 >>> 24 & 0xff;
  37348. o[24] = x8 >>> 0 & 0xff;
  37349. o[25] = x8 >>> 8 & 0xff;
  37350. o[26] = x8 >>> 16 & 0xff;
  37351. o[27] = x8 >>> 24 & 0xff;
  37352. o[28] = x9 >>> 0 & 0xff;
  37353. o[29] = x9 >>> 8 & 0xff;
  37354. o[30] = x9 >>> 16 & 0xff;
  37355. o[31] = x9 >>> 24 & 0xff;
  37356. }
  37357. function crypto_core_salsa20(out,inp,k,c) {
  37358. core_salsa20(out,inp,k,c);
  37359. }
  37360. function crypto_core_hsalsa20(out,inp,k,c) {
  37361. core_hsalsa20(out,inp,k,c);
  37362. }
  37363. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37364. // "expand 32-byte k"
  37365. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37366. var z = new Uint8Array(16), x = new Uint8Array(64);
  37367. var u, i;
  37368. for (i = 0; i < 16; i++) z[i] = 0;
  37369. for (i = 0; i < 8; i++) z[i] = n[i];
  37370. while (b >= 64) {
  37371. crypto_core_salsa20(x,z,k,sigma);
  37372. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37373. u = 1;
  37374. for (i = 8; i < 16; i++) {
  37375. u = u + (z[i] & 0xff) | 0;
  37376. z[i] = u & 0xff;
  37377. u >>>= 8;
  37378. }
  37379. b -= 64;
  37380. cpos += 64;
  37381. mpos += 64;
  37382. }
  37383. if (b > 0) {
  37384. crypto_core_salsa20(x,z,k,sigma);
  37385. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37386. }
  37387. return 0;
  37388. }
  37389. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37390. var z = new Uint8Array(16), x = new Uint8Array(64);
  37391. var u, i;
  37392. for (i = 0; i < 16; i++) z[i] = 0;
  37393. for (i = 0; i < 8; i++) z[i] = n[i];
  37394. while (b >= 64) {
  37395. crypto_core_salsa20(x,z,k,sigma);
  37396. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37397. u = 1;
  37398. for (i = 8; i < 16; i++) {
  37399. u = u + (z[i] & 0xff) | 0;
  37400. z[i] = u & 0xff;
  37401. u >>>= 8;
  37402. }
  37403. b -= 64;
  37404. cpos += 64;
  37405. }
  37406. if (b > 0) {
  37407. crypto_core_salsa20(x,z,k,sigma);
  37408. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37409. }
  37410. return 0;
  37411. }
  37412. function crypto_stream(c,cpos,d,n,k) {
  37413. var s = new Uint8Array(32);
  37414. crypto_core_hsalsa20(s,n,k,sigma);
  37415. var sn = new Uint8Array(8);
  37416. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37417. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37418. }
  37419. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37420. var s = new Uint8Array(32);
  37421. crypto_core_hsalsa20(s,n,k,sigma);
  37422. var sn = new Uint8Array(8);
  37423. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37424. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37425. }
  37426. /*
  37427. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37428. * https://github.com/floodyberry/poly1305-donna
  37429. */
  37430. var poly1305 = function(key) {
  37431. this.buffer = new Uint8Array(16);
  37432. this.r = new Uint16Array(10);
  37433. this.h = new Uint16Array(10);
  37434. this.pad = new Uint16Array(8);
  37435. this.leftover = 0;
  37436. this.fin = 0;
  37437. var t0, t1, t2, t3, t4, t5, t6, t7;
  37438. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37439. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37440. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37441. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37442. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37443. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37444. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37445. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37446. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37447. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37448. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37449. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37450. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37451. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37452. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37453. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37454. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37455. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37456. };
  37457. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37458. var hibit = this.fin ? 0 : (1 << 11);
  37459. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37460. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37461. var h0 = this.h[0],
  37462. h1 = this.h[1],
  37463. h2 = this.h[2],
  37464. h3 = this.h[3],
  37465. h4 = this.h[4],
  37466. h5 = this.h[5],
  37467. h6 = this.h[6],
  37468. h7 = this.h[7],
  37469. h8 = this.h[8],
  37470. h9 = this.h[9];
  37471. var r0 = this.r[0],
  37472. r1 = this.r[1],
  37473. r2 = this.r[2],
  37474. r3 = this.r[3],
  37475. r4 = this.r[4],
  37476. r5 = this.r[5],
  37477. r6 = this.r[6],
  37478. r7 = this.r[7],
  37479. r8 = this.r[8],
  37480. r9 = this.r[9];
  37481. while (bytes >= 16) {
  37482. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37483. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37484. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37485. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37486. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37487. h5 += ((t4 >>> 1)) & 0x1fff;
  37488. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37489. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37490. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37491. h9 += ((t7 >>> 5)) | hibit;
  37492. c = 0;
  37493. d0 = c;
  37494. d0 += h0 * r0;
  37495. d0 += h1 * (5 * r9);
  37496. d0 += h2 * (5 * r8);
  37497. d0 += h3 * (5 * r7);
  37498. d0 += h4 * (5 * r6);
  37499. c = (d0 >>> 13); d0 &= 0x1fff;
  37500. d0 += h5 * (5 * r5);
  37501. d0 += h6 * (5 * r4);
  37502. d0 += h7 * (5 * r3);
  37503. d0 += h8 * (5 * r2);
  37504. d0 += h9 * (5 * r1);
  37505. c += (d0 >>> 13); d0 &= 0x1fff;
  37506. d1 = c;
  37507. d1 += h0 * r1;
  37508. d1 += h1 * r0;
  37509. d1 += h2 * (5 * r9);
  37510. d1 += h3 * (5 * r8);
  37511. d1 += h4 * (5 * r7);
  37512. c = (d1 >>> 13); d1 &= 0x1fff;
  37513. d1 += h5 * (5 * r6);
  37514. d1 += h6 * (5 * r5);
  37515. d1 += h7 * (5 * r4);
  37516. d1 += h8 * (5 * r3);
  37517. d1 += h9 * (5 * r2);
  37518. c += (d1 >>> 13); d1 &= 0x1fff;
  37519. d2 = c;
  37520. d2 += h0 * r2;
  37521. d2 += h1 * r1;
  37522. d2 += h2 * r0;
  37523. d2 += h3 * (5 * r9);
  37524. d2 += h4 * (5 * r8);
  37525. c = (d2 >>> 13); d2 &= 0x1fff;
  37526. d2 += h5 * (5 * r7);
  37527. d2 += h6 * (5 * r6);
  37528. d2 += h7 * (5 * r5);
  37529. d2 += h8 * (5 * r4);
  37530. d2 += h9 * (5 * r3);
  37531. c += (d2 >>> 13); d2 &= 0x1fff;
  37532. d3 = c;
  37533. d3 += h0 * r3;
  37534. d3 += h1 * r2;
  37535. d3 += h2 * r1;
  37536. d3 += h3 * r0;
  37537. d3 += h4 * (5 * r9);
  37538. c = (d3 >>> 13); d3 &= 0x1fff;
  37539. d3 += h5 * (5 * r8);
  37540. d3 += h6 * (5 * r7);
  37541. d3 += h7 * (5 * r6);
  37542. d3 += h8 * (5 * r5);
  37543. d3 += h9 * (5 * r4);
  37544. c += (d3 >>> 13); d3 &= 0x1fff;
  37545. d4 = c;
  37546. d4 += h0 * r4;
  37547. d4 += h1 * r3;
  37548. d4 += h2 * r2;
  37549. d4 += h3 * r1;
  37550. d4 += h4 * r0;
  37551. c = (d4 >>> 13); d4 &= 0x1fff;
  37552. d4 += h5 * (5 * r9);
  37553. d4 += h6 * (5 * r8);
  37554. d4 += h7 * (5 * r7);
  37555. d4 += h8 * (5 * r6);
  37556. d4 += h9 * (5 * r5);
  37557. c += (d4 >>> 13); d4 &= 0x1fff;
  37558. d5 = c;
  37559. d5 += h0 * r5;
  37560. d5 += h1 * r4;
  37561. d5 += h2 * r3;
  37562. d5 += h3 * r2;
  37563. d5 += h4 * r1;
  37564. c = (d5 >>> 13); d5 &= 0x1fff;
  37565. d5 += h5 * r0;
  37566. d5 += h6 * (5 * r9);
  37567. d5 += h7 * (5 * r8);
  37568. d5 += h8 * (5 * r7);
  37569. d5 += h9 * (5 * r6);
  37570. c += (d5 >>> 13); d5 &= 0x1fff;
  37571. d6 = c;
  37572. d6 += h0 * r6;
  37573. d6 += h1 * r5;
  37574. d6 += h2 * r4;
  37575. d6 += h3 * r3;
  37576. d6 += h4 * r2;
  37577. c = (d6 >>> 13); d6 &= 0x1fff;
  37578. d6 += h5 * r1;
  37579. d6 += h6 * r0;
  37580. d6 += h7 * (5 * r9);
  37581. d6 += h8 * (5 * r8);
  37582. d6 += h9 * (5 * r7);
  37583. c += (d6 >>> 13); d6 &= 0x1fff;
  37584. d7 = c;
  37585. d7 += h0 * r7;
  37586. d7 += h1 * r6;
  37587. d7 += h2 * r5;
  37588. d7 += h3 * r4;
  37589. d7 += h4 * r3;
  37590. c = (d7 >>> 13); d7 &= 0x1fff;
  37591. d7 += h5 * r2;
  37592. d7 += h6 * r1;
  37593. d7 += h7 * r0;
  37594. d7 += h8 * (5 * r9);
  37595. d7 += h9 * (5 * r8);
  37596. c += (d7 >>> 13); d7 &= 0x1fff;
  37597. d8 = c;
  37598. d8 += h0 * r8;
  37599. d8 += h1 * r7;
  37600. d8 += h2 * r6;
  37601. d8 += h3 * r5;
  37602. d8 += h4 * r4;
  37603. c = (d8 >>> 13); d8 &= 0x1fff;
  37604. d8 += h5 * r3;
  37605. d8 += h6 * r2;
  37606. d8 += h7 * r1;
  37607. d8 += h8 * r0;
  37608. d8 += h9 * (5 * r9);
  37609. c += (d8 >>> 13); d8 &= 0x1fff;
  37610. d9 = c;
  37611. d9 += h0 * r9;
  37612. d9 += h1 * r8;
  37613. d9 += h2 * r7;
  37614. d9 += h3 * r6;
  37615. d9 += h4 * r5;
  37616. c = (d9 >>> 13); d9 &= 0x1fff;
  37617. d9 += h5 * r4;
  37618. d9 += h6 * r3;
  37619. d9 += h7 * r2;
  37620. d9 += h8 * r1;
  37621. d9 += h9 * r0;
  37622. c += (d9 >>> 13); d9 &= 0x1fff;
  37623. c = (((c << 2) + c)) | 0;
  37624. c = (c + d0) | 0;
  37625. d0 = c & 0x1fff;
  37626. c = (c >>> 13);
  37627. d1 += c;
  37628. h0 = d0;
  37629. h1 = d1;
  37630. h2 = d2;
  37631. h3 = d3;
  37632. h4 = d4;
  37633. h5 = d5;
  37634. h6 = d6;
  37635. h7 = d7;
  37636. h8 = d8;
  37637. h9 = d9;
  37638. mpos += 16;
  37639. bytes -= 16;
  37640. }
  37641. this.h[0] = h0;
  37642. this.h[1] = h1;
  37643. this.h[2] = h2;
  37644. this.h[3] = h3;
  37645. this.h[4] = h4;
  37646. this.h[5] = h5;
  37647. this.h[6] = h6;
  37648. this.h[7] = h7;
  37649. this.h[8] = h8;
  37650. this.h[9] = h9;
  37651. };
  37652. poly1305.prototype.finish = function(mac, macpos) {
  37653. var g = new Uint16Array(10);
  37654. var c, mask, f, i;
  37655. if (this.leftover) {
  37656. i = this.leftover;
  37657. this.buffer[i++] = 1;
  37658. for (; i < 16; i++) this.buffer[i] = 0;
  37659. this.fin = 1;
  37660. this.blocks(this.buffer, 0, 16);
  37661. }
  37662. c = this.h[1] >>> 13;
  37663. this.h[1] &= 0x1fff;
  37664. for (i = 2; i < 10; i++) {
  37665. this.h[i] += c;
  37666. c = this.h[i] >>> 13;
  37667. this.h[i] &= 0x1fff;
  37668. }
  37669. this.h[0] += (c * 5);
  37670. c = this.h[0] >>> 13;
  37671. this.h[0] &= 0x1fff;
  37672. this.h[1] += c;
  37673. c = this.h[1] >>> 13;
  37674. this.h[1] &= 0x1fff;
  37675. this.h[2] += c;
  37676. g[0] = this.h[0] + 5;
  37677. c = g[0] >>> 13;
  37678. g[0] &= 0x1fff;
  37679. for (i = 1; i < 10; i++) {
  37680. g[i] = this.h[i] + c;
  37681. c = g[i] >>> 13;
  37682. g[i] &= 0x1fff;
  37683. }
  37684. g[9] -= (1 << 13);
  37685. mask = (c ^ 1) - 1;
  37686. for (i = 0; i < 10; i++) g[i] &= mask;
  37687. mask = ~mask;
  37688. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37689. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37690. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37691. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37692. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37693. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37694. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37695. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37696. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37697. f = this.h[0] + this.pad[0];
  37698. this.h[0] = f & 0xffff;
  37699. for (i = 1; i < 8; i++) {
  37700. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37701. this.h[i] = f & 0xffff;
  37702. }
  37703. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37704. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37705. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37706. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37707. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37708. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37709. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37710. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37711. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37712. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37713. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37714. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37715. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37716. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37717. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37718. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37719. };
  37720. poly1305.prototype.update = function(m, mpos, bytes) {
  37721. var i, want;
  37722. if (this.leftover) {
  37723. want = (16 - this.leftover);
  37724. if (want > bytes)
  37725. want = bytes;
  37726. for (i = 0; i < want; i++)
  37727. this.buffer[this.leftover + i] = m[mpos+i];
  37728. bytes -= want;
  37729. mpos += want;
  37730. this.leftover += want;
  37731. if (this.leftover < 16)
  37732. return;
  37733. this.blocks(this.buffer, 0, 16);
  37734. this.leftover = 0;
  37735. }
  37736. if (bytes >= 16) {
  37737. want = bytes - (bytes % 16);
  37738. this.blocks(m, mpos, want);
  37739. mpos += want;
  37740. bytes -= want;
  37741. }
  37742. if (bytes) {
  37743. for (i = 0; i < bytes; i++)
  37744. this.buffer[this.leftover + i] = m[mpos+i];
  37745. this.leftover += bytes;
  37746. }
  37747. };
  37748. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37749. var s = new poly1305(k);
  37750. s.update(m, mpos, n);
  37751. s.finish(out, outpos);
  37752. return 0;
  37753. }
  37754. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37755. var x = new Uint8Array(16);
  37756. crypto_onetimeauth(x,0,m,mpos,n,k);
  37757. return crypto_verify_16(h,hpos,x,0);
  37758. }
  37759. function crypto_secretbox(c,m,d,n,k) {
  37760. var i;
  37761. if (d < 32) return -1;
  37762. crypto_stream_xor(c,0,m,0,d,n,k);
  37763. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37764. for (i = 0; i < 16; i++) c[i] = 0;
  37765. return 0;
  37766. }
  37767. function crypto_secretbox_open(m,c,d,n,k) {
  37768. var i;
  37769. var x = new Uint8Array(32);
  37770. if (d < 32) return -1;
  37771. crypto_stream(x,0,32,n,k);
  37772. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37773. crypto_stream_xor(m,0,c,0,d,n,k);
  37774. for (i = 0; i < 32; i++) m[i] = 0;
  37775. return 0;
  37776. }
  37777. function set25519(r, a) {
  37778. var i;
  37779. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37780. }
  37781. function car25519(o) {
  37782. var i, v, c = 1;
  37783. for (i = 0; i < 16; i++) {
  37784. v = o[i] + c + 65535;
  37785. c = Math.floor(v / 65536);
  37786. o[i] = v - c * 65536;
  37787. }
  37788. o[0] += c-1 + 37 * (c-1);
  37789. }
  37790. function sel25519(p, q, b) {
  37791. var t, c = ~(b-1);
  37792. for (var i = 0; i < 16; i++) {
  37793. t = c & (p[i] ^ q[i]);
  37794. p[i] ^= t;
  37795. q[i] ^= t;
  37796. }
  37797. }
  37798. function pack25519(o, n) {
  37799. var i, j, b;
  37800. var m = gf(), t = gf();
  37801. for (i = 0; i < 16; i++) t[i] = n[i];
  37802. car25519(t);
  37803. car25519(t);
  37804. car25519(t);
  37805. for (j = 0; j < 2; j++) {
  37806. m[0] = t[0] - 0xffed;
  37807. for (i = 1; i < 15; i++) {
  37808. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37809. m[i-1] &= 0xffff;
  37810. }
  37811. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37812. b = (m[15]>>16) & 1;
  37813. m[14] &= 0xffff;
  37814. sel25519(t, m, 1-b);
  37815. }
  37816. for (i = 0; i < 16; i++) {
  37817. o[2*i] = t[i] & 0xff;
  37818. o[2*i+1] = t[i]>>8;
  37819. }
  37820. }
  37821. function neq25519(a, b) {
  37822. var c = new Uint8Array(32), d = new Uint8Array(32);
  37823. pack25519(c, a);
  37824. pack25519(d, b);
  37825. return crypto_verify_32(c, 0, d, 0);
  37826. }
  37827. function par25519(a) {
  37828. var d = new Uint8Array(32);
  37829. pack25519(d, a);
  37830. return d[0] & 1;
  37831. }
  37832. function unpack25519(o, n) {
  37833. var i;
  37834. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37835. o[15] &= 0x7fff;
  37836. }
  37837. function A(o, a, b) {
  37838. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37839. }
  37840. function Z(o, a, b) {
  37841. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37842. }
  37843. function M(o, a, b) {
  37844. var v, c,
  37845. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37846. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37847. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37848. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37849. b0 = b[0],
  37850. b1 = b[1],
  37851. b2 = b[2],
  37852. b3 = b[3],
  37853. b4 = b[4],
  37854. b5 = b[5],
  37855. b6 = b[6],
  37856. b7 = b[7],
  37857. b8 = b[8],
  37858. b9 = b[9],
  37859. b10 = b[10],
  37860. b11 = b[11],
  37861. b12 = b[12],
  37862. b13 = b[13],
  37863. b14 = b[14],
  37864. b15 = b[15];
  37865. v = a[0];
  37866. t0 += v * b0;
  37867. t1 += v * b1;
  37868. t2 += v * b2;
  37869. t3 += v * b3;
  37870. t4 += v * b4;
  37871. t5 += v * b5;
  37872. t6 += v * b6;
  37873. t7 += v * b7;
  37874. t8 += v * b8;
  37875. t9 += v * b9;
  37876. t10 += v * b10;
  37877. t11 += v * b11;
  37878. t12 += v * b12;
  37879. t13 += v * b13;
  37880. t14 += v * b14;
  37881. t15 += v * b15;
  37882. v = a[1];
  37883. t1 += v * b0;
  37884. t2 += v * b1;
  37885. t3 += v * b2;
  37886. t4 += v * b3;
  37887. t5 += v * b4;
  37888. t6 += v * b5;
  37889. t7 += v * b6;
  37890. t8 += v * b7;
  37891. t9 += v * b8;
  37892. t10 += v * b9;
  37893. t11 += v * b10;
  37894. t12 += v * b11;
  37895. t13 += v * b12;
  37896. t14 += v * b13;
  37897. t15 += v * b14;
  37898. t16 += v * b15;
  37899. v = a[2];
  37900. t2 += v * b0;
  37901. t3 += v * b1;
  37902. t4 += v * b2;
  37903. t5 += v * b3;
  37904. t6 += v * b4;
  37905. t7 += v * b5;
  37906. t8 += v * b6;
  37907. t9 += v * b7;
  37908. t10 += v * b8;
  37909. t11 += v * b9;
  37910. t12 += v * b10;
  37911. t13 += v * b11;
  37912. t14 += v * b12;
  37913. t15 += v * b13;
  37914. t16 += v * b14;
  37915. t17 += v * b15;
  37916. v = a[3];
  37917. t3 += v * b0;
  37918. t4 += v * b1;
  37919. t5 += v * b2;
  37920. t6 += v * b3;
  37921. t7 += v * b4;
  37922. t8 += v * b5;
  37923. t9 += v * b6;
  37924. t10 += v * b7;
  37925. t11 += v * b8;
  37926. t12 += v * b9;
  37927. t13 += v * b10;
  37928. t14 += v * b11;
  37929. t15 += v * b12;
  37930. t16 += v * b13;
  37931. t17 += v * b14;
  37932. t18 += v * b15;
  37933. v = a[4];
  37934. t4 += v * b0;
  37935. t5 += v * b1;
  37936. t6 += v * b2;
  37937. t7 += v * b3;
  37938. t8 += v * b4;
  37939. t9 += v * b5;
  37940. t10 += v * b6;
  37941. t11 += v * b7;
  37942. t12 += v * b8;
  37943. t13 += v * b9;
  37944. t14 += v * b10;
  37945. t15 += v * b11;
  37946. t16 += v * b12;
  37947. t17 += v * b13;
  37948. t18 += v * b14;
  37949. t19 += v * b15;
  37950. v = a[5];
  37951. t5 += v * b0;
  37952. t6 += v * b1;
  37953. t7 += v * b2;
  37954. t8 += v * b3;
  37955. t9 += v * b4;
  37956. t10 += v * b5;
  37957. t11 += v * b6;
  37958. t12 += v * b7;
  37959. t13 += v * b8;
  37960. t14 += v * b9;
  37961. t15 += v * b10;
  37962. t16 += v * b11;
  37963. t17 += v * b12;
  37964. t18 += v * b13;
  37965. t19 += v * b14;
  37966. t20 += v * b15;
  37967. v = a[6];
  37968. t6 += v * b0;
  37969. t7 += v * b1;
  37970. t8 += v * b2;
  37971. t9 += v * b3;
  37972. t10 += v * b4;
  37973. t11 += v * b5;
  37974. t12 += v * b6;
  37975. t13 += v * b7;
  37976. t14 += v * b8;
  37977. t15 += v * b9;
  37978. t16 += v * b10;
  37979. t17 += v * b11;
  37980. t18 += v * b12;
  37981. t19 += v * b13;
  37982. t20 += v * b14;
  37983. t21 += v * b15;
  37984. v = a[7];
  37985. t7 += v * b0;
  37986. t8 += v * b1;
  37987. t9 += v * b2;
  37988. t10 += v * b3;
  37989. t11 += v * b4;
  37990. t12 += v * b5;
  37991. t13 += v * b6;
  37992. t14 += v * b7;
  37993. t15 += v * b8;
  37994. t16 += v * b9;
  37995. t17 += v * b10;
  37996. t18 += v * b11;
  37997. t19 += v * b12;
  37998. t20 += v * b13;
  37999. t21 += v * b14;
  38000. t22 += v * b15;
  38001. v = a[8];
  38002. t8 += v * b0;
  38003. t9 += v * b1;
  38004. t10 += v * b2;
  38005. t11 += v * b3;
  38006. t12 += v * b4;
  38007. t13 += v * b5;
  38008. t14 += v * b6;
  38009. t15 += v * b7;
  38010. t16 += v * b8;
  38011. t17 += v * b9;
  38012. t18 += v * b10;
  38013. t19 += v * b11;
  38014. t20 += v * b12;
  38015. t21 += v * b13;
  38016. t22 += v * b14;
  38017. t23 += v * b15;
  38018. v = a[9];
  38019. t9 += v * b0;
  38020. t10 += v * b1;
  38021. t11 += v * b2;
  38022. t12 += v * b3;
  38023. t13 += v * b4;
  38024. t14 += v * b5;
  38025. t15 += v * b6;
  38026. t16 += v * b7;
  38027. t17 += v * b8;
  38028. t18 += v * b9;
  38029. t19 += v * b10;
  38030. t20 += v * b11;
  38031. t21 += v * b12;
  38032. t22 += v * b13;
  38033. t23 += v * b14;
  38034. t24 += v * b15;
  38035. v = a[10];
  38036. t10 += v * b0;
  38037. t11 += v * b1;
  38038. t12 += v * b2;
  38039. t13 += v * b3;
  38040. t14 += v * b4;
  38041. t15 += v * b5;
  38042. t16 += v * b6;
  38043. t17 += v * b7;
  38044. t18 += v * b8;
  38045. t19 += v * b9;
  38046. t20 += v * b10;
  38047. t21 += v * b11;
  38048. t22 += v * b12;
  38049. t23 += v * b13;
  38050. t24 += v * b14;
  38051. t25 += v * b15;
  38052. v = a[11];
  38053. t11 += v * b0;
  38054. t12 += v * b1;
  38055. t13 += v * b2;
  38056. t14 += v * b3;
  38057. t15 += v * b4;
  38058. t16 += v * b5;
  38059. t17 += v * b6;
  38060. t18 += v * b7;
  38061. t19 += v * b8;
  38062. t20 += v * b9;
  38063. t21 += v * b10;
  38064. t22 += v * b11;
  38065. t23 += v * b12;
  38066. t24 += v * b13;
  38067. t25 += v * b14;
  38068. t26 += v * b15;
  38069. v = a[12];
  38070. t12 += v * b0;
  38071. t13 += v * b1;
  38072. t14 += v * b2;
  38073. t15 += v * b3;
  38074. t16 += v * b4;
  38075. t17 += v * b5;
  38076. t18 += v * b6;
  38077. t19 += v * b7;
  38078. t20 += v * b8;
  38079. t21 += v * b9;
  38080. t22 += v * b10;
  38081. t23 += v * b11;
  38082. t24 += v * b12;
  38083. t25 += v * b13;
  38084. t26 += v * b14;
  38085. t27 += v * b15;
  38086. v = a[13];
  38087. t13 += v * b0;
  38088. t14 += v * b1;
  38089. t15 += v * b2;
  38090. t16 += v * b3;
  38091. t17 += v * b4;
  38092. t18 += v * b5;
  38093. t19 += v * b6;
  38094. t20 += v * b7;
  38095. t21 += v * b8;
  38096. t22 += v * b9;
  38097. t23 += v * b10;
  38098. t24 += v * b11;
  38099. t25 += v * b12;
  38100. t26 += v * b13;
  38101. t27 += v * b14;
  38102. t28 += v * b15;
  38103. v = a[14];
  38104. t14 += v * b0;
  38105. t15 += v * b1;
  38106. t16 += v * b2;
  38107. t17 += v * b3;
  38108. t18 += v * b4;
  38109. t19 += v * b5;
  38110. t20 += v * b6;
  38111. t21 += v * b7;
  38112. t22 += v * b8;
  38113. t23 += v * b9;
  38114. t24 += v * b10;
  38115. t25 += v * b11;
  38116. t26 += v * b12;
  38117. t27 += v * b13;
  38118. t28 += v * b14;
  38119. t29 += v * b15;
  38120. v = a[15];
  38121. t15 += v * b0;
  38122. t16 += v * b1;
  38123. t17 += v * b2;
  38124. t18 += v * b3;
  38125. t19 += v * b4;
  38126. t20 += v * b5;
  38127. t21 += v * b6;
  38128. t22 += v * b7;
  38129. t23 += v * b8;
  38130. t24 += v * b9;
  38131. t25 += v * b10;
  38132. t26 += v * b11;
  38133. t27 += v * b12;
  38134. t28 += v * b13;
  38135. t29 += v * b14;
  38136. t30 += v * b15;
  38137. t0 += 38 * t16;
  38138. t1 += 38 * t17;
  38139. t2 += 38 * t18;
  38140. t3 += 38 * t19;
  38141. t4 += 38 * t20;
  38142. t5 += 38 * t21;
  38143. t6 += 38 * t22;
  38144. t7 += 38 * t23;
  38145. t8 += 38 * t24;
  38146. t9 += 38 * t25;
  38147. t10 += 38 * t26;
  38148. t11 += 38 * t27;
  38149. t12 += 38 * t28;
  38150. t13 += 38 * t29;
  38151. t14 += 38 * t30;
  38152. // t15 left as is
  38153. // first car
  38154. c = 1;
  38155. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38156. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38157. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38158. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38159. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38160. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38161. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38162. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38163. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38164. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38165. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38166. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38167. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38168. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38169. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38170. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38171. t0 += c-1 + 37 * (c-1);
  38172. // second car
  38173. c = 1;
  38174. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38175. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38176. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38177. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38178. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38179. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38180. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38181. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38182. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38183. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38184. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38185. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38186. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38187. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38188. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38189. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38190. t0 += c-1 + 37 * (c-1);
  38191. o[ 0] = t0;
  38192. o[ 1] = t1;
  38193. o[ 2] = t2;
  38194. o[ 3] = t3;
  38195. o[ 4] = t4;
  38196. o[ 5] = t5;
  38197. o[ 6] = t6;
  38198. o[ 7] = t7;
  38199. o[ 8] = t8;
  38200. o[ 9] = t9;
  38201. o[10] = t10;
  38202. o[11] = t11;
  38203. o[12] = t12;
  38204. o[13] = t13;
  38205. o[14] = t14;
  38206. o[15] = t15;
  38207. }
  38208. function S(o, a) {
  38209. M(o, a, a);
  38210. }
  38211. function inv25519(o, i) {
  38212. var c = gf();
  38213. var a;
  38214. for (a = 0; a < 16; a++) c[a] = i[a];
  38215. for (a = 253; a >= 0; a--) {
  38216. S(c, c);
  38217. if(a !== 2 && a !== 4) M(c, c, i);
  38218. }
  38219. for (a = 0; a < 16; a++) o[a] = c[a];
  38220. }
  38221. function pow2523(o, i) {
  38222. var c = gf();
  38223. var a;
  38224. for (a = 0; a < 16; a++) c[a] = i[a];
  38225. for (a = 250; a >= 0; a--) {
  38226. S(c, c);
  38227. if(a !== 1) M(c, c, i);
  38228. }
  38229. for (a = 0; a < 16; a++) o[a] = c[a];
  38230. }
  38231. function crypto_scalarmult(q, n, p) {
  38232. var z = new Uint8Array(32);
  38233. var x = new Float64Array(80), r, i;
  38234. var a = gf(), b = gf(), c = gf(),
  38235. d = gf(), e = gf(), f = gf();
  38236. for (i = 0; i < 31; i++) z[i] = n[i];
  38237. z[31]=(n[31]&127)|64;
  38238. z[0]&=248;
  38239. unpack25519(x,p);
  38240. for (i = 0; i < 16; i++) {
  38241. b[i]=x[i];
  38242. d[i]=a[i]=c[i]=0;
  38243. }
  38244. a[0]=d[0]=1;
  38245. for (i=254; i>=0; --i) {
  38246. r=(z[i>>>3]>>>(i&7))&1;
  38247. sel25519(a,b,r);
  38248. sel25519(c,d,r);
  38249. A(e,a,c);
  38250. Z(a,a,c);
  38251. A(c,b,d);
  38252. Z(b,b,d);
  38253. S(d,e);
  38254. S(f,a);
  38255. M(a,c,a);
  38256. M(c,b,e);
  38257. A(e,a,c);
  38258. Z(a,a,c);
  38259. S(b,a);
  38260. Z(c,d,f);
  38261. M(a,c,_121665);
  38262. A(a,a,d);
  38263. M(c,c,a);
  38264. M(a,d,f);
  38265. M(d,b,x);
  38266. S(b,e);
  38267. sel25519(a,b,r);
  38268. sel25519(c,d,r);
  38269. }
  38270. for (i = 0; i < 16; i++) {
  38271. x[i+16]=a[i];
  38272. x[i+32]=c[i];
  38273. x[i+48]=b[i];
  38274. x[i+64]=d[i];
  38275. }
  38276. var x32 = x.subarray(32);
  38277. var x16 = x.subarray(16);
  38278. inv25519(x32,x32);
  38279. M(x16,x16,x32);
  38280. pack25519(q,x16);
  38281. return 0;
  38282. }
  38283. function crypto_scalarmult_base(q, n) {
  38284. return crypto_scalarmult(q, n, _9);
  38285. }
  38286. function crypto_box_keypair(y, x) {
  38287. randombytes(x, 32);
  38288. return crypto_scalarmult_base(y, x);
  38289. }
  38290. function crypto_box_beforenm(k, y, x) {
  38291. var s = new Uint8Array(32);
  38292. crypto_scalarmult(s, x, y);
  38293. return crypto_core_hsalsa20(k, _0, s, sigma);
  38294. }
  38295. var crypto_box_afternm = crypto_secretbox;
  38296. var crypto_box_open_afternm = crypto_secretbox_open;
  38297. function crypto_box(c, m, d, n, y, x) {
  38298. var k = new Uint8Array(32);
  38299. crypto_box_beforenm(k, y, x);
  38300. return crypto_box_afternm(c, m, d, n, k);
  38301. }
  38302. function crypto_box_open(m, c, d, n, y, x) {
  38303. var k = new Uint8Array(32);
  38304. crypto_box_beforenm(k, y, x);
  38305. return crypto_box_open_afternm(m, c, d, n, k);
  38306. }
  38307. var K = [
  38308. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38309. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38310. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38311. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38312. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38313. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38314. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38315. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38316. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38317. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38318. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38319. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38320. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38321. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38322. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38323. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38324. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38325. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38326. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38327. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38328. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38329. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38330. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38331. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38332. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38333. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38334. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38335. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38336. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38337. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38338. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38339. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38340. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38341. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38342. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38343. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38344. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38345. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38346. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38347. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38348. ];
  38349. function crypto_hashblocks_hl(hh, hl, m, n) {
  38350. var wh = new Int32Array(16), wl = new Int32Array(16),
  38351. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38352. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38353. th, tl, i, j, h, l, a, b, c, d;
  38354. var ah0 = hh[0],
  38355. ah1 = hh[1],
  38356. ah2 = hh[2],
  38357. ah3 = hh[3],
  38358. ah4 = hh[4],
  38359. ah5 = hh[5],
  38360. ah6 = hh[6],
  38361. ah7 = hh[7],
  38362. al0 = hl[0],
  38363. al1 = hl[1],
  38364. al2 = hl[2],
  38365. al3 = hl[3],
  38366. al4 = hl[4],
  38367. al5 = hl[5],
  38368. al6 = hl[6],
  38369. al7 = hl[7];
  38370. var pos = 0;
  38371. while (n >= 128) {
  38372. for (i = 0; i < 16; i++) {
  38373. j = 8 * i + pos;
  38374. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38375. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38376. }
  38377. for (i = 0; i < 80; i++) {
  38378. bh0 = ah0;
  38379. bh1 = ah1;
  38380. bh2 = ah2;
  38381. bh3 = ah3;
  38382. bh4 = ah4;
  38383. bh5 = ah5;
  38384. bh6 = ah6;
  38385. bh7 = ah7;
  38386. bl0 = al0;
  38387. bl1 = al1;
  38388. bl2 = al2;
  38389. bl3 = al3;
  38390. bl4 = al4;
  38391. bl5 = al5;
  38392. bl6 = al6;
  38393. bl7 = al7;
  38394. // add
  38395. h = ah7;
  38396. l = al7;
  38397. a = l & 0xffff; b = l >>> 16;
  38398. c = h & 0xffff; d = h >>> 16;
  38399. // Sigma1
  38400. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38401. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38402. a += l & 0xffff; b += l >>> 16;
  38403. c += h & 0xffff; d += h >>> 16;
  38404. // Ch
  38405. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38406. l = (al4 & al5) ^ (~al4 & al6);
  38407. a += l & 0xffff; b += l >>> 16;
  38408. c += h & 0xffff; d += h >>> 16;
  38409. // K
  38410. h = K[i*2];
  38411. l = K[i*2+1];
  38412. a += l & 0xffff; b += l >>> 16;
  38413. c += h & 0xffff; d += h >>> 16;
  38414. // w
  38415. h = wh[i%16];
  38416. l = wl[i%16];
  38417. a += l & 0xffff; b += l >>> 16;
  38418. c += h & 0xffff; d += h >>> 16;
  38419. b += a >>> 16;
  38420. c += b >>> 16;
  38421. d += c >>> 16;
  38422. th = c & 0xffff | d << 16;
  38423. tl = a & 0xffff | b << 16;
  38424. // add
  38425. h = th;
  38426. l = tl;
  38427. a = l & 0xffff; b = l >>> 16;
  38428. c = h & 0xffff; d = h >>> 16;
  38429. // Sigma0
  38430. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38431. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38432. a += l & 0xffff; b += l >>> 16;
  38433. c += h & 0xffff; d += h >>> 16;
  38434. // Maj
  38435. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38436. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38437. a += l & 0xffff; b += l >>> 16;
  38438. c += h & 0xffff; d += h >>> 16;
  38439. b += a >>> 16;
  38440. c += b >>> 16;
  38441. d += c >>> 16;
  38442. bh7 = (c & 0xffff) | (d << 16);
  38443. bl7 = (a & 0xffff) | (b << 16);
  38444. // add
  38445. h = bh3;
  38446. l = bl3;
  38447. a = l & 0xffff; b = l >>> 16;
  38448. c = h & 0xffff; d = h >>> 16;
  38449. h = th;
  38450. l = tl;
  38451. a += l & 0xffff; b += l >>> 16;
  38452. c += h & 0xffff; d += h >>> 16;
  38453. b += a >>> 16;
  38454. c += b >>> 16;
  38455. d += c >>> 16;
  38456. bh3 = (c & 0xffff) | (d << 16);
  38457. bl3 = (a & 0xffff) | (b << 16);
  38458. ah1 = bh0;
  38459. ah2 = bh1;
  38460. ah3 = bh2;
  38461. ah4 = bh3;
  38462. ah5 = bh4;
  38463. ah6 = bh5;
  38464. ah7 = bh6;
  38465. ah0 = bh7;
  38466. al1 = bl0;
  38467. al2 = bl1;
  38468. al3 = bl2;
  38469. al4 = bl3;
  38470. al5 = bl4;
  38471. al6 = bl5;
  38472. al7 = bl6;
  38473. al0 = bl7;
  38474. if (i%16 === 15) {
  38475. for (j = 0; j < 16; j++) {
  38476. // add
  38477. h = wh[j];
  38478. l = wl[j];
  38479. a = l & 0xffff; b = l >>> 16;
  38480. c = h & 0xffff; d = h >>> 16;
  38481. h = wh[(j+9)%16];
  38482. l = wl[(j+9)%16];
  38483. a += l & 0xffff; b += l >>> 16;
  38484. c += h & 0xffff; d += h >>> 16;
  38485. // sigma0
  38486. th = wh[(j+1)%16];
  38487. tl = wl[(j+1)%16];
  38488. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38489. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38490. a += l & 0xffff; b += l >>> 16;
  38491. c += h & 0xffff; d += h >>> 16;
  38492. // sigma1
  38493. th = wh[(j+14)%16];
  38494. tl = wl[(j+14)%16];
  38495. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38496. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38497. a += l & 0xffff; b += l >>> 16;
  38498. c += h & 0xffff; d += h >>> 16;
  38499. b += a >>> 16;
  38500. c += b >>> 16;
  38501. d += c >>> 16;
  38502. wh[j] = (c & 0xffff) | (d << 16);
  38503. wl[j] = (a & 0xffff) | (b << 16);
  38504. }
  38505. }
  38506. }
  38507. // add
  38508. h = ah0;
  38509. l = al0;
  38510. a = l & 0xffff; b = l >>> 16;
  38511. c = h & 0xffff; d = h >>> 16;
  38512. h = hh[0];
  38513. l = hl[0];
  38514. a += l & 0xffff; b += l >>> 16;
  38515. c += h & 0xffff; d += h >>> 16;
  38516. b += a >>> 16;
  38517. c += b >>> 16;
  38518. d += c >>> 16;
  38519. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38520. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38521. h = ah1;
  38522. l = al1;
  38523. a = l & 0xffff; b = l >>> 16;
  38524. c = h & 0xffff; d = h >>> 16;
  38525. h = hh[1];
  38526. l = hl[1];
  38527. a += l & 0xffff; b += l >>> 16;
  38528. c += h & 0xffff; d += h >>> 16;
  38529. b += a >>> 16;
  38530. c += b >>> 16;
  38531. d += c >>> 16;
  38532. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38533. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38534. h = ah2;
  38535. l = al2;
  38536. a = l & 0xffff; b = l >>> 16;
  38537. c = h & 0xffff; d = h >>> 16;
  38538. h = hh[2];
  38539. l = hl[2];
  38540. a += l & 0xffff; b += l >>> 16;
  38541. c += h & 0xffff; d += h >>> 16;
  38542. b += a >>> 16;
  38543. c += b >>> 16;
  38544. d += c >>> 16;
  38545. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38546. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38547. h = ah3;
  38548. l = al3;
  38549. a = l & 0xffff; b = l >>> 16;
  38550. c = h & 0xffff; d = h >>> 16;
  38551. h = hh[3];
  38552. l = hl[3];
  38553. a += l & 0xffff; b += l >>> 16;
  38554. c += h & 0xffff; d += h >>> 16;
  38555. b += a >>> 16;
  38556. c += b >>> 16;
  38557. d += c >>> 16;
  38558. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38559. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38560. h = ah4;
  38561. l = al4;
  38562. a = l & 0xffff; b = l >>> 16;
  38563. c = h & 0xffff; d = h >>> 16;
  38564. h = hh[4];
  38565. l = hl[4];
  38566. a += l & 0xffff; b += l >>> 16;
  38567. c += h & 0xffff; d += h >>> 16;
  38568. b += a >>> 16;
  38569. c += b >>> 16;
  38570. d += c >>> 16;
  38571. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38572. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38573. h = ah5;
  38574. l = al5;
  38575. a = l & 0xffff; b = l >>> 16;
  38576. c = h & 0xffff; d = h >>> 16;
  38577. h = hh[5];
  38578. l = hl[5];
  38579. a += l & 0xffff; b += l >>> 16;
  38580. c += h & 0xffff; d += h >>> 16;
  38581. b += a >>> 16;
  38582. c += b >>> 16;
  38583. d += c >>> 16;
  38584. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38585. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38586. h = ah6;
  38587. l = al6;
  38588. a = l & 0xffff; b = l >>> 16;
  38589. c = h & 0xffff; d = h >>> 16;
  38590. h = hh[6];
  38591. l = hl[6];
  38592. a += l & 0xffff; b += l >>> 16;
  38593. c += h & 0xffff; d += h >>> 16;
  38594. b += a >>> 16;
  38595. c += b >>> 16;
  38596. d += c >>> 16;
  38597. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38598. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38599. h = ah7;
  38600. l = al7;
  38601. a = l & 0xffff; b = l >>> 16;
  38602. c = h & 0xffff; d = h >>> 16;
  38603. h = hh[7];
  38604. l = hl[7];
  38605. a += l & 0xffff; b += l >>> 16;
  38606. c += h & 0xffff; d += h >>> 16;
  38607. b += a >>> 16;
  38608. c += b >>> 16;
  38609. d += c >>> 16;
  38610. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38611. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38612. pos += 128;
  38613. n -= 128;
  38614. }
  38615. return n;
  38616. }
  38617. function crypto_hash(out, m, n) {
  38618. var hh = new Int32Array(8),
  38619. hl = new Int32Array(8),
  38620. x = new Uint8Array(256),
  38621. i, b = n;
  38622. hh[0] = 0x6a09e667;
  38623. hh[1] = 0xbb67ae85;
  38624. hh[2] = 0x3c6ef372;
  38625. hh[3] = 0xa54ff53a;
  38626. hh[4] = 0x510e527f;
  38627. hh[5] = 0x9b05688c;
  38628. hh[6] = 0x1f83d9ab;
  38629. hh[7] = 0x5be0cd19;
  38630. hl[0] = 0xf3bcc908;
  38631. hl[1] = 0x84caa73b;
  38632. hl[2] = 0xfe94f82b;
  38633. hl[3] = 0x5f1d36f1;
  38634. hl[4] = 0xade682d1;
  38635. hl[5] = 0x2b3e6c1f;
  38636. hl[6] = 0xfb41bd6b;
  38637. hl[7] = 0x137e2179;
  38638. crypto_hashblocks_hl(hh, hl, m, n);
  38639. n %= 128;
  38640. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38641. x[n] = 128;
  38642. n = 256-128*(n<112?1:0);
  38643. x[n-9] = 0;
  38644. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38645. crypto_hashblocks_hl(hh, hl, x, n);
  38646. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38647. return 0;
  38648. }
  38649. function add(p, q) {
  38650. var a = gf(), b = gf(), c = gf(),
  38651. d = gf(), e = gf(), f = gf(),
  38652. g = gf(), h = gf(), t = gf();
  38653. Z(a, p[1], p[0]);
  38654. Z(t, q[1], q[0]);
  38655. M(a, a, t);
  38656. A(b, p[0], p[1]);
  38657. A(t, q[0], q[1]);
  38658. M(b, b, t);
  38659. M(c, p[3], q[3]);
  38660. M(c, c, D2);
  38661. M(d, p[2], q[2]);
  38662. A(d, d, d);
  38663. Z(e, b, a);
  38664. Z(f, d, c);
  38665. A(g, d, c);
  38666. A(h, b, a);
  38667. M(p[0], e, f);
  38668. M(p[1], h, g);
  38669. M(p[2], g, f);
  38670. M(p[3], e, h);
  38671. }
  38672. function cswap(p, q, b) {
  38673. var i;
  38674. for (i = 0; i < 4; i++) {
  38675. sel25519(p[i], q[i], b);
  38676. }
  38677. }
  38678. function pack(r, p) {
  38679. var tx = gf(), ty = gf(), zi = gf();
  38680. inv25519(zi, p[2]);
  38681. M(tx, p[0], zi);
  38682. M(ty, p[1], zi);
  38683. pack25519(r, ty);
  38684. r[31] ^= par25519(tx) << 7;
  38685. }
  38686. function scalarmult(p, q, s) {
  38687. var b, i;
  38688. set25519(p[0], gf0);
  38689. set25519(p[1], gf1);
  38690. set25519(p[2], gf1);
  38691. set25519(p[3], gf0);
  38692. for (i = 255; i >= 0; --i) {
  38693. b = (s[(i/8)|0] >> (i&7)) & 1;
  38694. cswap(p, q, b);
  38695. add(q, p);
  38696. add(p, p);
  38697. cswap(p, q, b);
  38698. }
  38699. }
  38700. function scalarbase(p, s) {
  38701. var q = [gf(), gf(), gf(), gf()];
  38702. set25519(q[0], X);
  38703. set25519(q[1], Y);
  38704. set25519(q[2], gf1);
  38705. M(q[3], X, Y);
  38706. scalarmult(p, q, s);
  38707. }
  38708. function crypto_sign_keypair(pk, sk, seeded) {
  38709. var d = new Uint8Array(64);
  38710. var p = [gf(), gf(), gf(), gf()];
  38711. var i;
  38712. if (!seeded) randombytes(sk, 32);
  38713. crypto_hash(d, sk, 32);
  38714. d[0] &= 248;
  38715. d[31] &= 127;
  38716. d[31] |= 64;
  38717. scalarbase(p, d);
  38718. pack(pk, p);
  38719. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38720. return 0;
  38721. }
  38722. 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]);
  38723. function modL(r, x) {
  38724. var carry, i, j, k;
  38725. for (i = 63; i >= 32; --i) {
  38726. carry = 0;
  38727. for (j = i - 32, k = i - 12; j < k; ++j) {
  38728. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38729. carry = (x[j] + 128) >> 8;
  38730. x[j] -= carry * 256;
  38731. }
  38732. x[j] += carry;
  38733. x[i] = 0;
  38734. }
  38735. carry = 0;
  38736. for (j = 0; j < 32; j++) {
  38737. x[j] += carry - (x[31] >> 4) * L[j];
  38738. carry = x[j] >> 8;
  38739. x[j] &= 255;
  38740. }
  38741. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38742. for (i = 0; i < 32; i++) {
  38743. x[i+1] += x[i] >> 8;
  38744. r[i] = x[i] & 255;
  38745. }
  38746. }
  38747. function reduce(r) {
  38748. var x = new Float64Array(64), i;
  38749. for (i = 0; i < 64; i++) x[i] = r[i];
  38750. for (i = 0; i < 64; i++) r[i] = 0;
  38751. modL(r, x);
  38752. }
  38753. // Note: difference from C - smlen returned, not passed as argument.
  38754. function crypto_sign(sm, m, n, sk) {
  38755. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38756. var i, j, x = new Float64Array(64);
  38757. var p = [gf(), gf(), gf(), gf()];
  38758. crypto_hash(d, sk, 32);
  38759. d[0] &= 248;
  38760. d[31] &= 127;
  38761. d[31] |= 64;
  38762. var smlen = n + 64;
  38763. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38764. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38765. crypto_hash(r, sm.subarray(32), n+32);
  38766. reduce(r);
  38767. scalarbase(p, r);
  38768. pack(sm, p);
  38769. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38770. crypto_hash(h, sm, n + 64);
  38771. reduce(h);
  38772. for (i = 0; i < 64; i++) x[i] = 0;
  38773. for (i = 0; i < 32; i++) x[i] = r[i];
  38774. for (i = 0; i < 32; i++) {
  38775. for (j = 0; j < 32; j++) {
  38776. x[i+j] += h[i] * d[j];
  38777. }
  38778. }
  38779. modL(sm.subarray(32), x);
  38780. return smlen;
  38781. }
  38782. function unpackneg(r, p) {
  38783. var t = gf(), chk = gf(), num = gf(),
  38784. den = gf(), den2 = gf(), den4 = gf(),
  38785. den6 = gf();
  38786. set25519(r[2], gf1);
  38787. unpack25519(r[1], p);
  38788. S(num, r[1]);
  38789. M(den, num, D);
  38790. Z(num, num, r[2]);
  38791. A(den, r[2], den);
  38792. S(den2, den);
  38793. S(den4, den2);
  38794. M(den6, den4, den2);
  38795. M(t, den6, num);
  38796. M(t, t, den);
  38797. pow2523(t, t);
  38798. M(t, t, num);
  38799. M(t, t, den);
  38800. M(t, t, den);
  38801. M(r[0], t, den);
  38802. S(chk, r[0]);
  38803. M(chk, chk, den);
  38804. if (neq25519(chk, num)) M(r[0], r[0], I);
  38805. S(chk, r[0]);
  38806. M(chk, chk, den);
  38807. if (neq25519(chk, num)) return -1;
  38808. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38809. M(r[3], r[0], r[1]);
  38810. return 0;
  38811. }
  38812. function crypto_sign_open(m, sm, n, pk) {
  38813. var i, mlen;
  38814. var t = new Uint8Array(32), h = new Uint8Array(64);
  38815. var p = [gf(), gf(), gf(), gf()],
  38816. q = [gf(), gf(), gf(), gf()];
  38817. mlen = -1;
  38818. if (n < 64) return -1;
  38819. if (unpackneg(q, pk)) return -1;
  38820. for (i = 0; i < n; i++) m[i] = sm[i];
  38821. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38822. crypto_hash(h, m, n);
  38823. reduce(h);
  38824. scalarmult(p, q, h);
  38825. scalarbase(q, sm.subarray(32));
  38826. add(p, q);
  38827. pack(t, p);
  38828. n -= 64;
  38829. if (crypto_verify_32(sm, 0, t, 0)) {
  38830. for (i = 0; i < n; i++) m[i] = 0;
  38831. return -1;
  38832. }
  38833. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38834. mlen = n;
  38835. return mlen;
  38836. }
  38837. var crypto_secretbox_KEYBYTES = 32,
  38838. crypto_secretbox_NONCEBYTES = 24,
  38839. crypto_secretbox_ZEROBYTES = 32,
  38840. crypto_secretbox_BOXZEROBYTES = 16,
  38841. crypto_scalarmult_BYTES = 32,
  38842. crypto_scalarmult_SCALARBYTES = 32,
  38843. crypto_box_PUBLICKEYBYTES = 32,
  38844. crypto_box_SECRETKEYBYTES = 32,
  38845. crypto_box_BEFORENMBYTES = 32,
  38846. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38847. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38848. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38849. crypto_sign_BYTES = 64,
  38850. crypto_sign_PUBLICKEYBYTES = 32,
  38851. crypto_sign_SECRETKEYBYTES = 64,
  38852. crypto_sign_SEEDBYTES = 32,
  38853. crypto_hash_BYTES = 64;
  38854. nacl.lowlevel = {
  38855. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38856. crypto_stream_xor: crypto_stream_xor,
  38857. crypto_stream: crypto_stream,
  38858. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38859. crypto_stream_salsa20: crypto_stream_salsa20,
  38860. crypto_onetimeauth: crypto_onetimeauth,
  38861. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38862. crypto_verify_16: crypto_verify_16,
  38863. crypto_verify_32: crypto_verify_32,
  38864. crypto_secretbox: crypto_secretbox,
  38865. crypto_secretbox_open: crypto_secretbox_open,
  38866. crypto_scalarmult: crypto_scalarmult,
  38867. crypto_scalarmult_base: crypto_scalarmult_base,
  38868. crypto_box_beforenm: crypto_box_beforenm,
  38869. crypto_box_afternm: crypto_box_afternm,
  38870. crypto_box: crypto_box,
  38871. crypto_box_open: crypto_box_open,
  38872. crypto_box_keypair: crypto_box_keypair,
  38873. crypto_hash: crypto_hash,
  38874. crypto_sign: crypto_sign,
  38875. crypto_sign_keypair: crypto_sign_keypair,
  38876. crypto_sign_open: crypto_sign_open,
  38877. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38878. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38879. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38880. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38881. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38882. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38883. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38884. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38885. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38886. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38887. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38888. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38889. crypto_sign_BYTES: crypto_sign_BYTES,
  38890. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38891. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38892. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38893. crypto_hash_BYTES: crypto_hash_BYTES
  38894. };
  38895. /* High-level API */
  38896. function checkLengths(k, n) {
  38897. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38898. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38899. }
  38900. function checkBoxLengths(pk, sk) {
  38901. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38902. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38903. }
  38904. function checkArrayTypes() {
  38905. for (var i = 0; i < arguments.length; i++) {
  38906. if (!(arguments[i] instanceof Uint8Array))
  38907. throw new TypeError('unexpected type, use Uint8Array');
  38908. }
  38909. }
  38910. function cleanup(arr) {
  38911. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38912. }
  38913. nacl.randomBytes = function(n) {
  38914. var b = new Uint8Array(n);
  38915. randombytes(b, n);
  38916. return b;
  38917. };
  38918. nacl.secretbox = function(msg, nonce, key) {
  38919. checkArrayTypes(msg, nonce, key);
  38920. checkLengths(key, nonce);
  38921. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38922. var c = new Uint8Array(m.length);
  38923. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38924. crypto_secretbox(c, m, m.length, nonce, key);
  38925. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38926. };
  38927. nacl.secretbox.open = function(box, nonce, key) {
  38928. checkArrayTypes(box, nonce, key);
  38929. checkLengths(key, nonce);
  38930. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38931. var m = new Uint8Array(c.length);
  38932. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38933. if (c.length < 32) return null;
  38934. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38935. return m.subarray(crypto_secretbox_ZEROBYTES);
  38936. };
  38937. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38938. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38939. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38940. nacl.scalarMult = function(n, p) {
  38941. checkArrayTypes(n, p);
  38942. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38943. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38944. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38945. crypto_scalarmult(q, n, p);
  38946. return q;
  38947. };
  38948. nacl.scalarMult.base = function(n) {
  38949. checkArrayTypes(n);
  38950. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38951. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38952. crypto_scalarmult_base(q, n);
  38953. return q;
  38954. };
  38955. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38956. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38957. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38958. var k = nacl.box.before(publicKey, secretKey);
  38959. return nacl.secretbox(msg, nonce, k);
  38960. };
  38961. nacl.box.before = function(publicKey, secretKey) {
  38962. checkArrayTypes(publicKey, secretKey);
  38963. checkBoxLengths(publicKey, secretKey);
  38964. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38965. crypto_box_beforenm(k, publicKey, secretKey);
  38966. return k;
  38967. };
  38968. nacl.box.after = nacl.secretbox;
  38969. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38970. var k = nacl.box.before(publicKey, secretKey);
  38971. return nacl.secretbox.open(msg, nonce, k);
  38972. };
  38973. nacl.box.open.after = nacl.secretbox.open;
  38974. nacl.box.keyPair = function() {
  38975. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38976. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38977. crypto_box_keypair(pk, sk);
  38978. return {publicKey: pk, secretKey: sk};
  38979. };
  38980. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38981. checkArrayTypes(secretKey);
  38982. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38983. throw new Error('bad secret key size');
  38984. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38985. crypto_scalarmult_base(pk, secretKey);
  38986. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38987. };
  38988. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38989. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38990. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38991. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38992. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38993. nacl.sign = function(msg, secretKey) {
  38994. checkArrayTypes(msg, secretKey);
  38995. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38996. throw new Error('bad secret key size');
  38997. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38998. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38999. return signedMsg;
  39000. };
  39001. nacl.sign.open = function(signedMsg, publicKey) {
  39002. checkArrayTypes(signedMsg, publicKey);
  39003. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39004. throw new Error('bad public key size');
  39005. var tmp = new Uint8Array(signedMsg.length);
  39006. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39007. if (mlen < 0) return null;
  39008. var m = new Uint8Array(mlen);
  39009. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39010. return m;
  39011. };
  39012. nacl.sign.detached = function(msg, secretKey) {
  39013. var signedMsg = nacl.sign(msg, secretKey);
  39014. var sig = new Uint8Array(crypto_sign_BYTES);
  39015. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39016. return sig;
  39017. };
  39018. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39019. checkArrayTypes(msg, sig, publicKey);
  39020. if (sig.length !== crypto_sign_BYTES)
  39021. throw new Error('bad signature size');
  39022. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39023. throw new Error('bad public key size');
  39024. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39025. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39026. var i;
  39027. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39028. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39029. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39030. };
  39031. nacl.sign.keyPair = function() {
  39032. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39033. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39034. crypto_sign_keypair(pk, sk);
  39035. return {publicKey: pk, secretKey: sk};
  39036. };
  39037. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39038. checkArrayTypes(secretKey);
  39039. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39040. throw new Error('bad secret key size');
  39041. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39042. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39043. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39044. };
  39045. nacl.sign.keyPair.fromSeed = function(seed) {
  39046. checkArrayTypes(seed);
  39047. if (seed.length !== crypto_sign_SEEDBYTES)
  39048. throw new Error('bad seed size');
  39049. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39050. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39051. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39052. crypto_sign_keypair(pk, sk, true);
  39053. return {publicKey: pk, secretKey: sk};
  39054. };
  39055. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39056. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39057. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39058. nacl.sign.signatureLength = crypto_sign_BYTES;
  39059. nacl.hash = function(msg) {
  39060. checkArrayTypes(msg);
  39061. var h = new Uint8Array(crypto_hash_BYTES);
  39062. crypto_hash(h, msg, msg.length);
  39063. return h;
  39064. };
  39065. nacl.hash.hashLength = crypto_hash_BYTES;
  39066. nacl.verify = function(x, y) {
  39067. checkArrayTypes(x, y);
  39068. // Zero length arguments are considered not equal.
  39069. if (x.length === 0 || y.length === 0) return false;
  39070. if (x.length !== y.length) return false;
  39071. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39072. };
  39073. nacl.setPRNG = function(fn) {
  39074. randombytes = fn;
  39075. };
  39076. (function() {
  39077. // Initialize PRNG if environment provides CSPRNG.
  39078. // If not, methods calling randombytes will throw.
  39079. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39080. if (crypto && crypto.getRandomValues) {
  39081. // Browsers.
  39082. var QUOTA = 65536;
  39083. nacl.setPRNG(function(x, n) {
  39084. var i, v = new Uint8Array(n);
  39085. for (i = 0; i < n; i += QUOTA) {
  39086. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39087. }
  39088. for (i = 0; i < n; i++) x[i] = v[i];
  39089. cleanup(v);
  39090. });
  39091. } else if (true) {
  39092. // Node.js.
  39093. crypto = __webpack_require__(3);
  39094. if (crypto && crypto.randomBytes) {
  39095. nacl.setPRNG(function(x, n) {
  39096. var i, v = crypto.randomBytes(n);
  39097. for (i = 0; i < n; i++) x[i] = v[i];
  39098. cleanup(v);
  39099. });
  39100. }
  39101. }
  39102. })();
  39103. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39104. /***/ }),
  39105. /* 1 */
  39106. /***/ (function(module, exports, __webpack_require__) {
  39107. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39108. // Public domain.
  39109. (function(root, f) {
  39110. 'use strict';
  39111. if ( true && module.exports) module.exports = f();
  39112. else if (root.nacl) root.nacl.util = f();
  39113. else {
  39114. root.nacl = {};
  39115. root.nacl.util = f();
  39116. }
  39117. }(this, function() {
  39118. 'use strict';
  39119. var util = {};
  39120. function validateBase64(s) {
  39121. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39122. throw new TypeError('invalid encoding');
  39123. }
  39124. }
  39125. util.decodeUTF8 = function(s) {
  39126. if (typeof s !== 'string') throw new TypeError('expected string');
  39127. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39128. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39129. return b;
  39130. };
  39131. util.encodeUTF8 = function(arr) {
  39132. var i, s = [];
  39133. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39134. return decodeURIComponent(escape(s.join('')));
  39135. };
  39136. if (typeof atob === 'undefined') {
  39137. // Node.js
  39138. if (typeof Buffer.from !== 'undefined') {
  39139. // Node v6 and later
  39140. util.encodeBase64 = function (arr) { // v6 and later
  39141. return Buffer.from(arr).toString('base64');
  39142. };
  39143. util.decodeBase64 = function (s) {
  39144. validateBase64(s);
  39145. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39146. };
  39147. } else {
  39148. // Node earlier than v6
  39149. util.encodeBase64 = function (arr) { // v6 and later
  39150. return (new Buffer(arr)).toString('base64');
  39151. };
  39152. util.decodeBase64 = function(s) {
  39153. validateBase64(s);
  39154. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39155. };
  39156. }
  39157. } else {
  39158. // Browsers
  39159. util.encodeBase64 = function(arr) {
  39160. var i, s = [], len = arr.length;
  39161. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39162. return btoa(s.join(''));
  39163. };
  39164. util.decodeBase64 = function(s) {
  39165. validateBase64(s);
  39166. var i, d = atob(s), b = new Uint8Array(d.length);
  39167. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39168. return b;
  39169. };
  39170. }
  39171. return util;
  39172. }));
  39173. /***/ }),
  39174. /* 2 */
  39175. /***/ (function(module, exports, __webpack_require__) {
  39176. // required so we don't have to do require('pusher').default etc.
  39177. module.exports = __webpack_require__(4).default;
  39178. /***/ }),
  39179. /* 3 */
  39180. /***/ (function(module, exports) {
  39181. /* (ignored) */
  39182. /***/ }),
  39183. /* 4 */
  39184. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39185. "use strict";
  39186. __webpack_require__.r(__webpack_exports__);
  39187. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39188. var ScriptReceiverFactory = (function () {
  39189. function ScriptReceiverFactory(prefix, name) {
  39190. this.lastId = 0;
  39191. this.prefix = prefix;
  39192. this.name = name;
  39193. }
  39194. ScriptReceiverFactory.prototype.create = function (callback) {
  39195. this.lastId++;
  39196. var number = this.lastId;
  39197. var id = this.prefix + number;
  39198. var name = this.name + "[" + number + "]";
  39199. var called = false;
  39200. var callbackWrapper = function () {
  39201. if (!called) {
  39202. callback.apply(null, arguments);
  39203. called = true;
  39204. }
  39205. };
  39206. this[number] = callbackWrapper;
  39207. return { number: number, id: id, name: name, callback: callbackWrapper };
  39208. };
  39209. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39210. delete this[receiver.number];
  39211. };
  39212. return ScriptReceiverFactory;
  39213. }());
  39214. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39215. // CONCATENATED MODULE: ./src/core/defaults.ts
  39216. var Defaults = {
  39217. VERSION: "5.0.3",
  39218. PROTOCOL: 7,
  39219. host: 'ws.pusherapp.com',
  39220. ws_port: 80,
  39221. wss_port: 443,
  39222. ws_path: '',
  39223. sockjs_host: 'sockjs.pusher.com',
  39224. sockjs_http_port: 80,
  39225. sockjs_https_port: 443,
  39226. sockjs_path: '/pusher',
  39227. stats_host: 'stats.pusher.com',
  39228. channel_auth_endpoint: '/pusher/auth',
  39229. channel_auth_transport: 'ajax',
  39230. activity_timeout: 120000,
  39231. pong_timeout: 30000,
  39232. unavailable_timeout: 10000,
  39233. cdn_http: "http://js.pusher.com",
  39234. cdn_https: "https://js.pusher.com",
  39235. dependency_suffix: ""
  39236. };
  39237. /* harmony default export */ var defaults = (Defaults);
  39238. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39239. var dependency_loader_DependencyLoader = (function () {
  39240. function DependencyLoader(options) {
  39241. this.options = options;
  39242. this.receivers = options.receivers || ScriptReceivers;
  39243. this.loading = {};
  39244. }
  39245. DependencyLoader.prototype.load = function (name, options, callback) {
  39246. var self = this;
  39247. if (self.loading[name] && self.loading[name].length > 0) {
  39248. self.loading[name].push(callback);
  39249. }
  39250. else {
  39251. self.loading[name] = [callback];
  39252. var request = runtime.createScriptRequest(self.getPath(name, options));
  39253. var receiver = self.receivers.create(function (error) {
  39254. self.receivers.remove(receiver);
  39255. if (self.loading[name]) {
  39256. var callbacks = self.loading[name];
  39257. delete self.loading[name];
  39258. var successCallback = function (wasSuccessful) {
  39259. if (!wasSuccessful) {
  39260. request.cleanup();
  39261. }
  39262. };
  39263. for (var i = 0; i < callbacks.length; i++) {
  39264. callbacks[i](error, successCallback);
  39265. }
  39266. }
  39267. });
  39268. request.send(receiver);
  39269. }
  39270. };
  39271. DependencyLoader.prototype.getRoot = function (options) {
  39272. var cdn;
  39273. var protocol = runtime.getDocument().location.protocol;
  39274. if ((options && options.useTLS) || protocol === "https:") {
  39275. cdn = this.options.cdn_https;
  39276. }
  39277. else {
  39278. cdn = this.options.cdn_http;
  39279. }
  39280. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39281. };
  39282. DependencyLoader.prototype.getPath = function (name, options) {
  39283. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39284. };
  39285. ;
  39286. return DependencyLoader;
  39287. }());
  39288. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39289. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39290. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39291. var Dependencies = new dependency_loader({
  39292. cdn_http: defaults.cdn_http,
  39293. cdn_https: defaults.cdn_https,
  39294. version: defaults.VERSION,
  39295. suffix: defaults.dependency_suffix,
  39296. receivers: DependenciesReceivers
  39297. });
  39298. // CONCATENATED MODULE: ./src/core/base64.ts
  39299. function encode(s) {
  39300. return btoa(utob(s));
  39301. }
  39302. var fromCharCode = String.fromCharCode;
  39303. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39304. var b64tab = {};
  39305. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39306. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39307. }
  39308. var cb_utob = function (c) {
  39309. var cc = c.charCodeAt(0);
  39310. return cc < 0x80
  39311. ? c
  39312. : cc < 0x800
  39313. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39314. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39315. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39316. fromCharCode(0x80 | (cc & 0x3f));
  39317. };
  39318. var utob = function (u) {
  39319. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39320. };
  39321. var cb_encode = function (ccc) {
  39322. var padlen = [0, 2, 1][ccc.length % 3];
  39323. var ord = (ccc.charCodeAt(0) << 16) |
  39324. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39325. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39326. var chars = [
  39327. b64chars.charAt(ord >>> 18),
  39328. b64chars.charAt((ord >>> 12) & 63),
  39329. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39330. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39331. ];
  39332. return chars.join('');
  39333. };
  39334. var btoa = window.btoa ||
  39335. function (b) {
  39336. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39337. };
  39338. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39339. var Timer = (function () {
  39340. function Timer(set, clear, delay, callback) {
  39341. var _this = this;
  39342. this.clear = clear;
  39343. this.timer = set(function () {
  39344. if (_this.timer) {
  39345. _this.timer = callback(_this.timer);
  39346. }
  39347. }, delay);
  39348. }
  39349. Timer.prototype.isRunning = function () {
  39350. return this.timer !== null;
  39351. };
  39352. Timer.prototype.ensureAborted = function () {
  39353. if (this.timer) {
  39354. this.clear(this.timer);
  39355. this.timer = null;
  39356. }
  39357. };
  39358. return Timer;
  39359. }());
  39360. /* harmony default export */ var abstract_timer = (Timer);
  39361. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39362. var __extends = (undefined && undefined.__extends) || (function () {
  39363. var extendStatics = function (d, b) {
  39364. extendStatics = Object.setPrototypeOf ||
  39365. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39366. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39367. return extendStatics(d, b);
  39368. };
  39369. return function (d, b) {
  39370. extendStatics(d, b);
  39371. function __() { this.constructor = d; }
  39372. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39373. };
  39374. })();
  39375. function timers_clearTimeout(timer) {
  39376. window.clearTimeout(timer);
  39377. }
  39378. function timers_clearInterval(timer) {
  39379. window.clearInterval(timer);
  39380. }
  39381. var OneOffTimer = (function (_super) {
  39382. __extends(OneOffTimer, _super);
  39383. function OneOffTimer(delay, callback) {
  39384. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39385. callback();
  39386. return null;
  39387. }) || this;
  39388. }
  39389. return OneOffTimer;
  39390. }(abstract_timer));
  39391. var PeriodicTimer = (function (_super) {
  39392. __extends(PeriodicTimer, _super);
  39393. function PeriodicTimer(delay, callback) {
  39394. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39395. callback();
  39396. return timer;
  39397. }) || this;
  39398. }
  39399. return PeriodicTimer;
  39400. }(abstract_timer));
  39401. // CONCATENATED MODULE: ./src/core/util.ts
  39402. var Util = {
  39403. now: function () {
  39404. if (Date.now) {
  39405. return Date.now();
  39406. }
  39407. else {
  39408. return new Date().valueOf();
  39409. }
  39410. },
  39411. defer: function (callback) {
  39412. return new OneOffTimer(0, callback);
  39413. },
  39414. method: function (name) {
  39415. var args = [];
  39416. for (var _i = 1; _i < arguments.length; _i++) {
  39417. args[_i - 1] = arguments[_i];
  39418. }
  39419. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39420. return function (object) {
  39421. return object[name].apply(object, boundArguments.concat(arguments));
  39422. };
  39423. }
  39424. };
  39425. /* harmony default export */ var util = (Util);
  39426. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39427. function extend(target) {
  39428. var sources = [];
  39429. for (var _i = 1; _i < arguments.length; _i++) {
  39430. sources[_i - 1] = arguments[_i];
  39431. }
  39432. for (var i = 0; i < sources.length; i++) {
  39433. var extensions = sources[i];
  39434. for (var property in extensions) {
  39435. if (extensions[property] && extensions[property].constructor &&
  39436. extensions[property].constructor === Object) {
  39437. target[property] = extend(target[property] || {}, extensions[property]);
  39438. }
  39439. else {
  39440. target[property] = extensions[property];
  39441. }
  39442. }
  39443. }
  39444. return target;
  39445. }
  39446. function stringify() {
  39447. var m = ["Pusher"];
  39448. for (var i = 0; i < arguments.length; i++) {
  39449. if (typeof arguments[i] === "string") {
  39450. m.push(arguments[i]);
  39451. }
  39452. else {
  39453. m.push(safeJSONStringify(arguments[i]));
  39454. }
  39455. }
  39456. return m.join(" : ");
  39457. }
  39458. function arrayIndexOf(array, item) {
  39459. var nativeIndexOf = Array.prototype.indexOf;
  39460. if (array === null) {
  39461. return -1;
  39462. }
  39463. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39464. return array.indexOf(item);
  39465. }
  39466. for (var i = 0, l = array.length; i < l; i++) {
  39467. if (array[i] === item) {
  39468. return i;
  39469. }
  39470. }
  39471. return -1;
  39472. }
  39473. function objectApply(object, f) {
  39474. for (var key in object) {
  39475. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39476. f(object[key], key, object);
  39477. }
  39478. }
  39479. }
  39480. function keys(object) {
  39481. var keys = [];
  39482. objectApply(object, function (_, key) {
  39483. keys.push(key);
  39484. });
  39485. return keys;
  39486. }
  39487. function values(object) {
  39488. var values = [];
  39489. objectApply(object, function (value) {
  39490. values.push(value);
  39491. });
  39492. return values;
  39493. }
  39494. function apply(array, f, context) {
  39495. for (var i = 0; i < array.length; i++) {
  39496. f.call(context || window, array[i], i, array);
  39497. }
  39498. }
  39499. function map(array, f) {
  39500. var result = [];
  39501. for (var i = 0; i < array.length; i++) {
  39502. result.push(f(array[i], i, array, result));
  39503. }
  39504. return result;
  39505. }
  39506. function mapObject(object, f) {
  39507. var result = {};
  39508. objectApply(object, function (value, key) {
  39509. result[key] = f(value);
  39510. });
  39511. return result;
  39512. }
  39513. function filter(array, test) {
  39514. test = test || function (value) { return !!value; };
  39515. var result = [];
  39516. for (var i = 0; i < array.length; i++) {
  39517. if (test(array[i], i, array, result)) {
  39518. result.push(array[i]);
  39519. }
  39520. }
  39521. return result;
  39522. }
  39523. function filterObject(object, test) {
  39524. var result = {};
  39525. objectApply(object, function (value, key) {
  39526. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39527. result[key] = value;
  39528. }
  39529. });
  39530. return result;
  39531. }
  39532. function flatten(object) {
  39533. var result = [];
  39534. objectApply(object, function (value, key) {
  39535. result.push([key, value]);
  39536. });
  39537. return result;
  39538. }
  39539. function any(array, test) {
  39540. for (var i = 0; i < array.length; i++) {
  39541. if (test(array[i], i, array)) {
  39542. return true;
  39543. }
  39544. }
  39545. return false;
  39546. }
  39547. function collections_all(array, test) {
  39548. for (var i = 0; i < array.length; i++) {
  39549. if (!test(array[i], i, array)) {
  39550. return false;
  39551. }
  39552. }
  39553. return true;
  39554. }
  39555. function encodeParamsObject(data) {
  39556. return mapObject(data, function (value) {
  39557. if (typeof value === "object") {
  39558. value = safeJSONStringify(value);
  39559. }
  39560. return encodeURIComponent(encode(value.toString()));
  39561. });
  39562. }
  39563. function buildQueryString(data) {
  39564. var params = filterObject(data, function (value) {
  39565. return value !== undefined;
  39566. });
  39567. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39568. return query;
  39569. }
  39570. function decycleObject(object) {
  39571. var objects = [], paths = [];
  39572. return (function derez(value, path) {
  39573. var i, name, nu;
  39574. switch (typeof value) {
  39575. case 'object':
  39576. if (!value) {
  39577. return null;
  39578. }
  39579. for (i = 0; i < objects.length; i += 1) {
  39580. if (objects[i] === value) {
  39581. return { $ref: paths[i] };
  39582. }
  39583. }
  39584. objects.push(value);
  39585. paths.push(path);
  39586. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39587. nu = [];
  39588. for (i = 0; i < value.length; i += 1) {
  39589. nu[i] = derez(value[i], path + '[' + i + ']');
  39590. }
  39591. }
  39592. else {
  39593. nu = {};
  39594. for (name in value) {
  39595. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39596. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39597. }
  39598. }
  39599. }
  39600. return nu;
  39601. case 'number':
  39602. case 'string':
  39603. case 'boolean':
  39604. return value;
  39605. }
  39606. }(object, '$'));
  39607. }
  39608. function safeJSONStringify(source) {
  39609. try {
  39610. return JSON.stringify(source);
  39611. }
  39612. catch (e) {
  39613. return JSON.stringify(decycleObject(source));
  39614. }
  39615. }
  39616. // CONCATENATED MODULE: ./src/core/logger.ts
  39617. var logger_Logger = (function () {
  39618. function Logger() {
  39619. this.globalLog = function (message) {
  39620. if (window.console && window.console.log) {
  39621. window.console.log(message);
  39622. }
  39623. };
  39624. }
  39625. Logger.prototype.debug = function () {
  39626. var args = [];
  39627. for (var _i = 0; _i < arguments.length; _i++) {
  39628. args[_i] = arguments[_i];
  39629. }
  39630. this.log(this.globalLog, args);
  39631. };
  39632. Logger.prototype.warn = function () {
  39633. var args = [];
  39634. for (var _i = 0; _i < arguments.length; _i++) {
  39635. args[_i] = arguments[_i];
  39636. }
  39637. this.log(this.globalLogWarn, args);
  39638. };
  39639. Logger.prototype.error = function () {
  39640. var args = [];
  39641. for (var _i = 0; _i < arguments.length; _i++) {
  39642. args[_i] = arguments[_i];
  39643. }
  39644. this.log(this.globalLogError, args);
  39645. };
  39646. Logger.prototype.globalLogWarn = function (message) {
  39647. if (window.console && window.console.warn) {
  39648. window.console.warn(message);
  39649. }
  39650. else {
  39651. this.globalLog(message);
  39652. }
  39653. };
  39654. Logger.prototype.globalLogError = function (message) {
  39655. if (window.console && window.console.error) {
  39656. window.console.error(message);
  39657. }
  39658. else {
  39659. this.globalLogWarn(message);
  39660. }
  39661. };
  39662. Logger.prototype.log = function (defaultLoggingFunction) {
  39663. var args = [];
  39664. for (var _i = 1; _i < arguments.length; _i++) {
  39665. args[_i - 1] = arguments[_i];
  39666. }
  39667. var message = stringify.apply(this, arguments);
  39668. if (core_pusher.log) {
  39669. core_pusher.log(message);
  39670. }
  39671. else if (core_pusher.logToConsole) {
  39672. var log = defaultLoggingFunction.bind(this);
  39673. log(message);
  39674. }
  39675. };
  39676. return Logger;
  39677. }());
  39678. /* harmony default export */ var logger = (new logger_Logger());
  39679. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39680. var urlStore = {
  39681. baseUrl: "https://pusher.com",
  39682. urls: {
  39683. authenticationEndpoint: {
  39684. path: "/docs/authenticating_users",
  39685. },
  39686. javascriptQuickStart: {
  39687. path: "/docs/javascript_quick_start"
  39688. },
  39689. triggeringClientEvents: {
  39690. path: "/docs/client_api_guide/client_events#trigger-events"
  39691. }
  39692. }
  39693. };
  39694. var buildLogSuffix = function (key) {
  39695. var urlPrefix = "See:";
  39696. var urlObj = urlStore.urls[key];
  39697. if (!urlObj)
  39698. return "";
  39699. var url;
  39700. if (urlObj.fullUrl) {
  39701. url = urlObj.fullUrl;
  39702. }
  39703. else if (urlObj.path) {
  39704. url = urlStore.baseUrl + urlObj.path;
  39705. }
  39706. if (!url)
  39707. return "";
  39708. return urlPrefix + " " + url;
  39709. };
  39710. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39711. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39712. var ajax = function (context, socketId, callback) {
  39713. var self = this, xhr;
  39714. xhr = runtime.createXHR();
  39715. xhr.open("POST", self.options.authEndpoint, true);
  39716. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39717. for (var headerName in this.authOptions.headers) {
  39718. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39719. }
  39720. xhr.onreadystatechange = function () {
  39721. if (xhr.readyState === 4) {
  39722. if (xhr.status === 200) {
  39723. var data, parsed = false;
  39724. try {
  39725. data = JSON.parse(xhr.responseText);
  39726. parsed = true;
  39727. }
  39728. catch (e) {
  39729. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39730. }
  39731. if (parsed) {
  39732. callback(false, data);
  39733. }
  39734. }
  39735. else {
  39736. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39737. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39738. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39739. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39740. callback(true, xhr.status);
  39741. }
  39742. }
  39743. };
  39744. xhr.send(this.composeQuery(socketId));
  39745. return xhr;
  39746. };
  39747. /* harmony default export */ var xhr_auth = (ajax);
  39748. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39749. var jsonp = function (context, socketId, callback) {
  39750. if (this.authOptions.headers !== undefined) {
  39751. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39752. }
  39753. var callbackName = context.nextAuthCallbackID.toString();
  39754. context.nextAuthCallbackID++;
  39755. var document = context.getDocument();
  39756. var script = document.createElement("script");
  39757. context.auth_callbacks[callbackName] = function (data) {
  39758. callback(false, data);
  39759. };
  39760. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39761. script.src = this.options.authEndpoint +
  39762. '?callback=' +
  39763. encodeURIComponent(callback_name) +
  39764. '&' +
  39765. this.composeQuery(socketId);
  39766. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39767. head.insertBefore(script, head.firstChild);
  39768. };
  39769. /* harmony default export */ var jsonp_auth = (jsonp);
  39770. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39771. var ScriptRequest = (function () {
  39772. function ScriptRequest(src) {
  39773. this.src = src;
  39774. }
  39775. ScriptRequest.prototype.send = function (receiver) {
  39776. var self = this;
  39777. var errorString = "Error loading " + self.src;
  39778. self.script = document.createElement("script");
  39779. self.script.id = receiver.id;
  39780. self.script.src = self.src;
  39781. self.script.type = "text/javascript";
  39782. self.script.charset = "UTF-8";
  39783. if (self.script.addEventListener) {
  39784. self.script.onerror = function () {
  39785. receiver.callback(errorString);
  39786. };
  39787. self.script.onload = function () {
  39788. receiver.callback(null);
  39789. };
  39790. }
  39791. else {
  39792. self.script.onreadystatechange = function () {
  39793. if (self.script.readyState === 'loaded' ||
  39794. self.script.readyState === 'complete') {
  39795. receiver.callback(null);
  39796. }
  39797. };
  39798. }
  39799. if (self.script.async === undefined && document.attachEvent &&
  39800. /opera/i.test(navigator.userAgent)) {
  39801. self.errorScript = document.createElement("script");
  39802. self.errorScript.id = receiver.id + "_error";
  39803. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39804. self.script.async = self.errorScript.async = false;
  39805. }
  39806. else {
  39807. self.script.async = true;
  39808. }
  39809. var head = document.getElementsByTagName('head')[0];
  39810. head.insertBefore(self.script, head.firstChild);
  39811. if (self.errorScript) {
  39812. head.insertBefore(self.errorScript, self.script.nextSibling);
  39813. }
  39814. };
  39815. ScriptRequest.prototype.cleanup = function () {
  39816. if (this.script) {
  39817. this.script.onload = this.script.onerror = null;
  39818. this.script.onreadystatechange = null;
  39819. }
  39820. if (this.script && this.script.parentNode) {
  39821. this.script.parentNode.removeChild(this.script);
  39822. }
  39823. if (this.errorScript && this.errorScript.parentNode) {
  39824. this.errorScript.parentNode.removeChild(this.errorScript);
  39825. }
  39826. this.script = null;
  39827. this.errorScript = null;
  39828. };
  39829. return ScriptRequest;
  39830. }());
  39831. /* harmony default export */ var script_request = (ScriptRequest);
  39832. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39833. var jsonp_request_JSONPRequest = (function () {
  39834. function JSONPRequest(url, data) {
  39835. this.url = url;
  39836. this.data = data;
  39837. }
  39838. JSONPRequest.prototype.send = function (receiver) {
  39839. if (this.request) {
  39840. return;
  39841. }
  39842. var query = buildQueryString(this.data);
  39843. var url = this.url + "/" + receiver.number + "?" + query;
  39844. this.request = runtime.createScriptRequest(url);
  39845. this.request.send(receiver);
  39846. };
  39847. JSONPRequest.prototype.cleanup = function () {
  39848. if (this.request) {
  39849. this.request.cleanup();
  39850. }
  39851. };
  39852. return JSONPRequest;
  39853. }());
  39854. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39855. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39856. var getAgent = function (sender, useTLS) {
  39857. return function (data, callback) {
  39858. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39859. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39860. var request = runtime.createJSONPRequest(url, data);
  39861. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39862. ScriptReceivers.remove(receiver);
  39863. request.cleanup();
  39864. if (result && result.host) {
  39865. sender.host = result.host;
  39866. }
  39867. if (callback) {
  39868. callback(error, result);
  39869. }
  39870. });
  39871. request.send(receiver);
  39872. };
  39873. };
  39874. var jsonp_timeline_jsonp = {
  39875. name: 'jsonp',
  39876. getAgent: getAgent
  39877. };
  39878. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39879. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39880. function getGenericURL(baseScheme, params, path) {
  39881. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39882. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39883. return scheme + "://" + host + path;
  39884. }
  39885. function getGenericPath(key, queryString) {
  39886. var path = "/app/" + key;
  39887. var query = "?protocol=" + defaults.PROTOCOL +
  39888. "&client=js" +
  39889. "&version=" + defaults.VERSION +
  39890. (queryString ? ("&" + queryString) : "");
  39891. return path + query;
  39892. }
  39893. var ws = {
  39894. getInitial: function (key, params) {
  39895. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39896. return getGenericURL("ws", params, path);
  39897. }
  39898. };
  39899. var http = {
  39900. getInitial: function (key, params) {
  39901. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39902. return getGenericURL("http", params, path);
  39903. }
  39904. };
  39905. var sockjs = {
  39906. getInitial: function (key, params) {
  39907. return getGenericURL("http", params, params.httpPath || "/pusher");
  39908. },
  39909. getPath: function (key, params) {
  39910. return getGenericPath(key);
  39911. }
  39912. };
  39913. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39914. var callback_registry_CallbackRegistry = (function () {
  39915. function CallbackRegistry() {
  39916. this._callbacks = {};
  39917. }
  39918. CallbackRegistry.prototype.get = function (name) {
  39919. return this._callbacks[prefix(name)];
  39920. };
  39921. CallbackRegistry.prototype.add = function (name, callback, context) {
  39922. var prefixedEventName = prefix(name);
  39923. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39924. this._callbacks[prefixedEventName].push({
  39925. fn: callback,
  39926. context: context
  39927. });
  39928. };
  39929. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39930. if (!name && !callback && !context) {
  39931. this._callbacks = {};
  39932. return;
  39933. }
  39934. var names = name ? [prefix(name)] : keys(this._callbacks);
  39935. if (callback || context) {
  39936. this.removeCallback(names, callback, context);
  39937. }
  39938. else {
  39939. this.removeAllCallbacks(names);
  39940. }
  39941. };
  39942. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39943. apply(names, function (name) {
  39944. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39945. return (callback && callback !== binding.fn) ||
  39946. (context && context !== binding.context);
  39947. });
  39948. if (this._callbacks[name].length === 0) {
  39949. delete this._callbacks[name];
  39950. }
  39951. }, this);
  39952. };
  39953. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39954. apply(names, function (name) {
  39955. delete this._callbacks[name];
  39956. }, this);
  39957. };
  39958. return CallbackRegistry;
  39959. }());
  39960. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39961. function prefix(name) {
  39962. return "_" + name;
  39963. }
  39964. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39965. var dispatcher_Dispatcher = (function () {
  39966. function Dispatcher(failThrough) {
  39967. this.callbacks = new callback_registry();
  39968. this.global_callbacks = [];
  39969. this.failThrough = failThrough;
  39970. }
  39971. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39972. this.callbacks.add(eventName, callback, context);
  39973. return this;
  39974. };
  39975. Dispatcher.prototype.bind_global = function (callback) {
  39976. this.global_callbacks.push(callback);
  39977. return this;
  39978. };
  39979. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39980. this.callbacks.remove(eventName, callback, context);
  39981. return this;
  39982. };
  39983. Dispatcher.prototype.unbind_global = function (callback) {
  39984. if (!callback) {
  39985. this.global_callbacks = [];
  39986. return this;
  39987. }
  39988. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39989. return this;
  39990. };
  39991. Dispatcher.prototype.unbind_all = function () {
  39992. this.unbind();
  39993. this.unbind_global();
  39994. return this;
  39995. };
  39996. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39997. for (var i = 0; i < this.global_callbacks.length; i++) {
  39998. this.global_callbacks[i](eventName, data);
  39999. }
  40000. var callbacks = this.callbacks.get(eventName);
  40001. var args = [];
  40002. if (metadata) {
  40003. args.push(data, metadata);
  40004. }
  40005. else if (data) {
  40006. args.push(data);
  40007. }
  40008. if (callbacks && callbacks.length > 0) {
  40009. for (var i = 0; i < callbacks.length; i++) {
  40010. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40011. }
  40012. }
  40013. else if (this.failThrough) {
  40014. this.failThrough(eventName, data);
  40015. }
  40016. return this;
  40017. };
  40018. return Dispatcher;
  40019. }());
  40020. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40021. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40022. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40023. var extendStatics = function (d, b) {
  40024. extendStatics = Object.setPrototypeOf ||
  40025. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40026. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40027. return extendStatics(d, b);
  40028. };
  40029. return function (d, b) {
  40030. extendStatics(d, b);
  40031. function __() { this.constructor = d; }
  40032. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40033. };
  40034. })();
  40035. var transport_connection_TransportConnection = (function (_super) {
  40036. transport_connection_extends(TransportConnection, _super);
  40037. function TransportConnection(hooks, name, priority, key, options) {
  40038. var _this = _super.call(this) || this;
  40039. _this.initialize = runtime.transportConnectionInitializer;
  40040. _this.hooks = hooks;
  40041. _this.name = name;
  40042. _this.priority = priority;
  40043. _this.key = key;
  40044. _this.options = options;
  40045. _this.state = "new";
  40046. _this.timeline = options.timeline;
  40047. _this.activityTimeout = options.activityTimeout;
  40048. _this.id = _this.timeline.generateUniqueID();
  40049. return _this;
  40050. }
  40051. TransportConnection.prototype.handlesActivityChecks = function () {
  40052. return Boolean(this.hooks.handlesActivityChecks);
  40053. };
  40054. TransportConnection.prototype.supportsPing = function () {
  40055. return Boolean(this.hooks.supportsPing);
  40056. };
  40057. TransportConnection.prototype.connect = function () {
  40058. var _this = this;
  40059. if (this.socket || this.state !== "initialized") {
  40060. return false;
  40061. }
  40062. var url = this.hooks.urls.getInitial(this.key, this.options);
  40063. try {
  40064. this.socket = this.hooks.getSocket(url, this.options);
  40065. }
  40066. catch (e) {
  40067. util.defer(function () {
  40068. _this.onError(e);
  40069. _this.changeState("closed");
  40070. });
  40071. return false;
  40072. }
  40073. this.bindListeners();
  40074. logger.debug("Connecting", { transport: this.name, url: url });
  40075. this.changeState("connecting");
  40076. return true;
  40077. };
  40078. TransportConnection.prototype.close = function () {
  40079. if (this.socket) {
  40080. this.socket.close();
  40081. return true;
  40082. }
  40083. else {
  40084. return false;
  40085. }
  40086. };
  40087. TransportConnection.prototype.send = function (data) {
  40088. var _this = this;
  40089. if (this.state === "open") {
  40090. util.defer(function () {
  40091. if (_this.socket) {
  40092. _this.socket.send(data);
  40093. }
  40094. });
  40095. return true;
  40096. }
  40097. else {
  40098. return false;
  40099. }
  40100. };
  40101. TransportConnection.prototype.ping = function () {
  40102. if (this.state === "open" && this.supportsPing()) {
  40103. this.socket.ping();
  40104. }
  40105. };
  40106. TransportConnection.prototype.onOpen = function () {
  40107. if (this.hooks.beforeOpen) {
  40108. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40109. }
  40110. this.changeState("open");
  40111. this.socket.onopen = undefined;
  40112. };
  40113. TransportConnection.prototype.onError = function (error) {
  40114. this.emit("error", { type: 'WebSocketError', error: error });
  40115. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40116. };
  40117. TransportConnection.prototype.onClose = function (closeEvent) {
  40118. if (closeEvent) {
  40119. this.changeState("closed", {
  40120. code: closeEvent.code,
  40121. reason: closeEvent.reason,
  40122. wasClean: closeEvent.wasClean
  40123. });
  40124. }
  40125. else {
  40126. this.changeState("closed");
  40127. }
  40128. this.unbindListeners();
  40129. this.socket = undefined;
  40130. };
  40131. TransportConnection.prototype.onMessage = function (message) {
  40132. this.emit("message", message);
  40133. };
  40134. TransportConnection.prototype.onActivity = function () {
  40135. this.emit("activity");
  40136. };
  40137. TransportConnection.prototype.bindListeners = function () {
  40138. var _this = this;
  40139. this.socket.onopen = function () {
  40140. _this.onOpen();
  40141. };
  40142. this.socket.onerror = function (error) {
  40143. _this.onError(error);
  40144. };
  40145. this.socket.onclose = function (closeEvent) {
  40146. _this.onClose(closeEvent);
  40147. };
  40148. this.socket.onmessage = function (message) {
  40149. _this.onMessage(message);
  40150. };
  40151. if (this.supportsPing()) {
  40152. this.socket.onactivity = function () { _this.onActivity(); };
  40153. }
  40154. };
  40155. TransportConnection.prototype.unbindListeners = function () {
  40156. if (this.socket) {
  40157. this.socket.onopen = undefined;
  40158. this.socket.onerror = undefined;
  40159. this.socket.onclose = undefined;
  40160. this.socket.onmessage = undefined;
  40161. if (this.supportsPing()) {
  40162. this.socket.onactivity = undefined;
  40163. }
  40164. }
  40165. };
  40166. TransportConnection.prototype.changeState = function (state, params) {
  40167. this.state = state;
  40168. this.timeline.info(this.buildTimelineMessage({
  40169. state: state,
  40170. params: params
  40171. }));
  40172. this.emit(state, params);
  40173. };
  40174. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40175. return extend({ cid: this.id }, message);
  40176. };
  40177. return TransportConnection;
  40178. }(dispatcher));
  40179. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40180. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40181. var transport_Transport = (function () {
  40182. function Transport(hooks) {
  40183. this.hooks = hooks;
  40184. }
  40185. Transport.prototype.isSupported = function (environment) {
  40186. return this.hooks.isSupported(environment);
  40187. };
  40188. Transport.prototype.createConnection = function (name, priority, key, options) {
  40189. return new transport_connection(this.hooks, name, priority, key, options);
  40190. };
  40191. return Transport;
  40192. }());
  40193. /* harmony default export */ var transports_transport = (transport_Transport);
  40194. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40195. var WSTransport = new transports_transport({
  40196. urls: ws,
  40197. handlesActivityChecks: false,
  40198. supportsPing: false,
  40199. isInitialized: function () {
  40200. return Boolean(runtime.getWebSocketAPI());
  40201. },
  40202. isSupported: function () {
  40203. return Boolean(runtime.getWebSocketAPI());
  40204. },
  40205. getSocket: function (url) {
  40206. return runtime.createWebSocket(url);
  40207. }
  40208. });
  40209. var httpConfiguration = {
  40210. urls: http,
  40211. handlesActivityChecks: false,
  40212. supportsPing: true,
  40213. isInitialized: function () {
  40214. return true;
  40215. }
  40216. };
  40217. var streamingConfiguration = extend({ getSocket: function (url) {
  40218. return runtime.HTTPFactory.createStreamingSocket(url);
  40219. }
  40220. }, httpConfiguration);
  40221. var pollingConfiguration = extend({ getSocket: function (url) {
  40222. return runtime.HTTPFactory.createPollingSocket(url);
  40223. }
  40224. }, httpConfiguration);
  40225. var xhrConfiguration = {
  40226. isSupported: function () {
  40227. return runtime.isXHRSupported();
  40228. }
  40229. };
  40230. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40231. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40232. var Transports = {
  40233. ws: WSTransport,
  40234. xhr_streaming: XHRStreamingTransport,
  40235. xhr_polling: XHRPollingTransport
  40236. };
  40237. /* harmony default export */ var transports = (Transports);
  40238. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40239. var SockJSTransport = new transports_transport({
  40240. file: "sockjs",
  40241. urls: sockjs,
  40242. handlesActivityChecks: true,
  40243. supportsPing: false,
  40244. isSupported: function () {
  40245. return true;
  40246. },
  40247. isInitialized: function () {
  40248. return window.SockJS !== undefined;
  40249. },
  40250. getSocket: function (url, options) {
  40251. return new window.SockJS(url, null, {
  40252. js_path: Dependencies.getPath("sockjs", {
  40253. useTLS: options.useTLS
  40254. }),
  40255. ignore_null_origin: options.ignoreNullOrigin
  40256. });
  40257. },
  40258. beforeOpen: function (socket, path) {
  40259. socket.send(JSON.stringify({
  40260. path: path
  40261. }));
  40262. }
  40263. });
  40264. var xdrConfiguration = {
  40265. isSupported: function (environment) {
  40266. var yes = runtime.isXDRSupported(environment.useTLS);
  40267. return yes;
  40268. }
  40269. };
  40270. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40271. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40272. transports.xdr_streaming = XDRStreamingTransport;
  40273. transports.xdr_polling = XDRPollingTransport;
  40274. transports.sockjs = SockJSTransport;
  40275. /* harmony default export */ var transports_transports = (transports);
  40276. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40277. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40278. var extendStatics = function (d, b) {
  40279. extendStatics = Object.setPrototypeOf ||
  40280. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40281. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40282. return extendStatics(d, b);
  40283. };
  40284. return function (d, b) {
  40285. extendStatics(d, b);
  40286. function __() { this.constructor = d; }
  40287. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40288. };
  40289. })();
  40290. var NetInfo = (function (_super) {
  40291. net_info_extends(NetInfo, _super);
  40292. function NetInfo() {
  40293. var _this = _super.call(this) || this;
  40294. var self = _this;
  40295. if (window.addEventListener !== undefined) {
  40296. window.addEventListener("online", function () {
  40297. self.emit('online');
  40298. }, false);
  40299. window.addEventListener("offline", function () {
  40300. self.emit('offline');
  40301. }, false);
  40302. }
  40303. return _this;
  40304. }
  40305. NetInfo.prototype.isOnline = function () {
  40306. if (window.navigator.onLine === undefined) {
  40307. return true;
  40308. }
  40309. else {
  40310. return window.navigator.onLine;
  40311. }
  40312. };
  40313. return NetInfo;
  40314. }(dispatcher));
  40315. var net_info_Network = new NetInfo();
  40316. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40317. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40318. function AssistantToTheTransportManager(manager, transport, options) {
  40319. this.manager = manager;
  40320. this.transport = transport;
  40321. this.minPingDelay = options.minPingDelay;
  40322. this.maxPingDelay = options.maxPingDelay;
  40323. this.pingDelay = undefined;
  40324. }
  40325. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40326. var _this = this;
  40327. options = extend({}, options, {
  40328. activityTimeout: this.pingDelay
  40329. });
  40330. var connection = this.transport.createConnection(name, priority, key, options);
  40331. var openTimestamp = null;
  40332. var onOpen = function () {
  40333. connection.unbind("open", onOpen);
  40334. connection.bind("closed", onClosed);
  40335. openTimestamp = util.now();
  40336. };
  40337. var onClosed = function (closeEvent) {
  40338. connection.unbind("closed", onClosed);
  40339. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40340. _this.manager.reportDeath();
  40341. }
  40342. else if (!closeEvent.wasClean && openTimestamp) {
  40343. var lifespan = util.now() - openTimestamp;
  40344. if (lifespan < 2 * _this.maxPingDelay) {
  40345. _this.manager.reportDeath();
  40346. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40347. }
  40348. }
  40349. };
  40350. connection.bind("open", onOpen);
  40351. return connection;
  40352. };
  40353. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40354. return this.manager.isAlive() && this.transport.isSupported(environment);
  40355. };
  40356. return AssistantToTheTransportManager;
  40357. }());
  40358. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40359. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40360. var Protocol = {
  40361. decodeMessage: function (messageEvent) {
  40362. try {
  40363. var messageData = JSON.parse(messageEvent.data);
  40364. var pusherEventData = messageData.data;
  40365. if (typeof pusherEventData === 'string') {
  40366. try {
  40367. pusherEventData = JSON.parse(messageData.data);
  40368. }
  40369. catch (e) { }
  40370. }
  40371. var pusherEvent = {
  40372. event: messageData.event,
  40373. channel: messageData.channel,
  40374. data: pusherEventData,
  40375. };
  40376. if (messageData.user_id) {
  40377. pusherEvent.user_id = messageData.user_id;
  40378. }
  40379. return pusherEvent;
  40380. }
  40381. catch (e) {
  40382. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40383. }
  40384. },
  40385. encodeMessage: function (event) {
  40386. return JSON.stringify(event);
  40387. },
  40388. processHandshake: function (messageEvent) {
  40389. var message = Protocol.decodeMessage(messageEvent);
  40390. if (message.event === "pusher:connection_established") {
  40391. if (!message.data.activity_timeout) {
  40392. throw "No activity timeout specified in handshake";
  40393. }
  40394. return {
  40395. action: "connected",
  40396. id: message.data.socket_id,
  40397. activityTimeout: message.data.activity_timeout * 1000
  40398. };
  40399. }
  40400. else if (message.event === "pusher:error") {
  40401. return {
  40402. action: this.getCloseAction(message.data),
  40403. error: this.getCloseError(message.data)
  40404. };
  40405. }
  40406. else {
  40407. throw "Invalid handshake";
  40408. }
  40409. },
  40410. getCloseAction: function (closeEvent) {
  40411. if (closeEvent.code < 4000) {
  40412. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40413. return "backoff";
  40414. }
  40415. else {
  40416. return null;
  40417. }
  40418. }
  40419. else if (closeEvent.code === 4000) {
  40420. return "tls_only";
  40421. }
  40422. else if (closeEvent.code < 4100) {
  40423. return "refused";
  40424. }
  40425. else if (closeEvent.code < 4200) {
  40426. return "backoff";
  40427. }
  40428. else if (closeEvent.code < 4300) {
  40429. return "retry";
  40430. }
  40431. else {
  40432. return "refused";
  40433. }
  40434. },
  40435. getCloseError: function (closeEvent) {
  40436. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40437. return {
  40438. type: 'PusherError',
  40439. data: {
  40440. code: closeEvent.code,
  40441. message: closeEvent.reason || closeEvent.message
  40442. }
  40443. };
  40444. }
  40445. else {
  40446. return null;
  40447. }
  40448. }
  40449. };
  40450. /* harmony default export */ var protocol_protocol = (Protocol);
  40451. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40452. var connection_extends = (undefined && undefined.__extends) || (function () {
  40453. var extendStatics = function (d, b) {
  40454. extendStatics = Object.setPrototypeOf ||
  40455. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40456. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40457. return extendStatics(d, b);
  40458. };
  40459. return function (d, b) {
  40460. extendStatics(d, b);
  40461. function __() { this.constructor = d; }
  40462. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40463. };
  40464. })();
  40465. var connection_Connection = (function (_super) {
  40466. connection_extends(Connection, _super);
  40467. function Connection(id, transport) {
  40468. var _this = _super.call(this) || this;
  40469. _this.id = id;
  40470. _this.transport = transport;
  40471. _this.activityTimeout = transport.activityTimeout;
  40472. _this.bindListeners();
  40473. return _this;
  40474. }
  40475. Connection.prototype.handlesActivityChecks = function () {
  40476. return this.transport.handlesActivityChecks();
  40477. };
  40478. Connection.prototype.send = function (data) {
  40479. return this.transport.send(data);
  40480. };
  40481. Connection.prototype.send_event = function (name, data, channel) {
  40482. var event = { event: name, data: data };
  40483. if (channel) {
  40484. event.channel = channel;
  40485. }
  40486. logger.debug('Event sent', event);
  40487. return this.send(protocol_protocol.encodeMessage(event));
  40488. };
  40489. Connection.prototype.ping = function () {
  40490. if (this.transport.supportsPing()) {
  40491. this.transport.ping();
  40492. }
  40493. else {
  40494. this.send_event('pusher:ping', {});
  40495. }
  40496. };
  40497. Connection.prototype.close = function () {
  40498. this.transport.close();
  40499. };
  40500. Connection.prototype.bindListeners = function () {
  40501. var _this = this;
  40502. var listeners = {
  40503. message: function (messageEvent) {
  40504. var pusherEvent;
  40505. try {
  40506. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40507. }
  40508. catch (e) {
  40509. _this.emit('error', {
  40510. type: 'MessageParseError',
  40511. error: e,
  40512. data: messageEvent.data
  40513. });
  40514. }
  40515. if (pusherEvent !== undefined) {
  40516. logger.debug('Event recd', pusherEvent);
  40517. switch (pusherEvent.event) {
  40518. case 'pusher:error':
  40519. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40520. break;
  40521. case 'pusher:ping':
  40522. _this.emit("ping");
  40523. break;
  40524. case 'pusher:pong':
  40525. _this.emit("pong");
  40526. break;
  40527. }
  40528. _this.emit('message', pusherEvent);
  40529. }
  40530. },
  40531. activity: function () {
  40532. _this.emit("activity");
  40533. },
  40534. error: function (error) {
  40535. _this.emit("error", { type: "WebSocketError", error: error });
  40536. },
  40537. closed: function (closeEvent) {
  40538. unbindListeners();
  40539. if (closeEvent && closeEvent.code) {
  40540. _this.handleCloseEvent(closeEvent);
  40541. }
  40542. _this.transport = null;
  40543. _this.emit("closed");
  40544. }
  40545. };
  40546. var unbindListeners = function () {
  40547. objectApply(listeners, function (listener, event) {
  40548. _this.transport.unbind(event, listener);
  40549. });
  40550. };
  40551. objectApply(listeners, function (listener, event) {
  40552. _this.transport.bind(event, listener);
  40553. });
  40554. };
  40555. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40556. var action = protocol_protocol.getCloseAction(closeEvent);
  40557. var error = protocol_protocol.getCloseError(closeEvent);
  40558. if (error) {
  40559. this.emit('error', error);
  40560. }
  40561. if (action) {
  40562. this.emit(action, { action: action, error: error });
  40563. }
  40564. };
  40565. return Connection;
  40566. }(dispatcher));
  40567. /* harmony default export */ var connection_connection = (connection_Connection);
  40568. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40569. var handshake_Handshake = (function () {
  40570. function Handshake(transport, callback) {
  40571. this.transport = transport;
  40572. this.callback = callback;
  40573. this.bindListeners();
  40574. }
  40575. Handshake.prototype.close = function () {
  40576. this.unbindListeners();
  40577. this.transport.close();
  40578. };
  40579. Handshake.prototype.bindListeners = function () {
  40580. var _this = this;
  40581. this.onMessage = function (m) {
  40582. _this.unbindListeners();
  40583. var result;
  40584. try {
  40585. result = protocol_protocol.processHandshake(m);
  40586. }
  40587. catch (e) {
  40588. _this.finish("error", { error: e });
  40589. _this.transport.close();
  40590. return;
  40591. }
  40592. if (result.action === "connected") {
  40593. _this.finish("connected", {
  40594. connection: new connection_connection(result.id, _this.transport),
  40595. activityTimeout: result.activityTimeout
  40596. });
  40597. }
  40598. else {
  40599. _this.finish(result.action, { error: result.error });
  40600. _this.transport.close();
  40601. }
  40602. };
  40603. this.onClosed = function (closeEvent) {
  40604. _this.unbindListeners();
  40605. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40606. var error = protocol_protocol.getCloseError(closeEvent);
  40607. _this.finish(action, { error: error });
  40608. };
  40609. this.transport.bind("message", this.onMessage);
  40610. this.transport.bind("closed", this.onClosed);
  40611. };
  40612. Handshake.prototype.unbindListeners = function () {
  40613. this.transport.unbind("message", this.onMessage);
  40614. this.transport.unbind("closed", this.onClosed);
  40615. };
  40616. Handshake.prototype.finish = function (action, params) {
  40617. this.callback(extend({ transport: this.transport, action: action }, params));
  40618. };
  40619. return Handshake;
  40620. }());
  40621. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40622. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40623. var pusher_authorizer_PusherAuthorizer = (function () {
  40624. function PusherAuthorizer(channel, options) {
  40625. this.channel = channel;
  40626. var authTransport = options.authTransport;
  40627. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40628. throw "'" + authTransport + "' is not a recognized auth transport";
  40629. }
  40630. this.type = authTransport;
  40631. this.options = options;
  40632. this.authOptions = (options || {}).auth || {};
  40633. }
  40634. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40635. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40636. '&channel_name=' + encodeURIComponent(this.channel.name);
  40637. for (var i in this.authOptions.params) {
  40638. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40639. }
  40640. return query;
  40641. };
  40642. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40643. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40644. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40645. };
  40646. return PusherAuthorizer;
  40647. }());
  40648. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40649. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40650. var timeline_sender_TimelineSender = (function () {
  40651. function TimelineSender(timeline, options) {
  40652. this.timeline = timeline;
  40653. this.options = options || {};
  40654. }
  40655. TimelineSender.prototype.send = function (useTLS, callback) {
  40656. if (this.timeline.isEmpty()) {
  40657. return;
  40658. }
  40659. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40660. };
  40661. return TimelineSender;
  40662. }());
  40663. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40664. // CONCATENATED MODULE: ./src/core/errors.ts
  40665. var errors_extends = (undefined && undefined.__extends) || (function () {
  40666. var extendStatics = function (d, b) {
  40667. extendStatics = Object.setPrototypeOf ||
  40668. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40669. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40670. return extendStatics(d, b);
  40671. };
  40672. return function (d, b) {
  40673. extendStatics(d, b);
  40674. function __() { this.constructor = d; }
  40675. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40676. };
  40677. })();
  40678. var BadEventName = (function (_super) {
  40679. errors_extends(BadEventName, _super);
  40680. function BadEventName(msg) {
  40681. var _newTarget = this.constructor;
  40682. var _this = _super.call(this, msg) || this;
  40683. Object.setPrototypeOf(_this, _newTarget.prototype);
  40684. return _this;
  40685. }
  40686. return BadEventName;
  40687. }(Error));
  40688. var RequestTimedOut = (function (_super) {
  40689. errors_extends(RequestTimedOut, _super);
  40690. function RequestTimedOut(msg) {
  40691. var _newTarget = this.constructor;
  40692. var _this = _super.call(this, msg) || this;
  40693. Object.setPrototypeOf(_this, _newTarget.prototype);
  40694. return _this;
  40695. }
  40696. return RequestTimedOut;
  40697. }(Error));
  40698. var TransportPriorityTooLow = (function (_super) {
  40699. errors_extends(TransportPriorityTooLow, _super);
  40700. function TransportPriorityTooLow(msg) {
  40701. var _newTarget = this.constructor;
  40702. var _this = _super.call(this, msg) || this;
  40703. Object.setPrototypeOf(_this, _newTarget.prototype);
  40704. return _this;
  40705. }
  40706. return TransportPriorityTooLow;
  40707. }(Error));
  40708. var TransportClosed = (function (_super) {
  40709. errors_extends(TransportClosed, _super);
  40710. function TransportClosed(msg) {
  40711. var _newTarget = this.constructor;
  40712. var _this = _super.call(this, msg) || this;
  40713. Object.setPrototypeOf(_this, _newTarget.prototype);
  40714. return _this;
  40715. }
  40716. return TransportClosed;
  40717. }(Error));
  40718. var UnsupportedFeature = (function (_super) {
  40719. errors_extends(UnsupportedFeature, _super);
  40720. function UnsupportedFeature(msg) {
  40721. var _newTarget = this.constructor;
  40722. var _this = _super.call(this, msg) || this;
  40723. Object.setPrototypeOf(_this, _newTarget.prototype);
  40724. return _this;
  40725. }
  40726. return UnsupportedFeature;
  40727. }(Error));
  40728. var UnsupportedTransport = (function (_super) {
  40729. errors_extends(UnsupportedTransport, _super);
  40730. function UnsupportedTransport(msg) {
  40731. var _newTarget = this.constructor;
  40732. var _this = _super.call(this, msg) || this;
  40733. Object.setPrototypeOf(_this, _newTarget.prototype);
  40734. return _this;
  40735. }
  40736. return UnsupportedTransport;
  40737. }(Error));
  40738. var UnsupportedStrategy = (function (_super) {
  40739. errors_extends(UnsupportedStrategy, _super);
  40740. function UnsupportedStrategy(msg) {
  40741. var _newTarget = this.constructor;
  40742. var _this = _super.call(this, msg) || this;
  40743. Object.setPrototypeOf(_this, _newTarget.prototype);
  40744. return _this;
  40745. }
  40746. return UnsupportedStrategy;
  40747. }(Error));
  40748. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40749. var channel_extends = (undefined && undefined.__extends) || (function () {
  40750. var extendStatics = function (d, b) {
  40751. extendStatics = Object.setPrototypeOf ||
  40752. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40753. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40754. return extendStatics(d, b);
  40755. };
  40756. return function (d, b) {
  40757. extendStatics(d, b);
  40758. function __() { this.constructor = d; }
  40759. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40760. };
  40761. })();
  40762. var channel_Channel = (function (_super) {
  40763. channel_extends(Channel, _super);
  40764. function Channel(name, pusher) {
  40765. var _this = _super.call(this, function (event, data) {
  40766. logger.debug('No callbacks on ' + name + ' for ' + event);
  40767. }) || this;
  40768. _this.name = name;
  40769. _this.pusher = pusher;
  40770. _this.subscribed = false;
  40771. _this.subscriptionPending = false;
  40772. _this.subscriptionCancelled = false;
  40773. return _this;
  40774. }
  40775. Channel.prototype.authorize = function (socketId, callback) {
  40776. return callback(false, {});
  40777. };
  40778. Channel.prototype.trigger = function (event, data) {
  40779. if (event.indexOf("client-") !== 0) {
  40780. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40781. }
  40782. if (!this.subscribed) {
  40783. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40784. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40785. }
  40786. return this.pusher.send_event(event, data, this.name);
  40787. };
  40788. Channel.prototype.disconnect = function () {
  40789. this.subscribed = false;
  40790. this.subscriptionPending = false;
  40791. };
  40792. Channel.prototype.handleEvent = function (event) {
  40793. var eventName = event.event;
  40794. var data = event.data;
  40795. if (eventName === "pusher_internal:subscription_succeeded") {
  40796. this.handleSubscriptionSucceededEvent(event);
  40797. }
  40798. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40799. var metadata = {};
  40800. this.emit(eventName, data, metadata);
  40801. }
  40802. };
  40803. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40804. this.subscriptionPending = false;
  40805. this.subscribed = true;
  40806. if (this.subscriptionCancelled) {
  40807. this.pusher.unsubscribe(this.name);
  40808. }
  40809. else {
  40810. this.emit("pusher:subscription_succeeded", event.data);
  40811. }
  40812. };
  40813. Channel.prototype.subscribe = function () {
  40814. var _this = this;
  40815. if (this.subscribed) {
  40816. return;
  40817. }
  40818. this.subscriptionPending = true;
  40819. this.subscriptionCancelled = false;
  40820. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40821. if (error) {
  40822. logger.error(data);
  40823. _this.emit('pusher:subscription_error', data);
  40824. }
  40825. else {
  40826. _this.pusher.send_event('pusher:subscribe', {
  40827. auth: data.auth,
  40828. channel_data: data.channel_data,
  40829. channel: _this.name
  40830. });
  40831. }
  40832. });
  40833. };
  40834. Channel.prototype.unsubscribe = function () {
  40835. this.subscribed = false;
  40836. this.pusher.send_event('pusher:unsubscribe', {
  40837. channel: this.name
  40838. });
  40839. };
  40840. Channel.prototype.cancelSubscription = function () {
  40841. this.subscriptionCancelled = true;
  40842. };
  40843. Channel.prototype.reinstateSubscription = function () {
  40844. this.subscriptionCancelled = false;
  40845. };
  40846. return Channel;
  40847. }(dispatcher));
  40848. /* harmony default export */ var channels_channel = (channel_Channel);
  40849. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40850. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40851. var extendStatics = function (d, b) {
  40852. extendStatics = Object.setPrototypeOf ||
  40853. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40854. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40855. return extendStatics(d, b);
  40856. };
  40857. return function (d, b) {
  40858. extendStatics(d, b);
  40859. function __() { this.constructor = d; }
  40860. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40861. };
  40862. })();
  40863. var private_channel_PrivateChannel = (function (_super) {
  40864. private_channel_extends(PrivateChannel, _super);
  40865. function PrivateChannel() {
  40866. return _super !== null && _super.apply(this, arguments) || this;
  40867. }
  40868. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40869. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40870. return authorizer.authorize(socketId, callback);
  40871. };
  40872. return PrivateChannel;
  40873. }(channels_channel));
  40874. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40875. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40876. var members_Members = (function () {
  40877. function Members() {
  40878. this.reset();
  40879. }
  40880. Members.prototype.get = function (id) {
  40881. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40882. return {
  40883. id: id,
  40884. info: this.members[id]
  40885. };
  40886. }
  40887. else {
  40888. return null;
  40889. }
  40890. };
  40891. Members.prototype.each = function (callback) {
  40892. var _this = this;
  40893. objectApply(this.members, function (member, id) {
  40894. callback(_this.get(id));
  40895. });
  40896. };
  40897. Members.prototype.setMyID = function (id) {
  40898. this.myID = id;
  40899. };
  40900. Members.prototype.onSubscription = function (subscriptionData) {
  40901. this.members = subscriptionData.presence.hash;
  40902. this.count = subscriptionData.presence.count;
  40903. this.me = this.get(this.myID);
  40904. };
  40905. Members.prototype.addMember = function (memberData) {
  40906. if (this.get(memberData.user_id) === null) {
  40907. this.count++;
  40908. }
  40909. this.members[memberData.user_id] = memberData.user_info;
  40910. return this.get(memberData.user_id);
  40911. };
  40912. Members.prototype.removeMember = function (memberData) {
  40913. var member = this.get(memberData.user_id);
  40914. if (member) {
  40915. delete this.members[memberData.user_id];
  40916. this.count--;
  40917. }
  40918. return member;
  40919. };
  40920. Members.prototype.reset = function () {
  40921. this.members = {};
  40922. this.count = 0;
  40923. this.myID = null;
  40924. this.me = null;
  40925. };
  40926. return Members;
  40927. }());
  40928. /* harmony default export */ var members = (members_Members);
  40929. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40930. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40931. var extendStatics = function (d, b) {
  40932. extendStatics = Object.setPrototypeOf ||
  40933. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40934. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40935. return extendStatics(d, b);
  40936. };
  40937. return function (d, b) {
  40938. extendStatics(d, b);
  40939. function __() { this.constructor = d; }
  40940. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40941. };
  40942. })();
  40943. var presence_channel_PresenceChannel = (function (_super) {
  40944. presence_channel_extends(PresenceChannel, _super);
  40945. function PresenceChannel(name, pusher) {
  40946. var _this = _super.call(this, name, pusher) || this;
  40947. _this.members = new members();
  40948. return _this;
  40949. }
  40950. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40951. var _this = this;
  40952. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40953. if (!error) {
  40954. if (authData.channel_data === undefined) {
  40955. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40956. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40957. ("expected 'channel_data' field. " + suffix));
  40958. callback("Invalid auth response");
  40959. return;
  40960. }
  40961. var channelData = JSON.parse(authData.channel_data);
  40962. _this.members.setMyID(channelData.user_id);
  40963. }
  40964. callback(error, authData);
  40965. });
  40966. };
  40967. PresenceChannel.prototype.handleEvent = function (event) {
  40968. var eventName = event.event;
  40969. if (eventName.indexOf("pusher_internal:") === 0) {
  40970. this.handleInternalEvent(event);
  40971. }
  40972. else {
  40973. var data = event.data;
  40974. var metadata = {};
  40975. if (event.user_id) {
  40976. metadata.user_id = event.user_id;
  40977. }
  40978. this.emit(eventName, data, metadata);
  40979. }
  40980. };
  40981. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40982. var eventName = event.event;
  40983. var data = event.data;
  40984. switch (eventName) {
  40985. case "pusher_internal:subscription_succeeded":
  40986. this.handleSubscriptionSucceededEvent(event);
  40987. break;
  40988. case "pusher_internal:member_added":
  40989. var addedMember = this.members.addMember(data);
  40990. this.emit('pusher:member_added', addedMember);
  40991. break;
  40992. case "pusher_internal:member_removed":
  40993. var removedMember = this.members.removeMember(data);
  40994. if (removedMember) {
  40995. this.emit('pusher:member_removed', removedMember);
  40996. }
  40997. break;
  40998. }
  40999. };
  41000. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41001. this.subscriptionPending = false;
  41002. this.subscribed = true;
  41003. if (this.subscriptionCancelled) {
  41004. this.pusher.unsubscribe(this.name);
  41005. }
  41006. else {
  41007. this.members.onSubscription(event.data);
  41008. this.emit("pusher:subscription_succeeded", this.members);
  41009. }
  41010. };
  41011. PresenceChannel.prototype.disconnect = function () {
  41012. this.members.reset();
  41013. _super.prototype.disconnect.call(this);
  41014. };
  41015. return PresenceChannel;
  41016. }(private_channel));
  41017. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41018. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41019. var nacl_fast = __webpack_require__(0);
  41020. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41021. var nacl_util = __webpack_require__(1);
  41022. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41023. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41024. var extendStatics = function (d, b) {
  41025. extendStatics = Object.setPrototypeOf ||
  41026. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41027. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41028. return extendStatics(d, b);
  41029. };
  41030. return function (d, b) {
  41031. extendStatics(d, b);
  41032. function __() { this.constructor = d; }
  41033. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41034. };
  41035. })();
  41036. var encrypted_channel_EncryptedChannel = (function (_super) {
  41037. encrypted_channel_extends(EncryptedChannel, _super);
  41038. function EncryptedChannel() {
  41039. var _this = _super !== null && _super.apply(this, arguments) || this;
  41040. _this.key = null;
  41041. return _this;
  41042. }
  41043. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41044. var _this = this;
  41045. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41046. if (error) {
  41047. callback(true, authData);
  41048. return;
  41049. }
  41050. var sharedSecret = authData["shared_secret"];
  41051. if (!sharedSecret) {
  41052. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41053. callback(true, errorMsg);
  41054. return;
  41055. }
  41056. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41057. delete authData["shared_secret"];
  41058. callback(false, authData);
  41059. });
  41060. };
  41061. EncryptedChannel.prototype.trigger = function (event, data) {
  41062. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41063. };
  41064. EncryptedChannel.prototype.handleEvent = function (event) {
  41065. var eventName = event.event;
  41066. var data = event.data;
  41067. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41068. _super.prototype.handleEvent.call(this, event);
  41069. return;
  41070. }
  41071. this.handleEncryptedEvent(eventName, data);
  41072. };
  41073. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41074. var _this = this;
  41075. if (!this.key) {
  41076. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41077. return;
  41078. }
  41079. if (!data.ciphertext || !data.nonce) {
  41080. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41081. return;
  41082. }
  41083. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41084. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41085. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41086. return;
  41087. }
  41088. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41089. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41090. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41091. return;
  41092. }
  41093. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41094. if (bytes === null) {
  41095. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41096. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41097. if (error) {
  41098. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41099. return;
  41100. }
  41101. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41102. if (bytes === null) {
  41103. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41104. return;
  41105. }
  41106. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41107. return;
  41108. });
  41109. return;
  41110. }
  41111. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41112. };
  41113. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41114. try {
  41115. this.emit(eventName, JSON.parse(data));
  41116. }
  41117. catch (e) {
  41118. this.emit(eventName, data);
  41119. }
  41120. return this;
  41121. };
  41122. return EncryptedChannel;
  41123. }(private_channel));
  41124. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41125. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41126. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41127. var extendStatics = function (d, b) {
  41128. extendStatics = Object.setPrototypeOf ||
  41129. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41130. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41131. return extendStatics(d, b);
  41132. };
  41133. return function (d, b) {
  41134. extendStatics(d, b);
  41135. function __() { this.constructor = d; }
  41136. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41137. };
  41138. })();
  41139. var connection_manager_ConnectionManager = (function (_super) {
  41140. connection_manager_extends(ConnectionManager, _super);
  41141. function ConnectionManager(key, options) {
  41142. var _this = _super.call(this) || this;
  41143. _this.key = key;
  41144. _this.options = options || {};
  41145. _this.state = "initialized";
  41146. _this.connection = null;
  41147. _this.usingTLS = !!options.useTLS;
  41148. _this.timeline = _this.options.timeline;
  41149. _this.errorCallbacks = _this.buildErrorCallbacks();
  41150. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41151. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41152. var Network = runtime.getNetwork();
  41153. Network.bind("online", function () {
  41154. _this.timeline.info({ netinfo: "online" });
  41155. if (_this.state === "connecting" || _this.state === "unavailable") {
  41156. _this.retryIn(0);
  41157. }
  41158. });
  41159. Network.bind("offline", function () {
  41160. _this.timeline.info({ netinfo: "offline" });
  41161. if (_this.connection) {
  41162. _this.sendActivityCheck();
  41163. }
  41164. });
  41165. _this.updateStrategy();
  41166. return _this;
  41167. }
  41168. ConnectionManager.prototype.connect = function () {
  41169. if (this.connection || this.runner) {
  41170. return;
  41171. }
  41172. if (!this.strategy.isSupported()) {
  41173. this.updateState("failed");
  41174. return;
  41175. }
  41176. this.updateState("connecting");
  41177. this.startConnecting();
  41178. this.setUnavailableTimer();
  41179. };
  41180. ;
  41181. ConnectionManager.prototype.send = function (data) {
  41182. if (this.connection) {
  41183. return this.connection.send(data);
  41184. }
  41185. else {
  41186. return false;
  41187. }
  41188. };
  41189. ;
  41190. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41191. if (this.connection) {
  41192. return this.connection.send_event(name, data, channel);
  41193. }
  41194. else {
  41195. return false;
  41196. }
  41197. };
  41198. ;
  41199. ConnectionManager.prototype.disconnect = function () {
  41200. this.disconnectInternally();
  41201. this.updateState("disconnected");
  41202. };
  41203. ;
  41204. ConnectionManager.prototype.isUsingTLS = function () {
  41205. return this.usingTLS;
  41206. };
  41207. ;
  41208. ConnectionManager.prototype.startConnecting = function () {
  41209. var _this = this;
  41210. var callback = function (error, handshake) {
  41211. if (error) {
  41212. _this.runner = _this.strategy.connect(0, callback);
  41213. }
  41214. else {
  41215. if (handshake.action === "error") {
  41216. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41217. _this.timeline.error({ handshakeError: handshake.error });
  41218. }
  41219. else {
  41220. _this.abortConnecting();
  41221. _this.handshakeCallbacks[handshake.action](handshake);
  41222. }
  41223. }
  41224. };
  41225. this.runner = this.strategy.connect(0, callback);
  41226. };
  41227. ;
  41228. ConnectionManager.prototype.abortConnecting = function () {
  41229. if (this.runner) {
  41230. this.runner.abort();
  41231. this.runner = null;
  41232. }
  41233. };
  41234. ;
  41235. ConnectionManager.prototype.disconnectInternally = function () {
  41236. this.abortConnecting();
  41237. this.clearRetryTimer();
  41238. this.clearUnavailableTimer();
  41239. if (this.connection) {
  41240. var connection = this.abandonConnection();
  41241. connection.close();
  41242. }
  41243. };
  41244. ;
  41245. ConnectionManager.prototype.updateStrategy = function () {
  41246. this.strategy = this.options.getStrategy({
  41247. key: this.key,
  41248. timeline: this.timeline,
  41249. useTLS: this.usingTLS
  41250. });
  41251. };
  41252. ;
  41253. ConnectionManager.prototype.retryIn = function (delay) {
  41254. var _this = this;
  41255. this.timeline.info({ action: "retry", delay: delay });
  41256. if (delay > 0) {
  41257. this.emit("connecting_in", Math.round(delay / 1000));
  41258. }
  41259. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41260. _this.disconnectInternally();
  41261. _this.connect();
  41262. });
  41263. };
  41264. ;
  41265. ConnectionManager.prototype.clearRetryTimer = function () {
  41266. if (this.retryTimer) {
  41267. this.retryTimer.ensureAborted();
  41268. this.retryTimer = null;
  41269. }
  41270. };
  41271. ;
  41272. ConnectionManager.prototype.setUnavailableTimer = function () {
  41273. var _this = this;
  41274. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41275. _this.updateState("unavailable");
  41276. });
  41277. };
  41278. ;
  41279. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41280. if (this.unavailableTimer) {
  41281. this.unavailableTimer.ensureAborted();
  41282. }
  41283. };
  41284. ;
  41285. ConnectionManager.prototype.sendActivityCheck = function () {
  41286. var _this = this;
  41287. this.stopActivityCheck();
  41288. this.connection.ping();
  41289. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41290. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41291. _this.retryIn(0);
  41292. });
  41293. };
  41294. ;
  41295. ConnectionManager.prototype.resetActivityCheck = function () {
  41296. var _this = this;
  41297. this.stopActivityCheck();
  41298. if (this.connection && !this.connection.handlesActivityChecks()) {
  41299. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41300. _this.sendActivityCheck();
  41301. });
  41302. }
  41303. };
  41304. ;
  41305. ConnectionManager.prototype.stopActivityCheck = function () {
  41306. if (this.activityTimer) {
  41307. this.activityTimer.ensureAborted();
  41308. }
  41309. };
  41310. ;
  41311. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41312. var _this = this;
  41313. return extend({}, errorCallbacks, {
  41314. message: function (message) {
  41315. _this.resetActivityCheck();
  41316. _this.emit('message', message);
  41317. },
  41318. ping: function () {
  41319. _this.send_event('pusher:pong', {});
  41320. },
  41321. activity: function () {
  41322. _this.resetActivityCheck();
  41323. },
  41324. error: function (error) {
  41325. _this.emit("error", { type: "WebSocketError", error: error });
  41326. },
  41327. closed: function () {
  41328. _this.abandonConnection();
  41329. if (_this.shouldRetry()) {
  41330. _this.retryIn(1000);
  41331. }
  41332. }
  41333. });
  41334. };
  41335. ;
  41336. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41337. var _this = this;
  41338. return extend({}, errorCallbacks, {
  41339. connected: function (handshake) {
  41340. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41341. _this.clearUnavailableTimer();
  41342. _this.setConnection(handshake.connection);
  41343. _this.socket_id = _this.connection.id;
  41344. _this.updateState("connected", { socket_id: _this.socket_id });
  41345. }
  41346. });
  41347. };
  41348. ;
  41349. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41350. var _this = this;
  41351. var withErrorEmitted = function (callback) {
  41352. return function (result) {
  41353. if (result.error) {
  41354. _this.emit("error", { type: "WebSocketError", error: result.error });
  41355. }
  41356. callback(result);
  41357. };
  41358. };
  41359. return {
  41360. tls_only: withErrorEmitted(function () {
  41361. _this.usingTLS = true;
  41362. _this.updateStrategy();
  41363. _this.retryIn(0);
  41364. }),
  41365. refused: withErrorEmitted(function () {
  41366. _this.disconnect();
  41367. }),
  41368. backoff: withErrorEmitted(function () {
  41369. _this.retryIn(1000);
  41370. }),
  41371. retry: withErrorEmitted(function () {
  41372. _this.retryIn(0);
  41373. })
  41374. };
  41375. };
  41376. ;
  41377. ConnectionManager.prototype.setConnection = function (connection) {
  41378. this.connection = connection;
  41379. for (var event in this.connectionCallbacks) {
  41380. this.connection.bind(event, this.connectionCallbacks[event]);
  41381. }
  41382. this.resetActivityCheck();
  41383. };
  41384. ;
  41385. ConnectionManager.prototype.abandonConnection = function () {
  41386. if (!this.connection) {
  41387. return;
  41388. }
  41389. this.stopActivityCheck();
  41390. for (var event in this.connectionCallbacks) {
  41391. this.connection.unbind(event, this.connectionCallbacks[event]);
  41392. }
  41393. var connection = this.connection;
  41394. this.connection = null;
  41395. return connection;
  41396. };
  41397. ConnectionManager.prototype.updateState = function (newState, data) {
  41398. var previousState = this.state;
  41399. this.state = newState;
  41400. if (previousState !== newState) {
  41401. var newStateDescription = newState;
  41402. if (newStateDescription === "connected") {
  41403. newStateDescription += " with new socket ID " + data.socket_id;
  41404. }
  41405. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41406. this.timeline.info({ state: newState, params: data });
  41407. this.emit('state_change', { previous: previousState, current: newState });
  41408. this.emit(newState, data);
  41409. }
  41410. };
  41411. ConnectionManager.prototype.shouldRetry = function () {
  41412. return this.state === "connecting" || this.state === "connected";
  41413. };
  41414. return ConnectionManager;
  41415. }(dispatcher));
  41416. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41417. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41418. var channels_Channels = (function () {
  41419. function Channels() {
  41420. this.channels = {};
  41421. }
  41422. Channels.prototype.add = function (name, pusher) {
  41423. if (!this.channels[name]) {
  41424. this.channels[name] = createChannel(name, pusher);
  41425. }
  41426. return this.channels[name];
  41427. };
  41428. Channels.prototype.all = function () {
  41429. return values(this.channels);
  41430. };
  41431. Channels.prototype.find = function (name) {
  41432. return this.channels[name];
  41433. };
  41434. Channels.prototype.remove = function (name) {
  41435. var channel = this.channels[name];
  41436. delete this.channels[name];
  41437. return channel;
  41438. };
  41439. Channels.prototype.disconnect = function () {
  41440. objectApply(this.channels, function (channel) {
  41441. channel.disconnect();
  41442. });
  41443. };
  41444. return Channels;
  41445. }());
  41446. /* harmony default export */ var channels = (channels_Channels);
  41447. function createChannel(name, pusher) {
  41448. if (name.indexOf('private-encrypted-') === 0) {
  41449. if (false) { var errorMsg; }
  41450. return factory.createEncryptedChannel(name, pusher);
  41451. }
  41452. else if (name.indexOf('private-') === 0) {
  41453. return factory.createPrivateChannel(name, pusher);
  41454. }
  41455. else if (name.indexOf('presence-') === 0) {
  41456. return factory.createPresenceChannel(name, pusher);
  41457. }
  41458. else {
  41459. return factory.createChannel(name, pusher);
  41460. }
  41461. }
  41462. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41463. var Factory = {
  41464. createChannels: function () {
  41465. return new channels();
  41466. },
  41467. createConnectionManager: function (key, options) {
  41468. return new connection_manager(key, options);
  41469. },
  41470. createChannel: function (name, pusher) {
  41471. return new channels_channel(name, pusher);
  41472. },
  41473. createPrivateChannel: function (name, pusher) {
  41474. return new private_channel(name, pusher);
  41475. },
  41476. createPresenceChannel: function (name, pusher) {
  41477. return new presence_channel(name, pusher);
  41478. },
  41479. createEncryptedChannel: function (name, pusher) {
  41480. return new encrypted_channel(name, pusher);
  41481. },
  41482. createTimelineSender: function (timeline, options) {
  41483. return new timeline_sender(timeline, options);
  41484. },
  41485. createAuthorizer: function (channel, options) {
  41486. if (options.authorizer) {
  41487. return options.authorizer(channel, options);
  41488. }
  41489. return new pusher_authorizer(channel, options);
  41490. },
  41491. createHandshake: function (transport, callback) {
  41492. return new connection_handshake(transport, callback);
  41493. },
  41494. createAssistantToTheTransportManager: function (manager, transport, options) {
  41495. return new assistant_to_the_transport_manager(manager, transport, options);
  41496. }
  41497. };
  41498. /* harmony default export */ var factory = (Factory);
  41499. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41500. var transport_manager_TransportManager = (function () {
  41501. function TransportManager(options) {
  41502. this.options = options || {};
  41503. this.livesLeft = this.options.lives || Infinity;
  41504. }
  41505. TransportManager.prototype.getAssistant = function (transport) {
  41506. return factory.createAssistantToTheTransportManager(this, transport, {
  41507. minPingDelay: this.options.minPingDelay,
  41508. maxPingDelay: this.options.maxPingDelay
  41509. });
  41510. };
  41511. TransportManager.prototype.isAlive = function () {
  41512. return this.livesLeft > 0;
  41513. };
  41514. TransportManager.prototype.reportDeath = function () {
  41515. this.livesLeft -= 1;
  41516. };
  41517. return TransportManager;
  41518. }());
  41519. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41520. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41521. var sequential_strategy_SequentialStrategy = (function () {
  41522. function SequentialStrategy(strategies, options) {
  41523. this.strategies = strategies;
  41524. this.loop = Boolean(options.loop);
  41525. this.failFast = Boolean(options.failFast);
  41526. this.timeout = options.timeout;
  41527. this.timeoutLimit = options.timeoutLimit;
  41528. }
  41529. SequentialStrategy.prototype.isSupported = function () {
  41530. return any(this.strategies, util.method("isSupported"));
  41531. };
  41532. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41533. var _this = this;
  41534. var strategies = this.strategies;
  41535. var current = 0;
  41536. var timeout = this.timeout;
  41537. var runner = null;
  41538. var tryNextStrategy = function (error, handshake) {
  41539. if (handshake) {
  41540. callback(null, handshake);
  41541. }
  41542. else {
  41543. current = current + 1;
  41544. if (_this.loop) {
  41545. current = current % strategies.length;
  41546. }
  41547. if (current < strategies.length) {
  41548. if (timeout) {
  41549. timeout = timeout * 2;
  41550. if (_this.timeoutLimit) {
  41551. timeout = Math.min(timeout, _this.timeoutLimit);
  41552. }
  41553. }
  41554. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41555. }
  41556. else {
  41557. callback(true);
  41558. }
  41559. }
  41560. };
  41561. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41562. return {
  41563. abort: function () {
  41564. runner.abort();
  41565. },
  41566. forceMinPriority: function (p) {
  41567. minPriority = p;
  41568. if (runner) {
  41569. runner.forceMinPriority(p);
  41570. }
  41571. }
  41572. };
  41573. };
  41574. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41575. var timer = null;
  41576. var runner = null;
  41577. if (options.timeout > 0) {
  41578. timer = new OneOffTimer(options.timeout, function () {
  41579. runner.abort();
  41580. callback(true);
  41581. });
  41582. }
  41583. runner = strategy.connect(minPriority, function (error, handshake) {
  41584. if (error && timer && timer.isRunning() && !options.failFast) {
  41585. return;
  41586. }
  41587. if (timer) {
  41588. timer.ensureAborted();
  41589. }
  41590. callback(error, handshake);
  41591. });
  41592. return {
  41593. abort: function () {
  41594. if (timer) {
  41595. timer.ensureAborted();
  41596. }
  41597. runner.abort();
  41598. },
  41599. forceMinPriority: function (p) {
  41600. runner.forceMinPriority(p);
  41601. }
  41602. };
  41603. };
  41604. return SequentialStrategy;
  41605. }());
  41606. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41607. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41608. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41609. function BestConnectedEverStrategy(strategies) {
  41610. this.strategies = strategies;
  41611. }
  41612. BestConnectedEverStrategy.prototype.isSupported = function () {
  41613. return any(this.strategies, util.method("isSupported"));
  41614. };
  41615. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41616. return connect(this.strategies, minPriority, function (i, runners) {
  41617. return function (error, handshake) {
  41618. runners[i].error = error;
  41619. if (error) {
  41620. if (allRunnersFailed(runners)) {
  41621. callback(true);
  41622. }
  41623. return;
  41624. }
  41625. apply(runners, function (runner) {
  41626. runner.forceMinPriority(handshake.transport.priority);
  41627. });
  41628. callback(null, handshake);
  41629. };
  41630. });
  41631. };
  41632. return BestConnectedEverStrategy;
  41633. }());
  41634. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41635. function connect(strategies, minPriority, callbackBuilder) {
  41636. var runners = map(strategies, function (strategy, i, _, rs) {
  41637. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41638. });
  41639. return {
  41640. abort: function () {
  41641. apply(runners, abortRunner);
  41642. },
  41643. forceMinPriority: function (p) {
  41644. apply(runners, function (runner) {
  41645. runner.forceMinPriority(p);
  41646. });
  41647. }
  41648. };
  41649. }
  41650. function allRunnersFailed(runners) {
  41651. return collections_all(runners, function (runner) {
  41652. return Boolean(runner.error);
  41653. });
  41654. }
  41655. function abortRunner(runner) {
  41656. if (!runner.error && !runner.aborted) {
  41657. runner.abort();
  41658. runner.aborted = true;
  41659. }
  41660. }
  41661. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41662. var cached_strategy_CachedStrategy = (function () {
  41663. function CachedStrategy(strategy, transports, options) {
  41664. this.strategy = strategy;
  41665. this.transports = transports;
  41666. this.ttl = options.ttl || 1800 * 1000;
  41667. this.usingTLS = options.useTLS;
  41668. this.timeline = options.timeline;
  41669. }
  41670. CachedStrategy.prototype.isSupported = function () {
  41671. return this.strategy.isSupported();
  41672. };
  41673. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41674. var usingTLS = this.usingTLS;
  41675. var info = fetchTransportCache(usingTLS);
  41676. var strategies = [this.strategy];
  41677. if (info && info.timestamp + this.ttl >= util.now()) {
  41678. var transport = this.transports[info.transport];
  41679. if (transport) {
  41680. this.timeline.info({
  41681. cached: true,
  41682. transport: info.transport,
  41683. latency: info.latency
  41684. });
  41685. strategies.push(new sequential_strategy([transport], {
  41686. timeout: info.latency * 2 + 1000,
  41687. failFast: true
  41688. }));
  41689. }
  41690. }
  41691. var startTimestamp = util.now();
  41692. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41693. if (error) {
  41694. flushTransportCache(usingTLS);
  41695. if (strategies.length > 0) {
  41696. startTimestamp = util.now();
  41697. runner = strategies.pop().connect(minPriority, cb);
  41698. }
  41699. else {
  41700. callback(error);
  41701. }
  41702. }
  41703. else {
  41704. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41705. callback(null, handshake);
  41706. }
  41707. });
  41708. return {
  41709. abort: function () {
  41710. runner.abort();
  41711. },
  41712. forceMinPriority: function (p) {
  41713. minPriority = p;
  41714. if (runner) {
  41715. runner.forceMinPriority(p);
  41716. }
  41717. }
  41718. };
  41719. };
  41720. return CachedStrategy;
  41721. }());
  41722. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41723. function getTransportCacheKey(usingTLS) {
  41724. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41725. }
  41726. function fetchTransportCache(usingTLS) {
  41727. var storage = runtime.getLocalStorage();
  41728. if (storage) {
  41729. try {
  41730. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41731. if (serializedCache) {
  41732. return JSON.parse(serializedCache);
  41733. }
  41734. }
  41735. catch (e) {
  41736. flushTransportCache(usingTLS);
  41737. }
  41738. }
  41739. return null;
  41740. }
  41741. function storeTransportCache(usingTLS, transport, latency) {
  41742. var storage = runtime.getLocalStorage();
  41743. if (storage) {
  41744. try {
  41745. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41746. timestamp: util.now(),
  41747. transport: transport,
  41748. latency: latency
  41749. });
  41750. }
  41751. catch (e) {
  41752. }
  41753. }
  41754. }
  41755. function flushTransportCache(usingTLS) {
  41756. var storage = runtime.getLocalStorage();
  41757. if (storage) {
  41758. try {
  41759. delete storage[getTransportCacheKey(usingTLS)];
  41760. }
  41761. catch (e) {
  41762. }
  41763. }
  41764. }
  41765. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41766. var delayed_strategy_DelayedStrategy = (function () {
  41767. function DelayedStrategy(strategy, _a) {
  41768. var number = _a.delay;
  41769. this.strategy = strategy;
  41770. this.options = { delay: number };
  41771. }
  41772. DelayedStrategy.prototype.isSupported = function () {
  41773. return this.strategy.isSupported();
  41774. };
  41775. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41776. var strategy = this.strategy;
  41777. var runner;
  41778. var timer = new OneOffTimer(this.options.delay, function () {
  41779. runner = strategy.connect(minPriority, callback);
  41780. });
  41781. return {
  41782. abort: function () {
  41783. timer.ensureAborted();
  41784. if (runner) {
  41785. runner.abort();
  41786. }
  41787. },
  41788. forceMinPriority: function (p) {
  41789. minPriority = p;
  41790. if (runner) {
  41791. runner.forceMinPriority(p);
  41792. }
  41793. }
  41794. };
  41795. };
  41796. return DelayedStrategy;
  41797. }());
  41798. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41799. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41800. var IfStrategy = (function () {
  41801. function IfStrategy(test, trueBranch, falseBranch) {
  41802. this.test = test;
  41803. this.trueBranch = trueBranch;
  41804. this.falseBranch = falseBranch;
  41805. }
  41806. IfStrategy.prototype.isSupported = function () {
  41807. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41808. return branch.isSupported();
  41809. };
  41810. IfStrategy.prototype.connect = function (minPriority, callback) {
  41811. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41812. return branch.connect(minPriority, callback);
  41813. };
  41814. return IfStrategy;
  41815. }());
  41816. /* harmony default export */ var if_strategy = (IfStrategy);
  41817. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41818. var FirstConnectedStrategy = (function () {
  41819. function FirstConnectedStrategy(strategy) {
  41820. this.strategy = strategy;
  41821. }
  41822. FirstConnectedStrategy.prototype.isSupported = function () {
  41823. return this.strategy.isSupported();
  41824. };
  41825. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41826. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41827. if (handshake) {
  41828. runner.abort();
  41829. }
  41830. callback(error, handshake);
  41831. });
  41832. return runner;
  41833. };
  41834. return FirstConnectedStrategy;
  41835. }());
  41836. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41837. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41838. function testSupportsStrategy(strategy) {
  41839. return function () {
  41840. return strategy.isSupported();
  41841. };
  41842. }
  41843. var getDefaultStrategy = function (config, defineTransport) {
  41844. var definedTransports = {};
  41845. function defineTransportStrategy(name, type, priority, options, manager) {
  41846. var transport = defineTransport(config, name, type, priority, options, manager);
  41847. definedTransports[name] = transport;
  41848. return transport;
  41849. }
  41850. var ws_options = {
  41851. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41852. hostTLS: config.wsHost + ":" + config.wssPort,
  41853. httpPath: config.wsPath
  41854. };
  41855. var wss_options = extend({}, ws_options, {
  41856. useTLS: true
  41857. });
  41858. var sockjs_options = {
  41859. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41860. hostTLS: config.httpHost + ":" + config.httpsPort,
  41861. httpPath: config.httpPath
  41862. };
  41863. var timeouts = {
  41864. loop: true,
  41865. timeout: 15000,
  41866. timeoutLimit: 60000
  41867. };
  41868. var ws_manager = new transport_manager({
  41869. lives: 2,
  41870. minPingDelay: 10000,
  41871. maxPingDelay: config.activity_timeout
  41872. });
  41873. var streaming_manager = new transport_manager({
  41874. lives: 2,
  41875. minPingDelay: 10000,
  41876. maxPingDelay: config.activity_timeout
  41877. });
  41878. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41879. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41880. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41881. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41882. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41883. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41884. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41885. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41886. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41887. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41888. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41889. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41890. 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);
  41891. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41892. var wsStrategy;
  41893. if (config.useTLS) {
  41894. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41895. }
  41896. else {
  41897. wsStrategy = new best_connected_ever_strategy([
  41898. ws_loop,
  41899. new delayed_strategy(wss_loop, { delay: 2000 }),
  41900. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41901. ]);
  41902. }
  41903. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41904. ttl: 1800000,
  41905. timeline: config.timeline,
  41906. useTLS: config.useTLS
  41907. });
  41908. };
  41909. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41910. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41911. /* harmony default export */ var transport_connection_initializer = (function () {
  41912. var self = this;
  41913. self.timeline.info(self.buildTimelineMessage({
  41914. transport: self.name + (self.options.useTLS ? "s" : "")
  41915. }));
  41916. if (self.hooks.isInitialized()) {
  41917. self.changeState("initialized");
  41918. }
  41919. else if (self.hooks.file) {
  41920. self.changeState("initializing");
  41921. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41922. if (self.hooks.isInitialized()) {
  41923. self.changeState("initialized");
  41924. callback(true);
  41925. }
  41926. else {
  41927. if (error) {
  41928. self.onError(error);
  41929. }
  41930. self.onClose();
  41931. callback(false);
  41932. }
  41933. });
  41934. }
  41935. else {
  41936. self.onClose();
  41937. }
  41938. });
  41939. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41940. var http_xdomain_request_hooks = {
  41941. getRequest: function (socket) {
  41942. var xdr = new window.XDomainRequest();
  41943. xdr.ontimeout = function () {
  41944. socket.emit("error", new RequestTimedOut());
  41945. socket.close();
  41946. };
  41947. xdr.onerror = function (e) {
  41948. socket.emit("error", e);
  41949. socket.close();
  41950. };
  41951. xdr.onprogress = function () {
  41952. if (xdr.responseText && xdr.responseText.length > 0) {
  41953. socket.onChunk(200, xdr.responseText);
  41954. }
  41955. };
  41956. xdr.onload = function () {
  41957. if (xdr.responseText && xdr.responseText.length > 0) {
  41958. socket.onChunk(200, xdr.responseText);
  41959. }
  41960. socket.emit("finished", 200);
  41961. socket.close();
  41962. };
  41963. return xdr;
  41964. },
  41965. abortRequest: function (xdr) {
  41966. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41967. xdr.abort();
  41968. }
  41969. };
  41970. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41971. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41972. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41973. var extendStatics = function (d, b) {
  41974. extendStatics = Object.setPrototypeOf ||
  41975. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41976. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41977. return extendStatics(d, b);
  41978. };
  41979. return function (d, b) {
  41980. extendStatics(d, b);
  41981. function __() { this.constructor = d; }
  41982. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41983. };
  41984. })();
  41985. var MAX_BUFFER_LENGTH = 256 * 1024;
  41986. var http_request_HTTPRequest = (function (_super) {
  41987. http_request_extends(HTTPRequest, _super);
  41988. function HTTPRequest(hooks, method, url) {
  41989. var _this = _super.call(this) || this;
  41990. _this.hooks = hooks;
  41991. _this.method = method;
  41992. _this.url = url;
  41993. return _this;
  41994. }
  41995. HTTPRequest.prototype.start = function (payload) {
  41996. var _this = this;
  41997. this.position = 0;
  41998. this.xhr = this.hooks.getRequest(this);
  41999. this.unloader = function () {
  42000. _this.close();
  42001. };
  42002. runtime.addUnloadListener(this.unloader);
  42003. this.xhr.open(this.method, this.url, true);
  42004. if (this.xhr.setRequestHeader) {
  42005. this.xhr.setRequestHeader("Content-Type", "application/json");
  42006. }
  42007. this.xhr.send(payload);
  42008. };
  42009. HTTPRequest.prototype.close = function () {
  42010. if (this.unloader) {
  42011. runtime.removeUnloadListener(this.unloader);
  42012. this.unloader = null;
  42013. }
  42014. if (this.xhr) {
  42015. this.hooks.abortRequest(this.xhr);
  42016. this.xhr = null;
  42017. }
  42018. };
  42019. HTTPRequest.prototype.onChunk = function (status, data) {
  42020. while (true) {
  42021. var chunk = this.advanceBuffer(data);
  42022. if (chunk) {
  42023. this.emit("chunk", { status: status, data: chunk });
  42024. }
  42025. else {
  42026. break;
  42027. }
  42028. }
  42029. if (this.isBufferTooLong(data)) {
  42030. this.emit("buffer_too_long");
  42031. }
  42032. };
  42033. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42034. var unreadData = buffer.slice(this.position);
  42035. var endOfLinePosition = unreadData.indexOf("\n");
  42036. if (endOfLinePosition !== -1) {
  42037. this.position += endOfLinePosition + 1;
  42038. return unreadData.slice(0, endOfLinePosition);
  42039. }
  42040. else {
  42041. return null;
  42042. }
  42043. };
  42044. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42045. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42046. };
  42047. return HTTPRequest;
  42048. }(dispatcher));
  42049. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42050. // CONCATENATED MODULE: ./src/core/http/state.ts
  42051. var State;
  42052. (function (State) {
  42053. State[State["CONNECTING"] = 0] = "CONNECTING";
  42054. State[State["OPEN"] = 1] = "OPEN";
  42055. State[State["CLOSED"] = 3] = "CLOSED";
  42056. })(State || (State = {}));
  42057. /* harmony default export */ var state = (State);
  42058. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42059. var autoIncrement = 1;
  42060. var http_socket_HTTPSocket = (function () {
  42061. function HTTPSocket(hooks, url) {
  42062. this.hooks = hooks;
  42063. this.session = randomNumber(1000) + "/" + randomString(8);
  42064. this.location = getLocation(url);
  42065. this.readyState = state.CONNECTING;
  42066. this.openStream();
  42067. }
  42068. HTTPSocket.prototype.send = function (payload) {
  42069. return this.sendRaw(JSON.stringify([payload]));
  42070. };
  42071. HTTPSocket.prototype.ping = function () {
  42072. this.hooks.sendHeartbeat(this);
  42073. };
  42074. HTTPSocket.prototype.close = function (code, reason) {
  42075. this.onClose(code, reason, true);
  42076. };
  42077. HTTPSocket.prototype.sendRaw = function (payload) {
  42078. if (this.readyState === state.OPEN) {
  42079. try {
  42080. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42081. return true;
  42082. }
  42083. catch (e) {
  42084. return false;
  42085. }
  42086. }
  42087. else {
  42088. return false;
  42089. }
  42090. };
  42091. HTTPSocket.prototype.reconnect = function () {
  42092. this.closeStream();
  42093. this.openStream();
  42094. };
  42095. ;
  42096. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42097. this.closeStream();
  42098. this.readyState = state.CLOSED;
  42099. if (this.onclose) {
  42100. this.onclose({
  42101. code: code,
  42102. reason: reason,
  42103. wasClean: wasClean
  42104. });
  42105. }
  42106. };
  42107. HTTPSocket.prototype.onChunk = function (chunk) {
  42108. if (chunk.status !== 200) {
  42109. return;
  42110. }
  42111. if (this.readyState === state.OPEN) {
  42112. this.onActivity();
  42113. }
  42114. var payload;
  42115. var type = chunk.data.slice(0, 1);
  42116. switch (type) {
  42117. case 'o':
  42118. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42119. this.onOpen(payload);
  42120. break;
  42121. case 'a':
  42122. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42123. for (var i = 0; i < payload.length; i++) {
  42124. this.onEvent(payload[i]);
  42125. }
  42126. break;
  42127. case 'm':
  42128. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42129. this.onEvent(payload);
  42130. break;
  42131. case 'h':
  42132. this.hooks.onHeartbeat(this);
  42133. break;
  42134. case 'c':
  42135. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42136. this.onClose(payload[0], payload[1], true);
  42137. break;
  42138. }
  42139. };
  42140. HTTPSocket.prototype.onOpen = function (options) {
  42141. if (this.readyState === state.CONNECTING) {
  42142. if (options && options.hostname) {
  42143. this.location.base = replaceHost(this.location.base, options.hostname);
  42144. }
  42145. this.readyState = state.OPEN;
  42146. if (this.onopen) {
  42147. this.onopen();
  42148. }
  42149. }
  42150. else {
  42151. this.onClose(1006, "Server lost session", true);
  42152. }
  42153. };
  42154. HTTPSocket.prototype.onEvent = function (event) {
  42155. if (this.readyState === state.OPEN && this.onmessage) {
  42156. this.onmessage({ data: event });
  42157. }
  42158. };
  42159. HTTPSocket.prototype.onActivity = function () {
  42160. if (this.onactivity) {
  42161. this.onactivity();
  42162. }
  42163. };
  42164. HTTPSocket.prototype.onError = function (error) {
  42165. if (this.onerror) {
  42166. this.onerror(error);
  42167. }
  42168. };
  42169. HTTPSocket.prototype.openStream = function () {
  42170. var _this = this;
  42171. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42172. this.stream.bind("chunk", function (chunk) {
  42173. _this.onChunk(chunk);
  42174. });
  42175. this.stream.bind("finished", function (status) {
  42176. _this.hooks.onFinished(_this, status);
  42177. });
  42178. this.stream.bind("buffer_too_long", function () {
  42179. _this.reconnect();
  42180. });
  42181. try {
  42182. this.stream.start();
  42183. }
  42184. catch (error) {
  42185. util.defer(function () {
  42186. _this.onError(error);
  42187. _this.onClose(1006, "Could not start streaming", false);
  42188. });
  42189. }
  42190. };
  42191. HTTPSocket.prototype.closeStream = function () {
  42192. if (this.stream) {
  42193. this.stream.unbind_all();
  42194. this.stream.close();
  42195. this.stream = null;
  42196. }
  42197. };
  42198. return HTTPSocket;
  42199. }());
  42200. function getLocation(url) {
  42201. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42202. return {
  42203. base: parts[1],
  42204. queryString: parts[2]
  42205. };
  42206. }
  42207. function getSendURL(url, session) {
  42208. return url.base + "/" + session + "/xhr_send";
  42209. }
  42210. function getUniqueURL(url) {
  42211. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42212. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42213. }
  42214. function replaceHost(url, hostname) {
  42215. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42216. return urlParts[1] + hostname + urlParts[3];
  42217. }
  42218. function randomNumber(max) {
  42219. return Math.floor(Math.random() * max);
  42220. }
  42221. function randomString(length) {
  42222. var result = [];
  42223. for (var i = 0; i < length; i++) {
  42224. result.push(randomNumber(32).toString(32));
  42225. }
  42226. return result.join('');
  42227. }
  42228. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42229. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42230. var http_streaming_socket_hooks = {
  42231. getReceiveURL: function (url, session) {
  42232. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42233. },
  42234. onHeartbeat: function (socket) {
  42235. socket.sendRaw("[]");
  42236. },
  42237. sendHeartbeat: function (socket) {
  42238. socket.sendRaw("[]");
  42239. },
  42240. onFinished: function (socket, status) {
  42241. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42242. }
  42243. };
  42244. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42245. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42246. var http_polling_socket_hooks = {
  42247. getReceiveURL: function (url, session) {
  42248. return url.base + "/" + session + "/xhr" + url.queryString;
  42249. },
  42250. onHeartbeat: function () {
  42251. },
  42252. sendHeartbeat: function (socket) {
  42253. socket.sendRaw("[]");
  42254. },
  42255. onFinished: function (socket, status) {
  42256. if (status === 200) {
  42257. socket.reconnect();
  42258. }
  42259. else {
  42260. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42261. }
  42262. }
  42263. };
  42264. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42265. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42266. var http_xhr_request_hooks = {
  42267. getRequest: function (socket) {
  42268. var Constructor = runtime.getXHRAPI();
  42269. var xhr = new Constructor();
  42270. xhr.onreadystatechange = xhr.onprogress = function () {
  42271. switch (xhr.readyState) {
  42272. case 3:
  42273. if (xhr.responseText && xhr.responseText.length > 0) {
  42274. socket.onChunk(xhr.status, xhr.responseText);
  42275. }
  42276. break;
  42277. case 4:
  42278. if (xhr.responseText && xhr.responseText.length > 0) {
  42279. socket.onChunk(xhr.status, xhr.responseText);
  42280. }
  42281. socket.emit("finished", xhr.status);
  42282. socket.close();
  42283. break;
  42284. }
  42285. };
  42286. return xhr;
  42287. },
  42288. abortRequest: function (xhr) {
  42289. xhr.onreadystatechange = null;
  42290. xhr.abort();
  42291. }
  42292. };
  42293. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42294. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42295. var HTTP = {
  42296. createStreamingSocket: function (url) {
  42297. return this.createSocket(http_streaming_socket, url);
  42298. },
  42299. createPollingSocket: function (url) {
  42300. return this.createSocket(http_polling_socket, url);
  42301. },
  42302. createSocket: function (hooks, url) {
  42303. return new http_socket(hooks, url);
  42304. },
  42305. createXHR: function (method, url) {
  42306. return this.createRequest(http_xhr_request, method, url);
  42307. },
  42308. createRequest: function (hooks, method, url) {
  42309. return new http_request(hooks, method, url);
  42310. }
  42311. };
  42312. /* harmony default export */ var http_http = (HTTP);
  42313. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42314. http_http.createXDR = function (method, url) {
  42315. return this.createRequest(http_xdomain_request, method, url);
  42316. };
  42317. /* harmony default export */ var web_http_http = (http_http);
  42318. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42319. var Runtime = {
  42320. nextAuthCallbackID: 1,
  42321. auth_callbacks: {},
  42322. ScriptReceivers: ScriptReceivers,
  42323. DependenciesReceivers: DependenciesReceivers,
  42324. getDefaultStrategy: default_strategy,
  42325. Transports: transports_transports,
  42326. transportConnectionInitializer: transport_connection_initializer,
  42327. HTTPFactory: web_http_http,
  42328. TimelineTransport: jsonp_timeline,
  42329. getXHRAPI: function () {
  42330. return window.XMLHttpRequest;
  42331. },
  42332. getWebSocketAPI: function () {
  42333. return window.WebSocket || window.MozWebSocket;
  42334. },
  42335. setup: function (PusherClass) {
  42336. var _this = this;
  42337. window.Pusher = PusherClass;
  42338. var initializeOnDocumentBody = function () {
  42339. _this.onDocumentBody(PusherClass.ready);
  42340. };
  42341. if (!window.JSON) {
  42342. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42343. }
  42344. else {
  42345. initializeOnDocumentBody();
  42346. }
  42347. },
  42348. getDocument: function () {
  42349. return document;
  42350. },
  42351. getProtocol: function () {
  42352. return this.getDocument().location.protocol;
  42353. },
  42354. getAuthorizers: function () {
  42355. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42356. },
  42357. onDocumentBody: function (callback) {
  42358. var _this = this;
  42359. if (document.body) {
  42360. callback();
  42361. }
  42362. else {
  42363. setTimeout(function () {
  42364. _this.onDocumentBody(callback);
  42365. }, 0);
  42366. }
  42367. },
  42368. createJSONPRequest: function (url, data) {
  42369. return new jsonp_request(url, data);
  42370. },
  42371. createScriptRequest: function (src) {
  42372. return new script_request(src);
  42373. },
  42374. getLocalStorage: function () {
  42375. try {
  42376. return window.localStorage;
  42377. }
  42378. catch (e) {
  42379. return undefined;
  42380. }
  42381. },
  42382. createXHR: function () {
  42383. if (this.getXHRAPI()) {
  42384. return this.createXMLHttpRequest();
  42385. }
  42386. else {
  42387. return this.createMicrosoftXHR();
  42388. }
  42389. },
  42390. createXMLHttpRequest: function () {
  42391. var Constructor = this.getXHRAPI();
  42392. return new Constructor();
  42393. },
  42394. createMicrosoftXHR: function () {
  42395. return new ActiveXObject("Microsoft.XMLHTTP");
  42396. },
  42397. getNetwork: function () {
  42398. return net_info_Network;
  42399. },
  42400. createWebSocket: function (url) {
  42401. var Constructor = this.getWebSocketAPI();
  42402. return new Constructor(url);
  42403. },
  42404. createSocketRequest: function (method, url) {
  42405. if (this.isXHRSupported()) {
  42406. return this.HTTPFactory.createXHR(method, url);
  42407. }
  42408. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42409. return this.HTTPFactory.createXDR(method, url);
  42410. }
  42411. else {
  42412. throw "Cross-origin HTTP requests are not supported";
  42413. }
  42414. },
  42415. isXHRSupported: function () {
  42416. var Constructor = this.getXHRAPI();
  42417. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42418. },
  42419. isXDRSupported: function (useTLS) {
  42420. var protocol = useTLS ? "https:" : "http:";
  42421. var documentProtocol = this.getProtocol();
  42422. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42423. },
  42424. addUnloadListener: function (listener) {
  42425. if (window.addEventListener !== undefined) {
  42426. window.addEventListener("unload", listener, false);
  42427. }
  42428. else if (window.attachEvent !== undefined) {
  42429. window.attachEvent("onunload", listener);
  42430. }
  42431. },
  42432. removeUnloadListener: function (listener) {
  42433. if (window.addEventListener !== undefined) {
  42434. window.removeEventListener("unload", listener, false);
  42435. }
  42436. else if (window.detachEvent !== undefined) {
  42437. window.detachEvent("onunload", listener);
  42438. }
  42439. }
  42440. };
  42441. /* harmony default export */ var runtime = (Runtime);
  42442. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42443. var TimelineLevel;
  42444. (function (TimelineLevel) {
  42445. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42446. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42447. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42448. })(TimelineLevel || (TimelineLevel = {}));
  42449. /* harmony default export */ var timeline_level = (TimelineLevel);
  42450. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42451. var timeline_Timeline = (function () {
  42452. function Timeline(key, session, options) {
  42453. this.key = key;
  42454. this.session = session;
  42455. this.events = [];
  42456. this.options = options || {};
  42457. this.sent = 0;
  42458. this.uniqueID = 0;
  42459. }
  42460. Timeline.prototype.log = function (level, event) {
  42461. if (level <= this.options.level) {
  42462. this.events.push(extend({}, event, { timestamp: util.now() }));
  42463. if (this.options.limit && this.events.length > this.options.limit) {
  42464. this.events.shift();
  42465. }
  42466. }
  42467. };
  42468. Timeline.prototype.error = function (event) {
  42469. this.log(timeline_level.ERROR, event);
  42470. };
  42471. Timeline.prototype.info = function (event) {
  42472. this.log(timeline_level.INFO, event);
  42473. };
  42474. Timeline.prototype.debug = function (event) {
  42475. this.log(timeline_level.DEBUG, event);
  42476. };
  42477. Timeline.prototype.isEmpty = function () {
  42478. return this.events.length === 0;
  42479. };
  42480. Timeline.prototype.send = function (sendfn, callback) {
  42481. var _this = this;
  42482. var data = extend({
  42483. session: this.session,
  42484. bundle: this.sent + 1,
  42485. key: this.key,
  42486. lib: "js",
  42487. version: this.options.version,
  42488. cluster: this.options.cluster,
  42489. features: this.options.features,
  42490. timeline: this.events
  42491. }, this.options.params);
  42492. this.events = [];
  42493. sendfn(data, function (error, result) {
  42494. if (!error) {
  42495. _this.sent++;
  42496. }
  42497. if (callback) {
  42498. callback(error, result);
  42499. }
  42500. });
  42501. return true;
  42502. };
  42503. Timeline.prototype.generateUniqueID = function () {
  42504. this.uniqueID++;
  42505. return this.uniqueID;
  42506. };
  42507. return Timeline;
  42508. }());
  42509. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42510. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42511. var transport_strategy_TransportStrategy = (function () {
  42512. function TransportStrategy(name, priority, transport, options) {
  42513. this.name = name;
  42514. this.priority = priority;
  42515. this.transport = transport;
  42516. this.options = options || {};
  42517. }
  42518. TransportStrategy.prototype.isSupported = function () {
  42519. return this.transport.isSupported({
  42520. useTLS: this.options.useTLS
  42521. });
  42522. };
  42523. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42524. var _this = this;
  42525. if (!this.isSupported()) {
  42526. return failAttempt(new UnsupportedStrategy(), callback);
  42527. }
  42528. else if (this.priority < minPriority) {
  42529. return failAttempt(new TransportPriorityTooLow(), callback);
  42530. }
  42531. var connected = false;
  42532. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42533. var handshake = null;
  42534. var onInitialized = function () {
  42535. transport.unbind("initialized", onInitialized);
  42536. transport.connect();
  42537. };
  42538. var onOpen = function () {
  42539. handshake = factory.createHandshake(transport, function (result) {
  42540. connected = true;
  42541. unbindListeners();
  42542. callback(null, result);
  42543. });
  42544. };
  42545. var onError = function (error) {
  42546. unbindListeners();
  42547. callback(error);
  42548. };
  42549. var onClosed = function () {
  42550. unbindListeners();
  42551. var serializedTransport;
  42552. serializedTransport = safeJSONStringify(transport);
  42553. callback(new TransportClosed(serializedTransport));
  42554. };
  42555. var unbindListeners = function () {
  42556. transport.unbind("initialized", onInitialized);
  42557. transport.unbind("open", onOpen);
  42558. transport.unbind("error", onError);
  42559. transport.unbind("closed", onClosed);
  42560. };
  42561. transport.bind("initialized", onInitialized);
  42562. transport.bind("open", onOpen);
  42563. transport.bind("error", onError);
  42564. transport.bind("closed", onClosed);
  42565. transport.initialize();
  42566. return {
  42567. abort: function () {
  42568. if (connected) {
  42569. return;
  42570. }
  42571. unbindListeners();
  42572. if (handshake) {
  42573. handshake.close();
  42574. }
  42575. else {
  42576. transport.close();
  42577. }
  42578. },
  42579. forceMinPriority: function (p) {
  42580. if (connected) {
  42581. return;
  42582. }
  42583. if (_this.priority < p) {
  42584. if (handshake) {
  42585. handshake.close();
  42586. }
  42587. else {
  42588. transport.close();
  42589. }
  42590. }
  42591. }
  42592. };
  42593. };
  42594. return TransportStrategy;
  42595. }());
  42596. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42597. function failAttempt(error, callback) {
  42598. util.defer(function () {
  42599. callback(error);
  42600. });
  42601. return {
  42602. abort: function () { },
  42603. forceMinPriority: function () { }
  42604. };
  42605. }
  42606. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42607. var strategy_builder_Transports = runtime.Transports;
  42608. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42609. var transportClass = strategy_builder_Transports[type];
  42610. if (!transportClass) {
  42611. throw new UnsupportedTransport(type);
  42612. }
  42613. var enabled = (!config.enabledTransports ||
  42614. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42615. (!config.disabledTransports ||
  42616. arrayIndexOf(config.disabledTransports, name) === -1);
  42617. var transport;
  42618. if (enabled) {
  42619. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42620. key: config.key,
  42621. useTLS: config.useTLS,
  42622. timeline: config.timeline,
  42623. ignoreNullOrigin: config.ignoreNullOrigin
  42624. }, options));
  42625. }
  42626. else {
  42627. transport = strategy_builder_UnsupportedStrategy;
  42628. }
  42629. return transport;
  42630. };
  42631. var strategy_builder_UnsupportedStrategy = {
  42632. isSupported: function () {
  42633. return false;
  42634. },
  42635. connect: function (_, callback) {
  42636. var deferred = util.defer(function () {
  42637. callback(new UnsupportedStrategy());
  42638. });
  42639. return {
  42640. abort: function () {
  42641. deferred.ensureAborted();
  42642. },
  42643. forceMinPriority: function () { }
  42644. };
  42645. }
  42646. };
  42647. // CONCATENATED MODULE: ./src/core/config.ts
  42648. var getGlobalConfig = function () {
  42649. return {
  42650. wsHost: defaults.host,
  42651. wsPort: defaults.ws_port,
  42652. wssPort: defaults.wss_port,
  42653. wsPath: defaults.ws_path,
  42654. httpHost: defaults.sockjs_host,
  42655. httpPort: defaults.sockjs_http_port,
  42656. httpsPort: defaults.sockjs_https_port,
  42657. httpPath: defaults.sockjs_path,
  42658. statsHost: defaults.stats_host,
  42659. authEndpoint: defaults.channel_auth_endpoint,
  42660. authTransport: defaults.channel_auth_transport,
  42661. activity_timeout: defaults.activity_timeout,
  42662. pong_timeout: defaults.pong_timeout,
  42663. unavailable_timeout: defaults.unavailable_timeout
  42664. };
  42665. };
  42666. var getClusterConfig = function (clusterName) {
  42667. return {
  42668. wsHost: 'ws-' + clusterName + '.pusher.com',
  42669. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42670. };
  42671. };
  42672. // CONCATENATED MODULE: ./src/core/pusher.ts
  42673. var pusher_Pusher = (function () {
  42674. function Pusher(app_key, options) {
  42675. var _this = this;
  42676. checkAppKey(app_key);
  42677. options = options || {};
  42678. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42679. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42680. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42681. }
  42682. this.key = app_key;
  42683. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42684. this.channels = factory.createChannels();
  42685. this.global_emitter = new dispatcher();
  42686. this.sessionID = Math.floor(Math.random() * 1000000000);
  42687. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42688. cluster: this.config.cluster,
  42689. features: Pusher.getClientFeatures(),
  42690. params: this.config.timelineParams || {},
  42691. limit: 50,
  42692. level: timeline_level.INFO,
  42693. version: defaults.VERSION
  42694. });
  42695. if (!this.config.disableStats) {
  42696. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42697. host: this.config.statsHost,
  42698. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42699. });
  42700. }
  42701. var getStrategy = function (options) {
  42702. var config = extend({}, _this.config, options);
  42703. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42704. };
  42705. this.connection = factory.createConnectionManager(this.key, extend({
  42706. getStrategy: getStrategy,
  42707. timeline: this.timeline,
  42708. activityTimeout: this.config.activity_timeout,
  42709. pongTimeout: this.config.pong_timeout,
  42710. unavailableTimeout: this.config.unavailable_timeout
  42711. }, this.config, { useTLS: this.shouldUseTLS() }));
  42712. this.connection.bind('connected', function () {
  42713. _this.subscribeAll();
  42714. if (_this.timelineSender) {
  42715. _this.timelineSender.send(_this.connection.isUsingTLS());
  42716. }
  42717. });
  42718. this.connection.bind('message', function (event) {
  42719. var eventName = event.event;
  42720. var internal = eventName.indexOf('pusher_internal:') === 0;
  42721. if (event.channel) {
  42722. var channel = _this.channel(event.channel);
  42723. if (channel) {
  42724. channel.handleEvent(event);
  42725. }
  42726. }
  42727. if (!internal) {
  42728. _this.global_emitter.emit(event.event, event.data);
  42729. }
  42730. });
  42731. this.connection.bind('connecting', function () {
  42732. _this.channels.disconnect();
  42733. });
  42734. this.connection.bind('disconnected', function () {
  42735. _this.channels.disconnect();
  42736. });
  42737. this.connection.bind('error', function (err) {
  42738. logger.warn(err);
  42739. });
  42740. Pusher.instances.push(this);
  42741. this.timeline.info({ instances: Pusher.instances.length });
  42742. if (Pusher.isReady) {
  42743. this.connect();
  42744. }
  42745. }
  42746. Pusher.ready = function () {
  42747. Pusher.isReady = true;
  42748. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42749. Pusher.instances[i].connect();
  42750. }
  42751. };
  42752. Pusher.getClientFeatures = function () {
  42753. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42754. return t.isSupported({});
  42755. }));
  42756. };
  42757. Pusher.prototype.channel = function (name) {
  42758. return this.channels.find(name);
  42759. };
  42760. Pusher.prototype.allChannels = function () {
  42761. return this.channels.all();
  42762. };
  42763. Pusher.prototype.connect = function () {
  42764. this.connection.connect();
  42765. if (this.timelineSender) {
  42766. if (!this.timelineSenderTimer) {
  42767. var usingTLS = this.connection.isUsingTLS();
  42768. var timelineSender = this.timelineSender;
  42769. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42770. timelineSender.send(usingTLS);
  42771. });
  42772. }
  42773. }
  42774. };
  42775. Pusher.prototype.disconnect = function () {
  42776. this.connection.disconnect();
  42777. if (this.timelineSenderTimer) {
  42778. this.timelineSenderTimer.ensureAborted();
  42779. this.timelineSenderTimer = null;
  42780. }
  42781. };
  42782. Pusher.prototype.bind = function (event_name, callback, context) {
  42783. this.global_emitter.bind(event_name, callback, context);
  42784. return this;
  42785. };
  42786. Pusher.prototype.unbind = function (event_name, callback, context) {
  42787. this.global_emitter.unbind(event_name, callback, context);
  42788. return this;
  42789. };
  42790. Pusher.prototype.bind_global = function (callback) {
  42791. this.global_emitter.bind_global(callback);
  42792. return this;
  42793. };
  42794. Pusher.prototype.unbind_global = function (callback) {
  42795. this.global_emitter.unbind_global(callback);
  42796. return this;
  42797. };
  42798. Pusher.prototype.unbind_all = function (callback) {
  42799. this.global_emitter.unbind_all();
  42800. return this;
  42801. };
  42802. Pusher.prototype.subscribeAll = function () {
  42803. var channelName;
  42804. for (channelName in this.channels.channels) {
  42805. if (this.channels.channels.hasOwnProperty(channelName)) {
  42806. this.subscribe(channelName);
  42807. }
  42808. }
  42809. };
  42810. Pusher.prototype.subscribe = function (channel_name) {
  42811. var channel = this.channels.add(channel_name, this);
  42812. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42813. channel.reinstateSubscription();
  42814. }
  42815. else if (!channel.subscriptionPending &&
  42816. this.connection.state === 'connected') {
  42817. channel.subscribe();
  42818. }
  42819. return channel;
  42820. };
  42821. Pusher.prototype.unsubscribe = function (channel_name) {
  42822. var channel = this.channels.find(channel_name);
  42823. if (channel && channel.subscriptionPending) {
  42824. channel.cancelSubscription();
  42825. }
  42826. else {
  42827. channel = this.channels.remove(channel_name);
  42828. if (channel && this.connection.state === 'connected') {
  42829. channel.unsubscribe();
  42830. }
  42831. }
  42832. };
  42833. Pusher.prototype.send_event = function (event_name, data, channel) {
  42834. return this.connection.send_event(event_name, data, channel);
  42835. };
  42836. Pusher.prototype.shouldUseTLS = function () {
  42837. if (runtime.getProtocol() === 'https:') {
  42838. return true;
  42839. }
  42840. else if (this.config.forceTLS === true) {
  42841. return true;
  42842. }
  42843. else {
  42844. return Boolean(this.config.encrypted);
  42845. }
  42846. };
  42847. Pusher.instances = [];
  42848. Pusher.isReady = false;
  42849. Pusher.logToConsole = false;
  42850. Pusher.Runtime = runtime;
  42851. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42852. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42853. Pusher.auth_callbacks = runtime.auth_callbacks;
  42854. return Pusher;
  42855. }());
  42856. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42857. function checkAppKey(key) {
  42858. if (key === null || key === undefined) {
  42859. throw 'You must pass your app key when you instantiate Pusher.';
  42860. }
  42861. }
  42862. runtime.setup(pusher_Pusher);
  42863. /***/ })
  42864. /******/ ]);
  42865. });
  42866. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42867. /***/ }),
  42868. /***/ "./node_modules/setimmediate/setImmediate.js":
  42869. /*!***************************************************!*\
  42870. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42871. \***************************************************/
  42872. /*! no static exports found */
  42873. /***/ (function(module, exports, __webpack_require__) {
  42874. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42875. "use strict";
  42876. if (global.setImmediate) {
  42877. return;
  42878. }
  42879. var nextHandle = 1; // Spec says greater than zero
  42880. var tasksByHandle = {};
  42881. var currentlyRunningATask = false;
  42882. var doc = global.document;
  42883. var registerImmediate;
  42884. function setImmediate(callback) {
  42885. // Callback can either be a function or a string
  42886. if (typeof callback !== "function") {
  42887. callback = new Function("" + callback);
  42888. }
  42889. // Copy function arguments
  42890. var args = new Array(arguments.length - 1);
  42891. for (var i = 0; i < args.length; i++) {
  42892. args[i] = arguments[i + 1];
  42893. }
  42894. // Store and register the task
  42895. var task = { callback: callback, args: args };
  42896. tasksByHandle[nextHandle] = task;
  42897. registerImmediate(nextHandle);
  42898. return nextHandle++;
  42899. }
  42900. function clearImmediate(handle) {
  42901. delete tasksByHandle[handle];
  42902. }
  42903. function run(task) {
  42904. var callback = task.callback;
  42905. var args = task.args;
  42906. switch (args.length) {
  42907. case 0:
  42908. callback();
  42909. break;
  42910. case 1:
  42911. callback(args[0]);
  42912. break;
  42913. case 2:
  42914. callback(args[0], args[1]);
  42915. break;
  42916. case 3:
  42917. callback(args[0], args[1], args[2]);
  42918. break;
  42919. default:
  42920. callback.apply(undefined, args);
  42921. break;
  42922. }
  42923. }
  42924. function runIfPresent(handle) {
  42925. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42926. // So if we're currently running a task, we'll need to delay this invocation.
  42927. if (currentlyRunningATask) {
  42928. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42929. // "too much recursion" error.
  42930. setTimeout(runIfPresent, 0, handle);
  42931. } else {
  42932. var task = tasksByHandle[handle];
  42933. if (task) {
  42934. currentlyRunningATask = true;
  42935. try {
  42936. run(task);
  42937. } finally {
  42938. clearImmediate(handle);
  42939. currentlyRunningATask = false;
  42940. }
  42941. }
  42942. }
  42943. }
  42944. function installNextTickImplementation() {
  42945. registerImmediate = function(handle) {
  42946. process.nextTick(function () { runIfPresent(handle); });
  42947. };
  42948. }
  42949. function canUsePostMessage() {
  42950. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42951. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42952. if (global.postMessage && !global.importScripts) {
  42953. var postMessageIsAsynchronous = true;
  42954. var oldOnMessage = global.onmessage;
  42955. global.onmessage = function() {
  42956. postMessageIsAsynchronous = false;
  42957. };
  42958. global.postMessage("", "*");
  42959. global.onmessage = oldOnMessage;
  42960. return postMessageIsAsynchronous;
  42961. }
  42962. }
  42963. function installPostMessageImplementation() {
  42964. // Installs an event handler on `global` for the `message` event: see
  42965. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42966. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42967. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42968. var onGlobalMessage = function(event) {
  42969. if (event.source === global &&
  42970. typeof event.data === "string" &&
  42971. event.data.indexOf(messagePrefix) === 0) {
  42972. runIfPresent(+event.data.slice(messagePrefix.length));
  42973. }
  42974. };
  42975. if (global.addEventListener) {
  42976. global.addEventListener("message", onGlobalMessage, false);
  42977. } else {
  42978. global.attachEvent("onmessage", onGlobalMessage);
  42979. }
  42980. registerImmediate = function(handle) {
  42981. global.postMessage(messagePrefix + handle, "*");
  42982. };
  42983. }
  42984. function installMessageChannelImplementation() {
  42985. var channel = new MessageChannel();
  42986. channel.port1.onmessage = function(event) {
  42987. var handle = event.data;
  42988. runIfPresent(handle);
  42989. };
  42990. registerImmediate = function(handle) {
  42991. channel.port2.postMessage(handle);
  42992. };
  42993. }
  42994. function installReadyStateChangeImplementation() {
  42995. var html = doc.documentElement;
  42996. registerImmediate = function(handle) {
  42997. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42998. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42999. var script = doc.createElement("script");
  43000. script.onreadystatechange = function () {
  43001. runIfPresent(handle);
  43002. script.onreadystatechange = null;
  43003. html.removeChild(script);
  43004. script = null;
  43005. };
  43006. html.appendChild(script);
  43007. };
  43008. }
  43009. function installSetTimeoutImplementation() {
  43010. registerImmediate = function(handle) {
  43011. setTimeout(runIfPresent, 0, handle);
  43012. };
  43013. }
  43014. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43015. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43016. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43017. // Don't get fooled by e.g. browserify environments.
  43018. if ({}.toString.call(global.process) === "[object process]") {
  43019. // For Node.js before 0.9
  43020. installNextTickImplementation();
  43021. } else if (canUsePostMessage()) {
  43022. // For non-IE10 modern browsers
  43023. installPostMessageImplementation();
  43024. } else if (global.MessageChannel) {
  43025. // For web workers, where supported
  43026. installMessageChannelImplementation();
  43027. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43028. // For IE 6–8
  43029. installReadyStateChangeImplementation();
  43030. } else {
  43031. // For older browsers
  43032. installSetTimeoutImplementation();
  43033. }
  43034. attachTo.setImmediate = setImmediate;
  43035. attachTo.clearImmediate = clearImmediate;
  43036. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43037. /* 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")))
  43038. /***/ }),
  43039. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  43040. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43041. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  43042. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43043. /*! no static exports found */
  43044. /***/ (function(module, exports, __webpack_require__) {
  43045. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  43046. if(typeof content === 'string') content = [[module.i, content, '']];
  43047. var transform;
  43048. var insertInto;
  43049. var options = {"hmr":true}
  43050. options.transform = transform
  43051. options.insertInto = undefined;
  43052. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43053. if(content.locals) module.exports = content.locals;
  43054. if(false) {}
  43055. /***/ }),
  43056. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  43057. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43058. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  43059. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43060. /*! no static exports found */
  43061. /***/ (function(module, exports, __webpack_require__) {
  43062. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  43063. if(typeof content === 'string') content = [[module.i, content, '']];
  43064. var transform;
  43065. var insertInto;
  43066. var options = {"hmr":true}
  43067. options.transform = transform
  43068. options.insertInto = undefined;
  43069. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43070. if(content.locals) module.exports = content.locals;
  43071. if(false) {}
  43072. /***/ }),
  43073. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43074. /*!****************************************************!*\
  43075. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43076. \****************************************************/
  43077. /*! no static exports found */
  43078. /***/ (function(module, exports, __webpack_require__) {
  43079. /*
  43080. MIT License http://www.opensource.org/licenses/mit-license.php
  43081. Author Tobias Koppers @sokra
  43082. */
  43083. var stylesInDom = {};
  43084. var memoize = function (fn) {
  43085. var memo;
  43086. return function () {
  43087. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43088. return memo;
  43089. };
  43090. };
  43091. var isOldIE = memoize(function () {
  43092. // Test for IE <= 9 as proposed by Browserhacks
  43093. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43094. // Tests for existence of standard globals is to allow style-loader
  43095. // to operate correctly into non-standard environments
  43096. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43097. return window && document && document.all && !window.atob;
  43098. });
  43099. var getTarget = function (target, parent) {
  43100. if (parent){
  43101. return parent.querySelector(target);
  43102. }
  43103. return document.querySelector(target);
  43104. };
  43105. var getElement = (function (fn) {
  43106. var memo = {};
  43107. return function(target, parent) {
  43108. // If passing function in options, then use it for resolve "head" element.
  43109. // Useful for Shadow Root style i.e
  43110. // {
  43111. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43112. // }
  43113. if (typeof target === 'function') {
  43114. return target();
  43115. }
  43116. if (typeof memo[target] === "undefined") {
  43117. var styleTarget = getTarget.call(this, target, parent);
  43118. // Special case to return head of iframe instead of iframe itself
  43119. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43120. try {
  43121. // This will throw an exception if access to iframe is blocked
  43122. // due to cross-origin restrictions
  43123. styleTarget = styleTarget.contentDocument.head;
  43124. } catch(e) {
  43125. styleTarget = null;
  43126. }
  43127. }
  43128. memo[target] = styleTarget;
  43129. }
  43130. return memo[target]
  43131. };
  43132. })();
  43133. var singleton = null;
  43134. var singletonCounter = 0;
  43135. var stylesInsertedAtTop = [];
  43136. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43137. module.exports = function(list, options) {
  43138. if (typeof DEBUG !== "undefined" && DEBUG) {
  43139. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43140. }
  43141. options = options || {};
  43142. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43143. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43144. // tags it will allow on a page
  43145. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43146. // By default, add <style> tags to the <head> element
  43147. if (!options.insertInto) options.insertInto = "head";
  43148. // By default, add <style> tags to the bottom of the target
  43149. if (!options.insertAt) options.insertAt = "bottom";
  43150. var styles = listToStyles(list, options);
  43151. addStylesToDom(styles, options);
  43152. return function update (newList) {
  43153. var mayRemove = [];
  43154. for (var i = 0; i < styles.length; i++) {
  43155. var item = styles[i];
  43156. var domStyle = stylesInDom[item.id];
  43157. domStyle.refs--;
  43158. mayRemove.push(domStyle);
  43159. }
  43160. if(newList) {
  43161. var newStyles = listToStyles(newList, options);
  43162. addStylesToDom(newStyles, options);
  43163. }
  43164. for (var i = 0; i < mayRemove.length; i++) {
  43165. var domStyle = mayRemove[i];
  43166. if(domStyle.refs === 0) {
  43167. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43168. delete stylesInDom[domStyle.id];
  43169. }
  43170. }
  43171. };
  43172. };
  43173. function addStylesToDom (styles, options) {
  43174. for (var i = 0; i < styles.length; i++) {
  43175. var item = styles[i];
  43176. var domStyle = stylesInDom[item.id];
  43177. if(domStyle) {
  43178. domStyle.refs++;
  43179. for(var j = 0; j < domStyle.parts.length; j++) {
  43180. domStyle.parts[j](item.parts[j]);
  43181. }
  43182. for(; j < item.parts.length; j++) {
  43183. domStyle.parts.push(addStyle(item.parts[j], options));
  43184. }
  43185. } else {
  43186. var parts = [];
  43187. for(var j = 0; j < item.parts.length; j++) {
  43188. parts.push(addStyle(item.parts[j], options));
  43189. }
  43190. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43191. }
  43192. }
  43193. }
  43194. function listToStyles (list, options) {
  43195. var styles = [];
  43196. var newStyles = {};
  43197. for (var i = 0; i < list.length; i++) {
  43198. var item = list[i];
  43199. var id = options.base ? item[0] + options.base : item[0];
  43200. var css = item[1];
  43201. var media = item[2];
  43202. var sourceMap = item[3];
  43203. var part = {css: css, media: media, sourceMap: sourceMap};
  43204. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43205. else newStyles[id].parts.push(part);
  43206. }
  43207. return styles;
  43208. }
  43209. function insertStyleElement (options, style) {
  43210. var target = getElement(options.insertInto)
  43211. if (!target) {
  43212. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43213. }
  43214. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43215. if (options.insertAt === "top") {
  43216. if (!lastStyleElementInsertedAtTop) {
  43217. target.insertBefore(style, target.firstChild);
  43218. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43219. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43220. } else {
  43221. target.appendChild(style);
  43222. }
  43223. stylesInsertedAtTop.push(style);
  43224. } else if (options.insertAt === "bottom") {
  43225. target.appendChild(style);
  43226. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43227. var nextSibling = getElement(options.insertAt.before, target);
  43228. target.insertBefore(style, nextSibling);
  43229. } else {
  43230. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  43231. }
  43232. }
  43233. function removeStyleElement (style) {
  43234. if (style.parentNode === null) return false;
  43235. style.parentNode.removeChild(style);
  43236. var idx = stylesInsertedAtTop.indexOf(style);
  43237. if(idx >= 0) {
  43238. stylesInsertedAtTop.splice(idx, 1);
  43239. }
  43240. }
  43241. function createStyleElement (options) {
  43242. var style = document.createElement("style");
  43243. if(options.attrs.type === undefined) {
  43244. options.attrs.type = "text/css";
  43245. }
  43246. if(options.attrs.nonce === undefined) {
  43247. var nonce = getNonce();
  43248. if (nonce) {
  43249. options.attrs.nonce = nonce;
  43250. }
  43251. }
  43252. addAttrs(style, options.attrs);
  43253. insertStyleElement(options, style);
  43254. return style;
  43255. }
  43256. function createLinkElement (options) {
  43257. var link = document.createElement("link");
  43258. if(options.attrs.type === undefined) {
  43259. options.attrs.type = "text/css";
  43260. }
  43261. options.attrs.rel = "stylesheet";
  43262. addAttrs(link, options.attrs);
  43263. insertStyleElement(options, link);
  43264. return link;
  43265. }
  43266. function addAttrs (el, attrs) {
  43267. Object.keys(attrs).forEach(function (key) {
  43268. el.setAttribute(key, attrs[key]);
  43269. });
  43270. }
  43271. function getNonce() {
  43272. if (false) {}
  43273. return __webpack_require__.nc;
  43274. }
  43275. function addStyle (obj, options) {
  43276. var style, update, remove, result;
  43277. // If a transform function was defined, run it on the css
  43278. if (options.transform && obj.css) {
  43279. result = typeof options.transform === 'function'
  43280. ? options.transform(obj.css)
  43281. : options.transform.default(obj.css);
  43282. if (result) {
  43283. // If transform returns a value, use that instead of the original css.
  43284. // This allows running runtime transformations on the css.
  43285. obj.css = result;
  43286. } else {
  43287. // If the transform function returns a falsy value, don't add this css.
  43288. // This allows conditional loading of css
  43289. return function() {
  43290. // noop
  43291. };
  43292. }
  43293. }
  43294. if (options.singleton) {
  43295. var styleIndex = singletonCounter++;
  43296. style = singleton || (singleton = createStyleElement(options));
  43297. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43298. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43299. } else if (
  43300. obj.sourceMap &&
  43301. typeof URL === "function" &&
  43302. typeof URL.createObjectURL === "function" &&
  43303. typeof URL.revokeObjectURL === "function" &&
  43304. typeof Blob === "function" &&
  43305. typeof btoa === "function"
  43306. ) {
  43307. style = createLinkElement(options);
  43308. update = updateLink.bind(null, style, options);
  43309. remove = function () {
  43310. removeStyleElement(style);
  43311. if(style.href) URL.revokeObjectURL(style.href);
  43312. };
  43313. } else {
  43314. style = createStyleElement(options);
  43315. update = applyToTag.bind(null, style);
  43316. remove = function () {
  43317. removeStyleElement(style);
  43318. };
  43319. }
  43320. update(obj);
  43321. return function updateStyle (newObj) {
  43322. if (newObj) {
  43323. if (
  43324. newObj.css === obj.css &&
  43325. newObj.media === obj.media &&
  43326. newObj.sourceMap === obj.sourceMap
  43327. ) {
  43328. return;
  43329. }
  43330. update(obj = newObj);
  43331. } else {
  43332. remove();
  43333. }
  43334. };
  43335. }
  43336. var replaceText = (function () {
  43337. var textStore = [];
  43338. return function (index, replacement) {
  43339. textStore[index] = replacement;
  43340. return textStore.filter(Boolean).join('\n');
  43341. };
  43342. })();
  43343. function applyToSingletonTag (style, index, remove, obj) {
  43344. var css = remove ? "" : obj.css;
  43345. if (style.styleSheet) {
  43346. style.styleSheet.cssText = replaceText(index, css);
  43347. } else {
  43348. var cssNode = document.createTextNode(css);
  43349. var childNodes = style.childNodes;
  43350. if (childNodes[index]) style.removeChild(childNodes[index]);
  43351. if (childNodes.length) {
  43352. style.insertBefore(cssNode, childNodes[index]);
  43353. } else {
  43354. style.appendChild(cssNode);
  43355. }
  43356. }
  43357. }
  43358. function applyToTag (style, obj) {
  43359. var css = obj.css;
  43360. var media = obj.media;
  43361. if(media) {
  43362. style.setAttribute("media", media)
  43363. }
  43364. if(style.styleSheet) {
  43365. style.styleSheet.cssText = css;
  43366. } else {
  43367. while(style.firstChild) {
  43368. style.removeChild(style.firstChild);
  43369. }
  43370. style.appendChild(document.createTextNode(css));
  43371. }
  43372. }
  43373. function updateLink (link, options, obj) {
  43374. var css = obj.css;
  43375. var sourceMap = obj.sourceMap;
  43376. /*
  43377. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43378. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43379. on by default. Otherwise default to the convertToAbsoluteUrls option
  43380. directly
  43381. */
  43382. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43383. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43384. css = fixUrls(css);
  43385. }
  43386. if (sourceMap) {
  43387. // http://stackoverflow.com/a/26603875
  43388. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43389. }
  43390. var blob = new Blob([css], { type: "text/css" });
  43391. var oldSrc = link.href;
  43392. link.href = URL.createObjectURL(blob);
  43393. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43394. }
  43395. /***/ }),
  43396. /***/ "./node_modules/style-loader/lib/urls.js":
  43397. /*!***********************************************!*\
  43398. !*** ./node_modules/style-loader/lib/urls.js ***!
  43399. \***********************************************/
  43400. /*! no static exports found */
  43401. /***/ (function(module, exports) {
  43402. /**
  43403. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43404. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43405. * bundle instead of the current page.
  43406. *
  43407. * One solution is to only use full urls, but that may be impossible.
  43408. *
  43409. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43410. *
  43411. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43412. *
  43413. */
  43414. module.exports = function (css) {
  43415. // get current location
  43416. var location = typeof window !== "undefined" && window.location;
  43417. if (!location) {
  43418. throw new Error("fixUrls requires window.location");
  43419. }
  43420. // blank or null?
  43421. if (!css || typeof css !== "string") {
  43422. return css;
  43423. }
  43424. var baseUrl = location.protocol + "//" + location.host;
  43425. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43426. // convert each url(...)
  43427. /*
  43428. This regular expression is just a way to recursively match brackets within
  43429. a string.
  43430. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43431. ( = Start a capturing group
  43432. (?: = Start a non-capturing group
  43433. [^)(] = Match anything that isn't a parentheses
  43434. | = OR
  43435. \( = Match a start parentheses
  43436. (?: = Start another non-capturing groups
  43437. [^)(]+ = Match anything that isn't a parentheses
  43438. | = OR
  43439. \( = Match a start parentheses
  43440. [^)(]* = Match anything that isn't a parentheses
  43441. \) = Match a end parentheses
  43442. ) = End Group
  43443. *\) = Match anything and then a close parens
  43444. ) = Close non-capturing group
  43445. * = Match anything
  43446. ) = Close capturing group
  43447. \) = Match a close parens
  43448. /gi = Get all matches, not the first. Be case insensitive.
  43449. */
  43450. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43451. // strip quotes (if they exist)
  43452. var unquotedOrigUrl = origUrl
  43453. .trim()
  43454. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43455. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43456. // already a full url? no change
  43457. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43458. return fullMatch;
  43459. }
  43460. // convert the url to a full url
  43461. var newUrl;
  43462. if (unquotedOrigUrl.indexOf("//") === 0) {
  43463. //TODO: should we add protocol?
  43464. newUrl = unquotedOrigUrl;
  43465. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43466. // path should be relative to the base url
  43467. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43468. } else {
  43469. // path should be relative to current directory
  43470. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43471. }
  43472. // send back the fixed url(...)
  43473. return "url(" + JSON.stringify(newUrl) + ")";
  43474. });
  43475. // send back the fixed css
  43476. return fixedCss;
  43477. };
  43478. /***/ }),
  43479. /***/ "./node_modules/timers-browserify/main.js":
  43480. /*!************************************************!*\
  43481. !*** ./node_modules/timers-browserify/main.js ***!
  43482. \************************************************/
  43483. /*! no static exports found */
  43484. /***/ (function(module, exports, __webpack_require__) {
  43485. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43486. (typeof self !== "undefined" && self) ||
  43487. window;
  43488. var apply = Function.prototype.apply;
  43489. // DOM APIs, for completeness
  43490. exports.setTimeout = function() {
  43491. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43492. };
  43493. exports.setInterval = function() {
  43494. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43495. };
  43496. exports.clearTimeout =
  43497. exports.clearInterval = function(timeout) {
  43498. if (timeout) {
  43499. timeout.close();
  43500. }
  43501. };
  43502. function Timeout(id, clearFn) {
  43503. this._id = id;
  43504. this._clearFn = clearFn;
  43505. }
  43506. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43507. Timeout.prototype.close = function() {
  43508. this._clearFn.call(scope, this._id);
  43509. };
  43510. // Does not start the time, just sets up the members needed.
  43511. exports.enroll = function(item, msecs) {
  43512. clearTimeout(item._idleTimeoutId);
  43513. item._idleTimeout = msecs;
  43514. };
  43515. exports.unenroll = function(item) {
  43516. clearTimeout(item._idleTimeoutId);
  43517. item._idleTimeout = -1;
  43518. };
  43519. exports._unrefActive = exports.active = function(item) {
  43520. clearTimeout(item._idleTimeoutId);
  43521. var msecs = item._idleTimeout;
  43522. if (msecs >= 0) {
  43523. item._idleTimeoutId = setTimeout(function onTimeout() {
  43524. if (item._onTimeout)
  43525. item._onTimeout();
  43526. }, msecs);
  43527. }
  43528. };
  43529. // setimmediate attaches itself to the global object
  43530. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43531. // On some exotic environments, it's not clear which object `setimmediate` was
  43532. // able to install onto. Search each possibility in the same order as the
  43533. // `setimmediate` library.
  43534. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43535. (typeof global !== "undefined" && global.setImmediate) ||
  43536. (this && this.setImmediate);
  43537. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43538. (typeof global !== "undefined" && global.clearImmediate) ||
  43539. (this && this.clearImmediate);
  43540. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43541. /***/ }),
  43542. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  43543. /*!*****************************************************************************************************************************************************************************************************************************!*\
  43544. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  43545. \*****************************************************************************************************************************************************************************************************************************/
  43546. /*! exports provided: render, staticRenderFns */
  43547. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43548. "use strict";
  43549. __webpack_require__.r(__webpack_exports__);
  43550. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43551. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43552. var render = function() {
  43553. var _vm = this
  43554. var _h = _vm.$createElement
  43555. var _c = _vm._self._c || _h
  43556. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43557. _c("div", { staticClass: "input-group" }, [
  43558. _c("input", {
  43559. directives: [
  43560. {
  43561. name: "model",
  43562. rawName: "v-model",
  43563. value: _vm.searchText,
  43564. expression: "searchText"
  43565. }
  43566. ],
  43567. staticClass: "form-control",
  43568. attrs: { type: "text" },
  43569. domProps: { value: _vm.searchText },
  43570. on: {
  43571. input: [
  43572. function($event) {
  43573. if ($event.target.composing) {
  43574. return
  43575. }
  43576. _vm.searchText = $event.target.value
  43577. },
  43578. _vm.searchChanged
  43579. ]
  43580. }
  43581. }),
  43582. _vm._v(" "),
  43583. _c("div", { staticClass: "form-group-append" }, [
  43584. _c(
  43585. "a",
  43586. {
  43587. staticClass: "toggle input-group-text bg-primary text-light",
  43588. on: {
  43589. mousedown: function($event) {
  43590. $event.preventDefault()
  43591. },
  43592. click: function($event) {
  43593. return _vm.setOpen(!_vm.open)
  43594. }
  43595. }
  43596. },
  43597. [
  43598. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43599. _vm._v(" "),
  43600. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43601. ]
  43602. )
  43603. ])
  43604. ]),
  43605. _vm._v(" "),
  43606. _c(
  43607. "ul",
  43608. { staticClass: "suggestion-list list-unstyled" },
  43609. _vm._l(_vm.matches, function(suggestion, index) {
  43610. return _c(
  43611. "li",
  43612. {
  43613. key: index,
  43614. on: {
  43615. mousedown: function($event) {
  43616. $event.preventDefault()
  43617. },
  43618. click: function($event) {
  43619. return _vm.suggestionSelected(suggestion)
  43620. }
  43621. }
  43622. },
  43623. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43624. )
  43625. }),
  43626. 0
  43627. )
  43628. ])
  43629. }
  43630. var staticRenderFns = []
  43631. render._withStripped = true
  43632. /***/ }),
  43633. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  43634. /*!****************************************************************************************************************************************************************************************************************************!*\
  43635. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  43636. \****************************************************************************************************************************************************************************************************************************/
  43637. /*! exports provided: render, staticRenderFns */
  43638. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43639. "use strict";
  43640. __webpack_require__.r(__webpack_exports__);
  43641. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43642. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43643. var render = function() {
  43644. var _vm = this
  43645. var _h = _vm.$createElement
  43646. var _c = _vm._self._c || _h
  43647. return _c("div", { staticClass: "loader" }, [_vm._v("Loading...")])
  43648. }
  43649. var staticRenderFns = []
  43650. render._withStripped = true
  43651. /***/ }),
  43652. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  43653. /*!********************************************************************************************************************************************************************************************************!*\
  43654. !*** ./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=53ab54d2& ***!
  43655. \********************************************************************************************************************************************************************************************************/
  43656. /*! exports provided: render, staticRenderFns */
  43657. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43658. "use strict";
  43659. __webpack_require__.r(__webpack_exports__);
  43660. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43661. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43662. var render = function() {
  43663. var _vm = this
  43664. var _h = _vm.$createElement
  43665. var _c = _vm._self._c || _h
  43666. return _c("div", { staticClass: "modal fade" }, [
  43667. _c(
  43668. "div",
  43669. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43670. [
  43671. _c("div", { staticClass: "modal-content" }, [
  43672. _c(
  43673. "div",
  43674. { staticClass: "modal-header" },
  43675. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43676. 2
  43677. ),
  43678. _vm._v(" "),
  43679. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43680. _vm._v(" "),
  43681. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43682. ])
  43683. ]
  43684. )
  43685. ])
  43686. }
  43687. var staticRenderFns = [
  43688. function() {
  43689. var _vm = this
  43690. var _h = _vm.$createElement
  43691. var _c = _vm._self._c || _h
  43692. return _c(
  43693. "button",
  43694. {
  43695. staticClass: "close",
  43696. attrs: {
  43697. type: "button",
  43698. "data-dismiss": "modal",
  43699. "aria-label": "Close"
  43700. }
  43701. },
  43702. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43703. )
  43704. }
  43705. ]
  43706. render._withStripped = true
  43707. /***/ }),
  43708. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  43709. /*!******************************************************************************************************************************************************************************************************************!*\
  43710. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  43711. \******************************************************************************************************************************************************************************************************************/
  43712. /*! exports provided: render, staticRenderFns */
  43713. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43714. "use strict";
  43715. __webpack_require__.r(__webpack_exports__);
  43716. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43718. var render = function() {
  43719. var _vm = this
  43720. var _h = _vm.$createElement
  43721. var _c = _vm._self._c || _h
  43722. return _c(
  43723. "modal",
  43724. {
  43725. attrs: {
  43726. id: _vm.id,
  43727. tabindex: "-1",
  43728. role: "dialog",
  43729. "aria-labelledby": _vm.id + "Label"
  43730. }
  43731. },
  43732. [
  43733. _c(
  43734. "h5",
  43735. {
  43736. staticClass: "modal-title",
  43737. attrs: { slot: "header", id: _vm.id + "Label" },
  43738. slot: "header"
  43739. },
  43740. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  43741. ),
  43742. _vm._v(" "),
  43743. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43744. _c(
  43745. "div",
  43746. { staticClass: "form-group" },
  43747. [
  43748. _c("label", { attrs: { for: "probdesc" } }, [
  43749. _vm._v("Problem Description")
  43750. ]),
  43751. _vm._v(" "),
  43752. _c("textarea", {
  43753. directives: [
  43754. {
  43755. name: "model",
  43756. rawName: "v-model",
  43757. value: _vm.data.probdesc,
  43758. expression: "data.probdesc"
  43759. }
  43760. ],
  43761. class: {
  43762. "form-control": true,
  43763. "is-invalid": _vm.errors.probdesc
  43764. },
  43765. attrs: { id: "probdesc", name: "probdesc" },
  43766. domProps: { value: _vm.data.probdesc },
  43767. on: {
  43768. input: function($event) {
  43769. if ($event.target.composing) {
  43770. return
  43771. }
  43772. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43773. }
  43774. }
  43775. }),
  43776. _vm._v(" "),
  43777. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43778. ],
  43779. 1
  43780. ),
  43781. _vm._v(" "),
  43782. _c(
  43783. "div",
  43784. { staticClass: "form-group" },
  43785. [
  43786. _c("label", { attrs: { for: "suggested" } }, [
  43787. _vm._v("Suggested Solution")
  43788. ]),
  43789. _vm._v(" "),
  43790. _c("textarea", {
  43791. directives: [
  43792. {
  43793. name: "model",
  43794. rawName: "v-model",
  43795. value: _vm.data.suggested,
  43796. expression: "data.suggested"
  43797. }
  43798. ],
  43799. class: {
  43800. "form-control": true,
  43801. "is-invalid": _vm.errors.suggested
  43802. },
  43803. attrs: { id: "suggested", name: "suggested" },
  43804. domProps: { value: _vm.data.suggested },
  43805. on: {
  43806. input: function($event) {
  43807. if ($event.target.composing) {
  43808. return
  43809. }
  43810. _vm.$set(_vm.data, "suggested", $event.target.value)
  43811. }
  43812. }
  43813. }),
  43814. _vm._v(" "),
  43815. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  43816. ],
  43817. 1
  43818. ),
  43819. _vm._v(" "),
  43820. _c(
  43821. "div",
  43822. { staticClass: "form-group" },
  43823. [
  43824. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43825. _vm._v(" "),
  43826. _c("autocomplete-custom-dropdown", {
  43827. attrs: { options: _vm.storeList, value: this.store },
  43828. model: {
  43829. value: _vm.store,
  43830. callback: function($$v) {
  43831. _vm.store = $$v
  43832. },
  43833. expression: "store"
  43834. }
  43835. })
  43836. ],
  43837. 1
  43838. )
  43839. ]),
  43840. _vm._v(" "),
  43841. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43842. _c(
  43843. "button",
  43844. {
  43845. staticClass: "btn btn-secondary",
  43846. attrs: { type: "button", "data-dismiss": "modal" }
  43847. },
  43848. [_vm._v("Close")]
  43849. ),
  43850. _vm._v(" "),
  43851. _c(
  43852. "button",
  43853. {
  43854. staticClass: "btn btn-primary",
  43855. attrs: { type: "button" },
  43856. on: {
  43857. click: function($event) {
  43858. return _vm.updateWorkOrder()
  43859. }
  43860. }
  43861. },
  43862. [_vm._v("Save")]
  43863. )
  43864. ])
  43865. ]
  43866. )
  43867. }
  43868. var staticRenderFns = []
  43869. render._withStripped = true
  43870. /***/ }),
  43871. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  43872. /*!****************************************************************************************************************************************************************************************************************!*\
  43873. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  43874. \****************************************************************************************************************************************************************************************************************/
  43875. /*! exports provided: render, staticRenderFns */
  43876. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43877. "use strict";
  43878. __webpack_require__.r(__webpack_exports__);
  43879. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43880. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43881. var render = function() {
  43882. var _vm = this
  43883. var _h = _vm.$createElement
  43884. var _c = _vm._self._c || _h
  43885. return _c(
  43886. "div",
  43887. [
  43888. _c("wo-info-edit-modal", {
  43889. attrs: {
  43890. "modal-id": "workordereditModal",
  43891. "populate-with": _vm.workOrder,
  43892. "store-list": this.storeList
  43893. }
  43894. }),
  43895. _vm._v(" "),
  43896. _c("p", [
  43897. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43898. _vm._v(" "),
  43899. _c("span", {
  43900. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  43901. })
  43902. ]),
  43903. _vm._v(" "),
  43904. _c("p", [
  43905. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43906. _vm._v(" "),
  43907. _c("span", {
  43908. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  43909. })
  43910. ]),
  43911. _vm._v(" "),
  43912. _c("p", [
  43913. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43914. _vm._v(" "),
  43915. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  43916. ]),
  43917. _vm._v(" "),
  43918. _c("p", [
  43919. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43920. _vm._v(" "),
  43921. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  43922. ]),
  43923. _vm._v(" "),
  43924. _c("p", [
  43925. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43926. _vm._v(" "),
  43927. _c(
  43928. "span",
  43929. {
  43930. staticClass: "dashed-underline",
  43931. attrs: {
  43932. "data-toggle": "tooltip",
  43933. "data-placement": "bottom",
  43934. title: this.getHRDate(_vm.workOrder.dropdate)
  43935. }
  43936. },
  43937. [
  43938. _vm._v(
  43939. "\n " +
  43940. _vm._s(
  43941. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  43942. ) +
  43943. " days ago\n "
  43944. )
  43945. ]
  43946. )
  43947. ]),
  43948. _vm._v(" "),
  43949. _c("p", [
  43950. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43951. _vm._v(" "),
  43952. !this.isZero(_vm.workOrder.pickupdate)
  43953. ? _c(
  43954. "span",
  43955. {
  43956. staticClass: "dashed-underline",
  43957. attrs: {
  43958. "data-toggle": "tooltip",
  43959. "data-placement": "bottom",
  43960. title: this.getHRDate(_vm.workOrder.pickupdate)
  43961. }
  43962. },
  43963. [
  43964. _vm._v(
  43965. "\n " +
  43966. _vm._s(
  43967. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  43968. ) +
  43969. " days ago\n "
  43970. )
  43971. ]
  43972. )
  43973. : _vm._e()
  43974. ]),
  43975. _vm._v(" "),
  43976. _c(
  43977. "button",
  43978. {
  43979. staticClass: "btn btn-primary",
  43980. attrs: {
  43981. type: "button",
  43982. "data-toggle": "modal",
  43983. "data-target": "#workordereditModal"
  43984. }
  43985. },
  43986. [_vm._v("Edit")]
  43987. )
  43988. ],
  43989. 1
  43990. )
  43991. }
  43992. var staticRenderFns = []
  43993. render._withStripped = true
  43994. /***/ }),
  43995. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  43996. /*!*************************************************************************************************************************************************************************************************!*\
  43997. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  43998. \*************************************************************************************************************************************************************************************************/
  43999. /*! exports provided: render, staticRenderFns */
  44000. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44001. "use strict";
  44002. __webpack_require__.r(__webpack_exports__);
  44003. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44005. var render = function() {
  44006. var _vm = this
  44007. var _h = _vm.$createElement
  44008. var _c = _vm._self._c || _h
  44009. return _c("div", [
  44010. _c(
  44011. "nav",
  44012. {
  44013. staticClass:
  44014. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  44015. },
  44016. [
  44017. _c(
  44018. "div",
  44019. { staticClass: "container-fluid" },
  44020. [
  44021. _c(
  44022. "router-link",
  44023. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  44024. [_vm._v("\n UPCCRT\n ")]
  44025. ),
  44026. _vm._v(" "),
  44027. _vm._m(0),
  44028. _vm._v(" "),
  44029. _c(
  44030. "div",
  44031. {
  44032. staticClass: "collapse navbar-collapse",
  44033. attrs: { id: "navbarSupportedContent" }
  44034. },
  44035. [
  44036. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  44037. _vm._m(1),
  44038. _vm._v(" "),
  44039. _vm._m(2),
  44040. _vm._v(" "),
  44041. _c(
  44042. "li",
  44043. { staticClass: "nav-item" },
  44044. [
  44045. _c(
  44046. "router-link",
  44047. {
  44048. staticClass: "nav-link",
  44049. attrs: { to: { name: "dashboard" } }
  44050. },
  44051. [
  44052. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  44053. _vm._v(" "),
  44054. _c(
  44055. "span",
  44056. { staticClass: "d-none d-sm-block d-md-inline" },
  44057. [_vm._v("Dashboard")]
  44058. )
  44059. ]
  44060. )
  44061. ],
  44062. 1
  44063. ),
  44064. _vm._v(" "),
  44065. _vm._m(3)
  44066. ]),
  44067. _vm._v(" "),
  44068. _c(
  44069. "ul",
  44070. { staticClass: "navbar-nav ml-auto" },
  44071. [
  44072. !_vm.isLoggedIn
  44073. ? _c(
  44074. "router-link",
  44075. {
  44076. staticClass: "nav-link",
  44077. attrs: { to: { name: "login" } }
  44078. },
  44079. [_vm._v("Login")]
  44080. )
  44081. : _vm._e(),
  44082. _vm._v(" "),
  44083. _vm.isLoggedIn
  44084. ? _c("li", { staticClass: "nav-link" }, [
  44085. _vm._v(_vm._s(_vm.username))
  44086. ])
  44087. : _vm._e(),
  44088. _vm._v(" "),
  44089. _vm.isLoggedIn
  44090. ? _c(
  44091. "router-link",
  44092. {
  44093. staticClass: "nav-link",
  44094. attrs: { to: { name: "home" } }
  44095. },
  44096. [_vm._v("Home")]
  44097. )
  44098. : _vm._e()
  44099. ],
  44100. 1
  44101. )
  44102. ]
  44103. )
  44104. ],
  44105. 1
  44106. )
  44107. ]
  44108. ),
  44109. _vm._v(" "),
  44110. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  44111. ])
  44112. }
  44113. var staticRenderFns = [
  44114. function() {
  44115. var _vm = this
  44116. var _h = _vm.$createElement
  44117. var _c = _vm._self._c || _h
  44118. return _c(
  44119. "button",
  44120. {
  44121. staticClass: "navbar-toggler",
  44122. attrs: {
  44123. type: "button",
  44124. "data-toggle": "collapse",
  44125. "data-target": "#navbarSupportedContent",
  44126. "aria-controls": "navbarSupportedContent",
  44127. "aria-expanded": "false"
  44128. }
  44129. },
  44130. [_c("span", { staticClass: "navbar-toggler-icon" })]
  44131. )
  44132. },
  44133. function() {
  44134. var _vm = this
  44135. var _h = _vm.$createElement
  44136. var _c = _vm._self._c || _h
  44137. return _c("li", { staticClass: "nav-item" }, [
  44138. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44139. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  44140. _vm._v(" "),
  44141. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44142. _vm._v("Check-In")
  44143. ])
  44144. ])
  44145. ])
  44146. },
  44147. function() {
  44148. var _vm = this
  44149. var _h = _vm.$createElement
  44150. var _c = _vm._self._c || _h
  44151. return _c("li", { staticClass: "nav-item" }, [
  44152. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44153. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44154. _vm._v(" "),
  44155. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44156. _vm._v("Check-Out")
  44157. ])
  44158. ])
  44159. ])
  44160. },
  44161. function() {
  44162. var _vm = this
  44163. var _h = _vm.$createElement
  44164. var _c = _vm._self._c || _h
  44165. return _c("li", { staticClass: "nav-item" }, [
  44166. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44167. _c("i", { staticClass: "fas fa-chart-bar" }),
  44168. _vm._v(" "),
  44169. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44170. _vm._v("Reports")
  44171. ])
  44172. ])
  44173. ])
  44174. }
  44175. ]
  44176. render._withStripped = true
  44177. /***/ }),
  44178. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  44179. /*!*******************************************************************************************************************************************************************************************************!*\
  44180. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  44181. \*******************************************************************************************************************************************************************************************************/
  44182. /*! exports provided: render, staticRenderFns */
  44183. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44184. "use strict";
  44185. __webpack_require__.r(__webpack_exports__);
  44186. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44187. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44188. var render = function() {
  44189. var _vm = this
  44190. var _h = _vm.$createElement
  44191. var _c = _vm._self._c || _h
  44192. return _c("div", { staticClass: "container" }, [
  44193. _c("div", { staticClass: "row justify-content-center" }, [
  44194. _c(
  44195. "div",
  44196. { staticClass: "col-md-12" },
  44197. _vm._l(_vm.workOrders, function(workOrder, index) {
  44198. return _c("div", { key: workOrder.woid, staticClass: "col-md-4" }, [
  44199. _c("div", { staticClass: "card" }, [
  44200. _c(
  44201. "div",
  44202. { staticClass: "card-header" },
  44203. [
  44204. _c(
  44205. "router-link",
  44206. {
  44207. staticClass: "h4 card-title",
  44208. attrs: {
  44209. to: {
  44210. name: "workorders",
  44211. params: { id: workOrder.woid }
  44212. }
  44213. }
  44214. },
  44215. [_vm._v(_vm._s(workOrder.woid))]
  44216. )
  44217. ],
  44218. 1
  44219. ),
  44220. _vm._v(" "),
  44221. _c("div", { staticClass: "card-body card-body-dark" }, [
  44222. _c("div", [
  44223. _vm._v(
  44224. "\n " +
  44225. _vm._s(workOrder.probdesc) +
  44226. "\n "
  44227. )
  44228. ]),
  44229. _vm._v(" "),
  44230. _c("div", [
  44231. _vm._v(
  44232. "\n " +
  44233. _vm._s(workOrder.suggested) +
  44234. "\n "
  44235. )
  44236. ])
  44237. ])
  44238. ])
  44239. ])
  44240. }),
  44241. 0
  44242. )
  44243. ])
  44244. ])
  44245. }
  44246. var staticRenderFns = []
  44247. render._withStripped = true
  44248. /***/ }),
  44249. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  44250. /*!***************************************************************************************************************************************************************************************************!*\
  44251. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  44252. \***************************************************************************************************************************************************************************************************/
  44253. /*! exports provided: render, staticRenderFns */
  44254. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44255. "use strict";
  44256. __webpack_require__.r(__webpack_exports__);
  44257. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44258. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44259. var render = function() {
  44260. var _vm = this
  44261. var _h = _vm.$createElement
  44262. var _c = _vm._self._c || _h
  44263. return _c("div", { staticClass: "container" }, [
  44264. _c("div", { staticClass: "row justify-content-center" }, [
  44265. _c("div", { staticClass: "col-md-8" }, [
  44266. _c("div", { staticClass: "card card-default" }, [
  44267. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  44268. _vm._v(" "),
  44269. _c("div", { staticClass: "card-body" }, [
  44270. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  44271. _c("div", { staticClass: "form-group row" }, [
  44272. _c(
  44273. "label",
  44274. {
  44275. staticClass: "col-sm-4 col-form-label text-md-right",
  44276. attrs: { for: "username" }
  44277. },
  44278. [_vm._v("Username")]
  44279. ),
  44280. _vm._v(" "),
  44281. _c("div", { staticClass: "col-md-6" }, [
  44282. _c("input", {
  44283. directives: [
  44284. {
  44285. name: "model",
  44286. rawName: "v-model",
  44287. value: _vm.username,
  44288. expression: "username"
  44289. }
  44290. ],
  44291. staticClass: "form-control",
  44292. attrs: {
  44293. id: "username",
  44294. type: "username",
  44295. required: "",
  44296. autofocus: ""
  44297. },
  44298. domProps: { value: _vm.username },
  44299. on: {
  44300. input: function($event) {
  44301. if ($event.target.composing) {
  44302. return
  44303. }
  44304. _vm.username = $event.target.value
  44305. }
  44306. }
  44307. })
  44308. ])
  44309. ]),
  44310. _vm._v(" "),
  44311. _c("div", { staticClass: "form-group row" }, [
  44312. _c(
  44313. "label",
  44314. {
  44315. staticClass: "col-md-4 col-form-label text-md-right",
  44316. attrs: { for: "password" }
  44317. },
  44318. [_vm._v("Password")]
  44319. ),
  44320. _vm._v(" "),
  44321. _c("div", { staticClass: "col-md-6" }, [
  44322. _c("input", {
  44323. directives: [
  44324. {
  44325. name: "model",
  44326. rawName: "v-model",
  44327. value: _vm.password,
  44328. expression: "password"
  44329. }
  44330. ],
  44331. staticClass: "form-control",
  44332. attrs: { id: "password", type: "password", required: "" },
  44333. domProps: { value: _vm.password },
  44334. on: {
  44335. input: function($event) {
  44336. if ($event.target.composing) {
  44337. return
  44338. }
  44339. _vm.password = $event.target.value
  44340. }
  44341. }
  44342. })
  44343. ])
  44344. ]),
  44345. _vm._v(" "),
  44346. _c("div", { staticClass: "form-group row mb-0" }, [
  44347. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  44348. _c(
  44349. "button",
  44350. {
  44351. staticClass: "btn btn-primary",
  44352. attrs: { type: "submit" },
  44353. on: { click: _vm.handleSubmit }
  44354. },
  44355. [
  44356. _vm._v(
  44357. "\n Login\n "
  44358. )
  44359. ]
  44360. )
  44361. ])
  44362. ])
  44363. ])
  44364. ])
  44365. ])
  44366. ])
  44367. ])
  44368. ])
  44369. }
  44370. var staticRenderFns = []
  44371. render._withStripped = true
  44372. /***/ }),
  44373. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  44374. /*!*****************************************************************************************************************************************************************************************************************!*\
  44375. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  44376. \*****************************************************************************************************************************************************************************************************************/
  44377. /*! exports provided: render, staticRenderFns */
  44378. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44379. "use strict";
  44380. __webpack_require__.r(__webpack_exports__);
  44381. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44382. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44383. var render = function() {
  44384. var _vm = this
  44385. var _h = _vm.$createElement
  44386. var _c = _vm._self._c || _h
  44387. return _vm._m(0)
  44388. }
  44389. var staticRenderFns = [
  44390. function() {
  44391. var _vm = this
  44392. var _h = _vm.$createElement
  44393. var _c = _vm._self._c || _h
  44394. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  44395. _c("div", { staticClass: "content" }, [
  44396. _c("div", { staticClass: "m-b-md" }, [
  44397. _c("h2", { staticClass: "title m-b-md" }, [
  44398. _vm._v("\n UPCCRT\n ")
  44399. ]),
  44400. _vm._v(" "),
  44401. _c("h3", [
  44402. _vm._v(
  44403. "\n University PC Care Repair Tracker\n "
  44404. )
  44405. ])
  44406. ])
  44407. ])
  44408. ])
  44409. }
  44410. ]
  44411. render._withStripped = true
  44412. /***/ }),
  44413. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  44414. /*!*******************************************************************************************************************************************************************************************************!*\
  44415. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  44416. \*******************************************************************************************************************************************************************************************************/
  44417. /*! exports provided: render, staticRenderFns */
  44418. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44419. "use strict";
  44420. __webpack_require__.r(__webpack_exports__);
  44421. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44423. var render = function() {
  44424. var _vm = this
  44425. var _h = _vm.$createElement
  44426. var _c = _vm._self._c || _h
  44427. return _c("div", { staticClass: "container-fluid" }, [
  44428. _c("div", { staticClass: "row my-3" }, [
  44429. _vm._m(0),
  44430. _vm._v(" "),
  44431. _c("div", { staticClass: "col-lg-6" }, [
  44432. _c("div", { staticClass: "card h-100" }, [
  44433. _vm._m(1),
  44434. _vm._v(" "),
  44435. _c("div", { staticClass: "card-body" }, [
  44436. _c("div", { staticClass: "tab-content" }, [
  44437. _c(
  44438. "div",
  44439. {
  44440. staticClass: "tab-pane active",
  44441. attrs: {
  44442. id: "workordersumm",
  44443. role: "tabpanel",
  44444. "aria-labelledby": "workordersumm-tab"
  44445. }
  44446. },
  44447. [
  44448. !_vm.woLoading && !_vm.storesLoading
  44449. ? _c("work-order-info", {
  44450. attrs: {
  44451. "work-order": _vm.workOrder,
  44452. stores: _vm.stores
  44453. }
  44454. })
  44455. : _c("circle-spinner", { attrs: { color: "#663399" } })
  44456. ],
  44457. 1
  44458. ),
  44459. _vm._v(" "),
  44460. _c(
  44461. "div",
  44462. {
  44463. staticClass: "tab-pane",
  44464. attrs: {
  44465. id: "attachments",
  44466. role: "tabpanel",
  44467. "aria-labelledby": "attachments-tab"
  44468. }
  44469. },
  44470. [
  44471. _vm._v(
  44472. "\n TODO 2\n "
  44473. )
  44474. ]
  44475. )
  44476. ])
  44477. ])
  44478. ])
  44479. ])
  44480. ])
  44481. ])
  44482. }
  44483. var staticRenderFns = [
  44484. function() {
  44485. var _vm = this
  44486. var _h = _vm.$createElement
  44487. var _c = _vm._self._c || _h
  44488. return _c("div", { staticClass: "col-lg-6" }, [
  44489. _c("div", { staticClass: "card h-100" }, [
  44490. _c("div", { staticClass: "card-header text-right" }, [
  44491. _c(
  44492. "button",
  44493. {
  44494. staticClass: "btn btn-default xs-toggle",
  44495. attrs: {
  44496. type: "button",
  44497. "data-toggle": "collapse",
  44498. "data-target": "#assetTab"
  44499. }
  44500. },
  44501. [
  44502. _c("span", { staticClass: "sr-only" }, [
  44503. _vm._v("Toggle Navigation")
  44504. ]),
  44505. _vm._v(" "),
  44506. _c("span", { staticClass: "icon-bar" }),
  44507. _vm._v(" "),
  44508. _c("span", { staticClass: "icon-bar" }),
  44509. _vm._v(" "),
  44510. _c("span", { staticClass: "icon-bar" })
  44511. ]
  44512. ),
  44513. _vm._v(" "),
  44514. _c(
  44515. "ul",
  44516. {
  44517. staticClass:
  44518. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  44519. attrs: { id: "assetTab", role: "tablist" }
  44520. },
  44521. [
  44522. _c("li", { staticClass: "nav-item" }, [
  44523. _c(
  44524. "a",
  44525. {
  44526. staticClass: "nav-link active",
  44527. attrs: {
  44528. id: "assetinfo-tab",
  44529. "data-toggle": "pill",
  44530. href: "#assetinfo",
  44531. role: "tab",
  44532. "aria-controls": "assetinfo",
  44533. "aria-selected": "true"
  44534. }
  44535. },
  44536. [_vm._v("Hardware")]
  44537. )
  44538. ]),
  44539. _vm._v(" "),
  44540. _c("li", { staticClass: "nav-item" }, [
  44541. _c(
  44542. "a",
  44543. {
  44544. staticClass: "nav-link",
  44545. attrs: {
  44546. id: "credentials-tab",
  44547. "data-toggle": "pill",
  44548. href: "#credentials",
  44549. role: "tab",
  44550. "aria-controls": "credentials",
  44551. "aria-selected": "false"
  44552. }
  44553. },
  44554. [_vm._v("Credentials")]
  44555. )
  44556. ])
  44557. ]
  44558. )
  44559. ]),
  44560. _vm._v(" "),
  44561. _c("div", { staticClass: "card-body" }, [
  44562. _c("div", { staticClass: "tab-content" }, [
  44563. _c("div", {
  44564. staticClass: "tab-pane active",
  44565. attrs: {
  44566. id: "assetinfo",
  44567. role: "tabpanel",
  44568. "aria-labelledby": "assetinfo-tab"
  44569. }
  44570. })
  44571. ])
  44572. ])
  44573. ])
  44574. ])
  44575. },
  44576. function() {
  44577. var _vm = this
  44578. var _h = _vm.$createElement
  44579. var _c = _vm._self._c || _h
  44580. return _c("div", { staticClass: "card-header text-right" }, [
  44581. _c(
  44582. "button",
  44583. {
  44584. staticClass: "btn btn-default xs-toggle",
  44585. attrs: {
  44586. type: "button",
  44587. "data-toggle": "collapse",
  44588. "data-target": "#workorderTab"
  44589. }
  44590. },
  44591. [
  44592. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  44593. _vm._v(" "),
  44594. _c("span", { staticClass: "icon-bar" }),
  44595. _vm._v(" "),
  44596. _c("span", { staticClass: "icon-bar" }),
  44597. _vm._v(" "),
  44598. _c("span", { staticClass: "icon-bar" })
  44599. ]
  44600. ),
  44601. _vm._v(" "),
  44602. _c(
  44603. "ul",
  44604. {
  44605. staticClass:
  44606. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  44607. attrs: { id: "workorderTab", role: "tablist" }
  44608. },
  44609. [
  44610. _c("li", { staticClass: "nav-item" }, [
  44611. _c(
  44612. "a",
  44613. {
  44614. staticClass: "nav-link active",
  44615. attrs: {
  44616. id: "workordersumm-tab",
  44617. "data-toggle": "pill",
  44618. href: "#workordersumm",
  44619. role: "tab",
  44620. "aria-controls": "workordersumm",
  44621. "aria-selected": "true"
  44622. }
  44623. },
  44624. [_vm._v("Summary")]
  44625. )
  44626. ]),
  44627. _vm._v(" "),
  44628. _c("li", { staticClass: "nav-item" }, [
  44629. _c(
  44630. "a",
  44631. {
  44632. staticClass: "nav-link",
  44633. attrs: {
  44634. id: "attachments-tab",
  44635. "data-toggle": "pill",
  44636. href: "#attachments",
  44637. role: "tab",
  44638. "aria-controls": "attachments",
  44639. "aria-selected": "false"
  44640. }
  44641. },
  44642. [_vm._v("Attachments")]
  44643. )
  44644. ])
  44645. ]
  44646. )
  44647. ])
  44648. }
  44649. ]
  44650. render._withStripped = true
  44651. /***/ }),
  44652. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44653. /*!********************************************************************!*\
  44654. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44655. \********************************************************************/
  44656. /*! exports provided: default */
  44657. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44658. "use strict";
  44659. __webpack_require__.r(__webpack_exports__);
  44660. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44661. /* globals __VUE_SSR_CONTEXT__ */
  44662. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44663. // This module is a runtime utility for cleaner component module output and will
  44664. // be included in the final webpack user bundle.
  44665. function normalizeComponent (
  44666. scriptExports,
  44667. render,
  44668. staticRenderFns,
  44669. functionalTemplate,
  44670. injectStyles,
  44671. scopeId,
  44672. moduleIdentifier, /* server only */
  44673. shadowMode /* vue-cli only */
  44674. ) {
  44675. // Vue.extend constructor export interop
  44676. var options = typeof scriptExports === 'function'
  44677. ? scriptExports.options
  44678. : scriptExports
  44679. // render functions
  44680. if (render) {
  44681. options.render = render
  44682. options.staticRenderFns = staticRenderFns
  44683. options._compiled = true
  44684. }
  44685. // functional template
  44686. if (functionalTemplate) {
  44687. options.functional = true
  44688. }
  44689. // scopedId
  44690. if (scopeId) {
  44691. options._scopeId = 'data-v-' + scopeId
  44692. }
  44693. var hook
  44694. if (moduleIdentifier) { // server build
  44695. hook = function (context) {
  44696. // 2.3 injection
  44697. context =
  44698. context || // cached call
  44699. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44700. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44701. // 2.2 with runInNewContext: true
  44702. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44703. context = __VUE_SSR_CONTEXT__
  44704. }
  44705. // inject component styles
  44706. if (injectStyles) {
  44707. injectStyles.call(this, context)
  44708. }
  44709. // register component module identifier for async chunk inferrence
  44710. if (context && context._registeredComponents) {
  44711. context._registeredComponents.add(moduleIdentifier)
  44712. }
  44713. }
  44714. // used by ssr in case component is cached and beforeCreate
  44715. // never gets called
  44716. options._ssrRegister = hook
  44717. } else if (injectStyles) {
  44718. hook = shadowMode
  44719. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44720. : injectStyles
  44721. }
  44722. if (hook) {
  44723. if (options.functional) {
  44724. // for template-only hot-reload because in that case the render fn doesn't
  44725. // go through the normalizer
  44726. options._injectStyles = hook
  44727. // register for functioal component in vue file
  44728. var originalRender = options.render
  44729. options.render = function renderWithStyleInjection (h, context) {
  44730. hook.call(context)
  44731. return originalRender(h, context)
  44732. }
  44733. } else {
  44734. // inject component registration as beforeCreate hook
  44735. var existing = options.beforeCreate
  44736. options.beforeCreate = existing
  44737. ? [].concat(existing, hook)
  44738. : [hook]
  44739. }
  44740. }
  44741. return {
  44742. exports: scriptExports,
  44743. options: options
  44744. }
  44745. }
  44746. /***/ }),
  44747. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  44748. /*!********************************************************!*\
  44749. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  44750. \********************************************************/
  44751. /*! exports provided: default */
  44752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44753. "use strict";
  44754. __webpack_require__.r(__webpack_exports__);
  44755. /*!
  44756. * vue-router v3.1.6
  44757. * (c) 2020 Evan You
  44758. * @license MIT
  44759. */
  44760. /* */
  44761. function assert (condition, message) {
  44762. if (!condition) {
  44763. throw new Error(("[vue-router] " + message))
  44764. }
  44765. }
  44766. function warn (condition, message) {
  44767. if ( true && !condition) {
  44768. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  44769. }
  44770. }
  44771. function isError (err) {
  44772. return Object.prototype.toString.call(err).indexOf('Error') > -1
  44773. }
  44774. function isExtendedError (constructor, err) {
  44775. return (
  44776. err instanceof constructor ||
  44777. // _name is to support IE9 too
  44778. (err && (err.name === constructor.name || err._name === constructor._name))
  44779. )
  44780. }
  44781. function extend (a, b) {
  44782. for (var key in b) {
  44783. a[key] = b[key];
  44784. }
  44785. return a
  44786. }
  44787. var View = {
  44788. name: 'RouterView',
  44789. functional: true,
  44790. props: {
  44791. name: {
  44792. type: String,
  44793. default: 'default'
  44794. }
  44795. },
  44796. render: function render (_, ref) {
  44797. var props = ref.props;
  44798. var children = ref.children;
  44799. var parent = ref.parent;
  44800. var data = ref.data;
  44801. // used by devtools to display a router-view badge
  44802. data.routerView = true;
  44803. // directly use parent context's createElement() function
  44804. // so that components rendered by router-view can resolve named slots
  44805. var h = parent.$createElement;
  44806. var name = props.name;
  44807. var route = parent.$route;
  44808. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  44809. // determine current view depth, also check to see if the tree
  44810. // has been toggled inactive but kept-alive.
  44811. var depth = 0;
  44812. var inactive = false;
  44813. while (parent && parent._routerRoot !== parent) {
  44814. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  44815. if (vnodeData.routerView) {
  44816. depth++;
  44817. }
  44818. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  44819. inactive = true;
  44820. }
  44821. parent = parent.$parent;
  44822. }
  44823. data.routerViewDepth = depth;
  44824. // render previous view if the tree is inactive and kept-alive
  44825. if (inactive) {
  44826. var cachedData = cache[name];
  44827. var cachedComponent = cachedData && cachedData.component;
  44828. if (cachedComponent) {
  44829. // #2301
  44830. // pass props
  44831. if (cachedData.configProps) {
  44832. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  44833. }
  44834. return h(cachedComponent, data, children)
  44835. } else {
  44836. // render previous empty view
  44837. return h()
  44838. }
  44839. }
  44840. var matched = route.matched[depth];
  44841. var component = matched && matched.components[name];
  44842. // render empty node if no matched route or no config component
  44843. if (!matched || !component) {
  44844. cache[name] = null;
  44845. return h()
  44846. }
  44847. // cache component
  44848. cache[name] = { component: component };
  44849. // attach instance registration hook
  44850. // this will be called in the instance's injected lifecycle hooks
  44851. data.registerRouteInstance = function (vm, val) {
  44852. // val could be undefined for unregistration
  44853. var current = matched.instances[name];
  44854. if (
  44855. (val && current !== vm) ||
  44856. (!val && current === vm)
  44857. ) {
  44858. matched.instances[name] = val;
  44859. }
  44860. }
  44861. // also register instance in prepatch hook
  44862. // in case the same component instance is reused across different routes
  44863. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  44864. matched.instances[name] = vnode.componentInstance;
  44865. };
  44866. // register instance in init hook
  44867. // in case kept-alive component be actived when routes changed
  44868. data.hook.init = function (vnode) {
  44869. if (vnode.data.keepAlive &&
  44870. vnode.componentInstance &&
  44871. vnode.componentInstance !== matched.instances[name]
  44872. ) {
  44873. matched.instances[name] = vnode.componentInstance;
  44874. }
  44875. };
  44876. var configProps = matched.props && matched.props[name];
  44877. // save route and configProps in cachce
  44878. if (configProps) {
  44879. extend(cache[name], {
  44880. route: route,
  44881. configProps: configProps
  44882. });
  44883. fillPropsinData(component, data, route, configProps);
  44884. }
  44885. return h(component, data, children)
  44886. }
  44887. };
  44888. function fillPropsinData (component, data, route, configProps) {
  44889. // resolve props
  44890. var propsToPass = data.props = resolveProps(route, configProps);
  44891. if (propsToPass) {
  44892. // clone to prevent mutation
  44893. propsToPass = data.props = extend({}, propsToPass);
  44894. // pass non-declared props as attrs
  44895. var attrs = data.attrs = data.attrs || {};
  44896. for (var key in propsToPass) {
  44897. if (!component.props || !(key in component.props)) {
  44898. attrs[key] = propsToPass[key];
  44899. delete propsToPass[key];
  44900. }
  44901. }
  44902. }
  44903. }
  44904. function resolveProps (route, config) {
  44905. switch (typeof config) {
  44906. case 'undefined':
  44907. return
  44908. case 'object':
  44909. return config
  44910. case 'function':
  44911. return config(route)
  44912. case 'boolean':
  44913. return config ? route.params : undefined
  44914. default:
  44915. if (true) {
  44916. warn(
  44917. false,
  44918. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  44919. "expecting an object, function or boolean."
  44920. );
  44921. }
  44922. }
  44923. }
  44924. /* */
  44925. var encodeReserveRE = /[!'()*]/g;
  44926. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  44927. var commaRE = /%2C/g;
  44928. // fixed encodeURIComponent which is more conformant to RFC3986:
  44929. // - escapes [!'()*]
  44930. // - preserve commas
  44931. var encode = function (str) { return encodeURIComponent(str)
  44932. .replace(encodeReserveRE, encodeReserveReplacer)
  44933. .replace(commaRE, ','); };
  44934. var decode = decodeURIComponent;
  44935. function resolveQuery (
  44936. query,
  44937. extraQuery,
  44938. _parseQuery
  44939. ) {
  44940. if ( extraQuery === void 0 ) extraQuery = {};
  44941. var parse = _parseQuery || parseQuery;
  44942. var parsedQuery;
  44943. try {
  44944. parsedQuery = parse(query || '');
  44945. } catch (e) {
  44946. true && warn(false, e.message);
  44947. parsedQuery = {};
  44948. }
  44949. for (var key in extraQuery) {
  44950. parsedQuery[key] = extraQuery[key];
  44951. }
  44952. return parsedQuery
  44953. }
  44954. function parseQuery (query) {
  44955. var res = {};
  44956. query = query.trim().replace(/^(\?|#|&)/, '');
  44957. if (!query) {
  44958. return res
  44959. }
  44960. query.split('&').forEach(function (param) {
  44961. var parts = param.replace(/\+/g, ' ').split('=');
  44962. var key = decode(parts.shift());
  44963. var val = parts.length > 0
  44964. ? decode(parts.join('='))
  44965. : null;
  44966. if (res[key] === undefined) {
  44967. res[key] = val;
  44968. } else if (Array.isArray(res[key])) {
  44969. res[key].push(val);
  44970. } else {
  44971. res[key] = [res[key], val];
  44972. }
  44973. });
  44974. return res
  44975. }
  44976. function stringifyQuery (obj) {
  44977. var res = obj ? Object.keys(obj).map(function (key) {
  44978. var val = obj[key];
  44979. if (val === undefined) {
  44980. return ''
  44981. }
  44982. if (val === null) {
  44983. return encode(key)
  44984. }
  44985. if (Array.isArray(val)) {
  44986. var result = [];
  44987. val.forEach(function (val2) {
  44988. if (val2 === undefined) {
  44989. return
  44990. }
  44991. if (val2 === null) {
  44992. result.push(encode(key));
  44993. } else {
  44994. result.push(encode(key) + '=' + encode(val2));
  44995. }
  44996. });
  44997. return result.join('&')
  44998. }
  44999. return encode(key) + '=' + encode(val)
  45000. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  45001. return res ? ("?" + res) : ''
  45002. }
  45003. /* */
  45004. var trailingSlashRE = /\/?$/;
  45005. function createRoute (
  45006. record,
  45007. location,
  45008. redirectedFrom,
  45009. router
  45010. ) {
  45011. var stringifyQuery = router && router.options.stringifyQuery;
  45012. var query = location.query || {};
  45013. try {
  45014. query = clone(query);
  45015. } catch (e) {}
  45016. var route = {
  45017. name: location.name || (record && record.name),
  45018. meta: (record && record.meta) || {},
  45019. path: location.path || '/',
  45020. hash: location.hash || '',
  45021. query: query,
  45022. params: location.params || {},
  45023. fullPath: getFullPath(location, stringifyQuery),
  45024. matched: record ? formatMatch(record) : []
  45025. };
  45026. if (redirectedFrom) {
  45027. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  45028. }
  45029. return Object.freeze(route)
  45030. }
  45031. function clone (value) {
  45032. if (Array.isArray(value)) {
  45033. return value.map(clone)
  45034. } else if (value && typeof value === 'object') {
  45035. var res = {};
  45036. for (var key in value) {
  45037. res[key] = clone(value[key]);
  45038. }
  45039. return res
  45040. } else {
  45041. return value
  45042. }
  45043. }
  45044. // the starting route that represents the initial state
  45045. var START = createRoute(null, {
  45046. path: '/'
  45047. });
  45048. function formatMatch (record) {
  45049. var res = [];
  45050. while (record) {
  45051. res.unshift(record);
  45052. record = record.parent;
  45053. }
  45054. return res
  45055. }
  45056. function getFullPath (
  45057. ref,
  45058. _stringifyQuery
  45059. ) {
  45060. var path = ref.path;
  45061. var query = ref.query; if ( query === void 0 ) query = {};
  45062. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  45063. var stringify = _stringifyQuery || stringifyQuery;
  45064. return (path || '/') + stringify(query) + hash
  45065. }
  45066. function isSameRoute (a, b) {
  45067. if (b === START) {
  45068. return a === b
  45069. } else if (!b) {
  45070. return false
  45071. } else if (a.path && b.path) {
  45072. return (
  45073. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  45074. a.hash === b.hash &&
  45075. isObjectEqual(a.query, b.query)
  45076. )
  45077. } else if (a.name && b.name) {
  45078. return (
  45079. a.name === b.name &&
  45080. a.hash === b.hash &&
  45081. isObjectEqual(a.query, b.query) &&
  45082. isObjectEqual(a.params, b.params)
  45083. )
  45084. } else {
  45085. return false
  45086. }
  45087. }
  45088. function isObjectEqual (a, b) {
  45089. if ( a === void 0 ) a = {};
  45090. if ( b === void 0 ) b = {};
  45091. // handle null value #1566
  45092. if (!a || !b) { return a === b }
  45093. var aKeys = Object.keys(a);
  45094. var bKeys = Object.keys(b);
  45095. if (aKeys.length !== bKeys.length) {
  45096. return false
  45097. }
  45098. return aKeys.every(function (key) {
  45099. var aVal = a[key];
  45100. var bVal = b[key];
  45101. // check nested equality
  45102. if (typeof aVal === 'object' && typeof bVal === 'object') {
  45103. return isObjectEqual(aVal, bVal)
  45104. }
  45105. return String(aVal) === String(bVal)
  45106. })
  45107. }
  45108. function isIncludedRoute (current, target) {
  45109. return (
  45110. current.path.replace(trailingSlashRE, '/').indexOf(
  45111. target.path.replace(trailingSlashRE, '/')
  45112. ) === 0 &&
  45113. (!target.hash || current.hash === target.hash) &&
  45114. queryIncludes(current.query, target.query)
  45115. )
  45116. }
  45117. function queryIncludes (current, target) {
  45118. for (var key in target) {
  45119. if (!(key in current)) {
  45120. return false
  45121. }
  45122. }
  45123. return true
  45124. }
  45125. /* */
  45126. function resolvePath (
  45127. relative,
  45128. base,
  45129. append
  45130. ) {
  45131. var firstChar = relative.charAt(0);
  45132. if (firstChar === '/') {
  45133. return relative
  45134. }
  45135. if (firstChar === '?' || firstChar === '#') {
  45136. return base + relative
  45137. }
  45138. var stack = base.split('/');
  45139. // remove trailing segment if:
  45140. // - not appending
  45141. // - appending to trailing slash (last segment is empty)
  45142. if (!append || !stack[stack.length - 1]) {
  45143. stack.pop();
  45144. }
  45145. // resolve relative path
  45146. var segments = relative.replace(/^\//, '').split('/');
  45147. for (var i = 0; i < segments.length; i++) {
  45148. var segment = segments[i];
  45149. if (segment === '..') {
  45150. stack.pop();
  45151. } else if (segment !== '.') {
  45152. stack.push(segment);
  45153. }
  45154. }
  45155. // ensure leading slash
  45156. if (stack[0] !== '') {
  45157. stack.unshift('');
  45158. }
  45159. return stack.join('/')
  45160. }
  45161. function parsePath (path) {
  45162. var hash = '';
  45163. var query = '';
  45164. var hashIndex = path.indexOf('#');
  45165. if (hashIndex >= 0) {
  45166. hash = path.slice(hashIndex);
  45167. path = path.slice(0, hashIndex);
  45168. }
  45169. var queryIndex = path.indexOf('?');
  45170. if (queryIndex >= 0) {
  45171. query = path.slice(queryIndex + 1);
  45172. path = path.slice(0, queryIndex);
  45173. }
  45174. return {
  45175. path: path,
  45176. query: query,
  45177. hash: hash
  45178. }
  45179. }
  45180. function cleanPath (path) {
  45181. return path.replace(/\/\//g, '/')
  45182. }
  45183. var isarray = Array.isArray || function (arr) {
  45184. return Object.prototype.toString.call(arr) == '[object Array]';
  45185. };
  45186. /**
  45187. * Expose `pathToRegexp`.
  45188. */
  45189. var pathToRegexp_1 = pathToRegexp;
  45190. var parse_1 = parse;
  45191. var compile_1 = compile;
  45192. var tokensToFunction_1 = tokensToFunction;
  45193. var tokensToRegExp_1 = tokensToRegExp;
  45194. /**
  45195. * The main path matching regexp utility.
  45196. *
  45197. * @type {RegExp}
  45198. */
  45199. var PATH_REGEXP = new RegExp([
  45200. // Match escaped characters that would otherwise appear in future matches.
  45201. // This allows the user to escape special characters that won't transform.
  45202. '(\\\\.)',
  45203. // Match Express-style parameters and un-named parameters with a prefix
  45204. // and optional suffixes. Matches appear as:
  45205. //
  45206. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  45207. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  45208. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  45209. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  45210. ].join('|'), 'g');
  45211. /**
  45212. * Parse a string for the raw tokens.
  45213. *
  45214. * @param {string} str
  45215. * @param {Object=} options
  45216. * @return {!Array}
  45217. */
  45218. function parse (str, options) {
  45219. var tokens = [];
  45220. var key = 0;
  45221. var index = 0;
  45222. var path = '';
  45223. var defaultDelimiter = options && options.delimiter || '/';
  45224. var res;
  45225. while ((res = PATH_REGEXP.exec(str)) != null) {
  45226. var m = res[0];
  45227. var escaped = res[1];
  45228. var offset = res.index;
  45229. path += str.slice(index, offset);
  45230. index = offset + m.length;
  45231. // Ignore already escaped sequences.
  45232. if (escaped) {
  45233. path += escaped[1];
  45234. continue
  45235. }
  45236. var next = str[index];
  45237. var prefix = res[2];
  45238. var name = res[3];
  45239. var capture = res[4];
  45240. var group = res[5];
  45241. var modifier = res[6];
  45242. var asterisk = res[7];
  45243. // Push the current path onto the tokens.
  45244. if (path) {
  45245. tokens.push(path);
  45246. path = '';
  45247. }
  45248. var partial = prefix != null && next != null && next !== prefix;
  45249. var repeat = modifier === '+' || modifier === '*';
  45250. var optional = modifier === '?' || modifier === '*';
  45251. var delimiter = res[2] || defaultDelimiter;
  45252. var pattern = capture || group;
  45253. tokens.push({
  45254. name: name || key++,
  45255. prefix: prefix || '',
  45256. delimiter: delimiter,
  45257. optional: optional,
  45258. repeat: repeat,
  45259. partial: partial,
  45260. asterisk: !!asterisk,
  45261. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  45262. });
  45263. }
  45264. // Match any characters still remaining.
  45265. if (index < str.length) {
  45266. path += str.substr(index);
  45267. }
  45268. // If the path exists, push it onto the end.
  45269. if (path) {
  45270. tokens.push(path);
  45271. }
  45272. return tokens
  45273. }
  45274. /**
  45275. * Compile a string to a template function for the path.
  45276. *
  45277. * @param {string} str
  45278. * @param {Object=} options
  45279. * @return {!function(Object=, Object=)}
  45280. */
  45281. function compile (str, options) {
  45282. return tokensToFunction(parse(str, options))
  45283. }
  45284. /**
  45285. * Prettier encoding of URI path segments.
  45286. *
  45287. * @param {string}
  45288. * @return {string}
  45289. */
  45290. function encodeURIComponentPretty (str) {
  45291. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  45292. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45293. })
  45294. }
  45295. /**
  45296. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  45297. *
  45298. * @param {string}
  45299. * @return {string}
  45300. */
  45301. function encodeAsterisk (str) {
  45302. return encodeURI(str).replace(/[?#]/g, function (c) {
  45303. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45304. })
  45305. }
  45306. /**
  45307. * Expose a method for transforming tokens into the path function.
  45308. */
  45309. function tokensToFunction (tokens) {
  45310. // Compile all the tokens into regexps.
  45311. var matches = new Array(tokens.length);
  45312. // Compile all the patterns before compilation.
  45313. for (var i = 0; i < tokens.length; i++) {
  45314. if (typeof tokens[i] === 'object') {
  45315. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  45316. }
  45317. }
  45318. return function (obj, opts) {
  45319. var path = '';
  45320. var data = obj || {};
  45321. var options = opts || {};
  45322. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  45323. for (var i = 0; i < tokens.length; i++) {
  45324. var token = tokens[i];
  45325. if (typeof token === 'string') {
  45326. path += token;
  45327. continue
  45328. }
  45329. var value = data[token.name];
  45330. var segment;
  45331. if (value == null) {
  45332. if (token.optional) {
  45333. // Prepend partial segment prefixes.
  45334. if (token.partial) {
  45335. path += token.prefix;
  45336. }
  45337. continue
  45338. } else {
  45339. throw new TypeError('Expected "' + token.name + '" to be defined')
  45340. }
  45341. }
  45342. if (isarray(value)) {
  45343. if (!token.repeat) {
  45344. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  45345. }
  45346. if (value.length === 0) {
  45347. if (token.optional) {
  45348. continue
  45349. } else {
  45350. throw new TypeError('Expected "' + token.name + '" to not be empty')
  45351. }
  45352. }
  45353. for (var j = 0; j < value.length; j++) {
  45354. segment = encode(value[j]);
  45355. if (!matches[i].test(segment)) {
  45356. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  45357. }
  45358. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  45359. }
  45360. continue
  45361. }
  45362. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  45363. if (!matches[i].test(segment)) {
  45364. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  45365. }
  45366. path += token.prefix + segment;
  45367. }
  45368. return path
  45369. }
  45370. }
  45371. /**
  45372. * Escape a regular expression string.
  45373. *
  45374. * @param {string} str
  45375. * @return {string}
  45376. */
  45377. function escapeString (str) {
  45378. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  45379. }
  45380. /**
  45381. * Escape the capturing group by escaping special characters and meaning.
  45382. *
  45383. * @param {string} group
  45384. * @return {string}
  45385. */
  45386. function escapeGroup (group) {
  45387. return group.replace(/([=!:$\/()])/g, '\\$1')
  45388. }
  45389. /**
  45390. * Attach the keys as a property of the regexp.
  45391. *
  45392. * @param {!RegExp} re
  45393. * @param {Array} keys
  45394. * @return {!RegExp}
  45395. */
  45396. function attachKeys (re, keys) {
  45397. re.keys = keys;
  45398. return re
  45399. }
  45400. /**
  45401. * Get the flags for a regexp from the options.
  45402. *
  45403. * @param {Object} options
  45404. * @return {string}
  45405. */
  45406. function flags (options) {
  45407. return options.sensitive ? '' : 'i'
  45408. }
  45409. /**
  45410. * Pull out keys from a regexp.
  45411. *
  45412. * @param {!RegExp} path
  45413. * @param {!Array} keys
  45414. * @return {!RegExp}
  45415. */
  45416. function regexpToRegexp (path, keys) {
  45417. // Use a negative lookahead to match only capturing groups.
  45418. var groups = path.source.match(/\((?!\?)/g);
  45419. if (groups) {
  45420. for (var i = 0; i < groups.length; i++) {
  45421. keys.push({
  45422. name: i,
  45423. prefix: null,
  45424. delimiter: null,
  45425. optional: false,
  45426. repeat: false,
  45427. partial: false,
  45428. asterisk: false,
  45429. pattern: null
  45430. });
  45431. }
  45432. }
  45433. return attachKeys(path, keys)
  45434. }
  45435. /**
  45436. * Transform an array into a regexp.
  45437. *
  45438. * @param {!Array} path
  45439. * @param {Array} keys
  45440. * @param {!Object} options
  45441. * @return {!RegExp}
  45442. */
  45443. function arrayToRegexp (path, keys, options) {
  45444. var parts = [];
  45445. for (var i = 0; i < path.length; i++) {
  45446. parts.push(pathToRegexp(path[i], keys, options).source);
  45447. }
  45448. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  45449. return attachKeys(regexp, keys)
  45450. }
  45451. /**
  45452. * Create a path regexp from string input.
  45453. *
  45454. * @param {string} path
  45455. * @param {!Array} keys
  45456. * @param {!Object} options
  45457. * @return {!RegExp}
  45458. */
  45459. function stringToRegexp (path, keys, options) {
  45460. return tokensToRegExp(parse(path, options), keys, options)
  45461. }
  45462. /**
  45463. * Expose a function for taking tokens and returning a RegExp.
  45464. *
  45465. * @param {!Array} tokens
  45466. * @param {(Array|Object)=} keys
  45467. * @param {Object=} options
  45468. * @return {!RegExp}
  45469. */
  45470. function tokensToRegExp (tokens, keys, options) {
  45471. if (!isarray(keys)) {
  45472. options = /** @type {!Object} */ (keys || options);
  45473. keys = [];
  45474. }
  45475. options = options || {};
  45476. var strict = options.strict;
  45477. var end = options.end !== false;
  45478. var route = '';
  45479. // Iterate over the tokens and create our regexp string.
  45480. for (var i = 0; i < tokens.length; i++) {
  45481. var token = tokens[i];
  45482. if (typeof token === 'string') {
  45483. route += escapeString(token);
  45484. } else {
  45485. var prefix = escapeString(token.prefix);
  45486. var capture = '(?:' + token.pattern + ')';
  45487. keys.push(token);
  45488. if (token.repeat) {
  45489. capture += '(?:' + prefix + capture + ')*';
  45490. }
  45491. if (token.optional) {
  45492. if (!token.partial) {
  45493. capture = '(?:' + prefix + '(' + capture + '))?';
  45494. } else {
  45495. capture = prefix + '(' + capture + ')?';
  45496. }
  45497. } else {
  45498. capture = prefix + '(' + capture + ')';
  45499. }
  45500. route += capture;
  45501. }
  45502. }
  45503. var delimiter = escapeString(options.delimiter || '/');
  45504. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  45505. // In non-strict mode we allow a slash at the end of match. If the path to
  45506. // match already ends with a slash, we remove it for consistency. The slash
  45507. // is valid at the end of a path match, not in the middle. This is important
  45508. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  45509. if (!strict) {
  45510. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  45511. }
  45512. if (end) {
  45513. route += '$';
  45514. } else {
  45515. // In non-ending mode, we need the capturing groups to match as much as
  45516. // possible by using a positive lookahead to the end or next path segment.
  45517. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  45518. }
  45519. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  45520. }
  45521. /**
  45522. * Normalize the given path string, returning a regular expression.
  45523. *
  45524. * An empty array can be passed in for the keys, which will hold the
  45525. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  45526. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  45527. *
  45528. * @param {(string|RegExp|Array)} path
  45529. * @param {(Array|Object)=} keys
  45530. * @param {Object=} options
  45531. * @return {!RegExp}
  45532. */
  45533. function pathToRegexp (path, keys, options) {
  45534. if (!isarray(keys)) {
  45535. options = /** @type {!Object} */ (keys || options);
  45536. keys = [];
  45537. }
  45538. options = options || {};
  45539. if (path instanceof RegExp) {
  45540. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  45541. }
  45542. if (isarray(path)) {
  45543. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  45544. }
  45545. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  45546. }
  45547. pathToRegexp_1.parse = parse_1;
  45548. pathToRegexp_1.compile = compile_1;
  45549. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  45550. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  45551. /* */
  45552. // $flow-disable-line
  45553. var regexpCompileCache = Object.create(null);
  45554. function fillParams (
  45555. path,
  45556. params,
  45557. routeMsg
  45558. ) {
  45559. params = params || {};
  45560. try {
  45561. var filler =
  45562. regexpCompileCache[path] ||
  45563. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  45564. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  45565. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  45566. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  45567. return filler(params, { pretty: true })
  45568. } catch (e) {
  45569. if (true) {
  45570. // Fix #3072 no warn if `pathMatch` is string
  45571. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  45572. }
  45573. return ''
  45574. } finally {
  45575. // delete the 0 if it was added
  45576. delete params[0];
  45577. }
  45578. }
  45579. /* */
  45580. function normalizeLocation (
  45581. raw,
  45582. current,
  45583. append,
  45584. router
  45585. ) {
  45586. var next = typeof raw === 'string' ? { path: raw } : raw;
  45587. // named target
  45588. if (next._normalized) {
  45589. return next
  45590. } else if (next.name) {
  45591. next = extend({}, raw);
  45592. var params = next.params;
  45593. if (params && typeof params === 'object') {
  45594. next.params = extend({}, params);
  45595. }
  45596. return next
  45597. }
  45598. // relative params
  45599. if (!next.path && next.params && current) {
  45600. next = extend({}, next);
  45601. next._normalized = true;
  45602. var params$1 = extend(extend({}, current.params), next.params);
  45603. if (current.name) {
  45604. next.name = current.name;
  45605. next.params = params$1;
  45606. } else if (current.matched.length) {
  45607. var rawPath = current.matched[current.matched.length - 1].path;
  45608. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  45609. } else if (true) {
  45610. warn(false, "relative params navigation requires a current route.");
  45611. }
  45612. return next
  45613. }
  45614. var parsedPath = parsePath(next.path || '');
  45615. var basePath = (current && current.path) || '/';
  45616. var path = parsedPath.path
  45617. ? resolvePath(parsedPath.path, basePath, append || next.append)
  45618. : basePath;
  45619. var query = resolveQuery(
  45620. parsedPath.query,
  45621. next.query,
  45622. router && router.options.parseQuery
  45623. );
  45624. var hash = next.hash || parsedPath.hash;
  45625. if (hash && hash.charAt(0) !== '#') {
  45626. hash = "#" + hash;
  45627. }
  45628. return {
  45629. _normalized: true,
  45630. path: path,
  45631. query: query,
  45632. hash: hash
  45633. }
  45634. }
  45635. /* */
  45636. // work around weird flow bug
  45637. var toTypes = [String, Object];
  45638. var eventTypes = [String, Array];
  45639. var noop = function () {};
  45640. var Link = {
  45641. name: 'RouterLink',
  45642. props: {
  45643. to: {
  45644. type: toTypes,
  45645. required: true
  45646. },
  45647. tag: {
  45648. type: String,
  45649. default: 'a'
  45650. },
  45651. exact: Boolean,
  45652. append: Boolean,
  45653. replace: Boolean,
  45654. activeClass: String,
  45655. exactActiveClass: String,
  45656. event: {
  45657. type: eventTypes,
  45658. default: 'click'
  45659. }
  45660. },
  45661. render: function render (h) {
  45662. var this$1 = this;
  45663. var router = this.$router;
  45664. var current = this.$route;
  45665. var ref = router.resolve(
  45666. this.to,
  45667. current,
  45668. this.append
  45669. );
  45670. var location = ref.location;
  45671. var route = ref.route;
  45672. var href = ref.href;
  45673. var classes = {};
  45674. var globalActiveClass = router.options.linkActiveClass;
  45675. var globalExactActiveClass = router.options.linkExactActiveClass;
  45676. // Support global empty active class
  45677. var activeClassFallback =
  45678. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  45679. var exactActiveClassFallback =
  45680. globalExactActiveClass == null
  45681. ? 'router-link-exact-active'
  45682. : globalExactActiveClass;
  45683. var activeClass =
  45684. this.activeClass == null ? activeClassFallback : this.activeClass;
  45685. var exactActiveClass =
  45686. this.exactActiveClass == null
  45687. ? exactActiveClassFallback
  45688. : this.exactActiveClass;
  45689. var compareTarget = route.redirectedFrom
  45690. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  45691. : route;
  45692. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  45693. classes[activeClass] = this.exact
  45694. ? classes[exactActiveClass]
  45695. : isIncludedRoute(current, compareTarget);
  45696. var handler = function (e) {
  45697. if (guardEvent(e)) {
  45698. if (this$1.replace) {
  45699. router.replace(location, noop);
  45700. } else {
  45701. router.push(location, noop);
  45702. }
  45703. }
  45704. };
  45705. var on = { click: guardEvent };
  45706. if (Array.isArray(this.event)) {
  45707. this.event.forEach(function (e) {
  45708. on[e] = handler;
  45709. });
  45710. } else {
  45711. on[this.event] = handler;
  45712. }
  45713. var data = { class: classes };
  45714. var scopedSlot =
  45715. !this.$scopedSlots.$hasNormal &&
  45716. this.$scopedSlots.default &&
  45717. this.$scopedSlots.default({
  45718. href: href,
  45719. route: route,
  45720. navigate: handler,
  45721. isActive: classes[activeClass],
  45722. isExactActive: classes[exactActiveClass]
  45723. });
  45724. if (scopedSlot) {
  45725. if (scopedSlot.length === 1) {
  45726. return scopedSlot[0]
  45727. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  45728. if (true) {
  45729. warn(
  45730. false,
  45731. ("RouterLink with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.")
  45732. );
  45733. }
  45734. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  45735. }
  45736. }
  45737. if (this.tag === 'a') {
  45738. data.on = on;
  45739. data.attrs = { href: href };
  45740. } else {
  45741. // find the first <a> child and apply listener and href
  45742. var a = findAnchor(this.$slots.default);
  45743. if (a) {
  45744. // in case the <a> is a static node
  45745. a.isStatic = false;
  45746. var aData = (a.data = extend({}, a.data));
  45747. aData.on = aData.on || {};
  45748. // transform existing events in both objects into arrays so we can push later
  45749. for (var event in aData.on) {
  45750. var handler$1 = aData.on[event];
  45751. if (event in on) {
  45752. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  45753. }
  45754. }
  45755. // append new listeners for router-link
  45756. for (var event$1 in on) {
  45757. if (event$1 in aData.on) {
  45758. // on[event] is always a function
  45759. aData.on[event$1].push(on[event$1]);
  45760. } else {
  45761. aData.on[event$1] = handler;
  45762. }
  45763. }
  45764. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  45765. aAttrs.href = href;
  45766. } else {
  45767. // doesn't have <a> child, apply listener to self
  45768. data.on = on;
  45769. }
  45770. }
  45771. return h(this.tag, data, this.$slots.default)
  45772. }
  45773. };
  45774. function guardEvent (e) {
  45775. // don't redirect with control keys
  45776. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  45777. // don't redirect when preventDefault called
  45778. if (e.defaultPrevented) { return }
  45779. // don't redirect on right click
  45780. if (e.button !== undefined && e.button !== 0) { return }
  45781. // don't redirect if `target="_blank"`
  45782. if (e.currentTarget && e.currentTarget.getAttribute) {
  45783. var target = e.currentTarget.getAttribute('target');
  45784. if (/\b_blank\b/i.test(target)) { return }
  45785. }
  45786. // this may be a Weex event which doesn't have this method
  45787. if (e.preventDefault) {
  45788. e.preventDefault();
  45789. }
  45790. return true
  45791. }
  45792. function findAnchor (children) {
  45793. if (children) {
  45794. var child;
  45795. for (var i = 0; i < children.length; i++) {
  45796. child = children[i];
  45797. if (child.tag === 'a') {
  45798. return child
  45799. }
  45800. if (child.children && (child = findAnchor(child.children))) {
  45801. return child
  45802. }
  45803. }
  45804. }
  45805. }
  45806. var _Vue;
  45807. function install (Vue) {
  45808. if (install.installed && _Vue === Vue) { return }
  45809. install.installed = true;
  45810. _Vue = Vue;
  45811. var isDef = function (v) { return v !== undefined; };
  45812. var registerInstance = function (vm, callVal) {
  45813. var i = vm.$options._parentVnode;
  45814. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  45815. i(vm, callVal);
  45816. }
  45817. };
  45818. Vue.mixin({
  45819. beforeCreate: function beforeCreate () {
  45820. if (isDef(this.$options.router)) {
  45821. this._routerRoot = this;
  45822. this._router = this.$options.router;
  45823. this._router.init(this);
  45824. Vue.util.defineReactive(this, '_route', this._router.history.current);
  45825. } else {
  45826. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  45827. }
  45828. registerInstance(this, this);
  45829. },
  45830. destroyed: function destroyed () {
  45831. registerInstance(this);
  45832. }
  45833. });
  45834. Object.defineProperty(Vue.prototype, '$router', {
  45835. get: function get () { return this._routerRoot._router }
  45836. });
  45837. Object.defineProperty(Vue.prototype, '$route', {
  45838. get: function get () { return this._routerRoot._route }
  45839. });
  45840. Vue.component('RouterView', View);
  45841. Vue.component('RouterLink', Link);
  45842. var strats = Vue.config.optionMergeStrategies;
  45843. // use the same hook merging strategy for route hooks
  45844. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  45845. }
  45846. /* */
  45847. var inBrowser = typeof window !== 'undefined';
  45848. /* */
  45849. function createRouteMap (
  45850. routes,
  45851. oldPathList,
  45852. oldPathMap,
  45853. oldNameMap
  45854. ) {
  45855. // the path list is used to control path matching priority
  45856. var pathList = oldPathList || [];
  45857. // $flow-disable-line
  45858. var pathMap = oldPathMap || Object.create(null);
  45859. // $flow-disable-line
  45860. var nameMap = oldNameMap || Object.create(null);
  45861. routes.forEach(function (route) {
  45862. addRouteRecord(pathList, pathMap, nameMap, route);
  45863. });
  45864. // ensure wildcard routes are always at the end
  45865. for (var i = 0, l = pathList.length; i < l; i++) {
  45866. if (pathList[i] === '*') {
  45867. pathList.push(pathList.splice(i, 1)[0]);
  45868. l--;
  45869. i--;
  45870. }
  45871. }
  45872. if (true) {
  45873. // warn if routes do not include leading slashes
  45874. var found = pathList
  45875. // check for missing leading slash
  45876. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  45877. if (found.length > 0) {
  45878. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  45879. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  45880. }
  45881. }
  45882. return {
  45883. pathList: pathList,
  45884. pathMap: pathMap,
  45885. nameMap: nameMap
  45886. }
  45887. }
  45888. function addRouteRecord (
  45889. pathList,
  45890. pathMap,
  45891. nameMap,
  45892. route,
  45893. parent,
  45894. matchAs
  45895. ) {
  45896. var path = route.path;
  45897. var name = route.name;
  45898. if (true) {
  45899. assert(path != null, "\"path\" is required in a route configuration.");
  45900. assert(
  45901. typeof route.component !== 'string',
  45902. "route config \"component\" for path: " + (String(
  45903. path || name
  45904. )) + " cannot be a " + "string id. Use an actual component instead."
  45905. );
  45906. }
  45907. var pathToRegexpOptions =
  45908. route.pathToRegexpOptions || {};
  45909. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  45910. if (typeof route.caseSensitive === 'boolean') {
  45911. pathToRegexpOptions.sensitive = route.caseSensitive;
  45912. }
  45913. var record = {
  45914. path: normalizedPath,
  45915. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  45916. components: route.components || { default: route.component },
  45917. instances: {},
  45918. name: name,
  45919. parent: parent,
  45920. matchAs: matchAs,
  45921. redirect: route.redirect,
  45922. beforeEnter: route.beforeEnter,
  45923. meta: route.meta || {},
  45924. props:
  45925. route.props == null
  45926. ? {}
  45927. : route.components
  45928. ? route.props
  45929. : { default: route.props }
  45930. };
  45931. if (route.children) {
  45932. // Warn if route is named, does not redirect and has a default child route.
  45933. // If users navigate to this route by name, the default child will
  45934. // not be rendered (GH Issue #629)
  45935. if (true) {
  45936. if (
  45937. route.name &&
  45938. !route.redirect &&
  45939. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  45940. ) {
  45941. warn(
  45942. false,
  45943. "Named Route '" + (route.name) + "' has a default child route. " +
  45944. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  45945. "the default child route will not be rendered. Remove the name from " +
  45946. "this route and use the name of the default child route for named " +
  45947. "links instead."
  45948. );
  45949. }
  45950. }
  45951. route.children.forEach(function (child) {
  45952. var childMatchAs = matchAs
  45953. ? cleanPath((matchAs + "/" + (child.path)))
  45954. : undefined;
  45955. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  45956. });
  45957. }
  45958. if (!pathMap[record.path]) {
  45959. pathList.push(record.path);
  45960. pathMap[record.path] = record;
  45961. }
  45962. if (route.alias !== undefined) {
  45963. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  45964. for (var i = 0; i < aliases.length; ++i) {
  45965. var alias = aliases[i];
  45966. if ( true && alias === path) {
  45967. warn(
  45968. false,
  45969. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  45970. );
  45971. // skip in dev to make it work
  45972. continue
  45973. }
  45974. var aliasRoute = {
  45975. path: alias,
  45976. children: route.children
  45977. };
  45978. addRouteRecord(
  45979. pathList,
  45980. pathMap,
  45981. nameMap,
  45982. aliasRoute,
  45983. parent,
  45984. record.path || '/' // matchAs
  45985. );
  45986. }
  45987. }
  45988. if (name) {
  45989. if (!nameMap[name]) {
  45990. nameMap[name] = record;
  45991. } else if ( true && !matchAs) {
  45992. warn(
  45993. false,
  45994. "Duplicate named routes definition: " +
  45995. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  45996. );
  45997. }
  45998. }
  45999. }
  46000. function compileRouteRegex (
  46001. path,
  46002. pathToRegexpOptions
  46003. ) {
  46004. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  46005. if (true) {
  46006. var keys = Object.create(null);
  46007. regex.keys.forEach(function (key) {
  46008. warn(
  46009. !keys[key.name],
  46010. ("Duplicate param keys in route with path: \"" + path + "\"")
  46011. );
  46012. keys[key.name] = true;
  46013. });
  46014. }
  46015. return regex
  46016. }
  46017. function normalizePath (
  46018. path,
  46019. parent,
  46020. strict
  46021. ) {
  46022. if (!strict) { path = path.replace(/\/$/, ''); }
  46023. if (path[0] === '/') { return path }
  46024. if (parent == null) { return path }
  46025. return cleanPath(((parent.path) + "/" + path))
  46026. }
  46027. /* */
  46028. function createMatcher (
  46029. routes,
  46030. router
  46031. ) {
  46032. var ref = createRouteMap(routes);
  46033. var pathList = ref.pathList;
  46034. var pathMap = ref.pathMap;
  46035. var nameMap = ref.nameMap;
  46036. function addRoutes (routes) {
  46037. createRouteMap(routes, pathList, pathMap, nameMap);
  46038. }
  46039. function match (
  46040. raw,
  46041. currentRoute,
  46042. redirectedFrom
  46043. ) {
  46044. var location = normalizeLocation(raw, currentRoute, false, router);
  46045. var name = location.name;
  46046. if (name) {
  46047. var record = nameMap[name];
  46048. if (true) {
  46049. warn(record, ("Route with name '" + name + "' does not exist"));
  46050. }
  46051. if (!record) { return _createRoute(null, location) }
  46052. var paramNames = record.regex.keys
  46053. .filter(function (key) { return !key.optional; })
  46054. .map(function (key) { return key.name; });
  46055. if (typeof location.params !== 'object') {
  46056. location.params = {};
  46057. }
  46058. if (currentRoute && typeof currentRoute.params === 'object') {
  46059. for (var key in currentRoute.params) {
  46060. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  46061. location.params[key] = currentRoute.params[key];
  46062. }
  46063. }
  46064. }
  46065. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  46066. return _createRoute(record, location, redirectedFrom)
  46067. } else if (location.path) {
  46068. location.params = {};
  46069. for (var i = 0; i < pathList.length; i++) {
  46070. var path = pathList[i];
  46071. var record$1 = pathMap[path];
  46072. if (matchRoute(record$1.regex, location.path, location.params)) {
  46073. return _createRoute(record$1, location, redirectedFrom)
  46074. }
  46075. }
  46076. }
  46077. // no match
  46078. return _createRoute(null, location)
  46079. }
  46080. function redirect (
  46081. record,
  46082. location
  46083. ) {
  46084. var originalRedirect = record.redirect;
  46085. var redirect = typeof originalRedirect === 'function'
  46086. ? originalRedirect(createRoute(record, location, null, router))
  46087. : originalRedirect;
  46088. if (typeof redirect === 'string') {
  46089. redirect = { path: redirect };
  46090. }
  46091. if (!redirect || typeof redirect !== 'object') {
  46092. if (true) {
  46093. warn(
  46094. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  46095. );
  46096. }
  46097. return _createRoute(null, location)
  46098. }
  46099. var re = redirect;
  46100. var name = re.name;
  46101. var path = re.path;
  46102. var query = location.query;
  46103. var hash = location.hash;
  46104. var params = location.params;
  46105. query = re.hasOwnProperty('query') ? re.query : query;
  46106. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  46107. params = re.hasOwnProperty('params') ? re.params : params;
  46108. if (name) {
  46109. // resolved named direct
  46110. var targetRecord = nameMap[name];
  46111. if (true) {
  46112. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  46113. }
  46114. return match({
  46115. _normalized: true,
  46116. name: name,
  46117. query: query,
  46118. hash: hash,
  46119. params: params
  46120. }, undefined, location)
  46121. } else if (path) {
  46122. // 1. resolve relative redirect
  46123. var rawPath = resolveRecordPath(path, record);
  46124. // 2. resolve params
  46125. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  46126. // 3. rematch with existing query and hash
  46127. return match({
  46128. _normalized: true,
  46129. path: resolvedPath,
  46130. query: query,
  46131. hash: hash
  46132. }, undefined, location)
  46133. } else {
  46134. if (true) {
  46135. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  46136. }
  46137. return _createRoute(null, location)
  46138. }
  46139. }
  46140. function alias (
  46141. record,
  46142. location,
  46143. matchAs
  46144. ) {
  46145. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  46146. var aliasedMatch = match({
  46147. _normalized: true,
  46148. path: aliasedPath
  46149. });
  46150. if (aliasedMatch) {
  46151. var matched = aliasedMatch.matched;
  46152. var aliasedRecord = matched[matched.length - 1];
  46153. location.params = aliasedMatch.params;
  46154. return _createRoute(aliasedRecord, location)
  46155. }
  46156. return _createRoute(null, location)
  46157. }
  46158. function _createRoute (
  46159. record,
  46160. location,
  46161. redirectedFrom
  46162. ) {
  46163. if (record && record.redirect) {
  46164. return redirect(record, redirectedFrom || location)
  46165. }
  46166. if (record && record.matchAs) {
  46167. return alias(record, location, record.matchAs)
  46168. }
  46169. return createRoute(record, location, redirectedFrom, router)
  46170. }
  46171. return {
  46172. match: match,
  46173. addRoutes: addRoutes
  46174. }
  46175. }
  46176. function matchRoute (
  46177. regex,
  46178. path,
  46179. params
  46180. ) {
  46181. var m = path.match(regex);
  46182. if (!m) {
  46183. return false
  46184. } else if (!params) {
  46185. return true
  46186. }
  46187. for (var i = 1, len = m.length; i < len; ++i) {
  46188. var key = regex.keys[i - 1];
  46189. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  46190. if (key) {
  46191. // Fix #1994: using * with props: true generates a param named 0
  46192. params[key.name || 'pathMatch'] = val;
  46193. }
  46194. }
  46195. return true
  46196. }
  46197. function resolveRecordPath (path, record) {
  46198. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  46199. }
  46200. /* */
  46201. // use User Timing api (if present) for more accurate key precision
  46202. var Time =
  46203. inBrowser && window.performance && window.performance.now
  46204. ? window.performance
  46205. : Date;
  46206. function genStateKey () {
  46207. return Time.now().toFixed(3)
  46208. }
  46209. var _key = genStateKey();
  46210. function getStateKey () {
  46211. return _key
  46212. }
  46213. function setStateKey (key) {
  46214. return (_key = key)
  46215. }
  46216. /* */
  46217. var positionStore = Object.create(null);
  46218. function setupScroll () {
  46219. // Fix for #1585 for Firefox
  46220. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  46221. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  46222. // window.location.protocol + '//' + window.location.host
  46223. // location.host contains the port and location.hostname doesn't
  46224. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  46225. var absolutePath = window.location.href.replace(protocolAndPath, '');
  46226. // preserve existing history state as it could be overriden by the user
  46227. var stateCopy = extend({}, window.history.state);
  46228. stateCopy.key = getStateKey();
  46229. window.history.replaceState(stateCopy, '', absolutePath);
  46230. window.addEventListener('popstate', function (e) {
  46231. saveScrollPosition();
  46232. if (e.state && e.state.key) {
  46233. setStateKey(e.state.key);
  46234. }
  46235. });
  46236. }
  46237. function handleScroll (
  46238. router,
  46239. to,
  46240. from,
  46241. isPop
  46242. ) {
  46243. if (!router.app) {
  46244. return
  46245. }
  46246. var behavior = router.options.scrollBehavior;
  46247. if (!behavior) {
  46248. return
  46249. }
  46250. if (true) {
  46251. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  46252. }
  46253. // wait until re-render finishes before scrolling
  46254. router.app.$nextTick(function () {
  46255. var position = getScrollPosition();
  46256. var shouldScroll = behavior.call(
  46257. router,
  46258. to,
  46259. from,
  46260. isPop ? position : null
  46261. );
  46262. if (!shouldScroll) {
  46263. return
  46264. }
  46265. if (typeof shouldScroll.then === 'function') {
  46266. shouldScroll
  46267. .then(function (shouldScroll) {
  46268. scrollToPosition((shouldScroll), position);
  46269. })
  46270. .catch(function (err) {
  46271. if (true) {
  46272. assert(false, err.toString());
  46273. }
  46274. });
  46275. } else {
  46276. scrollToPosition(shouldScroll, position);
  46277. }
  46278. });
  46279. }
  46280. function saveScrollPosition () {
  46281. var key = getStateKey();
  46282. if (key) {
  46283. positionStore[key] = {
  46284. x: window.pageXOffset,
  46285. y: window.pageYOffset
  46286. };
  46287. }
  46288. }
  46289. function getScrollPosition () {
  46290. var key = getStateKey();
  46291. if (key) {
  46292. return positionStore[key]
  46293. }
  46294. }
  46295. function getElementPosition (el, offset) {
  46296. var docEl = document.documentElement;
  46297. var docRect = docEl.getBoundingClientRect();
  46298. var elRect = el.getBoundingClientRect();
  46299. return {
  46300. x: elRect.left - docRect.left - offset.x,
  46301. y: elRect.top - docRect.top - offset.y
  46302. }
  46303. }
  46304. function isValidPosition (obj) {
  46305. return isNumber(obj.x) || isNumber(obj.y)
  46306. }
  46307. function normalizePosition (obj) {
  46308. return {
  46309. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  46310. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  46311. }
  46312. }
  46313. function normalizeOffset (obj) {
  46314. return {
  46315. x: isNumber(obj.x) ? obj.x : 0,
  46316. y: isNumber(obj.y) ? obj.y : 0
  46317. }
  46318. }
  46319. function isNumber (v) {
  46320. return typeof v === 'number'
  46321. }
  46322. var hashStartsWithNumberRE = /^#\d/;
  46323. function scrollToPosition (shouldScroll, position) {
  46324. var isObject = typeof shouldScroll === 'object';
  46325. if (isObject && typeof shouldScroll.selector === 'string') {
  46326. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  46327. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  46328. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  46329. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  46330. : document.querySelector(shouldScroll.selector);
  46331. if (el) {
  46332. var offset =
  46333. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  46334. ? shouldScroll.offset
  46335. : {};
  46336. offset = normalizeOffset(offset);
  46337. position = getElementPosition(el, offset);
  46338. } else if (isValidPosition(shouldScroll)) {
  46339. position = normalizePosition(shouldScroll);
  46340. }
  46341. } else if (isObject && isValidPosition(shouldScroll)) {
  46342. position = normalizePosition(shouldScroll);
  46343. }
  46344. if (position) {
  46345. window.scrollTo(position.x, position.y);
  46346. }
  46347. }
  46348. /* */
  46349. var supportsPushState =
  46350. inBrowser &&
  46351. (function () {
  46352. var ua = window.navigator.userAgent;
  46353. if (
  46354. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  46355. ua.indexOf('Mobile Safari') !== -1 &&
  46356. ua.indexOf('Chrome') === -1 &&
  46357. ua.indexOf('Windows Phone') === -1
  46358. ) {
  46359. return false
  46360. }
  46361. return window.history && 'pushState' in window.history
  46362. })();
  46363. function pushState (url, replace) {
  46364. saveScrollPosition();
  46365. // try...catch the pushState call to get around Safari
  46366. // DOM Exception 18 where it limits to 100 pushState calls
  46367. var history = window.history;
  46368. try {
  46369. if (replace) {
  46370. // preserve existing history state as it could be overriden by the user
  46371. var stateCopy = extend({}, history.state);
  46372. stateCopy.key = getStateKey();
  46373. history.replaceState(stateCopy, '', url);
  46374. } else {
  46375. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  46376. }
  46377. } catch (e) {
  46378. window.location[replace ? 'replace' : 'assign'](url);
  46379. }
  46380. }
  46381. function replaceState (url) {
  46382. pushState(url, true);
  46383. }
  46384. /* */
  46385. function runQueue (queue, fn, cb) {
  46386. var step = function (index) {
  46387. if (index >= queue.length) {
  46388. cb();
  46389. } else {
  46390. if (queue[index]) {
  46391. fn(queue[index], function () {
  46392. step(index + 1);
  46393. });
  46394. } else {
  46395. step(index + 1);
  46396. }
  46397. }
  46398. };
  46399. step(0);
  46400. }
  46401. /* */
  46402. function resolveAsyncComponents (matched) {
  46403. return function (to, from, next) {
  46404. var hasAsync = false;
  46405. var pending = 0;
  46406. var error = null;
  46407. flatMapComponents(matched, function (def, _, match, key) {
  46408. // if it's a function and doesn't have cid attached,
  46409. // assume it's an async component resolve function.
  46410. // we are not using Vue's default async resolving mechanism because
  46411. // we want to halt the navigation until the incoming component has been
  46412. // resolved.
  46413. if (typeof def === 'function' && def.cid === undefined) {
  46414. hasAsync = true;
  46415. pending++;
  46416. var resolve = once(function (resolvedDef) {
  46417. if (isESModule(resolvedDef)) {
  46418. resolvedDef = resolvedDef.default;
  46419. }
  46420. // save resolved on async factory in case it's used elsewhere
  46421. def.resolved = typeof resolvedDef === 'function'
  46422. ? resolvedDef
  46423. : _Vue.extend(resolvedDef);
  46424. match.components[key] = resolvedDef;
  46425. pending--;
  46426. if (pending <= 0) {
  46427. next();
  46428. }
  46429. });
  46430. var reject = once(function (reason) {
  46431. var msg = "Failed to resolve async component " + key + ": " + reason;
  46432. true && warn(false, msg);
  46433. if (!error) {
  46434. error = isError(reason)
  46435. ? reason
  46436. : new Error(msg);
  46437. next(error);
  46438. }
  46439. });
  46440. var res;
  46441. try {
  46442. res = def(resolve, reject);
  46443. } catch (e) {
  46444. reject(e);
  46445. }
  46446. if (res) {
  46447. if (typeof res.then === 'function') {
  46448. res.then(resolve, reject);
  46449. } else {
  46450. // new syntax in Vue 2.3
  46451. var comp = res.component;
  46452. if (comp && typeof comp.then === 'function') {
  46453. comp.then(resolve, reject);
  46454. }
  46455. }
  46456. }
  46457. }
  46458. });
  46459. if (!hasAsync) { next(); }
  46460. }
  46461. }
  46462. function flatMapComponents (
  46463. matched,
  46464. fn
  46465. ) {
  46466. return flatten(matched.map(function (m) {
  46467. return Object.keys(m.components).map(function (key) { return fn(
  46468. m.components[key],
  46469. m.instances[key],
  46470. m, key
  46471. ); })
  46472. }))
  46473. }
  46474. function flatten (arr) {
  46475. return Array.prototype.concat.apply([], arr)
  46476. }
  46477. var hasSymbol =
  46478. typeof Symbol === 'function' &&
  46479. typeof Symbol.toStringTag === 'symbol';
  46480. function isESModule (obj) {
  46481. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  46482. }
  46483. // in Webpack 2, require.ensure now also returns a Promise
  46484. // so the resolve/reject functions may get called an extra time
  46485. // if the user uses an arrow function shorthand that happens to
  46486. // return that Promise.
  46487. function once (fn) {
  46488. var called = false;
  46489. return function () {
  46490. var args = [], len = arguments.length;
  46491. while ( len-- ) args[ len ] = arguments[ len ];
  46492. if (called) { return }
  46493. called = true;
  46494. return fn.apply(this, args)
  46495. }
  46496. }
  46497. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  46498. function NavigationDuplicated (normalizedLocation) {
  46499. Error.call(this);
  46500. this.name = this._name = 'NavigationDuplicated';
  46501. // passing the message to super() doesn't seem to work in the transpiled version
  46502. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  46503. // add a stack property so services like Sentry can correctly display it
  46504. Object.defineProperty(this, 'stack', {
  46505. value: new Error().stack,
  46506. writable: true,
  46507. configurable: true
  46508. });
  46509. // we could also have used
  46510. // Error.captureStackTrace(this, this.constructor)
  46511. // but it only exists on node and chrome
  46512. }
  46513. if ( Error ) NavigationDuplicated.__proto__ = Error;
  46514. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  46515. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  46516. return NavigationDuplicated;
  46517. }(Error));
  46518. // support IE9
  46519. NavigationDuplicated._name = 'NavigationDuplicated';
  46520. /* */
  46521. var History = function History (router, base) {
  46522. this.router = router;
  46523. this.base = normalizeBase(base);
  46524. // start with a route object that stands for "nowhere"
  46525. this.current = START;
  46526. this.pending = null;
  46527. this.ready = false;
  46528. this.readyCbs = [];
  46529. this.readyErrorCbs = [];
  46530. this.errorCbs = [];
  46531. };
  46532. History.prototype.listen = function listen (cb) {
  46533. this.cb = cb;
  46534. };
  46535. History.prototype.onReady = function onReady (cb, errorCb) {
  46536. if (this.ready) {
  46537. cb();
  46538. } else {
  46539. this.readyCbs.push(cb);
  46540. if (errorCb) {
  46541. this.readyErrorCbs.push(errorCb);
  46542. }
  46543. }
  46544. };
  46545. History.prototype.onError = function onError (errorCb) {
  46546. this.errorCbs.push(errorCb);
  46547. };
  46548. History.prototype.transitionTo = function transitionTo (
  46549. location,
  46550. onComplete,
  46551. onAbort
  46552. ) {
  46553. var this$1 = this;
  46554. var route = this.router.match(location, this.current);
  46555. this.confirmTransition(
  46556. route,
  46557. function () {
  46558. this$1.updateRoute(route);
  46559. onComplete && onComplete(route);
  46560. this$1.ensureURL();
  46561. // fire ready cbs once
  46562. if (!this$1.ready) {
  46563. this$1.ready = true;
  46564. this$1.readyCbs.forEach(function (cb) {
  46565. cb(route);
  46566. });
  46567. }
  46568. },
  46569. function (err) {
  46570. if (onAbort) {
  46571. onAbort(err);
  46572. }
  46573. if (err && !this$1.ready) {
  46574. this$1.ready = true;
  46575. this$1.readyErrorCbs.forEach(function (cb) {
  46576. cb(err);
  46577. });
  46578. }
  46579. }
  46580. );
  46581. };
  46582. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  46583. var this$1 = this;
  46584. var current = this.current;
  46585. var abort = function (err) {
  46586. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  46587. // When the user navigates through history through back/forward buttons
  46588. // we do not want to throw the error. We only throw it if directly calling
  46589. // push/replace. That's why it's not included in isError
  46590. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  46591. if (this$1.errorCbs.length) {
  46592. this$1.errorCbs.forEach(function (cb) {
  46593. cb(err);
  46594. });
  46595. } else {
  46596. warn(false, 'uncaught error during route navigation:');
  46597. console.error(err);
  46598. }
  46599. }
  46600. onAbort && onAbort(err);
  46601. };
  46602. if (
  46603. isSameRoute(route, current) &&
  46604. // in the case the route map has been dynamically appended to
  46605. route.matched.length === current.matched.length
  46606. ) {
  46607. this.ensureURL();
  46608. return abort(new NavigationDuplicated(route))
  46609. }
  46610. var ref = resolveQueue(
  46611. this.current.matched,
  46612. route.matched
  46613. );
  46614. var updated = ref.updated;
  46615. var deactivated = ref.deactivated;
  46616. var activated = ref.activated;
  46617. var queue = [].concat(
  46618. // in-component leave guards
  46619. extractLeaveGuards(deactivated),
  46620. // global before hooks
  46621. this.router.beforeHooks,
  46622. // in-component update hooks
  46623. extractUpdateHooks(updated),
  46624. // in-config enter guards
  46625. activated.map(function (m) { return m.beforeEnter; }),
  46626. // async components
  46627. resolveAsyncComponents(activated)
  46628. );
  46629. this.pending = route;
  46630. var iterator = function (hook, next) {
  46631. if (this$1.pending !== route) {
  46632. return abort()
  46633. }
  46634. try {
  46635. hook(route, current, function (to) {
  46636. if (to === false || isError(to)) {
  46637. // next(false) -> abort navigation, ensure current URL
  46638. this$1.ensureURL(true);
  46639. abort(to);
  46640. } else if (
  46641. typeof to === 'string' ||
  46642. (typeof to === 'object' &&
  46643. (typeof to.path === 'string' || typeof to.name === 'string'))
  46644. ) {
  46645. // next('/') or next({ path: '/' }) -> redirect
  46646. abort();
  46647. if (typeof to === 'object' && to.replace) {
  46648. this$1.replace(to);
  46649. } else {
  46650. this$1.push(to);
  46651. }
  46652. } else {
  46653. // confirm transition and pass on the value
  46654. next(to);
  46655. }
  46656. });
  46657. } catch (e) {
  46658. abort(e);
  46659. }
  46660. };
  46661. runQueue(queue, iterator, function () {
  46662. var postEnterCbs = [];
  46663. var isValid = function () { return this$1.current === route; };
  46664. // wait until async components are resolved before
  46665. // extracting in-component enter guards
  46666. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  46667. var queue = enterGuards.concat(this$1.router.resolveHooks);
  46668. runQueue(queue, iterator, function () {
  46669. if (this$1.pending !== route) {
  46670. return abort()
  46671. }
  46672. this$1.pending = null;
  46673. onComplete(route);
  46674. if (this$1.router.app) {
  46675. this$1.router.app.$nextTick(function () {
  46676. postEnterCbs.forEach(function (cb) {
  46677. cb();
  46678. });
  46679. });
  46680. }
  46681. });
  46682. });
  46683. };
  46684. History.prototype.updateRoute = function updateRoute (route) {
  46685. var prev = this.current;
  46686. this.current = route;
  46687. this.cb && this.cb(route);
  46688. this.router.afterHooks.forEach(function (hook) {
  46689. hook && hook(route, prev);
  46690. });
  46691. };
  46692. function normalizeBase (base) {
  46693. if (!base) {
  46694. if (inBrowser) {
  46695. // respect <base> tag
  46696. var baseEl = document.querySelector('base');
  46697. base = (baseEl && baseEl.getAttribute('href')) || '/';
  46698. // strip full URL origin
  46699. base = base.replace(/^https?:\/\/[^\/]+/, '');
  46700. } else {
  46701. base = '/';
  46702. }
  46703. }
  46704. // make sure there's the starting slash
  46705. if (base.charAt(0) !== '/') {
  46706. base = '/' + base;
  46707. }
  46708. // remove trailing slash
  46709. return base.replace(/\/$/, '')
  46710. }
  46711. function resolveQueue (
  46712. current,
  46713. next
  46714. ) {
  46715. var i;
  46716. var max = Math.max(current.length, next.length);
  46717. for (i = 0; i < max; i++) {
  46718. if (current[i] !== next[i]) {
  46719. break
  46720. }
  46721. }
  46722. return {
  46723. updated: next.slice(0, i),
  46724. activated: next.slice(i),
  46725. deactivated: current.slice(i)
  46726. }
  46727. }
  46728. function extractGuards (
  46729. records,
  46730. name,
  46731. bind,
  46732. reverse
  46733. ) {
  46734. var guards = flatMapComponents(records, function (def, instance, match, key) {
  46735. var guard = extractGuard(def, name);
  46736. if (guard) {
  46737. return Array.isArray(guard)
  46738. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  46739. : bind(guard, instance, match, key)
  46740. }
  46741. });
  46742. return flatten(reverse ? guards.reverse() : guards)
  46743. }
  46744. function extractGuard (
  46745. def,
  46746. key
  46747. ) {
  46748. if (typeof def !== 'function') {
  46749. // extend now so that global mixins are applied.
  46750. def = _Vue.extend(def);
  46751. }
  46752. return def.options[key]
  46753. }
  46754. function extractLeaveGuards (deactivated) {
  46755. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  46756. }
  46757. function extractUpdateHooks (updated) {
  46758. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  46759. }
  46760. function bindGuard (guard, instance) {
  46761. if (instance) {
  46762. return function boundRouteGuard () {
  46763. return guard.apply(instance, arguments)
  46764. }
  46765. }
  46766. }
  46767. function extractEnterGuards (
  46768. activated,
  46769. cbs,
  46770. isValid
  46771. ) {
  46772. return extractGuards(
  46773. activated,
  46774. 'beforeRouteEnter',
  46775. function (guard, _, match, key) {
  46776. return bindEnterGuard(guard, match, key, cbs, isValid)
  46777. }
  46778. )
  46779. }
  46780. function bindEnterGuard (
  46781. guard,
  46782. match,
  46783. key,
  46784. cbs,
  46785. isValid
  46786. ) {
  46787. return function routeEnterGuard (to, from, next) {
  46788. return guard(to, from, function (cb) {
  46789. if (typeof cb === 'function') {
  46790. cbs.push(function () {
  46791. // #750
  46792. // if a router-view is wrapped with an out-in transition,
  46793. // the instance may not have been registered at this time.
  46794. // we will need to poll for registration until current route
  46795. // is no longer valid.
  46796. poll(cb, match.instances, key, isValid);
  46797. });
  46798. }
  46799. next(cb);
  46800. })
  46801. }
  46802. }
  46803. function poll (
  46804. cb, // somehow flow cannot infer this is a function
  46805. instances,
  46806. key,
  46807. isValid
  46808. ) {
  46809. if (
  46810. instances[key] &&
  46811. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  46812. ) {
  46813. cb(instances[key]);
  46814. } else if (isValid()) {
  46815. setTimeout(function () {
  46816. poll(cb, instances, key, isValid);
  46817. }, 16);
  46818. }
  46819. }
  46820. /* */
  46821. var HTML5History = /*@__PURE__*/(function (History) {
  46822. function HTML5History (router, base) {
  46823. var this$1 = this;
  46824. History.call(this, router, base);
  46825. var expectScroll = router.options.scrollBehavior;
  46826. var supportsScroll = supportsPushState && expectScroll;
  46827. if (supportsScroll) {
  46828. setupScroll();
  46829. }
  46830. var initLocation = getLocation(this.base);
  46831. window.addEventListener('popstate', function (e) {
  46832. var current = this$1.current;
  46833. // Avoiding first `popstate` event dispatched in some browsers but first
  46834. // history route not updated since async guard at the same time.
  46835. var location = getLocation(this$1.base);
  46836. if (this$1.current === START && location === initLocation) {
  46837. return
  46838. }
  46839. this$1.transitionTo(location, function (route) {
  46840. if (supportsScroll) {
  46841. handleScroll(router, route, current, true);
  46842. }
  46843. });
  46844. });
  46845. }
  46846. if ( History ) HTML5History.__proto__ = History;
  46847. HTML5History.prototype = Object.create( History && History.prototype );
  46848. HTML5History.prototype.constructor = HTML5History;
  46849. HTML5History.prototype.go = function go (n) {
  46850. window.history.go(n);
  46851. };
  46852. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  46853. var this$1 = this;
  46854. var ref = this;
  46855. var fromRoute = ref.current;
  46856. this.transitionTo(location, function (route) {
  46857. pushState(cleanPath(this$1.base + route.fullPath));
  46858. handleScroll(this$1.router, route, fromRoute, false);
  46859. onComplete && onComplete(route);
  46860. }, onAbort);
  46861. };
  46862. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  46863. var this$1 = this;
  46864. var ref = this;
  46865. var fromRoute = ref.current;
  46866. this.transitionTo(location, function (route) {
  46867. replaceState(cleanPath(this$1.base + route.fullPath));
  46868. handleScroll(this$1.router, route, fromRoute, false);
  46869. onComplete && onComplete(route);
  46870. }, onAbort);
  46871. };
  46872. HTML5History.prototype.ensureURL = function ensureURL (push) {
  46873. if (getLocation(this.base) !== this.current.fullPath) {
  46874. var current = cleanPath(this.base + this.current.fullPath);
  46875. push ? pushState(current) : replaceState(current);
  46876. }
  46877. };
  46878. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  46879. return getLocation(this.base)
  46880. };
  46881. return HTML5History;
  46882. }(History));
  46883. function getLocation (base) {
  46884. var path = decodeURI(window.location.pathname);
  46885. if (base && path.indexOf(base) === 0) {
  46886. path = path.slice(base.length);
  46887. }
  46888. return (path || '/') + window.location.search + window.location.hash
  46889. }
  46890. /* */
  46891. var HashHistory = /*@__PURE__*/(function (History) {
  46892. function HashHistory (router, base, fallback) {
  46893. History.call(this, router, base);
  46894. // check history fallback deeplinking
  46895. if (fallback && checkFallback(this.base)) {
  46896. return
  46897. }
  46898. ensureSlash();
  46899. }
  46900. if ( History ) HashHistory.__proto__ = History;
  46901. HashHistory.prototype = Object.create( History && History.prototype );
  46902. HashHistory.prototype.constructor = HashHistory;
  46903. // this is delayed until the app mounts
  46904. // to avoid the hashchange listener being fired too early
  46905. HashHistory.prototype.setupListeners = function setupListeners () {
  46906. var this$1 = this;
  46907. var router = this.router;
  46908. var expectScroll = router.options.scrollBehavior;
  46909. var supportsScroll = supportsPushState && expectScroll;
  46910. if (supportsScroll) {
  46911. setupScroll();
  46912. }
  46913. window.addEventListener(
  46914. supportsPushState ? 'popstate' : 'hashchange',
  46915. function () {
  46916. var current = this$1.current;
  46917. if (!ensureSlash()) {
  46918. return
  46919. }
  46920. this$1.transitionTo(getHash(), function (route) {
  46921. if (supportsScroll) {
  46922. handleScroll(this$1.router, route, current, true);
  46923. }
  46924. if (!supportsPushState) {
  46925. replaceHash(route.fullPath);
  46926. }
  46927. });
  46928. }
  46929. );
  46930. };
  46931. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  46932. var this$1 = this;
  46933. var ref = this;
  46934. var fromRoute = ref.current;
  46935. this.transitionTo(
  46936. location,
  46937. function (route) {
  46938. pushHash(route.fullPath);
  46939. handleScroll(this$1.router, route, fromRoute, false);
  46940. onComplete && onComplete(route);
  46941. },
  46942. onAbort
  46943. );
  46944. };
  46945. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  46946. var this$1 = this;
  46947. var ref = this;
  46948. var fromRoute = ref.current;
  46949. this.transitionTo(
  46950. location,
  46951. function (route) {
  46952. replaceHash(route.fullPath);
  46953. handleScroll(this$1.router, route, fromRoute, false);
  46954. onComplete && onComplete(route);
  46955. },
  46956. onAbort
  46957. );
  46958. };
  46959. HashHistory.prototype.go = function go (n) {
  46960. window.history.go(n);
  46961. };
  46962. HashHistory.prototype.ensureURL = function ensureURL (push) {
  46963. var current = this.current.fullPath;
  46964. if (getHash() !== current) {
  46965. push ? pushHash(current) : replaceHash(current);
  46966. }
  46967. };
  46968. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  46969. return getHash()
  46970. };
  46971. return HashHistory;
  46972. }(History));
  46973. function checkFallback (base) {
  46974. var location = getLocation(base);
  46975. if (!/^\/#/.test(location)) {
  46976. window.location.replace(cleanPath(base + '/#' + location));
  46977. return true
  46978. }
  46979. }
  46980. function ensureSlash () {
  46981. var path = getHash();
  46982. if (path.charAt(0) === '/') {
  46983. return true
  46984. }
  46985. replaceHash('/' + path);
  46986. return false
  46987. }
  46988. function getHash () {
  46989. // We can't use window.location.hash here because it's not
  46990. // consistent across browsers - Firefox will pre-decode it!
  46991. var href = window.location.href;
  46992. var index = href.indexOf('#');
  46993. // empty path
  46994. if (index < 0) { return '' }
  46995. href = href.slice(index + 1);
  46996. // decode the hash but not the search or hash
  46997. // as search(query) is already decoded
  46998. // https://github.com/vuejs/vue-router/issues/2708
  46999. var searchIndex = href.indexOf('?');
  47000. if (searchIndex < 0) {
  47001. var hashIndex = href.indexOf('#');
  47002. if (hashIndex > -1) {
  47003. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  47004. } else { href = decodeURI(href); }
  47005. } else {
  47006. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  47007. }
  47008. return href
  47009. }
  47010. function getUrl (path) {
  47011. var href = window.location.href;
  47012. var i = href.indexOf('#');
  47013. var base = i >= 0 ? href.slice(0, i) : href;
  47014. return (base + "#" + path)
  47015. }
  47016. function pushHash (path) {
  47017. if (supportsPushState) {
  47018. pushState(getUrl(path));
  47019. } else {
  47020. window.location.hash = path;
  47021. }
  47022. }
  47023. function replaceHash (path) {
  47024. if (supportsPushState) {
  47025. replaceState(getUrl(path));
  47026. } else {
  47027. window.location.replace(getUrl(path));
  47028. }
  47029. }
  47030. /* */
  47031. var AbstractHistory = /*@__PURE__*/(function (History) {
  47032. function AbstractHistory (router, base) {
  47033. History.call(this, router, base);
  47034. this.stack = [];
  47035. this.index = -1;
  47036. }
  47037. if ( History ) AbstractHistory.__proto__ = History;
  47038. AbstractHistory.prototype = Object.create( History && History.prototype );
  47039. AbstractHistory.prototype.constructor = AbstractHistory;
  47040. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  47041. var this$1 = this;
  47042. this.transitionTo(
  47043. location,
  47044. function (route) {
  47045. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  47046. this$1.index++;
  47047. onComplete && onComplete(route);
  47048. },
  47049. onAbort
  47050. );
  47051. };
  47052. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  47053. var this$1 = this;
  47054. this.transitionTo(
  47055. location,
  47056. function (route) {
  47057. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  47058. onComplete && onComplete(route);
  47059. },
  47060. onAbort
  47061. );
  47062. };
  47063. AbstractHistory.prototype.go = function go (n) {
  47064. var this$1 = this;
  47065. var targetIndex = this.index + n;
  47066. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  47067. return
  47068. }
  47069. var route = this.stack[targetIndex];
  47070. this.confirmTransition(
  47071. route,
  47072. function () {
  47073. this$1.index = targetIndex;
  47074. this$1.updateRoute(route);
  47075. },
  47076. function (err) {
  47077. if (isExtendedError(NavigationDuplicated, err)) {
  47078. this$1.index = targetIndex;
  47079. }
  47080. }
  47081. );
  47082. };
  47083. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  47084. var current = this.stack[this.stack.length - 1];
  47085. return current ? current.fullPath : '/'
  47086. };
  47087. AbstractHistory.prototype.ensureURL = function ensureURL () {
  47088. // noop
  47089. };
  47090. return AbstractHistory;
  47091. }(History));
  47092. /* */
  47093. var VueRouter = function VueRouter (options) {
  47094. if ( options === void 0 ) options = {};
  47095. this.app = null;
  47096. this.apps = [];
  47097. this.options = options;
  47098. this.beforeHooks = [];
  47099. this.resolveHooks = [];
  47100. this.afterHooks = [];
  47101. this.matcher = createMatcher(options.routes || [], this);
  47102. var mode = options.mode || 'hash';
  47103. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  47104. if (this.fallback) {
  47105. mode = 'hash';
  47106. }
  47107. if (!inBrowser) {
  47108. mode = 'abstract';
  47109. }
  47110. this.mode = mode;
  47111. switch (mode) {
  47112. case 'history':
  47113. this.history = new HTML5History(this, options.base);
  47114. break
  47115. case 'hash':
  47116. this.history = new HashHistory(this, options.base, this.fallback);
  47117. break
  47118. case 'abstract':
  47119. this.history = new AbstractHistory(this, options.base);
  47120. break
  47121. default:
  47122. if (true) {
  47123. assert(false, ("invalid mode: " + mode));
  47124. }
  47125. }
  47126. };
  47127. var prototypeAccessors = { currentRoute: { configurable: true } };
  47128. VueRouter.prototype.match = function match (
  47129. raw,
  47130. current,
  47131. redirectedFrom
  47132. ) {
  47133. return this.matcher.match(raw, current, redirectedFrom)
  47134. };
  47135. prototypeAccessors.currentRoute.get = function () {
  47136. return this.history && this.history.current
  47137. };
  47138. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  47139. var this$1 = this;
  47140. true && assert(
  47141. install.installed,
  47142. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  47143. "before creating root instance."
  47144. );
  47145. this.apps.push(app);
  47146. // set up app destroyed handler
  47147. // https://github.com/vuejs/vue-router/issues/2639
  47148. app.$once('hook:destroyed', function () {
  47149. // clean out app from this.apps array once destroyed
  47150. var index = this$1.apps.indexOf(app);
  47151. if (index > -1) { this$1.apps.splice(index, 1); }
  47152. // ensure we still have a main app or null if no apps
  47153. // we do not release the router so it can be reused
  47154. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  47155. });
  47156. // main app previously initialized
  47157. // return as we don't need to set up new history listener
  47158. if (this.app) {
  47159. return
  47160. }
  47161. this.app = app;
  47162. var history = this.history;
  47163. if (history instanceof HTML5History) {
  47164. history.transitionTo(history.getCurrentLocation());
  47165. } else if (history instanceof HashHistory) {
  47166. var setupHashListener = function () {
  47167. history.setupListeners();
  47168. };
  47169. history.transitionTo(
  47170. history.getCurrentLocation(),
  47171. setupHashListener,
  47172. setupHashListener
  47173. );
  47174. }
  47175. history.listen(function (route) {
  47176. this$1.apps.forEach(function (app) {
  47177. app._route = route;
  47178. });
  47179. });
  47180. };
  47181. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  47182. return registerHook(this.beforeHooks, fn)
  47183. };
  47184. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  47185. return registerHook(this.resolveHooks, fn)
  47186. };
  47187. VueRouter.prototype.afterEach = function afterEach (fn) {
  47188. return registerHook(this.afterHooks, fn)
  47189. };
  47190. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  47191. this.history.onReady(cb, errorCb);
  47192. };
  47193. VueRouter.prototype.onError = function onError (errorCb) {
  47194. this.history.onError(errorCb);
  47195. };
  47196. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  47197. var this$1 = this;
  47198. // $flow-disable-line
  47199. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47200. return new Promise(function (resolve, reject) {
  47201. this$1.history.push(location, resolve, reject);
  47202. })
  47203. } else {
  47204. this.history.push(location, onComplete, onAbort);
  47205. }
  47206. };
  47207. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  47208. var this$1 = this;
  47209. // $flow-disable-line
  47210. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47211. return new Promise(function (resolve, reject) {
  47212. this$1.history.replace(location, resolve, reject);
  47213. })
  47214. } else {
  47215. this.history.replace(location, onComplete, onAbort);
  47216. }
  47217. };
  47218. VueRouter.prototype.go = function go (n) {
  47219. this.history.go(n);
  47220. };
  47221. VueRouter.prototype.back = function back () {
  47222. this.go(-1);
  47223. };
  47224. VueRouter.prototype.forward = function forward () {
  47225. this.go(1);
  47226. };
  47227. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  47228. var route = to
  47229. ? to.matched
  47230. ? to
  47231. : this.resolve(to).route
  47232. : this.currentRoute;
  47233. if (!route) {
  47234. return []
  47235. }
  47236. return [].concat.apply([], route.matched.map(function (m) {
  47237. return Object.keys(m.components).map(function (key) {
  47238. return m.components[key]
  47239. })
  47240. }))
  47241. };
  47242. VueRouter.prototype.resolve = function resolve (
  47243. to,
  47244. current,
  47245. append
  47246. ) {
  47247. current = current || this.history.current;
  47248. var location = normalizeLocation(
  47249. to,
  47250. current,
  47251. append,
  47252. this
  47253. );
  47254. var route = this.match(location, current);
  47255. var fullPath = route.redirectedFrom || route.fullPath;
  47256. var base = this.history.base;
  47257. var href = createHref(base, fullPath, this.mode);
  47258. return {
  47259. location: location,
  47260. route: route,
  47261. href: href,
  47262. // for backwards compat
  47263. normalizedTo: location,
  47264. resolved: route
  47265. }
  47266. };
  47267. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  47268. this.matcher.addRoutes(routes);
  47269. if (this.history.current !== START) {
  47270. this.history.transitionTo(this.history.getCurrentLocation());
  47271. }
  47272. };
  47273. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  47274. function registerHook (list, fn) {
  47275. list.push(fn);
  47276. return function () {
  47277. var i = list.indexOf(fn);
  47278. if (i > -1) { list.splice(i, 1); }
  47279. }
  47280. }
  47281. function createHref (base, fullPath, mode) {
  47282. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  47283. return base ? cleanPath(base + '/' + path) : path
  47284. }
  47285. VueRouter.install = install;
  47286. VueRouter.version = '3.1.6';
  47287. if (inBrowser && window.Vue) {
  47288. window.Vue.use(VueRouter);
  47289. }
  47290. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  47291. /***/ }),
  47292. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  47293. /*!*************************************************!*\
  47294. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  47295. \*************************************************/
  47296. /*! no static exports found */
  47297. /***/ (function(module, exports, __webpack_require__) {
  47298. "use strict";
  47299. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  47300. * Vue.js v2.6.11
  47301. * (c) 2014-2019 Evan You
  47302. * Released under the MIT License.
  47303. */
  47304. /* */
  47305. var emptyObject = Object.freeze({});
  47306. // These helpers produce better VM code in JS engines due to their
  47307. // explicitness and function inlining.
  47308. function isUndef (v) {
  47309. return v === undefined || v === null
  47310. }
  47311. function isDef (v) {
  47312. return v !== undefined && v !== null
  47313. }
  47314. function isTrue (v) {
  47315. return v === true
  47316. }
  47317. function isFalse (v) {
  47318. return v === false
  47319. }
  47320. /**
  47321. * Check if value is primitive.
  47322. */
  47323. function isPrimitive (value) {
  47324. return (
  47325. typeof value === 'string' ||
  47326. typeof value === 'number' ||
  47327. // $flow-disable-line
  47328. typeof value === 'symbol' ||
  47329. typeof value === 'boolean'
  47330. )
  47331. }
  47332. /**
  47333. * Quick object check - this is primarily used to tell
  47334. * Objects from primitive values when we know the value
  47335. * is a JSON-compliant type.
  47336. */
  47337. function isObject (obj) {
  47338. return obj !== null && typeof obj === 'object'
  47339. }
  47340. /**
  47341. * Get the raw type string of a value, e.g., [object Object].
  47342. */
  47343. var _toString = Object.prototype.toString;
  47344. function toRawType (value) {
  47345. return _toString.call(value).slice(8, -1)
  47346. }
  47347. /**
  47348. * Strict object type check. Only returns true
  47349. * for plain JavaScript objects.
  47350. */
  47351. function isPlainObject (obj) {
  47352. return _toString.call(obj) === '[object Object]'
  47353. }
  47354. function isRegExp (v) {
  47355. return _toString.call(v) === '[object RegExp]'
  47356. }
  47357. /**
  47358. * Check if val is a valid array index.
  47359. */
  47360. function isValidArrayIndex (val) {
  47361. var n = parseFloat(String(val));
  47362. return n >= 0 && Math.floor(n) === n && isFinite(val)
  47363. }
  47364. function isPromise (val) {
  47365. return (
  47366. isDef(val) &&
  47367. typeof val.then === 'function' &&
  47368. typeof val.catch === 'function'
  47369. )
  47370. }
  47371. /**
  47372. * Convert a value to a string that is actually rendered.
  47373. */
  47374. function toString (val) {
  47375. return val == null
  47376. ? ''
  47377. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  47378. ? JSON.stringify(val, null, 2)
  47379. : String(val)
  47380. }
  47381. /**
  47382. * Convert an input value to a number for persistence.
  47383. * If the conversion fails, return original string.
  47384. */
  47385. function toNumber (val) {
  47386. var n = parseFloat(val);
  47387. return isNaN(n) ? val : n
  47388. }
  47389. /**
  47390. * Make a map and return a function for checking if a key
  47391. * is in that map.
  47392. */
  47393. function makeMap (
  47394. str,
  47395. expectsLowerCase
  47396. ) {
  47397. var map = Object.create(null);
  47398. var list = str.split(',');
  47399. for (var i = 0; i < list.length; i++) {
  47400. map[list[i]] = true;
  47401. }
  47402. return expectsLowerCase
  47403. ? function (val) { return map[val.toLowerCase()]; }
  47404. : function (val) { return map[val]; }
  47405. }
  47406. /**
  47407. * Check if a tag is a built-in tag.
  47408. */
  47409. var isBuiltInTag = makeMap('slot,component', true);
  47410. /**
  47411. * Check if an attribute is a reserved attribute.
  47412. */
  47413. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  47414. /**
  47415. * Remove an item from an array.
  47416. */
  47417. function remove (arr, item) {
  47418. if (arr.length) {
  47419. var index = arr.indexOf(item);
  47420. if (index > -1) {
  47421. return arr.splice(index, 1)
  47422. }
  47423. }
  47424. }
  47425. /**
  47426. * Check whether an object has the property.
  47427. */
  47428. var hasOwnProperty = Object.prototype.hasOwnProperty;
  47429. function hasOwn (obj, key) {
  47430. return hasOwnProperty.call(obj, key)
  47431. }
  47432. /**
  47433. * Create a cached version of a pure function.
  47434. */
  47435. function cached (fn) {
  47436. var cache = Object.create(null);
  47437. return (function cachedFn (str) {
  47438. var hit = cache[str];
  47439. return hit || (cache[str] = fn(str))
  47440. })
  47441. }
  47442. /**
  47443. * Camelize a hyphen-delimited string.
  47444. */
  47445. var camelizeRE = /-(\w)/g;
  47446. var camelize = cached(function (str) {
  47447. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  47448. });
  47449. /**
  47450. * Capitalize a string.
  47451. */
  47452. var capitalize = cached(function (str) {
  47453. return str.charAt(0).toUpperCase() + str.slice(1)
  47454. });
  47455. /**
  47456. * Hyphenate a camelCase string.
  47457. */
  47458. var hyphenateRE = /\B([A-Z])/g;
  47459. var hyphenate = cached(function (str) {
  47460. return str.replace(hyphenateRE, '-$1').toLowerCase()
  47461. });
  47462. /**
  47463. * Simple bind polyfill for environments that do not support it,
  47464. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  47465. * since native bind is now performant enough in most browsers.
  47466. * But removing it would mean breaking code that was able to run in
  47467. * PhantomJS 1.x, so this must be kept for backward compatibility.
  47468. */
  47469. /* istanbul ignore next */
  47470. function polyfillBind (fn, ctx) {
  47471. function boundFn (a) {
  47472. var l = arguments.length;
  47473. return l
  47474. ? l > 1
  47475. ? fn.apply(ctx, arguments)
  47476. : fn.call(ctx, a)
  47477. : fn.call(ctx)
  47478. }
  47479. boundFn._length = fn.length;
  47480. return boundFn
  47481. }
  47482. function nativeBind (fn, ctx) {
  47483. return fn.bind(ctx)
  47484. }
  47485. var bind = Function.prototype.bind
  47486. ? nativeBind
  47487. : polyfillBind;
  47488. /**
  47489. * Convert an Array-like object to a real Array.
  47490. */
  47491. function toArray (list, start) {
  47492. start = start || 0;
  47493. var i = list.length - start;
  47494. var ret = new Array(i);
  47495. while (i--) {
  47496. ret[i] = list[i + start];
  47497. }
  47498. return ret
  47499. }
  47500. /**
  47501. * Mix properties into target object.
  47502. */
  47503. function extend (to, _from) {
  47504. for (var key in _from) {
  47505. to[key] = _from[key];
  47506. }
  47507. return to
  47508. }
  47509. /**
  47510. * Merge an Array of Objects into a single Object.
  47511. */
  47512. function toObject (arr) {
  47513. var res = {};
  47514. for (var i = 0; i < arr.length; i++) {
  47515. if (arr[i]) {
  47516. extend(res, arr[i]);
  47517. }
  47518. }
  47519. return res
  47520. }
  47521. /* eslint-disable no-unused-vars */
  47522. /**
  47523. * Perform no operation.
  47524. * Stubbing args to make Flow happy without leaving useless transpiled code
  47525. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  47526. */
  47527. function noop (a, b, c) {}
  47528. /**
  47529. * Always return false.
  47530. */
  47531. var no = function (a, b, c) { return false; };
  47532. /* eslint-enable no-unused-vars */
  47533. /**
  47534. * Return the same value.
  47535. */
  47536. var identity = function (_) { return _; };
  47537. /**
  47538. * Generate a string containing static keys from compiler modules.
  47539. */
  47540. function genStaticKeys (modules) {
  47541. return modules.reduce(function (keys, m) {
  47542. return keys.concat(m.staticKeys || [])
  47543. }, []).join(',')
  47544. }
  47545. /**
  47546. * Check if two values are loosely equal - that is,
  47547. * if they are plain objects, do they have the same shape?
  47548. */
  47549. function looseEqual (a, b) {
  47550. if (a === b) { return true }
  47551. var isObjectA = isObject(a);
  47552. var isObjectB = isObject(b);
  47553. if (isObjectA && isObjectB) {
  47554. try {
  47555. var isArrayA = Array.isArray(a);
  47556. var isArrayB = Array.isArray(b);
  47557. if (isArrayA && isArrayB) {
  47558. return a.length === b.length && a.every(function (e, i) {
  47559. return looseEqual(e, b[i])
  47560. })
  47561. } else if (a instanceof Date && b instanceof Date) {
  47562. return a.getTime() === b.getTime()
  47563. } else if (!isArrayA && !isArrayB) {
  47564. var keysA = Object.keys(a);
  47565. var keysB = Object.keys(b);
  47566. return keysA.length === keysB.length && keysA.every(function (key) {
  47567. return looseEqual(a[key], b[key])
  47568. })
  47569. } else {
  47570. /* istanbul ignore next */
  47571. return false
  47572. }
  47573. } catch (e) {
  47574. /* istanbul ignore next */
  47575. return false
  47576. }
  47577. } else if (!isObjectA && !isObjectB) {
  47578. return String(a) === String(b)
  47579. } else {
  47580. return false
  47581. }
  47582. }
  47583. /**
  47584. * Return the first index at which a loosely equal value can be
  47585. * found in the array (if value is a plain object, the array must
  47586. * contain an object of the same shape), or -1 if it is not present.
  47587. */
  47588. function looseIndexOf (arr, val) {
  47589. for (var i = 0; i < arr.length; i++) {
  47590. if (looseEqual(arr[i], val)) { return i }
  47591. }
  47592. return -1
  47593. }
  47594. /**
  47595. * Ensure a function is called only once.
  47596. */
  47597. function once (fn) {
  47598. var called = false;
  47599. return function () {
  47600. if (!called) {
  47601. called = true;
  47602. fn.apply(this, arguments);
  47603. }
  47604. }
  47605. }
  47606. var SSR_ATTR = 'data-server-rendered';
  47607. var ASSET_TYPES = [
  47608. 'component',
  47609. 'directive',
  47610. 'filter'
  47611. ];
  47612. var LIFECYCLE_HOOKS = [
  47613. 'beforeCreate',
  47614. 'created',
  47615. 'beforeMount',
  47616. 'mounted',
  47617. 'beforeUpdate',
  47618. 'updated',
  47619. 'beforeDestroy',
  47620. 'destroyed',
  47621. 'activated',
  47622. 'deactivated',
  47623. 'errorCaptured',
  47624. 'serverPrefetch'
  47625. ];
  47626. /* */
  47627. var config = ({
  47628. /**
  47629. * Option merge strategies (used in core/util/options)
  47630. */
  47631. // $flow-disable-line
  47632. optionMergeStrategies: Object.create(null),
  47633. /**
  47634. * Whether to suppress warnings.
  47635. */
  47636. silent: false,
  47637. /**
  47638. * Show production mode tip message on boot?
  47639. */
  47640. productionTip: "development" !== 'production',
  47641. /**
  47642. * Whether to enable devtools
  47643. */
  47644. devtools: "development" !== 'production',
  47645. /**
  47646. * Whether to record perf
  47647. */
  47648. performance: false,
  47649. /**
  47650. * Error handler for watcher errors
  47651. */
  47652. errorHandler: null,
  47653. /**
  47654. * Warn handler for watcher warns
  47655. */
  47656. warnHandler: null,
  47657. /**
  47658. * Ignore certain custom elements
  47659. */
  47660. ignoredElements: [],
  47661. /**
  47662. * Custom user key aliases for v-on
  47663. */
  47664. // $flow-disable-line
  47665. keyCodes: Object.create(null),
  47666. /**
  47667. * Check if a tag is reserved so that it cannot be registered as a
  47668. * component. This is platform-dependent and may be overwritten.
  47669. */
  47670. isReservedTag: no,
  47671. /**
  47672. * Check if an attribute is reserved so that it cannot be used as a component
  47673. * prop. This is platform-dependent and may be overwritten.
  47674. */
  47675. isReservedAttr: no,
  47676. /**
  47677. * Check if a tag is an unknown element.
  47678. * Platform-dependent.
  47679. */
  47680. isUnknownElement: no,
  47681. /**
  47682. * Get the namespace of an element
  47683. */
  47684. getTagNamespace: noop,
  47685. /**
  47686. * Parse the real tag name for the specific platform.
  47687. */
  47688. parsePlatformTagName: identity,
  47689. /**
  47690. * Check if an attribute must be bound using property, e.g. value
  47691. * Platform-dependent.
  47692. */
  47693. mustUseProp: no,
  47694. /**
  47695. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  47696. * This will significantly reduce performance if set to false.
  47697. */
  47698. async: true,
  47699. /**
  47700. * Exposed for legacy reasons
  47701. */
  47702. _lifecycleHooks: LIFECYCLE_HOOKS
  47703. });
  47704. /* */
  47705. /**
  47706. * unicode letters used for parsing html tags, component names and property paths.
  47707. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  47708. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  47709. */
  47710. 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/;
  47711. /**
  47712. * Check if a string starts with $ or _
  47713. */
  47714. function isReserved (str) {
  47715. var c = (str + '').charCodeAt(0);
  47716. return c === 0x24 || c === 0x5F
  47717. }
  47718. /**
  47719. * Define a property.
  47720. */
  47721. function def (obj, key, val, enumerable) {
  47722. Object.defineProperty(obj, key, {
  47723. value: val,
  47724. enumerable: !!enumerable,
  47725. writable: true,
  47726. configurable: true
  47727. });
  47728. }
  47729. /**
  47730. * Parse simple path.
  47731. */
  47732. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  47733. function parsePath (path) {
  47734. if (bailRE.test(path)) {
  47735. return
  47736. }
  47737. var segments = path.split('.');
  47738. return function (obj) {
  47739. for (var i = 0; i < segments.length; i++) {
  47740. if (!obj) { return }
  47741. obj = obj[segments[i]];
  47742. }
  47743. return obj
  47744. }
  47745. }
  47746. /* */
  47747. // can we use __proto__?
  47748. var hasProto = '__proto__' in {};
  47749. // Browser environment sniffing
  47750. var inBrowser = typeof window !== 'undefined';
  47751. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  47752. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  47753. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  47754. var isIE = UA && /msie|trident/.test(UA);
  47755. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  47756. var isEdge = UA && UA.indexOf('edge/') > 0;
  47757. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  47758. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  47759. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  47760. var isPhantomJS = UA && /phantomjs/.test(UA);
  47761. var isFF = UA && UA.match(/firefox\/(\d+)/);
  47762. // Firefox has a "watch" function on Object.prototype...
  47763. var nativeWatch = ({}).watch;
  47764. var supportsPassive = false;
  47765. if (inBrowser) {
  47766. try {
  47767. var opts = {};
  47768. Object.defineProperty(opts, 'passive', ({
  47769. get: function get () {
  47770. /* istanbul ignore next */
  47771. supportsPassive = true;
  47772. }
  47773. })); // https://github.com/facebook/flow/issues/285
  47774. window.addEventListener('test-passive', null, opts);
  47775. } catch (e) {}
  47776. }
  47777. // this needs to be lazy-evaled because vue may be required before
  47778. // vue-server-renderer can set VUE_ENV
  47779. var _isServer;
  47780. var isServerRendering = function () {
  47781. if (_isServer === undefined) {
  47782. /* istanbul ignore if */
  47783. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  47784. // detect presence of vue-server-renderer and avoid
  47785. // Webpack shimming the process
  47786. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  47787. } else {
  47788. _isServer = false;
  47789. }
  47790. }
  47791. return _isServer
  47792. };
  47793. // detect devtools
  47794. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  47795. /* istanbul ignore next */
  47796. function isNative (Ctor) {
  47797. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  47798. }
  47799. var hasSymbol =
  47800. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  47801. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  47802. var _Set;
  47803. /* istanbul ignore if */ // $flow-disable-line
  47804. if (typeof Set !== 'undefined' && isNative(Set)) {
  47805. // use native Set when available.
  47806. _Set = Set;
  47807. } else {
  47808. // a non-standard Set polyfill that only works with primitive keys.
  47809. _Set = /*@__PURE__*/(function () {
  47810. function Set () {
  47811. this.set = Object.create(null);
  47812. }
  47813. Set.prototype.has = function has (key) {
  47814. return this.set[key] === true
  47815. };
  47816. Set.prototype.add = function add (key) {
  47817. this.set[key] = true;
  47818. };
  47819. Set.prototype.clear = function clear () {
  47820. this.set = Object.create(null);
  47821. };
  47822. return Set;
  47823. }());
  47824. }
  47825. /* */
  47826. var warn = noop;
  47827. var tip = noop;
  47828. var generateComponentTrace = (noop); // work around flow check
  47829. var formatComponentName = (noop);
  47830. {
  47831. var hasConsole = typeof console !== 'undefined';
  47832. var classifyRE = /(?:^|[-_])(\w)/g;
  47833. var classify = function (str) { return str
  47834. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  47835. .replace(/[-_]/g, ''); };
  47836. warn = function (msg, vm) {
  47837. var trace = vm ? generateComponentTrace(vm) : '';
  47838. if (config.warnHandler) {
  47839. config.warnHandler.call(null, msg, vm, trace);
  47840. } else if (hasConsole && (!config.silent)) {
  47841. console.error(("[Vue warn]: " + msg + trace));
  47842. }
  47843. };
  47844. tip = function (msg, vm) {
  47845. if (hasConsole && (!config.silent)) {
  47846. console.warn("[Vue tip]: " + msg + (
  47847. vm ? generateComponentTrace(vm) : ''
  47848. ));
  47849. }
  47850. };
  47851. formatComponentName = function (vm, includeFile) {
  47852. if (vm.$root === vm) {
  47853. return '<Root>'
  47854. }
  47855. var options = typeof vm === 'function' && vm.cid != null
  47856. ? vm.options
  47857. : vm._isVue
  47858. ? vm.$options || vm.constructor.options
  47859. : vm;
  47860. var name = options.name || options._componentTag;
  47861. var file = options.__file;
  47862. if (!name && file) {
  47863. var match = file.match(/([^/\\]+)\.vue$/);
  47864. name = match && match[1];
  47865. }
  47866. return (
  47867. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  47868. (file && includeFile !== false ? (" at " + file) : '')
  47869. )
  47870. };
  47871. var repeat = function (str, n) {
  47872. var res = '';
  47873. while (n) {
  47874. if (n % 2 === 1) { res += str; }
  47875. if (n > 1) { str += str; }
  47876. n >>= 1;
  47877. }
  47878. return res
  47879. };
  47880. generateComponentTrace = function (vm) {
  47881. if (vm._isVue && vm.$parent) {
  47882. var tree = [];
  47883. var currentRecursiveSequence = 0;
  47884. while (vm) {
  47885. if (tree.length > 0) {
  47886. var last = tree[tree.length - 1];
  47887. if (last.constructor === vm.constructor) {
  47888. currentRecursiveSequence++;
  47889. vm = vm.$parent;
  47890. continue
  47891. } else if (currentRecursiveSequence > 0) {
  47892. tree[tree.length - 1] = [last, currentRecursiveSequence];
  47893. currentRecursiveSequence = 0;
  47894. }
  47895. }
  47896. tree.push(vm);
  47897. vm = vm.$parent;
  47898. }
  47899. return '\n\nfound in\n\n' + tree
  47900. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  47901. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  47902. : formatComponentName(vm))); })
  47903. .join('\n')
  47904. } else {
  47905. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  47906. }
  47907. };
  47908. }
  47909. /* */
  47910. var uid = 0;
  47911. /**
  47912. * A dep is an observable that can have multiple
  47913. * directives subscribing to it.
  47914. */
  47915. var Dep = function Dep () {
  47916. this.id = uid++;
  47917. this.subs = [];
  47918. };
  47919. Dep.prototype.addSub = function addSub (sub) {
  47920. this.subs.push(sub);
  47921. };
  47922. Dep.prototype.removeSub = function removeSub (sub) {
  47923. remove(this.subs, sub);
  47924. };
  47925. Dep.prototype.depend = function depend () {
  47926. if (Dep.target) {
  47927. Dep.target.addDep(this);
  47928. }
  47929. };
  47930. Dep.prototype.notify = function notify () {
  47931. // stabilize the subscriber list first
  47932. var subs = this.subs.slice();
  47933. if (!config.async) {
  47934. // subs aren't sorted in scheduler if not running async
  47935. // we need to sort them now to make sure they fire in correct
  47936. // order
  47937. subs.sort(function (a, b) { return a.id - b.id; });
  47938. }
  47939. for (var i = 0, l = subs.length; i < l; i++) {
  47940. subs[i].update();
  47941. }
  47942. };
  47943. // The current target watcher being evaluated.
  47944. // This is globally unique because only one watcher
  47945. // can be evaluated at a time.
  47946. Dep.target = null;
  47947. var targetStack = [];
  47948. function pushTarget (target) {
  47949. targetStack.push(target);
  47950. Dep.target = target;
  47951. }
  47952. function popTarget () {
  47953. targetStack.pop();
  47954. Dep.target = targetStack[targetStack.length - 1];
  47955. }
  47956. /* */
  47957. var VNode = function VNode (
  47958. tag,
  47959. data,
  47960. children,
  47961. text,
  47962. elm,
  47963. context,
  47964. componentOptions,
  47965. asyncFactory
  47966. ) {
  47967. this.tag = tag;
  47968. this.data = data;
  47969. this.children = children;
  47970. this.text = text;
  47971. this.elm = elm;
  47972. this.ns = undefined;
  47973. this.context = context;
  47974. this.fnContext = undefined;
  47975. this.fnOptions = undefined;
  47976. this.fnScopeId = undefined;
  47977. this.key = data && data.key;
  47978. this.componentOptions = componentOptions;
  47979. this.componentInstance = undefined;
  47980. this.parent = undefined;
  47981. this.raw = false;
  47982. this.isStatic = false;
  47983. this.isRootInsert = true;
  47984. this.isComment = false;
  47985. this.isCloned = false;
  47986. this.isOnce = false;
  47987. this.asyncFactory = asyncFactory;
  47988. this.asyncMeta = undefined;
  47989. this.isAsyncPlaceholder = false;
  47990. };
  47991. var prototypeAccessors = { child: { configurable: true } };
  47992. // DEPRECATED: alias for componentInstance for backwards compat.
  47993. /* istanbul ignore next */
  47994. prototypeAccessors.child.get = function () {
  47995. return this.componentInstance
  47996. };
  47997. Object.defineProperties( VNode.prototype, prototypeAccessors );
  47998. var createEmptyVNode = function (text) {
  47999. if ( text === void 0 ) text = '';
  48000. var node = new VNode();
  48001. node.text = text;
  48002. node.isComment = true;
  48003. return node
  48004. };
  48005. function createTextVNode (val) {
  48006. return new VNode(undefined, undefined, undefined, String(val))
  48007. }
  48008. // optimized shallow clone
  48009. // used for static nodes and slot nodes because they may be reused across
  48010. // multiple renders, cloning them avoids errors when DOM manipulations rely
  48011. // on their elm reference.
  48012. function cloneVNode (vnode) {
  48013. var cloned = new VNode(
  48014. vnode.tag,
  48015. vnode.data,
  48016. // #7975
  48017. // clone children array to avoid mutating original in case of cloning
  48018. // a child.
  48019. vnode.children && vnode.children.slice(),
  48020. vnode.text,
  48021. vnode.elm,
  48022. vnode.context,
  48023. vnode.componentOptions,
  48024. vnode.asyncFactory
  48025. );
  48026. cloned.ns = vnode.ns;
  48027. cloned.isStatic = vnode.isStatic;
  48028. cloned.key = vnode.key;
  48029. cloned.isComment = vnode.isComment;
  48030. cloned.fnContext = vnode.fnContext;
  48031. cloned.fnOptions = vnode.fnOptions;
  48032. cloned.fnScopeId = vnode.fnScopeId;
  48033. cloned.asyncMeta = vnode.asyncMeta;
  48034. cloned.isCloned = true;
  48035. return cloned
  48036. }
  48037. /*
  48038. * not type checking this file because flow doesn't play well with
  48039. * dynamically accessing methods on Array prototype
  48040. */
  48041. var arrayProto = Array.prototype;
  48042. var arrayMethods = Object.create(arrayProto);
  48043. var methodsToPatch = [
  48044. 'push',
  48045. 'pop',
  48046. 'shift',
  48047. 'unshift',
  48048. 'splice',
  48049. 'sort',
  48050. 'reverse'
  48051. ];
  48052. /**
  48053. * Intercept mutating methods and emit events
  48054. */
  48055. methodsToPatch.forEach(function (method) {
  48056. // cache original method
  48057. var original = arrayProto[method];
  48058. def(arrayMethods, method, function mutator () {
  48059. var args = [], len = arguments.length;
  48060. while ( len-- ) args[ len ] = arguments[ len ];
  48061. var result = original.apply(this, args);
  48062. var ob = this.__ob__;
  48063. var inserted;
  48064. switch (method) {
  48065. case 'push':
  48066. case 'unshift':
  48067. inserted = args;
  48068. break
  48069. case 'splice':
  48070. inserted = args.slice(2);
  48071. break
  48072. }
  48073. if (inserted) { ob.observeArray(inserted); }
  48074. // notify change
  48075. ob.dep.notify();
  48076. return result
  48077. });
  48078. });
  48079. /* */
  48080. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  48081. /**
  48082. * In some cases we may want to disable observation inside a component's
  48083. * update computation.
  48084. */
  48085. var shouldObserve = true;
  48086. function toggleObserving (value) {
  48087. shouldObserve = value;
  48088. }
  48089. /**
  48090. * Observer class that is attached to each observed
  48091. * object. Once attached, the observer converts the target
  48092. * object's property keys into getter/setters that
  48093. * collect dependencies and dispatch updates.
  48094. */
  48095. var Observer = function Observer (value) {
  48096. this.value = value;
  48097. this.dep = new Dep();
  48098. this.vmCount = 0;
  48099. def(value, '__ob__', this);
  48100. if (Array.isArray(value)) {
  48101. if (hasProto) {
  48102. protoAugment(value, arrayMethods);
  48103. } else {
  48104. copyAugment(value, arrayMethods, arrayKeys);
  48105. }
  48106. this.observeArray(value);
  48107. } else {
  48108. this.walk(value);
  48109. }
  48110. };
  48111. /**
  48112. * Walk through all properties and convert them into
  48113. * getter/setters. This method should only be called when
  48114. * value type is Object.
  48115. */
  48116. Observer.prototype.walk = function walk (obj) {
  48117. var keys = Object.keys(obj);
  48118. for (var i = 0; i < keys.length; i++) {
  48119. defineReactive$$1(obj, keys[i]);
  48120. }
  48121. };
  48122. /**
  48123. * Observe a list of Array items.
  48124. */
  48125. Observer.prototype.observeArray = function observeArray (items) {
  48126. for (var i = 0, l = items.length; i < l; i++) {
  48127. observe(items[i]);
  48128. }
  48129. };
  48130. // helpers
  48131. /**
  48132. * Augment a target Object or Array by intercepting
  48133. * the prototype chain using __proto__
  48134. */
  48135. function protoAugment (target, src) {
  48136. /* eslint-disable no-proto */
  48137. target.__proto__ = src;
  48138. /* eslint-enable no-proto */
  48139. }
  48140. /**
  48141. * Augment a target Object or Array by defining
  48142. * hidden properties.
  48143. */
  48144. /* istanbul ignore next */
  48145. function copyAugment (target, src, keys) {
  48146. for (var i = 0, l = keys.length; i < l; i++) {
  48147. var key = keys[i];
  48148. def(target, key, src[key]);
  48149. }
  48150. }
  48151. /**
  48152. * Attempt to create an observer instance for a value,
  48153. * returns the new observer if successfully observed,
  48154. * or the existing observer if the value already has one.
  48155. */
  48156. function observe (value, asRootData) {
  48157. if (!isObject(value) || value instanceof VNode) {
  48158. return
  48159. }
  48160. var ob;
  48161. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  48162. ob = value.__ob__;
  48163. } else if (
  48164. shouldObserve &&
  48165. !isServerRendering() &&
  48166. (Array.isArray(value) || isPlainObject(value)) &&
  48167. Object.isExtensible(value) &&
  48168. !value._isVue
  48169. ) {
  48170. ob = new Observer(value);
  48171. }
  48172. if (asRootData && ob) {
  48173. ob.vmCount++;
  48174. }
  48175. return ob
  48176. }
  48177. /**
  48178. * Define a reactive property on an Object.
  48179. */
  48180. function defineReactive$$1 (
  48181. obj,
  48182. key,
  48183. val,
  48184. customSetter,
  48185. shallow
  48186. ) {
  48187. var dep = new Dep();
  48188. var property = Object.getOwnPropertyDescriptor(obj, key);
  48189. if (property && property.configurable === false) {
  48190. return
  48191. }
  48192. // cater for pre-defined getter/setters
  48193. var getter = property && property.get;
  48194. var setter = property && property.set;
  48195. if ((!getter || setter) && arguments.length === 2) {
  48196. val = obj[key];
  48197. }
  48198. var childOb = !shallow && observe(val);
  48199. Object.defineProperty(obj, key, {
  48200. enumerable: true,
  48201. configurable: true,
  48202. get: function reactiveGetter () {
  48203. var value = getter ? getter.call(obj) : val;
  48204. if (Dep.target) {
  48205. dep.depend();
  48206. if (childOb) {
  48207. childOb.dep.depend();
  48208. if (Array.isArray(value)) {
  48209. dependArray(value);
  48210. }
  48211. }
  48212. }
  48213. return value
  48214. },
  48215. set: function reactiveSetter (newVal) {
  48216. var value = getter ? getter.call(obj) : val;
  48217. /* eslint-disable no-self-compare */
  48218. if (newVal === value || (newVal !== newVal && value !== value)) {
  48219. return
  48220. }
  48221. /* eslint-enable no-self-compare */
  48222. if (customSetter) {
  48223. customSetter();
  48224. }
  48225. // #7981: for accessor properties without setter
  48226. if (getter && !setter) { return }
  48227. if (setter) {
  48228. setter.call(obj, newVal);
  48229. } else {
  48230. val = newVal;
  48231. }
  48232. childOb = !shallow && observe(newVal);
  48233. dep.notify();
  48234. }
  48235. });
  48236. }
  48237. /**
  48238. * Set a property on an object. Adds the new property and
  48239. * triggers change notification if the property doesn't
  48240. * already exist.
  48241. */
  48242. function set (target, key, val) {
  48243. if (isUndef(target) || isPrimitive(target)
  48244. ) {
  48245. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  48246. }
  48247. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48248. target.length = Math.max(target.length, key);
  48249. target.splice(key, 1, val);
  48250. return val
  48251. }
  48252. if (key in target && !(key in Object.prototype)) {
  48253. target[key] = val;
  48254. return val
  48255. }
  48256. var ob = (target).__ob__;
  48257. if (target._isVue || (ob && ob.vmCount)) {
  48258. warn(
  48259. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  48260. 'at runtime - declare it upfront in the data option.'
  48261. );
  48262. return val
  48263. }
  48264. if (!ob) {
  48265. target[key] = val;
  48266. return val
  48267. }
  48268. defineReactive$$1(ob.value, key, val);
  48269. ob.dep.notify();
  48270. return val
  48271. }
  48272. /**
  48273. * Delete a property and trigger change if necessary.
  48274. */
  48275. function del (target, key) {
  48276. if (isUndef(target) || isPrimitive(target)
  48277. ) {
  48278. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  48279. }
  48280. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48281. target.splice(key, 1);
  48282. return
  48283. }
  48284. var ob = (target).__ob__;
  48285. if (target._isVue || (ob && ob.vmCount)) {
  48286. warn(
  48287. 'Avoid deleting properties on a Vue instance or its root $data ' +
  48288. '- just set it to null.'
  48289. );
  48290. return
  48291. }
  48292. if (!hasOwn(target, key)) {
  48293. return
  48294. }
  48295. delete target[key];
  48296. if (!ob) {
  48297. return
  48298. }
  48299. ob.dep.notify();
  48300. }
  48301. /**
  48302. * Collect dependencies on array elements when the array is touched, since
  48303. * we cannot intercept array element access like property getters.
  48304. */
  48305. function dependArray (value) {
  48306. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  48307. e = value[i];
  48308. e && e.__ob__ && e.__ob__.dep.depend();
  48309. if (Array.isArray(e)) {
  48310. dependArray(e);
  48311. }
  48312. }
  48313. }
  48314. /* */
  48315. /**
  48316. * Option overwriting strategies are functions that handle
  48317. * how to merge a parent option value and a child option
  48318. * value into the final value.
  48319. */
  48320. var strats = config.optionMergeStrategies;
  48321. /**
  48322. * Options with restrictions
  48323. */
  48324. {
  48325. strats.el = strats.propsData = function (parent, child, vm, key) {
  48326. if (!vm) {
  48327. warn(
  48328. "option \"" + key + "\" can only be used during instance " +
  48329. 'creation with the `new` keyword.'
  48330. );
  48331. }
  48332. return defaultStrat(parent, child)
  48333. };
  48334. }
  48335. /**
  48336. * Helper that recursively merges two data objects together.
  48337. */
  48338. function mergeData (to, from) {
  48339. if (!from) { return to }
  48340. var key, toVal, fromVal;
  48341. var keys = hasSymbol
  48342. ? Reflect.ownKeys(from)
  48343. : Object.keys(from);
  48344. for (var i = 0; i < keys.length; i++) {
  48345. key = keys[i];
  48346. // in case the object is already observed...
  48347. if (key === '__ob__') { continue }
  48348. toVal = to[key];
  48349. fromVal = from[key];
  48350. if (!hasOwn(to, key)) {
  48351. set(to, key, fromVal);
  48352. } else if (
  48353. toVal !== fromVal &&
  48354. isPlainObject(toVal) &&
  48355. isPlainObject(fromVal)
  48356. ) {
  48357. mergeData(toVal, fromVal);
  48358. }
  48359. }
  48360. return to
  48361. }
  48362. /**
  48363. * Data
  48364. */
  48365. function mergeDataOrFn (
  48366. parentVal,
  48367. childVal,
  48368. vm
  48369. ) {
  48370. if (!vm) {
  48371. // in a Vue.extend merge, both should be functions
  48372. if (!childVal) {
  48373. return parentVal
  48374. }
  48375. if (!parentVal) {
  48376. return childVal
  48377. }
  48378. // when parentVal & childVal are both present,
  48379. // we need to return a function that returns the
  48380. // merged result of both functions... no need to
  48381. // check if parentVal is a function here because
  48382. // it has to be a function to pass previous merges.
  48383. return function mergedDataFn () {
  48384. return mergeData(
  48385. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  48386. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  48387. )
  48388. }
  48389. } else {
  48390. return function mergedInstanceDataFn () {
  48391. // instance merge
  48392. var instanceData = typeof childVal === 'function'
  48393. ? childVal.call(vm, vm)
  48394. : childVal;
  48395. var defaultData = typeof parentVal === 'function'
  48396. ? parentVal.call(vm, vm)
  48397. : parentVal;
  48398. if (instanceData) {
  48399. return mergeData(instanceData, defaultData)
  48400. } else {
  48401. return defaultData
  48402. }
  48403. }
  48404. }
  48405. }
  48406. strats.data = function (
  48407. parentVal,
  48408. childVal,
  48409. vm
  48410. ) {
  48411. if (!vm) {
  48412. if (childVal && typeof childVal !== 'function') {
  48413. warn(
  48414. 'The "data" option should be a function ' +
  48415. 'that returns a per-instance value in component ' +
  48416. 'definitions.',
  48417. vm
  48418. );
  48419. return parentVal
  48420. }
  48421. return mergeDataOrFn(parentVal, childVal)
  48422. }
  48423. return mergeDataOrFn(parentVal, childVal, vm)
  48424. };
  48425. /**
  48426. * Hooks and props are merged as arrays.
  48427. */
  48428. function mergeHook (
  48429. parentVal,
  48430. childVal
  48431. ) {
  48432. var res = childVal
  48433. ? parentVal
  48434. ? parentVal.concat(childVal)
  48435. : Array.isArray(childVal)
  48436. ? childVal
  48437. : [childVal]
  48438. : parentVal;
  48439. return res
  48440. ? dedupeHooks(res)
  48441. : res
  48442. }
  48443. function dedupeHooks (hooks) {
  48444. var res = [];
  48445. for (var i = 0; i < hooks.length; i++) {
  48446. if (res.indexOf(hooks[i]) === -1) {
  48447. res.push(hooks[i]);
  48448. }
  48449. }
  48450. return res
  48451. }
  48452. LIFECYCLE_HOOKS.forEach(function (hook) {
  48453. strats[hook] = mergeHook;
  48454. });
  48455. /**
  48456. * Assets
  48457. *
  48458. * When a vm is present (instance creation), we need to do
  48459. * a three-way merge between constructor options, instance
  48460. * options and parent options.
  48461. */
  48462. function mergeAssets (
  48463. parentVal,
  48464. childVal,
  48465. vm,
  48466. key
  48467. ) {
  48468. var res = Object.create(parentVal || null);
  48469. if (childVal) {
  48470. assertObjectType(key, childVal, vm);
  48471. return extend(res, childVal)
  48472. } else {
  48473. return res
  48474. }
  48475. }
  48476. ASSET_TYPES.forEach(function (type) {
  48477. strats[type + 's'] = mergeAssets;
  48478. });
  48479. /**
  48480. * Watchers.
  48481. *
  48482. * Watchers hashes should not overwrite one
  48483. * another, so we merge them as arrays.
  48484. */
  48485. strats.watch = function (
  48486. parentVal,
  48487. childVal,
  48488. vm,
  48489. key
  48490. ) {
  48491. // work around Firefox's Object.prototype.watch...
  48492. if (parentVal === nativeWatch) { parentVal = undefined; }
  48493. if (childVal === nativeWatch) { childVal = undefined; }
  48494. /* istanbul ignore if */
  48495. if (!childVal) { return Object.create(parentVal || null) }
  48496. {
  48497. assertObjectType(key, childVal, vm);
  48498. }
  48499. if (!parentVal) { return childVal }
  48500. var ret = {};
  48501. extend(ret, parentVal);
  48502. for (var key$1 in childVal) {
  48503. var parent = ret[key$1];
  48504. var child = childVal[key$1];
  48505. if (parent && !Array.isArray(parent)) {
  48506. parent = [parent];
  48507. }
  48508. ret[key$1] = parent
  48509. ? parent.concat(child)
  48510. : Array.isArray(child) ? child : [child];
  48511. }
  48512. return ret
  48513. };
  48514. /**
  48515. * Other object hashes.
  48516. */
  48517. strats.props =
  48518. strats.methods =
  48519. strats.inject =
  48520. strats.computed = function (
  48521. parentVal,
  48522. childVal,
  48523. vm,
  48524. key
  48525. ) {
  48526. if (childVal && "development" !== 'production') {
  48527. assertObjectType(key, childVal, vm);
  48528. }
  48529. if (!parentVal) { return childVal }
  48530. var ret = Object.create(null);
  48531. extend(ret, parentVal);
  48532. if (childVal) { extend(ret, childVal); }
  48533. return ret
  48534. };
  48535. strats.provide = mergeDataOrFn;
  48536. /**
  48537. * Default strategy.
  48538. */
  48539. var defaultStrat = function (parentVal, childVal) {
  48540. return childVal === undefined
  48541. ? parentVal
  48542. : childVal
  48543. };
  48544. /**
  48545. * Validate component names
  48546. */
  48547. function checkComponents (options) {
  48548. for (var key in options.components) {
  48549. validateComponentName(key);
  48550. }
  48551. }
  48552. function validateComponentName (name) {
  48553. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  48554. warn(
  48555. 'Invalid component name: "' + name + '". Component names ' +
  48556. 'should conform to valid custom element name in html5 specification.'
  48557. );
  48558. }
  48559. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  48560. warn(
  48561. 'Do not use built-in or reserved HTML elements as component ' +
  48562. 'id: ' + name
  48563. );
  48564. }
  48565. }
  48566. /**
  48567. * Ensure all props option syntax are normalized into the
  48568. * Object-based format.
  48569. */
  48570. function normalizeProps (options, vm) {
  48571. var props = options.props;
  48572. if (!props) { return }
  48573. var res = {};
  48574. var i, val, name;
  48575. if (Array.isArray(props)) {
  48576. i = props.length;
  48577. while (i--) {
  48578. val = props[i];
  48579. if (typeof val === 'string') {
  48580. name = camelize(val);
  48581. res[name] = { type: null };
  48582. } else {
  48583. warn('props must be strings when using array syntax.');
  48584. }
  48585. }
  48586. } else if (isPlainObject(props)) {
  48587. for (var key in props) {
  48588. val = props[key];
  48589. name = camelize(key);
  48590. res[name] = isPlainObject(val)
  48591. ? val
  48592. : { type: val };
  48593. }
  48594. } else {
  48595. warn(
  48596. "Invalid value for option \"props\": expected an Array or an Object, " +
  48597. "but got " + (toRawType(props)) + ".",
  48598. vm
  48599. );
  48600. }
  48601. options.props = res;
  48602. }
  48603. /**
  48604. * Normalize all injections into Object-based format
  48605. */
  48606. function normalizeInject (options, vm) {
  48607. var inject = options.inject;
  48608. if (!inject) { return }
  48609. var normalized = options.inject = {};
  48610. if (Array.isArray(inject)) {
  48611. for (var i = 0; i < inject.length; i++) {
  48612. normalized[inject[i]] = { from: inject[i] };
  48613. }
  48614. } else if (isPlainObject(inject)) {
  48615. for (var key in inject) {
  48616. var val = inject[key];
  48617. normalized[key] = isPlainObject(val)
  48618. ? extend({ from: key }, val)
  48619. : { from: val };
  48620. }
  48621. } else {
  48622. warn(
  48623. "Invalid value for option \"inject\": expected an Array or an Object, " +
  48624. "but got " + (toRawType(inject)) + ".",
  48625. vm
  48626. );
  48627. }
  48628. }
  48629. /**
  48630. * Normalize raw function directives into object format.
  48631. */
  48632. function normalizeDirectives (options) {
  48633. var dirs = options.directives;
  48634. if (dirs) {
  48635. for (var key in dirs) {
  48636. var def$$1 = dirs[key];
  48637. if (typeof def$$1 === 'function') {
  48638. dirs[key] = { bind: def$$1, update: def$$1 };
  48639. }
  48640. }
  48641. }
  48642. }
  48643. function assertObjectType (name, value, vm) {
  48644. if (!isPlainObject(value)) {
  48645. warn(
  48646. "Invalid value for option \"" + name + "\": expected an Object, " +
  48647. "but got " + (toRawType(value)) + ".",
  48648. vm
  48649. );
  48650. }
  48651. }
  48652. /**
  48653. * Merge two option objects into a new one.
  48654. * Core utility used in both instantiation and inheritance.
  48655. */
  48656. function mergeOptions (
  48657. parent,
  48658. child,
  48659. vm
  48660. ) {
  48661. {
  48662. checkComponents(child);
  48663. }
  48664. if (typeof child === 'function') {
  48665. child = child.options;
  48666. }
  48667. normalizeProps(child, vm);
  48668. normalizeInject(child, vm);
  48669. normalizeDirectives(child);
  48670. // Apply extends and mixins on the child options,
  48671. // but only if it is a raw options object that isn't
  48672. // the result of another mergeOptions call.
  48673. // Only merged options has the _base property.
  48674. if (!child._base) {
  48675. if (child.extends) {
  48676. parent = mergeOptions(parent, child.extends, vm);
  48677. }
  48678. if (child.mixins) {
  48679. for (var i = 0, l = child.mixins.length; i < l; i++) {
  48680. parent = mergeOptions(parent, child.mixins[i], vm);
  48681. }
  48682. }
  48683. }
  48684. var options = {};
  48685. var key;
  48686. for (key in parent) {
  48687. mergeField(key);
  48688. }
  48689. for (key in child) {
  48690. if (!hasOwn(parent, key)) {
  48691. mergeField(key);
  48692. }
  48693. }
  48694. function mergeField (key) {
  48695. var strat = strats[key] || defaultStrat;
  48696. options[key] = strat(parent[key], child[key], vm, key);
  48697. }
  48698. return options
  48699. }
  48700. /**
  48701. * Resolve an asset.
  48702. * This function is used because child instances need access
  48703. * to assets defined in its ancestor chain.
  48704. */
  48705. function resolveAsset (
  48706. options,
  48707. type,
  48708. id,
  48709. warnMissing
  48710. ) {
  48711. /* istanbul ignore if */
  48712. if (typeof id !== 'string') {
  48713. return
  48714. }
  48715. var assets = options[type];
  48716. // check local registration variations first
  48717. if (hasOwn(assets, id)) { return assets[id] }
  48718. var camelizedId = camelize(id);
  48719. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  48720. var PascalCaseId = capitalize(camelizedId);
  48721. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  48722. // fallback to prototype chain
  48723. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  48724. if (warnMissing && !res) {
  48725. warn(
  48726. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  48727. options
  48728. );
  48729. }
  48730. return res
  48731. }
  48732. /* */
  48733. function validateProp (
  48734. key,
  48735. propOptions,
  48736. propsData,
  48737. vm
  48738. ) {
  48739. var prop = propOptions[key];
  48740. var absent = !hasOwn(propsData, key);
  48741. var value = propsData[key];
  48742. // boolean casting
  48743. var booleanIndex = getTypeIndex(Boolean, prop.type);
  48744. if (booleanIndex > -1) {
  48745. if (absent && !hasOwn(prop, 'default')) {
  48746. value = false;
  48747. } else if (value === '' || value === hyphenate(key)) {
  48748. // only cast empty string / same name to boolean if
  48749. // boolean has higher priority
  48750. var stringIndex = getTypeIndex(String, prop.type);
  48751. if (stringIndex < 0 || booleanIndex < stringIndex) {
  48752. value = true;
  48753. }
  48754. }
  48755. }
  48756. // check default value
  48757. if (value === undefined) {
  48758. value = getPropDefaultValue(vm, prop, key);
  48759. // since the default value is a fresh copy,
  48760. // make sure to observe it.
  48761. var prevShouldObserve = shouldObserve;
  48762. toggleObserving(true);
  48763. observe(value);
  48764. toggleObserving(prevShouldObserve);
  48765. }
  48766. {
  48767. assertProp(prop, key, value, vm, absent);
  48768. }
  48769. return value
  48770. }
  48771. /**
  48772. * Get the default value of a prop.
  48773. */
  48774. function getPropDefaultValue (vm, prop, key) {
  48775. // no default, return undefined
  48776. if (!hasOwn(prop, 'default')) {
  48777. return undefined
  48778. }
  48779. var def = prop.default;
  48780. // warn against non-factory defaults for Object & Array
  48781. if (isObject(def)) {
  48782. warn(
  48783. 'Invalid default value for prop "' + key + '": ' +
  48784. 'Props with type Object/Array must use a factory function ' +
  48785. 'to return the default value.',
  48786. vm
  48787. );
  48788. }
  48789. // the raw prop value was also undefined from previous render,
  48790. // return previous default value to avoid unnecessary watcher trigger
  48791. if (vm && vm.$options.propsData &&
  48792. vm.$options.propsData[key] === undefined &&
  48793. vm._props[key] !== undefined
  48794. ) {
  48795. return vm._props[key]
  48796. }
  48797. // call factory function for non-Function types
  48798. // a value is Function if its prototype is function even across different execution context
  48799. return typeof def === 'function' && getType(prop.type) !== 'Function'
  48800. ? def.call(vm)
  48801. : def
  48802. }
  48803. /**
  48804. * Assert whether a prop is valid.
  48805. */
  48806. function assertProp (
  48807. prop,
  48808. name,
  48809. value,
  48810. vm,
  48811. absent
  48812. ) {
  48813. if (prop.required && absent) {
  48814. warn(
  48815. 'Missing required prop: "' + name + '"',
  48816. vm
  48817. );
  48818. return
  48819. }
  48820. if (value == null && !prop.required) {
  48821. return
  48822. }
  48823. var type = prop.type;
  48824. var valid = !type || type === true;
  48825. var expectedTypes = [];
  48826. if (type) {
  48827. if (!Array.isArray(type)) {
  48828. type = [type];
  48829. }
  48830. for (var i = 0; i < type.length && !valid; i++) {
  48831. var assertedType = assertType(value, type[i]);
  48832. expectedTypes.push(assertedType.expectedType || '');
  48833. valid = assertedType.valid;
  48834. }
  48835. }
  48836. if (!valid) {
  48837. warn(
  48838. getInvalidTypeMessage(name, value, expectedTypes),
  48839. vm
  48840. );
  48841. return
  48842. }
  48843. var validator = prop.validator;
  48844. if (validator) {
  48845. if (!validator(value)) {
  48846. warn(
  48847. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  48848. vm
  48849. );
  48850. }
  48851. }
  48852. }
  48853. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  48854. function assertType (value, type) {
  48855. var valid;
  48856. var expectedType = getType(type);
  48857. if (simpleCheckRE.test(expectedType)) {
  48858. var t = typeof value;
  48859. valid = t === expectedType.toLowerCase();
  48860. // for primitive wrapper objects
  48861. if (!valid && t === 'object') {
  48862. valid = value instanceof type;
  48863. }
  48864. } else if (expectedType === 'Object') {
  48865. valid = isPlainObject(value);
  48866. } else if (expectedType === 'Array') {
  48867. valid = Array.isArray(value);
  48868. } else {
  48869. valid = value instanceof type;
  48870. }
  48871. return {
  48872. valid: valid,
  48873. expectedType: expectedType
  48874. }
  48875. }
  48876. /**
  48877. * Use function string name to check built-in types,
  48878. * because a simple equality check will fail when running
  48879. * across different vms / iframes.
  48880. */
  48881. function getType (fn) {
  48882. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  48883. return match ? match[1] : ''
  48884. }
  48885. function isSameType (a, b) {
  48886. return getType(a) === getType(b)
  48887. }
  48888. function getTypeIndex (type, expectedTypes) {
  48889. if (!Array.isArray(expectedTypes)) {
  48890. return isSameType(expectedTypes, type) ? 0 : -1
  48891. }
  48892. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  48893. if (isSameType(expectedTypes[i], type)) {
  48894. return i
  48895. }
  48896. }
  48897. return -1
  48898. }
  48899. function getInvalidTypeMessage (name, value, expectedTypes) {
  48900. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  48901. " Expected " + (expectedTypes.map(capitalize).join(', '));
  48902. var expectedType = expectedTypes[0];
  48903. var receivedType = toRawType(value);
  48904. var expectedValue = styleValue(value, expectedType);
  48905. var receivedValue = styleValue(value, receivedType);
  48906. // check if we need to specify expected value
  48907. if (expectedTypes.length === 1 &&
  48908. isExplicable(expectedType) &&
  48909. !isBoolean(expectedType, receivedType)) {
  48910. message += " with value " + expectedValue;
  48911. }
  48912. message += ", got " + receivedType + " ";
  48913. // check if we need to specify received value
  48914. if (isExplicable(receivedType)) {
  48915. message += "with value " + receivedValue + ".";
  48916. }
  48917. return message
  48918. }
  48919. function styleValue (value, type) {
  48920. if (type === 'String') {
  48921. return ("\"" + value + "\"")
  48922. } else if (type === 'Number') {
  48923. return ("" + (Number(value)))
  48924. } else {
  48925. return ("" + value)
  48926. }
  48927. }
  48928. function isExplicable (value) {
  48929. var explicitTypes = ['string', 'number', 'boolean'];
  48930. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  48931. }
  48932. function isBoolean () {
  48933. var args = [], len = arguments.length;
  48934. while ( len-- ) args[ len ] = arguments[ len ];
  48935. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  48936. }
  48937. /* */
  48938. function handleError (err, vm, info) {
  48939. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  48940. // See: https://github.com/vuejs/vuex/issues/1505
  48941. pushTarget();
  48942. try {
  48943. if (vm) {
  48944. var cur = vm;
  48945. while ((cur = cur.$parent)) {
  48946. var hooks = cur.$options.errorCaptured;
  48947. if (hooks) {
  48948. for (var i = 0; i < hooks.length; i++) {
  48949. try {
  48950. var capture = hooks[i].call(cur, err, vm, info) === false;
  48951. if (capture) { return }
  48952. } catch (e) {
  48953. globalHandleError(e, cur, 'errorCaptured hook');
  48954. }
  48955. }
  48956. }
  48957. }
  48958. }
  48959. globalHandleError(err, vm, info);
  48960. } finally {
  48961. popTarget();
  48962. }
  48963. }
  48964. function invokeWithErrorHandling (
  48965. handler,
  48966. context,
  48967. args,
  48968. vm,
  48969. info
  48970. ) {
  48971. var res;
  48972. try {
  48973. res = args ? handler.apply(context, args) : handler.call(context);
  48974. if (res && !res._isVue && isPromise(res) && !res._handled) {
  48975. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  48976. // issue #9511
  48977. // avoid catch triggering multiple times when nested calls
  48978. res._handled = true;
  48979. }
  48980. } catch (e) {
  48981. handleError(e, vm, info);
  48982. }
  48983. return res
  48984. }
  48985. function globalHandleError (err, vm, info) {
  48986. if (config.errorHandler) {
  48987. try {
  48988. return config.errorHandler.call(null, err, vm, info)
  48989. } catch (e) {
  48990. // if the user intentionally throws the original error in the handler,
  48991. // do not log it twice
  48992. if (e !== err) {
  48993. logError(e, null, 'config.errorHandler');
  48994. }
  48995. }
  48996. }
  48997. logError(err, vm, info);
  48998. }
  48999. function logError (err, vm, info) {
  49000. {
  49001. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  49002. }
  49003. /* istanbul ignore else */
  49004. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  49005. console.error(err);
  49006. } else {
  49007. throw err
  49008. }
  49009. }
  49010. /* */
  49011. var isUsingMicroTask = false;
  49012. var callbacks = [];
  49013. var pending = false;
  49014. function flushCallbacks () {
  49015. pending = false;
  49016. var copies = callbacks.slice(0);
  49017. callbacks.length = 0;
  49018. for (var i = 0; i < copies.length; i++) {
  49019. copies[i]();
  49020. }
  49021. }
  49022. // Here we have async deferring wrappers using microtasks.
  49023. // In 2.5 we used (macro) tasks (in combination with microtasks).
  49024. // However, it has subtle problems when state is changed right before repaint
  49025. // (e.g. #6813, out-in transitions).
  49026. // Also, using (macro) tasks in event handler would cause some weird behaviors
  49027. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  49028. // So we now use microtasks everywhere, again.
  49029. // A major drawback of this tradeoff is that there are some scenarios
  49030. // where microtasks have too high a priority and fire in between supposedly
  49031. // sequential events (e.g. #4521, #6690, which have workarounds)
  49032. // or even between bubbling of the same event (#6566).
  49033. var timerFunc;
  49034. // The nextTick behavior leverages the microtask queue, which can be accessed
  49035. // via either native Promise.then or MutationObserver.
  49036. // MutationObserver has wider support, however it is seriously bugged in
  49037. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  49038. // completely stops working after triggering a few times... so, if native
  49039. // Promise is available, we will use it:
  49040. /* istanbul ignore next, $flow-disable-line */
  49041. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  49042. var p = Promise.resolve();
  49043. timerFunc = function () {
  49044. p.then(flushCallbacks);
  49045. // In problematic UIWebViews, Promise.then doesn't completely break, but
  49046. // it can get stuck in a weird state where callbacks are pushed into the
  49047. // microtask queue but the queue isn't being flushed, until the browser
  49048. // needs to do some other work, e.g. handle a timer. Therefore we can
  49049. // "force" the microtask queue to be flushed by adding an empty timer.
  49050. if (isIOS) { setTimeout(noop); }
  49051. };
  49052. isUsingMicroTask = true;
  49053. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  49054. isNative(MutationObserver) ||
  49055. // PhantomJS and iOS 7.x
  49056. MutationObserver.toString() === '[object MutationObserverConstructor]'
  49057. )) {
  49058. // Use MutationObserver where native Promise is not available,
  49059. // e.g. PhantomJS, iOS7, Android 4.4
  49060. // (#6466 MutationObserver is unreliable in IE11)
  49061. var counter = 1;
  49062. var observer = new MutationObserver(flushCallbacks);
  49063. var textNode = document.createTextNode(String(counter));
  49064. observer.observe(textNode, {
  49065. characterData: true
  49066. });
  49067. timerFunc = function () {
  49068. counter = (counter + 1) % 2;
  49069. textNode.data = String(counter);
  49070. };
  49071. isUsingMicroTask = true;
  49072. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  49073. // Fallback to setImmediate.
  49074. // Technically it leverages the (macro) task queue,
  49075. // but it is still a better choice than setTimeout.
  49076. timerFunc = function () {
  49077. setImmediate(flushCallbacks);
  49078. };
  49079. } else {
  49080. // Fallback to setTimeout.
  49081. timerFunc = function () {
  49082. setTimeout(flushCallbacks, 0);
  49083. };
  49084. }
  49085. function nextTick (cb, ctx) {
  49086. var _resolve;
  49087. callbacks.push(function () {
  49088. if (cb) {
  49089. try {
  49090. cb.call(ctx);
  49091. } catch (e) {
  49092. handleError(e, ctx, 'nextTick');
  49093. }
  49094. } else if (_resolve) {
  49095. _resolve(ctx);
  49096. }
  49097. });
  49098. if (!pending) {
  49099. pending = true;
  49100. timerFunc();
  49101. }
  49102. // $flow-disable-line
  49103. if (!cb && typeof Promise !== 'undefined') {
  49104. return new Promise(function (resolve) {
  49105. _resolve = resolve;
  49106. })
  49107. }
  49108. }
  49109. /* */
  49110. var mark;
  49111. var measure;
  49112. {
  49113. var perf = inBrowser && window.performance;
  49114. /* istanbul ignore if */
  49115. if (
  49116. perf &&
  49117. perf.mark &&
  49118. perf.measure &&
  49119. perf.clearMarks &&
  49120. perf.clearMeasures
  49121. ) {
  49122. mark = function (tag) { return perf.mark(tag); };
  49123. measure = function (name, startTag, endTag) {
  49124. perf.measure(name, startTag, endTag);
  49125. perf.clearMarks(startTag);
  49126. perf.clearMarks(endTag);
  49127. // perf.clearMeasures(name)
  49128. };
  49129. }
  49130. }
  49131. /* not type checking this file because flow doesn't play well with Proxy */
  49132. var initProxy;
  49133. {
  49134. var allowedGlobals = makeMap(
  49135. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  49136. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  49137. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  49138. 'require' // for Webpack/Browserify
  49139. );
  49140. var warnNonPresent = function (target, key) {
  49141. warn(
  49142. "Property or method \"" + key + "\" is not defined on the instance but " +
  49143. 'referenced during render. Make sure that this property is reactive, ' +
  49144. 'either in the data option, or for class-based components, by ' +
  49145. 'initializing the property. ' +
  49146. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  49147. target
  49148. );
  49149. };
  49150. var warnReservedPrefix = function (target, key) {
  49151. warn(
  49152. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  49153. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  49154. 'prevent conflicts with Vue internals. ' +
  49155. 'See: https://vuejs.org/v2/api/#data',
  49156. target
  49157. );
  49158. };
  49159. var hasProxy =
  49160. typeof Proxy !== 'undefined' && isNative(Proxy);
  49161. if (hasProxy) {
  49162. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  49163. config.keyCodes = new Proxy(config.keyCodes, {
  49164. set: function set (target, key, value) {
  49165. if (isBuiltInModifier(key)) {
  49166. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  49167. return false
  49168. } else {
  49169. target[key] = value;
  49170. return true
  49171. }
  49172. }
  49173. });
  49174. }
  49175. var hasHandler = {
  49176. has: function has (target, key) {
  49177. var has = key in target;
  49178. var isAllowed = allowedGlobals(key) ||
  49179. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  49180. if (!has && !isAllowed) {
  49181. if (key in target.$data) { warnReservedPrefix(target, key); }
  49182. else { warnNonPresent(target, key); }
  49183. }
  49184. return has || !isAllowed
  49185. }
  49186. };
  49187. var getHandler = {
  49188. get: function get (target, key) {
  49189. if (typeof key === 'string' && !(key in target)) {
  49190. if (key in target.$data) { warnReservedPrefix(target, key); }
  49191. else { warnNonPresent(target, key); }
  49192. }
  49193. return target[key]
  49194. }
  49195. };
  49196. initProxy = function initProxy (vm) {
  49197. if (hasProxy) {
  49198. // determine which proxy handler to use
  49199. var options = vm.$options;
  49200. var handlers = options.render && options.render._withStripped
  49201. ? getHandler
  49202. : hasHandler;
  49203. vm._renderProxy = new Proxy(vm, handlers);
  49204. } else {
  49205. vm._renderProxy = vm;
  49206. }
  49207. };
  49208. }
  49209. /* */
  49210. var seenObjects = new _Set();
  49211. /**
  49212. * Recursively traverse an object to evoke all converted
  49213. * getters, so that every nested property inside the object
  49214. * is collected as a "deep" dependency.
  49215. */
  49216. function traverse (val) {
  49217. _traverse(val, seenObjects);
  49218. seenObjects.clear();
  49219. }
  49220. function _traverse (val, seen) {
  49221. var i, keys;
  49222. var isA = Array.isArray(val);
  49223. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  49224. return
  49225. }
  49226. if (val.__ob__) {
  49227. var depId = val.__ob__.dep.id;
  49228. if (seen.has(depId)) {
  49229. return
  49230. }
  49231. seen.add(depId);
  49232. }
  49233. if (isA) {
  49234. i = val.length;
  49235. while (i--) { _traverse(val[i], seen); }
  49236. } else {
  49237. keys = Object.keys(val);
  49238. i = keys.length;
  49239. while (i--) { _traverse(val[keys[i]], seen); }
  49240. }
  49241. }
  49242. /* */
  49243. var normalizeEvent = cached(function (name) {
  49244. var passive = name.charAt(0) === '&';
  49245. name = passive ? name.slice(1) : name;
  49246. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  49247. name = once$$1 ? name.slice(1) : name;
  49248. var capture = name.charAt(0) === '!';
  49249. name = capture ? name.slice(1) : name;
  49250. return {
  49251. name: name,
  49252. once: once$$1,
  49253. capture: capture,
  49254. passive: passive
  49255. }
  49256. });
  49257. function createFnInvoker (fns, vm) {
  49258. function invoker () {
  49259. var arguments$1 = arguments;
  49260. var fns = invoker.fns;
  49261. if (Array.isArray(fns)) {
  49262. var cloned = fns.slice();
  49263. for (var i = 0; i < cloned.length; i++) {
  49264. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  49265. }
  49266. } else {
  49267. // return handler return value for single handlers
  49268. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  49269. }
  49270. }
  49271. invoker.fns = fns;
  49272. return invoker
  49273. }
  49274. function updateListeners (
  49275. on,
  49276. oldOn,
  49277. add,
  49278. remove$$1,
  49279. createOnceHandler,
  49280. vm
  49281. ) {
  49282. var name, def$$1, cur, old, event;
  49283. for (name in on) {
  49284. def$$1 = cur = on[name];
  49285. old = oldOn[name];
  49286. event = normalizeEvent(name);
  49287. if (isUndef(cur)) {
  49288. warn(
  49289. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  49290. vm
  49291. );
  49292. } else if (isUndef(old)) {
  49293. if (isUndef(cur.fns)) {
  49294. cur = on[name] = createFnInvoker(cur, vm);
  49295. }
  49296. if (isTrue(event.once)) {
  49297. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  49298. }
  49299. add(event.name, cur, event.capture, event.passive, event.params);
  49300. } else if (cur !== old) {
  49301. old.fns = cur;
  49302. on[name] = old;
  49303. }
  49304. }
  49305. for (name in oldOn) {
  49306. if (isUndef(on[name])) {
  49307. event = normalizeEvent(name);
  49308. remove$$1(event.name, oldOn[name], event.capture);
  49309. }
  49310. }
  49311. }
  49312. /* */
  49313. function mergeVNodeHook (def, hookKey, hook) {
  49314. if (def instanceof VNode) {
  49315. def = def.data.hook || (def.data.hook = {});
  49316. }
  49317. var invoker;
  49318. var oldHook = def[hookKey];
  49319. function wrappedHook () {
  49320. hook.apply(this, arguments);
  49321. // important: remove merged hook to ensure it's called only once
  49322. // and prevent memory leak
  49323. remove(invoker.fns, wrappedHook);
  49324. }
  49325. if (isUndef(oldHook)) {
  49326. // no existing hook
  49327. invoker = createFnInvoker([wrappedHook]);
  49328. } else {
  49329. /* istanbul ignore if */
  49330. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  49331. // already a merged invoker
  49332. invoker = oldHook;
  49333. invoker.fns.push(wrappedHook);
  49334. } else {
  49335. // existing plain hook
  49336. invoker = createFnInvoker([oldHook, wrappedHook]);
  49337. }
  49338. }
  49339. invoker.merged = true;
  49340. def[hookKey] = invoker;
  49341. }
  49342. /* */
  49343. function extractPropsFromVNodeData (
  49344. data,
  49345. Ctor,
  49346. tag
  49347. ) {
  49348. // we are only extracting raw values here.
  49349. // validation and default values are handled in the child
  49350. // component itself.
  49351. var propOptions = Ctor.options.props;
  49352. if (isUndef(propOptions)) {
  49353. return
  49354. }
  49355. var res = {};
  49356. var attrs = data.attrs;
  49357. var props = data.props;
  49358. if (isDef(attrs) || isDef(props)) {
  49359. for (var key in propOptions) {
  49360. var altKey = hyphenate(key);
  49361. {
  49362. var keyInLowerCase = key.toLowerCase();
  49363. if (
  49364. key !== keyInLowerCase &&
  49365. attrs && hasOwn(attrs, keyInLowerCase)
  49366. ) {
  49367. tip(
  49368. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  49369. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  49370. " \"" + key + "\". " +
  49371. "Note that HTML attributes are case-insensitive and camelCased " +
  49372. "props need to use their kebab-case equivalents when using in-DOM " +
  49373. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  49374. );
  49375. }
  49376. }
  49377. checkProp(res, props, key, altKey, true) ||
  49378. checkProp(res, attrs, key, altKey, false);
  49379. }
  49380. }
  49381. return res
  49382. }
  49383. function checkProp (
  49384. res,
  49385. hash,
  49386. key,
  49387. altKey,
  49388. preserve
  49389. ) {
  49390. if (isDef(hash)) {
  49391. if (hasOwn(hash, key)) {
  49392. res[key] = hash[key];
  49393. if (!preserve) {
  49394. delete hash[key];
  49395. }
  49396. return true
  49397. } else if (hasOwn(hash, altKey)) {
  49398. res[key] = hash[altKey];
  49399. if (!preserve) {
  49400. delete hash[altKey];
  49401. }
  49402. return true
  49403. }
  49404. }
  49405. return false
  49406. }
  49407. /* */
  49408. // The template compiler attempts to minimize the need for normalization by
  49409. // statically analyzing the template at compile time.
  49410. //
  49411. // For plain HTML markup, normalization can be completely skipped because the
  49412. // generated render function is guaranteed to return Array<VNode>. There are
  49413. // two cases where extra normalization is needed:
  49414. // 1. When the children contains components - because a functional component
  49415. // may return an Array instead of a single root. In this case, just a simple
  49416. // normalization is needed - if any child is an Array, we flatten the whole
  49417. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  49418. // because functional components already normalize their own children.
  49419. function simpleNormalizeChildren (children) {
  49420. for (var i = 0; i < children.length; i++) {
  49421. if (Array.isArray(children[i])) {
  49422. return Array.prototype.concat.apply([], children)
  49423. }
  49424. }
  49425. return children
  49426. }
  49427. // 2. When the children contains constructs that always generated nested Arrays,
  49428. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  49429. // with hand-written render functions / JSX. In such cases a full normalization
  49430. // is needed to cater to all possible types of children values.
  49431. function normalizeChildren (children) {
  49432. return isPrimitive(children)
  49433. ? [createTextVNode(children)]
  49434. : Array.isArray(children)
  49435. ? normalizeArrayChildren(children)
  49436. : undefined
  49437. }
  49438. function isTextNode (node) {
  49439. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  49440. }
  49441. function normalizeArrayChildren (children, nestedIndex) {
  49442. var res = [];
  49443. var i, c, lastIndex, last;
  49444. for (i = 0; i < children.length; i++) {
  49445. c = children[i];
  49446. if (isUndef(c) || typeof c === 'boolean') { continue }
  49447. lastIndex = res.length - 1;
  49448. last = res[lastIndex];
  49449. // nested
  49450. if (Array.isArray(c)) {
  49451. if (c.length > 0) {
  49452. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  49453. // merge adjacent text nodes
  49454. if (isTextNode(c[0]) && isTextNode(last)) {
  49455. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  49456. c.shift();
  49457. }
  49458. res.push.apply(res, c);
  49459. }
  49460. } else if (isPrimitive(c)) {
  49461. if (isTextNode(last)) {
  49462. // merge adjacent text nodes
  49463. // this is necessary for SSR hydration because text nodes are
  49464. // essentially merged when rendered to HTML strings
  49465. res[lastIndex] = createTextVNode(last.text + c);
  49466. } else if (c !== '') {
  49467. // convert primitive to vnode
  49468. res.push(createTextVNode(c));
  49469. }
  49470. } else {
  49471. if (isTextNode(c) && isTextNode(last)) {
  49472. // merge adjacent text nodes
  49473. res[lastIndex] = createTextVNode(last.text + c.text);
  49474. } else {
  49475. // default key for nested array children (likely generated by v-for)
  49476. if (isTrue(children._isVList) &&
  49477. isDef(c.tag) &&
  49478. isUndef(c.key) &&
  49479. isDef(nestedIndex)) {
  49480. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  49481. }
  49482. res.push(c);
  49483. }
  49484. }
  49485. }
  49486. return res
  49487. }
  49488. /* */
  49489. function initProvide (vm) {
  49490. var provide = vm.$options.provide;
  49491. if (provide) {
  49492. vm._provided = typeof provide === 'function'
  49493. ? provide.call(vm)
  49494. : provide;
  49495. }
  49496. }
  49497. function initInjections (vm) {
  49498. var result = resolveInject(vm.$options.inject, vm);
  49499. if (result) {
  49500. toggleObserving(false);
  49501. Object.keys(result).forEach(function (key) {
  49502. /* istanbul ignore else */
  49503. {
  49504. defineReactive$$1(vm, key, result[key], function () {
  49505. warn(
  49506. "Avoid mutating an injected value directly since the changes will be " +
  49507. "overwritten whenever the provided component re-renders. " +
  49508. "injection being mutated: \"" + key + "\"",
  49509. vm
  49510. );
  49511. });
  49512. }
  49513. });
  49514. toggleObserving(true);
  49515. }
  49516. }
  49517. function resolveInject (inject, vm) {
  49518. if (inject) {
  49519. // inject is :any because flow is not smart enough to figure out cached
  49520. var result = Object.create(null);
  49521. var keys = hasSymbol
  49522. ? Reflect.ownKeys(inject)
  49523. : Object.keys(inject);
  49524. for (var i = 0; i < keys.length; i++) {
  49525. var key = keys[i];
  49526. // #6574 in case the inject object is observed...
  49527. if (key === '__ob__') { continue }
  49528. var provideKey = inject[key].from;
  49529. var source = vm;
  49530. while (source) {
  49531. if (source._provided && hasOwn(source._provided, provideKey)) {
  49532. result[key] = source._provided[provideKey];
  49533. break
  49534. }
  49535. source = source.$parent;
  49536. }
  49537. if (!source) {
  49538. if ('default' in inject[key]) {
  49539. var provideDefault = inject[key].default;
  49540. result[key] = typeof provideDefault === 'function'
  49541. ? provideDefault.call(vm)
  49542. : provideDefault;
  49543. } else {
  49544. warn(("Injection \"" + key + "\" not found"), vm);
  49545. }
  49546. }
  49547. }
  49548. return result
  49549. }
  49550. }
  49551. /* */
  49552. /**
  49553. * Runtime helper for resolving raw children VNodes into a slot object.
  49554. */
  49555. function resolveSlots (
  49556. children,
  49557. context
  49558. ) {
  49559. if (!children || !children.length) {
  49560. return {}
  49561. }
  49562. var slots = {};
  49563. for (var i = 0, l = children.length; i < l; i++) {
  49564. var child = children[i];
  49565. var data = child.data;
  49566. // remove slot attribute if the node is resolved as a Vue slot node
  49567. if (data && data.attrs && data.attrs.slot) {
  49568. delete data.attrs.slot;
  49569. }
  49570. // named slots should only be respected if the vnode was rendered in the
  49571. // same context.
  49572. if ((child.context === context || child.fnContext === context) &&
  49573. data && data.slot != null
  49574. ) {
  49575. var name = data.slot;
  49576. var slot = (slots[name] || (slots[name] = []));
  49577. if (child.tag === 'template') {
  49578. slot.push.apply(slot, child.children || []);
  49579. } else {
  49580. slot.push(child);
  49581. }
  49582. } else {
  49583. (slots.default || (slots.default = [])).push(child);
  49584. }
  49585. }
  49586. // ignore slots that contains only whitespace
  49587. for (var name$1 in slots) {
  49588. if (slots[name$1].every(isWhitespace)) {
  49589. delete slots[name$1];
  49590. }
  49591. }
  49592. return slots
  49593. }
  49594. function isWhitespace (node) {
  49595. return (node.isComment && !node.asyncFactory) || node.text === ' '
  49596. }
  49597. /* */
  49598. function normalizeScopedSlots (
  49599. slots,
  49600. normalSlots,
  49601. prevSlots
  49602. ) {
  49603. var res;
  49604. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  49605. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  49606. var key = slots && slots.$key;
  49607. if (!slots) {
  49608. res = {};
  49609. } else if (slots._normalized) {
  49610. // fast path 1: child component re-render only, parent did not change
  49611. return slots._normalized
  49612. } else if (
  49613. isStable &&
  49614. prevSlots &&
  49615. prevSlots !== emptyObject &&
  49616. key === prevSlots.$key &&
  49617. !hasNormalSlots &&
  49618. !prevSlots.$hasNormal
  49619. ) {
  49620. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  49621. // only need to normalize once
  49622. return prevSlots
  49623. } else {
  49624. res = {};
  49625. for (var key$1 in slots) {
  49626. if (slots[key$1] && key$1[0] !== '$') {
  49627. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  49628. }
  49629. }
  49630. }
  49631. // expose normal slots on scopedSlots
  49632. for (var key$2 in normalSlots) {
  49633. if (!(key$2 in res)) {
  49634. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  49635. }
  49636. }
  49637. // avoriaz seems to mock a non-extensible $scopedSlots object
  49638. // and when that is passed down this would cause an error
  49639. if (slots && Object.isExtensible(slots)) {
  49640. (slots)._normalized = res;
  49641. }
  49642. def(res, '$stable', isStable);
  49643. def(res, '$key', key);
  49644. def(res, '$hasNormal', hasNormalSlots);
  49645. return res
  49646. }
  49647. function normalizeScopedSlot(normalSlots, key, fn) {
  49648. var normalized = function () {
  49649. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  49650. res = res && typeof res === 'object' && !Array.isArray(res)
  49651. ? [res] // single vnode
  49652. : normalizeChildren(res);
  49653. return res && (
  49654. res.length === 0 ||
  49655. (res.length === 1 && res[0].isComment) // #9658
  49656. ) ? undefined
  49657. : res
  49658. };
  49659. // this is a slot using the new v-slot syntax without scope. although it is
  49660. // compiled as a scoped slot, render fn users would expect it to be present
  49661. // on this.$slots because the usage is semantically a normal slot.
  49662. if (fn.proxy) {
  49663. Object.defineProperty(normalSlots, key, {
  49664. get: normalized,
  49665. enumerable: true,
  49666. configurable: true
  49667. });
  49668. }
  49669. return normalized
  49670. }
  49671. function proxyNormalSlot(slots, key) {
  49672. return function () { return slots[key]; }
  49673. }
  49674. /* */
  49675. /**
  49676. * Runtime helper for rendering v-for lists.
  49677. */
  49678. function renderList (
  49679. val,
  49680. render
  49681. ) {
  49682. var ret, i, l, keys, key;
  49683. if (Array.isArray(val) || typeof val === 'string') {
  49684. ret = new Array(val.length);
  49685. for (i = 0, l = val.length; i < l; i++) {
  49686. ret[i] = render(val[i], i);
  49687. }
  49688. } else if (typeof val === 'number') {
  49689. ret = new Array(val);
  49690. for (i = 0; i < val; i++) {
  49691. ret[i] = render(i + 1, i);
  49692. }
  49693. } else if (isObject(val)) {
  49694. if (hasSymbol && val[Symbol.iterator]) {
  49695. ret = [];
  49696. var iterator = val[Symbol.iterator]();
  49697. var result = iterator.next();
  49698. while (!result.done) {
  49699. ret.push(render(result.value, ret.length));
  49700. result = iterator.next();
  49701. }
  49702. } else {
  49703. keys = Object.keys(val);
  49704. ret = new Array(keys.length);
  49705. for (i = 0, l = keys.length; i < l; i++) {
  49706. key = keys[i];
  49707. ret[i] = render(val[key], key, i);
  49708. }
  49709. }
  49710. }
  49711. if (!isDef(ret)) {
  49712. ret = [];
  49713. }
  49714. (ret)._isVList = true;
  49715. return ret
  49716. }
  49717. /* */
  49718. /**
  49719. * Runtime helper for rendering <slot>
  49720. */
  49721. function renderSlot (
  49722. name,
  49723. fallback,
  49724. props,
  49725. bindObject
  49726. ) {
  49727. var scopedSlotFn = this.$scopedSlots[name];
  49728. var nodes;
  49729. if (scopedSlotFn) { // scoped slot
  49730. props = props || {};
  49731. if (bindObject) {
  49732. if (!isObject(bindObject)) {
  49733. warn(
  49734. 'slot v-bind without argument expects an Object',
  49735. this
  49736. );
  49737. }
  49738. props = extend(extend({}, bindObject), props);
  49739. }
  49740. nodes = scopedSlotFn(props) || fallback;
  49741. } else {
  49742. nodes = this.$slots[name] || fallback;
  49743. }
  49744. var target = props && props.slot;
  49745. if (target) {
  49746. return this.$createElement('template', { slot: target }, nodes)
  49747. } else {
  49748. return nodes
  49749. }
  49750. }
  49751. /* */
  49752. /**
  49753. * Runtime helper for resolving filters
  49754. */
  49755. function resolveFilter (id) {
  49756. return resolveAsset(this.$options, 'filters', id, true) || identity
  49757. }
  49758. /* */
  49759. function isKeyNotMatch (expect, actual) {
  49760. if (Array.isArray(expect)) {
  49761. return expect.indexOf(actual) === -1
  49762. } else {
  49763. return expect !== actual
  49764. }
  49765. }
  49766. /**
  49767. * Runtime helper for checking keyCodes from config.
  49768. * exposed as Vue.prototype._k
  49769. * passing in eventKeyName as last argument separately for backwards compat
  49770. */
  49771. function checkKeyCodes (
  49772. eventKeyCode,
  49773. key,
  49774. builtInKeyCode,
  49775. eventKeyName,
  49776. builtInKeyName
  49777. ) {
  49778. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  49779. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  49780. return isKeyNotMatch(builtInKeyName, eventKeyName)
  49781. } else if (mappedKeyCode) {
  49782. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  49783. } else if (eventKeyName) {
  49784. return hyphenate(eventKeyName) !== key
  49785. }
  49786. }
  49787. /* */
  49788. /**
  49789. * Runtime helper for merging v-bind="object" into a VNode's data.
  49790. */
  49791. function bindObjectProps (
  49792. data,
  49793. tag,
  49794. value,
  49795. asProp,
  49796. isSync
  49797. ) {
  49798. if (value) {
  49799. if (!isObject(value)) {
  49800. warn(
  49801. 'v-bind without argument expects an Object or Array value',
  49802. this
  49803. );
  49804. } else {
  49805. if (Array.isArray(value)) {
  49806. value = toObject(value);
  49807. }
  49808. var hash;
  49809. var loop = function ( key ) {
  49810. if (
  49811. key === 'class' ||
  49812. key === 'style' ||
  49813. isReservedAttribute(key)
  49814. ) {
  49815. hash = data;
  49816. } else {
  49817. var type = data.attrs && data.attrs.type;
  49818. hash = asProp || config.mustUseProp(tag, type, key)
  49819. ? data.domProps || (data.domProps = {})
  49820. : data.attrs || (data.attrs = {});
  49821. }
  49822. var camelizedKey = camelize(key);
  49823. var hyphenatedKey = hyphenate(key);
  49824. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  49825. hash[key] = value[key];
  49826. if (isSync) {
  49827. var on = data.on || (data.on = {});
  49828. on[("update:" + key)] = function ($event) {
  49829. value[key] = $event;
  49830. };
  49831. }
  49832. }
  49833. };
  49834. for (var key in value) loop( key );
  49835. }
  49836. }
  49837. return data
  49838. }
  49839. /* */
  49840. /**
  49841. * Runtime helper for rendering static trees.
  49842. */
  49843. function renderStatic (
  49844. index,
  49845. isInFor
  49846. ) {
  49847. var cached = this._staticTrees || (this._staticTrees = []);
  49848. var tree = cached[index];
  49849. // if has already-rendered static tree and not inside v-for,
  49850. // we can reuse the same tree.
  49851. if (tree && !isInFor) {
  49852. return tree
  49853. }
  49854. // otherwise, render a fresh tree.
  49855. tree = cached[index] = this.$options.staticRenderFns[index].call(
  49856. this._renderProxy,
  49857. null,
  49858. this // for render fns generated for functional component templates
  49859. );
  49860. markStatic(tree, ("__static__" + index), false);
  49861. return tree
  49862. }
  49863. /**
  49864. * Runtime helper for v-once.
  49865. * Effectively it means marking the node as static with a unique key.
  49866. */
  49867. function markOnce (
  49868. tree,
  49869. index,
  49870. key
  49871. ) {
  49872. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  49873. return tree
  49874. }
  49875. function markStatic (
  49876. tree,
  49877. key,
  49878. isOnce
  49879. ) {
  49880. if (Array.isArray(tree)) {
  49881. for (var i = 0; i < tree.length; i++) {
  49882. if (tree[i] && typeof tree[i] !== 'string') {
  49883. markStaticNode(tree[i], (key + "_" + i), isOnce);
  49884. }
  49885. }
  49886. } else {
  49887. markStaticNode(tree, key, isOnce);
  49888. }
  49889. }
  49890. function markStaticNode (node, key, isOnce) {
  49891. node.isStatic = true;
  49892. node.key = key;
  49893. node.isOnce = isOnce;
  49894. }
  49895. /* */
  49896. function bindObjectListeners (data, value) {
  49897. if (value) {
  49898. if (!isPlainObject(value)) {
  49899. warn(
  49900. 'v-on without argument expects an Object value',
  49901. this
  49902. );
  49903. } else {
  49904. var on = data.on = data.on ? extend({}, data.on) : {};
  49905. for (var key in value) {
  49906. var existing = on[key];
  49907. var ours = value[key];
  49908. on[key] = existing ? [].concat(existing, ours) : ours;
  49909. }
  49910. }
  49911. }
  49912. return data
  49913. }
  49914. /* */
  49915. function resolveScopedSlots (
  49916. fns, // see flow/vnode
  49917. res,
  49918. // the following are added in 2.6
  49919. hasDynamicKeys,
  49920. contentHashKey
  49921. ) {
  49922. res = res || { $stable: !hasDynamicKeys };
  49923. for (var i = 0; i < fns.length; i++) {
  49924. var slot = fns[i];
  49925. if (Array.isArray(slot)) {
  49926. resolveScopedSlots(slot, res, hasDynamicKeys);
  49927. } else if (slot) {
  49928. // marker for reverse proxying v-slot without scope on this.$slots
  49929. if (slot.proxy) {
  49930. slot.fn.proxy = true;
  49931. }
  49932. res[slot.key] = slot.fn;
  49933. }
  49934. }
  49935. if (contentHashKey) {
  49936. (res).$key = contentHashKey;
  49937. }
  49938. return res
  49939. }
  49940. /* */
  49941. function bindDynamicKeys (baseObj, values) {
  49942. for (var i = 0; i < values.length; i += 2) {
  49943. var key = values[i];
  49944. if (typeof key === 'string' && key) {
  49945. baseObj[values[i]] = values[i + 1];
  49946. } else if (key !== '' && key !== null) {
  49947. // null is a special value for explicitly removing a binding
  49948. warn(
  49949. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  49950. this
  49951. );
  49952. }
  49953. }
  49954. return baseObj
  49955. }
  49956. // helper to dynamically append modifier runtime markers to event names.
  49957. // ensure only append when value is already string, otherwise it will be cast
  49958. // to string and cause the type check to miss.
  49959. function prependModifier (value, symbol) {
  49960. return typeof value === 'string' ? symbol + value : value
  49961. }
  49962. /* */
  49963. function installRenderHelpers (target) {
  49964. target._o = markOnce;
  49965. target._n = toNumber;
  49966. target._s = toString;
  49967. target._l = renderList;
  49968. target._t = renderSlot;
  49969. target._q = looseEqual;
  49970. target._i = looseIndexOf;
  49971. target._m = renderStatic;
  49972. target._f = resolveFilter;
  49973. target._k = checkKeyCodes;
  49974. target._b = bindObjectProps;
  49975. target._v = createTextVNode;
  49976. target._e = createEmptyVNode;
  49977. target._u = resolveScopedSlots;
  49978. target._g = bindObjectListeners;
  49979. target._d = bindDynamicKeys;
  49980. target._p = prependModifier;
  49981. }
  49982. /* */
  49983. function FunctionalRenderContext (
  49984. data,
  49985. props,
  49986. children,
  49987. parent,
  49988. Ctor
  49989. ) {
  49990. var this$1 = this;
  49991. var options = Ctor.options;
  49992. // ensure the createElement function in functional components
  49993. // gets a unique context - this is necessary for correct named slot check
  49994. var contextVm;
  49995. if (hasOwn(parent, '_uid')) {
  49996. contextVm = Object.create(parent);
  49997. // $flow-disable-line
  49998. contextVm._original = parent;
  49999. } else {
  50000. // the context vm passed in is a functional context as well.
  50001. // in this case we want to make sure we are able to get a hold to the
  50002. // real context instance.
  50003. contextVm = parent;
  50004. // $flow-disable-line
  50005. parent = parent._original;
  50006. }
  50007. var isCompiled = isTrue(options._compiled);
  50008. var needNormalization = !isCompiled;
  50009. this.data = data;
  50010. this.props = props;
  50011. this.children = children;
  50012. this.parent = parent;
  50013. this.listeners = data.on || emptyObject;
  50014. this.injections = resolveInject(options.inject, parent);
  50015. this.slots = function () {
  50016. if (!this$1.$slots) {
  50017. normalizeScopedSlots(
  50018. data.scopedSlots,
  50019. this$1.$slots = resolveSlots(children, parent)
  50020. );
  50021. }
  50022. return this$1.$slots
  50023. };
  50024. Object.defineProperty(this, 'scopedSlots', ({
  50025. enumerable: true,
  50026. get: function get () {
  50027. return normalizeScopedSlots(data.scopedSlots, this.slots())
  50028. }
  50029. }));
  50030. // support for compiled functional template
  50031. if (isCompiled) {
  50032. // exposing $options for renderStatic()
  50033. this.$options = options;
  50034. // pre-resolve slots for renderSlot()
  50035. this.$slots = this.slots();
  50036. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  50037. }
  50038. if (options._scopeId) {
  50039. this._c = function (a, b, c, d) {
  50040. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  50041. if (vnode && !Array.isArray(vnode)) {
  50042. vnode.fnScopeId = options._scopeId;
  50043. vnode.fnContext = parent;
  50044. }
  50045. return vnode
  50046. };
  50047. } else {
  50048. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  50049. }
  50050. }
  50051. installRenderHelpers(FunctionalRenderContext.prototype);
  50052. function createFunctionalComponent (
  50053. Ctor,
  50054. propsData,
  50055. data,
  50056. contextVm,
  50057. children
  50058. ) {
  50059. var options = Ctor.options;
  50060. var props = {};
  50061. var propOptions = options.props;
  50062. if (isDef(propOptions)) {
  50063. for (var key in propOptions) {
  50064. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  50065. }
  50066. } else {
  50067. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  50068. if (isDef(data.props)) { mergeProps(props, data.props); }
  50069. }
  50070. var renderContext = new FunctionalRenderContext(
  50071. data,
  50072. props,
  50073. children,
  50074. contextVm,
  50075. Ctor
  50076. );
  50077. var vnode = options.render.call(null, renderContext._c, renderContext);
  50078. if (vnode instanceof VNode) {
  50079. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  50080. } else if (Array.isArray(vnode)) {
  50081. var vnodes = normalizeChildren(vnode) || [];
  50082. var res = new Array(vnodes.length);
  50083. for (var i = 0; i < vnodes.length; i++) {
  50084. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  50085. }
  50086. return res
  50087. }
  50088. }
  50089. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  50090. // #7817 clone node before setting fnContext, otherwise if the node is reused
  50091. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  50092. // that should not be matched to match.
  50093. var clone = cloneVNode(vnode);
  50094. clone.fnContext = contextVm;
  50095. clone.fnOptions = options;
  50096. {
  50097. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  50098. }
  50099. if (data.slot) {
  50100. (clone.data || (clone.data = {})).slot = data.slot;
  50101. }
  50102. return clone
  50103. }
  50104. function mergeProps (to, from) {
  50105. for (var key in from) {
  50106. to[camelize(key)] = from[key];
  50107. }
  50108. }
  50109. /* */
  50110. /* */
  50111. /* */
  50112. /* */
  50113. // inline hooks to be invoked on component VNodes during patch
  50114. var componentVNodeHooks = {
  50115. init: function init (vnode, hydrating) {
  50116. if (
  50117. vnode.componentInstance &&
  50118. !vnode.componentInstance._isDestroyed &&
  50119. vnode.data.keepAlive
  50120. ) {
  50121. // kept-alive components, treat as a patch
  50122. var mountedNode = vnode; // work around flow
  50123. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  50124. } else {
  50125. var child = vnode.componentInstance = createComponentInstanceForVnode(
  50126. vnode,
  50127. activeInstance
  50128. );
  50129. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  50130. }
  50131. },
  50132. prepatch: function prepatch (oldVnode, vnode) {
  50133. var options = vnode.componentOptions;
  50134. var child = vnode.componentInstance = oldVnode.componentInstance;
  50135. updateChildComponent(
  50136. child,
  50137. options.propsData, // updated props
  50138. options.listeners, // updated listeners
  50139. vnode, // new parent vnode
  50140. options.children // new children
  50141. );
  50142. },
  50143. insert: function insert (vnode) {
  50144. var context = vnode.context;
  50145. var componentInstance = vnode.componentInstance;
  50146. if (!componentInstance._isMounted) {
  50147. componentInstance._isMounted = true;
  50148. callHook(componentInstance, 'mounted');
  50149. }
  50150. if (vnode.data.keepAlive) {
  50151. if (context._isMounted) {
  50152. // vue-router#1212
  50153. // During updates, a kept-alive component's child components may
  50154. // change, so directly walking the tree here may call activated hooks
  50155. // on incorrect children. Instead we push them into a queue which will
  50156. // be processed after the whole patch process ended.
  50157. queueActivatedComponent(componentInstance);
  50158. } else {
  50159. activateChildComponent(componentInstance, true /* direct */);
  50160. }
  50161. }
  50162. },
  50163. destroy: function destroy (vnode) {
  50164. var componentInstance = vnode.componentInstance;
  50165. if (!componentInstance._isDestroyed) {
  50166. if (!vnode.data.keepAlive) {
  50167. componentInstance.$destroy();
  50168. } else {
  50169. deactivateChildComponent(componentInstance, true /* direct */);
  50170. }
  50171. }
  50172. }
  50173. };
  50174. var hooksToMerge = Object.keys(componentVNodeHooks);
  50175. function createComponent (
  50176. Ctor,
  50177. data,
  50178. context,
  50179. children,
  50180. tag
  50181. ) {
  50182. if (isUndef(Ctor)) {
  50183. return
  50184. }
  50185. var baseCtor = context.$options._base;
  50186. // plain options object: turn it into a constructor
  50187. if (isObject(Ctor)) {
  50188. Ctor = baseCtor.extend(Ctor);
  50189. }
  50190. // if at this stage it's not a constructor or an async component factory,
  50191. // reject.
  50192. if (typeof Ctor !== 'function') {
  50193. {
  50194. warn(("Invalid Component definition: " + (String(Ctor))), context);
  50195. }
  50196. return
  50197. }
  50198. // async component
  50199. var asyncFactory;
  50200. if (isUndef(Ctor.cid)) {
  50201. asyncFactory = Ctor;
  50202. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  50203. if (Ctor === undefined) {
  50204. // return a placeholder node for async component, which is rendered
  50205. // as a comment node but preserves all the raw information for the node.
  50206. // the information will be used for async server-rendering and hydration.
  50207. return createAsyncPlaceholder(
  50208. asyncFactory,
  50209. data,
  50210. context,
  50211. children,
  50212. tag
  50213. )
  50214. }
  50215. }
  50216. data = data || {};
  50217. // resolve constructor options in case global mixins are applied after
  50218. // component constructor creation
  50219. resolveConstructorOptions(Ctor);
  50220. // transform component v-model data into props & events
  50221. if (isDef(data.model)) {
  50222. transformModel(Ctor.options, data);
  50223. }
  50224. // extract props
  50225. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  50226. // functional component
  50227. if (isTrue(Ctor.options.functional)) {
  50228. return createFunctionalComponent(Ctor, propsData, data, context, children)
  50229. }
  50230. // extract listeners, since these needs to be treated as
  50231. // child component listeners instead of DOM listeners
  50232. var listeners = data.on;
  50233. // replace with listeners with .native modifier
  50234. // so it gets processed during parent component patch.
  50235. data.on = data.nativeOn;
  50236. if (isTrue(Ctor.options.abstract)) {
  50237. // abstract components do not keep anything
  50238. // other than props & listeners & slot
  50239. // work around flow
  50240. var slot = data.slot;
  50241. data = {};
  50242. if (slot) {
  50243. data.slot = slot;
  50244. }
  50245. }
  50246. // install component management hooks onto the placeholder node
  50247. installComponentHooks(data);
  50248. // return a placeholder vnode
  50249. var name = Ctor.options.name || tag;
  50250. var vnode = new VNode(
  50251. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  50252. data, undefined, undefined, undefined, context,
  50253. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  50254. asyncFactory
  50255. );
  50256. return vnode
  50257. }
  50258. function createComponentInstanceForVnode (
  50259. vnode, // we know it's MountedComponentVNode but flow doesn't
  50260. parent // activeInstance in lifecycle state
  50261. ) {
  50262. var options = {
  50263. _isComponent: true,
  50264. _parentVnode: vnode,
  50265. parent: parent
  50266. };
  50267. // check inline-template render functions
  50268. var inlineTemplate = vnode.data.inlineTemplate;
  50269. if (isDef(inlineTemplate)) {
  50270. options.render = inlineTemplate.render;
  50271. options.staticRenderFns = inlineTemplate.staticRenderFns;
  50272. }
  50273. return new vnode.componentOptions.Ctor(options)
  50274. }
  50275. function installComponentHooks (data) {
  50276. var hooks = data.hook || (data.hook = {});
  50277. for (var i = 0; i < hooksToMerge.length; i++) {
  50278. var key = hooksToMerge[i];
  50279. var existing = hooks[key];
  50280. var toMerge = componentVNodeHooks[key];
  50281. if (existing !== toMerge && !(existing && existing._merged)) {
  50282. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  50283. }
  50284. }
  50285. }
  50286. function mergeHook$1 (f1, f2) {
  50287. var merged = function (a, b) {
  50288. // flow complains about extra args which is why we use any
  50289. f1(a, b);
  50290. f2(a, b);
  50291. };
  50292. merged._merged = true;
  50293. return merged
  50294. }
  50295. // transform component v-model info (value and callback) into
  50296. // prop and event handler respectively.
  50297. function transformModel (options, data) {
  50298. var prop = (options.model && options.model.prop) || 'value';
  50299. var event = (options.model && options.model.event) || 'input'
  50300. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  50301. var on = data.on || (data.on = {});
  50302. var existing = on[event];
  50303. var callback = data.model.callback;
  50304. if (isDef(existing)) {
  50305. if (
  50306. Array.isArray(existing)
  50307. ? existing.indexOf(callback) === -1
  50308. : existing !== callback
  50309. ) {
  50310. on[event] = [callback].concat(existing);
  50311. }
  50312. } else {
  50313. on[event] = callback;
  50314. }
  50315. }
  50316. /* */
  50317. var SIMPLE_NORMALIZE = 1;
  50318. var ALWAYS_NORMALIZE = 2;
  50319. // wrapper function for providing a more flexible interface
  50320. // without getting yelled at by flow
  50321. function createElement (
  50322. context,
  50323. tag,
  50324. data,
  50325. children,
  50326. normalizationType,
  50327. alwaysNormalize
  50328. ) {
  50329. if (Array.isArray(data) || isPrimitive(data)) {
  50330. normalizationType = children;
  50331. children = data;
  50332. data = undefined;
  50333. }
  50334. if (isTrue(alwaysNormalize)) {
  50335. normalizationType = ALWAYS_NORMALIZE;
  50336. }
  50337. return _createElement(context, tag, data, children, normalizationType)
  50338. }
  50339. function _createElement (
  50340. context,
  50341. tag,
  50342. data,
  50343. children,
  50344. normalizationType
  50345. ) {
  50346. if (isDef(data) && isDef((data).__ob__)) {
  50347. warn(
  50348. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  50349. 'Always create fresh vnode data objects in each render!',
  50350. context
  50351. );
  50352. return createEmptyVNode()
  50353. }
  50354. // object syntax in v-bind
  50355. if (isDef(data) && isDef(data.is)) {
  50356. tag = data.is;
  50357. }
  50358. if (!tag) {
  50359. // in case of component :is set to falsy value
  50360. return createEmptyVNode()
  50361. }
  50362. // warn against non-primitive key
  50363. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  50364. ) {
  50365. {
  50366. warn(
  50367. 'Avoid using non-primitive value as key, ' +
  50368. 'use string/number value instead.',
  50369. context
  50370. );
  50371. }
  50372. }
  50373. // support single function children as default scoped slot
  50374. if (Array.isArray(children) &&
  50375. typeof children[0] === 'function'
  50376. ) {
  50377. data = data || {};
  50378. data.scopedSlots = { default: children[0] };
  50379. children.length = 0;
  50380. }
  50381. if (normalizationType === ALWAYS_NORMALIZE) {
  50382. children = normalizeChildren(children);
  50383. } else if (normalizationType === SIMPLE_NORMALIZE) {
  50384. children = simpleNormalizeChildren(children);
  50385. }
  50386. var vnode, ns;
  50387. if (typeof tag === 'string') {
  50388. var Ctor;
  50389. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  50390. if (config.isReservedTag(tag)) {
  50391. // platform built-in elements
  50392. if (isDef(data) && isDef(data.nativeOn)) {
  50393. warn(
  50394. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  50395. context
  50396. );
  50397. }
  50398. vnode = new VNode(
  50399. config.parsePlatformTagName(tag), data, children,
  50400. undefined, undefined, context
  50401. );
  50402. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  50403. // component
  50404. vnode = createComponent(Ctor, data, context, children, tag);
  50405. } else {
  50406. // unknown or unlisted namespaced elements
  50407. // check at runtime because it may get assigned a namespace when its
  50408. // parent normalizes children
  50409. vnode = new VNode(
  50410. tag, data, children,
  50411. undefined, undefined, context
  50412. );
  50413. }
  50414. } else {
  50415. // direct component options / constructor
  50416. vnode = createComponent(tag, data, context, children);
  50417. }
  50418. if (Array.isArray(vnode)) {
  50419. return vnode
  50420. } else if (isDef(vnode)) {
  50421. if (isDef(ns)) { applyNS(vnode, ns); }
  50422. if (isDef(data)) { registerDeepBindings(data); }
  50423. return vnode
  50424. } else {
  50425. return createEmptyVNode()
  50426. }
  50427. }
  50428. function applyNS (vnode, ns, force) {
  50429. vnode.ns = ns;
  50430. if (vnode.tag === 'foreignObject') {
  50431. // use default namespace inside foreignObject
  50432. ns = undefined;
  50433. force = true;
  50434. }
  50435. if (isDef(vnode.children)) {
  50436. for (var i = 0, l = vnode.children.length; i < l; i++) {
  50437. var child = vnode.children[i];
  50438. if (isDef(child.tag) && (
  50439. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  50440. applyNS(child, ns, force);
  50441. }
  50442. }
  50443. }
  50444. }
  50445. // ref #5318
  50446. // necessary to ensure parent re-render when deep bindings like :style and
  50447. // :class are used on slot nodes
  50448. function registerDeepBindings (data) {
  50449. if (isObject(data.style)) {
  50450. traverse(data.style);
  50451. }
  50452. if (isObject(data.class)) {
  50453. traverse(data.class);
  50454. }
  50455. }
  50456. /* */
  50457. function initRender (vm) {
  50458. vm._vnode = null; // the root of the child tree
  50459. vm._staticTrees = null; // v-once cached trees
  50460. var options = vm.$options;
  50461. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  50462. var renderContext = parentVnode && parentVnode.context;
  50463. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  50464. vm.$scopedSlots = emptyObject;
  50465. // bind the createElement fn to this instance
  50466. // so that we get proper render context inside it.
  50467. // args order: tag, data, children, normalizationType, alwaysNormalize
  50468. // internal version is used by render functions compiled from templates
  50469. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  50470. // normalization is always applied for the public version, used in
  50471. // user-written render functions.
  50472. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  50473. // $attrs & $listeners are exposed for easier HOC creation.
  50474. // they need to be reactive so that HOCs using them are always updated
  50475. var parentData = parentVnode && parentVnode.data;
  50476. /* istanbul ignore else */
  50477. {
  50478. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  50479. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  50480. }, true);
  50481. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  50482. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  50483. }, true);
  50484. }
  50485. }
  50486. var currentRenderingInstance = null;
  50487. function renderMixin (Vue) {
  50488. // install runtime convenience helpers
  50489. installRenderHelpers(Vue.prototype);
  50490. Vue.prototype.$nextTick = function (fn) {
  50491. return nextTick(fn, this)
  50492. };
  50493. Vue.prototype._render = function () {
  50494. var vm = this;
  50495. var ref = vm.$options;
  50496. var render = ref.render;
  50497. var _parentVnode = ref._parentVnode;
  50498. if (_parentVnode) {
  50499. vm.$scopedSlots = normalizeScopedSlots(
  50500. _parentVnode.data.scopedSlots,
  50501. vm.$slots,
  50502. vm.$scopedSlots
  50503. );
  50504. }
  50505. // set parent vnode. this allows render functions to have access
  50506. // to the data on the placeholder node.
  50507. vm.$vnode = _parentVnode;
  50508. // render self
  50509. var vnode;
  50510. try {
  50511. // There's no need to maintain a stack because all render fns are called
  50512. // separately from one another. Nested component's render fns are called
  50513. // when parent component is patched.
  50514. currentRenderingInstance = vm;
  50515. vnode = render.call(vm._renderProxy, vm.$createElement);
  50516. } catch (e) {
  50517. handleError(e, vm, "render");
  50518. // return error render result,
  50519. // or previous vnode to prevent render error causing blank component
  50520. /* istanbul ignore else */
  50521. if (vm.$options.renderError) {
  50522. try {
  50523. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  50524. } catch (e) {
  50525. handleError(e, vm, "renderError");
  50526. vnode = vm._vnode;
  50527. }
  50528. } else {
  50529. vnode = vm._vnode;
  50530. }
  50531. } finally {
  50532. currentRenderingInstance = null;
  50533. }
  50534. // if the returned array contains only a single node, allow it
  50535. if (Array.isArray(vnode) && vnode.length === 1) {
  50536. vnode = vnode[0];
  50537. }
  50538. // return empty vnode in case the render function errored out
  50539. if (!(vnode instanceof VNode)) {
  50540. if (Array.isArray(vnode)) {
  50541. warn(
  50542. 'Multiple root nodes returned from render function. Render function ' +
  50543. 'should return a single root node.',
  50544. vm
  50545. );
  50546. }
  50547. vnode = createEmptyVNode();
  50548. }
  50549. // set parent
  50550. vnode.parent = _parentVnode;
  50551. return vnode
  50552. };
  50553. }
  50554. /* */
  50555. function ensureCtor (comp, base) {
  50556. if (
  50557. comp.__esModule ||
  50558. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  50559. ) {
  50560. comp = comp.default;
  50561. }
  50562. return isObject(comp)
  50563. ? base.extend(comp)
  50564. : comp
  50565. }
  50566. function createAsyncPlaceholder (
  50567. factory,
  50568. data,
  50569. context,
  50570. children,
  50571. tag
  50572. ) {
  50573. var node = createEmptyVNode();
  50574. node.asyncFactory = factory;
  50575. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  50576. return node
  50577. }
  50578. function resolveAsyncComponent (
  50579. factory,
  50580. baseCtor
  50581. ) {
  50582. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  50583. return factory.errorComp
  50584. }
  50585. if (isDef(factory.resolved)) {
  50586. return factory.resolved
  50587. }
  50588. var owner = currentRenderingInstance;
  50589. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  50590. // already pending
  50591. factory.owners.push(owner);
  50592. }
  50593. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  50594. return factory.loadingComp
  50595. }
  50596. if (owner && !isDef(factory.owners)) {
  50597. var owners = factory.owners = [owner];
  50598. var sync = true;
  50599. var timerLoading = null;
  50600. var timerTimeout = null
  50601. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  50602. var forceRender = function (renderCompleted) {
  50603. for (var i = 0, l = owners.length; i < l; i++) {
  50604. (owners[i]).$forceUpdate();
  50605. }
  50606. if (renderCompleted) {
  50607. owners.length = 0;
  50608. if (timerLoading !== null) {
  50609. clearTimeout(timerLoading);
  50610. timerLoading = null;
  50611. }
  50612. if (timerTimeout !== null) {
  50613. clearTimeout(timerTimeout);
  50614. timerTimeout = null;
  50615. }
  50616. }
  50617. };
  50618. var resolve = once(function (res) {
  50619. // cache resolved
  50620. factory.resolved = ensureCtor(res, baseCtor);
  50621. // invoke callbacks only if this is not a synchronous resolve
  50622. // (async resolves are shimmed as synchronous during SSR)
  50623. if (!sync) {
  50624. forceRender(true);
  50625. } else {
  50626. owners.length = 0;
  50627. }
  50628. });
  50629. var reject = once(function (reason) {
  50630. warn(
  50631. "Failed to resolve async component: " + (String(factory)) +
  50632. (reason ? ("\nReason: " + reason) : '')
  50633. );
  50634. if (isDef(factory.errorComp)) {
  50635. factory.error = true;
  50636. forceRender(true);
  50637. }
  50638. });
  50639. var res = factory(resolve, reject);
  50640. if (isObject(res)) {
  50641. if (isPromise(res)) {
  50642. // () => Promise
  50643. if (isUndef(factory.resolved)) {
  50644. res.then(resolve, reject);
  50645. }
  50646. } else if (isPromise(res.component)) {
  50647. res.component.then(resolve, reject);
  50648. if (isDef(res.error)) {
  50649. factory.errorComp = ensureCtor(res.error, baseCtor);
  50650. }
  50651. if (isDef(res.loading)) {
  50652. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  50653. if (res.delay === 0) {
  50654. factory.loading = true;
  50655. } else {
  50656. timerLoading = setTimeout(function () {
  50657. timerLoading = null;
  50658. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  50659. factory.loading = true;
  50660. forceRender(false);
  50661. }
  50662. }, res.delay || 200);
  50663. }
  50664. }
  50665. if (isDef(res.timeout)) {
  50666. timerTimeout = setTimeout(function () {
  50667. timerTimeout = null;
  50668. if (isUndef(factory.resolved)) {
  50669. reject(
  50670. "timeout (" + (res.timeout) + "ms)"
  50671. );
  50672. }
  50673. }, res.timeout);
  50674. }
  50675. }
  50676. }
  50677. sync = false;
  50678. // return in case resolved synchronously
  50679. return factory.loading
  50680. ? factory.loadingComp
  50681. : factory.resolved
  50682. }
  50683. }
  50684. /* */
  50685. function isAsyncPlaceholder (node) {
  50686. return node.isComment && node.asyncFactory
  50687. }
  50688. /* */
  50689. function getFirstComponentChild (children) {
  50690. if (Array.isArray(children)) {
  50691. for (var i = 0; i < children.length; i++) {
  50692. var c = children[i];
  50693. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  50694. return c
  50695. }
  50696. }
  50697. }
  50698. }
  50699. /* */
  50700. /* */
  50701. function initEvents (vm) {
  50702. vm._events = Object.create(null);
  50703. vm._hasHookEvent = false;
  50704. // init parent attached events
  50705. var listeners = vm.$options._parentListeners;
  50706. if (listeners) {
  50707. updateComponentListeners(vm, listeners);
  50708. }
  50709. }
  50710. var target;
  50711. function add (event, fn) {
  50712. target.$on(event, fn);
  50713. }
  50714. function remove$1 (event, fn) {
  50715. target.$off(event, fn);
  50716. }
  50717. function createOnceHandler (event, fn) {
  50718. var _target = target;
  50719. return function onceHandler () {
  50720. var res = fn.apply(null, arguments);
  50721. if (res !== null) {
  50722. _target.$off(event, onceHandler);
  50723. }
  50724. }
  50725. }
  50726. function updateComponentListeners (
  50727. vm,
  50728. listeners,
  50729. oldListeners
  50730. ) {
  50731. target = vm;
  50732. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  50733. target = undefined;
  50734. }
  50735. function eventsMixin (Vue) {
  50736. var hookRE = /^hook:/;
  50737. Vue.prototype.$on = function (event, fn) {
  50738. var vm = this;
  50739. if (Array.isArray(event)) {
  50740. for (var i = 0, l = event.length; i < l; i++) {
  50741. vm.$on(event[i], fn);
  50742. }
  50743. } else {
  50744. (vm._events[event] || (vm._events[event] = [])).push(fn);
  50745. // optimize hook:event cost by using a boolean flag marked at registration
  50746. // instead of a hash lookup
  50747. if (hookRE.test(event)) {
  50748. vm._hasHookEvent = true;
  50749. }
  50750. }
  50751. return vm
  50752. };
  50753. Vue.prototype.$once = function (event, fn) {
  50754. var vm = this;
  50755. function on () {
  50756. vm.$off(event, on);
  50757. fn.apply(vm, arguments);
  50758. }
  50759. on.fn = fn;
  50760. vm.$on(event, on);
  50761. return vm
  50762. };
  50763. Vue.prototype.$off = function (event, fn) {
  50764. var vm = this;
  50765. // all
  50766. if (!arguments.length) {
  50767. vm._events = Object.create(null);
  50768. return vm
  50769. }
  50770. // array of events
  50771. if (Array.isArray(event)) {
  50772. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  50773. vm.$off(event[i$1], fn);
  50774. }
  50775. return vm
  50776. }
  50777. // specific event
  50778. var cbs = vm._events[event];
  50779. if (!cbs) {
  50780. return vm
  50781. }
  50782. if (!fn) {
  50783. vm._events[event] = null;
  50784. return vm
  50785. }
  50786. // specific handler
  50787. var cb;
  50788. var i = cbs.length;
  50789. while (i--) {
  50790. cb = cbs[i];
  50791. if (cb === fn || cb.fn === fn) {
  50792. cbs.splice(i, 1);
  50793. break
  50794. }
  50795. }
  50796. return vm
  50797. };
  50798. Vue.prototype.$emit = function (event) {
  50799. var vm = this;
  50800. {
  50801. var lowerCaseEvent = event.toLowerCase();
  50802. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  50803. tip(
  50804. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  50805. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  50806. "Note that HTML attributes are case-insensitive and you cannot use " +
  50807. "v-on to listen to camelCase events when using in-DOM templates. " +
  50808. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  50809. );
  50810. }
  50811. }
  50812. var cbs = vm._events[event];
  50813. if (cbs) {
  50814. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  50815. var args = toArray(arguments, 1);
  50816. var info = "event handler for \"" + event + "\"";
  50817. for (var i = 0, l = cbs.length; i < l; i++) {
  50818. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  50819. }
  50820. }
  50821. return vm
  50822. };
  50823. }
  50824. /* */
  50825. var activeInstance = null;
  50826. var isUpdatingChildComponent = false;
  50827. function setActiveInstance(vm) {
  50828. var prevActiveInstance = activeInstance;
  50829. activeInstance = vm;
  50830. return function () {
  50831. activeInstance = prevActiveInstance;
  50832. }
  50833. }
  50834. function initLifecycle (vm) {
  50835. var options = vm.$options;
  50836. // locate first non-abstract parent
  50837. var parent = options.parent;
  50838. if (parent && !options.abstract) {
  50839. while (parent.$options.abstract && parent.$parent) {
  50840. parent = parent.$parent;
  50841. }
  50842. parent.$children.push(vm);
  50843. }
  50844. vm.$parent = parent;
  50845. vm.$root = parent ? parent.$root : vm;
  50846. vm.$children = [];
  50847. vm.$refs = {};
  50848. vm._watcher = null;
  50849. vm._inactive = null;
  50850. vm._directInactive = false;
  50851. vm._isMounted = false;
  50852. vm._isDestroyed = false;
  50853. vm._isBeingDestroyed = false;
  50854. }
  50855. function lifecycleMixin (Vue) {
  50856. Vue.prototype._update = function (vnode, hydrating) {
  50857. var vm = this;
  50858. var prevEl = vm.$el;
  50859. var prevVnode = vm._vnode;
  50860. var restoreActiveInstance = setActiveInstance(vm);
  50861. vm._vnode = vnode;
  50862. // Vue.prototype.__patch__ is injected in entry points
  50863. // based on the rendering backend used.
  50864. if (!prevVnode) {
  50865. // initial render
  50866. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  50867. } else {
  50868. // updates
  50869. vm.$el = vm.__patch__(prevVnode, vnode);
  50870. }
  50871. restoreActiveInstance();
  50872. // update __vue__ reference
  50873. if (prevEl) {
  50874. prevEl.__vue__ = null;
  50875. }
  50876. if (vm.$el) {
  50877. vm.$el.__vue__ = vm;
  50878. }
  50879. // if parent is an HOC, update its $el as well
  50880. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  50881. vm.$parent.$el = vm.$el;
  50882. }
  50883. // updated hook is called by the scheduler to ensure that children are
  50884. // updated in a parent's updated hook.
  50885. };
  50886. Vue.prototype.$forceUpdate = function () {
  50887. var vm = this;
  50888. if (vm._watcher) {
  50889. vm._watcher.update();
  50890. }
  50891. };
  50892. Vue.prototype.$destroy = function () {
  50893. var vm = this;
  50894. if (vm._isBeingDestroyed) {
  50895. return
  50896. }
  50897. callHook(vm, 'beforeDestroy');
  50898. vm._isBeingDestroyed = true;
  50899. // remove self from parent
  50900. var parent = vm.$parent;
  50901. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  50902. remove(parent.$children, vm);
  50903. }
  50904. // teardown watchers
  50905. if (vm._watcher) {
  50906. vm._watcher.teardown();
  50907. }
  50908. var i = vm._watchers.length;
  50909. while (i--) {
  50910. vm._watchers[i].teardown();
  50911. }
  50912. // remove reference from data ob
  50913. // frozen object may not have observer.
  50914. if (vm._data.__ob__) {
  50915. vm._data.__ob__.vmCount--;
  50916. }
  50917. // call the last hook...
  50918. vm._isDestroyed = true;
  50919. // invoke destroy hooks on current rendered tree
  50920. vm.__patch__(vm._vnode, null);
  50921. // fire destroyed hook
  50922. callHook(vm, 'destroyed');
  50923. // turn off all instance listeners.
  50924. vm.$off();
  50925. // remove __vue__ reference
  50926. if (vm.$el) {
  50927. vm.$el.__vue__ = null;
  50928. }
  50929. // release circular reference (#6759)
  50930. if (vm.$vnode) {
  50931. vm.$vnode.parent = null;
  50932. }
  50933. };
  50934. }
  50935. function mountComponent (
  50936. vm,
  50937. el,
  50938. hydrating
  50939. ) {
  50940. vm.$el = el;
  50941. if (!vm.$options.render) {
  50942. vm.$options.render = createEmptyVNode;
  50943. {
  50944. /* istanbul ignore if */
  50945. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  50946. vm.$options.el || el) {
  50947. warn(
  50948. 'You are using the runtime-only build of Vue where the template ' +
  50949. 'compiler is not available. Either pre-compile the templates into ' +
  50950. 'render functions, or use the compiler-included build.',
  50951. vm
  50952. );
  50953. } else {
  50954. warn(
  50955. 'Failed to mount component: template or render function not defined.',
  50956. vm
  50957. );
  50958. }
  50959. }
  50960. }
  50961. callHook(vm, 'beforeMount');
  50962. var updateComponent;
  50963. /* istanbul ignore if */
  50964. if (config.performance && mark) {
  50965. updateComponent = function () {
  50966. var name = vm._name;
  50967. var id = vm._uid;
  50968. var startTag = "vue-perf-start:" + id;
  50969. var endTag = "vue-perf-end:" + id;
  50970. mark(startTag);
  50971. var vnode = vm._render();
  50972. mark(endTag);
  50973. measure(("vue " + name + " render"), startTag, endTag);
  50974. mark(startTag);
  50975. vm._update(vnode, hydrating);
  50976. mark(endTag);
  50977. measure(("vue " + name + " patch"), startTag, endTag);
  50978. };
  50979. } else {
  50980. updateComponent = function () {
  50981. vm._update(vm._render(), hydrating);
  50982. };
  50983. }
  50984. // we set this to vm._watcher inside the watcher's constructor
  50985. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  50986. // component's mounted hook), which relies on vm._watcher being already defined
  50987. new Watcher(vm, updateComponent, noop, {
  50988. before: function before () {
  50989. if (vm._isMounted && !vm._isDestroyed) {
  50990. callHook(vm, 'beforeUpdate');
  50991. }
  50992. }
  50993. }, true /* isRenderWatcher */);
  50994. hydrating = false;
  50995. // manually mounted instance, call mounted on self
  50996. // mounted is called for render-created child components in its inserted hook
  50997. if (vm.$vnode == null) {
  50998. vm._isMounted = true;
  50999. callHook(vm, 'mounted');
  51000. }
  51001. return vm
  51002. }
  51003. function updateChildComponent (
  51004. vm,
  51005. propsData,
  51006. listeners,
  51007. parentVnode,
  51008. renderChildren
  51009. ) {
  51010. {
  51011. isUpdatingChildComponent = true;
  51012. }
  51013. // determine whether component has slot children
  51014. // we need to do this before overwriting $options._renderChildren.
  51015. // check if there are dynamic scopedSlots (hand-written or compiled but with
  51016. // dynamic slot names). Static scoped slots compiled from template has the
  51017. // "$stable" marker.
  51018. var newScopedSlots = parentVnode.data.scopedSlots;
  51019. var oldScopedSlots = vm.$scopedSlots;
  51020. var hasDynamicScopedSlot = !!(
  51021. (newScopedSlots && !newScopedSlots.$stable) ||
  51022. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  51023. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  51024. );
  51025. // Any static slot children from the parent may have changed during parent's
  51026. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  51027. // update is necessary to ensure correctness.
  51028. var needsForceUpdate = !!(
  51029. renderChildren || // has new static slots
  51030. vm.$options._renderChildren || // has old static slots
  51031. hasDynamicScopedSlot
  51032. );
  51033. vm.$options._parentVnode = parentVnode;
  51034. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  51035. if (vm._vnode) { // update child tree's parent
  51036. vm._vnode.parent = parentVnode;
  51037. }
  51038. vm.$options._renderChildren = renderChildren;
  51039. // update $attrs and $listeners hash
  51040. // these are also reactive so they may trigger child update if the child
  51041. // used them during render
  51042. vm.$attrs = parentVnode.data.attrs || emptyObject;
  51043. vm.$listeners = listeners || emptyObject;
  51044. // update props
  51045. if (propsData && vm.$options.props) {
  51046. toggleObserving(false);
  51047. var props = vm._props;
  51048. var propKeys = vm.$options._propKeys || [];
  51049. for (var i = 0; i < propKeys.length; i++) {
  51050. var key = propKeys[i];
  51051. var propOptions = vm.$options.props; // wtf flow?
  51052. props[key] = validateProp(key, propOptions, propsData, vm);
  51053. }
  51054. toggleObserving(true);
  51055. // keep a copy of raw propsData
  51056. vm.$options.propsData = propsData;
  51057. }
  51058. // update listeners
  51059. listeners = listeners || emptyObject;
  51060. var oldListeners = vm.$options._parentListeners;
  51061. vm.$options._parentListeners = listeners;
  51062. updateComponentListeners(vm, listeners, oldListeners);
  51063. // resolve slots + force update if has children
  51064. if (needsForceUpdate) {
  51065. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  51066. vm.$forceUpdate();
  51067. }
  51068. {
  51069. isUpdatingChildComponent = false;
  51070. }
  51071. }
  51072. function isInInactiveTree (vm) {
  51073. while (vm && (vm = vm.$parent)) {
  51074. if (vm._inactive) { return true }
  51075. }
  51076. return false
  51077. }
  51078. function activateChildComponent (vm, direct) {
  51079. if (direct) {
  51080. vm._directInactive = false;
  51081. if (isInInactiveTree(vm)) {
  51082. return
  51083. }
  51084. } else if (vm._directInactive) {
  51085. return
  51086. }
  51087. if (vm._inactive || vm._inactive === null) {
  51088. vm._inactive = false;
  51089. for (var i = 0; i < vm.$children.length; i++) {
  51090. activateChildComponent(vm.$children[i]);
  51091. }
  51092. callHook(vm, 'activated');
  51093. }
  51094. }
  51095. function deactivateChildComponent (vm, direct) {
  51096. if (direct) {
  51097. vm._directInactive = true;
  51098. if (isInInactiveTree(vm)) {
  51099. return
  51100. }
  51101. }
  51102. if (!vm._inactive) {
  51103. vm._inactive = true;
  51104. for (var i = 0; i < vm.$children.length; i++) {
  51105. deactivateChildComponent(vm.$children[i]);
  51106. }
  51107. callHook(vm, 'deactivated');
  51108. }
  51109. }
  51110. function callHook (vm, hook) {
  51111. // #7573 disable dep collection when invoking lifecycle hooks
  51112. pushTarget();
  51113. var handlers = vm.$options[hook];
  51114. var info = hook + " hook";
  51115. if (handlers) {
  51116. for (var i = 0, j = handlers.length; i < j; i++) {
  51117. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  51118. }
  51119. }
  51120. if (vm._hasHookEvent) {
  51121. vm.$emit('hook:' + hook);
  51122. }
  51123. popTarget();
  51124. }
  51125. /* */
  51126. var MAX_UPDATE_COUNT = 100;
  51127. var queue = [];
  51128. var activatedChildren = [];
  51129. var has = {};
  51130. var circular = {};
  51131. var waiting = false;
  51132. var flushing = false;
  51133. var index = 0;
  51134. /**
  51135. * Reset the scheduler's state.
  51136. */
  51137. function resetSchedulerState () {
  51138. index = queue.length = activatedChildren.length = 0;
  51139. has = {};
  51140. {
  51141. circular = {};
  51142. }
  51143. waiting = flushing = false;
  51144. }
  51145. // Async edge case #6566 requires saving the timestamp when event listeners are
  51146. // attached. However, calling performance.now() has a perf overhead especially
  51147. // if the page has thousands of event listeners. Instead, we take a timestamp
  51148. // every time the scheduler flushes and use that for all event listeners
  51149. // attached during that flush.
  51150. var currentFlushTimestamp = 0;
  51151. // Async edge case fix requires storing an event listener's attach timestamp.
  51152. var getNow = Date.now;
  51153. // Determine what event timestamp the browser is using. Annoyingly, the
  51154. // timestamp can either be hi-res (relative to page load) or low-res
  51155. // (relative to UNIX epoch), so in order to compare time we have to use the
  51156. // same timestamp type when saving the flush timestamp.
  51157. // All IE versions use low-res event timestamps, and have problematic clock
  51158. // implementations (#9632)
  51159. if (inBrowser && !isIE) {
  51160. var performance = window.performance;
  51161. if (
  51162. performance &&
  51163. typeof performance.now === 'function' &&
  51164. getNow() > document.createEvent('Event').timeStamp
  51165. ) {
  51166. // if the event timestamp, although evaluated AFTER the Date.now(), is
  51167. // smaller than it, it means the event is using a hi-res timestamp,
  51168. // and we need to use the hi-res version for event listener timestamps as
  51169. // well.
  51170. getNow = function () { return performance.now(); };
  51171. }
  51172. }
  51173. /**
  51174. * Flush both queues and run the watchers.
  51175. */
  51176. function flushSchedulerQueue () {
  51177. currentFlushTimestamp = getNow();
  51178. flushing = true;
  51179. var watcher, id;
  51180. // Sort queue before flush.
  51181. // This ensures that:
  51182. // 1. Components are updated from parent to child. (because parent is always
  51183. // created before the child)
  51184. // 2. A component's user watchers are run before its render watcher (because
  51185. // user watchers are created before the render watcher)
  51186. // 3. If a component is destroyed during a parent component's watcher run,
  51187. // its watchers can be skipped.
  51188. queue.sort(function (a, b) { return a.id - b.id; });
  51189. // do not cache length because more watchers might be pushed
  51190. // as we run existing watchers
  51191. for (index = 0; index < queue.length; index++) {
  51192. watcher = queue[index];
  51193. if (watcher.before) {
  51194. watcher.before();
  51195. }
  51196. id = watcher.id;
  51197. has[id] = null;
  51198. watcher.run();
  51199. // in dev build, check and stop circular updates.
  51200. if (has[id] != null) {
  51201. circular[id] = (circular[id] || 0) + 1;
  51202. if (circular[id] > MAX_UPDATE_COUNT) {
  51203. warn(
  51204. 'You may have an infinite update loop ' + (
  51205. watcher.user
  51206. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  51207. : "in a component render function."
  51208. ),
  51209. watcher.vm
  51210. );
  51211. break
  51212. }
  51213. }
  51214. }
  51215. // keep copies of post queues before resetting state
  51216. var activatedQueue = activatedChildren.slice();
  51217. var updatedQueue = queue.slice();
  51218. resetSchedulerState();
  51219. // call component updated and activated hooks
  51220. callActivatedHooks(activatedQueue);
  51221. callUpdatedHooks(updatedQueue);
  51222. // devtool hook
  51223. /* istanbul ignore if */
  51224. if (devtools && config.devtools) {
  51225. devtools.emit('flush');
  51226. }
  51227. }
  51228. function callUpdatedHooks (queue) {
  51229. var i = queue.length;
  51230. while (i--) {
  51231. var watcher = queue[i];
  51232. var vm = watcher.vm;
  51233. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  51234. callHook(vm, 'updated');
  51235. }
  51236. }
  51237. }
  51238. /**
  51239. * Queue a kept-alive component that was activated during patch.
  51240. * The queue will be processed after the entire tree has been patched.
  51241. */
  51242. function queueActivatedComponent (vm) {
  51243. // setting _inactive to false here so that a render function can
  51244. // rely on checking whether it's in an inactive tree (e.g. router-view)
  51245. vm._inactive = false;
  51246. activatedChildren.push(vm);
  51247. }
  51248. function callActivatedHooks (queue) {
  51249. for (var i = 0; i < queue.length; i++) {
  51250. queue[i]._inactive = true;
  51251. activateChildComponent(queue[i], true /* true */);
  51252. }
  51253. }
  51254. /**
  51255. * Push a watcher into the watcher queue.
  51256. * Jobs with duplicate IDs will be skipped unless it's
  51257. * pushed when the queue is being flushed.
  51258. */
  51259. function queueWatcher (watcher) {
  51260. var id = watcher.id;
  51261. if (has[id] == null) {
  51262. has[id] = true;
  51263. if (!flushing) {
  51264. queue.push(watcher);
  51265. } else {
  51266. // if already flushing, splice the watcher based on its id
  51267. // if already past its id, it will be run next immediately.
  51268. var i = queue.length - 1;
  51269. while (i > index && queue[i].id > watcher.id) {
  51270. i--;
  51271. }
  51272. queue.splice(i + 1, 0, watcher);
  51273. }
  51274. // queue the flush
  51275. if (!waiting) {
  51276. waiting = true;
  51277. if (!config.async) {
  51278. flushSchedulerQueue();
  51279. return
  51280. }
  51281. nextTick(flushSchedulerQueue);
  51282. }
  51283. }
  51284. }
  51285. /* */
  51286. var uid$2 = 0;
  51287. /**
  51288. * A watcher parses an expression, collects dependencies,
  51289. * and fires callback when the expression value changes.
  51290. * This is used for both the $watch() api and directives.
  51291. */
  51292. var Watcher = function Watcher (
  51293. vm,
  51294. expOrFn,
  51295. cb,
  51296. options,
  51297. isRenderWatcher
  51298. ) {
  51299. this.vm = vm;
  51300. if (isRenderWatcher) {
  51301. vm._watcher = this;
  51302. }
  51303. vm._watchers.push(this);
  51304. // options
  51305. if (options) {
  51306. this.deep = !!options.deep;
  51307. this.user = !!options.user;
  51308. this.lazy = !!options.lazy;
  51309. this.sync = !!options.sync;
  51310. this.before = options.before;
  51311. } else {
  51312. this.deep = this.user = this.lazy = this.sync = false;
  51313. }
  51314. this.cb = cb;
  51315. this.id = ++uid$2; // uid for batching
  51316. this.active = true;
  51317. this.dirty = this.lazy; // for lazy watchers
  51318. this.deps = [];
  51319. this.newDeps = [];
  51320. this.depIds = new _Set();
  51321. this.newDepIds = new _Set();
  51322. this.expression = expOrFn.toString();
  51323. // parse expression for getter
  51324. if (typeof expOrFn === 'function') {
  51325. this.getter = expOrFn;
  51326. } else {
  51327. this.getter = parsePath(expOrFn);
  51328. if (!this.getter) {
  51329. this.getter = noop;
  51330. warn(
  51331. "Failed watching path: \"" + expOrFn + "\" " +
  51332. 'Watcher only accepts simple dot-delimited paths. ' +
  51333. 'For full control, use a function instead.',
  51334. vm
  51335. );
  51336. }
  51337. }
  51338. this.value = this.lazy
  51339. ? undefined
  51340. : this.get();
  51341. };
  51342. /**
  51343. * Evaluate the getter, and re-collect dependencies.
  51344. */
  51345. Watcher.prototype.get = function get () {
  51346. pushTarget(this);
  51347. var value;
  51348. var vm = this.vm;
  51349. try {
  51350. value = this.getter.call(vm, vm);
  51351. } catch (e) {
  51352. if (this.user) {
  51353. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  51354. } else {
  51355. throw e
  51356. }
  51357. } finally {
  51358. // "touch" every property so they are all tracked as
  51359. // dependencies for deep watching
  51360. if (this.deep) {
  51361. traverse(value);
  51362. }
  51363. popTarget();
  51364. this.cleanupDeps();
  51365. }
  51366. return value
  51367. };
  51368. /**
  51369. * Add a dependency to this directive.
  51370. */
  51371. Watcher.prototype.addDep = function addDep (dep) {
  51372. var id = dep.id;
  51373. if (!this.newDepIds.has(id)) {
  51374. this.newDepIds.add(id);
  51375. this.newDeps.push(dep);
  51376. if (!this.depIds.has(id)) {
  51377. dep.addSub(this);
  51378. }
  51379. }
  51380. };
  51381. /**
  51382. * Clean up for dependency collection.
  51383. */
  51384. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  51385. var i = this.deps.length;
  51386. while (i--) {
  51387. var dep = this.deps[i];
  51388. if (!this.newDepIds.has(dep.id)) {
  51389. dep.removeSub(this);
  51390. }
  51391. }
  51392. var tmp = this.depIds;
  51393. this.depIds = this.newDepIds;
  51394. this.newDepIds = tmp;
  51395. this.newDepIds.clear();
  51396. tmp = this.deps;
  51397. this.deps = this.newDeps;
  51398. this.newDeps = tmp;
  51399. this.newDeps.length = 0;
  51400. };
  51401. /**
  51402. * Subscriber interface.
  51403. * Will be called when a dependency changes.
  51404. */
  51405. Watcher.prototype.update = function update () {
  51406. /* istanbul ignore else */
  51407. if (this.lazy) {
  51408. this.dirty = true;
  51409. } else if (this.sync) {
  51410. this.run();
  51411. } else {
  51412. queueWatcher(this);
  51413. }
  51414. };
  51415. /**
  51416. * Scheduler job interface.
  51417. * Will be called by the scheduler.
  51418. */
  51419. Watcher.prototype.run = function run () {
  51420. if (this.active) {
  51421. var value = this.get();
  51422. if (
  51423. value !== this.value ||
  51424. // Deep watchers and watchers on Object/Arrays should fire even
  51425. // when the value is the same, because the value may
  51426. // have mutated.
  51427. isObject(value) ||
  51428. this.deep
  51429. ) {
  51430. // set new value
  51431. var oldValue = this.value;
  51432. this.value = value;
  51433. if (this.user) {
  51434. try {
  51435. this.cb.call(this.vm, value, oldValue);
  51436. } catch (e) {
  51437. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  51438. }
  51439. } else {
  51440. this.cb.call(this.vm, value, oldValue);
  51441. }
  51442. }
  51443. }
  51444. };
  51445. /**
  51446. * Evaluate the value of the watcher.
  51447. * This only gets called for lazy watchers.
  51448. */
  51449. Watcher.prototype.evaluate = function evaluate () {
  51450. this.value = this.get();
  51451. this.dirty = false;
  51452. };
  51453. /**
  51454. * Depend on all deps collected by this watcher.
  51455. */
  51456. Watcher.prototype.depend = function depend () {
  51457. var i = this.deps.length;
  51458. while (i--) {
  51459. this.deps[i].depend();
  51460. }
  51461. };
  51462. /**
  51463. * Remove self from all dependencies' subscriber list.
  51464. */
  51465. Watcher.prototype.teardown = function teardown () {
  51466. if (this.active) {
  51467. // remove self from vm's watcher list
  51468. // this is a somewhat expensive operation so we skip it
  51469. // if the vm is being destroyed.
  51470. if (!this.vm._isBeingDestroyed) {
  51471. remove(this.vm._watchers, this);
  51472. }
  51473. var i = this.deps.length;
  51474. while (i--) {
  51475. this.deps[i].removeSub(this);
  51476. }
  51477. this.active = false;
  51478. }
  51479. };
  51480. /* */
  51481. var sharedPropertyDefinition = {
  51482. enumerable: true,
  51483. configurable: true,
  51484. get: noop,
  51485. set: noop
  51486. };
  51487. function proxy (target, sourceKey, key) {
  51488. sharedPropertyDefinition.get = function proxyGetter () {
  51489. return this[sourceKey][key]
  51490. };
  51491. sharedPropertyDefinition.set = function proxySetter (val) {
  51492. this[sourceKey][key] = val;
  51493. };
  51494. Object.defineProperty(target, key, sharedPropertyDefinition);
  51495. }
  51496. function initState (vm) {
  51497. vm._watchers = [];
  51498. var opts = vm.$options;
  51499. if (opts.props) { initProps(vm, opts.props); }
  51500. if (opts.methods) { initMethods(vm, opts.methods); }
  51501. if (opts.data) {
  51502. initData(vm);
  51503. } else {
  51504. observe(vm._data = {}, true /* asRootData */);
  51505. }
  51506. if (opts.computed) { initComputed(vm, opts.computed); }
  51507. if (opts.watch && opts.watch !== nativeWatch) {
  51508. initWatch(vm, opts.watch);
  51509. }
  51510. }
  51511. function initProps (vm, propsOptions) {
  51512. var propsData = vm.$options.propsData || {};
  51513. var props = vm._props = {};
  51514. // cache prop keys so that future props updates can iterate using Array
  51515. // instead of dynamic object key enumeration.
  51516. var keys = vm.$options._propKeys = [];
  51517. var isRoot = !vm.$parent;
  51518. // root instance props should be converted
  51519. if (!isRoot) {
  51520. toggleObserving(false);
  51521. }
  51522. var loop = function ( key ) {
  51523. keys.push(key);
  51524. var value = validateProp(key, propsOptions, propsData, vm);
  51525. /* istanbul ignore else */
  51526. {
  51527. var hyphenatedKey = hyphenate(key);
  51528. if (isReservedAttribute(hyphenatedKey) ||
  51529. config.isReservedAttr(hyphenatedKey)) {
  51530. warn(
  51531. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  51532. vm
  51533. );
  51534. }
  51535. defineReactive$$1(props, key, value, function () {
  51536. if (!isRoot && !isUpdatingChildComponent) {
  51537. warn(
  51538. "Avoid mutating a prop directly since the value will be " +
  51539. "overwritten whenever the parent component re-renders. " +
  51540. "Instead, use a data or computed property based on the prop's " +
  51541. "value. Prop being mutated: \"" + key + "\"",
  51542. vm
  51543. );
  51544. }
  51545. });
  51546. }
  51547. // static props are already proxied on the component's prototype
  51548. // during Vue.extend(). We only need to proxy props defined at
  51549. // instantiation here.
  51550. if (!(key in vm)) {
  51551. proxy(vm, "_props", key);
  51552. }
  51553. };
  51554. for (var key in propsOptions) loop( key );
  51555. toggleObserving(true);
  51556. }
  51557. function initData (vm) {
  51558. var data = vm.$options.data;
  51559. data = vm._data = typeof data === 'function'
  51560. ? getData(data, vm)
  51561. : data || {};
  51562. if (!isPlainObject(data)) {
  51563. data = {};
  51564. warn(
  51565. 'data functions should return an object:\n' +
  51566. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  51567. vm
  51568. );
  51569. }
  51570. // proxy data on instance
  51571. var keys = Object.keys(data);
  51572. var props = vm.$options.props;
  51573. var methods = vm.$options.methods;
  51574. var i = keys.length;
  51575. while (i--) {
  51576. var key = keys[i];
  51577. {
  51578. if (methods && hasOwn(methods, key)) {
  51579. warn(
  51580. ("Method \"" + key + "\" has already been defined as a data property."),
  51581. vm
  51582. );
  51583. }
  51584. }
  51585. if (props && hasOwn(props, key)) {
  51586. warn(
  51587. "The data property \"" + key + "\" is already declared as a prop. " +
  51588. "Use prop default value instead.",
  51589. vm
  51590. );
  51591. } else if (!isReserved(key)) {
  51592. proxy(vm, "_data", key);
  51593. }
  51594. }
  51595. // observe data
  51596. observe(data, true /* asRootData */);
  51597. }
  51598. function getData (data, vm) {
  51599. // #7573 disable dep collection when invoking data getters
  51600. pushTarget();
  51601. try {
  51602. return data.call(vm, vm)
  51603. } catch (e) {
  51604. handleError(e, vm, "data()");
  51605. return {}
  51606. } finally {
  51607. popTarget();
  51608. }
  51609. }
  51610. var computedWatcherOptions = { lazy: true };
  51611. function initComputed (vm, computed) {
  51612. // $flow-disable-line
  51613. var watchers = vm._computedWatchers = Object.create(null);
  51614. // computed properties are just getters during SSR
  51615. var isSSR = isServerRendering();
  51616. for (var key in computed) {
  51617. var userDef = computed[key];
  51618. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  51619. if (getter == null) {
  51620. warn(
  51621. ("Getter is missing for computed property \"" + key + "\"."),
  51622. vm
  51623. );
  51624. }
  51625. if (!isSSR) {
  51626. // create internal watcher for the computed property.
  51627. watchers[key] = new Watcher(
  51628. vm,
  51629. getter || noop,
  51630. noop,
  51631. computedWatcherOptions
  51632. );
  51633. }
  51634. // component-defined computed properties are already defined on the
  51635. // component prototype. We only need to define computed properties defined
  51636. // at instantiation here.
  51637. if (!(key in vm)) {
  51638. defineComputed(vm, key, userDef);
  51639. } else {
  51640. if (key in vm.$data) {
  51641. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  51642. } else if (vm.$options.props && key in vm.$options.props) {
  51643. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  51644. }
  51645. }
  51646. }
  51647. }
  51648. function defineComputed (
  51649. target,
  51650. key,
  51651. userDef
  51652. ) {
  51653. var shouldCache = !isServerRendering();
  51654. if (typeof userDef === 'function') {
  51655. sharedPropertyDefinition.get = shouldCache
  51656. ? createComputedGetter(key)
  51657. : createGetterInvoker(userDef);
  51658. sharedPropertyDefinition.set = noop;
  51659. } else {
  51660. sharedPropertyDefinition.get = userDef.get
  51661. ? shouldCache && userDef.cache !== false
  51662. ? createComputedGetter(key)
  51663. : createGetterInvoker(userDef.get)
  51664. : noop;
  51665. sharedPropertyDefinition.set = userDef.set || noop;
  51666. }
  51667. if (sharedPropertyDefinition.set === noop) {
  51668. sharedPropertyDefinition.set = function () {
  51669. warn(
  51670. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  51671. this
  51672. );
  51673. };
  51674. }
  51675. Object.defineProperty(target, key, sharedPropertyDefinition);
  51676. }
  51677. function createComputedGetter (key) {
  51678. return function computedGetter () {
  51679. var watcher = this._computedWatchers && this._computedWatchers[key];
  51680. if (watcher) {
  51681. if (watcher.dirty) {
  51682. watcher.evaluate();
  51683. }
  51684. if (Dep.target) {
  51685. watcher.depend();
  51686. }
  51687. return watcher.value
  51688. }
  51689. }
  51690. }
  51691. function createGetterInvoker(fn) {
  51692. return function computedGetter () {
  51693. return fn.call(this, this)
  51694. }
  51695. }
  51696. function initMethods (vm, methods) {
  51697. var props = vm.$options.props;
  51698. for (var key in methods) {
  51699. {
  51700. if (typeof methods[key] !== 'function') {
  51701. warn(
  51702. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  51703. "Did you reference the function correctly?",
  51704. vm
  51705. );
  51706. }
  51707. if (props && hasOwn(props, key)) {
  51708. warn(
  51709. ("Method \"" + key + "\" has already been defined as a prop."),
  51710. vm
  51711. );
  51712. }
  51713. if ((key in vm) && isReserved(key)) {
  51714. warn(
  51715. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  51716. "Avoid defining component methods that start with _ or $."
  51717. );
  51718. }
  51719. }
  51720. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  51721. }
  51722. }
  51723. function initWatch (vm, watch) {
  51724. for (var key in watch) {
  51725. var handler = watch[key];
  51726. if (Array.isArray(handler)) {
  51727. for (var i = 0; i < handler.length; i++) {
  51728. createWatcher(vm, key, handler[i]);
  51729. }
  51730. } else {
  51731. createWatcher(vm, key, handler);
  51732. }
  51733. }
  51734. }
  51735. function createWatcher (
  51736. vm,
  51737. expOrFn,
  51738. handler,
  51739. options
  51740. ) {
  51741. if (isPlainObject(handler)) {
  51742. options = handler;
  51743. handler = handler.handler;
  51744. }
  51745. if (typeof handler === 'string') {
  51746. handler = vm[handler];
  51747. }
  51748. return vm.$watch(expOrFn, handler, options)
  51749. }
  51750. function stateMixin (Vue) {
  51751. // flow somehow has problems with directly declared definition object
  51752. // when using Object.defineProperty, so we have to procedurally build up
  51753. // the object here.
  51754. var dataDef = {};
  51755. dataDef.get = function () { return this._data };
  51756. var propsDef = {};
  51757. propsDef.get = function () { return this._props };
  51758. {
  51759. dataDef.set = function () {
  51760. warn(
  51761. 'Avoid replacing instance root $data. ' +
  51762. 'Use nested data properties instead.',
  51763. this
  51764. );
  51765. };
  51766. propsDef.set = function () {
  51767. warn("$props is readonly.", this);
  51768. };
  51769. }
  51770. Object.defineProperty(Vue.prototype, '$data', dataDef);
  51771. Object.defineProperty(Vue.prototype, '$props', propsDef);
  51772. Vue.prototype.$set = set;
  51773. Vue.prototype.$delete = del;
  51774. Vue.prototype.$watch = function (
  51775. expOrFn,
  51776. cb,
  51777. options
  51778. ) {
  51779. var vm = this;
  51780. if (isPlainObject(cb)) {
  51781. return createWatcher(vm, expOrFn, cb, options)
  51782. }
  51783. options = options || {};
  51784. options.user = true;
  51785. var watcher = new Watcher(vm, expOrFn, cb, options);
  51786. if (options.immediate) {
  51787. try {
  51788. cb.call(vm, watcher.value);
  51789. } catch (error) {
  51790. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  51791. }
  51792. }
  51793. return function unwatchFn () {
  51794. watcher.teardown();
  51795. }
  51796. };
  51797. }
  51798. /* */
  51799. var uid$3 = 0;
  51800. function initMixin (Vue) {
  51801. Vue.prototype._init = function (options) {
  51802. var vm = this;
  51803. // a uid
  51804. vm._uid = uid$3++;
  51805. var startTag, endTag;
  51806. /* istanbul ignore if */
  51807. if (config.performance && mark) {
  51808. startTag = "vue-perf-start:" + (vm._uid);
  51809. endTag = "vue-perf-end:" + (vm._uid);
  51810. mark(startTag);
  51811. }
  51812. // a flag to avoid this being observed
  51813. vm._isVue = true;
  51814. // merge options
  51815. if (options && options._isComponent) {
  51816. // optimize internal component instantiation
  51817. // since dynamic options merging is pretty slow, and none of the
  51818. // internal component options needs special treatment.
  51819. initInternalComponent(vm, options);
  51820. } else {
  51821. vm.$options = mergeOptions(
  51822. resolveConstructorOptions(vm.constructor),
  51823. options || {},
  51824. vm
  51825. );
  51826. }
  51827. /* istanbul ignore else */
  51828. {
  51829. initProxy(vm);
  51830. }
  51831. // expose real self
  51832. vm._self = vm;
  51833. initLifecycle(vm);
  51834. initEvents(vm);
  51835. initRender(vm);
  51836. callHook(vm, 'beforeCreate');
  51837. initInjections(vm); // resolve injections before data/props
  51838. initState(vm);
  51839. initProvide(vm); // resolve provide after data/props
  51840. callHook(vm, 'created');
  51841. /* istanbul ignore if */
  51842. if (config.performance && mark) {
  51843. vm._name = formatComponentName(vm, false);
  51844. mark(endTag);
  51845. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  51846. }
  51847. if (vm.$options.el) {
  51848. vm.$mount(vm.$options.el);
  51849. }
  51850. };
  51851. }
  51852. function initInternalComponent (vm, options) {
  51853. var opts = vm.$options = Object.create(vm.constructor.options);
  51854. // doing this because it's faster than dynamic enumeration.
  51855. var parentVnode = options._parentVnode;
  51856. opts.parent = options.parent;
  51857. opts._parentVnode = parentVnode;
  51858. var vnodeComponentOptions = parentVnode.componentOptions;
  51859. opts.propsData = vnodeComponentOptions.propsData;
  51860. opts._parentListeners = vnodeComponentOptions.listeners;
  51861. opts._renderChildren = vnodeComponentOptions.children;
  51862. opts._componentTag = vnodeComponentOptions.tag;
  51863. if (options.render) {
  51864. opts.render = options.render;
  51865. opts.staticRenderFns = options.staticRenderFns;
  51866. }
  51867. }
  51868. function resolveConstructorOptions (Ctor) {
  51869. var options = Ctor.options;
  51870. if (Ctor.super) {
  51871. var superOptions = resolveConstructorOptions(Ctor.super);
  51872. var cachedSuperOptions = Ctor.superOptions;
  51873. if (superOptions !== cachedSuperOptions) {
  51874. // super option changed,
  51875. // need to resolve new options.
  51876. Ctor.superOptions = superOptions;
  51877. // check if there are any late-modified/attached options (#4976)
  51878. var modifiedOptions = resolveModifiedOptions(Ctor);
  51879. // update base extend options
  51880. if (modifiedOptions) {
  51881. extend(Ctor.extendOptions, modifiedOptions);
  51882. }
  51883. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  51884. if (options.name) {
  51885. options.components[options.name] = Ctor;
  51886. }
  51887. }
  51888. }
  51889. return options
  51890. }
  51891. function resolveModifiedOptions (Ctor) {
  51892. var modified;
  51893. var latest = Ctor.options;
  51894. var sealed = Ctor.sealedOptions;
  51895. for (var key in latest) {
  51896. if (latest[key] !== sealed[key]) {
  51897. if (!modified) { modified = {}; }
  51898. modified[key] = latest[key];
  51899. }
  51900. }
  51901. return modified
  51902. }
  51903. function Vue (options) {
  51904. if (!(this instanceof Vue)
  51905. ) {
  51906. warn('Vue is a constructor and should be called with the `new` keyword');
  51907. }
  51908. this._init(options);
  51909. }
  51910. initMixin(Vue);
  51911. stateMixin(Vue);
  51912. eventsMixin(Vue);
  51913. lifecycleMixin(Vue);
  51914. renderMixin(Vue);
  51915. /* */
  51916. function initUse (Vue) {
  51917. Vue.use = function (plugin) {
  51918. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  51919. if (installedPlugins.indexOf(plugin) > -1) {
  51920. return this
  51921. }
  51922. // additional parameters
  51923. var args = toArray(arguments, 1);
  51924. args.unshift(this);
  51925. if (typeof plugin.install === 'function') {
  51926. plugin.install.apply(plugin, args);
  51927. } else if (typeof plugin === 'function') {
  51928. plugin.apply(null, args);
  51929. }
  51930. installedPlugins.push(plugin);
  51931. return this
  51932. };
  51933. }
  51934. /* */
  51935. function initMixin$1 (Vue) {
  51936. Vue.mixin = function (mixin) {
  51937. this.options = mergeOptions(this.options, mixin);
  51938. return this
  51939. };
  51940. }
  51941. /* */
  51942. function initExtend (Vue) {
  51943. /**
  51944. * Each instance constructor, including Vue, has a unique
  51945. * cid. This enables us to create wrapped "child
  51946. * constructors" for prototypal inheritance and cache them.
  51947. */
  51948. Vue.cid = 0;
  51949. var cid = 1;
  51950. /**
  51951. * Class inheritance
  51952. */
  51953. Vue.extend = function (extendOptions) {
  51954. extendOptions = extendOptions || {};
  51955. var Super = this;
  51956. var SuperId = Super.cid;
  51957. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  51958. if (cachedCtors[SuperId]) {
  51959. return cachedCtors[SuperId]
  51960. }
  51961. var name = extendOptions.name || Super.options.name;
  51962. if (name) {
  51963. validateComponentName(name);
  51964. }
  51965. var Sub = function VueComponent (options) {
  51966. this._init(options);
  51967. };
  51968. Sub.prototype = Object.create(Super.prototype);
  51969. Sub.prototype.constructor = Sub;
  51970. Sub.cid = cid++;
  51971. Sub.options = mergeOptions(
  51972. Super.options,
  51973. extendOptions
  51974. );
  51975. Sub['super'] = Super;
  51976. // For props and computed properties, we define the proxy getters on
  51977. // the Vue instances at extension time, on the extended prototype. This
  51978. // avoids Object.defineProperty calls for each instance created.
  51979. if (Sub.options.props) {
  51980. initProps$1(Sub);
  51981. }
  51982. if (Sub.options.computed) {
  51983. initComputed$1(Sub);
  51984. }
  51985. // allow further extension/mixin/plugin usage
  51986. Sub.extend = Super.extend;
  51987. Sub.mixin = Super.mixin;
  51988. Sub.use = Super.use;
  51989. // create asset registers, so extended classes
  51990. // can have their private assets too.
  51991. ASSET_TYPES.forEach(function (type) {
  51992. Sub[type] = Super[type];
  51993. });
  51994. // enable recursive self-lookup
  51995. if (name) {
  51996. Sub.options.components[name] = Sub;
  51997. }
  51998. // keep a reference to the super options at extension time.
  51999. // later at instantiation we can check if Super's options have
  52000. // been updated.
  52001. Sub.superOptions = Super.options;
  52002. Sub.extendOptions = extendOptions;
  52003. Sub.sealedOptions = extend({}, Sub.options);
  52004. // cache constructor
  52005. cachedCtors[SuperId] = Sub;
  52006. return Sub
  52007. };
  52008. }
  52009. function initProps$1 (Comp) {
  52010. var props = Comp.options.props;
  52011. for (var key in props) {
  52012. proxy(Comp.prototype, "_props", key);
  52013. }
  52014. }
  52015. function initComputed$1 (Comp) {
  52016. var computed = Comp.options.computed;
  52017. for (var key in computed) {
  52018. defineComputed(Comp.prototype, key, computed[key]);
  52019. }
  52020. }
  52021. /* */
  52022. function initAssetRegisters (Vue) {
  52023. /**
  52024. * Create asset registration methods.
  52025. */
  52026. ASSET_TYPES.forEach(function (type) {
  52027. Vue[type] = function (
  52028. id,
  52029. definition
  52030. ) {
  52031. if (!definition) {
  52032. return this.options[type + 's'][id]
  52033. } else {
  52034. /* istanbul ignore if */
  52035. if (type === 'component') {
  52036. validateComponentName(id);
  52037. }
  52038. if (type === 'component' && isPlainObject(definition)) {
  52039. definition.name = definition.name || id;
  52040. definition = this.options._base.extend(definition);
  52041. }
  52042. if (type === 'directive' && typeof definition === 'function') {
  52043. definition = { bind: definition, update: definition };
  52044. }
  52045. this.options[type + 's'][id] = definition;
  52046. return definition
  52047. }
  52048. };
  52049. });
  52050. }
  52051. /* */
  52052. function getComponentName (opts) {
  52053. return opts && (opts.Ctor.options.name || opts.tag)
  52054. }
  52055. function matches (pattern, name) {
  52056. if (Array.isArray(pattern)) {
  52057. return pattern.indexOf(name) > -1
  52058. } else if (typeof pattern === 'string') {
  52059. return pattern.split(',').indexOf(name) > -1
  52060. } else if (isRegExp(pattern)) {
  52061. return pattern.test(name)
  52062. }
  52063. /* istanbul ignore next */
  52064. return false
  52065. }
  52066. function pruneCache (keepAliveInstance, filter) {
  52067. var cache = keepAliveInstance.cache;
  52068. var keys = keepAliveInstance.keys;
  52069. var _vnode = keepAliveInstance._vnode;
  52070. for (var key in cache) {
  52071. var cachedNode = cache[key];
  52072. if (cachedNode) {
  52073. var name = getComponentName(cachedNode.componentOptions);
  52074. if (name && !filter(name)) {
  52075. pruneCacheEntry(cache, key, keys, _vnode);
  52076. }
  52077. }
  52078. }
  52079. }
  52080. function pruneCacheEntry (
  52081. cache,
  52082. key,
  52083. keys,
  52084. current
  52085. ) {
  52086. var cached$$1 = cache[key];
  52087. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  52088. cached$$1.componentInstance.$destroy();
  52089. }
  52090. cache[key] = null;
  52091. remove(keys, key);
  52092. }
  52093. var patternTypes = [String, RegExp, Array];
  52094. var KeepAlive = {
  52095. name: 'keep-alive',
  52096. abstract: true,
  52097. props: {
  52098. include: patternTypes,
  52099. exclude: patternTypes,
  52100. max: [String, Number]
  52101. },
  52102. created: function created () {
  52103. this.cache = Object.create(null);
  52104. this.keys = [];
  52105. },
  52106. destroyed: function destroyed () {
  52107. for (var key in this.cache) {
  52108. pruneCacheEntry(this.cache, key, this.keys);
  52109. }
  52110. },
  52111. mounted: function mounted () {
  52112. var this$1 = this;
  52113. this.$watch('include', function (val) {
  52114. pruneCache(this$1, function (name) { return matches(val, name); });
  52115. });
  52116. this.$watch('exclude', function (val) {
  52117. pruneCache(this$1, function (name) { return !matches(val, name); });
  52118. });
  52119. },
  52120. render: function render () {
  52121. var slot = this.$slots.default;
  52122. var vnode = getFirstComponentChild(slot);
  52123. var componentOptions = vnode && vnode.componentOptions;
  52124. if (componentOptions) {
  52125. // check pattern
  52126. var name = getComponentName(componentOptions);
  52127. var ref = this;
  52128. var include = ref.include;
  52129. var exclude = ref.exclude;
  52130. if (
  52131. // not included
  52132. (include && (!name || !matches(include, name))) ||
  52133. // excluded
  52134. (exclude && name && matches(exclude, name))
  52135. ) {
  52136. return vnode
  52137. }
  52138. var ref$1 = this;
  52139. var cache = ref$1.cache;
  52140. var keys = ref$1.keys;
  52141. var key = vnode.key == null
  52142. // same constructor may get registered as different local components
  52143. // so cid alone is not enough (#3269)
  52144. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  52145. : vnode.key;
  52146. if (cache[key]) {
  52147. vnode.componentInstance = cache[key].componentInstance;
  52148. // make current key freshest
  52149. remove(keys, key);
  52150. keys.push(key);
  52151. } else {
  52152. cache[key] = vnode;
  52153. keys.push(key);
  52154. // prune oldest entry
  52155. if (this.max && keys.length > parseInt(this.max)) {
  52156. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  52157. }
  52158. }
  52159. vnode.data.keepAlive = true;
  52160. }
  52161. return vnode || (slot && slot[0])
  52162. }
  52163. };
  52164. var builtInComponents = {
  52165. KeepAlive: KeepAlive
  52166. };
  52167. /* */
  52168. function initGlobalAPI (Vue) {
  52169. // config
  52170. var configDef = {};
  52171. configDef.get = function () { return config; };
  52172. {
  52173. configDef.set = function () {
  52174. warn(
  52175. 'Do not replace the Vue.config object, set individual fields instead.'
  52176. );
  52177. };
  52178. }
  52179. Object.defineProperty(Vue, 'config', configDef);
  52180. // exposed util methods.
  52181. // NOTE: these are not considered part of the public API - avoid relying on
  52182. // them unless you are aware of the risk.
  52183. Vue.util = {
  52184. warn: warn,
  52185. extend: extend,
  52186. mergeOptions: mergeOptions,
  52187. defineReactive: defineReactive$$1
  52188. };
  52189. Vue.set = set;
  52190. Vue.delete = del;
  52191. Vue.nextTick = nextTick;
  52192. // 2.6 explicit observable API
  52193. Vue.observable = function (obj) {
  52194. observe(obj);
  52195. return obj
  52196. };
  52197. Vue.options = Object.create(null);
  52198. ASSET_TYPES.forEach(function (type) {
  52199. Vue.options[type + 's'] = Object.create(null);
  52200. });
  52201. // this is used to identify the "base" constructor to extend all plain-object
  52202. // components with in Weex's multi-instance scenarios.
  52203. Vue.options._base = Vue;
  52204. extend(Vue.options.components, builtInComponents);
  52205. initUse(Vue);
  52206. initMixin$1(Vue);
  52207. initExtend(Vue);
  52208. initAssetRegisters(Vue);
  52209. }
  52210. initGlobalAPI(Vue);
  52211. Object.defineProperty(Vue.prototype, '$isServer', {
  52212. get: isServerRendering
  52213. });
  52214. Object.defineProperty(Vue.prototype, '$ssrContext', {
  52215. get: function get () {
  52216. /* istanbul ignore next */
  52217. return this.$vnode && this.$vnode.ssrContext
  52218. }
  52219. });
  52220. // expose FunctionalRenderContext for ssr runtime helper installation
  52221. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  52222. value: FunctionalRenderContext
  52223. });
  52224. Vue.version = '2.6.11';
  52225. /* */
  52226. // these are reserved for web because they are directly compiled away
  52227. // during template compilation
  52228. var isReservedAttr = makeMap('style,class');
  52229. // attributes that should be using props for binding
  52230. var acceptValue = makeMap('input,textarea,option,select,progress');
  52231. var mustUseProp = function (tag, type, attr) {
  52232. return (
  52233. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  52234. (attr === 'selected' && tag === 'option') ||
  52235. (attr === 'checked' && tag === 'input') ||
  52236. (attr === 'muted' && tag === 'video')
  52237. )
  52238. };
  52239. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  52240. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  52241. var convertEnumeratedValue = function (key, value) {
  52242. return isFalsyAttrValue(value) || value === 'false'
  52243. ? 'false'
  52244. // allow arbitrary string value for contenteditable
  52245. : key === 'contenteditable' && isValidContentEditableValue(value)
  52246. ? value
  52247. : 'true'
  52248. };
  52249. var isBooleanAttr = makeMap(
  52250. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  52251. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  52252. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  52253. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  52254. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  52255. 'truespeed,typemustmatch,visible'
  52256. );
  52257. var xlinkNS = 'http://www.w3.org/1999/xlink';
  52258. var isXlink = function (name) {
  52259. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  52260. };
  52261. var getXlinkProp = function (name) {
  52262. return isXlink(name) ? name.slice(6, name.length) : ''
  52263. };
  52264. var isFalsyAttrValue = function (val) {
  52265. return val == null || val === false
  52266. };
  52267. /* */
  52268. function genClassForVnode (vnode) {
  52269. var data = vnode.data;
  52270. var parentNode = vnode;
  52271. var childNode = vnode;
  52272. while (isDef(childNode.componentInstance)) {
  52273. childNode = childNode.componentInstance._vnode;
  52274. if (childNode && childNode.data) {
  52275. data = mergeClassData(childNode.data, data);
  52276. }
  52277. }
  52278. while (isDef(parentNode = parentNode.parent)) {
  52279. if (parentNode && parentNode.data) {
  52280. data = mergeClassData(data, parentNode.data);
  52281. }
  52282. }
  52283. return renderClass(data.staticClass, data.class)
  52284. }
  52285. function mergeClassData (child, parent) {
  52286. return {
  52287. staticClass: concat(child.staticClass, parent.staticClass),
  52288. class: isDef(child.class)
  52289. ? [child.class, parent.class]
  52290. : parent.class
  52291. }
  52292. }
  52293. function renderClass (
  52294. staticClass,
  52295. dynamicClass
  52296. ) {
  52297. if (isDef(staticClass) || isDef(dynamicClass)) {
  52298. return concat(staticClass, stringifyClass(dynamicClass))
  52299. }
  52300. /* istanbul ignore next */
  52301. return ''
  52302. }
  52303. function concat (a, b) {
  52304. return a ? b ? (a + ' ' + b) : a : (b || '')
  52305. }
  52306. function stringifyClass (value) {
  52307. if (Array.isArray(value)) {
  52308. return stringifyArray(value)
  52309. }
  52310. if (isObject(value)) {
  52311. return stringifyObject(value)
  52312. }
  52313. if (typeof value === 'string') {
  52314. return value
  52315. }
  52316. /* istanbul ignore next */
  52317. return ''
  52318. }
  52319. function stringifyArray (value) {
  52320. var res = '';
  52321. var stringified;
  52322. for (var i = 0, l = value.length; i < l; i++) {
  52323. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  52324. if (res) { res += ' '; }
  52325. res += stringified;
  52326. }
  52327. }
  52328. return res
  52329. }
  52330. function stringifyObject (value) {
  52331. var res = '';
  52332. for (var key in value) {
  52333. if (value[key]) {
  52334. if (res) { res += ' '; }
  52335. res += key;
  52336. }
  52337. }
  52338. return res
  52339. }
  52340. /* */
  52341. var namespaceMap = {
  52342. svg: 'http://www.w3.org/2000/svg',
  52343. math: 'http://www.w3.org/1998/Math/MathML'
  52344. };
  52345. var isHTMLTag = makeMap(
  52346. 'html,body,base,head,link,meta,style,title,' +
  52347. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  52348. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  52349. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  52350. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  52351. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  52352. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  52353. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  52354. 'output,progress,select,textarea,' +
  52355. 'details,dialog,menu,menuitem,summary,' +
  52356. 'content,element,shadow,template,blockquote,iframe,tfoot'
  52357. );
  52358. // this map is intentionally selective, only covering SVG elements that may
  52359. // contain child elements.
  52360. var isSVG = makeMap(
  52361. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  52362. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  52363. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  52364. true
  52365. );
  52366. var isPreTag = function (tag) { return tag === 'pre'; };
  52367. var isReservedTag = function (tag) {
  52368. return isHTMLTag(tag) || isSVG(tag)
  52369. };
  52370. function getTagNamespace (tag) {
  52371. if (isSVG(tag)) {
  52372. return 'svg'
  52373. }
  52374. // basic support for MathML
  52375. // note it doesn't support other MathML elements being component roots
  52376. if (tag === 'math') {
  52377. return 'math'
  52378. }
  52379. }
  52380. var unknownElementCache = Object.create(null);
  52381. function isUnknownElement (tag) {
  52382. /* istanbul ignore if */
  52383. if (!inBrowser) {
  52384. return true
  52385. }
  52386. if (isReservedTag(tag)) {
  52387. return false
  52388. }
  52389. tag = tag.toLowerCase();
  52390. /* istanbul ignore if */
  52391. if (unknownElementCache[tag] != null) {
  52392. return unknownElementCache[tag]
  52393. }
  52394. var el = document.createElement(tag);
  52395. if (tag.indexOf('-') > -1) {
  52396. // http://stackoverflow.com/a/28210364/1070244
  52397. return (unknownElementCache[tag] = (
  52398. el.constructor === window.HTMLUnknownElement ||
  52399. el.constructor === window.HTMLElement
  52400. ))
  52401. } else {
  52402. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  52403. }
  52404. }
  52405. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  52406. /* */
  52407. /**
  52408. * Query an element selector if it's not an element already.
  52409. */
  52410. function query (el) {
  52411. if (typeof el === 'string') {
  52412. var selected = document.querySelector(el);
  52413. if (!selected) {
  52414. warn(
  52415. 'Cannot find element: ' + el
  52416. );
  52417. return document.createElement('div')
  52418. }
  52419. return selected
  52420. } else {
  52421. return el
  52422. }
  52423. }
  52424. /* */
  52425. function createElement$1 (tagName, vnode) {
  52426. var elm = document.createElement(tagName);
  52427. if (tagName !== 'select') {
  52428. return elm
  52429. }
  52430. // false or null will remove the attribute but undefined will not
  52431. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  52432. elm.setAttribute('multiple', 'multiple');
  52433. }
  52434. return elm
  52435. }
  52436. function createElementNS (namespace, tagName) {
  52437. return document.createElementNS(namespaceMap[namespace], tagName)
  52438. }
  52439. function createTextNode (text) {
  52440. return document.createTextNode(text)
  52441. }
  52442. function createComment (text) {
  52443. return document.createComment(text)
  52444. }
  52445. function insertBefore (parentNode, newNode, referenceNode) {
  52446. parentNode.insertBefore(newNode, referenceNode);
  52447. }
  52448. function removeChild (node, child) {
  52449. node.removeChild(child);
  52450. }
  52451. function appendChild (node, child) {
  52452. node.appendChild(child);
  52453. }
  52454. function parentNode (node) {
  52455. return node.parentNode
  52456. }
  52457. function nextSibling (node) {
  52458. return node.nextSibling
  52459. }
  52460. function tagName (node) {
  52461. return node.tagName
  52462. }
  52463. function setTextContent (node, text) {
  52464. node.textContent = text;
  52465. }
  52466. function setStyleScope (node, scopeId) {
  52467. node.setAttribute(scopeId, '');
  52468. }
  52469. var nodeOps = /*#__PURE__*/Object.freeze({
  52470. createElement: createElement$1,
  52471. createElementNS: createElementNS,
  52472. createTextNode: createTextNode,
  52473. createComment: createComment,
  52474. insertBefore: insertBefore,
  52475. removeChild: removeChild,
  52476. appendChild: appendChild,
  52477. parentNode: parentNode,
  52478. nextSibling: nextSibling,
  52479. tagName: tagName,
  52480. setTextContent: setTextContent,
  52481. setStyleScope: setStyleScope
  52482. });
  52483. /* */
  52484. var ref = {
  52485. create: function create (_, vnode) {
  52486. registerRef(vnode);
  52487. },
  52488. update: function update (oldVnode, vnode) {
  52489. if (oldVnode.data.ref !== vnode.data.ref) {
  52490. registerRef(oldVnode, true);
  52491. registerRef(vnode);
  52492. }
  52493. },
  52494. destroy: function destroy (vnode) {
  52495. registerRef(vnode, true);
  52496. }
  52497. };
  52498. function registerRef (vnode, isRemoval) {
  52499. var key = vnode.data.ref;
  52500. if (!isDef(key)) { return }
  52501. var vm = vnode.context;
  52502. var ref = vnode.componentInstance || vnode.elm;
  52503. var refs = vm.$refs;
  52504. if (isRemoval) {
  52505. if (Array.isArray(refs[key])) {
  52506. remove(refs[key], ref);
  52507. } else if (refs[key] === ref) {
  52508. refs[key] = undefined;
  52509. }
  52510. } else {
  52511. if (vnode.data.refInFor) {
  52512. if (!Array.isArray(refs[key])) {
  52513. refs[key] = [ref];
  52514. } else if (refs[key].indexOf(ref) < 0) {
  52515. // $flow-disable-line
  52516. refs[key].push(ref);
  52517. }
  52518. } else {
  52519. refs[key] = ref;
  52520. }
  52521. }
  52522. }
  52523. /**
  52524. * Virtual DOM patching algorithm based on Snabbdom by
  52525. * Simon Friis Vindum (@paldepind)
  52526. * Licensed under the MIT License
  52527. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  52528. *
  52529. * modified by Evan You (@yyx990803)
  52530. *
  52531. * Not type-checking this because this file is perf-critical and the cost
  52532. * of making flow understand it is not worth it.
  52533. */
  52534. var emptyNode = new VNode('', {}, []);
  52535. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  52536. function sameVnode (a, b) {
  52537. return (
  52538. a.key === b.key && (
  52539. (
  52540. a.tag === b.tag &&
  52541. a.isComment === b.isComment &&
  52542. isDef(a.data) === isDef(b.data) &&
  52543. sameInputType(a, b)
  52544. ) || (
  52545. isTrue(a.isAsyncPlaceholder) &&
  52546. a.asyncFactory === b.asyncFactory &&
  52547. isUndef(b.asyncFactory.error)
  52548. )
  52549. )
  52550. )
  52551. }
  52552. function sameInputType (a, b) {
  52553. if (a.tag !== 'input') { return true }
  52554. var i;
  52555. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  52556. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  52557. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  52558. }
  52559. function createKeyToOldIdx (children, beginIdx, endIdx) {
  52560. var i, key;
  52561. var map = {};
  52562. for (i = beginIdx; i <= endIdx; ++i) {
  52563. key = children[i].key;
  52564. if (isDef(key)) { map[key] = i; }
  52565. }
  52566. return map
  52567. }
  52568. function createPatchFunction (backend) {
  52569. var i, j;
  52570. var cbs = {};
  52571. var modules = backend.modules;
  52572. var nodeOps = backend.nodeOps;
  52573. for (i = 0; i < hooks.length; ++i) {
  52574. cbs[hooks[i]] = [];
  52575. for (j = 0; j < modules.length; ++j) {
  52576. if (isDef(modules[j][hooks[i]])) {
  52577. cbs[hooks[i]].push(modules[j][hooks[i]]);
  52578. }
  52579. }
  52580. }
  52581. function emptyNodeAt (elm) {
  52582. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  52583. }
  52584. function createRmCb (childElm, listeners) {
  52585. function remove$$1 () {
  52586. if (--remove$$1.listeners === 0) {
  52587. removeNode(childElm);
  52588. }
  52589. }
  52590. remove$$1.listeners = listeners;
  52591. return remove$$1
  52592. }
  52593. function removeNode (el) {
  52594. var parent = nodeOps.parentNode(el);
  52595. // element may have already been removed due to v-html / v-text
  52596. if (isDef(parent)) {
  52597. nodeOps.removeChild(parent, el);
  52598. }
  52599. }
  52600. function isUnknownElement$$1 (vnode, inVPre) {
  52601. return (
  52602. !inVPre &&
  52603. !vnode.ns &&
  52604. !(
  52605. config.ignoredElements.length &&
  52606. config.ignoredElements.some(function (ignore) {
  52607. return isRegExp(ignore)
  52608. ? ignore.test(vnode.tag)
  52609. : ignore === vnode.tag
  52610. })
  52611. ) &&
  52612. config.isUnknownElement(vnode.tag)
  52613. )
  52614. }
  52615. var creatingElmInVPre = 0;
  52616. function createElm (
  52617. vnode,
  52618. insertedVnodeQueue,
  52619. parentElm,
  52620. refElm,
  52621. nested,
  52622. ownerArray,
  52623. index
  52624. ) {
  52625. if (isDef(vnode.elm) && isDef(ownerArray)) {
  52626. // This vnode was used in a previous render!
  52627. // now it's used as a new node, overwriting its elm would cause
  52628. // potential patch errors down the road when it's used as an insertion
  52629. // reference node. Instead, we clone the node on-demand before creating
  52630. // associated DOM element for it.
  52631. vnode = ownerArray[index] = cloneVNode(vnode);
  52632. }
  52633. vnode.isRootInsert = !nested; // for transition enter check
  52634. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  52635. return
  52636. }
  52637. var data = vnode.data;
  52638. var children = vnode.children;
  52639. var tag = vnode.tag;
  52640. if (isDef(tag)) {
  52641. {
  52642. if (data && data.pre) {
  52643. creatingElmInVPre++;
  52644. }
  52645. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  52646. warn(
  52647. 'Unknown custom element: <' + tag + '> - did you ' +
  52648. 'register the component correctly? For recursive components, ' +
  52649. 'make sure to provide the "name" option.',
  52650. vnode.context
  52651. );
  52652. }
  52653. }
  52654. vnode.elm = vnode.ns
  52655. ? nodeOps.createElementNS(vnode.ns, tag)
  52656. : nodeOps.createElement(tag, vnode);
  52657. setScope(vnode);
  52658. /* istanbul ignore if */
  52659. {
  52660. createChildren(vnode, children, insertedVnodeQueue);
  52661. if (isDef(data)) {
  52662. invokeCreateHooks(vnode, insertedVnodeQueue);
  52663. }
  52664. insert(parentElm, vnode.elm, refElm);
  52665. }
  52666. if (data && data.pre) {
  52667. creatingElmInVPre--;
  52668. }
  52669. } else if (isTrue(vnode.isComment)) {
  52670. vnode.elm = nodeOps.createComment(vnode.text);
  52671. insert(parentElm, vnode.elm, refElm);
  52672. } else {
  52673. vnode.elm = nodeOps.createTextNode(vnode.text);
  52674. insert(parentElm, vnode.elm, refElm);
  52675. }
  52676. }
  52677. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  52678. var i = vnode.data;
  52679. if (isDef(i)) {
  52680. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  52681. if (isDef(i = i.hook) && isDef(i = i.init)) {
  52682. i(vnode, false /* hydrating */);
  52683. }
  52684. // after calling the init hook, if the vnode is a child component
  52685. // it should've created a child instance and mounted it. the child
  52686. // component also has set the placeholder vnode's elm.
  52687. // in that case we can just return the element and be done.
  52688. if (isDef(vnode.componentInstance)) {
  52689. initComponent(vnode, insertedVnodeQueue);
  52690. insert(parentElm, vnode.elm, refElm);
  52691. if (isTrue(isReactivated)) {
  52692. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  52693. }
  52694. return true
  52695. }
  52696. }
  52697. }
  52698. function initComponent (vnode, insertedVnodeQueue) {
  52699. if (isDef(vnode.data.pendingInsert)) {
  52700. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  52701. vnode.data.pendingInsert = null;
  52702. }
  52703. vnode.elm = vnode.componentInstance.$el;
  52704. if (isPatchable(vnode)) {
  52705. invokeCreateHooks(vnode, insertedVnodeQueue);
  52706. setScope(vnode);
  52707. } else {
  52708. // empty component root.
  52709. // skip all element-related modules except for ref (#3455)
  52710. registerRef(vnode);
  52711. // make sure to invoke the insert hook
  52712. insertedVnodeQueue.push(vnode);
  52713. }
  52714. }
  52715. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  52716. var i;
  52717. // hack for #4339: a reactivated component with inner transition
  52718. // does not trigger because the inner node's created hooks are not called
  52719. // again. It's not ideal to involve module-specific logic in here but
  52720. // there doesn't seem to be a better way to do it.
  52721. var innerNode = vnode;
  52722. while (innerNode.componentInstance) {
  52723. innerNode = innerNode.componentInstance._vnode;
  52724. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  52725. for (i = 0; i < cbs.activate.length; ++i) {
  52726. cbs.activate[i](emptyNode, innerNode);
  52727. }
  52728. insertedVnodeQueue.push(innerNode);
  52729. break
  52730. }
  52731. }
  52732. // unlike a newly created component,
  52733. // a reactivated keep-alive component doesn't insert itself
  52734. insert(parentElm, vnode.elm, refElm);
  52735. }
  52736. function insert (parent, elm, ref$$1) {
  52737. if (isDef(parent)) {
  52738. if (isDef(ref$$1)) {
  52739. if (nodeOps.parentNode(ref$$1) === parent) {
  52740. nodeOps.insertBefore(parent, elm, ref$$1);
  52741. }
  52742. } else {
  52743. nodeOps.appendChild(parent, elm);
  52744. }
  52745. }
  52746. }
  52747. function createChildren (vnode, children, insertedVnodeQueue) {
  52748. if (Array.isArray(children)) {
  52749. {
  52750. checkDuplicateKeys(children);
  52751. }
  52752. for (var i = 0; i < children.length; ++i) {
  52753. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  52754. }
  52755. } else if (isPrimitive(vnode.text)) {
  52756. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  52757. }
  52758. }
  52759. function isPatchable (vnode) {
  52760. while (vnode.componentInstance) {
  52761. vnode = vnode.componentInstance._vnode;
  52762. }
  52763. return isDef(vnode.tag)
  52764. }
  52765. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  52766. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  52767. cbs.create[i$1](emptyNode, vnode);
  52768. }
  52769. i = vnode.data.hook; // Reuse variable
  52770. if (isDef(i)) {
  52771. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  52772. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  52773. }
  52774. }
  52775. // set scope id attribute for scoped CSS.
  52776. // this is implemented as a special case to avoid the overhead
  52777. // of going through the normal attribute patching process.
  52778. function setScope (vnode) {
  52779. var i;
  52780. if (isDef(i = vnode.fnScopeId)) {
  52781. nodeOps.setStyleScope(vnode.elm, i);
  52782. } else {
  52783. var ancestor = vnode;
  52784. while (ancestor) {
  52785. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  52786. nodeOps.setStyleScope(vnode.elm, i);
  52787. }
  52788. ancestor = ancestor.parent;
  52789. }
  52790. }
  52791. // for slot content they should also get the scopeId from the host instance.
  52792. if (isDef(i = activeInstance) &&
  52793. i !== vnode.context &&
  52794. i !== vnode.fnContext &&
  52795. isDef(i = i.$options._scopeId)
  52796. ) {
  52797. nodeOps.setStyleScope(vnode.elm, i);
  52798. }
  52799. }
  52800. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  52801. for (; startIdx <= endIdx; ++startIdx) {
  52802. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  52803. }
  52804. }
  52805. function invokeDestroyHook (vnode) {
  52806. var i, j;
  52807. var data = vnode.data;
  52808. if (isDef(data)) {
  52809. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  52810. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  52811. }
  52812. if (isDef(i = vnode.children)) {
  52813. for (j = 0; j < vnode.children.length; ++j) {
  52814. invokeDestroyHook(vnode.children[j]);
  52815. }
  52816. }
  52817. }
  52818. function removeVnodes (vnodes, startIdx, endIdx) {
  52819. for (; startIdx <= endIdx; ++startIdx) {
  52820. var ch = vnodes[startIdx];
  52821. if (isDef(ch)) {
  52822. if (isDef(ch.tag)) {
  52823. removeAndInvokeRemoveHook(ch);
  52824. invokeDestroyHook(ch);
  52825. } else { // Text node
  52826. removeNode(ch.elm);
  52827. }
  52828. }
  52829. }
  52830. }
  52831. function removeAndInvokeRemoveHook (vnode, rm) {
  52832. if (isDef(rm) || isDef(vnode.data)) {
  52833. var i;
  52834. var listeners = cbs.remove.length + 1;
  52835. if (isDef(rm)) {
  52836. // we have a recursively passed down rm callback
  52837. // increase the listeners count
  52838. rm.listeners += listeners;
  52839. } else {
  52840. // directly removing
  52841. rm = createRmCb(vnode.elm, listeners);
  52842. }
  52843. // recursively invoke hooks on child component root node
  52844. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  52845. removeAndInvokeRemoveHook(i, rm);
  52846. }
  52847. for (i = 0; i < cbs.remove.length; ++i) {
  52848. cbs.remove[i](vnode, rm);
  52849. }
  52850. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  52851. i(vnode, rm);
  52852. } else {
  52853. rm();
  52854. }
  52855. } else {
  52856. removeNode(vnode.elm);
  52857. }
  52858. }
  52859. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  52860. var oldStartIdx = 0;
  52861. var newStartIdx = 0;
  52862. var oldEndIdx = oldCh.length - 1;
  52863. var oldStartVnode = oldCh[0];
  52864. var oldEndVnode = oldCh[oldEndIdx];
  52865. var newEndIdx = newCh.length - 1;
  52866. var newStartVnode = newCh[0];
  52867. var newEndVnode = newCh[newEndIdx];
  52868. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  52869. // removeOnly is a special flag used only by <transition-group>
  52870. // to ensure removed elements stay in correct relative positions
  52871. // during leaving transitions
  52872. var canMove = !removeOnly;
  52873. {
  52874. checkDuplicateKeys(newCh);
  52875. }
  52876. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  52877. if (isUndef(oldStartVnode)) {
  52878. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  52879. } else if (isUndef(oldEndVnode)) {
  52880. oldEndVnode = oldCh[--oldEndIdx];
  52881. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  52882. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52883. oldStartVnode = oldCh[++oldStartIdx];
  52884. newStartVnode = newCh[++newStartIdx];
  52885. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  52886. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  52887. oldEndVnode = oldCh[--oldEndIdx];
  52888. newEndVnode = newCh[--newEndIdx];
  52889. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  52890. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  52891. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  52892. oldStartVnode = oldCh[++oldStartIdx];
  52893. newEndVnode = newCh[--newEndIdx];
  52894. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  52895. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52896. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  52897. oldEndVnode = oldCh[--oldEndIdx];
  52898. newStartVnode = newCh[++newStartIdx];
  52899. } else {
  52900. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  52901. idxInOld = isDef(newStartVnode.key)
  52902. ? oldKeyToIdx[newStartVnode.key]
  52903. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  52904. if (isUndef(idxInOld)) { // New element
  52905. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  52906. } else {
  52907. vnodeToMove = oldCh[idxInOld];
  52908. if (sameVnode(vnodeToMove, newStartVnode)) {
  52909. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  52910. oldCh[idxInOld] = undefined;
  52911. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  52912. } else {
  52913. // same key but different element. treat as new element
  52914. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  52915. }
  52916. }
  52917. newStartVnode = newCh[++newStartIdx];
  52918. }
  52919. }
  52920. if (oldStartIdx > oldEndIdx) {
  52921. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  52922. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  52923. } else if (newStartIdx > newEndIdx) {
  52924. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  52925. }
  52926. }
  52927. function checkDuplicateKeys (children) {
  52928. var seenKeys = {};
  52929. for (var i = 0; i < children.length; i++) {
  52930. var vnode = children[i];
  52931. var key = vnode.key;
  52932. if (isDef(key)) {
  52933. if (seenKeys[key]) {
  52934. warn(
  52935. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  52936. vnode.context
  52937. );
  52938. } else {
  52939. seenKeys[key] = true;
  52940. }
  52941. }
  52942. }
  52943. }
  52944. function findIdxInOld (node, oldCh, start, end) {
  52945. for (var i = start; i < end; i++) {
  52946. var c = oldCh[i];
  52947. if (isDef(c) && sameVnode(node, c)) { return i }
  52948. }
  52949. }
  52950. function patchVnode (
  52951. oldVnode,
  52952. vnode,
  52953. insertedVnodeQueue,
  52954. ownerArray,
  52955. index,
  52956. removeOnly
  52957. ) {
  52958. if (oldVnode === vnode) {
  52959. return
  52960. }
  52961. if (isDef(vnode.elm) && isDef(ownerArray)) {
  52962. // clone reused vnode
  52963. vnode = ownerArray[index] = cloneVNode(vnode);
  52964. }
  52965. var elm = vnode.elm = oldVnode.elm;
  52966. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  52967. if (isDef(vnode.asyncFactory.resolved)) {
  52968. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  52969. } else {
  52970. vnode.isAsyncPlaceholder = true;
  52971. }
  52972. return
  52973. }
  52974. // reuse element for static trees.
  52975. // note we only do this if the vnode is cloned -
  52976. // if the new node is not cloned it means the render functions have been
  52977. // reset by the hot-reload-api and we need to do a proper re-render.
  52978. if (isTrue(vnode.isStatic) &&
  52979. isTrue(oldVnode.isStatic) &&
  52980. vnode.key === oldVnode.key &&
  52981. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  52982. ) {
  52983. vnode.componentInstance = oldVnode.componentInstance;
  52984. return
  52985. }
  52986. var i;
  52987. var data = vnode.data;
  52988. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  52989. i(oldVnode, vnode);
  52990. }
  52991. var oldCh = oldVnode.children;
  52992. var ch = vnode.children;
  52993. if (isDef(data) && isPatchable(vnode)) {
  52994. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  52995. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  52996. }
  52997. if (isUndef(vnode.text)) {
  52998. if (isDef(oldCh) && isDef(ch)) {
  52999. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  53000. } else if (isDef(ch)) {
  53001. {
  53002. checkDuplicateKeys(ch);
  53003. }
  53004. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  53005. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  53006. } else if (isDef(oldCh)) {
  53007. removeVnodes(oldCh, 0, oldCh.length - 1);
  53008. } else if (isDef(oldVnode.text)) {
  53009. nodeOps.setTextContent(elm, '');
  53010. }
  53011. } else if (oldVnode.text !== vnode.text) {
  53012. nodeOps.setTextContent(elm, vnode.text);
  53013. }
  53014. if (isDef(data)) {
  53015. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  53016. }
  53017. }
  53018. function invokeInsertHook (vnode, queue, initial) {
  53019. // delay insert hooks for component root nodes, invoke them after the
  53020. // element is really inserted
  53021. if (isTrue(initial) && isDef(vnode.parent)) {
  53022. vnode.parent.data.pendingInsert = queue;
  53023. } else {
  53024. for (var i = 0; i < queue.length; ++i) {
  53025. queue[i].data.hook.insert(queue[i]);
  53026. }
  53027. }
  53028. }
  53029. var hydrationBailed = false;
  53030. // list of modules that can skip create hook during hydration because they
  53031. // are already rendered on the client or has no need for initialization
  53032. // Note: style is excluded because it relies on initial clone for future
  53033. // deep updates (#7063).
  53034. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  53035. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  53036. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  53037. var i;
  53038. var tag = vnode.tag;
  53039. var data = vnode.data;
  53040. var children = vnode.children;
  53041. inVPre = inVPre || (data && data.pre);
  53042. vnode.elm = elm;
  53043. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  53044. vnode.isAsyncPlaceholder = true;
  53045. return true
  53046. }
  53047. // assert node match
  53048. {
  53049. if (!assertNodeMatch(elm, vnode, inVPre)) {
  53050. return false
  53051. }
  53052. }
  53053. if (isDef(data)) {
  53054. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  53055. if (isDef(i = vnode.componentInstance)) {
  53056. // child component. it should have hydrated its own tree.
  53057. initComponent(vnode, insertedVnodeQueue);
  53058. return true
  53059. }
  53060. }
  53061. if (isDef(tag)) {
  53062. if (isDef(children)) {
  53063. // empty element, allow client to pick up and populate children
  53064. if (!elm.hasChildNodes()) {
  53065. createChildren(vnode, children, insertedVnodeQueue);
  53066. } else {
  53067. // v-html and domProps: innerHTML
  53068. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  53069. if (i !== elm.innerHTML) {
  53070. /* istanbul ignore if */
  53071. if (typeof console !== 'undefined' &&
  53072. !hydrationBailed
  53073. ) {
  53074. hydrationBailed = true;
  53075. console.warn('Parent: ', elm);
  53076. console.warn('server innerHTML: ', i);
  53077. console.warn('client innerHTML: ', elm.innerHTML);
  53078. }
  53079. return false
  53080. }
  53081. } else {
  53082. // iterate and compare children lists
  53083. var childrenMatch = true;
  53084. var childNode = elm.firstChild;
  53085. for (var i$1 = 0; i$1 < children.length; i$1++) {
  53086. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  53087. childrenMatch = false;
  53088. break
  53089. }
  53090. childNode = childNode.nextSibling;
  53091. }
  53092. // if childNode is not null, it means the actual childNodes list is
  53093. // longer than the virtual children list.
  53094. if (!childrenMatch || childNode) {
  53095. /* istanbul ignore if */
  53096. if (typeof console !== 'undefined' &&
  53097. !hydrationBailed
  53098. ) {
  53099. hydrationBailed = true;
  53100. console.warn('Parent: ', elm);
  53101. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  53102. }
  53103. return false
  53104. }
  53105. }
  53106. }
  53107. }
  53108. if (isDef(data)) {
  53109. var fullInvoke = false;
  53110. for (var key in data) {
  53111. if (!isRenderedModule(key)) {
  53112. fullInvoke = true;
  53113. invokeCreateHooks(vnode, insertedVnodeQueue);
  53114. break
  53115. }
  53116. }
  53117. if (!fullInvoke && data['class']) {
  53118. // ensure collecting deps for deep class bindings for future updates
  53119. traverse(data['class']);
  53120. }
  53121. }
  53122. } else if (elm.data !== vnode.text) {
  53123. elm.data = vnode.text;
  53124. }
  53125. return true
  53126. }
  53127. function assertNodeMatch (node, vnode, inVPre) {
  53128. if (isDef(vnode.tag)) {
  53129. return vnode.tag.indexOf('vue-component') === 0 || (
  53130. !isUnknownElement$$1(vnode, inVPre) &&
  53131. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  53132. )
  53133. } else {
  53134. return node.nodeType === (vnode.isComment ? 8 : 3)
  53135. }
  53136. }
  53137. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  53138. if (isUndef(vnode)) {
  53139. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  53140. return
  53141. }
  53142. var isInitialPatch = false;
  53143. var insertedVnodeQueue = [];
  53144. if (isUndef(oldVnode)) {
  53145. // empty mount (likely as component), create new root element
  53146. isInitialPatch = true;
  53147. createElm(vnode, insertedVnodeQueue);
  53148. } else {
  53149. var isRealElement = isDef(oldVnode.nodeType);
  53150. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  53151. // patch existing root node
  53152. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  53153. } else {
  53154. if (isRealElement) {
  53155. // mounting to a real element
  53156. // check if this is server-rendered content and if we can perform
  53157. // a successful hydration.
  53158. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  53159. oldVnode.removeAttribute(SSR_ATTR);
  53160. hydrating = true;
  53161. }
  53162. if (isTrue(hydrating)) {
  53163. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  53164. invokeInsertHook(vnode, insertedVnodeQueue, true);
  53165. return oldVnode
  53166. } else {
  53167. warn(
  53168. 'The client-side rendered virtual DOM tree is not matching ' +
  53169. 'server-rendered content. This is likely caused by incorrect ' +
  53170. 'HTML markup, for example nesting block-level elements inside ' +
  53171. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  53172. 'full client-side render.'
  53173. );
  53174. }
  53175. }
  53176. // either not server-rendered, or hydration failed.
  53177. // create an empty node and replace it
  53178. oldVnode = emptyNodeAt(oldVnode);
  53179. }
  53180. // replacing existing element
  53181. var oldElm = oldVnode.elm;
  53182. var parentElm = nodeOps.parentNode(oldElm);
  53183. // create new node
  53184. createElm(
  53185. vnode,
  53186. insertedVnodeQueue,
  53187. // extremely rare edge case: do not insert if old element is in a
  53188. // leaving transition. Only happens when combining transition +
  53189. // keep-alive + HOCs. (#4590)
  53190. oldElm._leaveCb ? null : parentElm,
  53191. nodeOps.nextSibling(oldElm)
  53192. );
  53193. // update parent placeholder node element, recursively
  53194. if (isDef(vnode.parent)) {
  53195. var ancestor = vnode.parent;
  53196. var patchable = isPatchable(vnode);
  53197. while (ancestor) {
  53198. for (var i = 0; i < cbs.destroy.length; ++i) {
  53199. cbs.destroy[i](ancestor);
  53200. }
  53201. ancestor.elm = vnode.elm;
  53202. if (patchable) {
  53203. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53204. cbs.create[i$1](emptyNode, ancestor);
  53205. }
  53206. // #6513
  53207. // invoke insert hooks that may have been merged by create hooks.
  53208. // e.g. for directives that uses the "inserted" hook.
  53209. var insert = ancestor.data.hook.insert;
  53210. if (insert.merged) {
  53211. // start at index 1 to avoid re-invoking component mounted hook
  53212. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  53213. insert.fns[i$2]();
  53214. }
  53215. }
  53216. } else {
  53217. registerRef(ancestor);
  53218. }
  53219. ancestor = ancestor.parent;
  53220. }
  53221. }
  53222. // destroy old node
  53223. if (isDef(parentElm)) {
  53224. removeVnodes([oldVnode], 0, 0);
  53225. } else if (isDef(oldVnode.tag)) {
  53226. invokeDestroyHook(oldVnode);
  53227. }
  53228. }
  53229. }
  53230. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  53231. return vnode.elm
  53232. }
  53233. }
  53234. /* */
  53235. var directives = {
  53236. create: updateDirectives,
  53237. update: updateDirectives,
  53238. destroy: function unbindDirectives (vnode) {
  53239. updateDirectives(vnode, emptyNode);
  53240. }
  53241. };
  53242. function updateDirectives (oldVnode, vnode) {
  53243. if (oldVnode.data.directives || vnode.data.directives) {
  53244. _update(oldVnode, vnode);
  53245. }
  53246. }
  53247. function _update (oldVnode, vnode) {
  53248. var isCreate = oldVnode === emptyNode;
  53249. var isDestroy = vnode === emptyNode;
  53250. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  53251. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  53252. var dirsWithInsert = [];
  53253. var dirsWithPostpatch = [];
  53254. var key, oldDir, dir;
  53255. for (key in newDirs) {
  53256. oldDir = oldDirs[key];
  53257. dir = newDirs[key];
  53258. if (!oldDir) {
  53259. // new directive, bind
  53260. callHook$1(dir, 'bind', vnode, oldVnode);
  53261. if (dir.def && dir.def.inserted) {
  53262. dirsWithInsert.push(dir);
  53263. }
  53264. } else {
  53265. // existing directive, update
  53266. dir.oldValue = oldDir.value;
  53267. dir.oldArg = oldDir.arg;
  53268. callHook$1(dir, 'update', vnode, oldVnode);
  53269. if (dir.def && dir.def.componentUpdated) {
  53270. dirsWithPostpatch.push(dir);
  53271. }
  53272. }
  53273. }
  53274. if (dirsWithInsert.length) {
  53275. var callInsert = function () {
  53276. for (var i = 0; i < dirsWithInsert.length; i++) {
  53277. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  53278. }
  53279. };
  53280. if (isCreate) {
  53281. mergeVNodeHook(vnode, 'insert', callInsert);
  53282. } else {
  53283. callInsert();
  53284. }
  53285. }
  53286. if (dirsWithPostpatch.length) {
  53287. mergeVNodeHook(vnode, 'postpatch', function () {
  53288. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  53289. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  53290. }
  53291. });
  53292. }
  53293. if (!isCreate) {
  53294. for (key in oldDirs) {
  53295. if (!newDirs[key]) {
  53296. // no longer present, unbind
  53297. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  53298. }
  53299. }
  53300. }
  53301. }
  53302. var emptyModifiers = Object.create(null);
  53303. function normalizeDirectives$1 (
  53304. dirs,
  53305. vm
  53306. ) {
  53307. var res = Object.create(null);
  53308. if (!dirs) {
  53309. // $flow-disable-line
  53310. return res
  53311. }
  53312. var i, dir;
  53313. for (i = 0; i < dirs.length; i++) {
  53314. dir = dirs[i];
  53315. if (!dir.modifiers) {
  53316. // $flow-disable-line
  53317. dir.modifiers = emptyModifiers;
  53318. }
  53319. res[getRawDirName(dir)] = dir;
  53320. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  53321. }
  53322. // $flow-disable-line
  53323. return res
  53324. }
  53325. function getRawDirName (dir) {
  53326. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  53327. }
  53328. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  53329. var fn = dir.def && dir.def[hook];
  53330. if (fn) {
  53331. try {
  53332. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  53333. } catch (e) {
  53334. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  53335. }
  53336. }
  53337. }
  53338. var baseModules = [
  53339. ref,
  53340. directives
  53341. ];
  53342. /* */
  53343. function updateAttrs (oldVnode, vnode) {
  53344. var opts = vnode.componentOptions;
  53345. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  53346. return
  53347. }
  53348. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  53349. return
  53350. }
  53351. var key, cur, old;
  53352. var elm = vnode.elm;
  53353. var oldAttrs = oldVnode.data.attrs || {};
  53354. var attrs = vnode.data.attrs || {};
  53355. // clone observed objects, as the user probably wants to mutate it
  53356. if (isDef(attrs.__ob__)) {
  53357. attrs = vnode.data.attrs = extend({}, attrs);
  53358. }
  53359. for (key in attrs) {
  53360. cur = attrs[key];
  53361. old = oldAttrs[key];
  53362. if (old !== cur) {
  53363. setAttr(elm, key, cur);
  53364. }
  53365. }
  53366. // #4391: in IE9, setting type can reset value for input[type=radio]
  53367. // #6666: IE/Edge forces progress value down to 1 before setting a max
  53368. /* istanbul ignore if */
  53369. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  53370. setAttr(elm, 'value', attrs.value);
  53371. }
  53372. for (key in oldAttrs) {
  53373. if (isUndef(attrs[key])) {
  53374. if (isXlink(key)) {
  53375. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53376. } else if (!isEnumeratedAttr(key)) {
  53377. elm.removeAttribute(key);
  53378. }
  53379. }
  53380. }
  53381. }
  53382. function setAttr (el, key, value) {
  53383. if (el.tagName.indexOf('-') > -1) {
  53384. baseSetAttr(el, key, value);
  53385. } else if (isBooleanAttr(key)) {
  53386. // set attribute for blank value
  53387. // e.g. <option disabled>Select one</option>
  53388. if (isFalsyAttrValue(value)) {
  53389. el.removeAttribute(key);
  53390. } else {
  53391. // technically allowfullscreen is a boolean attribute for <iframe>,
  53392. // but Flash expects a value of "true" when used on <embed> tag
  53393. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  53394. ? 'true'
  53395. : key;
  53396. el.setAttribute(key, value);
  53397. }
  53398. } else if (isEnumeratedAttr(key)) {
  53399. el.setAttribute(key, convertEnumeratedValue(key, value));
  53400. } else if (isXlink(key)) {
  53401. if (isFalsyAttrValue(value)) {
  53402. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53403. } else {
  53404. el.setAttributeNS(xlinkNS, key, value);
  53405. }
  53406. } else {
  53407. baseSetAttr(el, key, value);
  53408. }
  53409. }
  53410. function baseSetAttr (el, key, value) {
  53411. if (isFalsyAttrValue(value)) {
  53412. el.removeAttribute(key);
  53413. } else {
  53414. // #7138: IE10 & 11 fires input event when setting placeholder on
  53415. // <textarea>... block the first input event and remove the blocker
  53416. // immediately.
  53417. /* istanbul ignore if */
  53418. if (
  53419. isIE && !isIE9 &&
  53420. el.tagName === 'TEXTAREA' &&
  53421. key === 'placeholder' && value !== '' && !el.__ieph
  53422. ) {
  53423. var blocker = function (e) {
  53424. e.stopImmediatePropagation();
  53425. el.removeEventListener('input', blocker);
  53426. };
  53427. el.addEventListener('input', blocker);
  53428. // $flow-disable-line
  53429. el.__ieph = true; /* IE placeholder patched */
  53430. }
  53431. el.setAttribute(key, value);
  53432. }
  53433. }
  53434. var attrs = {
  53435. create: updateAttrs,
  53436. update: updateAttrs
  53437. };
  53438. /* */
  53439. function updateClass (oldVnode, vnode) {
  53440. var el = vnode.elm;
  53441. var data = vnode.data;
  53442. var oldData = oldVnode.data;
  53443. if (
  53444. isUndef(data.staticClass) &&
  53445. isUndef(data.class) && (
  53446. isUndef(oldData) || (
  53447. isUndef(oldData.staticClass) &&
  53448. isUndef(oldData.class)
  53449. )
  53450. )
  53451. ) {
  53452. return
  53453. }
  53454. var cls = genClassForVnode(vnode);
  53455. // handle transition classes
  53456. var transitionClass = el._transitionClasses;
  53457. if (isDef(transitionClass)) {
  53458. cls = concat(cls, stringifyClass(transitionClass));
  53459. }
  53460. // set the class
  53461. if (cls !== el._prevClass) {
  53462. el.setAttribute('class', cls);
  53463. el._prevClass = cls;
  53464. }
  53465. }
  53466. var klass = {
  53467. create: updateClass,
  53468. update: updateClass
  53469. };
  53470. /* */
  53471. var validDivisionCharRE = /[\w).+\-_$\]]/;
  53472. function parseFilters (exp) {
  53473. var inSingle = false;
  53474. var inDouble = false;
  53475. var inTemplateString = false;
  53476. var inRegex = false;
  53477. var curly = 0;
  53478. var square = 0;
  53479. var paren = 0;
  53480. var lastFilterIndex = 0;
  53481. var c, prev, i, expression, filters;
  53482. for (i = 0; i < exp.length; i++) {
  53483. prev = c;
  53484. c = exp.charCodeAt(i);
  53485. if (inSingle) {
  53486. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  53487. } else if (inDouble) {
  53488. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  53489. } else if (inTemplateString) {
  53490. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  53491. } else if (inRegex) {
  53492. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  53493. } else if (
  53494. c === 0x7C && // pipe
  53495. exp.charCodeAt(i + 1) !== 0x7C &&
  53496. exp.charCodeAt(i - 1) !== 0x7C &&
  53497. !curly && !square && !paren
  53498. ) {
  53499. if (expression === undefined) {
  53500. // first filter, end of expression
  53501. lastFilterIndex = i + 1;
  53502. expression = exp.slice(0, i).trim();
  53503. } else {
  53504. pushFilter();
  53505. }
  53506. } else {
  53507. switch (c) {
  53508. case 0x22: inDouble = true; break // "
  53509. case 0x27: inSingle = true; break // '
  53510. case 0x60: inTemplateString = true; break // `
  53511. case 0x28: paren++; break // (
  53512. case 0x29: paren--; break // )
  53513. case 0x5B: square++; break // [
  53514. case 0x5D: square--; break // ]
  53515. case 0x7B: curly++; break // {
  53516. case 0x7D: curly--; break // }
  53517. }
  53518. if (c === 0x2f) { // /
  53519. var j = i - 1;
  53520. var p = (void 0);
  53521. // find first non-whitespace prev char
  53522. for (; j >= 0; j--) {
  53523. p = exp.charAt(j);
  53524. if (p !== ' ') { break }
  53525. }
  53526. if (!p || !validDivisionCharRE.test(p)) {
  53527. inRegex = true;
  53528. }
  53529. }
  53530. }
  53531. }
  53532. if (expression === undefined) {
  53533. expression = exp.slice(0, i).trim();
  53534. } else if (lastFilterIndex !== 0) {
  53535. pushFilter();
  53536. }
  53537. function pushFilter () {
  53538. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  53539. lastFilterIndex = i + 1;
  53540. }
  53541. if (filters) {
  53542. for (i = 0; i < filters.length; i++) {
  53543. expression = wrapFilter(expression, filters[i]);
  53544. }
  53545. }
  53546. return expression
  53547. }
  53548. function wrapFilter (exp, filter) {
  53549. var i = filter.indexOf('(');
  53550. if (i < 0) {
  53551. // _f: resolveFilter
  53552. return ("_f(\"" + filter + "\")(" + exp + ")")
  53553. } else {
  53554. var name = filter.slice(0, i);
  53555. var args = filter.slice(i + 1);
  53556. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  53557. }
  53558. }
  53559. /* */
  53560. /* eslint-disable no-unused-vars */
  53561. function baseWarn (msg, range) {
  53562. console.error(("[Vue compiler]: " + msg));
  53563. }
  53564. /* eslint-enable no-unused-vars */
  53565. function pluckModuleFunction (
  53566. modules,
  53567. key
  53568. ) {
  53569. return modules
  53570. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  53571. : []
  53572. }
  53573. function addProp (el, name, value, range, dynamic) {
  53574. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  53575. el.plain = false;
  53576. }
  53577. function addAttr (el, name, value, range, dynamic) {
  53578. var attrs = dynamic
  53579. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  53580. : (el.attrs || (el.attrs = []));
  53581. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  53582. el.plain = false;
  53583. }
  53584. // add a raw attr (use this in preTransforms)
  53585. function addRawAttr (el, name, value, range) {
  53586. el.attrsMap[name] = value;
  53587. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  53588. }
  53589. function addDirective (
  53590. el,
  53591. name,
  53592. rawName,
  53593. value,
  53594. arg,
  53595. isDynamicArg,
  53596. modifiers,
  53597. range
  53598. ) {
  53599. (el.directives || (el.directives = [])).push(rangeSetItem({
  53600. name: name,
  53601. rawName: rawName,
  53602. value: value,
  53603. arg: arg,
  53604. isDynamicArg: isDynamicArg,
  53605. modifiers: modifiers
  53606. }, range));
  53607. el.plain = false;
  53608. }
  53609. function prependModifierMarker (symbol, name, dynamic) {
  53610. return dynamic
  53611. ? ("_p(" + name + ",\"" + symbol + "\")")
  53612. : symbol + name // mark the event as captured
  53613. }
  53614. function addHandler (
  53615. el,
  53616. name,
  53617. value,
  53618. modifiers,
  53619. important,
  53620. warn,
  53621. range,
  53622. dynamic
  53623. ) {
  53624. modifiers = modifiers || emptyObject;
  53625. // warn prevent and passive modifier
  53626. /* istanbul ignore if */
  53627. if (
  53628. warn &&
  53629. modifiers.prevent && modifiers.passive
  53630. ) {
  53631. warn(
  53632. 'passive and prevent can\'t be used together. ' +
  53633. 'Passive handler can\'t prevent default event.',
  53634. range
  53635. );
  53636. }
  53637. // normalize click.right and click.middle since they don't actually fire
  53638. // this is technically browser-specific, but at least for now browsers are
  53639. // the only target envs that have right/middle clicks.
  53640. if (modifiers.right) {
  53641. if (dynamic) {
  53642. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  53643. } else if (name === 'click') {
  53644. name = 'contextmenu';
  53645. delete modifiers.right;
  53646. }
  53647. } else if (modifiers.middle) {
  53648. if (dynamic) {
  53649. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  53650. } else if (name === 'click') {
  53651. name = 'mouseup';
  53652. }
  53653. }
  53654. // check capture modifier
  53655. if (modifiers.capture) {
  53656. delete modifiers.capture;
  53657. name = prependModifierMarker('!', name, dynamic);
  53658. }
  53659. if (modifiers.once) {
  53660. delete modifiers.once;
  53661. name = prependModifierMarker('~', name, dynamic);
  53662. }
  53663. /* istanbul ignore if */
  53664. if (modifiers.passive) {
  53665. delete modifiers.passive;
  53666. name = prependModifierMarker('&', name, dynamic);
  53667. }
  53668. var events;
  53669. if (modifiers.native) {
  53670. delete modifiers.native;
  53671. events = el.nativeEvents || (el.nativeEvents = {});
  53672. } else {
  53673. events = el.events || (el.events = {});
  53674. }
  53675. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  53676. if (modifiers !== emptyObject) {
  53677. newHandler.modifiers = modifiers;
  53678. }
  53679. var handlers = events[name];
  53680. /* istanbul ignore if */
  53681. if (Array.isArray(handlers)) {
  53682. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  53683. } else if (handlers) {
  53684. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  53685. } else {
  53686. events[name] = newHandler;
  53687. }
  53688. el.plain = false;
  53689. }
  53690. function getRawBindingAttr (
  53691. el,
  53692. name
  53693. ) {
  53694. return el.rawAttrsMap[':' + name] ||
  53695. el.rawAttrsMap['v-bind:' + name] ||
  53696. el.rawAttrsMap[name]
  53697. }
  53698. function getBindingAttr (
  53699. el,
  53700. name,
  53701. getStatic
  53702. ) {
  53703. var dynamicValue =
  53704. getAndRemoveAttr(el, ':' + name) ||
  53705. getAndRemoveAttr(el, 'v-bind:' + name);
  53706. if (dynamicValue != null) {
  53707. return parseFilters(dynamicValue)
  53708. } else if (getStatic !== false) {
  53709. var staticValue = getAndRemoveAttr(el, name);
  53710. if (staticValue != null) {
  53711. return JSON.stringify(staticValue)
  53712. }
  53713. }
  53714. }
  53715. // note: this only removes the attr from the Array (attrsList) so that it
  53716. // doesn't get processed by processAttrs.
  53717. // By default it does NOT remove it from the map (attrsMap) because the map is
  53718. // needed during codegen.
  53719. function getAndRemoveAttr (
  53720. el,
  53721. name,
  53722. removeFromMap
  53723. ) {
  53724. var val;
  53725. if ((val = el.attrsMap[name]) != null) {
  53726. var list = el.attrsList;
  53727. for (var i = 0, l = list.length; i < l; i++) {
  53728. if (list[i].name === name) {
  53729. list.splice(i, 1);
  53730. break
  53731. }
  53732. }
  53733. }
  53734. if (removeFromMap) {
  53735. delete el.attrsMap[name];
  53736. }
  53737. return val
  53738. }
  53739. function getAndRemoveAttrByRegex (
  53740. el,
  53741. name
  53742. ) {
  53743. var list = el.attrsList;
  53744. for (var i = 0, l = list.length; i < l; i++) {
  53745. var attr = list[i];
  53746. if (name.test(attr.name)) {
  53747. list.splice(i, 1);
  53748. return attr
  53749. }
  53750. }
  53751. }
  53752. function rangeSetItem (
  53753. item,
  53754. range
  53755. ) {
  53756. if (range) {
  53757. if (range.start != null) {
  53758. item.start = range.start;
  53759. }
  53760. if (range.end != null) {
  53761. item.end = range.end;
  53762. }
  53763. }
  53764. return item
  53765. }
  53766. /* */
  53767. /**
  53768. * Cross-platform code generation for component v-model
  53769. */
  53770. function genComponentModel (
  53771. el,
  53772. value,
  53773. modifiers
  53774. ) {
  53775. var ref = modifiers || {};
  53776. var number = ref.number;
  53777. var trim = ref.trim;
  53778. var baseValueExpression = '$$v';
  53779. var valueExpression = baseValueExpression;
  53780. if (trim) {
  53781. valueExpression =
  53782. "(typeof " + baseValueExpression + " === 'string'" +
  53783. "? " + baseValueExpression + ".trim()" +
  53784. ": " + baseValueExpression + ")";
  53785. }
  53786. if (number) {
  53787. valueExpression = "_n(" + valueExpression + ")";
  53788. }
  53789. var assignment = genAssignmentCode(value, valueExpression);
  53790. el.model = {
  53791. value: ("(" + value + ")"),
  53792. expression: JSON.stringify(value),
  53793. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  53794. };
  53795. }
  53796. /**
  53797. * Cross-platform codegen helper for generating v-model value assignment code.
  53798. */
  53799. function genAssignmentCode (
  53800. value,
  53801. assignment
  53802. ) {
  53803. var res = parseModel(value);
  53804. if (res.key === null) {
  53805. return (value + "=" + assignment)
  53806. } else {
  53807. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  53808. }
  53809. }
  53810. /**
  53811. * Parse a v-model expression into a base path and a final key segment.
  53812. * Handles both dot-path and possible square brackets.
  53813. *
  53814. * Possible cases:
  53815. *
  53816. * - test
  53817. * - test[key]
  53818. * - test[test1[key]]
  53819. * - test["a"][key]
  53820. * - xxx.test[a[a].test1[key]]
  53821. * - test.xxx.a["asa"][test1[key]]
  53822. *
  53823. */
  53824. var len, str, chr, index$1, expressionPos, expressionEndPos;
  53825. function parseModel (val) {
  53826. // Fix https://github.com/vuejs/vue/pull/7730
  53827. // allow v-model="obj.val " (trailing whitespace)
  53828. val = val.trim();
  53829. len = val.length;
  53830. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  53831. index$1 = val.lastIndexOf('.');
  53832. if (index$1 > -1) {
  53833. return {
  53834. exp: val.slice(0, index$1),
  53835. key: '"' + val.slice(index$1 + 1) + '"'
  53836. }
  53837. } else {
  53838. return {
  53839. exp: val,
  53840. key: null
  53841. }
  53842. }
  53843. }
  53844. str = val;
  53845. index$1 = expressionPos = expressionEndPos = 0;
  53846. while (!eof()) {
  53847. chr = next();
  53848. /* istanbul ignore if */
  53849. if (isStringStart(chr)) {
  53850. parseString(chr);
  53851. } else if (chr === 0x5B) {
  53852. parseBracket(chr);
  53853. }
  53854. }
  53855. return {
  53856. exp: val.slice(0, expressionPos),
  53857. key: val.slice(expressionPos + 1, expressionEndPos)
  53858. }
  53859. }
  53860. function next () {
  53861. return str.charCodeAt(++index$1)
  53862. }
  53863. function eof () {
  53864. return index$1 >= len
  53865. }
  53866. function isStringStart (chr) {
  53867. return chr === 0x22 || chr === 0x27
  53868. }
  53869. function parseBracket (chr) {
  53870. var inBracket = 1;
  53871. expressionPos = index$1;
  53872. while (!eof()) {
  53873. chr = next();
  53874. if (isStringStart(chr)) {
  53875. parseString(chr);
  53876. continue
  53877. }
  53878. if (chr === 0x5B) { inBracket++; }
  53879. if (chr === 0x5D) { inBracket--; }
  53880. if (inBracket === 0) {
  53881. expressionEndPos = index$1;
  53882. break
  53883. }
  53884. }
  53885. }
  53886. function parseString (chr) {
  53887. var stringQuote = chr;
  53888. while (!eof()) {
  53889. chr = next();
  53890. if (chr === stringQuote) {
  53891. break
  53892. }
  53893. }
  53894. }
  53895. /* */
  53896. var warn$1;
  53897. // in some cases, the event used has to be determined at runtime
  53898. // so we used some reserved tokens during compile.
  53899. var RANGE_TOKEN = '__r';
  53900. var CHECKBOX_RADIO_TOKEN = '__c';
  53901. function model (
  53902. el,
  53903. dir,
  53904. _warn
  53905. ) {
  53906. warn$1 = _warn;
  53907. var value = dir.value;
  53908. var modifiers = dir.modifiers;
  53909. var tag = el.tag;
  53910. var type = el.attrsMap.type;
  53911. {
  53912. // inputs with type="file" are read only and setting the input's
  53913. // value will throw an error.
  53914. if (tag === 'input' && type === 'file') {
  53915. warn$1(
  53916. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  53917. "File inputs are read only. Use a v-on:change listener instead.",
  53918. el.rawAttrsMap['v-model']
  53919. );
  53920. }
  53921. }
  53922. if (el.component) {
  53923. genComponentModel(el, value, modifiers);
  53924. // component v-model doesn't need extra runtime
  53925. return false
  53926. } else if (tag === 'select') {
  53927. genSelect(el, value, modifiers);
  53928. } else if (tag === 'input' && type === 'checkbox') {
  53929. genCheckboxModel(el, value, modifiers);
  53930. } else if (tag === 'input' && type === 'radio') {
  53931. genRadioModel(el, value, modifiers);
  53932. } else if (tag === 'input' || tag === 'textarea') {
  53933. genDefaultModel(el, value, modifiers);
  53934. } else if (!config.isReservedTag(tag)) {
  53935. genComponentModel(el, value, modifiers);
  53936. // component v-model doesn't need extra runtime
  53937. return false
  53938. } else {
  53939. warn$1(
  53940. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53941. "v-model is not supported on this element type. " +
  53942. 'If you are working with contenteditable, it\'s recommended to ' +
  53943. 'wrap a library dedicated for that purpose inside a custom component.',
  53944. el.rawAttrsMap['v-model']
  53945. );
  53946. }
  53947. // ensure runtime directive metadata
  53948. return true
  53949. }
  53950. function genCheckboxModel (
  53951. el,
  53952. value,
  53953. modifiers
  53954. ) {
  53955. var number = modifiers && modifiers.number;
  53956. var valueBinding = getBindingAttr(el, 'value') || 'null';
  53957. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  53958. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  53959. addProp(el, 'checked',
  53960. "Array.isArray(" + value + ")" +
  53961. "?_i(" + value + "," + valueBinding + ")>-1" + (
  53962. trueValueBinding === 'true'
  53963. ? (":(" + value + ")")
  53964. : (":_q(" + value + "," + trueValueBinding + ")")
  53965. )
  53966. );
  53967. addHandler(el, 'change',
  53968. "var $$a=" + value + "," +
  53969. '$$el=$event.target,' +
  53970. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  53971. 'if(Array.isArray($$a)){' +
  53972. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  53973. '$$i=_i($$a,$$v);' +
  53974. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  53975. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  53976. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  53977. null, true
  53978. );
  53979. }
  53980. function genRadioModel (
  53981. el,
  53982. value,
  53983. modifiers
  53984. ) {
  53985. var number = modifiers && modifiers.number;
  53986. var valueBinding = getBindingAttr(el, 'value') || 'null';
  53987. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  53988. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  53989. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  53990. }
  53991. function genSelect (
  53992. el,
  53993. value,
  53994. modifiers
  53995. ) {
  53996. var number = modifiers && modifiers.number;
  53997. var selectedVal = "Array.prototype.filter" +
  53998. ".call($event.target.options,function(o){return o.selected})" +
  53999. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  54000. "return " + (number ? '_n(val)' : 'val') + "})";
  54001. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  54002. var code = "var $$selectedVal = " + selectedVal + ";";
  54003. code = code + " " + (genAssignmentCode(value, assignment));
  54004. addHandler(el, 'change', code, null, true);
  54005. }
  54006. function genDefaultModel (
  54007. el,
  54008. value,
  54009. modifiers
  54010. ) {
  54011. var type = el.attrsMap.type;
  54012. // warn if v-bind:value conflicts with v-model
  54013. // except for inputs with v-bind:type
  54014. {
  54015. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  54016. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  54017. if (value$1 && !typeBinding) {
  54018. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  54019. warn$1(
  54020. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  54021. 'because the latter already expands to a value binding internally',
  54022. el.rawAttrsMap[binding]
  54023. );
  54024. }
  54025. }
  54026. var ref = modifiers || {};
  54027. var lazy = ref.lazy;
  54028. var number = ref.number;
  54029. var trim = ref.trim;
  54030. var needCompositionGuard = !lazy && type !== 'range';
  54031. var event = lazy
  54032. ? 'change'
  54033. : type === 'range'
  54034. ? RANGE_TOKEN
  54035. : 'input';
  54036. var valueExpression = '$event.target.value';
  54037. if (trim) {
  54038. valueExpression = "$event.target.value.trim()";
  54039. }
  54040. if (number) {
  54041. valueExpression = "_n(" + valueExpression + ")";
  54042. }
  54043. var code = genAssignmentCode(value, valueExpression);
  54044. if (needCompositionGuard) {
  54045. code = "if($event.target.composing)return;" + code;
  54046. }
  54047. addProp(el, 'value', ("(" + value + ")"));
  54048. addHandler(el, event, code, null, true);
  54049. if (trim || number) {
  54050. addHandler(el, 'blur', '$forceUpdate()');
  54051. }
  54052. }
  54053. /* */
  54054. // normalize v-model event tokens that can only be determined at runtime.
  54055. // it's important to place the event as the first in the array because
  54056. // the whole point is ensuring the v-model callback gets called before
  54057. // user-attached handlers.
  54058. function normalizeEvents (on) {
  54059. /* istanbul ignore if */
  54060. if (isDef(on[RANGE_TOKEN])) {
  54061. // IE input[type=range] only supports `change` event
  54062. var event = isIE ? 'change' : 'input';
  54063. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  54064. delete on[RANGE_TOKEN];
  54065. }
  54066. // This was originally intended to fix #4521 but no longer necessary
  54067. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  54068. /* istanbul ignore if */
  54069. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  54070. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  54071. delete on[CHECKBOX_RADIO_TOKEN];
  54072. }
  54073. }
  54074. var target$1;
  54075. function createOnceHandler$1 (event, handler, capture) {
  54076. var _target = target$1; // save current target element in closure
  54077. return function onceHandler () {
  54078. var res = handler.apply(null, arguments);
  54079. if (res !== null) {
  54080. remove$2(event, onceHandler, capture, _target);
  54081. }
  54082. }
  54083. }
  54084. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  54085. // implementation and does not fire microtasks in between event propagation, so
  54086. // safe to exclude.
  54087. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  54088. function add$1 (
  54089. name,
  54090. handler,
  54091. capture,
  54092. passive
  54093. ) {
  54094. // async edge case #6566: inner click event triggers patch, event handler
  54095. // attached to outer element during patch, and triggered again. This
  54096. // happens because browsers fire microtask ticks between event propagation.
  54097. // the solution is simple: we save the timestamp when a handler is attached,
  54098. // and the handler would only fire if the event passed to it was fired
  54099. // AFTER it was attached.
  54100. if (useMicrotaskFix) {
  54101. var attachedTimestamp = currentFlushTimestamp;
  54102. var original = handler;
  54103. handler = original._wrapper = function (e) {
  54104. if (
  54105. // no bubbling, should always fire.
  54106. // this is just a safety net in case event.timeStamp is unreliable in
  54107. // certain weird environments...
  54108. e.target === e.currentTarget ||
  54109. // event is fired after handler attachment
  54110. e.timeStamp >= attachedTimestamp ||
  54111. // bail for environments that have buggy event.timeStamp implementations
  54112. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  54113. // #9681 QtWebEngine event.timeStamp is negative value
  54114. e.timeStamp <= 0 ||
  54115. // #9448 bail if event is fired in another document in a multi-page
  54116. // electron/nw.js app, since event.timeStamp will be using a different
  54117. // starting reference
  54118. e.target.ownerDocument !== document
  54119. ) {
  54120. return original.apply(this, arguments)
  54121. }
  54122. };
  54123. }
  54124. target$1.addEventListener(
  54125. name,
  54126. handler,
  54127. supportsPassive
  54128. ? { capture: capture, passive: passive }
  54129. : capture
  54130. );
  54131. }
  54132. function remove$2 (
  54133. name,
  54134. handler,
  54135. capture,
  54136. _target
  54137. ) {
  54138. (_target || target$1).removeEventListener(
  54139. name,
  54140. handler._wrapper || handler,
  54141. capture
  54142. );
  54143. }
  54144. function updateDOMListeners (oldVnode, vnode) {
  54145. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  54146. return
  54147. }
  54148. var on = vnode.data.on || {};
  54149. var oldOn = oldVnode.data.on || {};
  54150. target$1 = vnode.elm;
  54151. normalizeEvents(on);
  54152. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  54153. target$1 = undefined;
  54154. }
  54155. var events = {
  54156. create: updateDOMListeners,
  54157. update: updateDOMListeners
  54158. };
  54159. /* */
  54160. var svgContainer;
  54161. function updateDOMProps (oldVnode, vnode) {
  54162. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  54163. return
  54164. }
  54165. var key, cur;
  54166. var elm = vnode.elm;
  54167. var oldProps = oldVnode.data.domProps || {};
  54168. var props = vnode.data.domProps || {};
  54169. // clone observed objects, as the user probably wants to mutate it
  54170. if (isDef(props.__ob__)) {
  54171. props = vnode.data.domProps = extend({}, props);
  54172. }
  54173. for (key in oldProps) {
  54174. if (!(key in props)) {
  54175. elm[key] = '';
  54176. }
  54177. }
  54178. for (key in props) {
  54179. cur = props[key];
  54180. // ignore children if the node has textContent or innerHTML,
  54181. // as these will throw away existing DOM nodes and cause removal errors
  54182. // on subsequent patches (#3360)
  54183. if (key === 'textContent' || key === 'innerHTML') {
  54184. if (vnode.children) { vnode.children.length = 0; }
  54185. if (cur === oldProps[key]) { continue }
  54186. // #6601 work around Chrome version <= 55 bug where single textNode
  54187. // replaced by innerHTML/textContent retains its parentNode property
  54188. if (elm.childNodes.length === 1) {
  54189. elm.removeChild(elm.childNodes[0]);
  54190. }
  54191. }
  54192. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  54193. // store value as _value as well since
  54194. // non-string values will be stringified
  54195. elm._value = cur;
  54196. // avoid resetting cursor position when value is the same
  54197. var strCur = isUndef(cur) ? '' : String(cur);
  54198. if (shouldUpdateValue(elm, strCur)) {
  54199. elm.value = strCur;
  54200. }
  54201. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  54202. // IE doesn't support innerHTML for SVG elements
  54203. svgContainer = svgContainer || document.createElement('div');
  54204. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  54205. var svg = svgContainer.firstChild;
  54206. while (elm.firstChild) {
  54207. elm.removeChild(elm.firstChild);
  54208. }
  54209. while (svg.firstChild) {
  54210. elm.appendChild(svg.firstChild);
  54211. }
  54212. } else if (
  54213. // skip the update if old and new VDOM state is the same.
  54214. // `value` is handled separately because the DOM value may be temporarily
  54215. // out of sync with VDOM state due to focus, composition and modifiers.
  54216. // This #4521 by skipping the unnecesarry `checked` update.
  54217. cur !== oldProps[key]
  54218. ) {
  54219. // some property updates can throw
  54220. // e.g. `value` on <progress> w/ non-finite value
  54221. try {
  54222. elm[key] = cur;
  54223. } catch (e) {}
  54224. }
  54225. }
  54226. }
  54227. // check platforms/web/util/attrs.js acceptValue
  54228. function shouldUpdateValue (elm, checkVal) {
  54229. return (!elm.composing && (
  54230. elm.tagName === 'OPTION' ||
  54231. isNotInFocusAndDirty(elm, checkVal) ||
  54232. isDirtyWithModifiers(elm, checkVal)
  54233. ))
  54234. }
  54235. function isNotInFocusAndDirty (elm, checkVal) {
  54236. // return true when textbox (.number and .trim) loses focus and its value is
  54237. // not equal to the updated value
  54238. var notInFocus = true;
  54239. // #6157
  54240. // work around IE bug when accessing document.activeElement in an iframe
  54241. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  54242. return notInFocus && elm.value !== checkVal
  54243. }
  54244. function isDirtyWithModifiers (elm, newVal) {
  54245. var value = elm.value;
  54246. var modifiers = elm._vModifiers; // injected by v-model runtime
  54247. if (isDef(modifiers)) {
  54248. if (modifiers.number) {
  54249. return toNumber(value) !== toNumber(newVal)
  54250. }
  54251. if (modifiers.trim) {
  54252. return value.trim() !== newVal.trim()
  54253. }
  54254. }
  54255. return value !== newVal
  54256. }
  54257. var domProps = {
  54258. create: updateDOMProps,
  54259. update: updateDOMProps
  54260. };
  54261. /* */
  54262. var parseStyleText = cached(function (cssText) {
  54263. var res = {};
  54264. var listDelimiter = /;(?![^(]*\))/g;
  54265. var propertyDelimiter = /:(.+)/;
  54266. cssText.split(listDelimiter).forEach(function (item) {
  54267. if (item) {
  54268. var tmp = item.split(propertyDelimiter);
  54269. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  54270. }
  54271. });
  54272. return res
  54273. });
  54274. // merge static and dynamic style data on the same vnode
  54275. function normalizeStyleData (data) {
  54276. var style = normalizeStyleBinding(data.style);
  54277. // static style is pre-processed into an object during compilation
  54278. // and is always a fresh object, so it's safe to merge into it
  54279. return data.staticStyle
  54280. ? extend(data.staticStyle, style)
  54281. : style
  54282. }
  54283. // normalize possible array / string values into Object
  54284. function normalizeStyleBinding (bindingStyle) {
  54285. if (Array.isArray(bindingStyle)) {
  54286. return toObject(bindingStyle)
  54287. }
  54288. if (typeof bindingStyle === 'string') {
  54289. return parseStyleText(bindingStyle)
  54290. }
  54291. return bindingStyle
  54292. }
  54293. /**
  54294. * parent component style should be after child's
  54295. * so that parent component's style could override it
  54296. */
  54297. function getStyle (vnode, checkChild) {
  54298. var res = {};
  54299. var styleData;
  54300. if (checkChild) {
  54301. var childNode = vnode;
  54302. while (childNode.componentInstance) {
  54303. childNode = childNode.componentInstance._vnode;
  54304. if (
  54305. childNode && childNode.data &&
  54306. (styleData = normalizeStyleData(childNode.data))
  54307. ) {
  54308. extend(res, styleData);
  54309. }
  54310. }
  54311. }
  54312. if ((styleData = normalizeStyleData(vnode.data))) {
  54313. extend(res, styleData);
  54314. }
  54315. var parentNode = vnode;
  54316. while ((parentNode = parentNode.parent)) {
  54317. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  54318. extend(res, styleData);
  54319. }
  54320. }
  54321. return res
  54322. }
  54323. /* */
  54324. var cssVarRE = /^--/;
  54325. var importantRE = /\s*!important$/;
  54326. var setProp = function (el, name, val) {
  54327. /* istanbul ignore if */
  54328. if (cssVarRE.test(name)) {
  54329. el.style.setProperty(name, val);
  54330. } else if (importantRE.test(val)) {
  54331. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  54332. } else {
  54333. var normalizedName = normalize(name);
  54334. if (Array.isArray(val)) {
  54335. // Support values array created by autoprefixer, e.g.
  54336. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  54337. // Set them one by one, and the browser will only set those it can recognize
  54338. for (var i = 0, len = val.length; i < len; i++) {
  54339. el.style[normalizedName] = val[i];
  54340. }
  54341. } else {
  54342. el.style[normalizedName] = val;
  54343. }
  54344. }
  54345. };
  54346. var vendorNames = ['Webkit', 'Moz', 'ms'];
  54347. var emptyStyle;
  54348. var normalize = cached(function (prop) {
  54349. emptyStyle = emptyStyle || document.createElement('div').style;
  54350. prop = camelize(prop);
  54351. if (prop !== 'filter' && (prop in emptyStyle)) {
  54352. return prop
  54353. }
  54354. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  54355. for (var i = 0; i < vendorNames.length; i++) {
  54356. var name = vendorNames[i] + capName;
  54357. if (name in emptyStyle) {
  54358. return name
  54359. }
  54360. }
  54361. });
  54362. function updateStyle (oldVnode, vnode) {
  54363. var data = vnode.data;
  54364. var oldData = oldVnode.data;
  54365. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  54366. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  54367. ) {
  54368. return
  54369. }
  54370. var cur, name;
  54371. var el = vnode.elm;
  54372. var oldStaticStyle = oldData.staticStyle;
  54373. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  54374. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  54375. var oldStyle = oldStaticStyle || oldStyleBinding;
  54376. var style = normalizeStyleBinding(vnode.data.style) || {};
  54377. // store normalized style under a different key for next diff
  54378. // make sure to clone it if it's reactive, since the user likely wants
  54379. // to mutate it.
  54380. vnode.data.normalizedStyle = isDef(style.__ob__)
  54381. ? extend({}, style)
  54382. : style;
  54383. var newStyle = getStyle(vnode, true);
  54384. for (name in oldStyle) {
  54385. if (isUndef(newStyle[name])) {
  54386. setProp(el, name, '');
  54387. }
  54388. }
  54389. for (name in newStyle) {
  54390. cur = newStyle[name];
  54391. if (cur !== oldStyle[name]) {
  54392. // ie9 setting to null has no effect, must use empty string
  54393. setProp(el, name, cur == null ? '' : cur);
  54394. }
  54395. }
  54396. }
  54397. var style = {
  54398. create: updateStyle,
  54399. update: updateStyle
  54400. };
  54401. /* */
  54402. var whitespaceRE = /\s+/;
  54403. /**
  54404. * Add class with compatibility for SVG since classList is not supported on
  54405. * SVG elements in IE
  54406. */
  54407. function addClass (el, cls) {
  54408. /* istanbul ignore if */
  54409. if (!cls || !(cls = cls.trim())) {
  54410. return
  54411. }
  54412. /* istanbul ignore else */
  54413. if (el.classList) {
  54414. if (cls.indexOf(' ') > -1) {
  54415. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  54416. } else {
  54417. el.classList.add(cls);
  54418. }
  54419. } else {
  54420. var cur = " " + (el.getAttribute('class') || '') + " ";
  54421. if (cur.indexOf(' ' + cls + ' ') < 0) {
  54422. el.setAttribute('class', (cur + cls).trim());
  54423. }
  54424. }
  54425. }
  54426. /**
  54427. * Remove class with compatibility for SVG since classList is not supported on
  54428. * SVG elements in IE
  54429. */
  54430. function removeClass (el, cls) {
  54431. /* istanbul ignore if */
  54432. if (!cls || !(cls = cls.trim())) {
  54433. return
  54434. }
  54435. /* istanbul ignore else */
  54436. if (el.classList) {
  54437. if (cls.indexOf(' ') > -1) {
  54438. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  54439. } else {
  54440. el.classList.remove(cls);
  54441. }
  54442. if (!el.classList.length) {
  54443. el.removeAttribute('class');
  54444. }
  54445. } else {
  54446. var cur = " " + (el.getAttribute('class') || '') + " ";
  54447. var tar = ' ' + cls + ' ';
  54448. while (cur.indexOf(tar) >= 0) {
  54449. cur = cur.replace(tar, ' ');
  54450. }
  54451. cur = cur.trim();
  54452. if (cur) {
  54453. el.setAttribute('class', cur);
  54454. } else {
  54455. el.removeAttribute('class');
  54456. }
  54457. }
  54458. }
  54459. /* */
  54460. function resolveTransition (def$$1) {
  54461. if (!def$$1) {
  54462. return
  54463. }
  54464. /* istanbul ignore else */
  54465. if (typeof def$$1 === 'object') {
  54466. var res = {};
  54467. if (def$$1.css !== false) {
  54468. extend(res, autoCssTransition(def$$1.name || 'v'));
  54469. }
  54470. extend(res, def$$1);
  54471. return res
  54472. } else if (typeof def$$1 === 'string') {
  54473. return autoCssTransition(def$$1)
  54474. }
  54475. }
  54476. var autoCssTransition = cached(function (name) {
  54477. return {
  54478. enterClass: (name + "-enter"),
  54479. enterToClass: (name + "-enter-to"),
  54480. enterActiveClass: (name + "-enter-active"),
  54481. leaveClass: (name + "-leave"),
  54482. leaveToClass: (name + "-leave-to"),
  54483. leaveActiveClass: (name + "-leave-active")
  54484. }
  54485. });
  54486. var hasTransition = inBrowser && !isIE9;
  54487. var TRANSITION = 'transition';
  54488. var ANIMATION = 'animation';
  54489. // Transition property/event sniffing
  54490. var transitionProp = 'transition';
  54491. var transitionEndEvent = 'transitionend';
  54492. var animationProp = 'animation';
  54493. var animationEndEvent = 'animationend';
  54494. if (hasTransition) {
  54495. /* istanbul ignore if */
  54496. if (window.ontransitionend === undefined &&
  54497. window.onwebkittransitionend !== undefined
  54498. ) {
  54499. transitionProp = 'WebkitTransition';
  54500. transitionEndEvent = 'webkitTransitionEnd';
  54501. }
  54502. if (window.onanimationend === undefined &&
  54503. window.onwebkitanimationend !== undefined
  54504. ) {
  54505. animationProp = 'WebkitAnimation';
  54506. animationEndEvent = 'webkitAnimationEnd';
  54507. }
  54508. }
  54509. // binding to window is necessary to make hot reload work in IE in strict mode
  54510. var raf = inBrowser
  54511. ? window.requestAnimationFrame
  54512. ? window.requestAnimationFrame.bind(window)
  54513. : setTimeout
  54514. : /* istanbul ignore next */ function (fn) { return fn(); };
  54515. function nextFrame (fn) {
  54516. raf(function () {
  54517. raf(fn);
  54518. });
  54519. }
  54520. function addTransitionClass (el, cls) {
  54521. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  54522. if (transitionClasses.indexOf(cls) < 0) {
  54523. transitionClasses.push(cls);
  54524. addClass(el, cls);
  54525. }
  54526. }
  54527. function removeTransitionClass (el, cls) {
  54528. if (el._transitionClasses) {
  54529. remove(el._transitionClasses, cls);
  54530. }
  54531. removeClass(el, cls);
  54532. }
  54533. function whenTransitionEnds (
  54534. el,
  54535. expectedType,
  54536. cb
  54537. ) {
  54538. var ref = getTransitionInfo(el, expectedType);
  54539. var type = ref.type;
  54540. var timeout = ref.timeout;
  54541. var propCount = ref.propCount;
  54542. if (!type) { return cb() }
  54543. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  54544. var ended = 0;
  54545. var end = function () {
  54546. el.removeEventListener(event, onEnd);
  54547. cb();
  54548. };
  54549. var onEnd = function (e) {
  54550. if (e.target === el) {
  54551. if (++ended >= propCount) {
  54552. end();
  54553. }
  54554. }
  54555. };
  54556. setTimeout(function () {
  54557. if (ended < propCount) {
  54558. end();
  54559. }
  54560. }, timeout + 1);
  54561. el.addEventListener(event, onEnd);
  54562. }
  54563. var transformRE = /\b(transform|all)(,|$)/;
  54564. function getTransitionInfo (el, expectedType) {
  54565. var styles = window.getComputedStyle(el);
  54566. // JSDOM may return undefined for transition properties
  54567. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  54568. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  54569. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  54570. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  54571. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  54572. var animationTimeout = getTimeout(animationDelays, animationDurations);
  54573. var type;
  54574. var timeout = 0;
  54575. var propCount = 0;
  54576. /* istanbul ignore if */
  54577. if (expectedType === TRANSITION) {
  54578. if (transitionTimeout > 0) {
  54579. type = TRANSITION;
  54580. timeout = transitionTimeout;
  54581. propCount = transitionDurations.length;
  54582. }
  54583. } else if (expectedType === ANIMATION) {
  54584. if (animationTimeout > 0) {
  54585. type = ANIMATION;
  54586. timeout = animationTimeout;
  54587. propCount = animationDurations.length;
  54588. }
  54589. } else {
  54590. timeout = Math.max(transitionTimeout, animationTimeout);
  54591. type = timeout > 0
  54592. ? transitionTimeout > animationTimeout
  54593. ? TRANSITION
  54594. : ANIMATION
  54595. : null;
  54596. propCount = type
  54597. ? type === TRANSITION
  54598. ? transitionDurations.length
  54599. : animationDurations.length
  54600. : 0;
  54601. }
  54602. var hasTransform =
  54603. type === TRANSITION &&
  54604. transformRE.test(styles[transitionProp + 'Property']);
  54605. return {
  54606. type: type,
  54607. timeout: timeout,
  54608. propCount: propCount,
  54609. hasTransform: hasTransform
  54610. }
  54611. }
  54612. function getTimeout (delays, durations) {
  54613. /* istanbul ignore next */
  54614. while (delays.length < durations.length) {
  54615. delays = delays.concat(delays);
  54616. }
  54617. return Math.max.apply(null, durations.map(function (d, i) {
  54618. return toMs(d) + toMs(delays[i])
  54619. }))
  54620. }
  54621. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  54622. // in a locale-dependent way, using a comma instead of a dot.
  54623. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  54624. // as a floor function) causing unexpected behaviors
  54625. function toMs (s) {
  54626. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  54627. }
  54628. /* */
  54629. function enter (vnode, toggleDisplay) {
  54630. var el = vnode.elm;
  54631. // call leave callback now
  54632. if (isDef(el._leaveCb)) {
  54633. el._leaveCb.cancelled = true;
  54634. el._leaveCb();
  54635. }
  54636. var data = resolveTransition(vnode.data.transition);
  54637. if (isUndef(data)) {
  54638. return
  54639. }
  54640. /* istanbul ignore if */
  54641. if (isDef(el._enterCb) || el.nodeType !== 1) {
  54642. return
  54643. }
  54644. var css = data.css;
  54645. var type = data.type;
  54646. var enterClass = data.enterClass;
  54647. var enterToClass = data.enterToClass;
  54648. var enterActiveClass = data.enterActiveClass;
  54649. var appearClass = data.appearClass;
  54650. var appearToClass = data.appearToClass;
  54651. var appearActiveClass = data.appearActiveClass;
  54652. var beforeEnter = data.beforeEnter;
  54653. var enter = data.enter;
  54654. var afterEnter = data.afterEnter;
  54655. var enterCancelled = data.enterCancelled;
  54656. var beforeAppear = data.beforeAppear;
  54657. var appear = data.appear;
  54658. var afterAppear = data.afterAppear;
  54659. var appearCancelled = data.appearCancelled;
  54660. var duration = data.duration;
  54661. // activeInstance will always be the <transition> component managing this
  54662. // transition. One edge case to check is when the <transition> is placed
  54663. // as the root node of a child component. In that case we need to check
  54664. // <transition>'s parent for appear check.
  54665. var context = activeInstance;
  54666. var transitionNode = activeInstance.$vnode;
  54667. while (transitionNode && transitionNode.parent) {
  54668. context = transitionNode.context;
  54669. transitionNode = transitionNode.parent;
  54670. }
  54671. var isAppear = !context._isMounted || !vnode.isRootInsert;
  54672. if (isAppear && !appear && appear !== '') {
  54673. return
  54674. }
  54675. var startClass = isAppear && appearClass
  54676. ? appearClass
  54677. : enterClass;
  54678. var activeClass = isAppear && appearActiveClass
  54679. ? appearActiveClass
  54680. : enterActiveClass;
  54681. var toClass = isAppear && appearToClass
  54682. ? appearToClass
  54683. : enterToClass;
  54684. var beforeEnterHook = isAppear
  54685. ? (beforeAppear || beforeEnter)
  54686. : beforeEnter;
  54687. var enterHook = isAppear
  54688. ? (typeof appear === 'function' ? appear : enter)
  54689. : enter;
  54690. var afterEnterHook = isAppear
  54691. ? (afterAppear || afterEnter)
  54692. : afterEnter;
  54693. var enterCancelledHook = isAppear
  54694. ? (appearCancelled || enterCancelled)
  54695. : enterCancelled;
  54696. var explicitEnterDuration = toNumber(
  54697. isObject(duration)
  54698. ? duration.enter
  54699. : duration
  54700. );
  54701. if (explicitEnterDuration != null) {
  54702. checkDuration(explicitEnterDuration, 'enter', vnode);
  54703. }
  54704. var expectsCSS = css !== false && !isIE9;
  54705. var userWantsControl = getHookArgumentsLength(enterHook);
  54706. var cb = el._enterCb = once(function () {
  54707. if (expectsCSS) {
  54708. removeTransitionClass(el, toClass);
  54709. removeTransitionClass(el, activeClass);
  54710. }
  54711. if (cb.cancelled) {
  54712. if (expectsCSS) {
  54713. removeTransitionClass(el, startClass);
  54714. }
  54715. enterCancelledHook && enterCancelledHook(el);
  54716. } else {
  54717. afterEnterHook && afterEnterHook(el);
  54718. }
  54719. el._enterCb = null;
  54720. });
  54721. if (!vnode.data.show) {
  54722. // remove pending leave element on enter by injecting an insert hook
  54723. mergeVNodeHook(vnode, 'insert', function () {
  54724. var parent = el.parentNode;
  54725. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  54726. if (pendingNode &&
  54727. pendingNode.tag === vnode.tag &&
  54728. pendingNode.elm._leaveCb
  54729. ) {
  54730. pendingNode.elm._leaveCb();
  54731. }
  54732. enterHook && enterHook(el, cb);
  54733. });
  54734. }
  54735. // start enter transition
  54736. beforeEnterHook && beforeEnterHook(el);
  54737. if (expectsCSS) {
  54738. addTransitionClass(el, startClass);
  54739. addTransitionClass(el, activeClass);
  54740. nextFrame(function () {
  54741. removeTransitionClass(el, startClass);
  54742. if (!cb.cancelled) {
  54743. addTransitionClass(el, toClass);
  54744. if (!userWantsControl) {
  54745. if (isValidDuration(explicitEnterDuration)) {
  54746. setTimeout(cb, explicitEnterDuration);
  54747. } else {
  54748. whenTransitionEnds(el, type, cb);
  54749. }
  54750. }
  54751. }
  54752. });
  54753. }
  54754. if (vnode.data.show) {
  54755. toggleDisplay && toggleDisplay();
  54756. enterHook && enterHook(el, cb);
  54757. }
  54758. if (!expectsCSS && !userWantsControl) {
  54759. cb();
  54760. }
  54761. }
  54762. function leave (vnode, rm) {
  54763. var el = vnode.elm;
  54764. // call enter callback now
  54765. if (isDef(el._enterCb)) {
  54766. el._enterCb.cancelled = true;
  54767. el._enterCb();
  54768. }
  54769. var data = resolveTransition(vnode.data.transition);
  54770. if (isUndef(data) || el.nodeType !== 1) {
  54771. return rm()
  54772. }
  54773. /* istanbul ignore if */
  54774. if (isDef(el._leaveCb)) {
  54775. return
  54776. }
  54777. var css = data.css;
  54778. var type = data.type;
  54779. var leaveClass = data.leaveClass;
  54780. var leaveToClass = data.leaveToClass;
  54781. var leaveActiveClass = data.leaveActiveClass;
  54782. var beforeLeave = data.beforeLeave;
  54783. var leave = data.leave;
  54784. var afterLeave = data.afterLeave;
  54785. var leaveCancelled = data.leaveCancelled;
  54786. var delayLeave = data.delayLeave;
  54787. var duration = data.duration;
  54788. var expectsCSS = css !== false && !isIE9;
  54789. var userWantsControl = getHookArgumentsLength(leave);
  54790. var explicitLeaveDuration = toNumber(
  54791. isObject(duration)
  54792. ? duration.leave
  54793. : duration
  54794. );
  54795. if (isDef(explicitLeaveDuration)) {
  54796. checkDuration(explicitLeaveDuration, 'leave', vnode);
  54797. }
  54798. var cb = el._leaveCb = once(function () {
  54799. if (el.parentNode && el.parentNode._pending) {
  54800. el.parentNode._pending[vnode.key] = null;
  54801. }
  54802. if (expectsCSS) {
  54803. removeTransitionClass(el, leaveToClass);
  54804. removeTransitionClass(el, leaveActiveClass);
  54805. }
  54806. if (cb.cancelled) {
  54807. if (expectsCSS) {
  54808. removeTransitionClass(el, leaveClass);
  54809. }
  54810. leaveCancelled && leaveCancelled(el);
  54811. } else {
  54812. rm();
  54813. afterLeave && afterLeave(el);
  54814. }
  54815. el._leaveCb = null;
  54816. });
  54817. if (delayLeave) {
  54818. delayLeave(performLeave);
  54819. } else {
  54820. performLeave();
  54821. }
  54822. function performLeave () {
  54823. // the delayed leave may have already been cancelled
  54824. if (cb.cancelled) {
  54825. return
  54826. }
  54827. // record leaving element
  54828. if (!vnode.data.show && el.parentNode) {
  54829. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  54830. }
  54831. beforeLeave && beforeLeave(el);
  54832. if (expectsCSS) {
  54833. addTransitionClass(el, leaveClass);
  54834. addTransitionClass(el, leaveActiveClass);
  54835. nextFrame(function () {
  54836. removeTransitionClass(el, leaveClass);
  54837. if (!cb.cancelled) {
  54838. addTransitionClass(el, leaveToClass);
  54839. if (!userWantsControl) {
  54840. if (isValidDuration(explicitLeaveDuration)) {
  54841. setTimeout(cb, explicitLeaveDuration);
  54842. } else {
  54843. whenTransitionEnds(el, type, cb);
  54844. }
  54845. }
  54846. }
  54847. });
  54848. }
  54849. leave && leave(el, cb);
  54850. if (!expectsCSS && !userWantsControl) {
  54851. cb();
  54852. }
  54853. }
  54854. }
  54855. // only used in dev mode
  54856. function checkDuration (val, name, vnode) {
  54857. if (typeof val !== 'number') {
  54858. warn(
  54859. "<transition> explicit " + name + " duration is not a valid number - " +
  54860. "got " + (JSON.stringify(val)) + ".",
  54861. vnode.context
  54862. );
  54863. } else if (isNaN(val)) {
  54864. warn(
  54865. "<transition> explicit " + name + " duration is NaN - " +
  54866. 'the duration expression might be incorrect.',
  54867. vnode.context
  54868. );
  54869. }
  54870. }
  54871. function isValidDuration (val) {
  54872. return typeof val === 'number' && !isNaN(val)
  54873. }
  54874. /**
  54875. * Normalize a transition hook's argument length. The hook may be:
  54876. * - a merged hook (invoker) with the original in .fns
  54877. * - a wrapped component method (check ._length)
  54878. * - a plain function (.length)
  54879. */
  54880. function getHookArgumentsLength (fn) {
  54881. if (isUndef(fn)) {
  54882. return false
  54883. }
  54884. var invokerFns = fn.fns;
  54885. if (isDef(invokerFns)) {
  54886. // invoker
  54887. return getHookArgumentsLength(
  54888. Array.isArray(invokerFns)
  54889. ? invokerFns[0]
  54890. : invokerFns
  54891. )
  54892. } else {
  54893. return (fn._length || fn.length) > 1
  54894. }
  54895. }
  54896. function _enter (_, vnode) {
  54897. if (vnode.data.show !== true) {
  54898. enter(vnode);
  54899. }
  54900. }
  54901. var transition = inBrowser ? {
  54902. create: _enter,
  54903. activate: _enter,
  54904. remove: function remove$$1 (vnode, rm) {
  54905. /* istanbul ignore else */
  54906. if (vnode.data.show !== true) {
  54907. leave(vnode, rm);
  54908. } else {
  54909. rm();
  54910. }
  54911. }
  54912. } : {};
  54913. var platformModules = [
  54914. attrs,
  54915. klass,
  54916. events,
  54917. domProps,
  54918. style,
  54919. transition
  54920. ];
  54921. /* */
  54922. // the directive module should be applied last, after all
  54923. // built-in modules have been applied.
  54924. var modules = platformModules.concat(baseModules);
  54925. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  54926. /**
  54927. * Not type checking this file because flow doesn't like attaching
  54928. * properties to Elements.
  54929. */
  54930. /* istanbul ignore if */
  54931. if (isIE9) {
  54932. // http://www.matts411.com/post/internet-explorer-9-oninput/
  54933. document.addEventListener('selectionchange', function () {
  54934. var el = document.activeElement;
  54935. if (el && el.vmodel) {
  54936. trigger(el, 'input');
  54937. }
  54938. });
  54939. }
  54940. var directive = {
  54941. inserted: function inserted (el, binding, vnode, oldVnode) {
  54942. if (vnode.tag === 'select') {
  54943. // #6903
  54944. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  54945. mergeVNodeHook(vnode, 'postpatch', function () {
  54946. directive.componentUpdated(el, binding, vnode);
  54947. });
  54948. } else {
  54949. setSelected(el, binding, vnode.context);
  54950. }
  54951. el._vOptions = [].map.call(el.options, getValue);
  54952. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  54953. el._vModifiers = binding.modifiers;
  54954. if (!binding.modifiers.lazy) {
  54955. el.addEventListener('compositionstart', onCompositionStart);
  54956. el.addEventListener('compositionend', onCompositionEnd);
  54957. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  54958. // switching focus before confirming composition choice
  54959. // this also fixes the issue where some browsers e.g. iOS Chrome
  54960. // fires "change" instead of "input" on autocomplete.
  54961. el.addEventListener('change', onCompositionEnd);
  54962. /* istanbul ignore if */
  54963. if (isIE9) {
  54964. el.vmodel = true;
  54965. }
  54966. }
  54967. }
  54968. },
  54969. componentUpdated: function componentUpdated (el, binding, vnode) {
  54970. if (vnode.tag === 'select') {
  54971. setSelected(el, binding, vnode.context);
  54972. // in case the options rendered by v-for have changed,
  54973. // it's possible that the value is out-of-sync with the rendered options.
  54974. // detect such cases and filter out values that no longer has a matching
  54975. // option in the DOM.
  54976. var prevOptions = el._vOptions;
  54977. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  54978. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  54979. // trigger change event if
  54980. // no matching option found for at least one value
  54981. var needReset = el.multiple
  54982. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  54983. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  54984. if (needReset) {
  54985. trigger(el, 'change');
  54986. }
  54987. }
  54988. }
  54989. }
  54990. };
  54991. function setSelected (el, binding, vm) {
  54992. actuallySetSelected(el, binding, vm);
  54993. /* istanbul ignore if */
  54994. if (isIE || isEdge) {
  54995. setTimeout(function () {
  54996. actuallySetSelected(el, binding, vm);
  54997. }, 0);
  54998. }
  54999. }
  55000. function actuallySetSelected (el, binding, vm) {
  55001. var value = binding.value;
  55002. var isMultiple = el.multiple;
  55003. if (isMultiple && !Array.isArray(value)) {
  55004. warn(
  55005. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  55006. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  55007. vm
  55008. );
  55009. return
  55010. }
  55011. var selected, option;
  55012. for (var i = 0, l = el.options.length; i < l; i++) {
  55013. option = el.options[i];
  55014. if (isMultiple) {
  55015. selected = looseIndexOf(value, getValue(option)) > -1;
  55016. if (option.selected !== selected) {
  55017. option.selected = selected;
  55018. }
  55019. } else {
  55020. if (looseEqual(getValue(option), value)) {
  55021. if (el.selectedIndex !== i) {
  55022. el.selectedIndex = i;
  55023. }
  55024. return
  55025. }
  55026. }
  55027. }
  55028. if (!isMultiple) {
  55029. el.selectedIndex = -1;
  55030. }
  55031. }
  55032. function hasNoMatchingOption (value, options) {
  55033. return options.every(function (o) { return !looseEqual(o, value); })
  55034. }
  55035. function getValue (option) {
  55036. return '_value' in option
  55037. ? option._value
  55038. : option.value
  55039. }
  55040. function onCompositionStart (e) {
  55041. e.target.composing = true;
  55042. }
  55043. function onCompositionEnd (e) {
  55044. // prevent triggering an input event for no reason
  55045. if (!e.target.composing) { return }
  55046. e.target.composing = false;
  55047. trigger(e.target, 'input');
  55048. }
  55049. function trigger (el, type) {
  55050. var e = document.createEvent('HTMLEvents');
  55051. e.initEvent(type, true, true);
  55052. el.dispatchEvent(e);
  55053. }
  55054. /* */
  55055. // recursively search for possible transition defined inside the component root
  55056. function locateNode (vnode) {
  55057. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  55058. ? locateNode(vnode.componentInstance._vnode)
  55059. : vnode
  55060. }
  55061. var show = {
  55062. bind: function bind (el, ref, vnode) {
  55063. var value = ref.value;
  55064. vnode = locateNode(vnode);
  55065. var transition$$1 = vnode.data && vnode.data.transition;
  55066. var originalDisplay = el.__vOriginalDisplay =
  55067. el.style.display === 'none' ? '' : el.style.display;
  55068. if (value && transition$$1) {
  55069. vnode.data.show = true;
  55070. enter(vnode, function () {
  55071. el.style.display = originalDisplay;
  55072. });
  55073. } else {
  55074. el.style.display = value ? originalDisplay : 'none';
  55075. }
  55076. },
  55077. update: function update (el, ref, vnode) {
  55078. var value = ref.value;
  55079. var oldValue = ref.oldValue;
  55080. /* istanbul ignore if */
  55081. if (!value === !oldValue) { return }
  55082. vnode = locateNode(vnode);
  55083. var transition$$1 = vnode.data && vnode.data.transition;
  55084. if (transition$$1) {
  55085. vnode.data.show = true;
  55086. if (value) {
  55087. enter(vnode, function () {
  55088. el.style.display = el.__vOriginalDisplay;
  55089. });
  55090. } else {
  55091. leave(vnode, function () {
  55092. el.style.display = 'none';
  55093. });
  55094. }
  55095. } else {
  55096. el.style.display = value ? el.__vOriginalDisplay : 'none';
  55097. }
  55098. },
  55099. unbind: function unbind (
  55100. el,
  55101. binding,
  55102. vnode,
  55103. oldVnode,
  55104. isDestroy
  55105. ) {
  55106. if (!isDestroy) {
  55107. el.style.display = el.__vOriginalDisplay;
  55108. }
  55109. }
  55110. };
  55111. var platformDirectives = {
  55112. model: directive,
  55113. show: show
  55114. };
  55115. /* */
  55116. var transitionProps = {
  55117. name: String,
  55118. appear: Boolean,
  55119. css: Boolean,
  55120. mode: String,
  55121. type: String,
  55122. enterClass: String,
  55123. leaveClass: String,
  55124. enterToClass: String,
  55125. leaveToClass: String,
  55126. enterActiveClass: String,
  55127. leaveActiveClass: String,
  55128. appearClass: String,
  55129. appearActiveClass: String,
  55130. appearToClass: String,
  55131. duration: [Number, String, Object]
  55132. };
  55133. // in case the child is also an abstract component, e.g. <keep-alive>
  55134. // we want to recursively retrieve the real component to be rendered
  55135. function getRealChild (vnode) {
  55136. var compOptions = vnode && vnode.componentOptions;
  55137. if (compOptions && compOptions.Ctor.options.abstract) {
  55138. return getRealChild(getFirstComponentChild(compOptions.children))
  55139. } else {
  55140. return vnode
  55141. }
  55142. }
  55143. function extractTransitionData (comp) {
  55144. var data = {};
  55145. var options = comp.$options;
  55146. // props
  55147. for (var key in options.propsData) {
  55148. data[key] = comp[key];
  55149. }
  55150. // events.
  55151. // extract listeners and pass them directly to the transition methods
  55152. var listeners = options._parentListeners;
  55153. for (var key$1 in listeners) {
  55154. data[camelize(key$1)] = listeners[key$1];
  55155. }
  55156. return data
  55157. }
  55158. function placeholder (h, rawChild) {
  55159. if (/\d-keep-alive$/.test(rawChild.tag)) {
  55160. return h('keep-alive', {
  55161. props: rawChild.componentOptions.propsData
  55162. })
  55163. }
  55164. }
  55165. function hasParentTransition (vnode) {
  55166. while ((vnode = vnode.parent)) {
  55167. if (vnode.data.transition) {
  55168. return true
  55169. }
  55170. }
  55171. }
  55172. function isSameChild (child, oldChild) {
  55173. return oldChild.key === child.key && oldChild.tag === child.tag
  55174. }
  55175. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  55176. var isVShowDirective = function (d) { return d.name === 'show'; };
  55177. var Transition = {
  55178. name: 'transition',
  55179. props: transitionProps,
  55180. abstract: true,
  55181. render: function render (h) {
  55182. var this$1 = this;
  55183. var children = this.$slots.default;
  55184. if (!children) {
  55185. return
  55186. }
  55187. // filter out text nodes (possible whitespaces)
  55188. children = children.filter(isNotTextNode);
  55189. /* istanbul ignore if */
  55190. if (!children.length) {
  55191. return
  55192. }
  55193. // warn multiple elements
  55194. if (children.length > 1) {
  55195. warn(
  55196. '<transition> can only be used on a single element. Use ' +
  55197. '<transition-group> for lists.',
  55198. this.$parent
  55199. );
  55200. }
  55201. var mode = this.mode;
  55202. // warn invalid mode
  55203. if (mode && mode !== 'in-out' && mode !== 'out-in'
  55204. ) {
  55205. warn(
  55206. 'invalid <transition> mode: ' + mode,
  55207. this.$parent
  55208. );
  55209. }
  55210. var rawChild = children[0];
  55211. // if this is a component root node and the component's
  55212. // parent container node also has transition, skip.
  55213. if (hasParentTransition(this.$vnode)) {
  55214. return rawChild
  55215. }
  55216. // apply transition data to child
  55217. // use getRealChild() to ignore abstract components e.g. keep-alive
  55218. var child = getRealChild(rawChild);
  55219. /* istanbul ignore if */
  55220. if (!child) {
  55221. return rawChild
  55222. }
  55223. if (this._leaving) {
  55224. return placeholder(h, rawChild)
  55225. }
  55226. // ensure a key that is unique to the vnode type and to this transition
  55227. // component instance. This key will be used to remove pending leaving nodes
  55228. // during entering.
  55229. var id = "__transition-" + (this._uid) + "-";
  55230. child.key = child.key == null
  55231. ? child.isComment
  55232. ? id + 'comment'
  55233. : id + child.tag
  55234. : isPrimitive(child.key)
  55235. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  55236. : child.key;
  55237. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  55238. var oldRawChild = this._vnode;
  55239. var oldChild = getRealChild(oldRawChild);
  55240. // mark v-show
  55241. // so that the transition module can hand over the control to the directive
  55242. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  55243. child.data.show = true;
  55244. }
  55245. if (
  55246. oldChild &&
  55247. oldChild.data &&
  55248. !isSameChild(child, oldChild) &&
  55249. !isAsyncPlaceholder(oldChild) &&
  55250. // #6687 component root is a comment node
  55251. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  55252. ) {
  55253. // replace old child transition data with fresh one
  55254. // important for dynamic transitions!
  55255. var oldData = oldChild.data.transition = extend({}, data);
  55256. // handle transition mode
  55257. if (mode === 'out-in') {
  55258. // return placeholder node and queue update when leave finishes
  55259. this._leaving = true;
  55260. mergeVNodeHook(oldData, 'afterLeave', function () {
  55261. this$1._leaving = false;
  55262. this$1.$forceUpdate();
  55263. });
  55264. return placeholder(h, rawChild)
  55265. } else if (mode === 'in-out') {
  55266. if (isAsyncPlaceholder(child)) {
  55267. return oldRawChild
  55268. }
  55269. var delayedLeave;
  55270. var performLeave = function () { delayedLeave(); };
  55271. mergeVNodeHook(data, 'afterEnter', performLeave);
  55272. mergeVNodeHook(data, 'enterCancelled', performLeave);
  55273. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  55274. }
  55275. }
  55276. return rawChild
  55277. }
  55278. };
  55279. /* */
  55280. var props = extend({
  55281. tag: String,
  55282. moveClass: String
  55283. }, transitionProps);
  55284. delete props.mode;
  55285. var TransitionGroup = {
  55286. props: props,
  55287. beforeMount: function beforeMount () {
  55288. var this$1 = this;
  55289. var update = this._update;
  55290. this._update = function (vnode, hydrating) {
  55291. var restoreActiveInstance = setActiveInstance(this$1);
  55292. // force removing pass
  55293. this$1.__patch__(
  55294. this$1._vnode,
  55295. this$1.kept,
  55296. false, // hydrating
  55297. true // removeOnly (!important, avoids unnecessary moves)
  55298. );
  55299. this$1._vnode = this$1.kept;
  55300. restoreActiveInstance();
  55301. update.call(this$1, vnode, hydrating);
  55302. };
  55303. },
  55304. render: function render (h) {
  55305. var tag = this.tag || this.$vnode.data.tag || 'span';
  55306. var map = Object.create(null);
  55307. var prevChildren = this.prevChildren = this.children;
  55308. var rawChildren = this.$slots.default || [];
  55309. var children = this.children = [];
  55310. var transitionData = extractTransitionData(this);
  55311. for (var i = 0; i < rawChildren.length; i++) {
  55312. var c = rawChildren[i];
  55313. if (c.tag) {
  55314. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  55315. children.push(c);
  55316. map[c.key] = c
  55317. ;(c.data || (c.data = {})).transition = transitionData;
  55318. } else {
  55319. var opts = c.componentOptions;
  55320. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  55321. warn(("<transition-group> children must be keyed: <" + name + ">"));
  55322. }
  55323. }
  55324. }
  55325. if (prevChildren) {
  55326. var kept = [];
  55327. var removed = [];
  55328. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  55329. var c$1 = prevChildren[i$1];
  55330. c$1.data.transition = transitionData;
  55331. c$1.data.pos = c$1.elm.getBoundingClientRect();
  55332. if (map[c$1.key]) {
  55333. kept.push(c$1);
  55334. } else {
  55335. removed.push(c$1);
  55336. }
  55337. }
  55338. this.kept = h(tag, null, kept);
  55339. this.removed = removed;
  55340. }
  55341. return h(tag, null, children)
  55342. },
  55343. updated: function updated () {
  55344. var children = this.prevChildren;
  55345. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  55346. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  55347. return
  55348. }
  55349. // we divide the work into three loops to avoid mixing DOM reads and writes
  55350. // in each iteration - which helps prevent layout thrashing.
  55351. children.forEach(callPendingCbs);
  55352. children.forEach(recordPosition);
  55353. children.forEach(applyTranslation);
  55354. // force reflow to put everything in position
  55355. // assign to this to avoid being removed in tree-shaking
  55356. // $flow-disable-line
  55357. this._reflow = document.body.offsetHeight;
  55358. children.forEach(function (c) {
  55359. if (c.data.moved) {
  55360. var el = c.elm;
  55361. var s = el.style;
  55362. addTransitionClass(el, moveClass);
  55363. s.transform = s.WebkitTransform = s.transitionDuration = '';
  55364. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  55365. if (e && e.target !== el) {
  55366. return
  55367. }
  55368. if (!e || /transform$/.test(e.propertyName)) {
  55369. el.removeEventListener(transitionEndEvent, cb);
  55370. el._moveCb = null;
  55371. removeTransitionClass(el, moveClass);
  55372. }
  55373. });
  55374. }
  55375. });
  55376. },
  55377. methods: {
  55378. hasMove: function hasMove (el, moveClass) {
  55379. /* istanbul ignore if */
  55380. if (!hasTransition) {
  55381. return false
  55382. }
  55383. /* istanbul ignore if */
  55384. if (this._hasMove) {
  55385. return this._hasMove
  55386. }
  55387. // Detect whether an element with the move class applied has
  55388. // CSS transitions. Since the element may be inside an entering
  55389. // transition at this very moment, we make a clone of it and remove
  55390. // all other transition classes applied to ensure only the move class
  55391. // is applied.
  55392. var clone = el.cloneNode();
  55393. if (el._transitionClasses) {
  55394. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  55395. }
  55396. addClass(clone, moveClass);
  55397. clone.style.display = 'none';
  55398. this.$el.appendChild(clone);
  55399. var info = getTransitionInfo(clone);
  55400. this.$el.removeChild(clone);
  55401. return (this._hasMove = info.hasTransform)
  55402. }
  55403. }
  55404. };
  55405. function callPendingCbs (c) {
  55406. /* istanbul ignore if */
  55407. if (c.elm._moveCb) {
  55408. c.elm._moveCb();
  55409. }
  55410. /* istanbul ignore if */
  55411. if (c.elm._enterCb) {
  55412. c.elm._enterCb();
  55413. }
  55414. }
  55415. function recordPosition (c) {
  55416. c.data.newPos = c.elm.getBoundingClientRect();
  55417. }
  55418. function applyTranslation (c) {
  55419. var oldPos = c.data.pos;
  55420. var newPos = c.data.newPos;
  55421. var dx = oldPos.left - newPos.left;
  55422. var dy = oldPos.top - newPos.top;
  55423. if (dx || dy) {
  55424. c.data.moved = true;
  55425. var s = c.elm.style;
  55426. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  55427. s.transitionDuration = '0s';
  55428. }
  55429. }
  55430. var platformComponents = {
  55431. Transition: Transition,
  55432. TransitionGroup: TransitionGroup
  55433. };
  55434. /* */
  55435. // install platform specific utils
  55436. Vue.config.mustUseProp = mustUseProp;
  55437. Vue.config.isReservedTag = isReservedTag;
  55438. Vue.config.isReservedAttr = isReservedAttr;
  55439. Vue.config.getTagNamespace = getTagNamespace;
  55440. Vue.config.isUnknownElement = isUnknownElement;
  55441. // install platform runtime directives & components
  55442. extend(Vue.options.directives, platformDirectives);
  55443. extend(Vue.options.components, platformComponents);
  55444. // install platform patch function
  55445. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  55446. // public mount method
  55447. Vue.prototype.$mount = function (
  55448. el,
  55449. hydrating
  55450. ) {
  55451. el = el && inBrowser ? query(el) : undefined;
  55452. return mountComponent(this, el, hydrating)
  55453. };
  55454. // devtools global hook
  55455. /* istanbul ignore next */
  55456. if (inBrowser) {
  55457. setTimeout(function () {
  55458. if (config.devtools) {
  55459. if (devtools) {
  55460. devtools.emit('init', Vue);
  55461. } else {
  55462. console[console.info ? 'info' : 'log'](
  55463. 'Download the Vue Devtools extension for a better development experience:\n' +
  55464. 'https://github.com/vuejs/vue-devtools'
  55465. );
  55466. }
  55467. }
  55468. if (config.productionTip !== false &&
  55469. typeof console !== 'undefined'
  55470. ) {
  55471. console[console.info ? 'info' : 'log'](
  55472. "You are running Vue in development mode.\n" +
  55473. "Make sure to turn on production mode when deploying for production.\n" +
  55474. "See more tips at https://vuejs.org/guide/deployment.html"
  55475. );
  55476. }
  55477. }, 0);
  55478. }
  55479. /* */
  55480. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  55481. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  55482. var buildRegex = cached(function (delimiters) {
  55483. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  55484. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  55485. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  55486. });
  55487. function parseText (
  55488. text,
  55489. delimiters
  55490. ) {
  55491. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  55492. if (!tagRE.test(text)) {
  55493. return
  55494. }
  55495. var tokens = [];
  55496. var rawTokens = [];
  55497. var lastIndex = tagRE.lastIndex = 0;
  55498. var match, index, tokenValue;
  55499. while ((match = tagRE.exec(text))) {
  55500. index = match.index;
  55501. // push text token
  55502. if (index > lastIndex) {
  55503. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  55504. tokens.push(JSON.stringify(tokenValue));
  55505. }
  55506. // tag token
  55507. var exp = parseFilters(match[1].trim());
  55508. tokens.push(("_s(" + exp + ")"));
  55509. rawTokens.push({ '@binding': exp });
  55510. lastIndex = index + match[0].length;
  55511. }
  55512. if (lastIndex < text.length) {
  55513. rawTokens.push(tokenValue = text.slice(lastIndex));
  55514. tokens.push(JSON.stringify(tokenValue));
  55515. }
  55516. return {
  55517. expression: tokens.join('+'),
  55518. tokens: rawTokens
  55519. }
  55520. }
  55521. /* */
  55522. function transformNode (el, options) {
  55523. var warn = options.warn || baseWarn;
  55524. var staticClass = getAndRemoveAttr(el, 'class');
  55525. if (staticClass) {
  55526. var res = parseText(staticClass, options.delimiters);
  55527. if (res) {
  55528. warn(
  55529. "class=\"" + staticClass + "\": " +
  55530. 'Interpolation inside attributes has been removed. ' +
  55531. 'Use v-bind or the colon shorthand instead. For example, ' +
  55532. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  55533. el.rawAttrsMap['class']
  55534. );
  55535. }
  55536. }
  55537. if (staticClass) {
  55538. el.staticClass = JSON.stringify(staticClass);
  55539. }
  55540. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  55541. if (classBinding) {
  55542. el.classBinding = classBinding;
  55543. }
  55544. }
  55545. function genData (el) {
  55546. var data = '';
  55547. if (el.staticClass) {
  55548. data += "staticClass:" + (el.staticClass) + ",";
  55549. }
  55550. if (el.classBinding) {
  55551. data += "class:" + (el.classBinding) + ",";
  55552. }
  55553. return data
  55554. }
  55555. var klass$1 = {
  55556. staticKeys: ['staticClass'],
  55557. transformNode: transformNode,
  55558. genData: genData
  55559. };
  55560. /* */
  55561. function transformNode$1 (el, options) {
  55562. var warn = options.warn || baseWarn;
  55563. var staticStyle = getAndRemoveAttr(el, 'style');
  55564. if (staticStyle) {
  55565. /* istanbul ignore if */
  55566. {
  55567. var res = parseText(staticStyle, options.delimiters);
  55568. if (res) {
  55569. warn(
  55570. "style=\"" + staticStyle + "\": " +
  55571. 'Interpolation inside attributes has been removed. ' +
  55572. 'Use v-bind or the colon shorthand instead. For example, ' +
  55573. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  55574. el.rawAttrsMap['style']
  55575. );
  55576. }
  55577. }
  55578. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  55579. }
  55580. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  55581. if (styleBinding) {
  55582. el.styleBinding = styleBinding;
  55583. }
  55584. }
  55585. function genData$1 (el) {
  55586. var data = '';
  55587. if (el.staticStyle) {
  55588. data += "staticStyle:" + (el.staticStyle) + ",";
  55589. }
  55590. if (el.styleBinding) {
  55591. data += "style:(" + (el.styleBinding) + "),";
  55592. }
  55593. return data
  55594. }
  55595. var style$1 = {
  55596. staticKeys: ['staticStyle'],
  55597. transformNode: transformNode$1,
  55598. genData: genData$1
  55599. };
  55600. /* */
  55601. var decoder;
  55602. var he = {
  55603. decode: function decode (html) {
  55604. decoder = decoder || document.createElement('div');
  55605. decoder.innerHTML = html;
  55606. return decoder.textContent
  55607. }
  55608. };
  55609. /* */
  55610. var isUnaryTag = makeMap(
  55611. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  55612. 'link,meta,param,source,track,wbr'
  55613. );
  55614. // Elements that you can, intentionally, leave open
  55615. // (and which close themselves)
  55616. var canBeLeftOpenTag = makeMap(
  55617. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  55618. );
  55619. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  55620. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  55621. var isNonPhrasingTag = makeMap(
  55622. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  55623. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  55624. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  55625. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  55626. 'title,tr,track'
  55627. );
  55628. /**
  55629. * Not type-checking this file because it's mostly vendor code.
  55630. */
  55631. // Regular Expressions for parsing tags and attributes
  55632. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  55633. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  55634. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  55635. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  55636. var startTagOpen = new RegExp(("^<" + qnameCapture));
  55637. var startTagClose = /^\s*(\/?)>/;
  55638. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  55639. var doctype = /^<!DOCTYPE [^>]+>/i;
  55640. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  55641. var comment = /^<!\--/;
  55642. var conditionalComment = /^<!\[/;
  55643. // Special Elements (can contain anything)
  55644. var isPlainTextElement = makeMap('script,style,textarea', true);
  55645. var reCache = {};
  55646. var decodingMap = {
  55647. '&lt;': '<',
  55648. '&gt;': '>',
  55649. '&quot;': '"',
  55650. '&amp;': '&',
  55651. '&#10;': '\n',
  55652. '&#9;': '\t',
  55653. '&#39;': "'"
  55654. };
  55655. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  55656. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  55657. // #5992
  55658. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  55659. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  55660. function decodeAttr (value, shouldDecodeNewlines) {
  55661. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  55662. return value.replace(re, function (match) { return decodingMap[match]; })
  55663. }
  55664. function parseHTML (html, options) {
  55665. var stack = [];
  55666. var expectHTML = options.expectHTML;
  55667. var isUnaryTag$$1 = options.isUnaryTag || no;
  55668. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  55669. var index = 0;
  55670. var last, lastTag;
  55671. while (html) {
  55672. last = html;
  55673. // Make sure we're not in a plaintext content element like script/style
  55674. if (!lastTag || !isPlainTextElement(lastTag)) {
  55675. var textEnd = html.indexOf('<');
  55676. if (textEnd === 0) {
  55677. // Comment:
  55678. if (comment.test(html)) {
  55679. var commentEnd = html.indexOf('-->');
  55680. if (commentEnd >= 0) {
  55681. if (options.shouldKeepComment) {
  55682. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  55683. }
  55684. advance(commentEnd + 3);
  55685. continue
  55686. }
  55687. }
  55688. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  55689. if (conditionalComment.test(html)) {
  55690. var conditionalEnd = html.indexOf(']>');
  55691. if (conditionalEnd >= 0) {
  55692. advance(conditionalEnd + 2);
  55693. continue
  55694. }
  55695. }
  55696. // Doctype:
  55697. var doctypeMatch = html.match(doctype);
  55698. if (doctypeMatch) {
  55699. advance(doctypeMatch[0].length);
  55700. continue
  55701. }
  55702. // End tag:
  55703. var endTagMatch = html.match(endTag);
  55704. if (endTagMatch) {
  55705. var curIndex = index;
  55706. advance(endTagMatch[0].length);
  55707. parseEndTag(endTagMatch[1], curIndex, index);
  55708. continue
  55709. }
  55710. // Start tag:
  55711. var startTagMatch = parseStartTag();
  55712. if (startTagMatch) {
  55713. handleStartTag(startTagMatch);
  55714. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  55715. advance(1);
  55716. }
  55717. continue
  55718. }
  55719. }
  55720. var text = (void 0), rest = (void 0), next = (void 0);
  55721. if (textEnd >= 0) {
  55722. rest = html.slice(textEnd);
  55723. while (
  55724. !endTag.test(rest) &&
  55725. !startTagOpen.test(rest) &&
  55726. !comment.test(rest) &&
  55727. !conditionalComment.test(rest)
  55728. ) {
  55729. // < in plain text, be forgiving and treat it as text
  55730. next = rest.indexOf('<', 1);
  55731. if (next < 0) { break }
  55732. textEnd += next;
  55733. rest = html.slice(textEnd);
  55734. }
  55735. text = html.substring(0, textEnd);
  55736. }
  55737. if (textEnd < 0) {
  55738. text = html;
  55739. }
  55740. if (text) {
  55741. advance(text.length);
  55742. }
  55743. if (options.chars && text) {
  55744. options.chars(text, index - text.length, index);
  55745. }
  55746. } else {
  55747. var endTagLength = 0;
  55748. var stackedTag = lastTag.toLowerCase();
  55749. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  55750. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  55751. endTagLength = endTag.length;
  55752. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  55753. text = text
  55754. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  55755. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  55756. }
  55757. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  55758. text = text.slice(1);
  55759. }
  55760. if (options.chars) {
  55761. options.chars(text);
  55762. }
  55763. return ''
  55764. });
  55765. index += html.length - rest$1.length;
  55766. html = rest$1;
  55767. parseEndTag(stackedTag, index - endTagLength, index);
  55768. }
  55769. if (html === last) {
  55770. options.chars && options.chars(html);
  55771. if (!stack.length && options.warn) {
  55772. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  55773. }
  55774. break
  55775. }
  55776. }
  55777. // Clean up any remaining tags
  55778. parseEndTag();
  55779. function advance (n) {
  55780. index += n;
  55781. html = html.substring(n);
  55782. }
  55783. function parseStartTag () {
  55784. var start = html.match(startTagOpen);
  55785. if (start) {
  55786. var match = {
  55787. tagName: start[1],
  55788. attrs: [],
  55789. start: index
  55790. };
  55791. advance(start[0].length);
  55792. var end, attr;
  55793. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  55794. attr.start = index;
  55795. advance(attr[0].length);
  55796. attr.end = index;
  55797. match.attrs.push(attr);
  55798. }
  55799. if (end) {
  55800. match.unarySlash = end[1];
  55801. advance(end[0].length);
  55802. match.end = index;
  55803. return match
  55804. }
  55805. }
  55806. }
  55807. function handleStartTag (match) {
  55808. var tagName = match.tagName;
  55809. var unarySlash = match.unarySlash;
  55810. if (expectHTML) {
  55811. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  55812. parseEndTag(lastTag);
  55813. }
  55814. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  55815. parseEndTag(tagName);
  55816. }
  55817. }
  55818. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  55819. var l = match.attrs.length;
  55820. var attrs = new Array(l);
  55821. for (var i = 0; i < l; i++) {
  55822. var args = match.attrs[i];
  55823. var value = args[3] || args[4] || args[5] || '';
  55824. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  55825. ? options.shouldDecodeNewlinesForHref
  55826. : options.shouldDecodeNewlines;
  55827. attrs[i] = {
  55828. name: args[1],
  55829. value: decodeAttr(value, shouldDecodeNewlines)
  55830. };
  55831. if (options.outputSourceRange) {
  55832. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  55833. attrs[i].end = args.end;
  55834. }
  55835. }
  55836. if (!unary) {
  55837. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  55838. lastTag = tagName;
  55839. }
  55840. if (options.start) {
  55841. options.start(tagName, attrs, unary, match.start, match.end);
  55842. }
  55843. }
  55844. function parseEndTag (tagName, start, end) {
  55845. var pos, lowerCasedTagName;
  55846. if (start == null) { start = index; }
  55847. if (end == null) { end = index; }
  55848. // Find the closest opened tag of the same type
  55849. if (tagName) {
  55850. lowerCasedTagName = tagName.toLowerCase();
  55851. for (pos = stack.length - 1; pos >= 0; pos--) {
  55852. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  55853. break
  55854. }
  55855. }
  55856. } else {
  55857. // If no tag name is provided, clean shop
  55858. pos = 0;
  55859. }
  55860. if (pos >= 0) {
  55861. // Close all the open elements, up the stack
  55862. for (var i = stack.length - 1; i >= pos; i--) {
  55863. if (i > pos || !tagName &&
  55864. options.warn
  55865. ) {
  55866. options.warn(
  55867. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  55868. { start: stack[i].start, end: stack[i].end }
  55869. );
  55870. }
  55871. if (options.end) {
  55872. options.end(stack[i].tag, start, end);
  55873. }
  55874. }
  55875. // Remove the open elements from the stack
  55876. stack.length = pos;
  55877. lastTag = pos && stack[pos - 1].tag;
  55878. } else if (lowerCasedTagName === 'br') {
  55879. if (options.start) {
  55880. options.start(tagName, [], true, start, end);
  55881. }
  55882. } else if (lowerCasedTagName === 'p') {
  55883. if (options.start) {
  55884. options.start(tagName, [], false, start, end);
  55885. }
  55886. if (options.end) {
  55887. options.end(tagName, start, end);
  55888. }
  55889. }
  55890. }
  55891. }
  55892. /* */
  55893. var onRE = /^@|^v-on:/;
  55894. var dirRE = /^v-|^@|^:|^#/;
  55895. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  55896. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  55897. var stripParensRE = /^\(|\)$/g;
  55898. var dynamicArgRE = /^\[.*\]$/;
  55899. var argRE = /:(.*)$/;
  55900. var bindRE = /^:|^\.|^v-bind:/;
  55901. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  55902. var slotRE = /^v-slot(:|$)|^#/;
  55903. var lineBreakRE = /[\r\n]/;
  55904. var whitespaceRE$1 = /\s+/g;
  55905. var invalidAttributeRE = /[\s"'<>\/=]/;
  55906. var decodeHTMLCached = cached(he.decode);
  55907. var emptySlotScopeToken = "_empty_";
  55908. // configurable state
  55909. var warn$2;
  55910. var delimiters;
  55911. var transforms;
  55912. var preTransforms;
  55913. var postTransforms;
  55914. var platformIsPreTag;
  55915. var platformMustUseProp;
  55916. var platformGetTagNamespace;
  55917. var maybeComponent;
  55918. function createASTElement (
  55919. tag,
  55920. attrs,
  55921. parent
  55922. ) {
  55923. return {
  55924. type: 1,
  55925. tag: tag,
  55926. attrsList: attrs,
  55927. attrsMap: makeAttrsMap(attrs),
  55928. rawAttrsMap: {},
  55929. parent: parent,
  55930. children: []
  55931. }
  55932. }
  55933. /**
  55934. * Convert HTML string to AST.
  55935. */
  55936. function parse (
  55937. template,
  55938. options
  55939. ) {
  55940. warn$2 = options.warn || baseWarn;
  55941. platformIsPreTag = options.isPreTag || no;
  55942. platformMustUseProp = options.mustUseProp || no;
  55943. platformGetTagNamespace = options.getTagNamespace || no;
  55944. var isReservedTag = options.isReservedTag || no;
  55945. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  55946. transforms = pluckModuleFunction(options.modules, 'transformNode');
  55947. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  55948. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  55949. delimiters = options.delimiters;
  55950. var stack = [];
  55951. var preserveWhitespace = options.preserveWhitespace !== false;
  55952. var whitespaceOption = options.whitespace;
  55953. var root;
  55954. var currentParent;
  55955. var inVPre = false;
  55956. var inPre = false;
  55957. var warned = false;
  55958. function warnOnce (msg, range) {
  55959. if (!warned) {
  55960. warned = true;
  55961. warn$2(msg, range);
  55962. }
  55963. }
  55964. function closeElement (element) {
  55965. trimEndingWhitespace(element);
  55966. if (!inVPre && !element.processed) {
  55967. element = processElement(element, options);
  55968. }
  55969. // tree management
  55970. if (!stack.length && element !== root) {
  55971. // allow root elements with v-if, v-else-if and v-else
  55972. if (root.if && (element.elseif || element.else)) {
  55973. {
  55974. checkRootConstraints(element);
  55975. }
  55976. addIfCondition(root, {
  55977. exp: element.elseif,
  55978. block: element
  55979. });
  55980. } else {
  55981. warnOnce(
  55982. "Component template should contain exactly one root element. " +
  55983. "If you are using v-if on multiple elements, " +
  55984. "use v-else-if to chain them instead.",
  55985. { start: element.start }
  55986. );
  55987. }
  55988. }
  55989. if (currentParent && !element.forbidden) {
  55990. if (element.elseif || element.else) {
  55991. processIfConditions(element, currentParent);
  55992. } else {
  55993. if (element.slotScope) {
  55994. // scoped slot
  55995. // keep it in the children list so that v-else(-if) conditions can
  55996. // find it as the prev node.
  55997. var name = element.slotTarget || '"default"'
  55998. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  55999. }
  56000. currentParent.children.push(element);
  56001. element.parent = currentParent;
  56002. }
  56003. }
  56004. // final children cleanup
  56005. // filter out scoped slots
  56006. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  56007. // remove trailing whitespace node again
  56008. trimEndingWhitespace(element);
  56009. // check pre state
  56010. if (element.pre) {
  56011. inVPre = false;
  56012. }
  56013. if (platformIsPreTag(element.tag)) {
  56014. inPre = false;
  56015. }
  56016. // apply post-transforms
  56017. for (var i = 0; i < postTransforms.length; i++) {
  56018. postTransforms[i](element, options);
  56019. }
  56020. }
  56021. function trimEndingWhitespace (el) {
  56022. // remove trailing whitespace node
  56023. if (!inPre) {
  56024. var lastNode;
  56025. while (
  56026. (lastNode = el.children[el.children.length - 1]) &&
  56027. lastNode.type === 3 &&
  56028. lastNode.text === ' '
  56029. ) {
  56030. el.children.pop();
  56031. }
  56032. }
  56033. }
  56034. function checkRootConstraints (el) {
  56035. if (el.tag === 'slot' || el.tag === 'template') {
  56036. warnOnce(
  56037. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  56038. 'contain multiple nodes.',
  56039. { start: el.start }
  56040. );
  56041. }
  56042. if (el.attrsMap.hasOwnProperty('v-for')) {
  56043. warnOnce(
  56044. 'Cannot use v-for on stateful component root element because ' +
  56045. 'it renders multiple elements.',
  56046. el.rawAttrsMap['v-for']
  56047. );
  56048. }
  56049. }
  56050. parseHTML(template, {
  56051. warn: warn$2,
  56052. expectHTML: options.expectHTML,
  56053. isUnaryTag: options.isUnaryTag,
  56054. canBeLeftOpenTag: options.canBeLeftOpenTag,
  56055. shouldDecodeNewlines: options.shouldDecodeNewlines,
  56056. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  56057. shouldKeepComment: options.comments,
  56058. outputSourceRange: options.outputSourceRange,
  56059. start: function start (tag, attrs, unary, start$1, end) {
  56060. // check namespace.
  56061. // inherit parent ns if there is one
  56062. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  56063. // handle IE svg bug
  56064. /* istanbul ignore if */
  56065. if (isIE && ns === 'svg') {
  56066. attrs = guardIESVGBug(attrs);
  56067. }
  56068. var element = createASTElement(tag, attrs, currentParent);
  56069. if (ns) {
  56070. element.ns = ns;
  56071. }
  56072. {
  56073. if (options.outputSourceRange) {
  56074. element.start = start$1;
  56075. element.end = end;
  56076. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  56077. cumulated[attr.name] = attr;
  56078. return cumulated
  56079. }, {});
  56080. }
  56081. attrs.forEach(function (attr) {
  56082. if (invalidAttributeRE.test(attr.name)) {
  56083. warn$2(
  56084. "Invalid dynamic argument expression: attribute names cannot contain " +
  56085. "spaces, quotes, <, >, / or =.",
  56086. {
  56087. start: attr.start + attr.name.indexOf("["),
  56088. end: attr.start + attr.name.length
  56089. }
  56090. );
  56091. }
  56092. });
  56093. }
  56094. if (isForbiddenTag(element) && !isServerRendering()) {
  56095. element.forbidden = true;
  56096. warn$2(
  56097. 'Templates should only be responsible for mapping the state to the ' +
  56098. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  56099. "<" + tag + ">" + ', as they will not be parsed.',
  56100. { start: element.start }
  56101. );
  56102. }
  56103. // apply pre-transforms
  56104. for (var i = 0; i < preTransforms.length; i++) {
  56105. element = preTransforms[i](element, options) || element;
  56106. }
  56107. if (!inVPre) {
  56108. processPre(element);
  56109. if (element.pre) {
  56110. inVPre = true;
  56111. }
  56112. }
  56113. if (platformIsPreTag(element.tag)) {
  56114. inPre = true;
  56115. }
  56116. if (inVPre) {
  56117. processRawAttrs(element);
  56118. } else if (!element.processed) {
  56119. // structural directives
  56120. processFor(element);
  56121. processIf(element);
  56122. processOnce(element);
  56123. }
  56124. if (!root) {
  56125. root = element;
  56126. {
  56127. checkRootConstraints(root);
  56128. }
  56129. }
  56130. if (!unary) {
  56131. currentParent = element;
  56132. stack.push(element);
  56133. } else {
  56134. closeElement(element);
  56135. }
  56136. },
  56137. end: function end (tag, start, end$1) {
  56138. var element = stack[stack.length - 1];
  56139. // pop stack
  56140. stack.length -= 1;
  56141. currentParent = stack[stack.length - 1];
  56142. if (options.outputSourceRange) {
  56143. element.end = end$1;
  56144. }
  56145. closeElement(element);
  56146. },
  56147. chars: function chars (text, start, end) {
  56148. if (!currentParent) {
  56149. {
  56150. if (text === template) {
  56151. warnOnce(
  56152. 'Component template requires a root element, rather than just text.',
  56153. { start: start }
  56154. );
  56155. } else if ((text = text.trim())) {
  56156. warnOnce(
  56157. ("text \"" + text + "\" outside root element will be ignored."),
  56158. { start: start }
  56159. );
  56160. }
  56161. }
  56162. return
  56163. }
  56164. // IE textarea placeholder bug
  56165. /* istanbul ignore if */
  56166. if (isIE &&
  56167. currentParent.tag === 'textarea' &&
  56168. currentParent.attrsMap.placeholder === text
  56169. ) {
  56170. return
  56171. }
  56172. var children = currentParent.children;
  56173. if (inPre || text.trim()) {
  56174. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  56175. } else if (!children.length) {
  56176. // remove the whitespace-only node right after an opening tag
  56177. text = '';
  56178. } else if (whitespaceOption) {
  56179. if (whitespaceOption === 'condense') {
  56180. // in condense mode, remove the whitespace node if it contains
  56181. // line break, otherwise condense to a single space
  56182. text = lineBreakRE.test(text) ? '' : ' ';
  56183. } else {
  56184. text = ' ';
  56185. }
  56186. } else {
  56187. text = preserveWhitespace ? ' ' : '';
  56188. }
  56189. if (text) {
  56190. if (!inPre && whitespaceOption === 'condense') {
  56191. // condense consecutive whitespaces into single space
  56192. text = text.replace(whitespaceRE$1, ' ');
  56193. }
  56194. var res;
  56195. var child;
  56196. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  56197. child = {
  56198. type: 2,
  56199. expression: res.expression,
  56200. tokens: res.tokens,
  56201. text: text
  56202. };
  56203. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  56204. child = {
  56205. type: 3,
  56206. text: text
  56207. };
  56208. }
  56209. if (child) {
  56210. if (options.outputSourceRange) {
  56211. child.start = start;
  56212. child.end = end;
  56213. }
  56214. children.push(child);
  56215. }
  56216. }
  56217. },
  56218. comment: function comment (text, start, end) {
  56219. // adding anyting as a sibling to the root node is forbidden
  56220. // comments should still be allowed, but ignored
  56221. if (currentParent) {
  56222. var child = {
  56223. type: 3,
  56224. text: text,
  56225. isComment: true
  56226. };
  56227. if (options.outputSourceRange) {
  56228. child.start = start;
  56229. child.end = end;
  56230. }
  56231. currentParent.children.push(child);
  56232. }
  56233. }
  56234. });
  56235. return root
  56236. }
  56237. function processPre (el) {
  56238. if (getAndRemoveAttr(el, 'v-pre') != null) {
  56239. el.pre = true;
  56240. }
  56241. }
  56242. function processRawAttrs (el) {
  56243. var list = el.attrsList;
  56244. var len = list.length;
  56245. if (len) {
  56246. var attrs = el.attrs = new Array(len);
  56247. for (var i = 0; i < len; i++) {
  56248. attrs[i] = {
  56249. name: list[i].name,
  56250. value: JSON.stringify(list[i].value)
  56251. };
  56252. if (list[i].start != null) {
  56253. attrs[i].start = list[i].start;
  56254. attrs[i].end = list[i].end;
  56255. }
  56256. }
  56257. } else if (!el.pre) {
  56258. // non root node in pre blocks with no attributes
  56259. el.plain = true;
  56260. }
  56261. }
  56262. function processElement (
  56263. element,
  56264. options
  56265. ) {
  56266. processKey(element);
  56267. // determine whether this is a plain element after
  56268. // removing structural attributes
  56269. element.plain = (
  56270. !element.key &&
  56271. !element.scopedSlots &&
  56272. !element.attrsList.length
  56273. );
  56274. processRef(element);
  56275. processSlotContent(element);
  56276. processSlotOutlet(element);
  56277. processComponent(element);
  56278. for (var i = 0; i < transforms.length; i++) {
  56279. element = transforms[i](element, options) || element;
  56280. }
  56281. processAttrs(element);
  56282. return element
  56283. }
  56284. function processKey (el) {
  56285. var exp = getBindingAttr(el, 'key');
  56286. if (exp) {
  56287. {
  56288. if (el.tag === 'template') {
  56289. warn$2(
  56290. "<template> cannot be keyed. Place the key on real elements instead.",
  56291. getRawBindingAttr(el, 'key')
  56292. );
  56293. }
  56294. if (el.for) {
  56295. var iterator = el.iterator2 || el.iterator1;
  56296. var parent = el.parent;
  56297. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  56298. warn$2(
  56299. "Do not use v-for index as key on <transition-group> children, " +
  56300. "this is the same as not using keys.",
  56301. getRawBindingAttr(el, 'key'),
  56302. true /* tip */
  56303. );
  56304. }
  56305. }
  56306. }
  56307. el.key = exp;
  56308. }
  56309. }
  56310. function processRef (el) {
  56311. var ref = getBindingAttr(el, 'ref');
  56312. if (ref) {
  56313. el.ref = ref;
  56314. el.refInFor = checkInFor(el);
  56315. }
  56316. }
  56317. function processFor (el) {
  56318. var exp;
  56319. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  56320. var res = parseFor(exp);
  56321. if (res) {
  56322. extend(el, res);
  56323. } else {
  56324. warn$2(
  56325. ("Invalid v-for expression: " + exp),
  56326. el.rawAttrsMap['v-for']
  56327. );
  56328. }
  56329. }
  56330. }
  56331. function parseFor (exp) {
  56332. var inMatch = exp.match(forAliasRE);
  56333. if (!inMatch) { return }
  56334. var res = {};
  56335. res.for = inMatch[2].trim();
  56336. var alias = inMatch[1].trim().replace(stripParensRE, '');
  56337. var iteratorMatch = alias.match(forIteratorRE);
  56338. if (iteratorMatch) {
  56339. res.alias = alias.replace(forIteratorRE, '').trim();
  56340. res.iterator1 = iteratorMatch[1].trim();
  56341. if (iteratorMatch[2]) {
  56342. res.iterator2 = iteratorMatch[2].trim();
  56343. }
  56344. } else {
  56345. res.alias = alias;
  56346. }
  56347. return res
  56348. }
  56349. function processIf (el) {
  56350. var exp = getAndRemoveAttr(el, 'v-if');
  56351. if (exp) {
  56352. el.if = exp;
  56353. addIfCondition(el, {
  56354. exp: exp,
  56355. block: el
  56356. });
  56357. } else {
  56358. if (getAndRemoveAttr(el, 'v-else') != null) {
  56359. el.else = true;
  56360. }
  56361. var elseif = getAndRemoveAttr(el, 'v-else-if');
  56362. if (elseif) {
  56363. el.elseif = elseif;
  56364. }
  56365. }
  56366. }
  56367. function processIfConditions (el, parent) {
  56368. var prev = findPrevElement(parent.children);
  56369. if (prev && prev.if) {
  56370. addIfCondition(prev, {
  56371. exp: el.elseif,
  56372. block: el
  56373. });
  56374. } else {
  56375. warn$2(
  56376. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  56377. "used on element <" + (el.tag) + "> without corresponding v-if.",
  56378. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  56379. );
  56380. }
  56381. }
  56382. function findPrevElement (children) {
  56383. var i = children.length;
  56384. while (i--) {
  56385. if (children[i].type === 1) {
  56386. return children[i]
  56387. } else {
  56388. if (children[i].text !== ' ') {
  56389. warn$2(
  56390. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  56391. "will be ignored.",
  56392. children[i]
  56393. );
  56394. }
  56395. children.pop();
  56396. }
  56397. }
  56398. }
  56399. function addIfCondition (el, condition) {
  56400. if (!el.ifConditions) {
  56401. el.ifConditions = [];
  56402. }
  56403. el.ifConditions.push(condition);
  56404. }
  56405. function processOnce (el) {
  56406. var once$$1 = getAndRemoveAttr(el, 'v-once');
  56407. if (once$$1 != null) {
  56408. el.once = true;
  56409. }
  56410. }
  56411. // handle content being passed to a component as slot,
  56412. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  56413. function processSlotContent (el) {
  56414. var slotScope;
  56415. if (el.tag === 'template') {
  56416. slotScope = getAndRemoveAttr(el, 'scope');
  56417. /* istanbul ignore if */
  56418. if (slotScope) {
  56419. warn$2(
  56420. "the \"scope\" attribute for scoped slots have been deprecated and " +
  56421. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  56422. "can also be used on plain elements in addition to <template> to " +
  56423. "denote scoped slots.",
  56424. el.rawAttrsMap['scope'],
  56425. true
  56426. );
  56427. }
  56428. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  56429. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  56430. /* istanbul ignore if */
  56431. if (el.attrsMap['v-for']) {
  56432. warn$2(
  56433. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  56434. "(v-for takes higher priority). Use a wrapper <template> for the " +
  56435. "scoped slot to make it clearer.",
  56436. el.rawAttrsMap['slot-scope'],
  56437. true
  56438. );
  56439. }
  56440. el.slotScope = slotScope;
  56441. }
  56442. // slot="xxx"
  56443. var slotTarget = getBindingAttr(el, 'slot');
  56444. if (slotTarget) {
  56445. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  56446. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  56447. // preserve slot as an attribute for native shadow DOM compat
  56448. // only for non-scoped slots.
  56449. if (el.tag !== 'template' && !el.slotScope) {
  56450. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  56451. }
  56452. }
  56453. // 2.6 v-slot syntax
  56454. {
  56455. if (el.tag === 'template') {
  56456. // v-slot on <template>
  56457. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  56458. if (slotBinding) {
  56459. {
  56460. if (el.slotTarget || el.slotScope) {
  56461. warn$2(
  56462. "Unexpected mixed usage of different slot syntaxes.",
  56463. el
  56464. );
  56465. }
  56466. if (el.parent && !maybeComponent(el.parent)) {
  56467. warn$2(
  56468. "<template v-slot> can only appear at the root level inside " +
  56469. "the receiving component",
  56470. el
  56471. );
  56472. }
  56473. }
  56474. var ref = getSlotName(slotBinding);
  56475. var name = ref.name;
  56476. var dynamic = ref.dynamic;
  56477. el.slotTarget = name;
  56478. el.slotTargetDynamic = dynamic;
  56479. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  56480. }
  56481. } else {
  56482. // v-slot on component, denotes default slot
  56483. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  56484. if (slotBinding$1) {
  56485. {
  56486. if (!maybeComponent(el)) {
  56487. warn$2(
  56488. "v-slot can only be used on components or <template>.",
  56489. slotBinding$1
  56490. );
  56491. }
  56492. if (el.slotScope || el.slotTarget) {
  56493. warn$2(
  56494. "Unexpected mixed usage of different slot syntaxes.",
  56495. el
  56496. );
  56497. }
  56498. if (el.scopedSlots) {
  56499. warn$2(
  56500. "To avoid scope ambiguity, the default slot should also use " +
  56501. "<template> syntax when there are other named slots.",
  56502. slotBinding$1
  56503. );
  56504. }
  56505. }
  56506. // add the component's children to its default slot
  56507. var slots = el.scopedSlots || (el.scopedSlots = {});
  56508. var ref$1 = getSlotName(slotBinding$1);
  56509. var name$1 = ref$1.name;
  56510. var dynamic$1 = ref$1.dynamic;
  56511. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  56512. slotContainer.slotTarget = name$1;
  56513. slotContainer.slotTargetDynamic = dynamic$1;
  56514. slotContainer.children = el.children.filter(function (c) {
  56515. if (!c.slotScope) {
  56516. c.parent = slotContainer;
  56517. return true
  56518. }
  56519. });
  56520. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  56521. // remove children as they are returned from scopedSlots now
  56522. el.children = [];
  56523. // mark el non-plain so data gets generated
  56524. el.plain = false;
  56525. }
  56526. }
  56527. }
  56528. }
  56529. function getSlotName (binding) {
  56530. var name = binding.name.replace(slotRE, '');
  56531. if (!name) {
  56532. if (binding.name[0] !== '#') {
  56533. name = 'default';
  56534. } else {
  56535. warn$2(
  56536. "v-slot shorthand syntax requires a slot name.",
  56537. binding
  56538. );
  56539. }
  56540. }
  56541. return dynamicArgRE.test(name)
  56542. // dynamic [name]
  56543. ? { name: name.slice(1, -1), dynamic: true }
  56544. // static name
  56545. : { name: ("\"" + name + "\""), dynamic: false }
  56546. }
  56547. // handle <slot/> outlets
  56548. function processSlotOutlet (el) {
  56549. if (el.tag === 'slot') {
  56550. el.slotName = getBindingAttr(el, 'name');
  56551. if (el.key) {
  56552. warn$2(
  56553. "`key` does not work on <slot> because slots are abstract outlets " +
  56554. "and can possibly expand into multiple elements. " +
  56555. "Use the key on a wrapping element instead.",
  56556. getRawBindingAttr(el, 'key')
  56557. );
  56558. }
  56559. }
  56560. }
  56561. function processComponent (el) {
  56562. var binding;
  56563. if ((binding = getBindingAttr(el, 'is'))) {
  56564. el.component = binding;
  56565. }
  56566. if (getAndRemoveAttr(el, 'inline-template') != null) {
  56567. el.inlineTemplate = true;
  56568. }
  56569. }
  56570. function processAttrs (el) {
  56571. var list = el.attrsList;
  56572. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  56573. for (i = 0, l = list.length; i < l; i++) {
  56574. name = rawName = list[i].name;
  56575. value = list[i].value;
  56576. if (dirRE.test(name)) {
  56577. // mark element as dynamic
  56578. el.hasBindings = true;
  56579. // modifiers
  56580. modifiers = parseModifiers(name.replace(dirRE, ''));
  56581. // support .foo shorthand syntax for the .prop modifier
  56582. if (modifiers) {
  56583. name = name.replace(modifierRE, '');
  56584. }
  56585. if (bindRE.test(name)) { // v-bind
  56586. name = name.replace(bindRE, '');
  56587. value = parseFilters(value);
  56588. isDynamic = dynamicArgRE.test(name);
  56589. if (isDynamic) {
  56590. name = name.slice(1, -1);
  56591. }
  56592. if (
  56593. value.trim().length === 0
  56594. ) {
  56595. warn$2(
  56596. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  56597. );
  56598. }
  56599. if (modifiers) {
  56600. if (modifiers.prop && !isDynamic) {
  56601. name = camelize(name);
  56602. if (name === 'innerHtml') { name = 'innerHTML'; }
  56603. }
  56604. if (modifiers.camel && !isDynamic) {
  56605. name = camelize(name);
  56606. }
  56607. if (modifiers.sync) {
  56608. syncGen = genAssignmentCode(value, "$event");
  56609. if (!isDynamic) {
  56610. addHandler(
  56611. el,
  56612. ("update:" + (camelize(name))),
  56613. syncGen,
  56614. null,
  56615. false,
  56616. warn$2,
  56617. list[i]
  56618. );
  56619. if (hyphenate(name) !== camelize(name)) {
  56620. addHandler(
  56621. el,
  56622. ("update:" + (hyphenate(name))),
  56623. syncGen,
  56624. null,
  56625. false,
  56626. warn$2,
  56627. list[i]
  56628. );
  56629. }
  56630. } else {
  56631. // handler w/ dynamic event name
  56632. addHandler(
  56633. el,
  56634. ("\"update:\"+(" + name + ")"),
  56635. syncGen,
  56636. null,
  56637. false,
  56638. warn$2,
  56639. list[i],
  56640. true // dynamic
  56641. );
  56642. }
  56643. }
  56644. }
  56645. if ((modifiers && modifiers.prop) || (
  56646. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  56647. )) {
  56648. addProp(el, name, value, list[i], isDynamic);
  56649. } else {
  56650. addAttr(el, name, value, list[i], isDynamic);
  56651. }
  56652. } else if (onRE.test(name)) { // v-on
  56653. name = name.replace(onRE, '');
  56654. isDynamic = dynamicArgRE.test(name);
  56655. if (isDynamic) {
  56656. name = name.slice(1, -1);
  56657. }
  56658. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  56659. } else { // normal directives
  56660. name = name.replace(dirRE, '');
  56661. // parse arg
  56662. var argMatch = name.match(argRE);
  56663. var arg = argMatch && argMatch[1];
  56664. isDynamic = false;
  56665. if (arg) {
  56666. name = name.slice(0, -(arg.length + 1));
  56667. if (dynamicArgRE.test(arg)) {
  56668. arg = arg.slice(1, -1);
  56669. isDynamic = true;
  56670. }
  56671. }
  56672. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  56673. if (name === 'model') {
  56674. checkForAliasModel(el, value);
  56675. }
  56676. }
  56677. } else {
  56678. // literal attribute
  56679. {
  56680. var res = parseText(value, delimiters);
  56681. if (res) {
  56682. warn$2(
  56683. name + "=\"" + value + "\": " +
  56684. 'Interpolation inside attributes has been removed. ' +
  56685. 'Use v-bind or the colon shorthand instead. For example, ' +
  56686. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  56687. list[i]
  56688. );
  56689. }
  56690. }
  56691. addAttr(el, name, JSON.stringify(value), list[i]);
  56692. // #6887 firefox doesn't update muted state if set via attribute
  56693. // even immediately after element creation
  56694. if (!el.component &&
  56695. name === 'muted' &&
  56696. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  56697. addProp(el, name, 'true', list[i]);
  56698. }
  56699. }
  56700. }
  56701. }
  56702. function checkInFor (el) {
  56703. var parent = el;
  56704. while (parent) {
  56705. if (parent.for !== undefined) {
  56706. return true
  56707. }
  56708. parent = parent.parent;
  56709. }
  56710. return false
  56711. }
  56712. function parseModifiers (name) {
  56713. var match = name.match(modifierRE);
  56714. if (match) {
  56715. var ret = {};
  56716. match.forEach(function (m) { ret[m.slice(1)] = true; });
  56717. return ret
  56718. }
  56719. }
  56720. function makeAttrsMap (attrs) {
  56721. var map = {};
  56722. for (var i = 0, l = attrs.length; i < l; i++) {
  56723. if (
  56724. map[attrs[i].name] && !isIE && !isEdge
  56725. ) {
  56726. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  56727. }
  56728. map[attrs[i].name] = attrs[i].value;
  56729. }
  56730. return map
  56731. }
  56732. // for script (e.g. type="x/template") or style, do not decode content
  56733. function isTextTag (el) {
  56734. return el.tag === 'script' || el.tag === 'style'
  56735. }
  56736. function isForbiddenTag (el) {
  56737. return (
  56738. el.tag === 'style' ||
  56739. (el.tag === 'script' && (
  56740. !el.attrsMap.type ||
  56741. el.attrsMap.type === 'text/javascript'
  56742. ))
  56743. )
  56744. }
  56745. var ieNSBug = /^xmlns:NS\d+/;
  56746. var ieNSPrefix = /^NS\d+:/;
  56747. /* istanbul ignore next */
  56748. function guardIESVGBug (attrs) {
  56749. var res = [];
  56750. for (var i = 0; i < attrs.length; i++) {
  56751. var attr = attrs[i];
  56752. if (!ieNSBug.test(attr.name)) {
  56753. attr.name = attr.name.replace(ieNSPrefix, '');
  56754. res.push(attr);
  56755. }
  56756. }
  56757. return res
  56758. }
  56759. function checkForAliasModel (el, value) {
  56760. var _el = el;
  56761. while (_el) {
  56762. if (_el.for && _el.alias === value) {
  56763. warn$2(
  56764. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  56765. "You are binding v-model directly to a v-for iteration alias. " +
  56766. "This will not be able to modify the v-for source array because " +
  56767. "writing to the alias is like modifying a function local variable. " +
  56768. "Consider using an array of objects and use v-model on an object property instead.",
  56769. el.rawAttrsMap['v-model']
  56770. );
  56771. }
  56772. _el = _el.parent;
  56773. }
  56774. }
  56775. /* */
  56776. function preTransformNode (el, options) {
  56777. if (el.tag === 'input') {
  56778. var map = el.attrsMap;
  56779. if (!map['v-model']) {
  56780. return
  56781. }
  56782. var typeBinding;
  56783. if (map[':type'] || map['v-bind:type']) {
  56784. typeBinding = getBindingAttr(el, 'type');
  56785. }
  56786. if (!map.type && !typeBinding && map['v-bind']) {
  56787. typeBinding = "(" + (map['v-bind']) + ").type";
  56788. }
  56789. if (typeBinding) {
  56790. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  56791. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  56792. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  56793. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  56794. // 1. checkbox
  56795. var branch0 = cloneASTElement(el);
  56796. // process for on the main node
  56797. processFor(branch0);
  56798. addRawAttr(branch0, 'type', 'checkbox');
  56799. processElement(branch0, options);
  56800. branch0.processed = true; // prevent it from double-processed
  56801. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  56802. addIfCondition(branch0, {
  56803. exp: branch0.if,
  56804. block: branch0
  56805. });
  56806. // 2. add radio else-if condition
  56807. var branch1 = cloneASTElement(el);
  56808. getAndRemoveAttr(branch1, 'v-for', true);
  56809. addRawAttr(branch1, 'type', 'radio');
  56810. processElement(branch1, options);
  56811. addIfCondition(branch0, {
  56812. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  56813. block: branch1
  56814. });
  56815. // 3. other
  56816. var branch2 = cloneASTElement(el);
  56817. getAndRemoveAttr(branch2, 'v-for', true);
  56818. addRawAttr(branch2, ':type', typeBinding);
  56819. processElement(branch2, options);
  56820. addIfCondition(branch0, {
  56821. exp: ifCondition,
  56822. block: branch2
  56823. });
  56824. if (hasElse) {
  56825. branch0.else = true;
  56826. } else if (elseIfCondition) {
  56827. branch0.elseif = elseIfCondition;
  56828. }
  56829. return branch0
  56830. }
  56831. }
  56832. }
  56833. function cloneASTElement (el) {
  56834. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  56835. }
  56836. var model$1 = {
  56837. preTransformNode: preTransformNode
  56838. };
  56839. var modules$1 = [
  56840. klass$1,
  56841. style$1,
  56842. model$1
  56843. ];
  56844. /* */
  56845. function text (el, dir) {
  56846. if (dir.value) {
  56847. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  56848. }
  56849. }
  56850. /* */
  56851. function html (el, dir) {
  56852. if (dir.value) {
  56853. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  56854. }
  56855. }
  56856. var directives$1 = {
  56857. model: model,
  56858. text: text,
  56859. html: html
  56860. };
  56861. /* */
  56862. var baseOptions = {
  56863. expectHTML: true,
  56864. modules: modules$1,
  56865. directives: directives$1,
  56866. isPreTag: isPreTag,
  56867. isUnaryTag: isUnaryTag,
  56868. mustUseProp: mustUseProp,
  56869. canBeLeftOpenTag: canBeLeftOpenTag,
  56870. isReservedTag: isReservedTag,
  56871. getTagNamespace: getTagNamespace,
  56872. staticKeys: genStaticKeys(modules$1)
  56873. };
  56874. /* */
  56875. var isStaticKey;
  56876. var isPlatformReservedTag;
  56877. var genStaticKeysCached = cached(genStaticKeys$1);
  56878. /**
  56879. * Goal of the optimizer: walk the generated template AST tree
  56880. * and detect sub-trees that are purely static, i.e. parts of
  56881. * the DOM that never needs to change.
  56882. *
  56883. * Once we detect these sub-trees, we can:
  56884. *
  56885. * 1. Hoist them into constants, so that we no longer need to
  56886. * create fresh nodes for them on each re-render;
  56887. * 2. Completely skip them in the patching process.
  56888. */
  56889. function optimize (root, options) {
  56890. if (!root) { return }
  56891. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  56892. isPlatformReservedTag = options.isReservedTag || no;
  56893. // first pass: mark all non-static nodes.
  56894. markStatic$1(root);
  56895. // second pass: mark static roots.
  56896. markStaticRoots(root, false);
  56897. }
  56898. function genStaticKeys$1 (keys) {
  56899. return makeMap(
  56900. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  56901. (keys ? ',' + keys : '')
  56902. )
  56903. }
  56904. function markStatic$1 (node) {
  56905. node.static = isStatic(node);
  56906. if (node.type === 1) {
  56907. // do not make component slot content static. this avoids
  56908. // 1. components not able to mutate slot nodes
  56909. // 2. static slot content fails for hot-reloading
  56910. if (
  56911. !isPlatformReservedTag(node.tag) &&
  56912. node.tag !== 'slot' &&
  56913. node.attrsMap['inline-template'] == null
  56914. ) {
  56915. return
  56916. }
  56917. for (var i = 0, l = node.children.length; i < l; i++) {
  56918. var child = node.children[i];
  56919. markStatic$1(child);
  56920. if (!child.static) {
  56921. node.static = false;
  56922. }
  56923. }
  56924. if (node.ifConditions) {
  56925. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  56926. var block = node.ifConditions[i$1].block;
  56927. markStatic$1(block);
  56928. if (!block.static) {
  56929. node.static = false;
  56930. }
  56931. }
  56932. }
  56933. }
  56934. }
  56935. function markStaticRoots (node, isInFor) {
  56936. if (node.type === 1) {
  56937. if (node.static || node.once) {
  56938. node.staticInFor = isInFor;
  56939. }
  56940. // For a node to qualify as a static root, it should have children that
  56941. // are not just static text. Otherwise the cost of hoisting out will
  56942. // outweigh the benefits and it's better off to just always render it fresh.
  56943. if (node.static && node.children.length && !(
  56944. node.children.length === 1 &&
  56945. node.children[0].type === 3
  56946. )) {
  56947. node.staticRoot = true;
  56948. return
  56949. } else {
  56950. node.staticRoot = false;
  56951. }
  56952. if (node.children) {
  56953. for (var i = 0, l = node.children.length; i < l; i++) {
  56954. markStaticRoots(node.children[i], isInFor || !!node.for);
  56955. }
  56956. }
  56957. if (node.ifConditions) {
  56958. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  56959. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  56960. }
  56961. }
  56962. }
  56963. }
  56964. function isStatic (node) {
  56965. if (node.type === 2) { // expression
  56966. return false
  56967. }
  56968. if (node.type === 3) { // text
  56969. return true
  56970. }
  56971. return !!(node.pre || (
  56972. !node.hasBindings && // no dynamic bindings
  56973. !node.if && !node.for && // not v-if or v-for or v-else
  56974. !isBuiltInTag(node.tag) && // not a built-in
  56975. isPlatformReservedTag(node.tag) && // not a component
  56976. !isDirectChildOfTemplateFor(node) &&
  56977. Object.keys(node).every(isStaticKey)
  56978. ))
  56979. }
  56980. function isDirectChildOfTemplateFor (node) {
  56981. while (node.parent) {
  56982. node = node.parent;
  56983. if (node.tag !== 'template') {
  56984. return false
  56985. }
  56986. if (node.for) {
  56987. return true
  56988. }
  56989. }
  56990. return false
  56991. }
  56992. /* */
  56993. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  56994. var fnInvokeRE = /\([^)]*?\);*$/;
  56995. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  56996. // KeyboardEvent.keyCode aliases
  56997. var keyCodes = {
  56998. esc: 27,
  56999. tab: 9,
  57000. enter: 13,
  57001. space: 32,
  57002. up: 38,
  57003. left: 37,
  57004. right: 39,
  57005. down: 40,
  57006. 'delete': [8, 46]
  57007. };
  57008. // KeyboardEvent.key aliases
  57009. var keyNames = {
  57010. // #7880: IE11 and Edge use `Esc` for Escape key name.
  57011. esc: ['Esc', 'Escape'],
  57012. tab: 'Tab',
  57013. enter: 'Enter',
  57014. // #9112: IE11 uses `Spacebar` for Space key name.
  57015. space: [' ', 'Spacebar'],
  57016. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  57017. up: ['Up', 'ArrowUp'],
  57018. left: ['Left', 'ArrowLeft'],
  57019. right: ['Right', 'ArrowRight'],
  57020. down: ['Down', 'ArrowDown'],
  57021. // #9112: IE11 uses `Del` for Delete key name.
  57022. 'delete': ['Backspace', 'Delete', 'Del']
  57023. };
  57024. // #4868: modifiers that prevent the execution of the listener
  57025. // need to explicitly return null so that we can determine whether to remove
  57026. // the listener for .once
  57027. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  57028. var modifierCode = {
  57029. stop: '$event.stopPropagation();',
  57030. prevent: '$event.preventDefault();',
  57031. self: genGuard("$event.target !== $event.currentTarget"),
  57032. ctrl: genGuard("!$event.ctrlKey"),
  57033. shift: genGuard("!$event.shiftKey"),
  57034. alt: genGuard("!$event.altKey"),
  57035. meta: genGuard("!$event.metaKey"),
  57036. left: genGuard("'button' in $event && $event.button !== 0"),
  57037. middle: genGuard("'button' in $event && $event.button !== 1"),
  57038. right: genGuard("'button' in $event && $event.button !== 2")
  57039. };
  57040. function genHandlers (
  57041. events,
  57042. isNative
  57043. ) {
  57044. var prefix = isNative ? 'nativeOn:' : 'on:';
  57045. var staticHandlers = "";
  57046. var dynamicHandlers = "";
  57047. for (var name in events) {
  57048. var handlerCode = genHandler(events[name]);
  57049. if (events[name] && events[name].dynamic) {
  57050. dynamicHandlers += name + "," + handlerCode + ",";
  57051. } else {
  57052. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  57053. }
  57054. }
  57055. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  57056. if (dynamicHandlers) {
  57057. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  57058. } else {
  57059. return prefix + staticHandlers
  57060. }
  57061. }
  57062. function genHandler (handler) {
  57063. if (!handler) {
  57064. return 'function(){}'
  57065. }
  57066. if (Array.isArray(handler)) {
  57067. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  57068. }
  57069. var isMethodPath = simplePathRE.test(handler.value);
  57070. var isFunctionExpression = fnExpRE.test(handler.value);
  57071. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  57072. if (!handler.modifiers) {
  57073. if (isMethodPath || isFunctionExpression) {
  57074. return handler.value
  57075. }
  57076. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  57077. } else {
  57078. var code = '';
  57079. var genModifierCode = '';
  57080. var keys = [];
  57081. for (var key in handler.modifiers) {
  57082. if (modifierCode[key]) {
  57083. genModifierCode += modifierCode[key];
  57084. // left/right
  57085. if (keyCodes[key]) {
  57086. keys.push(key);
  57087. }
  57088. } else if (key === 'exact') {
  57089. var modifiers = (handler.modifiers);
  57090. genModifierCode += genGuard(
  57091. ['ctrl', 'shift', 'alt', 'meta']
  57092. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  57093. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  57094. .join('||')
  57095. );
  57096. } else {
  57097. keys.push(key);
  57098. }
  57099. }
  57100. if (keys.length) {
  57101. code += genKeyFilter(keys);
  57102. }
  57103. // Make sure modifiers like prevent and stop get executed after key filtering
  57104. if (genModifierCode) {
  57105. code += genModifierCode;
  57106. }
  57107. var handlerCode = isMethodPath
  57108. ? ("return " + (handler.value) + "($event)")
  57109. : isFunctionExpression
  57110. ? ("return (" + (handler.value) + ")($event)")
  57111. : isFunctionInvocation
  57112. ? ("return " + (handler.value))
  57113. : handler.value;
  57114. return ("function($event){" + code + handlerCode + "}")
  57115. }
  57116. }
  57117. function genKeyFilter (keys) {
  57118. return (
  57119. // make sure the key filters only apply to KeyboardEvents
  57120. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  57121. // key events that do not have keyCode property...
  57122. "if(!$event.type.indexOf('key')&&" +
  57123. (keys.map(genFilterCode).join('&&')) + ")return null;"
  57124. )
  57125. }
  57126. function genFilterCode (key) {
  57127. var keyVal = parseInt(key, 10);
  57128. if (keyVal) {
  57129. return ("$event.keyCode!==" + keyVal)
  57130. }
  57131. var keyCode = keyCodes[key];
  57132. var keyName = keyNames[key];
  57133. return (
  57134. "_k($event.keyCode," +
  57135. (JSON.stringify(key)) + "," +
  57136. (JSON.stringify(keyCode)) + "," +
  57137. "$event.key," +
  57138. "" + (JSON.stringify(keyName)) +
  57139. ")"
  57140. )
  57141. }
  57142. /* */
  57143. function on (el, dir) {
  57144. if (dir.modifiers) {
  57145. warn("v-on without argument does not support modifiers.");
  57146. }
  57147. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  57148. }
  57149. /* */
  57150. function bind$1 (el, dir) {
  57151. el.wrapData = function (code) {
  57152. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  57153. };
  57154. }
  57155. /* */
  57156. var baseDirectives = {
  57157. on: on,
  57158. bind: bind$1,
  57159. cloak: noop
  57160. };
  57161. /* */
  57162. var CodegenState = function CodegenState (options) {
  57163. this.options = options;
  57164. this.warn = options.warn || baseWarn;
  57165. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  57166. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  57167. this.directives = extend(extend({}, baseDirectives), options.directives);
  57168. var isReservedTag = options.isReservedTag || no;
  57169. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57170. this.onceId = 0;
  57171. this.staticRenderFns = [];
  57172. this.pre = false;
  57173. };
  57174. function generate (
  57175. ast,
  57176. options
  57177. ) {
  57178. var state = new CodegenState(options);
  57179. var code = ast ? genElement(ast, state) : '_c("div")';
  57180. return {
  57181. render: ("with(this){return " + code + "}"),
  57182. staticRenderFns: state.staticRenderFns
  57183. }
  57184. }
  57185. function genElement (el, state) {
  57186. if (el.parent) {
  57187. el.pre = el.pre || el.parent.pre;
  57188. }
  57189. if (el.staticRoot && !el.staticProcessed) {
  57190. return genStatic(el, state)
  57191. } else if (el.once && !el.onceProcessed) {
  57192. return genOnce(el, state)
  57193. } else if (el.for && !el.forProcessed) {
  57194. return genFor(el, state)
  57195. } else if (el.if && !el.ifProcessed) {
  57196. return genIf(el, state)
  57197. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  57198. return genChildren(el, state) || 'void 0'
  57199. } else if (el.tag === 'slot') {
  57200. return genSlot(el, state)
  57201. } else {
  57202. // component or element
  57203. var code;
  57204. if (el.component) {
  57205. code = genComponent(el.component, el, state);
  57206. } else {
  57207. var data;
  57208. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  57209. data = genData$2(el, state);
  57210. }
  57211. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57212. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  57213. }
  57214. // module transforms
  57215. for (var i = 0; i < state.transforms.length; i++) {
  57216. code = state.transforms[i](el, code);
  57217. }
  57218. return code
  57219. }
  57220. }
  57221. // hoist static sub-trees out
  57222. function genStatic (el, state) {
  57223. el.staticProcessed = true;
  57224. // Some elements (templates) need to behave differently inside of a v-pre
  57225. // node. All pre nodes are static roots, so we can use this as a location to
  57226. // wrap a state change and reset it upon exiting the pre node.
  57227. var originalPreState = state.pre;
  57228. if (el.pre) {
  57229. state.pre = el.pre;
  57230. }
  57231. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  57232. state.pre = originalPreState;
  57233. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  57234. }
  57235. // v-once
  57236. function genOnce (el, state) {
  57237. el.onceProcessed = true;
  57238. if (el.if && !el.ifProcessed) {
  57239. return genIf(el, state)
  57240. } else if (el.staticInFor) {
  57241. var key = '';
  57242. var parent = el.parent;
  57243. while (parent) {
  57244. if (parent.for) {
  57245. key = parent.key;
  57246. break
  57247. }
  57248. parent = parent.parent;
  57249. }
  57250. if (!key) {
  57251. state.warn(
  57252. "v-once can only be used inside v-for that is keyed. ",
  57253. el.rawAttrsMap['v-once']
  57254. );
  57255. return genElement(el, state)
  57256. }
  57257. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  57258. } else {
  57259. return genStatic(el, state)
  57260. }
  57261. }
  57262. function genIf (
  57263. el,
  57264. state,
  57265. altGen,
  57266. altEmpty
  57267. ) {
  57268. el.ifProcessed = true; // avoid recursion
  57269. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  57270. }
  57271. function genIfConditions (
  57272. conditions,
  57273. state,
  57274. altGen,
  57275. altEmpty
  57276. ) {
  57277. if (!conditions.length) {
  57278. return altEmpty || '_e()'
  57279. }
  57280. var condition = conditions.shift();
  57281. if (condition.exp) {
  57282. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  57283. } else {
  57284. return ("" + (genTernaryExp(condition.block)))
  57285. }
  57286. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  57287. function genTernaryExp (el) {
  57288. return altGen
  57289. ? altGen(el, state)
  57290. : el.once
  57291. ? genOnce(el, state)
  57292. : genElement(el, state)
  57293. }
  57294. }
  57295. function genFor (
  57296. el,
  57297. state,
  57298. altGen,
  57299. altHelper
  57300. ) {
  57301. var exp = el.for;
  57302. var alias = el.alias;
  57303. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  57304. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  57305. if (state.maybeComponent(el) &&
  57306. el.tag !== 'slot' &&
  57307. el.tag !== 'template' &&
  57308. !el.key
  57309. ) {
  57310. state.warn(
  57311. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  57312. "v-for should have explicit keys. " +
  57313. "See https://vuejs.org/guide/list.html#key for more info.",
  57314. el.rawAttrsMap['v-for'],
  57315. true /* tip */
  57316. );
  57317. }
  57318. el.forProcessed = true; // avoid recursion
  57319. return (altHelper || '_l') + "((" + exp + ")," +
  57320. "function(" + alias + iterator1 + iterator2 + "){" +
  57321. "return " + ((altGen || genElement)(el, state)) +
  57322. '})'
  57323. }
  57324. function genData$2 (el, state) {
  57325. var data = '{';
  57326. // directives first.
  57327. // directives may mutate the el's other properties before they are generated.
  57328. var dirs = genDirectives(el, state);
  57329. if (dirs) { data += dirs + ','; }
  57330. // key
  57331. if (el.key) {
  57332. data += "key:" + (el.key) + ",";
  57333. }
  57334. // ref
  57335. if (el.ref) {
  57336. data += "ref:" + (el.ref) + ",";
  57337. }
  57338. if (el.refInFor) {
  57339. data += "refInFor:true,";
  57340. }
  57341. // pre
  57342. if (el.pre) {
  57343. data += "pre:true,";
  57344. }
  57345. // record original tag name for components using "is" attribute
  57346. if (el.component) {
  57347. data += "tag:\"" + (el.tag) + "\",";
  57348. }
  57349. // module data generation functions
  57350. for (var i = 0; i < state.dataGenFns.length; i++) {
  57351. data += state.dataGenFns[i](el);
  57352. }
  57353. // attributes
  57354. if (el.attrs) {
  57355. data += "attrs:" + (genProps(el.attrs)) + ",";
  57356. }
  57357. // DOM props
  57358. if (el.props) {
  57359. data += "domProps:" + (genProps(el.props)) + ",";
  57360. }
  57361. // event handlers
  57362. if (el.events) {
  57363. data += (genHandlers(el.events, false)) + ",";
  57364. }
  57365. if (el.nativeEvents) {
  57366. data += (genHandlers(el.nativeEvents, true)) + ",";
  57367. }
  57368. // slot target
  57369. // only for non-scoped slots
  57370. if (el.slotTarget && !el.slotScope) {
  57371. data += "slot:" + (el.slotTarget) + ",";
  57372. }
  57373. // scoped slots
  57374. if (el.scopedSlots) {
  57375. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  57376. }
  57377. // component v-model
  57378. if (el.model) {
  57379. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  57380. }
  57381. // inline-template
  57382. if (el.inlineTemplate) {
  57383. var inlineTemplate = genInlineTemplate(el, state);
  57384. if (inlineTemplate) {
  57385. data += inlineTemplate + ",";
  57386. }
  57387. }
  57388. data = data.replace(/,$/, '') + '}';
  57389. // v-bind dynamic argument wrap
  57390. // v-bind with dynamic arguments must be applied using the same v-bind object
  57391. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  57392. if (el.dynamicAttrs) {
  57393. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  57394. }
  57395. // v-bind data wrap
  57396. if (el.wrapData) {
  57397. data = el.wrapData(data);
  57398. }
  57399. // v-on data wrap
  57400. if (el.wrapListeners) {
  57401. data = el.wrapListeners(data);
  57402. }
  57403. return data
  57404. }
  57405. function genDirectives (el, state) {
  57406. var dirs = el.directives;
  57407. if (!dirs) { return }
  57408. var res = 'directives:[';
  57409. var hasRuntime = false;
  57410. var i, l, dir, needRuntime;
  57411. for (i = 0, l = dirs.length; i < l; i++) {
  57412. dir = dirs[i];
  57413. needRuntime = true;
  57414. var gen = state.directives[dir.name];
  57415. if (gen) {
  57416. // compile-time directive that manipulates AST.
  57417. // returns true if it also needs a runtime counterpart.
  57418. needRuntime = !!gen(el, dir, state.warn);
  57419. }
  57420. if (needRuntime) {
  57421. hasRuntime = true;
  57422. 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))) : '') + "},";
  57423. }
  57424. }
  57425. if (hasRuntime) {
  57426. return res.slice(0, -1) + ']'
  57427. }
  57428. }
  57429. function genInlineTemplate (el, state) {
  57430. var ast = el.children[0];
  57431. if (el.children.length !== 1 || ast.type !== 1) {
  57432. state.warn(
  57433. 'Inline-template components must have exactly one child element.',
  57434. { start: el.start }
  57435. );
  57436. }
  57437. if (ast && ast.type === 1) {
  57438. var inlineRenderFns = generate(ast, state.options);
  57439. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  57440. }
  57441. }
  57442. function genScopedSlots (
  57443. el,
  57444. slots,
  57445. state
  57446. ) {
  57447. // by default scoped slots are considered "stable", this allows child
  57448. // components with only scoped slots to skip forced updates from parent.
  57449. // but in some cases we have to bail-out of this optimization
  57450. // for example if the slot contains dynamic names, has v-if or v-for on them...
  57451. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  57452. var slot = slots[key];
  57453. return (
  57454. slot.slotTargetDynamic ||
  57455. slot.if ||
  57456. slot.for ||
  57457. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  57458. )
  57459. });
  57460. // #9534: if a component with scoped slots is inside a conditional branch,
  57461. // it's possible for the same component to be reused but with different
  57462. // compiled slot content. To avoid that, we generate a unique key based on
  57463. // the generated code of all the slot contents.
  57464. var needsKey = !!el.if;
  57465. // OR when it is inside another scoped slot or v-for (the reactivity may be
  57466. // disconnected due to the intermediate scope variable)
  57467. // #9438, #9506
  57468. // TODO: this can be further optimized by properly analyzing in-scope bindings
  57469. // and skip force updating ones that do not actually use scope variables.
  57470. if (!needsForceUpdate) {
  57471. var parent = el.parent;
  57472. while (parent) {
  57473. if (
  57474. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  57475. parent.for
  57476. ) {
  57477. needsForceUpdate = true;
  57478. break
  57479. }
  57480. if (parent.if) {
  57481. needsKey = true;
  57482. }
  57483. parent = parent.parent;
  57484. }
  57485. }
  57486. var generatedSlots = Object.keys(slots)
  57487. .map(function (key) { return genScopedSlot(slots[key], state); })
  57488. .join(',');
  57489. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  57490. }
  57491. function hash(str) {
  57492. var hash = 5381;
  57493. var i = str.length;
  57494. while(i) {
  57495. hash = (hash * 33) ^ str.charCodeAt(--i);
  57496. }
  57497. return hash >>> 0
  57498. }
  57499. function containsSlotChild (el) {
  57500. if (el.type === 1) {
  57501. if (el.tag === 'slot') {
  57502. return true
  57503. }
  57504. return el.children.some(containsSlotChild)
  57505. }
  57506. return false
  57507. }
  57508. function genScopedSlot (
  57509. el,
  57510. state
  57511. ) {
  57512. var isLegacySyntax = el.attrsMap['slot-scope'];
  57513. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  57514. return genIf(el, state, genScopedSlot, "null")
  57515. }
  57516. if (el.for && !el.forProcessed) {
  57517. return genFor(el, state, genScopedSlot)
  57518. }
  57519. var slotScope = el.slotScope === emptySlotScopeToken
  57520. ? ""
  57521. : String(el.slotScope);
  57522. var fn = "function(" + slotScope + "){" +
  57523. "return " + (el.tag === 'template'
  57524. ? el.if && isLegacySyntax
  57525. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  57526. : genChildren(el, state) || 'undefined'
  57527. : genElement(el, state)) + "}";
  57528. // reverse proxy v-slot without scope on this.$slots
  57529. var reverseProxy = slotScope ? "" : ",proxy:true";
  57530. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  57531. }
  57532. function genChildren (
  57533. el,
  57534. state,
  57535. checkSkip,
  57536. altGenElement,
  57537. altGenNode
  57538. ) {
  57539. var children = el.children;
  57540. if (children.length) {
  57541. var el$1 = children[0];
  57542. // optimize single v-for
  57543. if (children.length === 1 &&
  57544. el$1.for &&
  57545. el$1.tag !== 'template' &&
  57546. el$1.tag !== 'slot'
  57547. ) {
  57548. var normalizationType = checkSkip
  57549. ? state.maybeComponent(el$1) ? ",1" : ",0"
  57550. : "";
  57551. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  57552. }
  57553. var normalizationType$1 = checkSkip
  57554. ? getNormalizationType(children, state.maybeComponent)
  57555. : 0;
  57556. var gen = altGenNode || genNode;
  57557. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  57558. }
  57559. }
  57560. // determine the normalization needed for the children array.
  57561. // 0: no normalization needed
  57562. // 1: simple normalization needed (possible 1-level deep nested array)
  57563. // 2: full normalization needed
  57564. function getNormalizationType (
  57565. children,
  57566. maybeComponent
  57567. ) {
  57568. var res = 0;
  57569. for (var i = 0; i < children.length; i++) {
  57570. var el = children[i];
  57571. if (el.type !== 1) {
  57572. continue
  57573. }
  57574. if (needsNormalization(el) ||
  57575. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  57576. res = 2;
  57577. break
  57578. }
  57579. if (maybeComponent(el) ||
  57580. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  57581. res = 1;
  57582. }
  57583. }
  57584. return res
  57585. }
  57586. function needsNormalization (el) {
  57587. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  57588. }
  57589. function genNode (node, state) {
  57590. if (node.type === 1) {
  57591. return genElement(node, state)
  57592. } else if (node.type === 3 && node.isComment) {
  57593. return genComment(node)
  57594. } else {
  57595. return genText(node)
  57596. }
  57597. }
  57598. function genText (text) {
  57599. return ("_v(" + (text.type === 2
  57600. ? text.expression // no need for () because already wrapped in _s()
  57601. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  57602. }
  57603. function genComment (comment) {
  57604. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  57605. }
  57606. function genSlot (el, state) {
  57607. var slotName = el.slotName || '"default"';
  57608. var children = genChildren(el, state);
  57609. var res = "_t(" + slotName + (children ? ("," + children) : '');
  57610. var attrs = el.attrs || el.dynamicAttrs
  57611. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  57612. // slot props are camelized
  57613. name: camelize(attr.name),
  57614. value: attr.value,
  57615. dynamic: attr.dynamic
  57616. }); }))
  57617. : null;
  57618. var bind$$1 = el.attrsMap['v-bind'];
  57619. if ((attrs || bind$$1) && !children) {
  57620. res += ",null";
  57621. }
  57622. if (attrs) {
  57623. res += "," + attrs;
  57624. }
  57625. if (bind$$1) {
  57626. res += (attrs ? '' : ',null') + "," + bind$$1;
  57627. }
  57628. return res + ')'
  57629. }
  57630. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  57631. function genComponent (
  57632. componentName,
  57633. el,
  57634. state
  57635. ) {
  57636. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57637. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  57638. }
  57639. function genProps (props) {
  57640. var staticProps = "";
  57641. var dynamicProps = "";
  57642. for (var i = 0; i < props.length; i++) {
  57643. var prop = props[i];
  57644. var value = transformSpecialNewlines(prop.value);
  57645. if (prop.dynamic) {
  57646. dynamicProps += (prop.name) + "," + value + ",";
  57647. } else {
  57648. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  57649. }
  57650. }
  57651. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  57652. if (dynamicProps) {
  57653. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  57654. } else {
  57655. return staticProps
  57656. }
  57657. }
  57658. // #3895, #4268
  57659. function transformSpecialNewlines (text) {
  57660. return text
  57661. .replace(/\u2028/g, '\\u2028')
  57662. .replace(/\u2029/g, '\\u2029')
  57663. }
  57664. /* */
  57665. // these keywords should not appear inside expressions, but operators like
  57666. // typeof, instanceof and in are allowed
  57667. var prohibitedKeywordRE = new RegExp('\\b' + (
  57668. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  57669. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  57670. 'extends,finally,continue,debugger,function,arguments'
  57671. ).split(',').join('\\b|\\b') + '\\b');
  57672. // these unary operators should not be used as property/method names
  57673. var unaryOperatorsRE = new RegExp('\\b' + (
  57674. 'delete,typeof,void'
  57675. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  57676. // strip strings in expressions
  57677. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  57678. // detect problematic expressions in a template
  57679. function detectErrors (ast, warn) {
  57680. if (ast) {
  57681. checkNode(ast, warn);
  57682. }
  57683. }
  57684. function checkNode (node, warn) {
  57685. if (node.type === 1) {
  57686. for (var name in node.attrsMap) {
  57687. if (dirRE.test(name)) {
  57688. var value = node.attrsMap[name];
  57689. if (value) {
  57690. var range = node.rawAttrsMap[name];
  57691. if (name === 'v-for') {
  57692. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  57693. } else if (name === 'v-slot' || name[0] === '#') {
  57694. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  57695. } else if (onRE.test(name)) {
  57696. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  57697. } else {
  57698. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  57699. }
  57700. }
  57701. }
  57702. }
  57703. if (node.children) {
  57704. for (var i = 0; i < node.children.length; i++) {
  57705. checkNode(node.children[i], warn);
  57706. }
  57707. }
  57708. } else if (node.type === 2) {
  57709. checkExpression(node.expression, node.text, warn, node);
  57710. }
  57711. }
  57712. function checkEvent (exp, text, warn, range) {
  57713. var stripped = exp.replace(stripStringRE, '');
  57714. var keywordMatch = stripped.match(unaryOperatorsRE);
  57715. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  57716. warn(
  57717. "avoid using JavaScript unary operator as property name: " +
  57718. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  57719. range
  57720. );
  57721. }
  57722. checkExpression(exp, text, warn, range);
  57723. }
  57724. function checkFor (node, text, warn, range) {
  57725. checkExpression(node.for || '', text, warn, range);
  57726. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  57727. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  57728. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  57729. }
  57730. function checkIdentifier (
  57731. ident,
  57732. type,
  57733. text,
  57734. warn,
  57735. range
  57736. ) {
  57737. if (typeof ident === 'string') {
  57738. try {
  57739. new Function(("var " + ident + "=_"));
  57740. } catch (e) {
  57741. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  57742. }
  57743. }
  57744. }
  57745. function checkExpression (exp, text, warn, range) {
  57746. try {
  57747. new Function(("return " + exp));
  57748. } catch (e) {
  57749. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  57750. if (keywordMatch) {
  57751. warn(
  57752. "avoid using JavaScript keyword as property name: " +
  57753. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  57754. range
  57755. );
  57756. } else {
  57757. warn(
  57758. "invalid expression: " + (e.message) + " in\n\n" +
  57759. " " + exp + "\n\n" +
  57760. " Raw expression: " + (text.trim()) + "\n",
  57761. range
  57762. );
  57763. }
  57764. }
  57765. }
  57766. function checkFunctionParameterExpression (exp, text, warn, range) {
  57767. try {
  57768. new Function(exp, '');
  57769. } catch (e) {
  57770. warn(
  57771. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  57772. " " + exp + "\n\n" +
  57773. " Raw expression: " + (text.trim()) + "\n",
  57774. range
  57775. );
  57776. }
  57777. }
  57778. /* */
  57779. var range = 2;
  57780. function generateCodeFrame (
  57781. source,
  57782. start,
  57783. end
  57784. ) {
  57785. if ( start === void 0 ) start = 0;
  57786. if ( end === void 0 ) end = source.length;
  57787. var lines = source.split(/\r?\n/);
  57788. var count = 0;
  57789. var res = [];
  57790. for (var i = 0; i < lines.length; i++) {
  57791. count += lines[i].length + 1;
  57792. if (count >= start) {
  57793. for (var j = i - range; j <= i + range || end > count; j++) {
  57794. if (j < 0 || j >= lines.length) { continue }
  57795. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  57796. var lineLength = lines[j].length;
  57797. if (j === i) {
  57798. // push underline
  57799. var pad = start - (count - lineLength) + 1;
  57800. var length = end > count ? lineLength - pad : end - start;
  57801. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  57802. } else if (j > i) {
  57803. if (end > count) {
  57804. var length$1 = Math.min(end - count, lineLength);
  57805. res.push(" | " + repeat$1("^", length$1));
  57806. }
  57807. count += lineLength + 1;
  57808. }
  57809. }
  57810. break
  57811. }
  57812. }
  57813. return res.join('\n')
  57814. }
  57815. function repeat$1 (str, n) {
  57816. var result = '';
  57817. if (n > 0) {
  57818. while (true) { // eslint-disable-line
  57819. if (n & 1) { result += str; }
  57820. n >>>= 1;
  57821. if (n <= 0) { break }
  57822. str += str;
  57823. }
  57824. }
  57825. return result
  57826. }
  57827. /* */
  57828. function createFunction (code, errors) {
  57829. try {
  57830. return new Function(code)
  57831. } catch (err) {
  57832. errors.push({ err: err, code: code });
  57833. return noop
  57834. }
  57835. }
  57836. function createCompileToFunctionFn (compile) {
  57837. var cache = Object.create(null);
  57838. return function compileToFunctions (
  57839. template,
  57840. options,
  57841. vm
  57842. ) {
  57843. options = extend({}, options);
  57844. var warn$$1 = options.warn || warn;
  57845. delete options.warn;
  57846. /* istanbul ignore if */
  57847. {
  57848. // detect possible CSP restriction
  57849. try {
  57850. new Function('return 1');
  57851. } catch (e) {
  57852. if (e.toString().match(/unsafe-eval|CSP/)) {
  57853. warn$$1(
  57854. 'It seems you are using the standalone build of Vue.js in an ' +
  57855. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  57856. 'The template compiler cannot work in this environment. Consider ' +
  57857. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  57858. 'templates into render functions.'
  57859. );
  57860. }
  57861. }
  57862. }
  57863. // check cache
  57864. var key = options.delimiters
  57865. ? String(options.delimiters) + template
  57866. : template;
  57867. if (cache[key]) {
  57868. return cache[key]
  57869. }
  57870. // compile
  57871. var compiled = compile(template, options);
  57872. // check compilation errors/tips
  57873. {
  57874. if (compiled.errors && compiled.errors.length) {
  57875. if (options.outputSourceRange) {
  57876. compiled.errors.forEach(function (e) {
  57877. warn$$1(
  57878. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  57879. generateCodeFrame(template, e.start, e.end),
  57880. vm
  57881. );
  57882. });
  57883. } else {
  57884. warn$$1(
  57885. "Error compiling template:\n\n" + template + "\n\n" +
  57886. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  57887. vm
  57888. );
  57889. }
  57890. }
  57891. if (compiled.tips && compiled.tips.length) {
  57892. if (options.outputSourceRange) {
  57893. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  57894. } else {
  57895. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  57896. }
  57897. }
  57898. }
  57899. // turn code into functions
  57900. var res = {};
  57901. var fnGenErrors = [];
  57902. res.render = createFunction(compiled.render, fnGenErrors);
  57903. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  57904. return createFunction(code, fnGenErrors)
  57905. });
  57906. // check function generation errors.
  57907. // this should only happen if there is a bug in the compiler itself.
  57908. // mostly for codegen development use
  57909. /* istanbul ignore if */
  57910. {
  57911. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  57912. warn$$1(
  57913. "Failed to generate render function:\n\n" +
  57914. fnGenErrors.map(function (ref) {
  57915. var err = ref.err;
  57916. var code = ref.code;
  57917. return ((err.toString()) + " in\n\n" + code + "\n");
  57918. }).join('\n'),
  57919. vm
  57920. );
  57921. }
  57922. }
  57923. return (cache[key] = res)
  57924. }
  57925. }
  57926. /* */
  57927. function createCompilerCreator (baseCompile) {
  57928. return function createCompiler (baseOptions) {
  57929. function compile (
  57930. template,
  57931. options
  57932. ) {
  57933. var finalOptions = Object.create(baseOptions);
  57934. var errors = [];
  57935. var tips = [];
  57936. var warn = function (msg, range, tip) {
  57937. (tip ? tips : errors).push(msg);
  57938. };
  57939. if (options) {
  57940. if (options.outputSourceRange) {
  57941. // $flow-disable-line
  57942. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  57943. warn = function (msg, range, tip) {
  57944. var data = { msg: msg };
  57945. if (range) {
  57946. if (range.start != null) {
  57947. data.start = range.start + leadingSpaceLength;
  57948. }
  57949. if (range.end != null) {
  57950. data.end = range.end + leadingSpaceLength;
  57951. }
  57952. }
  57953. (tip ? tips : errors).push(data);
  57954. };
  57955. }
  57956. // merge custom modules
  57957. if (options.modules) {
  57958. finalOptions.modules =
  57959. (baseOptions.modules || []).concat(options.modules);
  57960. }
  57961. // merge custom directives
  57962. if (options.directives) {
  57963. finalOptions.directives = extend(
  57964. Object.create(baseOptions.directives || null),
  57965. options.directives
  57966. );
  57967. }
  57968. // copy other options
  57969. for (var key in options) {
  57970. if (key !== 'modules' && key !== 'directives') {
  57971. finalOptions[key] = options[key];
  57972. }
  57973. }
  57974. }
  57975. finalOptions.warn = warn;
  57976. var compiled = baseCompile(template.trim(), finalOptions);
  57977. {
  57978. detectErrors(compiled.ast, warn);
  57979. }
  57980. compiled.errors = errors;
  57981. compiled.tips = tips;
  57982. return compiled
  57983. }
  57984. return {
  57985. compile: compile,
  57986. compileToFunctions: createCompileToFunctionFn(compile)
  57987. }
  57988. }
  57989. }
  57990. /* */
  57991. // `createCompilerCreator` allows creating compilers that use alternative
  57992. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  57993. // Here we just export a default compiler using the default parts.
  57994. var createCompiler = createCompilerCreator(function baseCompile (
  57995. template,
  57996. options
  57997. ) {
  57998. var ast = parse(template.trim(), options);
  57999. if (options.optimize !== false) {
  58000. optimize(ast, options);
  58001. }
  58002. var code = generate(ast, options);
  58003. return {
  58004. ast: ast,
  58005. render: code.render,
  58006. staticRenderFns: code.staticRenderFns
  58007. }
  58008. });
  58009. /* */
  58010. var ref$1 = createCompiler(baseOptions);
  58011. var compile = ref$1.compile;
  58012. var compileToFunctions = ref$1.compileToFunctions;
  58013. /* */
  58014. // check whether current browser encodes a char inside attribute values
  58015. var div;
  58016. function getShouldDecode (href) {
  58017. div = div || document.createElement('div');
  58018. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  58019. return div.innerHTML.indexOf('&#10;') > 0
  58020. }
  58021. // #3663: IE encodes newlines inside attribute values while other browsers don't
  58022. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  58023. // #6828: chrome encodes content in a[href]
  58024. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  58025. /* */
  58026. var idToTemplate = cached(function (id) {
  58027. var el = query(id);
  58028. return el && el.innerHTML
  58029. });
  58030. var mount = Vue.prototype.$mount;
  58031. Vue.prototype.$mount = function (
  58032. el,
  58033. hydrating
  58034. ) {
  58035. el = el && query(el);
  58036. /* istanbul ignore if */
  58037. if (el === document.body || el === document.documentElement) {
  58038. warn(
  58039. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  58040. );
  58041. return this
  58042. }
  58043. var options = this.$options;
  58044. // resolve template/el and convert to render function
  58045. if (!options.render) {
  58046. var template = options.template;
  58047. if (template) {
  58048. if (typeof template === 'string') {
  58049. if (template.charAt(0) === '#') {
  58050. template = idToTemplate(template);
  58051. /* istanbul ignore if */
  58052. if (!template) {
  58053. warn(
  58054. ("Template element not found or is empty: " + (options.template)),
  58055. this
  58056. );
  58057. }
  58058. }
  58059. } else if (template.nodeType) {
  58060. template = template.innerHTML;
  58061. } else {
  58062. {
  58063. warn('invalid template option:' + template, this);
  58064. }
  58065. return this
  58066. }
  58067. } else if (el) {
  58068. template = getOuterHTML(el);
  58069. }
  58070. if (template) {
  58071. /* istanbul ignore if */
  58072. if (config.performance && mark) {
  58073. mark('compile');
  58074. }
  58075. var ref = compileToFunctions(template, {
  58076. outputSourceRange: "development" !== 'production',
  58077. shouldDecodeNewlines: shouldDecodeNewlines,
  58078. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  58079. delimiters: options.delimiters,
  58080. comments: options.comments
  58081. }, this);
  58082. var render = ref.render;
  58083. var staticRenderFns = ref.staticRenderFns;
  58084. options.render = render;
  58085. options.staticRenderFns = staticRenderFns;
  58086. /* istanbul ignore if */
  58087. if (config.performance && mark) {
  58088. mark('compile end');
  58089. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  58090. }
  58091. }
  58092. }
  58093. return mount.call(this, el, hydrating)
  58094. };
  58095. /**
  58096. * Get outerHTML of elements, taking care
  58097. * of SVG elements in IE as well.
  58098. */
  58099. function getOuterHTML (el) {
  58100. if (el.outerHTML) {
  58101. return el.outerHTML
  58102. } else {
  58103. var container = document.createElement('div');
  58104. container.appendChild(el.cloneNode(true));
  58105. return container.innerHTML
  58106. }
  58107. }
  58108. Vue.compile = compileToFunctions;
  58109. module.exports = Vue;
  58110. /* 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))
  58111. /***/ }),
  58112. /***/ "./node_modules/vue/dist/vue.common.js":
  58113. /*!*********************************************!*\
  58114. !*** ./node_modules/vue/dist/vue.common.js ***!
  58115. \*********************************************/
  58116. /*! no static exports found */
  58117. /***/ (function(module, exports, __webpack_require__) {
  58118. if (false) {} else {
  58119. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  58120. }
  58121. /***/ }),
  58122. /***/ "./node_modules/webpack/buildin/global.js":
  58123. /*!***********************************!*\
  58124. !*** (webpack)/buildin/global.js ***!
  58125. \***********************************/
  58126. /*! no static exports found */
  58127. /***/ (function(module, exports) {
  58128. var g;
  58129. // This works in non-strict mode
  58130. g = (function() {
  58131. return this;
  58132. })();
  58133. try {
  58134. // This works if eval is allowed (see CSP)
  58135. g = g || new Function("return this")();
  58136. } catch (e) {
  58137. // This works if the window reference is available
  58138. if (typeof window === "object") g = window;
  58139. }
  58140. // g can still be undefined, but nothing to do about it...
  58141. // We return undefined, instead of nothing here, so it's
  58142. // easier to handle this case. if(!global) { ...}
  58143. module.exports = g;
  58144. /***/ }),
  58145. /***/ "./node_modules/webpack/buildin/module.js":
  58146. /*!***********************************!*\
  58147. !*** (webpack)/buildin/module.js ***!
  58148. \***********************************/
  58149. /*! no static exports found */
  58150. /***/ (function(module, exports) {
  58151. module.exports = function(module) {
  58152. if (!module.webpackPolyfill) {
  58153. module.deprecate = function() {};
  58154. module.paths = [];
  58155. // module.parent = undefined by default
  58156. if (!module.children) module.children = [];
  58157. Object.defineProperty(module, "loaded", {
  58158. enumerable: true,
  58159. get: function() {
  58160. return module.l;
  58161. }
  58162. });
  58163. Object.defineProperty(module, "id", {
  58164. enumerable: true,
  58165. get: function() {
  58166. return module.i;
  58167. }
  58168. });
  58169. module.webpackPolyfill = 1;
  58170. }
  58171. return module;
  58172. };
  58173. /***/ }),
  58174. /***/ "./resources/js/app.js":
  58175. /*!*****************************!*\
  58176. !*** ./resources/js/app.js ***!
  58177. \*****************************/
  58178. /*! no exports provided */
  58179. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58180. "use strict";
  58181. __webpack_require__.r(__webpack_exports__);
  58182. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  58183. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  58184. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  58185. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  58186. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  58187. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  58188. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  58189. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  58190. /**
  58191. * First we will load all of this project's JavaScript dependencies which
  58192. * includes Vue and other libraries. It is a great starting point when
  58193. * building robust, powerful web applications using Vue and Laravel.
  58194. */
  58195. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  58196. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  58197. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  58198. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  58199. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  58200. mode: 'history',
  58201. routes: [{
  58202. path: '/',
  58203. name: 'home',
  58204. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  58205. }, {
  58206. path: '/login',
  58207. name: 'login',
  58208. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  58209. }, {
  58210. path: '/dashboard',
  58211. name: 'dashboard',
  58212. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  58213. }, {
  58214. path: '/workorders/:id',
  58215. name: 'workorders',
  58216. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  58217. props: true
  58218. }]
  58219. });
  58220. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  58221. el: '#app',
  58222. components: {
  58223. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  58224. },
  58225. router: router
  58226. });
  58227. $(function () {
  58228. $('[data-toggle="tooltip"]').tooltip();
  58229. });
  58230. var clipboard = new Clipboard('.btn-clip');
  58231. clipboard.on('success', function (e) {
  58232. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  58233. position: "right",
  58234. className: 'success'
  58235. });
  58236. e.clearSelection();
  58237. });
  58238. /***/ }),
  58239. /***/ "./resources/js/bootstrap.js":
  58240. /*!***********************************!*\
  58241. !*** ./resources/js/bootstrap.js ***!
  58242. \***********************************/
  58243. /*! no exports provided */
  58244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58245. "use strict";
  58246. __webpack_require__.r(__webpack_exports__);
  58247. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  58248. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  58249. /**
  58250. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  58251. * for JavaScript based Bootstrap features such as modals and tabs. This
  58252. * code may be modified to fit the specific needs of your application.
  58253. */
  58254. try {
  58255. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  58256. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  58257. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  58258. } catch (e) {}
  58259. /**
  58260. * We'll load the axios HTTP library which allows us to easily issue requests
  58261. * to our Laravel back-end. This library automatically handles sending the
  58262. * CSRF token as a header based on the value of the "XSRF" token cookie.
  58263. */
  58264. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  58265. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  58266. /**
  58267. * Echo exposes an expressive API for subscribing to channels and listening
  58268. * for events that are broadcast by Laravel. Echo and event broadcasting
  58269. * allows your team to easily build robust real-time web applications.
  58270. */
  58271. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  58272. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  58273. broadcaster: 'pusher',
  58274. key: "upccrt",
  58275. authEndpoint: '/broadcasting/auth',
  58276. wsHost: window.location.hostname,
  58277. wsPort: 6001,
  58278. disableStats: true
  58279. });
  58280. /***/ }),
  58281. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  58282. /*!****************************************************************!*\
  58283. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  58284. \****************************************************************/
  58285. /*! exports provided: default */
  58286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58287. "use strict";
  58288. __webpack_require__.r(__webpack_exports__);
  58289. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  58290. /* harmony import */ var _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  58291. /* 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");
  58292. /* normalize component */
  58293. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58294. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58295. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  58296. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58297. false,
  58298. null,
  58299. null,
  58300. null
  58301. )
  58302. /* hot reload */
  58303. if (false) { var api; }
  58304. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  58305. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58306. /***/ }),
  58307. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  58308. /*!*****************************************************************************************!*\
  58309. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  58310. \*****************************************************************************************/
  58311. /*! exports provided: default */
  58312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58313. "use strict";
  58314. __webpack_require__.r(__webpack_exports__);
  58315. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_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!./AutocompleteCustomDropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&");
  58316. /* 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_AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58317. /***/ }),
  58318. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  58319. /*!***********************************************************************************************!*\
  58320. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  58321. \***********************************************************************************************/
  58322. /*! exports provided: render, staticRenderFns */
  58323. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58324. "use strict";
  58325. __webpack_require__.r(__webpack_exports__);
  58326. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___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!./AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&");
  58327. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58328. /* 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_AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58329. /***/ }),
  58330. /***/ "./resources/js/components/CircleSpinner.vue":
  58331. /*!***************************************************!*\
  58332. !*** ./resources/js/components/CircleSpinner.vue ***!
  58333. \***************************************************/
  58334. /*! no static exports found */
  58335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58336. "use strict";
  58337. __webpack_require__.r(__webpack_exports__);
  58338. /* harmony import */ var _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  58339. /* harmony import */ var _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=script&lang=js& */ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  58340. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  58341. /* harmony import */ var _CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  58342. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  58343. /* normalize component */
  58344. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  58345. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58346. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  58347. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58348. false,
  58349. null,
  58350. "9a543b64",
  58351. null
  58352. )
  58353. /* hot reload */
  58354. if (false) { var api; }
  58355. component.options.__file = "resources/js/components/CircleSpinner.vue"
  58356. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58357. /***/ }),
  58358. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  58359. /*!****************************************************************************!*\
  58360. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  58361. \****************************************************************************/
  58362. /*! no static exports found */
  58363. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58364. "use strict";
  58365. __webpack_require__.r(__webpack_exports__);
  58366. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_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!./CircleSpinner.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&");
  58367. /* 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_CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58368. /***/ }),
  58369. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  58370. /*!************************************************************************************************************!*\
  58371. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  58372. \************************************************************************************************************/
  58373. /*! no static exports found */
  58374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58375. "use strict";
  58376. __webpack_require__.r(__webpack_exports__);
  58377. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&");
  58378. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  58379. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  58380. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_style_index_0_id_9a543b64_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  58381. /***/ }),
  58382. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  58383. /*!**********************************************************************************************!*\
  58384. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  58385. \**********************************************************************************************/
  58386. /*! exports provided: render, staticRenderFns */
  58387. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58388. "use strict";
  58389. __webpack_require__.r(__webpack_exports__);
  58390. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___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!./CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&");
  58391. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58392. /* 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_CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58393. /***/ }),
  58394. /***/ "./resources/js/components/Modal.vue":
  58395. /*!*******************************************!*\
  58396. !*** ./resources/js/components/Modal.vue ***!
  58397. \*******************************************/
  58398. /*! exports provided: default */
  58399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58400. "use strict";
  58401. __webpack_require__.r(__webpack_exports__);
  58402. /* harmony import */ var _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Modal.vue?vue&type=template&id=53ab54d2& */ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  58403. /* 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");
  58404. var script = {}
  58405. /* normalize component */
  58406. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  58407. script,
  58408. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  58409. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58410. false,
  58411. null,
  58412. null,
  58413. null
  58414. )
  58415. /* hot reload */
  58416. if (false) { var api; }
  58417. component.options.__file = "resources/js/components/Modal.vue"
  58418. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58419. /***/ }),
  58420. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  58421. /*!**************************************************************************!*\
  58422. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  58423. \**************************************************************************/
  58424. /*! exports provided: render, staticRenderFns */
  58425. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58426. "use strict";
  58427. __webpack_require__.r(__webpack_exports__);
  58428. /* 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_53ab54d2___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=53ab54d2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&");
  58429. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58430. /* 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_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58431. /***/ }),
  58432. /***/ "./resources/js/components/WoInfoEditModal.vue":
  58433. /*!*****************************************************!*\
  58434. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  58435. \*****************************************************/
  58436. /*! exports provided: default */
  58437. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58438. "use strict";
  58439. __webpack_require__.r(__webpack_exports__);
  58440. /* harmony import */ var _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  58441. /* harmony import */ var _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  58442. /* 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");
  58443. /* normalize component */
  58444. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58445. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58446. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  58447. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58448. false,
  58449. null,
  58450. null,
  58451. null
  58452. )
  58453. /* hot reload */
  58454. if (false) { var api; }
  58455. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  58456. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58457. /***/ }),
  58458. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  58459. /*!******************************************************************************!*\
  58460. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  58461. \******************************************************************************/
  58462. /*! exports provided: default */
  58463. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58464. "use strict";
  58465. __webpack_require__.r(__webpack_exports__);
  58466. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_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!./WoInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&");
  58467. /* 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_WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58468. /***/ }),
  58469. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  58470. /*!************************************************************************************!*\
  58471. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  58472. \************************************************************************************/
  58473. /*! exports provided: render, staticRenderFns */
  58474. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58475. "use strict";
  58476. __webpack_require__.r(__webpack_exports__);
  58477. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___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!./WoInfoEditModal.vue?vue&type=template&id=352dd7a2& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&");
  58478. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58479. /* 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_WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58480. /***/ }),
  58481. /***/ "./resources/js/components/WorkOrderInfo.vue":
  58482. /*!***************************************************!*\
  58483. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  58484. \***************************************************/
  58485. /*! exports provided: default */
  58486. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58487. "use strict";
  58488. __webpack_require__.r(__webpack_exports__);
  58489. /* harmony import */ var _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  58490. /* harmony import */ var _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  58491. /* 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");
  58492. /* normalize component */
  58493. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58494. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58495. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  58496. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58497. false,
  58498. null,
  58499. null,
  58500. null
  58501. )
  58502. /* hot reload */
  58503. if (false) { var api; }
  58504. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  58505. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58506. /***/ }),
  58507. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  58508. /*!****************************************************************************!*\
  58509. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  58510. \****************************************************************************/
  58511. /*! exports provided: default */
  58512. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58513. "use strict";
  58514. __webpack_require__.r(__webpack_exports__);
  58515. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_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!./WorkOrderInfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&");
  58516. /* 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_WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58517. /***/ }),
  58518. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  58519. /*!**********************************************************************************!*\
  58520. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  58521. \**********************************************************************************/
  58522. /*! exports provided: render, staticRenderFns */
  58523. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58524. "use strict";
  58525. __webpack_require__.r(__webpack_exports__);
  58526. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrderInfo_vue_vue_type_template_id_50116330___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!./WorkOrderInfo.vue?vue&type=template&id=50116330& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&");
  58527. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58528. /* 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_WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58529. /***/ }),
  58530. /***/ "./resources/js/mixins/dateMixin.js":
  58531. /*!******************************************!*\
  58532. !*** ./resources/js/mixins/dateMixin.js ***!
  58533. \******************************************/
  58534. /*! exports provided: default */
  58535. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58536. "use strict";
  58537. __webpack_require__.r(__webpack_exports__);
  58538. /* harmony default export */ __webpack_exports__["default"] = ({
  58539. methods: {
  58540. treatAsUTC: function treatAsUTC(date) {
  58541. var result = new Date(date);
  58542. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  58543. return result;
  58544. },
  58545. daysSinceToday: function daysSinceToday(date) {
  58546. var currentDate = new Date();
  58547. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  58548. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  58549. },
  58550. getHRDate: function getHRDate(dateString) {
  58551. var date = new Date(dateString);
  58552. return date.toLocaleString('default', {
  58553. month: 'short',
  58554. day: 'numeric',
  58555. year: 'numeric',
  58556. hour: 'numeric',
  58557. minute: 'numeric'
  58558. });
  58559. },
  58560. isZero: function isZero(dateString) {
  58561. return dateString === '0000-00-00 00:00:00';
  58562. }
  58563. }
  58564. });
  58565. /***/ }),
  58566. /***/ "./resources/js/notify.min.js":
  58567. /*!************************************!*\
  58568. !*** ./resources/js/notify.min.js ***!
  58569. \************************************/
  58570. /*! no static exports found */
  58571. /***/ (function(module, exports, __webpack_require__) {
  58572. 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); }
  58573. (function (e) {
  58574. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  58575. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  58576. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  58577. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  58578. })(function (e) {
  58579. function A(t, n, i) {
  58580. typeof i == "string" && (i = {
  58581. className: i
  58582. }), 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);
  58583. }
  58584. var t = [].indexOf || function (e) {
  58585. for (var t = 0, n = this.length; t < n; t++) {
  58586. if (t in this && this[t] === e) return t;
  58587. }
  58588. return -1;
  58589. },
  58590. n = "notify",
  58591. r = n + "js",
  58592. i = n + "!blank",
  58593. s = {
  58594. t: "top",
  58595. m: "middle",
  58596. b: "bottom",
  58597. l: "left",
  58598. c: "center",
  58599. r: "right"
  58600. },
  58601. o = ["l", "c", "r"],
  58602. u = ["t", "m", "b"],
  58603. a = ["t", "b", "l", "r"],
  58604. f = {
  58605. t: "b",
  58606. m: null,
  58607. b: "t",
  58608. l: "r",
  58609. c: null,
  58610. r: "l"
  58611. },
  58612. l = function l(t) {
  58613. var n;
  58614. return n = [], e.each(t.split(/\W+/), function (e, t) {
  58615. var r;
  58616. r = t.toLowerCase().charAt(0);
  58617. if (s[r]) return n.push(r);
  58618. }), n;
  58619. },
  58620. c = {},
  58621. h = {
  58622. name: "core",
  58623. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  58624. 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}"
  58625. },
  58626. p = {
  58627. "border-radius": ["-webkit-", "-moz-"]
  58628. },
  58629. d = function d(e) {
  58630. return c[e];
  58631. },
  58632. v = function v(e) {
  58633. if (!e) throw "Missing Style name";
  58634. c[e] && delete c[e];
  58635. },
  58636. m = function m(t, i) {
  58637. if (!t) throw "Missing Style name";
  58638. if (!i) throw "Missing Style definition";
  58639. if (!i.html) throw "Missing Style HTML";
  58640. var s = c[t];
  58641. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  58642. var o = "";
  58643. i.classes && e.each(i.classes, function (t, n) {
  58644. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  58645. return p[t] && e.each(p[t], function (e, r) {
  58646. return o += " " + r + t + ": " + n + ";\n";
  58647. }), o += " " + t + ": " + n + ";\n";
  58648. }), o += "}\n";
  58649. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  58650. var u = {},
  58651. a = e(i.html);
  58652. y("html", a, u), y("text", a, u), i.fields = u;
  58653. },
  58654. g = function g(t) {
  58655. var n, r, i;
  58656. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  58657. try {
  58658. r.html(t);
  58659. } catch (s) {
  58660. r[0].styleSheet.cssText = t;
  58661. }
  58662. return r;
  58663. },
  58664. y = function y(t, n, r) {
  58665. var s;
  58666. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  58667. var n;
  58668. n = e(this).attr(s), n || (n = i), r[n] = t;
  58669. });
  58670. },
  58671. b = function b(e, t) {
  58672. return e.is(t) ? e : e.find(t);
  58673. },
  58674. w = {
  58675. clickToHide: !0,
  58676. autoHide: !0,
  58677. autoHideDelay: 5e3,
  58678. arrowShow: !0,
  58679. arrowSize: 5,
  58680. breakNewLines: !0,
  58681. elementPosition: "bottom",
  58682. globalPosition: "top right",
  58683. style: "bootstrap",
  58684. className: "error",
  58685. showAnimation: "slideDown",
  58686. showDuration: 400,
  58687. hideAnimation: "slideUp",
  58688. hideDuration: 200,
  58689. gap: 5
  58690. },
  58691. E = function E(t, n) {
  58692. var r;
  58693. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  58694. },
  58695. S = function S(t) {
  58696. return e.extend(w, t);
  58697. },
  58698. x = function x(t) {
  58699. return e("<" + t + "></" + t + ">");
  58700. },
  58701. T = {},
  58702. N = function N(t) {
  58703. var n;
  58704. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  58705. return e(r).attr("name") === t.attr("name");
  58706. }), t = n.first()), t;
  58707. },
  58708. C = function C(e, t, n) {
  58709. var r, i;
  58710. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  58711. if (isNaN(n)) return;
  58712. 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;
  58713. },
  58714. k = function k(e, t, n) {
  58715. if (e === "l" || e === "t") return 0;
  58716. if (e === "c" || e === "m") return n / 2 - t / 2;
  58717. if (e === "r" || e === "b") return n - t;
  58718. throw "Invalid alignment";
  58719. },
  58720. L = function L(e) {
  58721. return L.e = L.e || x("div"), L.e.text(e).html();
  58722. };
  58723. A.prototype.loadHTML = function () {
  58724. var t;
  58725. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  58726. }, A.prototype.show = function (e, t) {
  58727. var n, r, i, s, o;
  58728. r = function (n) {
  58729. return function () {
  58730. !e && !n.elem && n.destroy();
  58731. if (t) return t();
  58732. };
  58733. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  58734. 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 {
  58735. if (!!o || !!e) return r();
  58736. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  58737. }
  58738. return n.push(r), i[s].apply(i, n);
  58739. }, A.prototype.setGlobalPosition = function () {
  58740. var t = this.getPosition(),
  58741. n = t[0],
  58742. i = t[1],
  58743. o = s[n],
  58744. u = s[i],
  58745. a = n + "|" + i,
  58746. f = T[a];
  58747. if (!f || !document.body.contains(f[0])) {
  58748. f = T[a] = x("div");
  58749. var l = {};
  58750. 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);
  58751. }
  58752. return f.prepend(this.wrapper);
  58753. }, A.prototype.setElementPosition = function () {
  58754. 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;
  58755. 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"];
  58756. for (w = 0, S = B.length; w < S; w++) {
  58757. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  58758. }
  58759. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  58760. if (!this.options.arrowShow) this.arrow.hide();else {
  58761. 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";
  58762. for (E = 0, x = a.length; E < x; E++) {
  58763. D = a[E], P = s[D];
  58764. if (D === L) continue;
  58765. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  58766. }
  58767. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  58768. }
  58769. 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);
  58770. if (r) return this.arrow.removeAttr("style").css(r);
  58771. }, A.prototype.getPosition = function () {
  58772. var e, n, r, i, s, f, c, h;
  58773. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  58774. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  58775. 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";
  58776. return e.length === 2 && (e[2] = e[1]), e;
  58777. }, A.prototype.getStyle = function (e) {
  58778. var t;
  58779. e || (e = this.options.style), e || (e = "default"), t = c[e];
  58780. if (!t) throw "Missing style: " + e;
  58781. return t;
  58782. }, A.prototype.updateClasses = function () {
  58783. var t, n;
  58784. 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) {
  58785. return r + "-" + n.name + "-" + e;
  58786. }).join(" "), this.userContainer.attr("class", t);
  58787. }, A.prototype.run = function (t, n) {
  58788. var r, s, o, u, a;
  58789. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  58790. if (this.container && !t) {
  58791. this.show(!1);
  58792. return;
  58793. }
  58794. if (!this.container && !t) return;
  58795. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  58796. for (o in s) {
  58797. r = s[o], u = this.userFields[o];
  58798. if (!u) continue;
  58799. 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);
  58800. }
  58801. 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));
  58802. }, A.prototype.destroy = function () {
  58803. this.wrapper.data(r, null), this.wrapper.remove();
  58804. }, e[n] = function (t, r, i) {
  58805. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  58806. }, e.fn[n] = function (t, n) {
  58807. return e(this).each(function () {
  58808. var i = N(e(this)).data(r);
  58809. i && i.destroy();
  58810. var s = new A(e(this), t, n);
  58811. }), this;
  58812. }, e.extend(e[n], {
  58813. defaults: S,
  58814. addStyle: m,
  58815. removeStyle: v,
  58816. pluginOptions: w,
  58817. getStyle: d,
  58818. insertCSS: g
  58819. }), m("bootstrap", {
  58820. html: "<div>\n<span data-notify-text></span>\n</div>",
  58821. classes: {
  58822. base: {
  58823. "font-weight": "bold",
  58824. padding: "8px 15px 8px 14px",
  58825. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  58826. "background-color": "#fcf8e3",
  58827. border: "1px solid #fbeed5",
  58828. "border-radius": "4px",
  58829. "white-space": "nowrap",
  58830. "padding-left": "25px",
  58831. "background-repeat": "no-repeat",
  58832. "background-position": "3px 7px"
  58833. },
  58834. error: {
  58835. color: "#B94A48",
  58836. "background-color": "#F2DEDE",
  58837. "border-color": "#EED3D7",
  58838. "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=)"
  58839. },
  58840. success: {
  58841. color: "#468847",
  58842. "background-color": "#DFF0D8",
  58843. "border-color": "#D6E9C6",
  58844. "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==)"
  58845. },
  58846. info: {
  58847. color: "#3A87AD",
  58848. "background-color": "#D9EDF7",
  58849. "border-color": "#BCE8F1",
  58850. "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=)"
  58851. },
  58852. warn: {
  58853. color: "#C09853",
  58854. "background-color": "#FCF8E3",
  58855. "border-color": "#FBEED5",
  58856. "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)"
  58857. }
  58858. }
  58859. }), e(function () {
  58860. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  58861. e(this).trigger("notify-hide");
  58862. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  58863. var n = e(this).data(r);
  58864. n && n.show(!1);
  58865. });
  58866. });
  58867. });
  58868. /***/ }),
  58869. /***/ "./resources/js/views/App.vue":
  58870. /*!************************************!*\
  58871. !*** ./resources/js/views/App.vue ***!
  58872. \************************************/
  58873. /*! exports provided: default */
  58874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58875. "use strict";
  58876. __webpack_require__.r(__webpack_exports__);
  58877. /* harmony import */ var _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=template&id=91ac6b5c& */ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  58878. /* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ "./resources/js/views/App.vue?vue&type=script&lang=js&");
  58879. /* 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");
  58880. /* normalize component */
  58881. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58882. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58883. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  58884. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58885. false,
  58886. null,
  58887. null,
  58888. null
  58889. )
  58890. /* hot reload */
  58891. if (false) { var api; }
  58892. component.options.__file = "resources/js/views/App.vue"
  58893. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58894. /***/ }),
  58895. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  58896. /*!*************************************************************!*\
  58897. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  58898. \*************************************************************/
  58899. /*! exports provided: default */
  58900. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58901. "use strict";
  58902. __webpack_require__.r(__webpack_exports__);
  58903. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_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!./App.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&");
  58904. /* 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_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58905. /***/ }),
  58906. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  58907. /*!*******************************************************************!*\
  58908. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  58909. \*******************************************************************/
  58910. /*! exports provided: render, staticRenderFns */
  58911. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58912. "use strict";
  58913. __webpack_require__.r(__webpack_exports__);
  58914. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_template_id_91ac6b5c___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!./App.vue?vue&type=template&id=91ac6b5c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  58915. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58916. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58917. /***/ }),
  58918. /***/ "./resources/js/views/Dashboard.vue":
  58919. /*!******************************************!*\
  58920. !*** ./resources/js/views/Dashboard.vue ***!
  58921. \******************************************/
  58922. /*! exports provided: default */
  58923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58924. "use strict";
  58925. __webpack_require__.r(__webpack_exports__);
  58926. /* harmony import */ var _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  58927. /* harmony import */ var _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=script&lang=js& */ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  58928. /* 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");
  58929. /* normalize component */
  58930. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58931. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58932. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  58933. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58934. false,
  58935. null,
  58936. null,
  58937. null
  58938. )
  58939. /* hot reload */
  58940. if (false) { var api; }
  58941. component.options.__file = "resources/js/views/Dashboard.vue"
  58942. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58943. /***/ }),
  58944. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  58945. /*!*******************************************************************!*\
  58946. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  58947. \*******************************************************************/
  58948. /*! exports provided: default */
  58949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58950. "use strict";
  58951. __webpack_require__.r(__webpack_exports__);
  58952. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_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!./Dashboard.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  58953. /* 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_Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58954. /***/ }),
  58955. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  58956. /*!*************************************************************************!*\
  58957. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  58958. \*************************************************************************/
  58959. /*! exports provided: render, staticRenderFns */
  58960. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58961. "use strict";
  58962. __webpack_require__.r(__webpack_exports__);
  58963. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_vue_vue_type_template_id_1f79daf6___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!./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  58964. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58965. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58966. /***/ }),
  58967. /***/ "./resources/js/views/Login.vue":
  58968. /*!**************************************!*\
  58969. !*** ./resources/js/views/Login.vue ***!
  58970. \**************************************/
  58971. /*! exports provided: default */
  58972. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58973. "use strict";
  58974. __webpack_require__.r(__webpack_exports__);
  58975. /* harmony import */ var _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Login.vue?vue&type=template&id=12f5395a& */ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  58976. /* harmony import */ var _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login.vue?vue&type=script&lang=js& */ "./resources/js/views/Login.vue?vue&type=script&lang=js&");
  58977. /* 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");
  58978. /* normalize component */
  58979. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58980. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58981. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  58982. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58983. false,
  58984. null,
  58985. null,
  58986. null
  58987. )
  58988. /* hot reload */
  58989. if (false) { var api; }
  58990. component.options.__file = "resources/js/views/Login.vue"
  58991. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58992. /***/ }),
  58993. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  58994. /*!***************************************************************!*\
  58995. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  58996. \***************************************************************/
  58997. /*! exports provided: default */
  58998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58999. "use strict";
  59000. __webpack_require__.r(__webpack_exports__);
  59001. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_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!./Login.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&");
  59002. /* 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_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59003. /***/ }),
  59004. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  59005. /*!*********************************************************************!*\
  59006. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  59007. \*********************************************************************/
  59008. /*! exports provided: render, staticRenderFns */
  59009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59010. "use strict";
  59011. __webpack_require__.r(__webpack_exports__);
  59012. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_12f5395a___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!./Login.vue?vue&type=template&id=12f5395a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  59013. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59014. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59015. /***/ }),
  59016. /***/ "./resources/js/views/Welcome.vue":
  59017. /*!****************************************!*\
  59018. !*** ./resources/js/views/Welcome.vue ***!
  59019. \****************************************/
  59020. /*! exports provided: default */
  59021. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59022. "use strict";
  59023. __webpack_require__.r(__webpack_exports__);
  59024. /* harmony import */ var _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  59025. /* harmony import */ var _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Welcome.vue?vue&type=script&lang=js& */ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  59026. /* empty/unused harmony star reexport *//* harmony import */ var _Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  59027. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  59028. /* normalize component */
  59029. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  59030. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59031. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  59032. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59033. false,
  59034. null,
  59035. "1ae8ae93",
  59036. null
  59037. )
  59038. /* hot reload */
  59039. if (false) { var api; }
  59040. component.options.__file = "resources/js/views/Welcome.vue"
  59041. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59042. /***/ }),
  59043. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  59044. /*!*****************************************************************!*\
  59045. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  59046. \*****************************************************************/
  59047. /*! exports provided: default */
  59048. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59049. "use strict";
  59050. __webpack_require__.r(__webpack_exports__);
  59051. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_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!./Welcome.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  59052. /* 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_Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59053. /***/ }),
  59054. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  59055. /*!*************************************************************************************************!*\
  59056. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  59057. \*************************************************************************************************/
  59058. /*! no static exports found */
  59059. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59060. "use strict";
  59061. __webpack_require__.r(__webpack_exports__);
  59062. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  59063. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  59064. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  59065. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  59066. /***/ }),
  59067. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  59068. /*!***********************************************************************************!*\
  59069. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  59070. \***********************************************************************************/
  59071. /*! exports provided: render, staticRenderFns */
  59072. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59073. "use strict";
  59074. __webpack_require__.r(__webpack_exports__);
  59075. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___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!./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  59076. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59077. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59078. /***/ }),
  59079. /***/ "./resources/js/views/WorkOrder.vue":
  59080. /*!******************************************!*\
  59081. !*** ./resources/js/views/WorkOrder.vue ***!
  59082. \******************************************/
  59083. /*! exports provided: default */
  59084. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59085. "use strict";
  59086. __webpack_require__.r(__webpack_exports__);
  59087. /* harmony import */ var _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  59088. /* harmony import */ var _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./WorkOrder.vue?vue&type=script&lang=js& */ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  59089. /* 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");
  59090. /* normalize component */
  59091. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59092. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59093. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  59094. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59095. false,
  59096. null,
  59097. null,
  59098. null
  59099. )
  59100. /* hot reload */
  59101. if (false) { var api; }
  59102. component.options.__file = "resources/js/views/WorkOrder.vue"
  59103. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59104. /***/ }),
  59105. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  59106. /*!*******************************************************************!*\
  59107. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  59108. \*******************************************************************/
  59109. /*! exports provided: default */
  59110. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59111. "use strict";
  59112. __webpack_require__.r(__webpack_exports__);
  59113. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_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!./WorkOrder.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&");
  59114. /* 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_WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  59115. /***/ }),
  59116. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  59117. /*!*************************************************************************!*\
  59118. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  59119. \*************************************************************************/
  59120. /*! exports provided: render, staticRenderFns */
  59121. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59122. "use strict";
  59123. __webpack_require__.r(__webpack_exports__);
  59124. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_WorkOrder_vue_vue_type_template_id_17837e2e___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!./WorkOrder.vue?vue&type=template&id=17837e2e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&");
  59125. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  59126. /* 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_WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  59127. /***/ }),
  59128. /***/ "./resources/sass/app.scss":
  59129. /*!*********************************!*\
  59130. !*** ./resources/sass/app.scss ***!
  59131. \*********************************/
  59132. /*! no static exports found */
  59133. /***/ (function(module, exports) {
  59134. // removed by extract-text-webpack-plugin
  59135. /***/ }),
  59136. /***/ 0:
  59137. /*!*************************************************************!*\
  59138. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  59139. \*************************************************************/
  59140. /*! no static exports found */
  59141. /***/ (function(module, exports, __webpack_require__) {
  59142. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  59143. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  59144. /***/ })
  59145. /******/ });