app.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719
  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/AssetInfo.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/AssetInfo.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. /* harmony import */ var _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/AssetInfoEditModal.vue */ "./resources/js/components/AssetInfoEditModal.vue");
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. /* harmony default export */ __webpack_exports__["default"] = ({
  1596. components: {
  1597. AssetInfoEditModal: _components_AssetInfoEditModal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1598. },
  1599. props: ['asset'],
  1600. mounted: function mounted() {
  1601. var _this = this;
  1602. Echo.channel('asset.' + this.asset.pcid).listen('AssetUpdated', function (e) {
  1603. _this.asset = e.data;
  1604. });
  1605. }
  1606. });
  1607. /***/ }),
  1608. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  1609. /*!*****************************************************************************************************************************************************************************!*\
  1610. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  1611. \*****************************************************************************************************************************************************************************/
  1612. /*! exports provided: default */
  1613. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1614. "use strict";
  1615. __webpack_require__.r(__webpack_exports__);
  1616. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  1617. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. components: {
  1669. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  1670. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  1671. },
  1672. props: ['populateWith', 'modalId'],
  1673. data: function data() {
  1674. return {
  1675. // Essentially makes a copy of the object. Otherwise
  1676. // We would have a reference to the exising object causing
  1677. // unwanted mutations in the parent component.
  1678. asset: JSON.parse(JSON.stringify(this.populateWith)),
  1679. assetSaving: false
  1680. };
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. var _this = this;
  1685. this.assetSaving = true;
  1686. axios.put("/api/assets/".concat(this.asset.pcid), this.asset).then(function (response) {
  1687. _this.assetSaving = false;
  1688. $("#".concat(_this.modalId)).modal('hide');
  1689. })["catch"](function (error) {
  1690. _this.assetSaving = false;
  1691. });
  1692. }
  1693. }
  1694. });
  1695. /***/ }),
  1696. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  1697. /*!*************************************************************************************************************************************************************************************!*\
  1698. !*** ./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& ***!
  1699. \*************************************************************************************************************************************************************************************/
  1700. /*! exports provided: default */
  1701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1702. "use strict";
  1703. __webpack_require__.r(__webpack_exports__);
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. //
  1721. //
  1722. //
  1723. //
  1724. //
  1725. /* harmony default export */ __webpack_exports__["default"] = ({
  1726. props: {
  1727. value: null,
  1728. // An object with the following format
  1729. // {
  1730. // key: value,
  1731. // key: value,
  1732. // }
  1733. options: {
  1734. type: Object,
  1735. required: true
  1736. },
  1737. allowCustom: {
  1738. type: Boolean,
  1739. "default": false
  1740. }
  1741. },
  1742. data: function data() {
  1743. return {
  1744. searchText: '',
  1745. selectedOption: null,
  1746. open: false,
  1747. // allows for checking whether button was clicked or text was typed.
  1748. // If button was clicked, we show all options without having to clear
  1749. // out any searchText that was autofilled when page loaded.
  1750. isSearching: false
  1751. };
  1752. },
  1753. computed: {
  1754. matches: function matches() {
  1755. var _this = this;
  1756. // If button was clicked, show all options, if typing, filter
  1757. // options based on searchText
  1758. return Object.entries(this.options).filter(function (option) {
  1759. var optionText = option[1].toUpperCase();
  1760. if (_this.isSearching) {
  1761. return optionText.match(_this.searchText.toUpperCase());
  1762. } else {
  1763. return optionText.match('');
  1764. }
  1765. });
  1766. }
  1767. },
  1768. methods: {
  1769. // if button is clicked, show all options
  1770. setOpen: function setOpen(isOpen) {
  1771. this.open = isOpen;
  1772. this.isSearching = false;
  1773. },
  1774. // if typing in the box, start filtering options
  1775. searchChanged: function searchChanged() {
  1776. if (!this.open) {
  1777. this.open = true;
  1778. }
  1779. if (!this.isSearching) {
  1780. this.isSearching = true;
  1781. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1782. if (this.allowCustom) {
  1783. this.$emit('input', {
  1784. 'id': 'custom',
  1785. 'name': this.searchText
  1786. });
  1787. }
  1788. },
  1789. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1790. // a suggestion is selected
  1791. suggestionSelected: function suggestionSelected(suggestion) {
  1792. this.open = false;
  1793. this.searchText = suggestion[1];
  1794. this.$emit('input', {
  1795. 'id': suggestion[0],
  1796. 'name': suggestion[1]
  1797. });
  1798. },
  1799. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1800. if (this.allowCustom) {
  1801. this.searchText = this.value.name;
  1802. } else {
  1803. if (newValue.id > -1) {
  1804. // Find the matching text for the supplied option value
  1805. for (var id in this.options) {
  1806. if (this.options.hasOwnProperty(id)) {
  1807. if (this.options[id] === this.options[newValue.id]) {
  1808. this.searchText = this.options[id];
  1809. }
  1810. }
  1811. }
  1812. }
  1813. }
  1814. }
  1815. },
  1816. mounted: function mounted() {
  1817. this.updateComponentWithValue(this.value);
  1818. },
  1819. watch: {
  1820. value: function value(newValue) {
  1821. this.updateComponentWithValue(newValue);
  1822. }
  1823. }
  1824. });
  1825. /***/ }),
  1826. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CircleSpinner.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/CircleSpinner.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. //
  1835. //
  1836. //
  1837. //
  1838. /* harmony default export */ __webpack_exports__["default"] = ({
  1839. name: 'IntersectingCirclesSpinner',
  1840. props: {
  1841. color: {
  1842. type: String,
  1843. "default": '#fff'
  1844. },
  1845. size: {
  1846. type: String,
  1847. "default": '10'
  1848. }
  1849. }
  1850. });
  1851. /***/ }),
  1852. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  1853. /*!**************************************************************************************************************************************************************************!*\
  1854. !*** ./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& ***!
  1855. \**************************************************************************************************************************************************************************/
  1856. /*! exports provided: default */
  1857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1858. "use strict";
  1859. __webpack_require__.r(__webpack_exports__);
  1860. /* harmony import */ var _components_Modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal */ "./resources/js/components/Modal.vue");
  1861. /* harmony import */ var _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  1862. //
  1863. //
  1864. //
  1865. //
  1866. //
  1867. //
  1868. //
  1869. //
  1870. //
  1871. //
  1872. //
  1873. //
  1874. //
  1875. //
  1876. //
  1877. //
  1878. //
  1879. //
  1880. //
  1881. //
  1882. //
  1883. //
  1884. //
  1885. //
  1886. //
  1887. //
  1888. //
  1889. //
  1890. //
  1891. //
  1892. //
  1893. //
  1894. //
  1895. /* harmony default export */ __webpack_exports__["default"] = ({
  1896. components: {
  1897. Modal: _components_Modal__WEBPACK_IMPORTED_MODULE_0__["default"],
  1898. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown__WEBPACK_IMPORTED_MODULE_1__["default"]
  1899. },
  1900. props: ['populateWith', 'storeList', 'modalId'],
  1901. data: function data() {
  1902. return {
  1903. // Copies object from prop, so it doesn't mutate the object
  1904. // from the parent component. Parent component will be updated via
  1905. // Websocket if updateWorkOrder is successful.
  1906. data: JSON.parse(JSON.stringify(this.populateWith)),
  1907. id: this.modalId,
  1908. store: {},
  1909. errors: []
  1910. };
  1911. },
  1912. methods: {
  1913. updateWorkOrder: function updateWorkOrder() {
  1914. var _this = this;
  1915. this.data.storeid = this.store.id;
  1916. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1917. $('#workordereditModal').modal('hide');
  1918. })["catch"](function (error) {
  1919. _this.errors = JSON.parse(error.response.request.response).errors;
  1920. });
  1921. }
  1922. },
  1923. mounted: function mounted() {
  1924. this.store = {
  1925. 'id': this.data.storeid,
  1926. 'name': this.storeList[this.data.storeid]
  1927. };
  1928. },
  1929. // This was originally here because the populateWith info would originally
  1930. // not necessarily be loaded when this component was mounted. That is no
  1931. // longer the case as I now don't render the parent component until the
  1932. // ajax request is finised. The watch statements are still here to cover
  1933. // the case where someone else updates the populateWith values while
  1934. // someone is editing, although it probably should be edited so it doesn't
  1935. // immediately overwrite the unsaved edits of the current user.
  1936. watch: {
  1937. populateWith: function populateWith(value) {
  1938. this.data = JSON.parse(JSON.stringify(this.populateWith));
  1939. this.store = {
  1940. 'id': this.data.storeid,
  1941. 'name': this.storeList[this.data.storeid]
  1942. };
  1943. },
  1944. storeList: function storeList(value) {
  1945. this.store = {
  1946. 'id': this.data.storeid,
  1947. 'name': this.storeList[this.data.storeid]
  1948. };
  1949. }
  1950. }
  1951. });
  1952. /***/ }),
  1953. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  1954. /*!************************************************************************************************************************************************************************!*\
  1955. !*** ./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& ***!
  1956. \************************************************************************************************************************************************************************/
  1957. /*! exports provided: default */
  1958. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1959. "use strict";
  1960. __webpack_require__.r(__webpack_exports__);
  1961. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1962. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. /* harmony default export */ __webpack_exports__["default"] = ({
  1984. components: {
  1985. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  1986. },
  1987. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1988. props: ['workOrder', 'stores'],
  1989. computed: {
  1990. storeList: function storeList() {
  1991. var list = {};
  1992. Object.values(this.stores).map(function (val) {
  1993. list[val.storeid] = val.storesname;
  1994. });
  1995. return list;
  1996. }
  1997. }
  1998. });
  1999. /***/ }),
  2000. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2001. /*!*********************************************************************************************************************************************************!*\
  2002. !*** ./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& ***!
  2003. \*********************************************************************************************************************************************************/
  2004. /*! exports provided: default */
  2005. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2006. "use strict";
  2007. __webpack_require__.r(__webpack_exports__);
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  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. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. //
  2078. //
  2079. /* harmony default export */ __webpack_exports__["default"] = ({
  2080. data: function data() {
  2081. return {
  2082. isLoggedIn: null,
  2083. username: null
  2084. };
  2085. },
  2086. mounted: function mounted() {
  2087. this.isLoggedIn = localStorage.getItem('jwt');
  2088. this.username = localStorage.getItem('user');
  2089. }
  2090. });
  2091. /***/ }),
  2092. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2093. /*!***************************************************************************************************************************************************************!*\
  2094. !*** ./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& ***!
  2095. \***************************************************************************************************************************************************************/
  2096. /*! exports provided: default */
  2097. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2098. "use strict";
  2099. __webpack_require__.r(__webpack_exports__);
  2100. //
  2101. //
  2102. //
  2103. //
  2104. //
  2105. //
  2106. //
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. //
  2118. //
  2119. //
  2120. //
  2121. //
  2122. //
  2123. /* harmony default export */ __webpack_exports__["default"] = ({
  2124. data: function data() {
  2125. return {
  2126. workOrders: []
  2127. };
  2128. },
  2129. mounted: function mounted() {
  2130. var _this = this;
  2131. var token = localStorage.getItem('jwt');
  2132. var user = localStorage.getItem('user');
  2133. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2134. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2135. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2136. _this.workOrders = response.data;
  2137. })["catch"](function (error) {
  2138. console.log(error);
  2139. });
  2140. },
  2141. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2142. if (!localStorage.getItem('jwt')) {
  2143. return next('login');
  2144. }
  2145. next();
  2146. }
  2147. });
  2148. /***/ }),
  2149. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2150. /*!***********************************************************************************************************************************************************!*\
  2151. !*** ./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& ***!
  2152. \***********************************************************************************************************************************************************/
  2153. /*! exports provided: default */
  2154. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2155. "use strict";
  2156. __webpack_require__.r(__webpack_exports__);
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. /* harmony default export */ __webpack_exports__["default"] = ({
  2197. data: function data() {
  2198. return {
  2199. username: "",
  2200. password: ""
  2201. };
  2202. },
  2203. methods: {
  2204. handleSubmit: function handleSubmit(e) {
  2205. var _this = this;
  2206. e.preventDefault();
  2207. if (this.password.length > 0) {
  2208. axios.post('api/login', {
  2209. username: this.username,
  2210. password: this.password
  2211. }).then(function (response) {
  2212. localStorage.setItem('user', response.data.success.username);
  2213. localStorage.setItem('jwt', response.data.success.token);
  2214. if (localStorage.getItem('jwt') != null) {
  2215. _this.$router.go('/dashboard');
  2216. }
  2217. })["catch"](function (error) {
  2218. console.error(error);
  2219. });
  2220. }
  2221. }
  2222. },
  2223. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2224. if (localStorage.getItem('jwt')) {
  2225. return next('dashboard');
  2226. }
  2227. next();
  2228. }
  2229. });
  2230. /***/ }),
  2231. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2232. /*!*************************************************************************************************************************************************************!*\
  2233. !*** ./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& ***!
  2234. \*************************************************************************************************************************************************************/
  2235. /*! exports provided: default */
  2236. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2237. "use strict";
  2238. __webpack_require__.r(__webpack_exports__);
  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. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. /* harmony default export */ __webpack_exports__["default"] = ({});
  2291. /***/ }),
  2292. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2293. /*!***************************************************************************************************************************************************************!*\
  2294. !*** ./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& ***!
  2295. \***************************************************************************************************************************************************************/
  2296. /*! exports provided: default */
  2297. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2298. "use strict";
  2299. __webpack_require__.r(__webpack_exports__);
  2300. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2301. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2302. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. //
  2335. //
  2336. //
  2337. //
  2338. //
  2339. //
  2340. //
  2341. //
  2342. //
  2343. //
  2344. //
  2345. //
  2346. //
  2347. //
  2348. //
  2349. //
  2350. //
  2351. //
  2352. //
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. //
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. //
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. /* harmony default export */ __webpack_exports__["default"] = ({
  2402. components: {
  2403. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2404. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2405. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
  2406. },
  2407. props: ['id'],
  2408. data: function data() {
  2409. return {
  2410. workOrder: {},
  2411. asset: {},
  2412. stores: {},
  2413. woLoading: true,
  2414. assetLoading: true,
  2415. storesLoading: true
  2416. };
  2417. },
  2418. mounted: function mounted() {
  2419. var _this = this;
  2420. // Get authentication info from current user from local storage
  2421. var token = localStorage.getItem('jwt');
  2422. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  2423. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2424. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  2425. axios.get('/api/workorders/' + this.id).then(function (response) {
  2426. _this.workOrder = response.data;
  2427. _this.woLoading = false;
  2428. })["catch"](function (error) {
  2429. console.log(error);
  2430. }); // Get Asset from API (will most likely be replaced with list of assets
  2431. // in the future. Current each WO can only have one but that is likely
  2432. // to change)
  2433. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  2434. _this.asset = response.data;
  2435. _this.assetLoading = false;
  2436. })["catch"](function (error) {
  2437. console.log(error);
  2438. }); // Get list of stores from API
  2439. axios.get('/api/stores/').then(function (response) {
  2440. _this.stores = response.data;
  2441. _this.storesLoading = false;
  2442. })["catch"](function (error) {
  2443. console.log(error);
  2444. });
  2445. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  2446. _this.workOrder = e.data;
  2447. });
  2448. }
  2449. });
  2450. /***/ }),
  2451. /***/ "./node_modules/base64-js/index.js":
  2452. /*!*****************************************!*\
  2453. !*** ./node_modules/base64-js/index.js ***!
  2454. \*****************************************/
  2455. /*! no static exports found */
  2456. /***/ (function(module, exports, __webpack_require__) {
  2457. "use strict";
  2458. exports.byteLength = byteLength
  2459. exports.toByteArray = toByteArray
  2460. exports.fromByteArray = fromByteArray
  2461. var lookup = []
  2462. var revLookup = []
  2463. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2464. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2465. for (var i = 0, len = code.length; i < len; ++i) {
  2466. lookup[i] = code[i]
  2467. revLookup[code.charCodeAt(i)] = i
  2468. }
  2469. // Support decoding URL-safe base64 strings, as Node.js does.
  2470. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2471. revLookup['-'.charCodeAt(0)] = 62
  2472. revLookup['_'.charCodeAt(0)] = 63
  2473. function getLens (b64) {
  2474. var len = b64.length
  2475. if (len % 4 > 0) {
  2476. throw new Error('Invalid string. Length must be a multiple of 4')
  2477. }
  2478. // Trim off extra bytes after placeholder bytes are found
  2479. // See: https://github.com/beatgammit/base64-js/issues/42
  2480. var validLen = b64.indexOf('=')
  2481. if (validLen === -1) validLen = len
  2482. var placeHoldersLen = validLen === len
  2483. ? 0
  2484. : 4 - (validLen % 4)
  2485. return [validLen, placeHoldersLen]
  2486. }
  2487. // base64 is 4/3 + up to two characters of the original data
  2488. function byteLength (b64) {
  2489. var lens = getLens(b64)
  2490. var validLen = lens[0]
  2491. var placeHoldersLen = lens[1]
  2492. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2493. }
  2494. function _byteLength (b64, validLen, placeHoldersLen) {
  2495. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2496. }
  2497. function toByteArray (b64) {
  2498. var tmp
  2499. var lens = getLens(b64)
  2500. var validLen = lens[0]
  2501. var placeHoldersLen = lens[1]
  2502. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2503. var curByte = 0
  2504. // if there are placeholders, only get up to the last complete 4 chars
  2505. var len = placeHoldersLen > 0
  2506. ? validLen - 4
  2507. : validLen
  2508. var i
  2509. for (i = 0; i < len; i += 4) {
  2510. tmp =
  2511. (revLookup[b64.charCodeAt(i)] << 18) |
  2512. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2513. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2514. revLookup[b64.charCodeAt(i + 3)]
  2515. arr[curByte++] = (tmp >> 16) & 0xFF
  2516. arr[curByte++] = (tmp >> 8) & 0xFF
  2517. arr[curByte++] = tmp & 0xFF
  2518. }
  2519. if (placeHoldersLen === 2) {
  2520. tmp =
  2521. (revLookup[b64.charCodeAt(i)] << 2) |
  2522. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2523. arr[curByte++] = tmp & 0xFF
  2524. }
  2525. if (placeHoldersLen === 1) {
  2526. tmp =
  2527. (revLookup[b64.charCodeAt(i)] << 10) |
  2528. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2529. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2530. arr[curByte++] = (tmp >> 8) & 0xFF
  2531. arr[curByte++] = tmp & 0xFF
  2532. }
  2533. return arr
  2534. }
  2535. function tripletToBase64 (num) {
  2536. return lookup[num >> 18 & 0x3F] +
  2537. lookup[num >> 12 & 0x3F] +
  2538. lookup[num >> 6 & 0x3F] +
  2539. lookup[num & 0x3F]
  2540. }
  2541. function encodeChunk (uint8, start, end) {
  2542. var tmp
  2543. var output = []
  2544. for (var i = start; i < end; i += 3) {
  2545. tmp =
  2546. ((uint8[i] << 16) & 0xFF0000) +
  2547. ((uint8[i + 1] << 8) & 0xFF00) +
  2548. (uint8[i + 2] & 0xFF)
  2549. output.push(tripletToBase64(tmp))
  2550. }
  2551. return output.join('')
  2552. }
  2553. function fromByteArray (uint8) {
  2554. var tmp
  2555. var len = uint8.length
  2556. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2557. var parts = []
  2558. var maxChunkLength = 16383 // must be multiple of 3
  2559. // go through the array every three bytes, we'll deal with trailing stuff later
  2560. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2561. parts.push(encodeChunk(
  2562. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2563. ))
  2564. }
  2565. // pad the end with zeros, but make sure to not forget the extra bytes
  2566. if (extraBytes === 1) {
  2567. tmp = uint8[len - 1]
  2568. parts.push(
  2569. lookup[tmp >> 2] +
  2570. lookup[(tmp << 4) & 0x3F] +
  2571. '=='
  2572. )
  2573. } else if (extraBytes === 2) {
  2574. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2575. parts.push(
  2576. lookup[tmp >> 10] +
  2577. lookup[(tmp >> 4) & 0x3F] +
  2578. lookup[(tmp << 2) & 0x3F] +
  2579. '='
  2580. )
  2581. }
  2582. return parts.join('')
  2583. }
  2584. /***/ }),
  2585. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2586. /*!*****************************************************!*\
  2587. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2588. \*****************************************************/
  2589. /*! no static exports found */
  2590. /***/ (function(module, exports, __webpack_require__) {
  2591. /*!
  2592. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2593. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2594. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2595. */
  2596. (function (global, factory) {
  2597. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2598. undefined;
  2599. }(this, (function (exports, $, Popper) { 'use strict';
  2600. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2601. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2602. function _defineProperties(target, props) {
  2603. for (var i = 0; i < props.length; i++) {
  2604. var descriptor = props[i];
  2605. descriptor.enumerable = descriptor.enumerable || false;
  2606. descriptor.configurable = true;
  2607. if ("value" in descriptor) descriptor.writable = true;
  2608. Object.defineProperty(target, descriptor.key, descriptor);
  2609. }
  2610. }
  2611. function _createClass(Constructor, protoProps, staticProps) {
  2612. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2613. if (staticProps) _defineProperties(Constructor, staticProps);
  2614. return Constructor;
  2615. }
  2616. function _defineProperty(obj, key, value) {
  2617. if (key in obj) {
  2618. Object.defineProperty(obj, key, {
  2619. value: value,
  2620. enumerable: true,
  2621. configurable: true,
  2622. writable: true
  2623. });
  2624. } else {
  2625. obj[key] = value;
  2626. }
  2627. return obj;
  2628. }
  2629. function ownKeys(object, enumerableOnly) {
  2630. var keys = Object.keys(object);
  2631. if (Object.getOwnPropertySymbols) {
  2632. var symbols = Object.getOwnPropertySymbols(object);
  2633. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2634. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2635. });
  2636. keys.push.apply(keys, symbols);
  2637. }
  2638. return keys;
  2639. }
  2640. function _objectSpread2(target) {
  2641. for (var i = 1; i < arguments.length; i++) {
  2642. var source = arguments[i] != null ? arguments[i] : {};
  2643. if (i % 2) {
  2644. ownKeys(Object(source), true).forEach(function (key) {
  2645. _defineProperty(target, key, source[key]);
  2646. });
  2647. } else if (Object.getOwnPropertyDescriptors) {
  2648. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2649. } else {
  2650. ownKeys(Object(source)).forEach(function (key) {
  2651. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2652. });
  2653. }
  2654. }
  2655. return target;
  2656. }
  2657. function _inheritsLoose(subClass, superClass) {
  2658. subClass.prototype = Object.create(superClass.prototype);
  2659. subClass.prototype.constructor = subClass;
  2660. subClass.__proto__ = superClass;
  2661. }
  2662. /**
  2663. * --------------------------------------------------------------------------
  2664. * Bootstrap (v4.4.1): util.js
  2665. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2666. * --------------------------------------------------------------------------
  2667. */
  2668. /**
  2669. * ------------------------------------------------------------------------
  2670. * Private TransitionEnd Helpers
  2671. * ------------------------------------------------------------------------
  2672. */
  2673. var TRANSITION_END = 'transitionend';
  2674. var MAX_UID = 1000000;
  2675. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2676. function toType(obj) {
  2677. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2678. }
  2679. function getSpecialTransitionEndEvent() {
  2680. return {
  2681. bindType: TRANSITION_END,
  2682. delegateType: TRANSITION_END,
  2683. handle: function handle(event) {
  2684. if ($(event.target).is(this)) {
  2685. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2686. }
  2687. return undefined; // eslint-disable-line no-undefined
  2688. }
  2689. };
  2690. }
  2691. function transitionEndEmulator(duration) {
  2692. var _this = this;
  2693. var called = false;
  2694. $(this).one(Util.TRANSITION_END, function () {
  2695. called = true;
  2696. });
  2697. setTimeout(function () {
  2698. if (!called) {
  2699. Util.triggerTransitionEnd(_this);
  2700. }
  2701. }, duration);
  2702. return this;
  2703. }
  2704. function setTransitionEndSupport() {
  2705. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2706. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2707. }
  2708. /**
  2709. * --------------------------------------------------------------------------
  2710. * Public Util Api
  2711. * --------------------------------------------------------------------------
  2712. */
  2713. var Util = {
  2714. TRANSITION_END: 'bsTransitionEnd',
  2715. getUID: function getUID(prefix) {
  2716. do {
  2717. // eslint-disable-next-line no-bitwise
  2718. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2719. } while (document.getElementById(prefix));
  2720. return prefix;
  2721. },
  2722. getSelectorFromElement: function getSelectorFromElement(element) {
  2723. var selector = element.getAttribute('data-target');
  2724. if (!selector || selector === '#') {
  2725. var hrefAttr = element.getAttribute('href');
  2726. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2727. }
  2728. try {
  2729. return document.querySelector(selector) ? selector : null;
  2730. } catch (err) {
  2731. return null;
  2732. }
  2733. },
  2734. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2735. if (!element) {
  2736. return 0;
  2737. } // Get transition-duration of the element
  2738. var transitionDuration = $(element).css('transition-duration');
  2739. var transitionDelay = $(element).css('transition-delay');
  2740. var floatTransitionDuration = parseFloat(transitionDuration);
  2741. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2742. if (!floatTransitionDuration && !floatTransitionDelay) {
  2743. return 0;
  2744. } // If multiple durations are defined, take the first
  2745. transitionDuration = transitionDuration.split(',')[0];
  2746. transitionDelay = transitionDelay.split(',')[0];
  2747. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2748. },
  2749. reflow: function reflow(element) {
  2750. return element.offsetHeight;
  2751. },
  2752. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2753. $(element).trigger(TRANSITION_END);
  2754. },
  2755. // TODO: Remove in v5
  2756. supportsTransitionEnd: function supportsTransitionEnd() {
  2757. return Boolean(TRANSITION_END);
  2758. },
  2759. isElement: function isElement(obj) {
  2760. return (obj[0] || obj).nodeType;
  2761. },
  2762. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2763. for (var property in configTypes) {
  2764. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2765. var expectedTypes = configTypes[property];
  2766. var value = config[property];
  2767. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2768. if (!new RegExp(expectedTypes).test(valueType)) {
  2769. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2770. }
  2771. }
  2772. }
  2773. },
  2774. findShadowRoot: function findShadowRoot(element) {
  2775. if (!document.documentElement.attachShadow) {
  2776. return null;
  2777. } // Can find the shadow root otherwise it'll return the document
  2778. if (typeof element.getRootNode === 'function') {
  2779. var root = element.getRootNode();
  2780. return root instanceof ShadowRoot ? root : null;
  2781. }
  2782. if (element instanceof ShadowRoot) {
  2783. return element;
  2784. } // when we don't find a shadow root
  2785. if (!element.parentNode) {
  2786. return null;
  2787. }
  2788. return Util.findShadowRoot(element.parentNode);
  2789. },
  2790. jQueryDetection: function jQueryDetection() {
  2791. if (typeof $ === 'undefined') {
  2792. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2793. }
  2794. var version = $.fn.jquery.split(' ')[0].split('.');
  2795. var minMajor = 1;
  2796. var ltMajor = 2;
  2797. var minMinor = 9;
  2798. var minPatch = 1;
  2799. var maxMajor = 4;
  2800. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2801. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2802. }
  2803. }
  2804. };
  2805. Util.jQueryDetection();
  2806. setTransitionEndSupport();
  2807. /**
  2808. * ------------------------------------------------------------------------
  2809. * Constants
  2810. * ------------------------------------------------------------------------
  2811. */
  2812. var NAME = 'alert';
  2813. var VERSION = '4.4.1';
  2814. var DATA_KEY = 'bs.alert';
  2815. var EVENT_KEY = "." + DATA_KEY;
  2816. var DATA_API_KEY = '.data-api';
  2817. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2818. var Selector = {
  2819. DISMISS: '[data-dismiss="alert"]'
  2820. };
  2821. var Event = {
  2822. CLOSE: "close" + EVENT_KEY,
  2823. CLOSED: "closed" + EVENT_KEY,
  2824. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2825. };
  2826. var ClassName = {
  2827. ALERT: 'alert',
  2828. FADE: 'fade',
  2829. SHOW: 'show'
  2830. };
  2831. /**
  2832. * ------------------------------------------------------------------------
  2833. * Class Definition
  2834. * ------------------------------------------------------------------------
  2835. */
  2836. var Alert =
  2837. /*#__PURE__*/
  2838. function () {
  2839. function Alert(element) {
  2840. this._element = element;
  2841. } // Getters
  2842. var _proto = Alert.prototype;
  2843. // Public
  2844. _proto.close = function close(element) {
  2845. var rootElement = this._element;
  2846. if (element) {
  2847. rootElement = this._getRootElement(element);
  2848. }
  2849. var customEvent = this._triggerCloseEvent(rootElement);
  2850. if (customEvent.isDefaultPrevented()) {
  2851. return;
  2852. }
  2853. this._removeElement(rootElement);
  2854. };
  2855. _proto.dispose = function dispose() {
  2856. $.removeData(this._element, DATA_KEY);
  2857. this._element = null;
  2858. } // Private
  2859. ;
  2860. _proto._getRootElement = function _getRootElement(element) {
  2861. var selector = Util.getSelectorFromElement(element);
  2862. var parent = false;
  2863. if (selector) {
  2864. parent = document.querySelector(selector);
  2865. }
  2866. if (!parent) {
  2867. parent = $(element).closest("." + ClassName.ALERT)[0];
  2868. }
  2869. return parent;
  2870. };
  2871. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2872. var closeEvent = $.Event(Event.CLOSE);
  2873. $(element).trigger(closeEvent);
  2874. return closeEvent;
  2875. };
  2876. _proto._removeElement = function _removeElement(element) {
  2877. var _this = this;
  2878. $(element).removeClass(ClassName.SHOW);
  2879. if (!$(element).hasClass(ClassName.FADE)) {
  2880. this._destroyElement(element);
  2881. return;
  2882. }
  2883. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2884. $(element).one(Util.TRANSITION_END, function (event) {
  2885. return _this._destroyElement(element, event);
  2886. }).emulateTransitionEnd(transitionDuration);
  2887. };
  2888. _proto._destroyElement = function _destroyElement(element) {
  2889. $(element).detach().trigger(Event.CLOSED).remove();
  2890. } // Static
  2891. ;
  2892. Alert._jQueryInterface = function _jQueryInterface(config) {
  2893. return this.each(function () {
  2894. var $element = $(this);
  2895. var data = $element.data(DATA_KEY);
  2896. if (!data) {
  2897. data = new Alert(this);
  2898. $element.data(DATA_KEY, data);
  2899. }
  2900. if (config === 'close') {
  2901. data[config](this);
  2902. }
  2903. });
  2904. };
  2905. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2906. return function (event) {
  2907. if (event) {
  2908. event.preventDefault();
  2909. }
  2910. alertInstance.close(this);
  2911. };
  2912. };
  2913. _createClass(Alert, null, [{
  2914. key: "VERSION",
  2915. get: function get() {
  2916. return VERSION;
  2917. }
  2918. }]);
  2919. return Alert;
  2920. }();
  2921. /**
  2922. * ------------------------------------------------------------------------
  2923. * Data Api implementation
  2924. * ------------------------------------------------------------------------
  2925. */
  2926. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2927. /**
  2928. * ------------------------------------------------------------------------
  2929. * jQuery
  2930. * ------------------------------------------------------------------------
  2931. */
  2932. $.fn[NAME] = Alert._jQueryInterface;
  2933. $.fn[NAME].Constructor = Alert;
  2934. $.fn[NAME].noConflict = function () {
  2935. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2936. return Alert._jQueryInterface;
  2937. };
  2938. /**
  2939. * ------------------------------------------------------------------------
  2940. * Constants
  2941. * ------------------------------------------------------------------------
  2942. */
  2943. var NAME$1 = 'button';
  2944. var VERSION$1 = '4.4.1';
  2945. var DATA_KEY$1 = 'bs.button';
  2946. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2947. var DATA_API_KEY$1 = '.data-api';
  2948. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2949. var ClassName$1 = {
  2950. ACTIVE: 'active',
  2951. BUTTON: 'btn',
  2952. FOCUS: 'focus'
  2953. };
  2954. var Selector$1 = {
  2955. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2956. DATA_TOGGLES: '[data-toggle="buttons"]',
  2957. DATA_TOGGLE: '[data-toggle="button"]',
  2958. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2959. INPUT: 'input:not([type="hidden"])',
  2960. ACTIVE: '.active',
  2961. BUTTON: '.btn'
  2962. };
  2963. var Event$1 = {
  2964. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2965. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2966. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2967. };
  2968. /**
  2969. * ------------------------------------------------------------------------
  2970. * Class Definition
  2971. * ------------------------------------------------------------------------
  2972. */
  2973. var Button =
  2974. /*#__PURE__*/
  2975. function () {
  2976. function Button(element) {
  2977. this._element = element;
  2978. } // Getters
  2979. var _proto = Button.prototype;
  2980. // Public
  2981. _proto.toggle = function toggle() {
  2982. var triggerChangeEvent = true;
  2983. var addAriaPressed = true;
  2984. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2985. if (rootElement) {
  2986. var input = this._element.querySelector(Selector$1.INPUT);
  2987. if (input) {
  2988. if (input.type === 'radio') {
  2989. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2990. triggerChangeEvent = false;
  2991. } else {
  2992. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2993. if (activeElement) {
  2994. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2995. }
  2996. }
  2997. } else if (input.type === 'checkbox') {
  2998. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2999. triggerChangeEvent = false;
  3000. }
  3001. } else {
  3002. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3003. triggerChangeEvent = false;
  3004. }
  3005. if (triggerChangeEvent) {
  3006. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3007. $(input).trigger('change');
  3008. }
  3009. input.focus();
  3010. addAriaPressed = false;
  3011. }
  3012. }
  3013. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3014. if (addAriaPressed) {
  3015. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3016. }
  3017. if (triggerChangeEvent) {
  3018. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3019. }
  3020. }
  3021. };
  3022. _proto.dispose = function dispose() {
  3023. $.removeData(this._element, DATA_KEY$1);
  3024. this._element = null;
  3025. } // Static
  3026. ;
  3027. Button._jQueryInterface = function _jQueryInterface(config) {
  3028. return this.each(function () {
  3029. var data = $(this).data(DATA_KEY$1);
  3030. if (!data) {
  3031. data = new Button(this);
  3032. $(this).data(DATA_KEY$1, data);
  3033. }
  3034. if (config === 'toggle') {
  3035. data[config]();
  3036. }
  3037. });
  3038. };
  3039. _createClass(Button, null, [{
  3040. key: "VERSION",
  3041. get: function get() {
  3042. return VERSION$1;
  3043. }
  3044. }]);
  3045. return Button;
  3046. }();
  3047. /**
  3048. * ------------------------------------------------------------------------
  3049. * Data Api implementation
  3050. * ------------------------------------------------------------------------
  3051. */
  3052. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3053. var button = event.target;
  3054. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3055. button = $(button).closest(Selector$1.BUTTON)[0];
  3056. }
  3057. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3058. event.preventDefault(); // work around Firefox bug #1540995
  3059. } else {
  3060. var inputBtn = button.querySelector(Selector$1.INPUT);
  3061. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3062. event.preventDefault(); // work around Firefox bug #1540995
  3063. return;
  3064. }
  3065. Button._jQueryInterface.call($(button), 'toggle');
  3066. }
  3067. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3068. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3069. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3070. });
  3071. $(window).on(Event$1.LOAD_DATA_API, function () {
  3072. // ensure correct active class is set to match the controls' actual values/states
  3073. // find all checkboxes/readio buttons inside data-toggle groups
  3074. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3075. for (var i = 0, len = buttons.length; i < len; i++) {
  3076. var button = buttons[i];
  3077. var input = button.querySelector(Selector$1.INPUT);
  3078. if (input.checked || input.hasAttribute('checked')) {
  3079. button.classList.add(ClassName$1.ACTIVE);
  3080. } else {
  3081. button.classList.remove(ClassName$1.ACTIVE);
  3082. }
  3083. } // find all button toggles
  3084. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3085. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3086. var _button = buttons[_i];
  3087. if (_button.getAttribute('aria-pressed') === 'true') {
  3088. _button.classList.add(ClassName$1.ACTIVE);
  3089. } else {
  3090. _button.classList.remove(ClassName$1.ACTIVE);
  3091. }
  3092. }
  3093. });
  3094. /**
  3095. * ------------------------------------------------------------------------
  3096. * jQuery
  3097. * ------------------------------------------------------------------------
  3098. */
  3099. $.fn[NAME$1] = Button._jQueryInterface;
  3100. $.fn[NAME$1].Constructor = Button;
  3101. $.fn[NAME$1].noConflict = function () {
  3102. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3103. return Button._jQueryInterface;
  3104. };
  3105. /**
  3106. * ------------------------------------------------------------------------
  3107. * Constants
  3108. * ------------------------------------------------------------------------
  3109. */
  3110. var NAME$2 = 'carousel';
  3111. var VERSION$2 = '4.4.1';
  3112. var DATA_KEY$2 = 'bs.carousel';
  3113. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3114. var DATA_API_KEY$2 = '.data-api';
  3115. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3116. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3117. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3118. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3119. var SWIPE_THRESHOLD = 40;
  3120. var Default = {
  3121. interval: 5000,
  3122. keyboard: true,
  3123. slide: false,
  3124. pause: 'hover',
  3125. wrap: true,
  3126. touch: true
  3127. };
  3128. var DefaultType = {
  3129. interval: '(number|boolean)',
  3130. keyboard: 'boolean',
  3131. slide: '(boolean|string)',
  3132. pause: '(string|boolean)',
  3133. wrap: 'boolean',
  3134. touch: 'boolean'
  3135. };
  3136. var Direction = {
  3137. NEXT: 'next',
  3138. PREV: 'prev',
  3139. LEFT: 'left',
  3140. RIGHT: 'right'
  3141. };
  3142. var Event$2 = {
  3143. SLIDE: "slide" + EVENT_KEY$2,
  3144. SLID: "slid" + EVENT_KEY$2,
  3145. KEYDOWN: "keydown" + EVENT_KEY$2,
  3146. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3147. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3148. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3149. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3150. TOUCHEND: "touchend" + EVENT_KEY$2,
  3151. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3152. POINTERUP: "pointerup" + EVENT_KEY$2,
  3153. DRAG_START: "dragstart" + EVENT_KEY$2,
  3154. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3155. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3156. };
  3157. var ClassName$2 = {
  3158. CAROUSEL: 'carousel',
  3159. ACTIVE: 'active',
  3160. SLIDE: 'slide',
  3161. RIGHT: 'carousel-item-right',
  3162. LEFT: 'carousel-item-left',
  3163. NEXT: 'carousel-item-next',
  3164. PREV: 'carousel-item-prev',
  3165. ITEM: 'carousel-item',
  3166. POINTER_EVENT: 'pointer-event'
  3167. };
  3168. var Selector$2 = {
  3169. ACTIVE: '.active',
  3170. ACTIVE_ITEM: '.active.carousel-item',
  3171. ITEM: '.carousel-item',
  3172. ITEM_IMG: '.carousel-item img',
  3173. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3174. INDICATORS: '.carousel-indicators',
  3175. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3176. DATA_RIDE: '[data-ride="carousel"]'
  3177. };
  3178. var PointerType = {
  3179. TOUCH: 'touch',
  3180. PEN: 'pen'
  3181. };
  3182. /**
  3183. * ------------------------------------------------------------------------
  3184. * Class Definition
  3185. * ------------------------------------------------------------------------
  3186. */
  3187. var Carousel =
  3188. /*#__PURE__*/
  3189. function () {
  3190. function Carousel(element, config) {
  3191. this._items = null;
  3192. this._interval = null;
  3193. this._activeElement = null;
  3194. this._isPaused = false;
  3195. this._isSliding = false;
  3196. this.touchTimeout = null;
  3197. this.touchStartX = 0;
  3198. this.touchDeltaX = 0;
  3199. this._config = this._getConfig(config);
  3200. this._element = element;
  3201. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3202. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3203. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3204. this._addEventListeners();
  3205. } // Getters
  3206. var _proto = Carousel.prototype;
  3207. // Public
  3208. _proto.next = function next() {
  3209. if (!this._isSliding) {
  3210. this._slide(Direction.NEXT);
  3211. }
  3212. };
  3213. _proto.nextWhenVisible = function nextWhenVisible() {
  3214. // Don't call next when the page isn't visible
  3215. // or the carousel or its parent isn't visible
  3216. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3217. this.next();
  3218. }
  3219. };
  3220. _proto.prev = function prev() {
  3221. if (!this._isSliding) {
  3222. this._slide(Direction.PREV);
  3223. }
  3224. };
  3225. _proto.pause = function pause(event) {
  3226. if (!event) {
  3227. this._isPaused = true;
  3228. }
  3229. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3230. Util.triggerTransitionEnd(this._element);
  3231. this.cycle(true);
  3232. }
  3233. clearInterval(this._interval);
  3234. this._interval = null;
  3235. };
  3236. _proto.cycle = function cycle(event) {
  3237. if (!event) {
  3238. this._isPaused = false;
  3239. }
  3240. if (this._interval) {
  3241. clearInterval(this._interval);
  3242. this._interval = null;
  3243. }
  3244. if (this._config.interval && !this._isPaused) {
  3245. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3246. }
  3247. };
  3248. _proto.to = function to(index) {
  3249. var _this = this;
  3250. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3251. var activeIndex = this._getItemIndex(this._activeElement);
  3252. if (index > this._items.length - 1 || index < 0) {
  3253. return;
  3254. }
  3255. if (this._isSliding) {
  3256. $(this._element).one(Event$2.SLID, function () {
  3257. return _this.to(index);
  3258. });
  3259. return;
  3260. }
  3261. if (activeIndex === index) {
  3262. this.pause();
  3263. this.cycle();
  3264. return;
  3265. }
  3266. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3267. this._slide(direction, this._items[index]);
  3268. };
  3269. _proto.dispose = function dispose() {
  3270. $(this._element).off(EVENT_KEY$2);
  3271. $.removeData(this._element, DATA_KEY$2);
  3272. this._items = null;
  3273. this._config = null;
  3274. this._element = null;
  3275. this._interval = null;
  3276. this._isPaused = null;
  3277. this._isSliding = null;
  3278. this._activeElement = null;
  3279. this._indicatorsElement = null;
  3280. } // Private
  3281. ;
  3282. _proto._getConfig = function _getConfig(config) {
  3283. config = _objectSpread2({}, Default, {}, config);
  3284. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3285. return config;
  3286. };
  3287. _proto._handleSwipe = function _handleSwipe() {
  3288. var absDeltax = Math.abs(this.touchDeltaX);
  3289. if (absDeltax <= SWIPE_THRESHOLD) {
  3290. return;
  3291. }
  3292. var direction = absDeltax / this.touchDeltaX;
  3293. this.touchDeltaX = 0; // swipe left
  3294. if (direction > 0) {
  3295. this.prev();
  3296. } // swipe right
  3297. if (direction < 0) {
  3298. this.next();
  3299. }
  3300. };
  3301. _proto._addEventListeners = function _addEventListeners() {
  3302. var _this2 = this;
  3303. if (this._config.keyboard) {
  3304. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3305. return _this2._keydown(event);
  3306. });
  3307. }
  3308. if (this._config.pause === 'hover') {
  3309. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3310. return _this2.pause(event);
  3311. }).on(Event$2.MOUSELEAVE, function (event) {
  3312. return _this2.cycle(event);
  3313. });
  3314. }
  3315. if (this._config.touch) {
  3316. this._addTouchEventListeners();
  3317. }
  3318. };
  3319. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3320. var _this3 = this;
  3321. if (!this._touchSupported) {
  3322. return;
  3323. }
  3324. var start = function start(event) {
  3325. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3326. _this3.touchStartX = event.originalEvent.clientX;
  3327. } else if (!_this3._pointerEvent) {
  3328. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3329. }
  3330. };
  3331. var move = function move(event) {
  3332. // ensure swiping with one touch and not pinching
  3333. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3334. _this3.touchDeltaX = 0;
  3335. } else {
  3336. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3337. }
  3338. };
  3339. var end = function end(event) {
  3340. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3341. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3342. }
  3343. _this3._handleSwipe();
  3344. if (_this3._config.pause === 'hover') {
  3345. // If it's a touch-enabled device, mouseenter/leave are fired as
  3346. // part of the mouse compatibility events on first tap - the carousel
  3347. // would stop cycling until user tapped out of it;
  3348. // here, we listen for touchend, explicitly pause the carousel
  3349. // (as if it's the second time we tap on it, mouseenter compat event
  3350. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3351. // events to fire) we explicitly restart cycling
  3352. _this3.pause();
  3353. if (_this3.touchTimeout) {
  3354. clearTimeout(_this3.touchTimeout);
  3355. }
  3356. _this3.touchTimeout = setTimeout(function (event) {
  3357. return _this3.cycle(event);
  3358. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3359. }
  3360. };
  3361. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3362. return e.preventDefault();
  3363. });
  3364. if (this._pointerEvent) {
  3365. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3366. return start(event);
  3367. });
  3368. $(this._element).on(Event$2.POINTERUP, function (event) {
  3369. return end(event);
  3370. });
  3371. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3372. } else {
  3373. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3374. return start(event);
  3375. });
  3376. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3377. return move(event);
  3378. });
  3379. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3380. return end(event);
  3381. });
  3382. }
  3383. };
  3384. _proto._keydown = function _keydown(event) {
  3385. if (/input|textarea/i.test(event.target.tagName)) {
  3386. return;
  3387. }
  3388. switch (event.which) {
  3389. case ARROW_LEFT_KEYCODE:
  3390. event.preventDefault();
  3391. this.prev();
  3392. break;
  3393. case ARROW_RIGHT_KEYCODE:
  3394. event.preventDefault();
  3395. this.next();
  3396. break;
  3397. }
  3398. };
  3399. _proto._getItemIndex = function _getItemIndex(element) {
  3400. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3401. return this._items.indexOf(element);
  3402. };
  3403. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3404. var isNextDirection = direction === Direction.NEXT;
  3405. var isPrevDirection = direction === Direction.PREV;
  3406. var activeIndex = this._getItemIndex(activeElement);
  3407. var lastItemIndex = this._items.length - 1;
  3408. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3409. if (isGoingToWrap && !this._config.wrap) {
  3410. return activeElement;
  3411. }
  3412. var delta = direction === Direction.PREV ? -1 : 1;
  3413. var itemIndex = (activeIndex + delta) % this._items.length;
  3414. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3415. };
  3416. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3417. var targetIndex = this._getItemIndex(relatedTarget);
  3418. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3419. var slideEvent = $.Event(Event$2.SLIDE, {
  3420. relatedTarget: relatedTarget,
  3421. direction: eventDirectionName,
  3422. from: fromIndex,
  3423. to: targetIndex
  3424. });
  3425. $(this._element).trigger(slideEvent);
  3426. return slideEvent;
  3427. };
  3428. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3429. if (this._indicatorsElement) {
  3430. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3431. $(indicators).removeClass(ClassName$2.ACTIVE);
  3432. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3433. if (nextIndicator) {
  3434. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3435. }
  3436. }
  3437. };
  3438. _proto._slide = function _slide(direction, element) {
  3439. var _this4 = this;
  3440. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3441. var activeElementIndex = this._getItemIndex(activeElement);
  3442. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3443. var nextElementIndex = this._getItemIndex(nextElement);
  3444. var isCycling = Boolean(this._interval);
  3445. var directionalClassName;
  3446. var orderClassName;
  3447. var eventDirectionName;
  3448. if (direction === Direction.NEXT) {
  3449. directionalClassName = ClassName$2.LEFT;
  3450. orderClassName = ClassName$2.NEXT;
  3451. eventDirectionName = Direction.LEFT;
  3452. } else {
  3453. directionalClassName = ClassName$2.RIGHT;
  3454. orderClassName = ClassName$2.PREV;
  3455. eventDirectionName = Direction.RIGHT;
  3456. }
  3457. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3458. this._isSliding = false;
  3459. return;
  3460. }
  3461. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3462. if (slideEvent.isDefaultPrevented()) {
  3463. return;
  3464. }
  3465. if (!activeElement || !nextElement) {
  3466. // Some weirdness is happening, so we bail
  3467. return;
  3468. }
  3469. this._isSliding = true;
  3470. if (isCycling) {
  3471. this.pause();
  3472. }
  3473. this._setActiveIndicatorElement(nextElement);
  3474. var slidEvent = $.Event(Event$2.SLID, {
  3475. relatedTarget: nextElement,
  3476. direction: eventDirectionName,
  3477. from: activeElementIndex,
  3478. to: nextElementIndex
  3479. });
  3480. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3481. $(nextElement).addClass(orderClassName);
  3482. Util.reflow(nextElement);
  3483. $(activeElement).addClass(directionalClassName);
  3484. $(nextElement).addClass(directionalClassName);
  3485. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3486. if (nextElementInterval) {
  3487. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3488. this._config.interval = nextElementInterval;
  3489. } else {
  3490. this._config.interval = this._config.defaultInterval || this._config.interval;
  3491. }
  3492. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3493. $(activeElement).one(Util.TRANSITION_END, function () {
  3494. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3495. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3496. _this4._isSliding = false;
  3497. setTimeout(function () {
  3498. return $(_this4._element).trigger(slidEvent);
  3499. }, 0);
  3500. }).emulateTransitionEnd(transitionDuration);
  3501. } else {
  3502. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3503. $(nextElement).addClass(ClassName$2.ACTIVE);
  3504. this._isSliding = false;
  3505. $(this._element).trigger(slidEvent);
  3506. }
  3507. if (isCycling) {
  3508. this.cycle();
  3509. }
  3510. } // Static
  3511. ;
  3512. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3513. return this.each(function () {
  3514. var data = $(this).data(DATA_KEY$2);
  3515. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3516. if (typeof config === 'object') {
  3517. _config = _objectSpread2({}, _config, {}, config);
  3518. }
  3519. var action = typeof config === 'string' ? config : _config.slide;
  3520. if (!data) {
  3521. data = new Carousel(this, _config);
  3522. $(this).data(DATA_KEY$2, data);
  3523. }
  3524. if (typeof config === 'number') {
  3525. data.to(config);
  3526. } else if (typeof action === 'string') {
  3527. if (typeof data[action] === 'undefined') {
  3528. throw new TypeError("No method named \"" + action + "\"");
  3529. }
  3530. data[action]();
  3531. } else if (_config.interval && _config.ride) {
  3532. data.pause();
  3533. data.cycle();
  3534. }
  3535. });
  3536. };
  3537. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3538. var selector = Util.getSelectorFromElement(this);
  3539. if (!selector) {
  3540. return;
  3541. }
  3542. var target = $(selector)[0];
  3543. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3544. return;
  3545. }
  3546. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3547. var slideIndex = this.getAttribute('data-slide-to');
  3548. if (slideIndex) {
  3549. config.interval = false;
  3550. }
  3551. Carousel._jQueryInterface.call($(target), config);
  3552. if (slideIndex) {
  3553. $(target).data(DATA_KEY$2).to(slideIndex);
  3554. }
  3555. event.preventDefault();
  3556. };
  3557. _createClass(Carousel, null, [{
  3558. key: "VERSION",
  3559. get: function get() {
  3560. return VERSION$2;
  3561. }
  3562. }, {
  3563. key: "Default",
  3564. get: function get() {
  3565. return Default;
  3566. }
  3567. }]);
  3568. return Carousel;
  3569. }();
  3570. /**
  3571. * ------------------------------------------------------------------------
  3572. * Data Api implementation
  3573. * ------------------------------------------------------------------------
  3574. */
  3575. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3576. $(window).on(Event$2.LOAD_DATA_API, function () {
  3577. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3578. for (var i = 0, len = carousels.length; i < len; i++) {
  3579. var $carousel = $(carousels[i]);
  3580. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3581. }
  3582. });
  3583. /**
  3584. * ------------------------------------------------------------------------
  3585. * jQuery
  3586. * ------------------------------------------------------------------------
  3587. */
  3588. $.fn[NAME$2] = Carousel._jQueryInterface;
  3589. $.fn[NAME$2].Constructor = Carousel;
  3590. $.fn[NAME$2].noConflict = function () {
  3591. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3592. return Carousel._jQueryInterface;
  3593. };
  3594. /**
  3595. * ------------------------------------------------------------------------
  3596. * Constants
  3597. * ------------------------------------------------------------------------
  3598. */
  3599. var NAME$3 = 'collapse';
  3600. var VERSION$3 = '4.4.1';
  3601. var DATA_KEY$3 = 'bs.collapse';
  3602. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3603. var DATA_API_KEY$3 = '.data-api';
  3604. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3605. var Default$1 = {
  3606. toggle: true,
  3607. parent: ''
  3608. };
  3609. var DefaultType$1 = {
  3610. toggle: 'boolean',
  3611. parent: '(string|element)'
  3612. };
  3613. var Event$3 = {
  3614. SHOW: "show" + EVENT_KEY$3,
  3615. SHOWN: "shown" + EVENT_KEY$3,
  3616. HIDE: "hide" + EVENT_KEY$3,
  3617. HIDDEN: "hidden" + EVENT_KEY$3,
  3618. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3619. };
  3620. var ClassName$3 = {
  3621. SHOW: 'show',
  3622. COLLAPSE: 'collapse',
  3623. COLLAPSING: 'collapsing',
  3624. COLLAPSED: 'collapsed'
  3625. };
  3626. var Dimension = {
  3627. WIDTH: 'width',
  3628. HEIGHT: 'height'
  3629. };
  3630. var Selector$3 = {
  3631. ACTIVES: '.show, .collapsing',
  3632. DATA_TOGGLE: '[data-toggle="collapse"]'
  3633. };
  3634. /**
  3635. * ------------------------------------------------------------------------
  3636. * Class Definition
  3637. * ------------------------------------------------------------------------
  3638. */
  3639. var Collapse =
  3640. /*#__PURE__*/
  3641. function () {
  3642. function Collapse(element, config) {
  3643. this._isTransitioning = false;
  3644. this._element = element;
  3645. this._config = this._getConfig(config);
  3646. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3647. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3648. for (var i = 0, len = toggleList.length; i < len; i++) {
  3649. var elem = toggleList[i];
  3650. var selector = Util.getSelectorFromElement(elem);
  3651. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3652. return foundElem === element;
  3653. });
  3654. if (selector !== null && filterElement.length > 0) {
  3655. this._selector = selector;
  3656. this._triggerArray.push(elem);
  3657. }
  3658. }
  3659. this._parent = this._config.parent ? this._getParent() : null;
  3660. if (!this._config.parent) {
  3661. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3662. }
  3663. if (this._config.toggle) {
  3664. this.toggle();
  3665. }
  3666. } // Getters
  3667. var _proto = Collapse.prototype;
  3668. // Public
  3669. _proto.toggle = function toggle() {
  3670. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3671. this.hide();
  3672. } else {
  3673. this.show();
  3674. }
  3675. };
  3676. _proto.show = function show() {
  3677. var _this = this;
  3678. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3679. return;
  3680. }
  3681. var actives;
  3682. var activesData;
  3683. if (this._parent) {
  3684. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3685. if (typeof _this._config.parent === 'string') {
  3686. return elem.getAttribute('data-parent') === _this._config.parent;
  3687. }
  3688. return elem.classList.contains(ClassName$3.COLLAPSE);
  3689. });
  3690. if (actives.length === 0) {
  3691. actives = null;
  3692. }
  3693. }
  3694. if (actives) {
  3695. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3696. if (activesData && activesData._isTransitioning) {
  3697. return;
  3698. }
  3699. }
  3700. var startEvent = $.Event(Event$3.SHOW);
  3701. $(this._element).trigger(startEvent);
  3702. if (startEvent.isDefaultPrevented()) {
  3703. return;
  3704. }
  3705. if (actives) {
  3706. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3707. if (!activesData) {
  3708. $(actives).data(DATA_KEY$3, null);
  3709. }
  3710. }
  3711. var dimension = this._getDimension();
  3712. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3713. this._element.style[dimension] = 0;
  3714. if (this._triggerArray.length) {
  3715. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3716. }
  3717. this.setTransitioning(true);
  3718. var complete = function complete() {
  3719. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3720. _this._element.style[dimension] = '';
  3721. _this.setTransitioning(false);
  3722. $(_this._element).trigger(Event$3.SHOWN);
  3723. };
  3724. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3725. var scrollSize = "scroll" + capitalizedDimension;
  3726. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3727. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3728. this._element.style[dimension] = this._element[scrollSize] + "px";
  3729. };
  3730. _proto.hide = function hide() {
  3731. var _this2 = this;
  3732. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3733. return;
  3734. }
  3735. var startEvent = $.Event(Event$3.HIDE);
  3736. $(this._element).trigger(startEvent);
  3737. if (startEvent.isDefaultPrevented()) {
  3738. return;
  3739. }
  3740. var dimension = this._getDimension();
  3741. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3742. Util.reflow(this._element);
  3743. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3744. var triggerArrayLength = this._triggerArray.length;
  3745. if (triggerArrayLength > 0) {
  3746. for (var i = 0; i < triggerArrayLength; i++) {
  3747. var trigger = this._triggerArray[i];
  3748. var selector = Util.getSelectorFromElement(trigger);
  3749. if (selector !== null) {
  3750. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3751. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3752. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3753. }
  3754. }
  3755. }
  3756. }
  3757. this.setTransitioning(true);
  3758. var complete = function complete() {
  3759. _this2.setTransitioning(false);
  3760. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3761. };
  3762. this._element.style[dimension] = '';
  3763. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3764. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3765. };
  3766. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3767. this._isTransitioning = isTransitioning;
  3768. };
  3769. _proto.dispose = function dispose() {
  3770. $.removeData(this._element, DATA_KEY$3);
  3771. this._config = null;
  3772. this._parent = null;
  3773. this._element = null;
  3774. this._triggerArray = null;
  3775. this._isTransitioning = null;
  3776. } // Private
  3777. ;
  3778. _proto._getConfig = function _getConfig(config) {
  3779. config = _objectSpread2({}, Default$1, {}, config);
  3780. config.toggle = Boolean(config.toggle); // Coerce string values
  3781. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3782. return config;
  3783. };
  3784. _proto._getDimension = function _getDimension() {
  3785. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3786. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3787. };
  3788. _proto._getParent = function _getParent() {
  3789. var _this3 = this;
  3790. var parent;
  3791. if (Util.isElement(this._config.parent)) {
  3792. parent = this._config.parent; // It's a jQuery object
  3793. if (typeof this._config.parent.jquery !== 'undefined') {
  3794. parent = this._config.parent[0];
  3795. }
  3796. } else {
  3797. parent = document.querySelector(this._config.parent);
  3798. }
  3799. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3800. var children = [].slice.call(parent.querySelectorAll(selector));
  3801. $(children).each(function (i, element) {
  3802. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3803. });
  3804. return parent;
  3805. };
  3806. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3807. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3808. if (triggerArray.length) {
  3809. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3810. }
  3811. } // Static
  3812. ;
  3813. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3814. var selector = Util.getSelectorFromElement(element);
  3815. return selector ? document.querySelector(selector) : null;
  3816. };
  3817. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3818. return this.each(function () {
  3819. var $this = $(this);
  3820. var data = $this.data(DATA_KEY$3);
  3821. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3822. if (!data && _config.toggle && /show|hide/.test(config)) {
  3823. _config.toggle = false;
  3824. }
  3825. if (!data) {
  3826. data = new Collapse(this, _config);
  3827. $this.data(DATA_KEY$3, data);
  3828. }
  3829. if (typeof config === 'string') {
  3830. if (typeof data[config] === 'undefined') {
  3831. throw new TypeError("No method named \"" + config + "\"");
  3832. }
  3833. data[config]();
  3834. }
  3835. });
  3836. };
  3837. _createClass(Collapse, null, [{
  3838. key: "VERSION",
  3839. get: function get() {
  3840. return VERSION$3;
  3841. }
  3842. }, {
  3843. key: "Default",
  3844. get: function get() {
  3845. return Default$1;
  3846. }
  3847. }]);
  3848. return Collapse;
  3849. }();
  3850. /**
  3851. * ------------------------------------------------------------------------
  3852. * Data Api implementation
  3853. * ------------------------------------------------------------------------
  3854. */
  3855. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3856. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3857. if (event.currentTarget.tagName === 'A') {
  3858. event.preventDefault();
  3859. }
  3860. var $trigger = $(this);
  3861. var selector = Util.getSelectorFromElement(this);
  3862. var selectors = [].slice.call(document.querySelectorAll(selector));
  3863. $(selectors).each(function () {
  3864. var $target = $(this);
  3865. var data = $target.data(DATA_KEY$3);
  3866. var config = data ? 'toggle' : $trigger.data();
  3867. Collapse._jQueryInterface.call($target, config);
  3868. });
  3869. });
  3870. /**
  3871. * ------------------------------------------------------------------------
  3872. * jQuery
  3873. * ------------------------------------------------------------------------
  3874. */
  3875. $.fn[NAME$3] = Collapse._jQueryInterface;
  3876. $.fn[NAME$3].Constructor = Collapse;
  3877. $.fn[NAME$3].noConflict = function () {
  3878. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3879. return Collapse._jQueryInterface;
  3880. };
  3881. /**
  3882. * ------------------------------------------------------------------------
  3883. * Constants
  3884. * ------------------------------------------------------------------------
  3885. */
  3886. var NAME$4 = 'dropdown';
  3887. var VERSION$4 = '4.4.1';
  3888. var DATA_KEY$4 = 'bs.dropdown';
  3889. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3890. var DATA_API_KEY$4 = '.data-api';
  3891. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3892. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3893. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3894. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3895. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3896. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3897. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3898. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3899. var Event$4 = {
  3900. HIDE: "hide" + EVENT_KEY$4,
  3901. HIDDEN: "hidden" + EVENT_KEY$4,
  3902. SHOW: "show" + EVENT_KEY$4,
  3903. SHOWN: "shown" + EVENT_KEY$4,
  3904. CLICK: "click" + EVENT_KEY$4,
  3905. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3906. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3907. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3908. };
  3909. var ClassName$4 = {
  3910. DISABLED: 'disabled',
  3911. SHOW: 'show',
  3912. DROPUP: 'dropup',
  3913. DROPRIGHT: 'dropright',
  3914. DROPLEFT: 'dropleft',
  3915. MENURIGHT: 'dropdown-menu-right',
  3916. MENULEFT: 'dropdown-menu-left',
  3917. POSITION_STATIC: 'position-static'
  3918. };
  3919. var Selector$4 = {
  3920. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3921. FORM_CHILD: '.dropdown form',
  3922. MENU: '.dropdown-menu',
  3923. NAVBAR_NAV: '.navbar-nav',
  3924. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3925. };
  3926. var AttachmentMap = {
  3927. TOP: 'top-start',
  3928. TOPEND: 'top-end',
  3929. BOTTOM: 'bottom-start',
  3930. BOTTOMEND: 'bottom-end',
  3931. RIGHT: 'right-start',
  3932. RIGHTEND: 'right-end',
  3933. LEFT: 'left-start',
  3934. LEFTEND: 'left-end'
  3935. };
  3936. var Default$2 = {
  3937. offset: 0,
  3938. flip: true,
  3939. boundary: 'scrollParent',
  3940. reference: 'toggle',
  3941. display: 'dynamic',
  3942. popperConfig: null
  3943. };
  3944. var DefaultType$2 = {
  3945. offset: '(number|string|function)',
  3946. flip: 'boolean',
  3947. boundary: '(string|element)',
  3948. reference: '(string|element)',
  3949. display: 'string',
  3950. popperConfig: '(null|object)'
  3951. };
  3952. /**
  3953. * ------------------------------------------------------------------------
  3954. * Class Definition
  3955. * ------------------------------------------------------------------------
  3956. */
  3957. var Dropdown =
  3958. /*#__PURE__*/
  3959. function () {
  3960. function Dropdown(element, config) {
  3961. this._element = element;
  3962. this._popper = null;
  3963. this._config = this._getConfig(config);
  3964. this._menu = this._getMenuElement();
  3965. this._inNavbar = this._detectNavbar();
  3966. this._addEventListeners();
  3967. } // Getters
  3968. var _proto = Dropdown.prototype;
  3969. // Public
  3970. _proto.toggle = function toggle() {
  3971. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3972. return;
  3973. }
  3974. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3975. Dropdown._clearMenus();
  3976. if (isActive) {
  3977. return;
  3978. }
  3979. this.show(true);
  3980. };
  3981. _proto.show = function show(usePopper) {
  3982. if (usePopper === void 0) {
  3983. usePopper = false;
  3984. }
  3985. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3986. return;
  3987. }
  3988. var relatedTarget = {
  3989. relatedTarget: this._element
  3990. };
  3991. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3992. var parent = Dropdown._getParentFromElement(this._element);
  3993. $(parent).trigger(showEvent);
  3994. if (showEvent.isDefaultPrevented()) {
  3995. return;
  3996. } // Disable totally Popper.js for Dropdown in Navbar
  3997. if (!this._inNavbar && usePopper) {
  3998. /**
  3999. * Check for Popper dependency
  4000. * Popper - https://popper.js.org
  4001. */
  4002. if (typeof Popper === 'undefined') {
  4003. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4004. }
  4005. var referenceElement = this._element;
  4006. if (this._config.reference === 'parent') {
  4007. referenceElement = parent;
  4008. } else if (Util.isElement(this._config.reference)) {
  4009. referenceElement = this._config.reference; // Check if it's jQuery element
  4010. if (typeof this._config.reference.jquery !== 'undefined') {
  4011. referenceElement = this._config.reference[0];
  4012. }
  4013. } // If boundary is not `scrollParent`, then set position to `static`
  4014. // to allow the menu to "escape" the scroll parent's boundaries
  4015. // https://github.com/twbs/bootstrap/issues/24251
  4016. if (this._config.boundary !== 'scrollParent') {
  4017. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4018. }
  4019. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4020. } // If this is a touch-enabled device we add extra
  4021. // empty mouseover listeners to the body's immediate children;
  4022. // only needed because of broken event delegation on iOS
  4023. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4024. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4025. $(document.body).children().on('mouseover', null, $.noop);
  4026. }
  4027. this._element.focus();
  4028. this._element.setAttribute('aria-expanded', true);
  4029. $(this._menu).toggleClass(ClassName$4.SHOW);
  4030. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4031. };
  4032. _proto.hide = function hide() {
  4033. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4034. return;
  4035. }
  4036. var relatedTarget = {
  4037. relatedTarget: this._element
  4038. };
  4039. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4040. var parent = Dropdown._getParentFromElement(this._element);
  4041. $(parent).trigger(hideEvent);
  4042. if (hideEvent.isDefaultPrevented()) {
  4043. return;
  4044. }
  4045. if (this._popper) {
  4046. this._popper.destroy();
  4047. }
  4048. $(this._menu).toggleClass(ClassName$4.SHOW);
  4049. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4050. };
  4051. _proto.dispose = function dispose() {
  4052. $.removeData(this._element, DATA_KEY$4);
  4053. $(this._element).off(EVENT_KEY$4);
  4054. this._element = null;
  4055. this._menu = null;
  4056. if (this._popper !== null) {
  4057. this._popper.destroy();
  4058. this._popper = null;
  4059. }
  4060. };
  4061. _proto.update = function update() {
  4062. this._inNavbar = this._detectNavbar();
  4063. if (this._popper !== null) {
  4064. this._popper.scheduleUpdate();
  4065. }
  4066. } // Private
  4067. ;
  4068. _proto._addEventListeners = function _addEventListeners() {
  4069. var _this = this;
  4070. $(this._element).on(Event$4.CLICK, function (event) {
  4071. event.preventDefault();
  4072. event.stopPropagation();
  4073. _this.toggle();
  4074. });
  4075. };
  4076. _proto._getConfig = function _getConfig(config) {
  4077. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4078. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4079. return config;
  4080. };
  4081. _proto._getMenuElement = function _getMenuElement() {
  4082. if (!this._menu) {
  4083. var parent = Dropdown._getParentFromElement(this._element);
  4084. if (parent) {
  4085. this._menu = parent.querySelector(Selector$4.MENU);
  4086. }
  4087. }
  4088. return this._menu;
  4089. };
  4090. _proto._getPlacement = function _getPlacement() {
  4091. var $parentDropdown = $(this._element.parentNode);
  4092. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4093. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4094. placement = AttachmentMap.TOP;
  4095. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4096. placement = AttachmentMap.TOPEND;
  4097. }
  4098. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4099. placement = AttachmentMap.RIGHT;
  4100. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4101. placement = AttachmentMap.LEFT;
  4102. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4103. placement = AttachmentMap.BOTTOMEND;
  4104. }
  4105. return placement;
  4106. };
  4107. _proto._detectNavbar = function _detectNavbar() {
  4108. return $(this._element).closest('.navbar').length > 0;
  4109. };
  4110. _proto._getOffset = function _getOffset() {
  4111. var _this2 = this;
  4112. var offset = {};
  4113. if (typeof this._config.offset === 'function') {
  4114. offset.fn = function (data) {
  4115. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4116. return data;
  4117. };
  4118. } else {
  4119. offset.offset = this._config.offset;
  4120. }
  4121. return offset;
  4122. };
  4123. _proto._getPopperConfig = function _getPopperConfig() {
  4124. var popperConfig = {
  4125. placement: this._getPlacement(),
  4126. modifiers: {
  4127. offset: this._getOffset(),
  4128. flip: {
  4129. enabled: this._config.flip
  4130. },
  4131. preventOverflow: {
  4132. boundariesElement: this._config.boundary
  4133. }
  4134. }
  4135. }; // Disable Popper.js if we have a static display
  4136. if (this._config.display === 'static') {
  4137. popperConfig.modifiers.applyStyle = {
  4138. enabled: false
  4139. };
  4140. }
  4141. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4142. } // Static
  4143. ;
  4144. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4145. return this.each(function () {
  4146. var data = $(this).data(DATA_KEY$4);
  4147. var _config = typeof config === 'object' ? config : null;
  4148. if (!data) {
  4149. data = new Dropdown(this, _config);
  4150. $(this).data(DATA_KEY$4, data);
  4151. }
  4152. if (typeof config === 'string') {
  4153. if (typeof data[config] === 'undefined') {
  4154. throw new TypeError("No method named \"" + config + "\"");
  4155. }
  4156. data[config]();
  4157. }
  4158. });
  4159. };
  4160. Dropdown._clearMenus = function _clearMenus(event) {
  4161. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4162. return;
  4163. }
  4164. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4165. for (var i = 0, len = toggles.length; i < len; i++) {
  4166. var parent = Dropdown._getParentFromElement(toggles[i]);
  4167. var context = $(toggles[i]).data(DATA_KEY$4);
  4168. var relatedTarget = {
  4169. relatedTarget: toggles[i]
  4170. };
  4171. if (event && event.type === 'click') {
  4172. relatedTarget.clickEvent = event;
  4173. }
  4174. if (!context) {
  4175. continue;
  4176. }
  4177. var dropdownMenu = context._menu;
  4178. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4179. continue;
  4180. }
  4181. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4182. continue;
  4183. }
  4184. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4185. $(parent).trigger(hideEvent);
  4186. if (hideEvent.isDefaultPrevented()) {
  4187. continue;
  4188. } // If this is a touch-enabled device we remove the extra
  4189. // empty mouseover listeners we added for iOS support
  4190. if ('ontouchstart' in document.documentElement) {
  4191. $(document.body).children().off('mouseover', null, $.noop);
  4192. }
  4193. toggles[i].setAttribute('aria-expanded', 'false');
  4194. if (context._popper) {
  4195. context._popper.destroy();
  4196. }
  4197. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4198. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4199. }
  4200. };
  4201. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4202. var parent;
  4203. var selector = Util.getSelectorFromElement(element);
  4204. if (selector) {
  4205. parent = document.querySelector(selector);
  4206. }
  4207. return parent || element.parentNode;
  4208. } // eslint-disable-next-line complexity
  4209. ;
  4210. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4211. // If not input/textarea:
  4212. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4213. // If input/textarea:
  4214. // - If space key => not a dropdown command
  4215. // - If key is other than escape
  4216. // - If key is not up or down => not a dropdown command
  4217. // - If trigger inside the menu => not a dropdown command
  4218. 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)) {
  4219. return;
  4220. }
  4221. event.preventDefault();
  4222. event.stopPropagation();
  4223. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4224. return;
  4225. }
  4226. var parent = Dropdown._getParentFromElement(this);
  4227. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4228. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4229. return;
  4230. }
  4231. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4232. if (event.which === ESCAPE_KEYCODE) {
  4233. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4234. $(toggle).trigger('focus');
  4235. }
  4236. $(this).trigger('click');
  4237. return;
  4238. }
  4239. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4240. return $(item).is(':visible');
  4241. });
  4242. if (items.length === 0) {
  4243. return;
  4244. }
  4245. var index = items.indexOf(event.target);
  4246. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4247. // Up
  4248. index--;
  4249. }
  4250. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4251. // Down
  4252. index++;
  4253. }
  4254. if (index < 0) {
  4255. index = 0;
  4256. }
  4257. items[index].focus();
  4258. };
  4259. _createClass(Dropdown, null, [{
  4260. key: "VERSION",
  4261. get: function get() {
  4262. return VERSION$4;
  4263. }
  4264. }, {
  4265. key: "Default",
  4266. get: function get() {
  4267. return Default$2;
  4268. }
  4269. }, {
  4270. key: "DefaultType",
  4271. get: function get() {
  4272. return DefaultType$2;
  4273. }
  4274. }]);
  4275. return Dropdown;
  4276. }();
  4277. /**
  4278. * ------------------------------------------------------------------------
  4279. * Data Api implementation
  4280. * ------------------------------------------------------------------------
  4281. */
  4282. $(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) {
  4283. event.preventDefault();
  4284. event.stopPropagation();
  4285. Dropdown._jQueryInterface.call($(this), 'toggle');
  4286. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4287. e.stopPropagation();
  4288. });
  4289. /**
  4290. * ------------------------------------------------------------------------
  4291. * jQuery
  4292. * ------------------------------------------------------------------------
  4293. */
  4294. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4295. $.fn[NAME$4].Constructor = Dropdown;
  4296. $.fn[NAME$4].noConflict = function () {
  4297. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4298. return Dropdown._jQueryInterface;
  4299. };
  4300. /**
  4301. * ------------------------------------------------------------------------
  4302. * Constants
  4303. * ------------------------------------------------------------------------
  4304. */
  4305. var NAME$5 = 'modal';
  4306. var VERSION$5 = '4.4.1';
  4307. var DATA_KEY$5 = 'bs.modal';
  4308. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4309. var DATA_API_KEY$5 = '.data-api';
  4310. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4311. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4312. var Default$3 = {
  4313. backdrop: true,
  4314. keyboard: true,
  4315. focus: true,
  4316. show: true
  4317. };
  4318. var DefaultType$3 = {
  4319. backdrop: '(boolean|string)',
  4320. keyboard: 'boolean',
  4321. focus: 'boolean',
  4322. show: 'boolean'
  4323. };
  4324. var Event$5 = {
  4325. HIDE: "hide" + EVENT_KEY$5,
  4326. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4327. HIDDEN: "hidden" + EVENT_KEY$5,
  4328. SHOW: "show" + EVENT_KEY$5,
  4329. SHOWN: "shown" + EVENT_KEY$5,
  4330. FOCUSIN: "focusin" + EVENT_KEY$5,
  4331. RESIZE: "resize" + EVENT_KEY$5,
  4332. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4333. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4334. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4335. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4336. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4337. };
  4338. var ClassName$5 = {
  4339. SCROLLABLE: 'modal-dialog-scrollable',
  4340. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4341. BACKDROP: 'modal-backdrop',
  4342. OPEN: 'modal-open',
  4343. FADE: 'fade',
  4344. SHOW: 'show',
  4345. STATIC: 'modal-static'
  4346. };
  4347. var Selector$5 = {
  4348. DIALOG: '.modal-dialog',
  4349. MODAL_BODY: '.modal-body',
  4350. DATA_TOGGLE: '[data-toggle="modal"]',
  4351. DATA_DISMISS: '[data-dismiss="modal"]',
  4352. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4353. STICKY_CONTENT: '.sticky-top'
  4354. };
  4355. /**
  4356. * ------------------------------------------------------------------------
  4357. * Class Definition
  4358. * ------------------------------------------------------------------------
  4359. */
  4360. var Modal =
  4361. /*#__PURE__*/
  4362. function () {
  4363. function Modal(element, config) {
  4364. this._config = this._getConfig(config);
  4365. this._element = element;
  4366. this._dialog = element.querySelector(Selector$5.DIALOG);
  4367. this._backdrop = null;
  4368. this._isShown = false;
  4369. this._isBodyOverflowing = false;
  4370. this._ignoreBackdropClick = false;
  4371. this._isTransitioning = false;
  4372. this._scrollbarWidth = 0;
  4373. } // Getters
  4374. var _proto = Modal.prototype;
  4375. // Public
  4376. _proto.toggle = function toggle(relatedTarget) {
  4377. return this._isShown ? this.hide() : this.show(relatedTarget);
  4378. };
  4379. _proto.show = function show(relatedTarget) {
  4380. var _this = this;
  4381. if (this._isShown || this._isTransitioning) {
  4382. return;
  4383. }
  4384. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4385. this._isTransitioning = true;
  4386. }
  4387. var showEvent = $.Event(Event$5.SHOW, {
  4388. relatedTarget: relatedTarget
  4389. });
  4390. $(this._element).trigger(showEvent);
  4391. if (this._isShown || showEvent.isDefaultPrevented()) {
  4392. return;
  4393. }
  4394. this._isShown = true;
  4395. this._checkScrollbar();
  4396. this._setScrollbar();
  4397. this._adjustDialog();
  4398. this._setEscapeEvent();
  4399. this._setResizeEvent();
  4400. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4401. return _this.hide(event);
  4402. });
  4403. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4404. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4405. if ($(event.target).is(_this._element)) {
  4406. _this._ignoreBackdropClick = true;
  4407. }
  4408. });
  4409. });
  4410. this._showBackdrop(function () {
  4411. return _this._showElement(relatedTarget);
  4412. });
  4413. };
  4414. _proto.hide = function hide(event) {
  4415. var _this2 = this;
  4416. if (event) {
  4417. event.preventDefault();
  4418. }
  4419. if (!this._isShown || this._isTransitioning) {
  4420. return;
  4421. }
  4422. var hideEvent = $.Event(Event$5.HIDE);
  4423. $(this._element).trigger(hideEvent);
  4424. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4425. return;
  4426. }
  4427. this._isShown = false;
  4428. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4429. if (transition) {
  4430. this._isTransitioning = true;
  4431. }
  4432. this._setEscapeEvent();
  4433. this._setResizeEvent();
  4434. $(document).off(Event$5.FOCUSIN);
  4435. $(this._element).removeClass(ClassName$5.SHOW);
  4436. $(this._element).off(Event$5.CLICK_DISMISS);
  4437. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4438. if (transition) {
  4439. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4440. $(this._element).one(Util.TRANSITION_END, function (event) {
  4441. return _this2._hideModal(event);
  4442. }).emulateTransitionEnd(transitionDuration);
  4443. } else {
  4444. this._hideModal();
  4445. }
  4446. };
  4447. _proto.dispose = function dispose() {
  4448. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4449. return $(htmlElement).off(EVENT_KEY$5);
  4450. });
  4451. /**
  4452. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4453. * Do not move `document` in `htmlElements` array
  4454. * It will remove `Event.CLICK_DATA_API` event that should remain
  4455. */
  4456. $(document).off(Event$5.FOCUSIN);
  4457. $.removeData(this._element, DATA_KEY$5);
  4458. this._config = null;
  4459. this._element = null;
  4460. this._dialog = null;
  4461. this._backdrop = null;
  4462. this._isShown = null;
  4463. this._isBodyOverflowing = null;
  4464. this._ignoreBackdropClick = null;
  4465. this._isTransitioning = null;
  4466. this._scrollbarWidth = null;
  4467. };
  4468. _proto.handleUpdate = function handleUpdate() {
  4469. this._adjustDialog();
  4470. } // Private
  4471. ;
  4472. _proto._getConfig = function _getConfig(config) {
  4473. config = _objectSpread2({}, Default$3, {}, config);
  4474. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4475. return config;
  4476. };
  4477. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4478. var _this3 = this;
  4479. if (this._config.backdrop === 'static') {
  4480. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4481. $(this._element).trigger(hideEventPrevented);
  4482. if (hideEventPrevented.defaultPrevented) {
  4483. return;
  4484. }
  4485. this._element.classList.add(ClassName$5.STATIC);
  4486. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4487. $(this._element).one(Util.TRANSITION_END, function () {
  4488. _this3._element.classList.remove(ClassName$5.STATIC);
  4489. }).emulateTransitionEnd(modalTransitionDuration);
  4490. this._element.focus();
  4491. } else {
  4492. this.hide();
  4493. }
  4494. };
  4495. _proto._showElement = function _showElement(relatedTarget) {
  4496. var _this4 = this;
  4497. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4498. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4499. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4500. // Don't move modal's DOM position
  4501. document.body.appendChild(this._element);
  4502. }
  4503. this._element.style.display = 'block';
  4504. this._element.removeAttribute('aria-hidden');
  4505. this._element.setAttribute('aria-modal', true);
  4506. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4507. modalBody.scrollTop = 0;
  4508. } else {
  4509. this._element.scrollTop = 0;
  4510. }
  4511. if (transition) {
  4512. Util.reflow(this._element);
  4513. }
  4514. $(this._element).addClass(ClassName$5.SHOW);
  4515. if (this._config.focus) {
  4516. this._enforceFocus();
  4517. }
  4518. var shownEvent = $.Event(Event$5.SHOWN, {
  4519. relatedTarget: relatedTarget
  4520. });
  4521. var transitionComplete = function transitionComplete() {
  4522. if (_this4._config.focus) {
  4523. _this4._element.focus();
  4524. }
  4525. _this4._isTransitioning = false;
  4526. $(_this4._element).trigger(shownEvent);
  4527. };
  4528. if (transition) {
  4529. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4530. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4531. } else {
  4532. transitionComplete();
  4533. }
  4534. };
  4535. _proto._enforceFocus = function _enforceFocus() {
  4536. var _this5 = this;
  4537. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4538. .on(Event$5.FOCUSIN, function (event) {
  4539. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4540. _this5._element.focus();
  4541. }
  4542. });
  4543. };
  4544. _proto._setEscapeEvent = function _setEscapeEvent() {
  4545. var _this6 = this;
  4546. if (this._isShown && this._config.keyboard) {
  4547. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4548. if (event.which === ESCAPE_KEYCODE$1) {
  4549. _this6._triggerBackdropTransition();
  4550. }
  4551. });
  4552. } else if (!this._isShown) {
  4553. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4554. }
  4555. };
  4556. _proto._setResizeEvent = function _setResizeEvent() {
  4557. var _this7 = this;
  4558. if (this._isShown) {
  4559. $(window).on(Event$5.RESIZE, function (event) {
  4560. return _this7.handleUpdate(event);
  4561. });
  4562. } else {
  4563. $(window).off(Event$5.RESIZE);
  4564. }
  4565. };
  4566. _proto._hideModal = function _hideModal() {
  4567. var _this8 = this;
  4568. this._element.style.display = 'none';
  4569. this._element.setAttribute('aria-hidden', true);
  4570. this._element.removeAttribute('aria-modal');
  4571. this._isTransitioning = false;
  4572. this._showBackdrop(function () {
  4573. $(document.body).removeClass(ClassName$5.OPEN);
  4574. _this8._resetAdjustments();
  4575. _this8._resetScrollbar();
  4576. $(_this8._element).trigger(Event$5.HIDDEN);
  4577. });
  4578. };
  4579. _proto._removeBackdrop = function _removeBackdrop() {
  4580. if (this._backdrop) {
  4581. $(this._backdrop).remove();
  4582. this._backdrop = null;
  4583. }
  4584. };
  4585. _proto._showBackdrop = function _showBackdrop(callback) {
  4586. var _this9 = this;
  4587. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4588. if (this._isShown && this._config.backdrop) {
  4589. this._backdrop = document.createElement('div');
  4590. this._backdrop.className = ClassName$5.BACKDROP;
  4591. if (animate) {
  4592. this._backdrop.classList.add(animate);
  4593. }
  4594. $(this._backdrop).appendTo(document.body);
  4595. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4596. if (_this9._ignoreBackdropClick) {
  4597. _this9._ignoreBackdropClick = false;
  4598. return;
  4599. }
  4600. if (event.target !== event.currentTarget) {
  4601. return;
  4602. }
  4603. _this9._triggerBackdropTransition();
  4604. });
  4605. if (animate) {
  4606. Util.reflow(this._backdrop);
  4607. }
  4608. $(this._backdrop).addClass(ClassName$5.SHOW);
  4609. if (!callback) {
  4610. return;
  4611. }
  4612. if (!animate) {
  4613. callback();
  4614. return;
  4615. }
  4616. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4617. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4618. } else if (!this._isShown && this._backdrop) {
  4619. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4620. var callbackRemove = function callbackRemove() {
  4621. _this9._removeBackdrop();
  4622. if (callback) {
  4623. callback();
  4624. }
  4625. };
  4626. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4627. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4628. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4629. } else {
  4630. callbackRemove();
  4631. }
  4632. } else if (callback) {
  4633. callback();
  4634. }
  4635. } // ----------------------------------------------------------------------
  4636. // the following methods are used to handle overflowing modals
  4637. // todo (fat): these should probably be refactored out of modal.js
  4638. // ----------------------------------------------------------------------
  4639. ;
  4640. _proto._adjustDialog = function _adjustDialog() {
  4641. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4642. if (!this._isBodyOverflowing && isModalOverflowing) {
  4643. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4644. }
  4645. if (this._isBodyOverflowing && !isModalOverflowing) {
  4646. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4647. }
  4648. };
  4649. _proto._resetAdjustments = function _resetAdjustments() {
  4650. this._element.style.paddingLeft = '';
  4651. this._element.style.paddingRight = '';
  4652. };
  4653. _proto._checkScrollbar = function _checkScrollbar() {
  4654. var rect = document.body.getBoundingClientRect();
  4655. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4656. this._scrollbarWidth = this._getScrollbarWidth();
  4657. };
  4658. _proto._setScrollbar = function _setScrollbar() {
  4659. var _this10 = this;
  4660. if (this._isBodyOverflowing) {
  4661. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4662. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4663. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4664. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4665. $(fixedContent).each(function (index, element) {
  4666. var actualPadding = element.style.paddingRight;
  4667. var calculatedPadding = $(element).css('padding-right');
  4668. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4669. }); // Adjust sticky content margin
  4670. $(stickyContent).each(function (index, element) {
  4671. var actualMargin = element.style.marginRight;
  4672. var calculatedMargin = $(element).css('margin-right');
  4673. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4674. }); // Adjust body padding
  4675. var actualPadding = document.body.style.paddingRight;
  4676. var calculatedPadding = $(document.body).css('padding-right');
  4677. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4678. }
  4679. $(document.body).addClass(ClassName$5.OPEN);
  4680. };
  4681. _proto._resetScrollbar = function _resetScrollbar() {
  4682. // Restore fixed content padding
  4683. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4684. $(fixedContent).each(function (index, element) {
  4685. var padding = $(element).data('padding-right');
  4686. $(element).removeData('padding-right');
  4687. element.style.paddingRight = padding ? padding : '';
  4688. }); // Restore sticky content
  4689. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4690. $(elements).each(function (index, element) {
  4691. var margin = $(element).data('margin-right');
  4692. if (typeof margin !== 'undefined') {
  4693. $(element).css('margin-right', margin).removeData('margin-right');
  4694. }
  4695. }); // Restore body padding
  4696. var padding = $(document.body).data('padding-right');
  4697. $(document.body).removeData('padding-right');
  4698. document.body.style.paddingRight = padding ? padding : '';
  4699. };
  4700. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4701. // thx d.walsh
  4702. var scrollDiv = document.createElement('div');
  4703. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4704. document.body.appendChild(scrollDiv);
  4705. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4706. document.body.removeChild(scrollDiv);
  4707. return scrollbarWidth;
  4708. } // Static
  4709. ;
  4710. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4711. return this.each(function () {
  4712. var data = $(this).data(DATA_KEY$5);
  4713. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4714. if (!data) {
  4715. data = new Modal(this, _config);
  4716. $(this).data(DATA_KEY$5, data);
  4717. }
  4718. if (typeof config === 'string') {
  4719. if (typeof data[config] === 'undefined') {
  4720. throw new TypeError("No method named \"" + config + "\"");
  4721. }
  4722. data[config](relatedTarget);
  4723. } else if (_config.show) {
  4724. data.show(relatedTarget);
  4725. }
  4726. });
  4727. };
  4728. _createClass(Modal, null, [{
  4729. key: "VERSION",
  4730. get: function get() {
  4731. return VERSION$5;
  4732. }
  4733. }, {
  4734. key: "Default",
  4735. get: function get() {
  4736. return Default$3;
  4737. }
  4738. }]);
  4739. return Modal;
  4740. }();
  4741. /**
  4742. * ------------------------------------------------------------------------
  4743. * Data Api implementation
  4744. * ------------------------------------------------------------------------
  4745. */
  4746. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4747. var _this11 = this;
  4748. var target;
  4749. var selector = Util.getSelectorFromElement(this);
  4750. if (selector) {
  4751. target = document.querySelector(selector);
  4752. }
  4753. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4754. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4755. event.preventDefault();
  4756. }
  4757. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4758. if (showEvent.isDefaultPrevented()) {
  4759. // Only register focus restorer if modal will actually get shown
  4760. return;
  4761. }
  4762. $target.one(Event$5.HIDDEN, function () {
  4763. if ($(_this11).is(':visible')) {
  4764. _this11.focus();
  4765. }
  4766. });
  4767. });
  4768. Modal._jQueryInterface.call($(target), config, this);
  4769. });
  4770. /**
  4771. * ------------------------------------------------------------------------
  4772. * jQuery
  4773. * ------------------------------------------------------------------------
  4774. */
  4775. $.fn[NAME$5] = Modal._jQueryInterface;
  4776. $.fn[NAME$5].Constructor = Modal;
  4777. $.fn[NAME$5].noConflict = function () {
  4778. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4779. return Modal._jQueryInterface;
  4780. };
  4781. /**
  4782. * --------------------------------------------------------------------------
  4783. * Bootstrap (v4.4.1): tools/sanitizer.js
  4784. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4785. * --------------------------------------------------------------------------
  4786. */
  4787. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4788. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4789. var DefaultWhitelist = {
  4790. // Global attributes allowed on any supplied element below.
  4791. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4792. a: ['target', 'href', 'title', 'rel'],
  4793. area: [],
  4794. b: [],
  4795. br: [],
  4796. col: [],
  4797. code: [],
  4798. div: [],
  4799. em: [],
  4800. hr: [],
  4801. h1: [],
  4802. h2: [],
  4803. h3: [],
  4804. h4: [],
  4805. h5: [],
  4806. h6: [],
  4807. i: [],
  4808. img: ['src', 'alt', 'title', 'width', 'height'],
  4809. li: [],
  4810. ol: [],
  4811. p: [],
  4812. pre: [],
  4813. s: [],
  4814. small: [],
  4815. span: [],
  4816. sub: [],
  4817. sup: [],
  4818. strong: [],
  4819. u: [],
  4820. ul: []
  4821. };
  4822. /**
  4823. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4824. *
  4825. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4826. */
  4827. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4828. /**
  4829. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4830. *
  4831. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4832. */
  4833. 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;
  4834. function allowedAttribute(attr, allowedAttributeList) {
  4835. var attrName = attr.nodeName.toLowerCase();
  4836. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4837. if (uriAttrs.indexOf(attrName) !== -1) {
  4838. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4839. }
  4840. return true;
  4841. }
  4842. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4843. return attrRegex instanceof RegExp;
  4844. }); // Check if a regular expression validates the attribute.
  4845. for (var i = 0, l = regExp.length; i < l; i++) {
  4846. if (attrName.match(regExp[i])) {
  4847. return true;
  4848. }
  4849. }
  4850. return false;
  4851. }
  4852. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4853. if (unsafeHtml.length === 0) {
  4854. return unsafeHtml;
  4855. }
  4856. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4857. return sanitizeFn(unsafeHtml);
  4858. }
  4859. var domParser = new window.DOMParser();
  4860. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4861. var whitelistKeys = Object.keys(whiteList);
  4862. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4863. var _loop = function _loop(i, len) {
  4864. var el = elements[i];
  4865. var elName = el.nodeName.toLowerCase();
  4866. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4867. el.parentNode.removeChild(el);
  4868. return "continue";
  4869. }
  4870. var attributeList = [].slice.call(el.attributes);
  4871. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4872. attributeList.forEach(function (attr) {
  4873. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4874. el.removeAttribute(attr.nodeName);
  4875. }
  4876. });
  4877. };
  4878. for (var i = 0, len = elements.length; i < len; i++) {
  4879. var _ret = _loop(i);
  4880. if (_ret === "continue") continue;
  4881. }
  4882. return createdDocument.body.innerHTML;
  4883. }
  4884. /**
  4885. * ------------------------------------------------------------------------
  4886. * Constants
  4887. * ------------------------------------------------------------------------
  4888. */
  4889. var NAME$6 = 'tooltip';
  4890. var VERSION$6 = '4.4.1';
  4891. var DATA_KEY$6 = 'bs.tooltip';
  4892. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4893. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4894. var CLASS_PREFIX = 'bs-tooltip';
  4895. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4896. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4897. var DefaultType$4 = {
  4898. animation: 'boolean',
  4899. template: 'string',
  4900. title: '(string|element|function)',
  4901. trigger: 'string',
  4902. delay: '(number|object)',
  4903. html: 'boolean',
  4904. selector: '(string|boolean)',
  4905. placement: '(string|function)',
  4906. offset: '(number|string|function)',
  4907. container: '(string|element|boolean)',
  4908. fallbackPlacement: '(string|array)',
  4909. boundary: '(string|element)',
  4910. sanitize: 'boolean',
  4911. sanitizeFn: '(null|function)',
  4912. whiteList: 'object',
  4913. popperConfig: '(null|object)'
  4914. };
  4915. var AttachmentMap$1 = {
  4916. AUTO: 'auto',
  4917. TOP: 'top',
  4918. RIGHT: 'right',
  4919. BOTTOM: 'bottom',
  4920. LEFT: 'left'
  4921. };
  4922. var Default$4 = {
  4923. animation: true,
  4924. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4925. trigger: 'hover focus',
  4926. title: '',
  4927. delay: 0,
  4928. html: false,
  4929. selector: false,
  4930. placement: 'top',
  4931. offset: 0,
  4932. container: false,
  4933. fallbackPlacement: 'flip',
  4934. boundary: 'scrollParent',
  4935. sanitize: true,
  4936. sanitizeFn: null,
  4937. whiteList: DefaultWhitelist,
  4938. popperConfig: null
  4939. };
  4940. var HoverState = {
  4941. SHOW: 'show',
  4942. OUT: 'out'
  4943. };
  4944. var Event$6 = {
  4945. HIDE: "hide" + EVENT_KEY$6,
  4946. HIDDEN: "hidden" + EVENT_KEY$6,
  4947. SHOW: "show" + EVENT_KEY$6,
  4948. SHOWN: "shown" + EVENT_KEY$6,
  4949. INSERTED: "inserted" + EVENT_KEY$6,
  4950. CLICK: "click" + EVENT_KEY$6,
  4951. FOCUSIN: "focusin" + EVENT_KEY$6,
  4952. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4953. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4954. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4955. };
  4956. var ClassName$6 = {
  4957. FADE: 'fade',
  4958. SHOW: 'show'
  4959. };
  4960. var Selector$6 = {
  4961. TOOLTIP: '.tooltip',
  4962. TOOLTIP_INNER: '.tooltip-inner',
  4963. ARROW: '.arrow'
  4964. };
  4965. var Trigger = {
  4966. HOVER: 'hover',
  4967. FOCUS: 'focus',
  4968. CLICK: 'click',
  4969. MANUAL: 'manual'
  4970. };
  4971. /**
  4972. * ------------------------------------------------------------------------
  4973. * Class Definition
  4974. * ------------------------------------------------------------------------
  4975. */
  4976. var Tooltip =
  4977. /*#__PURE__*/
  4978. function () {
  4979. function Tooltip(element, config) {
  4980. if (typeof Popper === 'undefined') {
  4981. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4982. } // private
  4983. this._isEnabled = true;
  4984. this._timeout = 0;
  4985. this._hoverState = '';
  4986. this._activeTrigger = {};
  4987. this._popper = null; // Protected
  4988. this.element = element;
  4989. this.config = this._getConfig(config);
  4990. this.tip = null;
  4991. this._setListeners();
  4992. } // Getters
  4993. var _proto = Tooltip.prototype;
  4994. // Public
  4995. _proto.enable = function enable() {
  4996. this._isEnabled = true;
  4997. };
  4998. _proto.disable = function disable() {
  4999. this._isEnabled = false;
  5000. };
  5001. _proto.toggleEnabled = function toggleEnabled() {
  5002. this._isEnabled = !this._isEnabled;
  5003. };
  5004. _proto.toggle = function toggle(event) {
  5005. if (!this._isEnabled) {
  5006. return;
  5007. }
  5008. if (event) {
  5009. var dataKey = this.constructor.DATA_KEY;
  5010. var context = $(event.currentTarget).data(dataKey);
  5011. if (!context) {
  5012. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5013. $(event.currentTarget).data(dataKey, context);
  5014. }
  5015. context._activeTrigger.click = !context._activeTrigger.click;
  5016. if (context._isWithActiveTrigger()) {
  5017. context._enter(null, context);
  5018. } else {
  5019. context._leave(null, context);
  5020. }
  5021. } else {
  5022. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5023. this._leave(null, this);
  5024. return;
  5025. }
  5026. this._enter(null, this);
  5027. }
  5028. };
  5029. _proto.dispose = function dispose() {
  5030. clearTimeout(this._timeout);
  5031. $.removeData(this.element, this.constructor.DATA_KEY);
  5032. $(this.element).off(this.constructor.EVENT_KEY);
  5033. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5034. if (this.tip) {
  5035. $(this.tip).remove();
  5036. }
  5037. this._isEnabled = null;
  5038. this._timeout = null;
  5039. this._hoverState = null;
  5040. this._activeTrigger = null;
  5041. if (this._popper) {
  5042. this._popper.destroy();
  5043. }
  5044. this._popper = null;
  5045. this.element = null;
  5046. this.config = null;
  5047. this.tip = null;
  5048. };
  5049. _proto.show = function show() {
  5050. var _this = this;
  5051. if ($(this.element).css('display') === 'none') {
  5052. throw new Error('Please use show on visible elements');
  5053. }
  5054. var showEvent = $.Event(this.constructor.Event.SHOW);
  5055. if (this.isWithContent() && this._isEnabled) {
  5056. $(this.element).trigger(showEvent);
  5057. var shadowRoot = Util.findShadowRoot(this.element);
  5058. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5059. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5060. return;
  5061. }
  5062. var tip = this.getTipElement();
  5063. var tipId = Util.getUID(this.constructor.NAME);
  5064. tip.setAttribute('id', tipId);
  5065. this.element.setAttribute('aria-describedby', tipId);
  5066. this.setContent();
  5067. if (this.config.animation) {
  5068. $(tip).addClass(ClassName$6.FADE);
  5069. }
  5070. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5071. var attachment = this._getAttachment(placement);
  5072. this.addAttachmentClass(attachment);
  5073. var container = this._getContainer();
  5074. $(tip).data(this.constructor.DATA_KEY, this);
  5075. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5076. $(tip).appendTo(container);
  5077. }
  5078. $(this.element).trigger(this.constructor.Event.INSERTED);
  5079. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5080. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5081. // empty mouseover listeners to the body's immediate children;
  5082. // only needed because of broken event delegation on iOS
  5083. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5084. if ('ontouchstart' in document.documentElement) {
  5085. $(document.body).children().on('mouseover', null, $.noop);
  5086. }
  5087. var complete = function complete() {
  5088. if (_this.config.animation) {
  5089. _this._fixTransition();
  5090. }
  5091. var prevHoverState = _this._hoverState;
  5092. _this._hoverState = null;
  5093. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5094. if (prevHoverState === HoverState.OUT) {
  5095. _this._leave(null, _this);
  5096. }
  5097. };
  5098. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5099. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5100. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5101. } else {
  5102. complete();
  5103. }
  5104. }
  5105. };
  5106. _proto.hide = function hide(callback) {
  5107. var _this2 = this;
  5108. var tip = this.getTipElement();
  5109. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5110. var complete = function complete() {
  5111. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5112. tip.parentNode.removeChild(tip);
  5113. }
  5114. _this2._cleanTipClass();
  5115. _this2.element.removeAttribute('aria-describedby');
  5116. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5117. if (_this2._popper !== null) {
  5118. _this2._popper.destroy();
  5119. }
  5120. if (callback) {
  5121. callback();
  5122. }
  5123. };
  5124. $(this.element).trigger(hideEvent);
  5125. if (hideEvent.isDefaultPrevented()) {
  5126. return;
  5127. }
  5128. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5129. // empty mouseover listeners we added for iOS support
  5130. if ('ontouchstart' in document.documentElement) {
  5131. $(document.body).children().off('mouseover', null, $.noop);
  5132. }
  5133. this._activeTrigger[Trigger.CLICK] = false;
  5134. this._activeTrigger[Trigger.FOCUS] = false;
  5135. this._activeTrigger[Trigger.HOVER] = false;
  5136. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5137. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5138. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5139. } else {
  5140. complete();
  5141. }
  5142. this._hoverState = '';
  5143. };
  5144. _proto.update = function update() {
  5145. if (this._popper !== null) {
  5146. this._popper.scheduleUpdate();
  5147. }
  5148. } // Protected
  5149. ;
  5150. _proto.isWithContent = function isWithContent() {
  5151. return Boolean(this.getTitle());
  5152. };
  5153. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5154. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5155. };
  5156. _proto.getTipElement = function getTipElement() {
  5157. this.tip = this.tip || $(this.config.template)[0];
  5158. return this.tip;
  5159. };
  5160. _proto.setContent = function setContent() {
  5161. var tip = this.getTipElement();
  5162. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5163. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5164. };
  5165. _proto.setElementContent = function setElementContent($element, content) {
  5166. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5167. // Content is a DOM node or a jQuery
  5168. if (this.config.html) {
  5169. if (!$(content).parent().is($element)) {
  5170. $element.empty().append(content);
  5171. }
  5172. } else {
  5173. $element.text($(content).text());
  5174. }
  5175. return;
  5176. }
  5177. if (this.config.html) {
  5178. if (this.config.sanitize) {
  5179. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5180. }
  5181. $element.html(content);
  5182. } else {
  5183. $element.text(content);
  5184. }
  5185. };
  5186. _proto.getTitle = function getTitle() {
  5187. var title = this.element.getAttribute('data-original-title');
  5188. if (!title) {
  5189. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5190. }
  5191. return title;
  5192. } // Private
  5193. ;
  5194. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5195. var _this3 = this;
  5196. var defaultBsConfig = {
  5197. placement: attachment,
  5198. modifiers: {
  5199. offset: this._getOffset(),
  5200. flip: {
  5201. behavior: this.config.fallbackPlacement
  5202. },
  5203. arrow: {
  5204. element: Selector$6.ARROW
  5205. },
  5206. preventOverflow: {
  5207. boundariesElement: this.config.boundary
  5208. }
  5209. },
  5210. onCreate: function onCreate(data) {
  5211. if (data.originalPlacement !== data.placement) {
  5212. _this3._handlePopperPlacementChange(data);
  5213. }
  5214. },
  5215. onUpdate: function onUpdate(data) {
  5216. return _this3._handlePopperPlacementChange(data);
  5217. }
  5218. };
  5219. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5220. };
  5221. _proto._getOffset = function _getOffset() {
  5222. var _this4 = this;
  5223. var offset = {};
  5224. if (typeof this.config.offset === 'function') {
  5225. offset.fn = function (data) {
  5226. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5227. return data;
  5228. };
  5229. } else {
  5230. offset.offset = this.config.offset;
  5231. }
  5232. return offset;
  5233. };
  5234. _proto._getContainer = function _getContainer() {
  5235. if (this.config.container === false) {
  5236. return document.body;
  5237. }
  5238. if (Util.isElement(this.config.container)) {
  5239. return $(this.config.container);
  5240. }
  5241. return $(document).find(this.config.container);
  5242. };
  5243. _proto._getAttachment = function _getAttachment(placement) {
  5244. return AttachmentMap$1[placement.toUpperCase()];
  5245. };
  5246. _proto._setListeners = function _setListeners() {
  5247. var _this5 = this;
  5248. var triggers = this.config.trigger.split(' ');
  5249. triggers.forEach(function (trigger) {
  5250. if (trigger === 'click') {
  5251. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5252. return _this5.toggle(event);
  5253. });
  5254. } else if (trigger !== Trigger.MANUAL) {
  5255. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5256. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5257. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5258. return _this5._enter(event);
  5259. }).on(eventOut, _this5.config.selector, function (event) {
  5260. return _this5._leave(event);
  5261. });
  5262. }
  5263. });
  5264. this._hideModalHandler = function () {
  5265. if (_this5.element) {
  5266. _this5.hide();
  5267. }
  5268. };
  5269. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5270. if (this.config.selector) {
  5271. this.config = _objectSpread2({}, this.config, {
  5272. trigger: 'manual',
  5273. selector: ''
  5274. });
  5275. } else {
  5276. this._fixTitle();
  5277. }
  5278. };
  5279. _proto._fixTitle = function _fixTitle() {
  5280. var titleType = typeof this.element.getAttribute('data-original-title');
  5281. if (this.element.getAttribute('title') || titleType !== 'string') {
  5282. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5283. this.element.setAttribute('title', '');
  5284. }
  5285. };
  5286. _proto._enter = function _enter(event, context) {
  5287. var dataKey = this.constructor.DATA_KEY;
  5288. context = context || $(event.currentTarget).data(dataKey);
  5289. if (!context) {
  5290. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5291. $(event.currentTarget).data(dataKey, context);
  5292. }
  5293. if (event) {
  5294. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5295. }
  5296. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5297. context._hoverState = HoverState.SHOW;
  5298. return;
  5299. }
  5300. clearTimeout(context._timeout);
  5301. context._hoverState = HoverState.SHOW;
  5302. if (!context.config.delay || !context.config.delay.show) {
  5303. context.show();
  5304. return;
  5305. }
  5306. context._timeout = setTimeout(function () {
  5307. if (context._hoverState === HoverState.SHOW) {
  5308. context.show();
  5309. }
  5310. }, context.config.delay.show);
  5311. };
  5312. _proto._leave = function _leave(event, context) {
  5313. var dataKey = this.constructor.DATA_KEY;
  5314. context = context || $(event.currentTarget).data(dataKey);
  5315. if (!context) {
  5316. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5317. $(event.currentTarget).data(dataKey, context);
  5318. }
  5319. if (event) {
  5320. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5321. }
  5322. if (context._isWithActiveTrigger()) {
  5323. return;
  5324. }
  5325. clearTimeout(context._timeout);
  5326. context._hoverState = HoverState.OUT;
  5327. if (!context.config.delay || !context.config.delay.hide) {
  5328. context.hide();
  5329. return;
  5330. }
  5331. context._timeout = setTimeout(function () {
  5332. if (context._hoverState === HoverState.OUT) {
  5333. context.hide();
  5334. }
  5335. }, context.config.delay.hide);
  5336. };
  5337. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5338. for (var trigger in this._activeTrigger) {
  5339. if (this._activeTrigger[trigger]) {
  5340. return true;
  5341. }
  5342. }
  5343. return false;
  5344. };
  5345. _proto._getConfig = function _getConfig(config) {
  5346. var dataAttributes = $(this.element).data();
  5347. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5348. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5349. delete dataAttributes[dataAttr];
  5350. }
  5351. });
  5352. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5353. if (typeof config.delay === 'number') {
  5354. config.delay = {
  5355. show: config.delay,
  5356. hide: config.delay
  5357. };
  5358. }
  5359. if (typeof config.title === 'number') {
  5360. config.title = config.title.toString();
  5361. }
  5362. if (typeof config.content === 'number') {
  5363. config.content = config.content.toString();
  5364. }
  5365. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5366. if (config.sanitize) {
  5367. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5368. }
  5369. return config;
  5370. };
  5371. _proto._getDelegateConfig = function _getDelegateConfig() {
  5372. var config = {};
  5373. if (this.config) {
  5374. for (var key in this.config) {
  5375. if (this.constructor.Default[key] !== this.config[key]) {
  5376. config[key] = this.config[key];
  5377. }
  5378. }
  5379. }
  5380. return config;
  5381. };
  5382. _proto._cleanTipClass = function _cleanTipClass() {
  5383. var $tip = $(this.getTipElement());
  5384. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5385. if (tabClass !== null && tabClass.length) {
  5386. $tip.removeClass(tabClass.join(''));
  5387. }
  5388. };
  5389. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5390. var popperInstance = popperData.instance;
  5391. this.tip = popperInstance.popper;
  5392. this._cleanTipClass();
  5393. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5394. };
  5395. _proto._fixTransition = function _fixTransition() {
  5396. var tip = this.getTipElement();
  5397. var initConfigAnimation = this.config.animation;
  5398. if (tip.getAttribute('x-placement') !== null) {
  5399. return;
  5400. }
  5401. $(tip).removeClass(ClassName$6.FADE);
  5402. this.config.animation = false;
  5403. this.hide();
  5404. this.show();
  5405. this.config.animation = initConfigAnimation;
  5406. } // Static
  5407. ;
  5408. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5409. return this.each(function () {
  5410. var data = $(this).data(DATA_KEY$6);
  5411. var _config = typeof config === 'object' && config;
  5412. if (!data && /dispose|hide/.test(config)) {
  5413. return;
  5414. }
  5415. if (!data) {
  5416. data = new Tooltip(this, _config);
  5417. $(this).data(DATA_KEY$6, data);
  5418. }
  5419. if (typeof config === 'string') {
  5420. if (typeof data[config] === 'undefined') {
  5421. throw new TypeError("No method named \"" + config + "\"");
  5422. }
  5423. data[config]();
  5424. }
  5425. });
  5426. };
  5427. _createClass(Tooltip, null, [{
  5428. key: "VERSION",
  5429. get: function get() {
  5430. return VERSION$6;
  5431. }
  5432. }, {
  5433. key: "Default",
  5434. get: function get() {
  5435. return Default$4;
  5436. }
  5437. }, {
  5438. key: "NAME",
  5439. get: function get() {
  5440. return NAME$6;
  5441. }
  5442. }, {
  5443. key: "DATA_KEY",
  5444. get: function get() {
  5445. return DATA_KEY$6;
  5446. }
  5447. }, {
  5448. key: "Event",
  5449. get: function get() {
  5450. return Event$6;
  5451. }
  5452. }, {
  5453. key: "EVENT_KEY",
  5454. get: function get() {
  5455. return EVENT_KEY$6;
  5456. }
  5457. }, {
  5458. key: "DefaultType",
  5459. get: function get() {
  5460. return DefaultType$4;
  5461. }
  5462. }]);
  5463. return Tooltip;
  5464. }();
  5465. /**
  5466. * ------------------------------------------------------------------------
  5467. * jQuery
  5468. * ------------------------------------------------------------------------
  5469. */
  5470. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5471. $.fn[NAME$6].Constructor = Tooltip;
  5472. $.fn[NAME$6].noConflict = function () {
  5473. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5474. return Tooltip._jQueryInterface;
  5475. };
  5476. /**
  5477. * ------------------------------------------------------------------------
  5478. * Constants
  5479. * ------------------------------------------------------------------------
  5480. */
  5481. var NAME$7 = 'popover';
  5482. var VERSION$7 = '4.4.1';
  5483. var DATA_KEY$7 = 'bs.popover';
  5484. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5485. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5486. var CLASS_PREFIX$1 = 'bs-popover';
  5487. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5488. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5489. placement: 'right',
  5490. trigger: 'click',
  5491. content: '',
  5492. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5493. });
  5494. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5495. content: '(string|element|function)'
  5496. });
  5497. var ClassName$7 = {
  5498. FADE: 'fade',
  5499. SHOW: 'show'
  5500. };
  5501. var Selector$7 = {
  5502. TITLE: '.popover-header',
  5503. CONTENT: '.popover-body'
  5504. };
  5505. var Event$7 = {
  5506. HIDE: "hide" + EVENT_KEY$7,
  5507. HIDDEN: "hidden" + EVENT_KEY$7,
  5508. SHOW: "show" + EVENT_KEY$7,
  5509. SHOWN: "shown" + EVENT_KEY$7,
  5510. INSERTED: "inserted" + EVENT_KEY$7,
  5511. CLICK: "click" + EVENT_KEY$7,
  5512. FOCUSIN: "focusin" + EVENT_KEY$7,
  5513. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5514. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5515. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5516. };
  5517. /**
  5518. * ------------------------------------------------------------------------
  5519. * Class Definition
  5520. * ------------------------------------------------------------------------
  5521. */
  5522. var Popover =
  5523. /*#__PURE__*/
  5524. function (_Tooltip) {
  5525. _inheritsLoose(Popover, _Tooltip);
  5526. function Popover() {
  5527. return _Tooltip.apply(this, arguments) || this;
  5528. }
  5529. var _proto = Popover.prototype;
  5530. // Overrides
  5531. _proto.isWithContent = function isWithContent() {
  5532. return this.getTitle() || this._getContent();
  5533. };
  5534. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5535. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5536. };
  5537. _proto.getTipElement = function getTipElement() {
  5538. this.tip = this.tip || $(this.config.template)[0];
  5539. return this.tip;
  5540. };
  5541. _proto.setContent = function setContent() {
  5542. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5543. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5544. var content = this._getContent();
  5545. if (typeof content === 'function') {
  5546. content = content.call(this.element);
  5547. }
  5548. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5549. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5550. } // Private
  5551. ;
  5552. _proto._getContent = function _getContent() {
  5553. return this.element.getAttribute('data-content') || this.config.content;
  5554. };
  5555. _proto._cleanTipClass = function _cleanTipClass() {
  5556. var $tip = $(this.getTipElement());
  5557. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5558. if (tabClass !== null && tabClass.length > 0) {
  5559. $tip.removeClass(tabClass.join(''));
  5560. }
  5561. } // Static
  5562. ;
  5563. Popover._jQueryInterface = function _jQueryInterface(config) {
  5564. return this.each(function () {
  5565. var data = $(this).data(DATA_KEY$7);
  5566. var _config = typeof config === 'object' ? config : null;
  5567. if (!data && /dispose|hide/.test(config)) {
  5568. return;
  5569. }
  5570. if (!data) {
  5571. data = new Popover(this, _config);
  5572. $(this).data(DATA_KEY$7, data);
  5573. }
  5574. if (typeof config === 'string') {
  5575. if (typeof data[config] === 'undefined') {
  5576. throw new TypeError("No method named \"" + config + "\"");
  5577. }
  5578. data[config]();
  5579. }
  5580. });
  5581. };
  5582. _createClass(Popover, null, [{
  5583. key: "VERSION",
  5584. // Getters
  5585. get: function get() {
  5586. return VERSION$7;
  5587. }
  5588. }, {
  5589. key: "Default",
  5590. get: function get() {
  5591. return Default$5;
  5592. }
  5593. }, {
  5594. key: "NAME",
  5595. get: function get() {
  5596. return NAME$7;
  5597. }
  5598. }, {
  5599. key: "DATA_KEY",
  5600. get: function get() {
  5601. return DATA_KEY$7;
  5602. }
  5603. }, {
  5604. key: "Event",
  5605. get: function get() {
  5606. return Event$7;
  5607. }
  5608. }, {
  5609. key: "EVENT_KEY",
  5610. get: function get() {
  5611. return EVENT_KEY$7;
  5612. }
  5613. }, {
  5614. key: "DefaultType",
  5615. get: function get() {
  5616. return DefaultType$5;
  5617. }
  5618. }]);
  5619. return Popover;
  5620. }(Tooltip);
  5621. /**
  5622. * ------------------------------------------------------------------------
  5623. * jQuery
  5624. * ------------------------------------------------------------------------
  5625. */
  5626. $.fn[NAME$7] = Popover._jQueryInterface;
  5627. $.fn[NAME$7].Constructor = Popover;
  5628. $.fn[NAME$7].noConflict = function () {
  5629. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5630. return Popover._jQueryInterface;
  5631. };
  5632. /**
  5633. * ------------------------------------------------------------------------
  5634. * Constants
  5635. * ------------------------------------------------------------------------
  5636. */
  5637. var NAME$8 = 'scrollspy';
  5638. var VERSION$8 = '4.4.1';
  5639. var DATA_KEY$8 = 'bs.scrollspy';
  5640. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5641. var DATA_API_KEY$6 = '.data-api';
  5642. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5643. var Default$6 = {
  5644. offset: 10,
  5645. method: 'auto',
  5646. target: ''
  5647. };
  5648. var DefaultType$6 = {
  5649. offset: 'number',
  5650. method: 'string',
  5651. target: '(string|element)'
  5652. };
  5653. var Event$8 = {
  5654. ACTIVATE: "activate" + EVENT_KEY$8,
  5655. SCROLL: "scroll" + EVENT_KEY$8,
  5656. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5657. };
  5658. var ClassName$8 = {
  5659. DROPDOWN_ITEM: 'dropdown-item',
  5660. DROPDOWN_MENU: 'dropdown-menu',
  5661. ACTIVE: 'active'
  5662. };
  5663. var Selector$8 = {
  5664. DATA_SPY: '[data-spy="scroll"]',
  5665. ACTIVE: '.active',
  5666. NAV_LIST_GROUP: '.nav, .list-group',
  5667. NAV_LINKS: '.nav-link',
  5668. NAV_ITEMS: '.nav-item',
  5669. LIST_ITEMS: '.list-group-item',
  5670. DROPDOWN: '.dropdown',
  5671. DROPDOWN_ITEMS: '.dropdown-item',
  5672. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5673. };
  5674. var OffsetMethod = {
  5675. OFFSET: 'offset',
  5676. POSITION: 'position'
  5677. };
  5678. /**
  5679. * ------------------------------------------------------------------------
  5680. * Class Definition
  5681. * ------------------------------------------------------------------------
  5682. */
  5683. var ScrollSpy =
  5684. /*#__PURE__*/
  5685. function () {
  5686. function ScrollSpy(element, config) {
  5687. var _this = this;
  5688. this._element = element;
  5689. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5690. this._config = this._getConfig(config);
  5691. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5692. this._offsets = [];
  5693. this._targets = [];
  5694. this._activeTarget = null;
  5695. this._scrollHeight = 0;
  5696. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5697. return _this._process(event);
  5698. });
  5699. this.refresh();
  5700. this._process();
  5701. } // Getters
  5702. var _proto = ScrollSpy.prototype;
  5703. // Public
  5704. _proto.refresh = function refresh() {
  5705. var _this2 = this;
  5706. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5707. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5708. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5709. this._offsets = [];
  5710. this._targets = [];
  5711. this._scrollHeight = this._getScrollHeight();
  5712. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5713. targets.map(function (element) {
  5714. var target;
  5715. var targetSelector = Util.getSelectorFromElement(element);
  5716. if (targetSelector) {
  5717. target = document.querySelector(targetSelector);
  5718. }
  5719. if (target) {
  5720. var targetBCR = target.getBoundingClientRect();
  5721. if (targetBCR.width || targetBCR.height) {
  5722. // TODO (fat): remove sketch reliance on jQuery position/offset
  5723. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5724. }
  5725. }
  5726. return null;
  5727. }).filter(function (item) {
  5728. return item;
  5729. }).sort(function (a, b) {
  5730. return a[0] - b[0];
  5731. }).forEach(function (item) {
  5732. _this2._offsets.push(item[0]);
  5733. _this2._targets.push(item[1]);
  5734. });
  5735. };
  5736. _proto.dispose = function dispose() {
  5737. $.removeData(this._element, DATA_KEY$8);
  5738. $(this._scrollElement).off(EVENT_KEY$8);
  5739. this._element = null;
  5740. this._scrollElement = null;
  5741. this._config = null;
  5742. this._selector = null;
  5743. this._offsets = null;
  5744. this._targets = null;
  5745. this._activeTarget = null;
  5746. this._scrollHeight = null;
  5747. } // Private
  5748. ;
  5749. _proto._getConfig = function _getConfig(config) {
  5750. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5751. if (typeof config.target !== 'string') {
  5752. var id = $(config.target).attr('id');
  5753. if (!id) {
  5754. id = Util.getUID(NAME$8);
  5755. $(config.target).attr('id', id);
  5756. }
  5757. config.target = "#" + id;
  5758. }
  5759. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5760. return config;
  5761. };
  5762. _proto._getScrollTop = function _getScrollTop() {
  5763. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5764. };
  5765. _proto._getScrollHeight = function _getScrollHeight() {
  5766. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5767. };
  5768. _proto._getOffsetHeight = function _getOffsetHeight() {
  5769. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5770. };
  5771. _proto._process = function _process() {
  5772. var scrollTop = this._getScrollTop() + this._config.offset;
  5773. var scrollHeight = this._getScrollHeight();
  5774. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5775. if (this._scrollHeight !== scrollHeight) {
  5776. this.refresh();
  5777. }
  5778. if (scrollTop >= maxScroll) {
  5779. var target = this._targets[this._targets.length - 1];
  5780. if (this._activeTarget !== target) {
  5781. this._activate(target);
  5782. }
  5783. return;
  5784. }
  5785. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5786. this._activeTarget = null;
  5787. this._clear();
  5788. return;
  5789. }
  5790. var offsetLength = this._offsets.length;
  5791. for (var i = offsetLength; i--;) {
  5792. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5793. if (isActiveTarget) {
  5794. this._activate(this._targets[i]);
  5795. }
  5796. }
  5797. };
  5798. _proto._activate = function _activate(target) {
  5799. this._activeTarget = target;
  5800. this._clear();
  5801. var queries = this._selector.split(',').map(function (selector) {
  5802. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5803. });
  5804. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5805. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5806. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5807. $link.addClass(ClassName$8.ACTIVE);
  5808. } else {
  5809. // Set triggered link as active
  5810. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5811. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5812. $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
  5813. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5814. }
  5815. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5816. relatedTarget: target
  5817. });
  5818. };
  5819. _proto._clear = function _clear() {
  5820. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5821. return node.classList.contains(ClassName$8.ACTIVE);
  5822. }).forEach(function (node) {
  5823. return node.classList.remove(ClassName$8.ACTIVE);
  5824. });
  5825. } // Static
  5826. ;
  5827. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5828. return this.each(function () {
  5829. var data = $(this).data(DATA_KEY$8);
  5830. var _config = typeof config === 'object' && config;
  5831. if (!data) {
  5832. data = new ScrollSpy(this, _config);
  5833. $(this).data(DATA_KEY$8, data);
  5834. }
  5835. if (typeof config === 'string') {
  5836. if (typeof data[config] === 'undefined') {
  5837. throw new TypeError("No method named \"" + config + "\"");
  5838. }
  5839. data[config]();
  5840. }
  5841. });
  5842. };
  5843. _createClass(ScrollSpy, null, [{
  5844. key: "VERSION",
  5845. get: function get() {
  5846. return VERSION$8;
  5847. }
  5848. }, {
  5849. key: "Default",
  5850. get: function get() {
  5851. return Default$6;
  5852. }
  5853. }]);
  5854. return ScrollSpy;
  5855. }();
  5856. /**
  5857. * ------------------------------------------------------------------------
  5858. * Data Api implementation
  5859. * ------------------------------------------------------------------------
  5860. */
  5861. $(window).on(Event$8.LOAD_DATA_API, function () {
  5862. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5863. var scrollSpysLength = scrollSpys.length;
  5864. for (var i = scrollSpysLength; i--;) {
  5865. var $spy = $(scrollSpys[i]);
  5866. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5867. }
  5868. });
  5869. /**
  5870. * ------------------------------------------------------------------------
  5871. * jQuery
  5872. * ------------------------------------------------------------------------
  5873. */
  5874. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5875. $.fn[NAME$8].Constructor = ScrollSpy;
  5876. $.fn[NAME$8].noConflict = function () {
  5877. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5878. return ScrollSpy._jQueryInterface;
  5879. };
  5880. /**
  5881. * ------------------------------------------------------------------------
  5882. * Constants
  5883. * ------------------------------------------------------------------------
  5884. */
  5885. var NAME$9 = 'tab';
  5886. var VERSION$9 = '4.4.1';
  5887. var DATA_KEY$9 = 'bs.tab';
  5888. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5889. var DATA_API_KEY$7 = '.data-api';
  5890. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5891. var Event$9 = {
  5892. HIDE: "hide" + EVENT_KEY$9,
  5893. HIDDEN: "hidden" + EVENT_KEY$9,
  5894. SHOW: "show" + EVENT_KEY$9,
  5895. SHOWN: "shown" + EVENT_KEY$9,
  5896. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5897. };
  5898. var ClassName$9 = {
  5899. DROPDOWN_MENU: 'dropdown-menu',
  5900. ACTIVE: 'active',
  5901. DISABLED: 'disabled',
  5902. FADE: 'fade',
  5903. SHOW: 'show'
  5904. };
  5905. var Selector$9 = {
  5906. DROPDOWN: '.dropdown',
  5907. NAV_LIST_GROUP: '.nav, .list-group',
  5908. ACTIVE: '.active',
  5909. ACTIVE_UL: '> li > .active',
  5910. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5911. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5912. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5913. };
  5914. /**
  5915. * ------------------------------------------------------------------------
  5916. * Class Definition
  5917. * ------------------------------------------------------------------------
  5918. */
  5919. var Tab =
  5920. /*#__PURE__*/
  5921. function () {
  5922. function Tab(element) {
  5923. this._element = element;
  5924. } // Getters
  5925. var _proto = Tab.prototype;
  5926. // Public
  5927. _proto.show = function show() {
  5928. var _this = this;
  5929. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5930. return;
  5931. }
  5932. var target;
  5933. var previous;
  5934. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5935. var selector = Util.getSelectorFromElement(this._element);
  5936. if (listElement) {
  5937. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5938. previous = $.makeArray($(listElement).find(itemSelector));
  5939. previous = previous[previous.length - 1];
  5940. }
  5941. var hideEvent = $.Event(Event$9.HIDE, {
  5942. relatedTarget: this._element
  5943. });
  5944. var showEvent = $.Event(Event$9.SHOW, {
  5945. relatedTarget: previous
  5946. });
  5947. if (previous) {
  5948. $(previous).trigger(hideEvent);
  5949. }
  5950. $(this._element).trigger(showEvent);
  5951. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5952. return;
  5953. }
  5954. if (selector) {
  5955. target = document.querySelector(selector);
  5956. }
  5957. this._activate(this._element, listElement);
  5958. var complete = function complete() {
  5959. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5960. relatedTarget: _this._element
  5961. });
  5962. var shownEvent = $.Event(Event$9.SHOWN, {
  5963. relatedTarget: previous
  5964. });
  5965. $(previous).trigger(hiddenEvent);
  5966. $(_this._element).trigger(shownEvent);
  5967. };
  5968. if (target) {
  5969. this._activate(target, target.parentNode, complete);
  5970. } else {
  5971. complete();
  5972. }
  5973. };
  5974. _proto.dispose = function dispose() {
  5975. $.removeData(this._element, DATA_KEY$9);
  5976. this._element = null;
  5977. } // Private
  5978. ;
  5979. _proto._activate = function _activate(element, container, callback) {
  5980. var _this2 = this;
  5981. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5982. var active = activeElements[0];
  5983. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5984. var complete = function complete() {
  5985. return _this2._transitionComplete(element, active, callback);
  5986. };
  5987. if (active && isTransitioning) {
  5988. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5989. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5990. } else {
  5991. complete();
  5992. }
  5993. };
  5994. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5995. if (active) {
  5996. $(active).removeClass(ClassName$9.ACTIVE);
  5997. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5998. if (dropdownChild) {
  5999. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6000. }
  6001. if (active.getAttribute('role') === 'tab') {
  6002. active.setAttribute('aria-selected', false);
  6003. }
  6004. }
  6005. $(element).addClass(ClassName$9.ACTIVE);
  6006. if (element.getAttribute('role') === 'tab') {
  6007. element.setAttribute('aria-selected', true);
  6008. }
  6009. Util.reflow(element);
  6010. if (element.classList.contains(ClassName$9.FADE)) {
  6011. element.classList.add(ClassName$9.SHOW);
  6012. }
  6013. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6014. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6015. if (dropdownElement) {
  6016. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6017. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6018. }
  6019. element.setAttribute('aria-expanded', true);
  6020. }
  6021. if (callback) {
  6022. callback();
  6023. }
  6024. } // Static
  6025. ;
  6026. Tab._jQueryInterface = function _jQueryInterface(config) {
  6027. return this.each(function () {
  6028. var $this = $(this);
  6029. var data = $this.data(DATA_KEY$9);
  6030. if (!data) {
  6031. data = new Tab(this);
  6032. $this.data(DATA_KEY$9, data);
  6033. }
  6034. if (typeof config === 'string') {
  6035. if (typeof data[config] === 'undefined') {
  6036. throw new TypeError("No method named \"" + config + "\"");
  6037. }
  6038. data[config]();
  6039. }
  6040. });
  6041. };
  6042. _createClass(Tab, null, [{
  6043. key: "VERSION",
  6044. get: function get() {
  6045. return VERSION$9;
  6046. }
  6047. }]);
  6048. return Tab;
  6049. }();
  6050. /**
  6051. * ------------------------------------------------------------------------
  6052. * Data Api implementation
  6053. * ------------------------------------------------------------------------
  6054. */
  6055. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6056. event.preventDefault();
  6057. Tab._jQueryInterface.call($(this), 'show');
  6058. });
  6059. /**
  6060. * ------------------------------------------------------------------------
  6061. * jQuery
  6062. * ------------------------------------------------------------------------
  6063. */
  6064. $.fn[NAME$9] = Tab._jQueryInterface;
  6065. $.fn[NAME$9].Constructor = Tab;
  6066. $.fn[NAME$9].noConflict = function () {
  6067. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6068. return Tab._jQueryInterface;
  6069. };
  6070. /**
  6071. * ------------------------------------------------------------------------
  6072. * Constants
  6073. * ------------------------------------------------------------------------
  6074. */
  6075. var NAME$a = 'toast';
  6076. var VERSION$a = '4.4.1';
  6077. var DATA_KEY$a = 'bs.toast';
  6078. var EVENT_KEY$a = "." + DATA_KEY$a;
  6079. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6080. var Event$a = {
  6081. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6082. HIDE: "hide" + EVENT_KEY$a,
  6083. HIDDEN: "hidden" + EVENT_KEY$a,
  6084. SHOW: "show" + EVENT_KEY$a,
  6085. SHOWN: "shown" + EVENT_KEY$a
  6086. };
  6087. var ClassName$a = {
  6088. FADE: 'fade',
  6089. HIDE: 'hide',
  6090. SHOW: 'show',
  6091. SHOWING: 'showing'
  6092. };
  6093. var DefaultType$7 = {
  6094. animation: 'boolean',
  6095. autohide: 'boolean',
  6096. delay: 'number'
  6097. };
  6098. var Default$7 = {
  6099. animation: true,
  6100. autohide: true,
  6101. delay: 500
  6102. };
  6103. var Selector$a = {
  6104. DATA_DISMISS: '[data-dismiss="toast"]'
  6105. };
  6106. /**
  6107. * ------------------------------------------------------------------------
  6108. * Class Definition
  6109. * ------------------------------------------------------------------------
  6110. */
  6111. var Toast =
  6112. /*#__PURE__*/
  6113. function () {
  6114. function Toast(element, config) {
  6115. this._element = element;
  6116. this._config = this._getConfig(config);
  6117. this._timeout = null;
  6118. this._setListeners();
  6119. } // Getters
  6120. var _proto = Toast.prototype;
  6121. // Public
  6122. _proto.show = function show() {
  6123. var _this = this;
  6124. var showEvent = $.Event(Event$a.SHOW);
  6125. $(this._element).trigger(showEvent);
  6126. if (showEvent.isDefaultPrevented()) {
  6127. return;
  6128. }
  6129. if (this._config.animation) {
  6130. this._element.classList.add(ClassName$a.FADE);
  6131. }
  6132. var complete = function complete() {
  6133. _this._element.classList.remove(ClassName$a.SHOWING);
  6134. _this._element.classList.add(ClassName$a.SHOW);
  6135. $(_this._element).trigger(Event$a.SHOWN);
  6136. if (_this._config.autohide) {
  6137. _this._timeout = setTimeout(function () {
  6138. _this.hide();
  6139. }, _this._config.delay);
  6140. }
  6141. };
  6142. this._element.classList.remove(ClassName$a.HIDE);
  6143. Util.reflow(this._element);
  6144. this._element.classList.add(ClassName$a.SHOWING);
  6145. if (this._config.animation) {
  6146. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6147. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6148. } else {
  6149. complete();
  6150. }
  6151. };
  6152. _proto.hide = function hide() {
  6153. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6154. return;
  6155. }
  6156. var hideEvent = $.Event(Event$a.HIDE);
  6157. $(this._element).trigger(hideEvent);
  6158. if (hideEvent.isDefaultPrevented()) {
  6159. return;
  6160. }
  6161. this._close();
  6162. };
  6163. _proto.dispose = function dispose() {
  6164. clearTimeout(this._timeout);
  6165. this._timeout = null;
  6166. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6167. this._element.classList.remove(ClassName$a.SHOW);
  6168. }
  6169. $(this._element).off(Event$a.CLICK_DISMISS);
  6170. $.removeData(this._element, DATA_KEY$a);
  6171. this._element = null;
  6172. this._config = null;
  6173. } // Private
  6174. ;
  6175. _proto._getConfig = function _getConfig(config) {
  6176. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6177. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6178. return config;
  6179. };
  6180. _proto._setListeners = function _setListeners() {
  6181. var _this2 = this;
  6182. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6183. return _this2.hide();
  6184. });
  6185. };
  6186. _proto._close = function _close() {
  6187. var _this3 = this;
  6188. var complete = function complete() {
  6189. _this3._element.classList.add(ClassName$a.HIDE);
  6190. $(_this3._element).trigger(Event$a.HIDDEN);
  6191. };
  6192. this._element.classList.remove(ClassName$a.SHOW);
  6193. if (this._config.animation) {
  6194. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6195. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6196. } else {
  6197. complete();
  6198. }
  6199. } // Static
  6200. ;
  6201. Toast._jQueryInterface = function _jQueryInterface(config) {
  6202. return this.each(function () {
  6203. var $element = $(this);
  6204. var data = $element.data(DATA_KEY$a);
  6205. var _config = typeof config === 'object' && config;
  6206. if (!data) {
  6207. data = new Toast(this, _config);
  6208. $element.data(DATA_KEY$a, data);
  6209. }
  6210. if (typeof config === 'string') {
  6211. if (typeof data[config] === 'undefined') {
  6212. throw new TypeError("No method named \"" + config + "\"");
  6213. }
  6214. data[config](this);
  6215. }
  6216. });
  6217. };
  6218. _createClass(Toast, null, [{
  6219. key: "VERSION",
  6220. get: function get() {
  6221. return VERSION$a;
  6222. }
  6223. }, {
  6224. key: "DefaultType",
  6225. get: function get() {
  6226. return DefaultType$7;
  6227. }
  6228. }, {
  6229. key: "Default",
  6230. get: function get() {
  6231. return Default$7;
  6232. }
  6233. }]);
  6234. return Toast;
  6235. }();
  6236. /**
  6237. * ------------------------------------------------------------------------
  6238. * jQuery
  6239. * ------------------------------------------------------------------------
  6240. */
  6241. $.fn[NAME$a] = Toast._jQueryInterface;
  6242. $.fn[NAME$a].Constructor = Toast;
  6243. $.fn[NAME$a].noConflict = function () {
  6244. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6245. return Toast._jQueryInterface;
  6246. };
  6247. exports.Alert = Alert;
  6248. exports.Button = Button;
  6249. exports.Carousel = Carousel;
  6250. exports.Collapse = Collapse;
  6251. exports.Dropdown = Dropdown;
  6252. exports.Modal = Modal;
  6253. exports.Popover = Popover;
  6254. exports.Scrollspy = ScrollSpy;
  6255. exports.Tab = Tab;
  6256. exports.Toast = Toast;
  6257. exports.Tooltip = Tooltip;
  6258. exports.Util = Util;
  6259. Object.defineProperty(exports, '__esModule', { value: true });
  6260. })));
  6261. //# sourceMappingURL=bootstrap.js.map
  6262. /***/ }),
  6263. /***/ "./node_modules/buffer/index.js":
  6264. /*!**************************************!*\
  6265. !*** ./node_modules/buffer/index.js ***!
  6266. \**************************************/
  6267. /*! no static exports found */
  6268. /***/ (function(module, exports, __webpack_require__) {
  6269. "use strict";
  6270. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6271. * The buffer module from node.js, for the browser.
  6272. *
  6273. * @author Feross Aboukhadijeh <http://feross.org>
  6274. * @license MIT
  6275. */
  6276. /* eslint-disable no-proto */
  6277. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6278. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6279. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6280. exports.Buffer = Buffer
  6281. exports.SlowBuffer = SlowBuffer
  6282. exports.INSPECT_MAX_BYTES = 50
  6283. /**
  6284. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6285. * === true Use Uint8Array implementation (fastest)
  6286. * === false Use Object implementation (most compatible, even IE6)
  6287. *
  6288. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6289. * Opera 11.6+, iOS 4.2+.
  6290. *
  6291. * Due to various browser bugs, sometimes the Object implementation will be used even
  6292. * when the browser supports typed arrays.
  6293. *
  6294. * Note:
  6295. *
  6296. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6297. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6298. *
  6299. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6300. *
  6301. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6302. * incorrect length in some situations.
  6303. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6304. * get the Object implementation, which is slower but behaves correctly.
  6305. */
  6306. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6307. ? global.TYPED_ARRAY_SUPPORT
  6308. : typedArraySupport()
  6309. /*
  6310. * Export kMaxLength after typed array support is determined.
  6311. */
  6312. exports.kMaxLength = kMaxLength()
  6313. function typedArraySupport () {
  6314. try {
  6315. var arr = new Uint8Array(1)
  6316. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6317. return arr.foo() === 42 && // typed array instances can be augmented
  6318. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6319. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6320. } catch (e) {
  6321. return false
  6322. }
  6323. }
  6324. function kMaxLength () {
  6325. return Buffer.TYPED_ARRAY_SUPPORT
  6326. ? 0x7fffffff
  6327. : 0x3fffffff
  6328. }
  6329. function createBuffer (that, length) {
  6330. if (kMaxLength() < length) {
  6331. throw new RangeError('Invalid typed array length')
  6332. }
  6333. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6334. // Return an augmented `Uint8Array` instance, for best performance
  6335. that = new Uint8Array(length)
  6336. that.__proto__ = Buffer.prototype
  6337. } else {
  6338. // Fallback: Return an object instance of the Buffer class
  6339. if (that === null) {
  6340. that = new Buffer(length)
  6341. }
  6342. that.length = length
  6343. }
  6344. return that
  6345. }
  6346. /**
  6347. * The Buffer constructor returns instances of `Uint8Array` that have their
  6348. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6349. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6350. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6351. * returns a single octet.
  6352. *
  6353. * The `Uint8Array` prototype remains unmodified.
  6354. */
  6355. function Buffer (arg, encodingOrOffset, length) {
  6356. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6357. return new Buffer(arg, encodingOrOffset, length)
  6358. }
  6359. // Common case.
  6360. if (typeof arg === 'number') {
  6361. if (typeof encodingOrOffset === 'string') {
  6362. throw new Error(
  6363. 'If encoding is specified then the first argument must be a string'
  6364. )
  6365. }
  6366. return allocUnsafe(this, arg)
  6367. }
  6368. return from(this, arg, encodingOrOffset, length)
  6369. }
  6370. Buffer.poolSize = 8192 // not used by this implementation
  6371. // TODO: Legacy, not needed anymore. Remove in next major version.
  6372. Buffer._augment = function (arr) {
  6373. arr.__proto__ = Buffer.prototype
  6374. return arr
  6375. }
  6376. function from (that, value, encodingOrOffset, length) {
  6377. if (typeof value === 'number') {
  6378. throw new TypeError('"value" argument must not be a number')
  6379. }
  6380. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6381. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6382. }
  6383. if (typeof value === 'string') {
  6384. return fromString(that, value, encodingOrOffset)
  6385. }
  6386. return fromObject(that, value)
  6387. }
  6388. /**
  6389. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6390. * if value is a number.
  6391. * Buffer.from(str[, encoding])
  6392. * Buffer.from(array)
  6393. * Buffer.from(buffer)
  6394. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6395. **/
  6396. Buffer.from = function (value, encodingOrOffset, length) {
  6397. return from(null, value, encodingOrOffset, length)
  6398. }
  6399. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6400. Buffer.prototype.__proto__ = Uint8Array.prototype
  6401. Buffer.__proto__ = Uint8Array
  6402. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6403. Buffer[Symbol.species] === Buffer) {
  6404. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6405. Object.defineProperty(Buffer, Symbol.species, {
  6406. value: null,
  6407. configurable: true
  6408. })
  6409. }
  6410. }
  6411. function assertSize (size) {
  6412. if (typeof size !== 'number') {
  6413. throw new TypeError('"size" argument must be a number')
  6414. } else if (size < 0) {
  6415. throw new RangeError('"size" argument must not be negative')
  6416. }
  6417. }
  6418. function alloc (that, size, fill, encoding) {
  6419. assertSize(size)
  6420. if (size <= 0) {
  6421. return createBuffer(that, size)
  6422. }
  6423. if (fill !== undefined) {
  6424. // Only pay attention to encoding if it's a string. This
  6425. // prevents accidentally sending in a number that would
  6426. // be interpretted as a start offset.
  6427. return typeof encoding === 'string'
  6428. ? createBuffer(that, size).fill(fill, encoding)
  6429. : createBuffer(that, size).fill(fill)
  6430. }
  6431. return createBuffer(that, size)
  6432. }
  6433. /**
  6434. * Creates a new filled Buffer instance.
  6435. * alloc(size[, fill[, encoding]])
  6436. **/
  6437. Buffer.alloc = function (size, fill, encoding) {
  6438. return alloc(null, size, fill, encoding)
  6439. }
  6440. function allocUnsafe (that, size) {
  6441. assertSize(size)
  6442. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6443. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6444. for (var i = 0; i < size; ++i) {
  6445. that[i] = 0
  6446. }
  6447. }
  6448. return that
  6449. }
  6450. /**
  6451. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6452. * */
  6453. Buffer.allocUnsafe = function (size) {
  6454. return allocUnsafe(null, size)
  6455. }
  6456. /**
  6457. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6458. */
  6459. Buffer.allocUnsafeSlow = function (size) {
  6460. return allocUnsafe(null, size)
  6461. }
  6462. function fromString (that, string, encoding) {
  6463. if (typeof encoding !== 'string' || encoding === '') {
  6464. encoding = 'utf8'
  6465. }
  6466. if (!Buffer.isEncoding(encoding)) {
  6467. throw new TypeError('"encoding" must be a valid string encoding')
  6468. }
  6469. var length = byteLength(string, encoding) | 0
  6470. that = createBuffer(that, length)
  6471. var actual = that.write(string, encoding)
  6472. if (actual !== length) {
  6473. // Writing a hex string, for example, that contains invalid characters will
  6474. // cause everything after the first invalid character to be ignored. (e.g.
  6475. // 'abxxcd' will be treated as 'ab')
  6476. that = that.slice(0, actual)
  6477. }
  6478. return that
  6479. }
  6480. function fromArrayLike (that, array) {
  6481. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6482. that = createBuffer(that, length)
  6483. for (var i = 0; i < length; i += 1) {
  6484. that[i] = array[i] & 255
  6485. }
  6486. return that
  6487. }
  6488. function fromArrayBuffer (that, array, byteOffset, length) {
  6489. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6490. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6491. throw new RangeError('\'offset\' is out of bounds')
  6492. }
  6493. if (array.byteLength < byteOffset + (length || 0)) {
  6494. throw new RangeError('\'length\' is out of bounds')
  6495. }
  6496. if (byteOffset === undefined && length === undefined) {
  6497. array = new Uint8Array(array)
  6498. } else if (length === undefined) {
  6499. array = new Uint8Array(array, byteOffset)
  6500. } else {
  6501. array = new Uint8Array(array, byteOffset, length)
  6502. }
  6503. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6504. // Return an augmented `Uint8Array` instance, for best performance
  6505. that = array
  6506. that.__proto__ = Buffer.prototype
  6507. } else {
  6508. // Fallback: Return an object instance of the Buffer class
  6509. that = fromArrayLike(that, array)
  6510. }
  6511. return that
  6512. }
  6513. function fromObject (that, obj) {
  6514. if (Buffer.isBuffer(obj)) {
  6515. var len = checked(obj.length) | 0
  6516. that = createBuffer(that, len)
  6517. if (that.length === 0) {
  6518. return that
  6519. }
  6520. obj.copy(that, 0, 0, len)
  6521. return that
  6522. }
  6523. if (obj) {
  6524. if ((typeof ArrayBuffer !== 'undefined' &&
  6525. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6526. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6527. return createBuffer(that, 0)
  6528. }
  6529. return fromArrayLike(that, obj)
  6530. }
  6531. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6532. return fromArrayLike(that, obj.data)
  6533. }
  6534. }
  6535. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6536. }
  6537. function checked (length) {
  6538. // Note: cannot use `length < kMaxLength()` here because that fails when
  6539. // length is NaN (which is otherwise coerced to zero.)
  6540. if (length >= kMaxLength()) {
  6541. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6542. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6543. }
  6544. return length | 0
  6545. }
  6546. function SlowBuffer (length) {
  6547. if (+length != length) { // eslint-disable-line eqeqeq
  6548. length = 0
  6549. }
  6550. return Buffer.alloc(+length)
  6551. }
  6552. Buffer.isBuffer = function isBuffer (b) {
  6553. return !!(b != null && b._isBuffer)
  6554. }
  6555. Buffer.compare = function compare (a, b) {
  6556. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6557. throw new TypeError('Arguments must be Buffers')
  6558. }
  6559. if (a === b) return 0
  6560. var x = a.length
  6561. var y = b.length
  6562. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6563. if (a[i] !== b[i]) {
  6564. x = a[i]
  6565. y = b[i]
  6566. break
  6567. }
  6568. }
  6569. if (x < y) return -1
  6570. if (y < x) return 1
  6571. return 0
  6572. }
  6573. Buffer.isEncoding = function isEncoding (encoding) {
  6574. switch (String(encoding).toLowerCase()) {
  6575. case 'hex':
  6576. case 'utf8':
  6577. case 'utf-8':
  6578. case 'ascii':
  6579. case 'latin1':
  6580. case 'binary':
  6581. case 'base64':
  6582. case 'ucs2':
  6583. case 'ucs-2':
  6584. case 'utf16le':
  6585. case 'utf-16le':
  6586. return true
  6587. default:
  6588. return false
  6589. }
  6590. }
  6591. Buffer.concat = function concat (list, length) {
  6592. if (!isArray(list)) {
  6593. throw new TypeError('"list" argument must be an Array of Buffers')
  6594. }
  6595. if (list.length === 0) {
  6596. return Buffer.alloc(0)
  6597. }
  6598. var i
  6599. if (length === undefined) {
  6600. length = 0
  6601. for (i = 0; i < list.length; ++i) {
  6602. length += list[i].length
  6603. }
  6604. }
  6605. var buffer = Buffer.allocUnsafe(length)
  6606. var pos = 0
  6607. for (i = 0; i < list.length; ++i) {
  6608. var buf = list[i]
  6609. if (!Buffer.isBuffer(buf)) {
  6610. throw new TypeError('"list" argument must be an Array of Buffers')
  6611. }
  6612. buf.copy(buffer, pos)
  6613. pos += buf.length
  6614. }
  6615. return buffer
  6616. }
  6617. function byteLength (string, encoding) {
  6618. if (Buffer.isBuffer(string)) {
  6619. return string.length
  6620. }
  6621. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6622. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6623. return string.byteLength
  6624. }
  6625. if (typeof string !== 'string') {
  6626. string = '' + string
  6627. }
  6628. var len = string.length
  6629. if (len === 0) return 0
  6630. // Use a for loop to avoid recursion
  6631. var loweredCase = false
  6632. for (;;) {
  6633. switch (encoding) {
  6634. case 'ascii':
  6635. case 'latin1':
  6636. case 'binary':
  6637. return len
  6638. case 'utf8':
  6639. case 'utf-8':
  6640. case undefined:
  6641. return utf8ToBytes(string).length
  6642. case 'ucs2':
  6643. case 'ucs-2':
  6644. case 'utf16le':
  6645. case 'utf-16le':
  6646. return len * 2
  6647. case 'hex':
  6648. return len >>> 1
  6649. case 'base64':
  6650. return base64ToBytes(string).length
  6651. default:
  6652. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6653. encoding = ('' + encoding).toLowerCase()
  6654. loweredCase = true
  6655. }
  6656. }
  6657. }
  6658. Buffer.byteLength = byteLength
  6659. function slowToString (encoding, start, end) {
  6660. var loweredCase = false
  6661. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6662. // property of a typed array.
  6663. // This behaves neither like String nor Uint8Array in that we set start/end
  6664. // to their upper/lower bounds if the value passed is out of range.
  6665. // undefined is handled specially as per ECMA-262 6th Edition,
  6666. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6667. if (start === undefined || start < 0) {
  6668. start = 0
  6669. }
  6670. // Return early if start > this.length. Done here to prevent potential uint32
  6671. // coercion fail below.
  6672. if (start > this.length) {
  6673. return ''
  6674. }
  6675. if (end === undefined || end > this.length) {
  6676. end = this.length
  6677. }
  6678. if (end <= 0) {
  6679. return ''
  6680. }
  6681. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6682. end >>>= 0
  6683. start >>>= 0
  6684. if (end <= start) {
  6685. return ''
  6686. }
  6687. if (!encoding) encoding = 'utf8'
  6688. while (true) {
  6689. switch (encoding) {
  6690. case 'hex':
  6691. return hexSlice(this, start, end)
  6692. case 'utf8':
  6693. case 'utf-8':
  6694. return utf8Slice(this, start, end)
  6695. case 'ascii':
  6696. return asciiSlice(this, start, end)
  6697. case 'latin1':
  6698. case 'binary':
  6699. return latin1Slice(this, start, end)
  6700. case 'base64':
  6701. return base64Slice(this, start, end)
  6702. case 'ucs2':
  6703. case 'ucs-2':
  6704. case 'utf16le':
  6705. case 'utf-16le':
  6706. return utf16leSlice(this, start, end)
  6707. default:
  6708. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6709. encoding = (encoding + '').toLowerCase()
  6710. loweredCase = true
  6711. }
  6712. }
  6713. }
  6714. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6715. // Buffer instances.
  6716. Buffer.prototype._isBuffer = true
  6717. function swap (b, n, m) {
  6718. var i = b[n]
  6719. b[n] = b[m]
  6720. b[m] = i
  6721. }
  6722. Buffer.prototype.swap16 = function swap16 () {
  6723. var len = this.length
  6724. if (len % 2 !== 0) {
  6725. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6726. }
  6727. for (var i = 0; i < len; i += 2) {
  6728. swap(this, i, i + 1)
  6729. }
  6730. return this
  6731. }
  6732. Buffer.prototype.swap32 = function swap32 () {
  6733. var len = this.length
  6734. if (len % 4 !== 0) {
  6735. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6736. }
  6737. for (var i = 0; i < len; i += 4) {
  6738. swap(this, i, i + 3)
  6739. swap(this, i + 1, i + 2)
  6740. }
  6741. return this
  6742. }
  6743. Buffer.prototype.swap64 = function swap64 () {
  6744. var len = this.length
  6745. if (len % 8 !== 0) {
  6746. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6747. }
  6748. for (var i = 0; i < len; i += 8) {
  6749. swap(this, i, i + 7)
  6750. swap(this, i + 1, i + 6)
  6751. swap(this, i + 2, i + 5)
  6752. swap(this, i + 3, i + 4)
  6753. }
  6754. return this
  6755. }
  6756. Buffer.prototype.toString = function toString () {
  6757. var length = this.length | 0
  6758. if (length === 0) return ''
  6759. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6760. return slowToString.apply(this, arguments)
  6761. }
  6762. Buffer.prototype.equals = function equals (b) {
  6763. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6764. if (this === b) return true
  6765. return Buffer.compare(this, b) === 0
  6766. }
  6767. Buffer.prototype.inspect = function inspect () {
  6768. var str = ''
  6769. var max = exports.INSPECT_MAX_BYTES
  6770. if (this.length > 0) {
  6771. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6772. if (this.length > max) str += ' ... '
  6773. }
  6774. return '<Buffer ' + str + '>'
  6775. }
  6776. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6777. if (!Buffer.isBuffer(target)) {
  6778. throw new TypeError('Argument must be a Buffer')
  6779. }
  6780. if (start === undefined) {
  6781. start = 0
  6782. }
  6783. if (end === undefined) {
  6784. end = target ? target.length : 0
  6785. }
  6786. if (thisStart === undefined) {
  6787. thisStart = 0
  6788. }
  6789. if (thisEnd === undefined) {
  6790. thisEnd = this.length
  6791. }
  6792. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6793. throw new RangeError('out of range index')
  6794. }
  6795. if (thisStart >= thisEnd && start >= end) {
  6796. return 0
  6797. }
  6798. if (thisStart >= thisEnd) {
  6799. return -1
  6800. }
  6801. if (start >= end) {
  6802. return 1
  6803. }
  6804. start >>>= 0
  6805. end >>>= 0
  6806. thisStart >>>= 0
  6807. thisEnd >>>= 0
  6808. if (this === target) return 0
  6809. var x = thisEnd - thisStart
  6810. var y = end - start
  6811. var len = Math.min(x, y)
  6812. var thisCopy = this.slice(thisStart, thisEnd)
  6813. var targetCopy = target.slice(start, end)
  6814. for (var i = 0; i < len; ++i) {
  6815. if (thisCopy[i] !== targetCopy[i]) {
  6816. x = thisCopy[i]
  6817. y = targetCopy[i]
  6818. break
  6819. }
  6820. }
  6821. if (x < y) return -1
  6822. if (y < x) return 1
  6823. return 0
  6824. }
  6825. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6826. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6827. //
  6828. // Arguments:
  6829. // - buffer - a Buffer to search
  6830. // - val - a string, Buffer, or number
  6831. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6832. // - encoding - an optional encoding, relevant is val is a string
  6833. // - dir - true for indexOf, false for lastIndexOf
  6834. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6835. // Empty buffer means no match
  6836. if (buffer.length === 0) return -1
  6837. // Normalize byteOffset
  6838. if (typeof byteOffset === 'string') {
  6839. encoding = byteOffset
  6840. byteOffset = 0
  6841. } else if (byteOffset > 0x7fffffff) {
  6842. byteOffset = 0x7fffffff
  6843. } else if (byteOffset < -0x80000000) {
  6844. byteOffset = -0x80000000
  6845. }
  6846. byteOffset = +byteOffset // Coerce to Number.
  6847. if (isNaN(byteOffset)) {
  6848. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6849. byteOffset = dir ? 0 : (buffer.length - 1)
  6850. }
  6851. // Normalize byteOffset: negative offsets start from the end of the buffer
  6852. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6853. if (byteOffset >= buffer.length) {
  6854. if (dir) return -1
  6855. else byteOffset = buffer.length - 1
  6856. } else if (byteOffset < 0) {
  6857. if (dir) byteOffset = 0
  6858. else return -1
  6859. }
  6860. // Normalize val
  6861. if (typeof val === 'string') {
  6862. val = Buffer.from(val, encoding)
  6863. }
  6864. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6865. if (Buffer.isBuffer(val)) {
  6866. // Special case: looking for empty string/buffer always fails
  6867. if (val.length === 0) {
  6868. return -1
  6869. }
  6870. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6871. } else if (typeof val === 'number') {
  6872. val = val & 0xFF // Search for a byte value [0-255]
  6873. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6874. typeof Uint8Array.prototype.indexOf === 'function') {
  6875. if (dir) {
  6876. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6877. } else {
  6878. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6879. }
  6880. }
  6881. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6882. }
  6883. throw new TypeError('val must be string, number or Buffer')
  6884. }
  6885. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6886. var indexSize = 1
  6887. var arrLength = arr.length
  6888. var valLength = val.length
  6889. if (encoding !== undefined) {
  6890. encoding = String(encoding).toLowerCase()
  6891. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6892. encoding === 'utf16le' || encoding === 'utf-16le') {
  6893. if (arr.length < 2 || val.length < 2) {
  6894. return -1
  6895. }
  6896. indexSize = 2
  6897. arrLength /= 2
  6898. valLength /= 2
  6899. byteOffset /= 2
  6900. }
  6901. }
  6902. function read (buf, i) {
  6903. if (indexSize === 1) {
  6904. return buf[i]
  6905. } else {
  6906. return buf.readUInt16BE(i * indexSize)
  6907. }
  6908. }
  6909. var i
  6910. if (dir) {
  6911. var foundIndex = -1
  6912. for (i = byteOffset; i < arrLength; i++) {
  6913. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6914. if (foundIndex === -1) foundIndex = i
  6915. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6916. } else {
  6917. if (foundIndex !== -1) i -= i - foundIndex
  6918. foundIndex = -1
  6919. }
  6920. }
  6921. } else {
  6922. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6923. for (i = byteOffset; i >= 0; i--) {
  6924. var found = true
  6925. for (var j = 0; j < valLength; j++) {
  6926. if (read(arr, i + j) !== read(val, j)) {
  6927. found = false
  6928. break
  6929. }
  6930. }
  6931. if (found) return i
  6932. }
  6933. }
  6934. return -1
  6935. }
  6936. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6937. return this.indexOf(val, byteOffset, encoding) !== -1
  6938. }
  6939. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6940. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6941. }
  6942. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6943. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6944. }
  6945. function hexWrite (buf, string, offset, length) {
  6946. offset = Number(offset) || 0
  6947. var remaining = buf.length - offset
  6948. if (!length) {
  6949. length = remaining
  6950. } else {
  6951. length = Number(length)
  6952. if (length > remaining) {
  6953. length = remaining
  6954. }
  6955. }
  6956. // must be an even number of digits
  6957. var strLen = string.length
  6958. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6959. if (length > strLen / 2) {
  6960. length = strLen / 2
  6961. }
  6962. for (var i = 0; i < length; ++i) {
  6963. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6964. if (isNaN(parsed)) return i
  6965. buf[offset + i] = parsed
  6966. }
  6967. return i
  6968. }
  6969. function utf8Write (buf, string, offset, length) {
  6970. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6971. }
  6972. function asciiWrite (buf, string, offset, length) {
  6973. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6974. }
  6975. function latin1Write (buf, string, offset, length) {
  6976. return asciiWrite(buf, string, offset, length)
  6977. }
  6978. function base64Write (buf, string, offset, length) {
  6979. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6980. }
  6981. function ucs2Write (buf, string, offset, length) {
  6982. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6983. }
  6984. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6985. // Buffer#write(string)
  6986. if (offset === undefined) {
  6987. encoding = 'utf8'
  6988. length = this.length
  6989. offset = 0
  6990. // Buffer#write(string, encoding)
  6991. } else if (length === undefined && typeof offset === 'string') {
  6992. encoding = offset
  6993. length = this.length
  6994. offset = 0
  6995. // Buffer#write(string, offset[, length][, encoding])
  6996. } else if (isFinite(offset)) {
  6997. offset = offset | 0
  6998. if (isFinite(length)) {
  6999. length = length | 0
  7000. if (encoding === undefined) encoding = 'utf8'
  7001. } else {
  7002. encoding = length
  7003. length = undefined
  7004. }
  7005. // legacy write(string, encoding, offset, length) - remove in v0.13
  7006. } else {
  7007. throw new Error(
  7008. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7009. )
  7010. }
  7011. var remaining = this.length - offset
  7012. if (length === undefined || length > remaining) length = remaining
  7013. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7014. throw new RangeError('Attempt to write outside buffer bounds')
  7015. }
  7016. if (!encoding) encoding = 'utf8'
  7017. var loweredCase = false
  7018. for (;;) {
  7019. switch (encoding) {
  7020. case 'hex':
  7021. return hexWrite(this, string, offset, length)
  7022. case 'utf8':
  7023. case 'utf-8':
  7024. return utf8Write(this, string, offset, length)
  7025. case 'ascii':
  7026. return asciiWrite(this, string, offset, length)
  7027. case 'latin1':
  7028. case 'binary':
  7029. return latin1Write(this, string, offset, length)
  7030. case 'base64':
  7031. // Warning: maxLength not taken into account in base64Write
  7032. return base64Write(this, string, offset, length)
  7033. case 'ucs2':
  7034. case 'ucs-2':
  7035. case 'utf16le':
  7036. case 'utf-16le':
  7037. return ucs2Write(this, string, offset, length)
  7038. default:
  7039. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7040. encoding = ('' + encoding).toLowerCase()
  7041. loweredCase = true
  7042. }
  7043. }
  7044. }
  7045. Buffer.prototype.toJSON = function toJSON () {
  7046. return {
  7047. type: 'Buffer',
  7048. data: Array.prototype.slice.call(this._arr || this, 0)
  7049. }
  7050. }
  7051. function base64Slice (buf, start, end) {
  7052. if (start === 0 && end === buf.length) {
  7053. return base64.fromByteArray(buf)
  7054. } else {
  7055. return base64.fromByteArray(buf.slice(start, end))
  7056. }
  7057. }
  7058. function utf8Slice (buf, start, end) {
  7059. end = Math.min(buf.length, end)
  7060. var res = []
  7061. var i = start
  7062. while (i < end) {
  7063. var firstByte = buf[i]
  7064. var codePoint = null
  7065. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7066. : (firstByte > 0xDF) ? 3
  7067. : (firstByte > 0xBF) ? 2
  7068. : 1
  7069. if (i + bytesPerSequence <= end) {
  7070. var secondByte, thirdByte, fourthByte, tempCodePoint
  7071. switch (bytesPerSequence) {
  7072. case 1:
  7073. if (firstByte < 0x80) {
  7074. codePoint = firstByte
  7075. }
  7076. break
  7077. case 2:
  7078. secondByte = buf[i + 1]
  7079. if ((secondByte & 0xC0) === 0x80) {
  7080. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7081. if (tempCodePoint > 0x7F) {
  7082. codePoint = tempCodePoint
  7083. }
  7084. }
  7085. break
  7086. case 3:
  7087. secondByte = buf[i + 1]
  7088. thirdByte = buf[i + 2]
  7089. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7090. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7091. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7092. codePoint = tempCodePoint
  7093. }
  7094. }
  7095. break
  7096. case 4:
  7097. secondByte = buf[i + 1]
  7098. thirdByte = buf[i + 2]
  7099. fourthByte = buf[i + 3]
  7100. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7101. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7102. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7103. codePoint = tempCodePoint
  7104. }
  7105. }
  7106. }
  7107. }
  7108. if (codePoint === null) {
  7109. // we did not generate a valid codePoint so insert a
  7110. // replacement char (U+FFFD) and advance only 1 byte
  7111. codePoint = 0xFFFD
  7112. bytesPerSequence = 1
  7113. } else if (codePoint > 0xFFFF) {
  7114. // encode to utf16 (surrogate pair dance)
  7115. codePoint -= 0x10000
  7116. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7117. codePoint = 0xDC00 | codePoint & 0x3FF
  7118. }
  7119. res.push(codePoint)
  7120. i += bytesPerSequence
  7121. }
  7122. return decodeCodePointsArray(res)
  7123. }
  7124. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7125. // the lowest limit is Chrome, with 0x10000 args.
  7126. // We go 1 magnitude less, for safety
  7127. var MAX_ARGUMENTS_LENGTH = 0x1000
  7128. function decodeCodePointsArray (codePoints) {
  7129. var len = codePoints.length
  7130. if (len <= MAX_ARGUMENTS_LENGTH) {
  7131. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7132. }
  7133. // Decode in chunks to avoid "call stack size exceeded".
  7134. var res = ''
  7135. var i = 0
  7136. while (i < len) {
  7137. res += String.fromCharCode.apply(
  7138. String,
  7139. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7140. )
  7141. }
  7142. return res
  7143. }
  7144. function asciiSlice (buf, start, end) {
  7145. var ret = ''
  7146. end = Math.min(buf.length, end)
  7147. for (var i = start; i < end; ++i) {
  7148. ret += String.fromCharCode(buf[i] & 0x7F)
  7149. }
  7150. return ret
  7151. }
  7152. function latin1Slice (buf, start, end) {
  7153. var ret = ''
  7154. end = Math.min(buf.length, end)
  7155. for (var i = start; i < end; ++i) {
  7156. ret += String.fromCharCode(buf[i])
  7157. }
  7158. return ret
  7159. }
  7160. function hexSlice (buf, start, end) {
  7161. var len = buf.length
  7162. if (!start || start < 0) start = 0
  7163. if (!end || end < 0 || end > len) end = len
  7164. var out = ''
  7165. for (var i = start; i < end; ++i) {
  7166. out += toHex(buf[i])
  7167. }
  7168. return out
  7169. }
  7170. function utf16leSlice (buf, start, end) {
  7171. var bytes = buf.slice(start, end)
  7172. var res = ''
  7173. for (var i = 0; i < bytes.length; i += 2) {
  7174. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7175. }
  7176. return res
  7177. }
  7178. Buffer.prototype.slice = function slice (start, end) {
  7179. var len = this.length
  7180. start = ~~start
  7181. end = end === undefined ? len : ~~end
  7182. if (start < 0) {
  7183. start += len
  7184. if (start < 0) start = 0
  7185. } else if (start > len) {
  7186. start = len
  7187. }
  7188. if (end < 0) {
  7189. end += len
  7190. if (end < 0) end = 0
  7191. } else if (end > len) {
  7192. end = len
  7193. }
  7194. if (end < start) end = start
  7195. var newBuf
  7196. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7197. newBuf = this.subarray(start, end)
  7198. newBuf.__proto__ = Buffer.prototype
  7199. } else {
  7200. var sliceLen = end - start
  7201. newBuf = new Buffer(sliceLen, undefined)
  7202. for (var i = 0; i < sliceLen; ++i) {
  7203. newBuf[i] = this[i + start]
  7204. }
  7205. }
  7206. return newBuf
  7207. }
  7208. /*
  7209. * Need to make sure that buffer isn't trying to write out of bounds.
  7210. */
  7211. function checkOffset (offset, ext, length) {
  7212. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7213. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7214. }
  7215. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7216. offset = offset | 0
  7217. byteLength = byteLength | 0
  7218. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7219. var val = this[offset]
  7220. var mul = 1
  7221. var i = 0
  7222. while (++i < byteLength && (mul *= 0x100)) {
  7223. val += this[offset + i] * mul
  7224. }
  7225. return val
  7226. }
  7227. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7228. offset = offset | 0
  7229. byteLength = byteLength | 0
  7230. if (!noAssert) {
  7231. checkOffset(offset, byteLength, this.length)
  7232. }
  7233. var val = this[offset + --byteLength]
  7234. var mul = 1
  7235. while (byteLength > 0 && (mul *= 0x100)) {
  7236. val += this[offset + --byteLength] * mul
  7237. }
  7238. return val
  7239. }
  7240. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7241. if (!noAssert) checkOffset(offset, 1, this.length)
  7242. return this[offset]
  7243. }
  7244. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7245. if (!noAssert) checkOffset(offset, 2, this.length)
  7246. return this[offset] | (this[offset + 1] << 8)
  7247. }
  7248. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7249. if (!noAssert) checkOffset(offset, 2, this.length)
  7250. return (this[offset] << 8) | this[offset + 1]
  7251. }
  7252. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7253. if (!noAssert) checkOffset(offset, 4, this.length)
  7254. return ((this[offset]) |
  7255. (this[offset + 1] << 8) |
  7256. (this[offset + 2] << 16)) +
  7257. (this[offset + 3] * 0x1000000)
  7258. }
  7259. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7260. if (!noAssert) checkOffset(offset, 4, this.length)
  7261. return (this[offset] * 0x1000000) +
  7262. ((this[offset + 1] << 16) |
  7263. (this[offset + 2] << 8) |
  7264. this[offset + 3])
  7265. }
  7266. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7267. offset = offset | 0
  7268. byteLength = byteLength | 0
  7269. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7270. var val = this[offset]
  7271. var mul = 1
  7272. var i = 0
  7273. while (++i < byteLength && (mul *= 0x100)) {
  7274. val += this[offset + i] * mul
  7275. }
  7276. mul *= 0x80
  7277. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7278. return val
  7279. }
  7280. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7281. offset = offset | 0
  7282. byteLength = byteLength | 0
  7283. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7284. var i = byteLength
  7285. var mul = 1
  7286. var val = this[offset + --i]
  7287. while (i > 0 && (mul *= 0x100)) {
  7288. val += this[offset + --i] * mul
  7289. }
  7290. mul *= 0x80
  7291. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7292. return val
  7293. }
  7294. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7295. if (!noAssert) checkOffset(offset, 1, this.length)
  7296. if (!(this[offset] & 0x80)) return (this[offset])
  7297. return ((0xff - this[offset] + 1) * -1)
  7298. }
  7299. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7300. if (!noAssert) checkOffset(offset, 2, this.length)
  7301. var val = this[offset] | (this[offset + 1] << 8)
  7302. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7303. }
  7304. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7305. if (!noAssert) checkOffset(offset, 2, this.length)
  7306. var val = this[offset + 1] | (this[offset] << 8)
  7307. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7308. }
  7309. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7310. if (!noAssert) checkOffset(offset, 4, this.length)
  7311. return (this[offset]) |
  7312. (this[offset + 1] << 8) |
  7313. (this[offset + 2] << 16) |
  7314. (this[offset + 3] << 24)
  7315. }
  7316. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7317. if (!noAssert) checkOffset(offset, 4, this.length)
  7318. return (this[offset] << 24) |
  7319. (this[offset + 1] << 16) |
  7320. (this[offset + 2] << 8) |
  7321. (this[offset + 3])
  7322. }
  7323. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7324. if (!noAssert) checkOffset(offset, 4, this.length)
  7325. return ieee754.read(this, offset, true, 23, 4)
  7326. }
  7327. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7328. if (!noAssert) checkOffset(offset, 4, this.length)
  7329. return ieee754.read(this, offset, false, 23, 4)
  7330. }
  7331. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7332. if (!noAssert) checkOffset(offset, 8, this.length)
  7333. return ieee754.read(this, offset, true, 52, 8)
  7334. }
  7335. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7336. if (!noAssert) checkOffset(offset, 8, this.length)
  7337. return ieee754.read(this, offset, false, 52, 8)
  7338. }
  7339. function checkInt (buf, value, offset, ext, max, min) {
  7340. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7341. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7342. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7343. }
  7344. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7345. value = +value
  7346. offset = offset | 0
  7347. byteLength = byteLength | 0
  7348. if (!noAssert) {
  7349. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7350. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7351. }
  7352. var mul = 1
  7353. var i = 0
  7354. this[offset] = value & 0xFF
  7355. while (++i < byteLength && (mul *= 0x100)) {
  7356. this[offset + i] = (value / mul) & 0xFF
  7357. }
  7358. return offset + byteLength
  7359. }
  7360. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7361. value = +value
  7362. offset = offset | 0
  7363. byteLength = byteLength | 0
  7364. if (!noAssert) {
  7365. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7366. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7367. }
  7368. var i = byteLength - 1
  7369. var mul = 1
  7370. this[offset + i] = value & 0xFF
  7371. while (--i >= 0 && (mul *= 0x100)) {
  7372. this[offset + i] = (value / mul) & 0xFF
  7373. }
  7374. return offset + byteLength
  7375. }
  7376. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7377. value = +value
  7378. offset = offset | 0
  7379. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7380. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7381. this[offset] = (value & 0xff)
  7382. return offset + 1
  7383. }
  7384. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7385. if (value < 0) value = 0xffff + value + 1
  7386. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7387. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7388. (littleEndian ? i : 1 - i) * 8
  7389. }
  7390. }
  7391. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7392. value = +value
  7393. offset = offset | 0
  7394. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7395. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7396. this[offset] = (value & 0xff)
  7397. this[offset + 1] = (value >>> 8)
  7398. } else {
  7399. objectWriteUInt16(this, value, offset, true)
  7400. }
  7401. return offset + 2
  7402. }
  7403. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7404. value = +value
  7405. offset = offset | 0
  7406. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7407. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7408. this[offset] = (value >>> 8)
  7409. this[offset + 1] = (value & 0xff)
  7410. } else {
  7411. objectWriteUInt16(this, value, offset, false)
  7412. }
  7413. return offset + 2
  7414. }
  7415. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7416. if (value < 0) value = 0xffffffff + value + 1
  7417. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7418. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7419. }
  7420. }
  7421. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7422. value = +value
  7423. offset = offset | 0
  7424. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7425. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7426. this[offset + 3] = (value >>> 24)
  7427. this[offset + 2] = (value >>> 16)
  7428. this[offset + 1] = (value >>> 8)
  7429. this[offset] = (value & 0xff)
  7430. } else {
  7431. objectWriteUInt32(this, value, offset, true)
  7432. }
  7433. return offset + 4
  7434. }
  7435. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7436. value = +value
  7437. offset = offset | 0
  7438. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7439. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7440. this[offset] = (value >>> 24)
  7441. this[offset + 1] = (value >>> 16)
  7442. this[offset + 2] = (value >>> 8)
  7443. this[offset + 3] = (value & 0xff)
  7444. } else {
  7445. objectWriteUInt32(this, value, offset, false)
  7446. }
  7447. return offset + 4
  7448. }
  7449. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7450. value = +value
  7451. offset = offset | 0
  7452. if (!noAssert) {
  7453. var limit = Math.pow(2, 8 * byteLength - 1)
  7454. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7455. }
  7456. var i = 0
  7457. var mul = 1
  7458. var sub = 0
  7459. this[offset] = value & 0xFF
  7460. while (++i < byteLength && (mul *= 0x100)) {
  7461. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7462. sub = 1
  7463. }
  7464. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7465. }
  7466. return offset + byteLength
  7467. }
  7468. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7469. value = +value
  7470. offset = offset | 0
  7471. if (!noAssert) {
  7472. var limit = Math.pow(2, 8 * byteLength - 1)
  7473. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7474. }
  7475. var i = byteLength - 1
  7476. var mul = 1
  7477. var sub = 0
  7478. this[offset + i] = value & 0xFF
  7479. while (--i >= 0 && (mul *= 0x100)) {
  7480. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7481. sub = 1
  7482. }
  7483. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7484. }
  7485. return offset + byteLength
  7486. }
  7487. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7488. value = +value
  7489. offset = offset | 0
  7490. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7491. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7492. if (value < 0) value = 0xff + value + 1
  7493. this[offset] = (value & 0xff)
  7494. return offset + 1
  7495. }
  7496. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7497. value = +value
  7498. offset = offset | 0
  7499. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7500. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7501. this[offset] = (value & 0xff)
  7502. this[offset + 1] = (value >>> 8)
  7503. } else {
  7504. objectWriteUInt16(this, value, offset, true)
  7505. }
  7506. return offset + 2
  7507. }
  7508. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7509. value = +value
  7510. offset = offset | 0
  7511. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7512. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7513. this[offset] = (value >>> 8)
  7514. this[offset + 1] = (value & 0xff)
  7515. } else {
  7516. objectWriteUInt16(this, value, offset, false)
  7517. }
  7518. return offset + 2
  7519. }
  7520. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7521. value = +value
  7522. offset = offset | 0
  7523. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7524. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7525. this[offset] = (value & 0xff)
  7526. this[offset + 1] = (value >>> 8)
  7527. this[offset + 2] = (value >>> 16)
  7528. this[offset + 3] = (value >>> 24)
  7529. } else {
  7530. objectWriteUInt32(this, value, offset, true)
  7531. }
  7532. return offset + 4
  7533. }
  7534. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7535. value = +value
  7536. offset = offset | 0
  7537. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7538. if (value < 0) value = 0xffffffff + value + 1
  7539. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7540. this[offset] = (value >>> 24)
  7541. this[offset + 1] = (value >>> 16)
  7542. this[offset + 2] = (value >>> 8)
  7543. this[offset + 3] = (value & 0xff)
  7544. } else {
  7545. objectWriteUInt32(this, value, offset, false)
  7546. }
  7547. return offset + 4
  7548. }
  7549. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7550. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7551. if (offset < 0) throw new RangeError('Index out of range')
  7552. }
  7553. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7554. if (!noAssert) {
  7555. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7556. }
  7557. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7558. return offset + 4
  7559. }
  7560. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7561. return writeFloat(this, value, offset, true, noAssert)
  7562. }
  7563. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7564. return writeFloat(this, value, offset, false, noAssert)
  7565. }
  7566. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7567. if (!noAssert) {
  7568. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7569. }
  7570. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7571. return offset + 8
  7572. }
  7573. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7574. return writeDouble(this, value, offset, true, noAssert)
  7575. }
  7576. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7577. return writeDouble(this, value, offset, false, noAssert)
  7578. }
  7579. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7580. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7581. if (!start) start = 0
  7582. if (!end && end !== 0) end = this.length
  7583. if (targetStart >= target.length) targetStart = target.length
  7584. if (!targetStart) targetStart = 0
  7585. if (end > 0 && end < start) end = start
  7586. // Copy 0 bytes; we're done
  7587. if (end === start) return 0
  7588. if (target.length === 0 || this.length === 0) return 0
  7589. // Fatal error conditions
  7590. if (targetStart < 0) {
  7591. throw new RangeError('targetStart out of bounds')
  7592. }
  7593. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7594. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7595. // Are we oob?
  7596. if (end > this.length) end = this.length
  7597. if (target.length - targetStart < end - start) {
  7598. end = target.length - targetStart + start
  7599. }
  7600. var len = end - start
  7601. var i
  7602. if (this === target && start < targetStart && targetStart < end) {
  7603. // descending copy from end
  7604. for (i = len - 1; i >= 0; --i) {
  7605. target[i + targetStart] = this[i + start]
  7606. }
  7607. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7608. // ascending copy from start
  7609. for (i = 0; i < len; ++i) {
  7610. target[i + targetStart] = this[i + start]
  7611. }
  7612. } else {
  7613. Uint8Array.prototype.set.call(
  7614. target,
  7615. this.subarray(start, start + len),
  7616. targetStart
  7617. )
  7618. }
  7619. return len
  7620. }
  7621. // Usage:
  7622. // buffer.fill(number[, offset[, end]])
  7623. // buffer.fill(buffer[, offset[, end]])
  7624. // buffer.fill(string[, offset[, end]][, encoding])
  7625. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7626. // Handle string cases:
  7627. if (typeof val === 'string') {
  7628. if (typeof start === 'string') {
  7629. encoding = start
  7630. start = 0
  7631. end = this.length
  7632. } else if (typeof end === 'string') {
  7633. encoding = end
  7634. end = this.length
  7635. }
  7636. if (val.length === 1) {
  7637. var code = val.charCodeAt(0)
  7638. if (code < 256) {
  7639. val = code
  7640. }
  7641. }
  7642. if (encoding !== undefined && typeof encoding !== 'string') {
  7643. throw new TypeError('encoding must be a string')
  7644. }
  7645. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7646. throw new TypeError('Unknown encoding: ' + encoding)
  7647. }
  7648. } else if (typeof val === 'number') {
  7649. val = val & 255
  7650. }
  7651. // Invalid ranges are not set to a default, so can range check early.
  7652. if (start < 0 || this.length < start || this.length < end) {
  7653. throw new RangeError('Out of range index')
  7654. }
  7655. if (end <= start) {
  7656. return this
  7657. }
  7658. start = start >>> 0
  7659. end = end === undefined ? this.length : end >>> 0
  7660. if (!val) val = 0
  7661. var i
  7662. if (typeof val === 'number') {
  7663. for (i = start; i < end; ++i) {
  7664. this[i] = val
  7665. }
  7666. } else {
  7667. var bytes = Buffer.isBuffer(val)
  7668. ? val
  7669. : utf8ToBytes(new Buffer(val, encoding).toString())
  7670. var len = bytes.length
  7671. for (i = 0; i < end - start; ++i) {
  7672. this[i + start] = bytes[i % len]
  7673. }
  7674. }
  7675. return this
  7676. }
  7677. // HELPER FUNCTIONS
  7678. // ================
  7679. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7680. function base64clean (str) {
  7681. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7682. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7683. // Node converts strings with length < 2 to ''
  7684. if (str.length < 2) return ''
  7685. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7686. while (str.length % 4 !== 0) {
  7687. str = str + '='
  7688. }
  7689. return str
  7690. }
  7691. function stringtrim (str) {
  7692. if (str.trim) return str.trim()
  7693. return str.replace(/^\s+|\s+$/g, '')
  7694. }
  7695. function toHex (n) {
  7696. if (n < 16) return '0' + n.toString(16)
  7697. return n.toString(16)
  7698. }
  7699. function utf8ToBytes (string, units) {
  7700. units = units || Infinity
  7701. var codePoint
  7702. var length = string.length
  7703. var leadSurrogate = null
  7704. var bytes = []
  7705. for (var i = 0; i < length; ++i) {
  7706. codePoint = string.charCodeAt(i)
  7707. // is surrogate component
  7708. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7709. // last char was a lead
  7710. if (!leadSurrogate) {
  7711. // no lead yet
  7712. if (codePoint > 0xDBFF) {
  7713. // unexpected trail
  7714. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7715. continue
  7716. } else if (i + 1 === length) {
  7717. // unpaired lead
  7718. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7719. continue
  7720. }
  7721. // valid lead
  7722. leadSurrogate = codePoint
  7723. continue
  7724. }
  7725. // 2 leads in a row
  7726. if (codePoint < 0xDC00) {
  7727. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7728. leadSurrogate = codePoint
  7729. continue
  7730. }
  7731. // valid surrogate pair
  7732. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7733. } else if (leadSurrogate) {
  7734. // valid bmp char, but last char was a lead
  7735. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7736. }
  7737. leadSurrogate = null
  7738. // encode utf8
  7739. if (codePoint < 0x80) {
  7740. if ((units -= 1) < 0) break
  7741. bytes.push(codePoint)
  7742. } else if (codePoint < 0x800) {
  7743. if ((units -= 2) < 0) break
  7744. bytes.push(
  7745. codePoint >> 0x6 | 0xC0,
  7746. codePoint & 0x3F | 0x80
  7747. )
  7748. } else if (codePoint < 0x10000) {
  7749. if ((units -= 3) < 0) break
  7750. bytes.push(
  7751. codePoint >> 0xC | 0xE0,
  7752. codePoint >> 0x6 & 0x3F | 0x80,
  7753. codePoint & 0x3F | 0x80
  7754. )
  7755. } else if (codePoint < 0x110000) {
  7756. if ((units -= 4) < 0) break
  7757. bytes.push(
  7758. codePoint >> 0x12 | 0xF0,
  7759. codePoint >> 0xC & 0x3F | 0x80,
  7760. codePoint >> 0x6 & 0x3F | 0x80,
  7761. codePoint & 0x3F | 0x80
  7762. )
  7763. } else {
  7764. throw new Error('Invalid code point')
  7765. }
  7766. }
  7767. return bytes
  7768. }
  7769. function asciiToBytes (str) {
  7770. var byteArray = []
  7771. for (var i = 0; i < str.length; ++i) {
  7772. // Node's code seems to be doing this and not & 0x7F..
  7773. byteArray.push(str.charCodeAt(i) & 0xFF)
  7774. }
  7775. return byteArray
  7776. }
  7777. function utf16leToBytes (str, units) {
  7778. var c, hi, lo
  7779. var byteArray = []
  7780. for (var i = 0; i < str.length; ++i) {
  7781. if ((units -= 2) < 0) break
  7782. c = str.charCodeAt(i)
  7783. hi = c >> 8
  7784. lo = c % 256
  7785. byteArray.push(lo)
  7786. byteArray.push(hi)
  7787. }
  7788. return byteArray
  7789. }
  7790. function base64ToBytes (str) {
  7791. return base64.toByteArray(base64clean(str))
  7792. }
  7793. function blitBuffer (src, dst, offset, length) {
  7794. for (var i = 0; i < length; ++i) {
  7795. if ((i + offset >= dst.length) || (i >= src.length)) break
  7796. dst[i + offset] = src[i]
  7797. }
  7798. return i
  7799. }
  7800. function isnan (val) {
  7801. return val !== val // eslint-disable-line no-self-compare
  7802. }
  7803. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7804. /***/ }),
  7805. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7806. /*!**************************************************!*\
  7807. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7808. \**************************************************/
  7809. /*! no static exports found */
  7810. /***/ (function(module, exports, __webpack_require__) {
  7811. /*!
  7812. * clipboard.js v2.0.4
  7813. * https://zenorocha.github.io/clipboard.js
  7814. *
  7815. * Licensed MIT © Zeno Rocha
  7816. */
  7817. (function webpackUniversalModuleDefinition(root, factory) {
  7818. if(true)
  7819. module.exports = factory();
  7820. else {}
  7821. })(this, function() {
  7822. return /******/ (function(modules) { // webpackBootstrap
  7823. /******/ // The module cache
  7824. /******/ var installedModules = {};
  7825. /******/
  7826. /******/ // The require function
  7827. /******/ function __webpack_require__(moduleId) {
  7828. /******/
  7829. /******/ // Check if module is in cache
  7830. /******/ if(installedModules[moduleId]) {
  7831. /******/ return installedModules[moduleId].exports;
  7832. /******/ }
  7833. /******/ // Create a new module (and put it into the cache)
  7834. /******/ var module = installedModules[moduleId] = {
  7835. /******/ i: moduleId,
  7836. /******/ l: false,
  7837. /******/ exports: {}
  7838. /******/ };
  7839. /******/
  7840. /******/ // Execute the module function
  7841. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7842. /******/
  7843. /******/ // Flag the module as loaded
  7844. /******/ module.l = true;
  7845. /******/
  7846. /******/ // Return the exports of the module
  7847. /******/ return module.exports;
  7848. /******/ }
  7849. /******/
  7850. /******/
  7851. /******/ // expose the modules object (__webpack_modules__)
  7852. /******/ __webpack_require__.m = modules;
  7853. /******/
  7854. /******/ // expose the module cache
  7855. /******/ __webpack_require__.c = installedModules;
  7856. /******/
  7857. /******/ // define getter function for harmony exports
  7858. /******/ __webpack_require__.d = function(exports, name, getter) {
  7859. /******/ if(!__webpack_require__.o(exports, name)) {
  7860. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7861. /******/ }
  7862. /******/ };
  7863. /******/
  7864. /******/ // define __esModule on exports
  7865. /******/ __webpack_require__.r = function(exports) {
  7866. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7867. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7868. /******/ }
  7869. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7870. /******/ };
  7871. /******/
  7872. /******/ // create a fake namespace object
  7873. /******/ // mode & 1: value is a module id, require it
  7874. /******/ // mode & 2: merge all properties of value into the ns
  7875. /******/ // mode & 4: return value when already ns object
  7876. /******/ // mode & 8|1: behave like require
  7877. /******/ __webpack_require__.t = function(value, mode) {
  7878. /******/ if(mode & 1) value = __webpack_require__(value);
  7879. /******/ if(mode & 8) return value;
  7880. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7881. /******/ var ns = Object.create(null);
  7882. /******/ __webpack_require__.r(ns);
  7883. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7884. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7885. /******/ return ns;
  7886. /******/ };
  7887. /******/
  7888. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7889. /******/ __webpack_require__.n = function(module) {
  7890. /******/ var getter = module && module.__esModule ?
  7891. /******/ function getDefault() { return module['default']; } :
  7892. /******/ function getModuleExports() { return module; };
  7893. /******/ __webpack_require__.d(getter, 'a', getter);
  7894. /******/ return getter;
  7895. /******/ };
  7896. /******/
  7897. /******/ // Object.prototype.hasOwnProperty.call
  7898. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7899. /******/
  7900. /******/ // __webpack_public_path__
  7901. /******/ __webpack_require__.p = "";
  7902. /******/
  7903. /******/
  7904. /******/ // Load entry module and return exports
  7905. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7906. /******/ })
  7907. /************************************************************************/
  7908. /******/ ([
  7909. /* 0 */
  7910. /***/ (function(module, exports, __webpack_require__) {
  7911. "use strict";
  7912. 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; };
  7913. 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; }; }();
  7914. var _clipboardAction = __webpack_require__(1);
  7915. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7916. var _tinyEmitter = __webpack_require__(3);
  7917. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7918. var _goodListener = __webpack_require__(4);
  7919. var _goodListener2 = _interopRequireDefault(_goodListener);
  7920. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7921. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7922. 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; }
  7923. 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; }
  7924. /**
  7925. * Base class which takes one or more elements, adds event listeners to them,
  7926. * and instantiates a new `ClipboardAction` on each click.
  7927. */
  7928. var Clipboard = function (_Emitter) {
  7929. _inherits(Clipboard, _Emitter);
  7930. /**
  7931. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7932. * @param {Object} options
  7933. */
  7934. function Clipboard(trigger, options) {
  7935. _classCallCheck(this, Clipboard);
  7936. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7937. _this.resolveOptions(options);
  7938. _this.listenClick(trigger);
  7939. return _this;
  7940. }
  7941. /**
  7942. * Defines if attributes would be resolved using internal setter functions
  7943. * or custom functions that were passed in the constructor.
  7944. * @param {Object} options
  7945. */
  7946. _createClass(Clipboard, [{
  7947. key: 'resolveOptions',
  7948. value: function resolveOptions() {
  7949. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7950. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7951. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7952. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7953. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7954. }
  7955. /**
  7956. * Adds a click event listener to the passed trigger.
  7957. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7958. */
  7959. }, {
  7960. key: 'listenClick',
  7961. value: function listenClick(trigger) {
  7962. var _this2 = this;
  7963. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7964. return _this2.onClick(e);
  7965. });
  7966. }
  7967. /**
  7968. * Defines a new `ClipboardAction` on each click event.
  7969. * @param {Event} e
  7970. */
  7971. }, {
  7972. key: 'onClick',
  7973. value: function onClick(e) {
  7974. var trigger = e.delegateTarget || e.currentTarget;
  7975. if (this.clipboardAction) {
  7976. this.clipboardAction = null;
  7977. }
  7978. this.clipboardAction = new _clipboardAction2.default({
  7979. action: this.action(trigger),
  7980. target: this.target(trigger),
  7981. text: this.text(trigger),
  7982. container: this.container,
  7983. trigger: trigger,
  7984. emitter: this
  7985. });
  7986. }
  7987. /**
  7988. * Default `action` lookup function.
  7989. * @param {Element} trigger
  7990. */
  7991. }, {
  7992. key: 'defaultAction',
  7993. value: function defaultAction(trigger) {
  7994. return getAttributeValue('action', trigger);
  7995. }
  7996. /**
  7997. * Default `target` lookup function.
  7998. * @param {Element} trigger
  7999. */
  8000. }, {
  8001. key: 'defaultTarget',
  8002. value: function defaultTarget(trigger) {
  8003. var selector = getAttributeValue('target', trigger);
  8004. if (selector) {
  8005. return document.querySelector(selector);
  8006. }
  8007. }
  8008. /**
  8009. * Returns the support of the given action, or all actions if no action is
  8010. * given.
  8011. * @param {String} [action]
  8012. */
  8013. }, {
  8014. key: 'defaultText',
  8015. /**
  8016. * Default `text` lookup function.
  8017. * @param {Element} trigger
  8018. */
  8019. value: function defaultText(trigger) {
  8020. return getAttributeValue('text', trigger);
  8021. }
  8022. /**
  8023. * Destroy lifecycle.
  8024. */
  8025. }, {
  8026. key: 'destroy',
  8027. value: function destroy() {
  8028. this.listener.destroy();
  8029. if (this.clipboardAction) {
  8030. this.clipboardAction.destroy();
  8031. this.clipboardAction = null;
  8032. }
  8033. }
  8034. }], [{
  8035. key: 'isSupported',
  8036. value: function isSupported() {
  8037. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8038. var actions = typeof action === 'string' ? [action] : action;
  8039. var support = !!document.queryCommandSupported;
  8040. actions.forEach(function (action) {
  8041. support = support && !!document.queryCommandSupported(action);
  8042. });
  8043. return support;
  8044. }
  8045. }]);
  8046. return Clipboard;
  8047. }(_tinyEmitter2.default);
  8048. /**
  8049. * Helper function to retrieve attribute value.
  8050. * @param {String} suffix
  8051. * @param {Element} element
  8052. */
  8053. function getAttributeValue(suffix, element) {
  8054. var attribute = 'data-clipboard-' + suffix;
  8055. if (!element.hasAttribute(attribute)) {
  8056. return;
  8057. }
  8058. return element.getAttribute(attribute);
  8059. }
  8060. module.exports = Clipboard;
  8061. /***/ }),
  8062. /* 1 */
  8063. /***/ (function(module, exports, __webpack_require__) {
  8064. "use strict";
  8065. 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; };
  8066. 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; }; }();
  8067. var _select = __webpack_require__(2);
  8068. var _select2 = _interopRequireDefault(_select);
  8069. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8070. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8071. /**
  8072. * Inner class which performs selection from either `text` or `target`
  8073. * properties and then executes copy or cut operations.
  8074. */
  8075. var ClipboardAction = function () {
  8076. /**
  8077. * @param {Object} options
  8078. */
  8079. function ClipboardAction(options) {
  8080. _classCallCheck(this, ClipboardAction);
  8081. this.resolveOptions(options);
  8082. this.initSelection();
  8083. }
  8084. /**
  8085. * Defines base properties passed from constructor.
  8086. * @param {Object} options
  8087. */
  8088. _createClass(ClipboardAction, [{
  8089. key: 'resolveOptions',
  8090. value: function resolveOptions() {
  8091. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8092. this.action = options.action;
  8093. this.container = options.container;
  8094. this.emitter = options.emitter;
  8095. this.target = options.target;
  8096. this.text = options.text;
  8097. this.trigger = options.trigger;
  8098. this.selectedText = '';
  8099. }
  8100. /**
  8101. * Decides which selection strategy is going to be applied based
  8102. * on the existence of `text` and `target` properties.
  8103. */
  8104. }, {
  8105. key: 'initSelection',
  8106. value: function initSelection() {
  8107. if (this.text) {
  8108. this.selectFake();
  8109. } else if (this.target) {
  8110. this.selectTarget();
  8111. }
  8112. }
  8113. /**
  8114. * Creates a fake textarea element, sets its value from `text` property,
  8115. * and makes a selection on it.
  8116. */
  8117. }, {
  8118. key: 'selectFake',
  8119. value: function selectFake() {
  8120. var _this = this;
  8121. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8122. this.removeFake();
  8123. this.fakeHandlerCallback = function () {
  8124. return _this.removeFake();
  8125. };
  8126. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8127. this.fakeElem = document.createElement('textarea');
  8128. // Prevent zooming on iOS
  8129. this.fakeElem.style.fontSize = '12pt';
  8130. // Reset box model
  8131. this.fakeElem.style.border = '0';
  8132. this.fakeElem.style.padding = '0';
  8133. this.fakeElem.style.margin = '0';
  8134. // Move element out of screen horizontally
  8135. this.fakeElem.style.position = 'absolute';
  8136. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8137. // Move element to the same position vertically
  8138. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8139. this.fakeElem.style.top = yPosition + 'px';
  8140. this.fakeElem.setAttribute('readonly', '');
  8141. this.fakeElem.value = this.text;
  8142. this.container.appendChild(this.fakeElem);
  8143. this.selectedText = (0, _select2.default)(this.fakeElem);
  8144. this.copyText();
  8145. }
  8146. /**
  8147. * Only removes the fake element after another click event, that way
  8148. * a user can hit `Ctrl+C` to copy because selection still exists.
  8149. */
  8150. }, {
  8151. key: 'removeFake',
  8152. value: function removeFake() {
  8153. if (this.fakeHandler) {
  8154. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8155. this.fakeHandler = null;
  8156. this.fakeHandlerCallback = null;
  8157. }
  8158. if (this.fakeElem) {
  8159. this.container.removeChild(this.fakeElem);
  8160. this.fakeElem = null;
  8161. }
  8162. }
  8163. /**
  8164. * Selects the content from element passed on `target` property.
  8165. */
  8166. }, {
  8167. key: 'selectTarget',
  8168. value: function selectTarget() {
  8169. this.selectedText = (0, _select2.default)(this.target);
  8170. this.copyText();
  8171. }
  8172. /**
  8173. * Executes the copy operation based on the current selection.
  8174. */
  8175. }, {
  8176. key: 'copyText',
  8177. value: function copyText() {
  8178. var succeeded = void 0;
  8179. try {
  8180. succeeded = document.execCommand(this.action);
  8181. } catch (err) {
  8182. succeeded = false;
  8183. }
  8184. this.handleResult(succeeded);
  8185. }
  8186. /**
  8187. * Fires an event based on the copy operation result.
  8188. * @param {Boolean} succeeded
  8189. */
  8190. }, {
  8191. key: 'handleResult',
  8192. value: function handleResult(succeeded) {
  8193. this.emitter.emit(succeeded ? 'success' : 'error', {
  8194. action: this.action,
  8195. text: this.selectedText,
  8196. trigger: this.trigger,
  8197. clearSelection: this.clearSelection.bind(this)
  8198. });
  8199. }
  8200. /**
  8201. * Moves focus away from `target` and back to the trigger, removes current selection.
  8202. */
  8203. }, {
  8204. key: 'clearSelection',
  8205. value: function clearSelection() {
  8206. if (this.trigger) {
  8207. this.trigger.focus();
  8208. }
  8209. window.getSelection().removeAllRanges();
  8210. }
  8211. /**
  8212. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8213. * @param {String} action
  8214. */
  8215. }, {
  8216. key: 'destroy',
  8217. /**
  8218. * Destroy lifecycle.
  8219. */
  8220. value: function destroy() {
  8221. this.removeFake();
  8222. }
  8223. }, {
  8224. key: 'action',
  8225. set: function set() {
  8226. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8227. this._action = action;
  8228. if (this._action !== 'copy' && this._action !== 'cut') {
  8229. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8230. }
  8231. }
  8232. /**
  8233. * Gets the `action` property.
  8234. * @return {String}
  8235. */
  8236. ,
  8237. get: function get() {
  8238. return this._action;
  8239. }
  8240. /**
  8241. * Sets the `target` property using an element
  8242. * that will be have its content copied.
  8243. * @param {Element} target
  8244. */
  8245. }, {
  8246. key: 'target',
  8247. set: function set(target) {
  8248. if (target !== undefined) {
  8249. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8250. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8251. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8252. }
  8253. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8254. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8255. }
  8256. this._target = target;
  8257. } else {
  8258. throw new Error('Invalid "target" value, use a valid Element');
  8259. }
  8260. }
  8261. }
  8262. /**
  8263. * Gets the `target` property.
  8264. * @return {String|HTMLElement}
  8265. */
  8266. ,
  8267. get: function get() {
  8268. return this._target;
  8269. }
  8270. }]);
  8271. return ClipboardAction;
  8272. }();
  8273. module.exports = ClipboardAction;
  8274. /***/ }),
  8275. /* 2 */
  8276. /***/ (function(module, exports) {
  8277. function select(element) {
  8278. var selectedText;
  8279. if (element.nodeName === 'SELECT') {
  8280. element.focus();
  8281. selectedText = element.value;
  8282. }
  8283. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8284. var isReadOnly = element.hasAttribute('readonly');
  8285. if (!isReadOnly) {
  8286. element.setAttribute('readonly', '');
  8287. }
  8288. element.select();
  8289. element.setSelectionRange(0, element.value.length);
  8290. if (!isReadOnly) {
  8291. element.removeAttribute('readonly');
  8292. }
  8293. selectedText = element.value;
  8294. }
  8295. else {
  8296. if (element.hasAttribute('contenteditable')) {
  8297. element.focus();
  8298. }
  8299. var selection = window.getSelection();
  8300. var range = document.createRange();
  8301. range.selectNodeContents(element);
  8302. selection.removeAllRanges();
  8303. selection.addRange(range);
  8304. selectedText = selection.toString();
  8305. }
  8306. return selectedText;
  8307. }
  8308. module.exports = select;
  8309. /***/ }),
  8310. /* 3 */
  8311. /***/ (function(module, exports) {
  8312. function E () {
  8313. // Keep this empty so it's easier to inherit from
  8314. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8315. }
  8316. E.prototype = {
  8317. on: function (name, callback, ctx) {
  8318. var e = this.e || (this.e = {});
  8319. (e[name] || (e[name] = [])).push({
  8320. fn: callback,
  8321. ctx: ctx
  8322. });
  8323. return this;
  8324. },
  8325. once: function (name, callback, ctx) {
  8326. var self = this;
  8327. function listener () {
  8328. self.off(name, listener);
  8329. callback.apply(ctx, arguments);
  8330. };
  8331. listener._ = callback
  8332. return this.on(name, listener, ctx);
  8333. },
  8334. emit: function (name) {
  8335. var data = [].slice.call(arguments, 1);
  8336. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8337. var i = 0;
  8338. var len = evtArr.length;
  8339. for (i; i < len; i++) {
  8340. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8341. }
  8342. return this;
  8343. },
  8344. off: function (name, callback) {
  8345. var e = this.e || (this.e = {});
  8346. var evts = e[name];
  8347. var liveEvents = [];
  8348. if (evts && callback) {
  8349. for (var i = 0, len = evts.length; i < len; i++) {
  8350. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8351. liveEvents.push(evts[i]);
  8352. }
  8353. }
  8354. // Remove event from queue to prevent memory leak
  8355. // Suggested by https://github.com/lazd
  8356. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8357. (liveEvents.length)
  8358. ? e[name] = liveEvents
  8359. : delete e[name];
  8360. return this;
  8361. }
  8362. };
  8363. module.exports = E;
  8364. /***/ }),
  8365. /* 4 */
  8366. /***/ (function(module, exports, __webpack_require__) {
  8367. var is = __webpack_require__(5);
  8368. var delegate = __webpack_require__(6);
  8369. /**
  8370. * Validates all params and calls the right
  8371. * listener function based on its target type.
  8372. *
  8373. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8374. * @param {String} type
  8375. * @param {Function} callback
  8376. * @return {Object}
  8377. */
  8378. function listen(target, type, callback) {
  8379. if (!target && !type && !callback) {
  8380. throw new Error('Missing required arguments');
  8381. }
  8382. if (!is.string(type)) {
  8383. throw new TypeError('Second argument must be a String');
  8384. }
  8385. if (!is.fn(callback)) {
  8386. throw new TypeError('Third argument must be a Function');
  8387. }
  8388. if (is.node(target)) {
  8389. return listenNode(target, type, callback);
  8390. }
  8391. else if (is.nodeList(target)) {
  8392. return listenNodeList(target, type, callback);
  8393. }
  8394. else if (is.string(target)) {
  8395. return listenSelector(target, type, callback);
  8396. }
  8397. else {
  8398. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8399. }
  8400. }
  8401. /**
  8402. * Adds an event listener to a HTML element
  8403. * and returns a remove listener function.
  8404. *
  8405. * @param {HTMLElement} node
  8406. * @param {String} type
  8407. * @param {Function} callback
  8408. * @return {Object}
  8409. */
  8410. function listenNode(node, type, callback) {
  8411. node.addEventListener(type, callback);
  8412. return {
  8413. destroy: function() {
  8414. node.removeEventListener(type, callback);
  8415. }
  8416. }
  8417. }
  8418. /**
  8419. * Add an event listener to a list of HTML elements
  8420. * and returns a remove listener function.
  8421. *
  8422. * @param {NodeList|HTMLCollection} nodeList
  8423. * @param {String} type
  8424. * @param {Function} callback
  8425. * @return {Object}
  8426. */
  8427. function listenNodeList(nodeList, type, callback) {
  8428. Array.prototype.forEach.call(nodeList, function(node) {
  8429. node.addEventListener(type, callback);
  8430. });
  8431. return {
  8432. destroy: function() {
  8433. Array.prototype.forEach.call(nodeList, function(node) {
  8434. node.removeEventListener(type, callback);
  8435. });
  8436. }
  8437. }
  8438. }
  8439. /**
  8440. * Add an event listener to a selector
  8441. * and returns a remove listener function.
  8442. *
  8443. * @param {String} selector
  8444. * @param {String} type
  8445. * @param {Function} callback
  8446. * @return {Object}
  8447. */
  8448. function listenSelector(selector, type, callback) {
  8449. return delegate(document.body, selector, type, callback);
  8450. }
  8451. module.exports = listen;
  8452. /***/ }),
  8453. /* 5 */
  8454. /***/ (function(module, exports) {
  8455. /**
  8456. * Check if argument is a HTML element.
  8457. *
  8458. * @param {Object} value
  8459. * @return {Boolean}
  8460. */
  8461. exports.node = function(value) {
  8462. return value !== undefined
  8463. && value instanceof HTMLElement
  8464. && value.nodeType === 1;
  8465. };
  8466. /**
  8467. * Check if argument is a list of HTML elements.
  8468. *
  8469. * @param {Object} value
  8470. * @return {Boolean}
  8471. */
  8472. exports.nodeList = function(value) {
  8473. var type = Object.prototype.toString.call(value);
  8474. return value !== undefined
  8475. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8476. && ('length' in value)
  8477. && (value.length === 0 || exports.node(value[0]));
  8478. };
  8479. /**
  8480. * Check if argument is a string.
  8481. *
  8482. * @param {Object} value
  8483. * @return {Boolean}
  8484. */
  8485. exports.string = function(value) {
  8486. return typeof value === 'string'
  8487. || value instanceof String;
  8488. };
  8489. /**
  8490. * Check if argument is a function.
  8491. *
  8492. * @param {Object} value
  8493. * @return {Boolean}
  8494. */
  8495. exports.fn = function(value) {
  8496. var type = Object.prototype.toString.call(value);
  8497. return type === '[object Function]';
  8498. };
  8499. /***/ }),
  8500. /* 6 */
  8501. /***/ (function(module, exports, __webpack_require__) {
  8502. var closest = __webpack_require__(7);
  8503. /**
  8504. * Delegates event to a selector.
  8505. *
  8506. * @param {Element} element
  8507. * @param {String} selector
  8508. * @param {String} type
  8509. * @param {Function} callback
  8510. * @param {Boolean} useCapture
  8511. * @return {Object}
  8512. */
  8513. function _delegate(element, selector, type, callback, useCapture) {
  8514. var listenerFn = listener.apply(this, arguments);
  8515. element.addEventListener(type, listenerFn, useCapture);
  8516. return {
  8517. destroy: function() {
  8518. element.removeEventListener(type, listenerFn, useCapture);
  8519. }
  8520. }
  8521. }
  8522. /**
  8523. * Delegates event to a selector.
  8524. *
  8525. * @param {Element|String|Array} [elements]
  8526. * @param {String} selector
  8527. * @param {String} type
  8528. * @param {Function} callback
  8529. * @param {Boolean} useCapture
  8530. * @return {Object}
  8531. */
  8532. function delegate(elements, selector, type, callback, useCapture) {
  8533. // Handle the regular Element usage
  8534. if (typeof elements.addEventListener === 'function') {
  8535. return _delegate.apply(null, arguments);
  8536. }
  8537. // Handle Element-less usage, it defaults to global delegation
  8538. if (typeof type === 'function') {
  8539. // Use `document` as the first parameter, then apply arguments
  8540. // This is a short way to .unshift `arguments` without running into deoptimizations
  8541. return _delegate.bind(null, document).apply(null, arguments);
  8542. }
  8543. // Handle Selector-based usage
  8544. if (typeof elements === 'string') {
  8545. elements = document.querySelectorAll(elements);
  8546. }
  8547. // Handle Array-like based usage
  8548. return Array.prototype.map.call(elements, function (element) {
  8549. return _delegate(element, selector, type, callback, useCapture);
  8550. });
  8551. }
  8552. /**
  8553. * Finds closest match and invokes callback.
  8554. *
  8555. * @param {Element} element
  8556. * @param {String} selector
  8557. * @param {String} type
  8558. * @param {Function} callback
  8559. * @return {Function}
  8560. */
  8561. function listener(element, selector, type, callback) {
  8562. return function(e) {
  8563. e.delegateTarget = closest(e.target, selector);
  8564. if (e.delegateTarget) {
  8565. callback.call(element, e);
  8566. }
  8567. }
  8568. }
  8569. module.exports = delegate;
  8570. /***/ }),
  8571. /* 7 */
  8572. /***/ (function(module, exports) {
  8573. var DOCUMENT_NODE_TYPE = 9;
  8574. /**
  8575. * A polyfill for Element.matches()
  8576. */
  8577. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8578. var proto = Element.prototype;
  8579. proto.matches = proto.matchesSelector ||
  8580. proto.mozMatchesSelector ||
  8581. proto.msMatchesSelector ||
  8582. proto.oMatchesSelector ||
  8583. proto.webkitMatchesSelector;
  8584. }
  8585. /**
  8586. * Finds the closest parent that matches a selector.
  8587. *
  8588. * @param {Element} element
  8589. * @param {String} selector
  8590. * @return {Function}
  8591. */
  8592. function closest (element, selector) {
  8593. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8594. if (typeof element.matches === 'function' &&
  8595. element.matches(selector)) {
  8596. return element;
  8597. }
  8598. element = element.parentNode;
  8599. }
  8600. }
  8601. module.exports = closest;
  8602. /***/ })
  8603. /******/ ]);
  8604. });
  8605. /***/ }),
  8606. /***/ "./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&":
  8607. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  8608. !*** ./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& ***!
  8609. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  8610. /*! no static exports found */
  8611. /***/ (function(module, exports, __webpack_require__) {
  8612. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8613. // imports
  8614. // module
  8615. 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: 0px auto;\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 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", ""]);
  8616. // exports
  8617. /***/ }),
  8618. /***/ "./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&":
  8619. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8620. !*** ./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& ***!
  8621. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8622. /*! no static exports found */
  8623. /***/ (function(module, exports, __webpack_require__) {
  8624. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8625. // imports
  8626. // module
  8627. 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", ""]);
  8628. // exports
  8629. /***/ }),
  8630. /***/ "./node_modules/css-loader/lib/css-base.js":
  8631. /*!*************************************************!*\
  8632. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8633. \*************************************************/
  8634. /*! no static exports found */
  8635. /***/ (function(module, exports) {
  8636. /*
  8637. MIT License http://www.opensource.org/licenses/mit-license.php
  8638. Author Tobias Koppers @sokra
  8639. */
  8640. // css base code, injected by the css-loader
  8641. module.exports = function(useSourceMap) {
  8642. var list = [];
  8643. // return the list of modules as css string
  8644. list.toString = function toString() {
  8645. return this.map(function (item) {
  8646. var content = cssWithMappingToString(item, useSourceMap);
  8647. if(item[2]) {
  8648. return "@media " + item[2] + "{" + content + "}";
  8649. } else {
  8650. return content;
  8651. }
  8652. }).join("");
  8653. };
  8654. // import a list of modules into the list
  8655. list.i = function(modules, mediaQuery) {
  8656. if(typeof modules === "string")
  8657. modules = [[null, modules, ""]];
  8658. var alreadyImportedModules = {};
  8659. for(var i = 0; i < this.length; i++) {
  8660. var id = this[i][0];
  8661. if(typeof id === "number")
  8662. alreadyImportedModules[id] = true;
  8663. }
  8664. for(i = 0; i < modules.length; i++) {
  8665. var item = modules[i];
  8666. // skip already imported module
  8667. // this implementation is not 100% perfect for weird media query combinations
  8668. // when a module is imported multiple times with different media queries.
  8669. // I hope this will never occur (Hey this way we have smaller bundles)
  8670. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8671. if(mediaQuery && !item[2]) {
  8672. item[2] = mediaQuery;
  8673. } else if(mediaQuery) {
  8674. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  8675. }
  8676. list.push(item);
  8677. }
  8678. }
  8679. };
  8680. return list;
  8681. };
  8682. function cssWithMappingToString(item, useSourceMap) {
  8683. var content = item[1] || '';
  8684. var cssMapping = item[3];
  8685. if (!cssMapping) {
  8686. return content;
  8687. }
  8688. if (useSourceMap && typeof btoa === 'function') {
  8689. var sourceMapping = toComment(cssMapping);
  8690. var sourceURLs = cssMapping.sources.map(function (source) {
  8691. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  8692. });
  8693. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  8694. }
  8695. return [content].join('\n');
  8696. }
  8697. // Adapted from convert-source-map (MIT)
  8698. function toComment(sourceMap) {
  8699. // eslint-disable-next-line no-undef
  8700. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  8701. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  8702. return '/*# ' + data + ' */';
  8703. }
  8704. /***/ }),
  8705. /***/ "./node_modules/ieee754/index.js":
  8706. /*!***************************************!*\
  8707. !*** ./node_modules/ieee754/index.js ***!
  8708. \***************************************/
  8709. /*! no static exports found */
  8710. /***/ (function(module, exports) {
  8711. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8712. var e, m
  8713. var eLen = (nBytes * 8) - mLen - 1
  8714. var eMax = (1 << eLen) - 1
  8715. var eBias = eMax >> 1
  8716. var nBits = -7
  8717. var i = isLE ? (nBytes - 1) : 0
  8718. var d = isLE ? -1 : 1
  8719. var s = buffer[offset + i]
  8720. i += d
  8721. e = s & ((1 << (-nBits)) - 1)
  8722. s >>= (-nBits)
  8723. nBits += eLen
  8724. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8725. m = e & ((1 << (-nBits)) - 1)
  8726. e >>= (-nBits)
  8727. nBits += mLen
  8728. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8729. if (e === 0) {
  8730. e = 1 - eBias
  8731. } else if (e === eMax) {
  8732. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8733. } else {
  8734. m = m + Math.pow(2, mLen)
  8735. e = e - eBias
  8736. }
  8737. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8738. }
  8739. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8740. var e, m, c
  8741. var eLen = (nBytes * 8) - mLen - 1
  8742. var eMax = (1 << eLen) - 1
  8743. var eBias = eMax >> 1
  8744. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8745. var i = isLE ? 0 : (nBytes - 1)
  8746. var d = isLE ? 1 : -1
  8747. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8748. value = Math.abs(value)
  8749. if (isNaN(value) || value === Infinity) {
  8750. m = isNaN(value) ? 1 : 0
  8751. e = eMax
  8752. } else {
  8753. e = Math.floor(Math.log(value) / Math.LN2)
  8754. if (value * (c = Math.pow(2, -e)) < 1) {
  8755. e--
  8756. c *= 2
  8757. }
  8758. if (e + eBias >= 1) {
  8759. value += rt / c
  8760. } else {
  8761. value += rt * Math.pow(2, 1 - eBias)
  8762. }
  8763. if (value * c >= 2) {
  8764. e++
  8765. c /= 2
  8766. }
  8767. if (e + eBias >= eMax) {
  8768. m = 0
  8769. e = eMax
  8770. } else if (e + eBias >= 1) {
  8771. m = ((value * c) - 1) * Math.pow(2, mLen)
  8772. e = e + eBias
  8773. } else {
  8774. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8775. e = 0
  8776. }
  8777. }
  8778. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8779. e = (e << mLen) | m
  8780. eLen += mLen
  8781. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8782. buffer[offset + i - d] |= s * 128
  8783. }
  8784. /***/ }),
  8785. /***/ "./node_modules/isarray/index.js":
  8786. /*!***************************************!*\
  8787. !*** ./node_modules/isarray/index.js ***!
  8788. \***************************************/
  8789. /*! no static exports found */
  8790. /***/ (function(module, exports) {
  8791. var toString = {}.toString;
  8792. module.exports = Array.isArray || function (arr) {
  8793. return toString.call(arr) == '[object Array]';
  8794. };
  8795. /***/ }),
  8796. /***/ "./node_modules/jquery/dist/jquery.js":
  8797. /*!********************************************!*\
  8798. !*** ./node_modules/jquery/dist/jquery.js ***!
  8799. \********************************************/
  8800. /*! no static exports found */
  8801. /***/ (function(module, exports, __webpack_require__) {
  8802. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8803. * jQuery JavaScript Library v3.4.1
  8804. * https://jquery.com/
  8805. *
  8806. * Includes Sizzle.js
  8807. * https://sizzlejs.com/
  8808. *
  8809. * Copyright JS Foundation and other contributors
  8810. * Released under the MIT license
  8811. * https://jquery.org/license
  8812. *
  8813. * Date: 2019-05-01T21:04Z
  8814. */
  8815. ( function( global, factory ) {
  8816. "use strict";
  8817. if ( true && typeof module.exports === "object" ) {
  8818. // For CommonJS and CommonJS-like environments where a proper `window`
  8819. // is present, execute the factory and get jQuery.
  8820. // For environments that do not have a `window` with a `document`
  8821. // (such as Node.js), expose a factory as module.exports.
  8822. // This accentuates the need for the creation of a real `window`.
  8823. // e.g. var jQuery = require("jquery")(window);
  8824. // See ticket #14549 for more info.
  8825. module.exports = global.document ?
  8826. factory( global, true ) :
  8827. function( w ) {
  8828. if ( !w.document ) {
  8829. throw new Error( "jQuery requires a window with a document" );
  8830. }
  8831. return factory( w );
  8832. };
  8833. } else {
  8834. factory( global );
  8835. }
  8836. // Pass this if window is not defined yet
  8837. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8838. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8839. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8840. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8841. // enough that all such attempts are guarded in a try block.
  8842. "use strict";
  8843. var arr = [];
  8844. var document = window.document;
  8845. var getProto = Object.getPrototypeOf;
  8846. var slice = arr.slice;
  8847. var concat = arr.concat;
  8848. var push = arr.push;
  8849. var indexOf = arr.indexOf;
  8850. var class2type = {};
  8851. var toString = class2type.toString;
  8852. var hasOwn = class2type.hasOwnProperty;
  8853. var fnToString = hasOwn.toString;
  8854. var ObjectFunctionString = fnToString.call( Object );
  8855. var support = {};
  8856. var isFunction = function isFunction( obj ) {
  8857. // Support: Chrome <=57, Firefox <=52
  8858. // In some browsers, typeof returns "function" for HTML <object> elements
  8859. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8860. // We don't want to classify *any* DOM node as a function.
  8861. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8862. };
  8863. var isWindow = function isWindow( obj ) {
  8864. return obj != null && obj === obj.window;
  8865. };
  8866. var preservedScriptAttributes = {
  8867. type: true,
  8868. src: true,
  8869. nonce: true,
  8870. noModule: true
  8871. };
  8872. function DOMEval( code, node, doc ) {
  8873. doc = doc || document;
  8874. var i, val,
  8875. script = doc.createElement( "script" );
  8876. script.text = code;
  8877. if ( node ) {
  8878. for ( i in preservedScriptAttributes ) {
  8879. // Support: Firefox 64+, Edge 18+
  8880. // Some browsers don't support the "nonce" property on scripts.
  8881. // On the other hand, just using `getAttribute` is not enough as
  8882. // the `nonce` attribute is reset to an empty string whenever it
  8883. // becomes browsing-context connected.
  8884. // See https://github.com/whatwg/html/issues/2369
  8885. // See https://html.spec.whatwg.org/#nonce-attributes
  8886. // The `node.getAttribute` check was added for the sake of
  8887. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8888. // via an object.
  8889. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8890. if ( val ) {
  8891. script.setAttribute( i, val );
  8892. }
  8893. }
  8894. }
  8895. doc.head.appendChild( script ).parentNode.removeChild( script );
  8896. }
  8897. function toType( obj ) {
  8898. if ( obj == null ) {
  8899. return obj + "";
  8900. }
  8901. // Support: Android <=2.3 only (functionish RegExp)
  8902. return typeof obj === "object" || typeof obj === "function" ?
  8903. class2type[ toString.call( obj ) ] || "object" :
  8904. typeof obj;
  8905. }
  8906. /* global Symbol */
  8907. // Defining this global in .eslintrc.json would create a danger of using the global
  8908. // unguarded in another place, it seems safer to define global only for this module
  8909. var
  8910. version = "3.4.1",
  8911. // Define a local copy of jQuery
  8912. jQuery = function( selector, context ) {
  8913. // The jQuery object is actually just the init constructor 'enhanced'
  8914. // Need init if jQuery is called (just allow error to be thrown if not included)
  8915. return new jQuery.fn.init( selector, context );
  8916. },
  8917. // Support: Android <=4.0 only
  8918. // Make sure we trim BOM and NBSP
  8919. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8920. jQuery.fn = jQuery.prototype = {
  8921. // The current version of jQuery being used
  8922. jquery: version,
  8923. constructor: jQuery,
  8924. // The default length of a jQuery object is 0
  8925. length: 0,
  8926. toArray: function() {
  8927. return slice.call( this );
  8928. },
  8929. // Get the Nth element in the matched element set OR
  8930. // Get the whole matched element set as a clean array
  8931. get: function( num ) {
  8932. // Return all the elements in a clean array
  8933. if ( num == null ) {
  8934. return slice.call( this );
  8935. }
  8936. // Return just the one element from the set
  8937. return num < 0 ? this[ num + this.length ] : this[ num ];
  8938. },
  8939. // Take an array of elements and push it onto the stack
  8940. // (returning the new matched element set)
  8941. pushStack: function( elems ) {
  8942. // Build a new jQuery matched element set
  8943. var ret = jQuery.merge( this.constructor(), elems );
  8944. // Add the old object onto the stack (as a reference)
  8945. ret.prevObject = this;
  8946. // Return the newly-formed element set
  8947. return ret;
  8948. },
  8949. // Execute a callback for every element in the matched set.
  8950. each: function( callback ) {
  8951. return jQuery.each( this, callback );
  8952. },
  8953. map: function( callback ) {
  8954. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8955. return callback.call( elem, i, elem );
  8956. } ) );
  8957. },
  8958. slice: function() {
  8959. return this.pushStack( slice.apply( this, arguments ) );
  8960. },
  8961. first: function() {
  8962. return this.eq( 0 );
  8963. },
  8964. last: function() {
  8965. return this.eq( -1 );
  8966. },
  8967. eq: function( i ) {
  8968. var len = this.length,
  8969. j = +i + ( i < 0 ? len : 0 );
  8970. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8971. },
  8972. end: function() {
  8973. return this.prevObject || this.constructor();
  8974. },
  8975. // For internal use only.
  8976. // Behaves like an Array's method, not like a jQuery method.
  8977. push: push,
  8978. sort: arr.sort,
  8979. splice: arr.splice
  8980. };
  8981. jQuery.extend = jQuery.fn.extend = function() {
  8982. var options, name, src, copy, copyIsArray, clone,
  8983. target = arguments[ 0 ] || {},
  8984. i = 1,
  8985. length = arguments.length,
  8986. deep = false;
  8987. // Handle a deep copy situation
  8988. if ( typeof target === "boolean" ) {
  8989. deep = target;
  8990. // Skip the boolean and the target
  8991. target = arguments[ i ] || {};
  8992. i++;
  8993. }
  8994. // Handle case when target is a string or something (possible in deep copy)
  8995. if ( typeof target !== "object" && !isFunction( target ) ) {
  8996. target = {};
  8997. }
  8998. // Extend jQuery itself if only one argument is passed
  8999. if ( i === length ) {
  9000. target = this;
  9001. i--;
  9002. }
  9003. for ( ; i < length; i++ ) {
  9004. // Only deal with non-null/undefined values
  9005. if ( ( options = arguments[ i ] ) != null ) {
  9006. // Extend the base object
  9007. for ( name in options ) {
  9008. copy = options[ name ];
  9009. // Prevent Object.prototype pollution
  9010. // Prevent never-ending loop
  9011. if ( name === "__proto__" || target === copy ) {
  9012. continue;
  9013. }
  9014. // Recurse if we're merging plain objects or arrays
  9015. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9016. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9017. src = target[ name ];
  9018. // Ensure proper type for the source value
  9019. if ( copyIsArray && !Array.isArray( src ) ) {
  9020. clone = [];
  9021. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9022. clone = {};
  9023. } else {
  9024. clone = src;
  9025. }
  9026. copyIsArray = false;
  9027. // Never move original objects, clone them
  9028. target[ name ] = jQuery.extend( deep, clone, copy );
  9029. // Don't bring in undefined values
  9030. } else if ( copy !== undefined ) {
  9031. target[ name ] = copy;
  9032. }
  9033. }
  9034. }
  9035. }
  9036. // Return the modified object
  9037. return target;
  9038. };
  9039. jQuery.extend( {
  9040. // Unique for each copy of jQuery on the page
  9041. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9042. // Assume jQuery is ready without the ready module
  9043. isReady: true,
  9044. error: function( msg ) {
  9045. throw new Error( msg );
  9046. },
  9047. noop: function() {},
  9048. isPlainObject: function( obj ) {
  9049. var proto, Ctor;
  9050. // Detect obvious negatives
  9051. // Use toString instead of jQuery.type to catch host objects
  9052. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9053. return false;
  9054. }
  9055. proto = getProto( obj );
  9056. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9057. if ( !proto ) {
  9058. return true;
  9059. }
  9060. // Objects with prototype are plain iff they were constructed by a global Object function
  9061. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9062. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9063. },
  9064. isEmptyObject: function( obj ) {
  9065. var name;
  9066. for ( name in obj ) {
  9067. return false;
  9068. }
  9069. return true;
  9070. },
  9071. // Evaluates a script in a global context
  9072. globalEval: function( code, options ) {
  9073. DOMEval( code, { nonce: options && options.nonce } );
  9074. },
  9075. each: function( obj, callback ) {
  9076. var length, i = 0;
  9077. if ( isArrayLike( obj ) ) {
  9078. length = obj.length;
  9079. for ( ; i < length; i++ ) {
  9080. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9081. break;
  9082. }
  9083. }
  9084. } else {
  9085. for ( i in obj ) {
  9086. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9087. break;
  9088. }
  9089. }
  9090. }
  9091. return obj;
  9092. },
  9093. // Support: Android <=4.0 only
  9094. trim: function( text ) {
  9095. return text == null ?
  9096. "" :
  9097. ( text + "" ).replace( rtrim, "" );
  9098. },
  9099. // results is for internal usage only
  9100. makeArray: function( arr, results ) {
  9101. var ret = results || [];
  9102. if ( arr != null ) {
  9103. if ( isArrayLike( Object( arr ) ) ) {
  9104. jQuery.merge( ret,
  9105. typeof arr === "string" ?
  9106. [ arr ] : arr
  9107. );
  9108. } else {
  9109. push.call( ret, arr );
  9110. }
  9111. }
  9112. return ret;
  9113. },
  9114. inArray: function( elem, arr, i ) {
  9115. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9116. },
  9117. // Support: Android <=4.0 only, PhantomJS 1 only
  9118. // push.apply(_, arraylike) throws on ancient WebKit
  9119. merge: function( first, second ) {
  9120. var len = +second.length,
  9121. j = 0,
  9122. i = first.length;
  9123. for ( ; j < len; j++ ) {
  9124. first[ i++ ] = second[ j ];
  9125. }
  9126. first.length = i;
  9127. return first;
  9128. },
  9129. grep: function( elems, callback, invert ) {
  9130. var callbackInverse,
  9131. matches = [],
  9132. i = 0,
  9133. length = elems.length,
  9134. callbackExpect = !invert;
  9135. // Go through the array, only saving the items
  9136. // that pass the validator function
  9137. for ( ; i < length; i++ ) {
  9138. callbackInverse = !callback( elems[ i ], i );
  9139. if ( callbackInverse !== callbackExpect ) {
  9140. matches.push( elems[ i ] );
  9141. }
  9142. }
  9143. return matches;
  9144. },
  9145. // arg is for internal usage only
  9146. map: function( elems, callback, arg ) {
  9147. var length, value,
  9148. i = 0,
  9149. ret = [];
  9150. // Go through the array, translating each of the items to their new values
  9151. if ( isArrayLike( elems ) ) {
  9152. length = elems.length;
  9153. for ( ; i < length; i++ ) {
  9154. value = callback( elems[ i ], i, arg );
  9155. if ( value != null ) {
  9156. ret.push( value );
  9157. }
  9158. }
  9159. // Go through every key on the object,
  9160. } else {
  9161. for ( i in elems ) {
  9162. value = callback( elems[ i ], i, arg );
  9163. if ( value != null ) {
  9164. ret.push( value );
  9165. }
  9166. }
  9167. }
  9168. // Flatten any nested arrays
  9169. return concat.apply( [], ret );
  9170. },
  9171. // A global GUID counter for objects
  9172. guid: 1,
  9173. // jQuery.support is not used in Core but other projects attach their
  9174. // properties to it so it needs to exist.
  9175. support: support
  9176. } );
  9177. if ( typeof Symbol === "function" ) {
  9178. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9179. }
  9180. // Populate the class2type map
  9181. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9182. function( i, name ) {
  9183. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9184. } );
  9185. function isArrayLike( obj ) {
  9186. // Support: real iOS 8.2 only (not reproducible in simulator)
  9187. // `in` check used to prevent JIT error (gh-2145)
  9188. // hasOwn isn't used here due to false negatives
  9189. // regarding Nodelist length in IE
  9190. var length = !!obj && "length" in obj && obj.length,
  9191. type = toType( obj );
  9192. if ( isFunction( obj ) || isWindow( obj ) ) {
  9193. return false;
  9194. }
  9195. return type === "array" || length === 0 ||
  9196. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9197. }
  9198. var Sizzle =
  9199. /*!
  9200. * Sizzle CSS Selector Engine v2.3.4
  9201. * https://sizzlejs.com/
  9202. *
  9203. * Copyright JS Foundation and other contributors
  9204. * Released under the MIT license
  9205. * https://js.foundation/
  9206. *
  9207. * Date: 2019-04-08
  9208. */
  9209. (function( window ) {
  9210. var i,
  9211. support,
  9212. Expr,
  9213. getText,
  9214. isXML,
  9215. tokenize,
  9216. compile,
  9217. select,
  9218. outermostContext,
  9219. sortInput,
  9220. hasDuplicate,
  9221. // Local document vars
  9222. setDocument,
  9223. document,
  9224. docElem,
  9225. documentIsHTML,
  9226. rbuggyQSA,
  9227. rbuggyMatches,
  9228. matches,
  9229. contains,
  9230. // Instance-specific data
  9231. expando = "sizzle" + 1 * new Date(),
  9232. preferredDoc = window.document,
  9233. dirruns = 0,
  9234. done = 0,
  9235. classCache = createCache(),
  9236. tokenCache = createCache(),
  9237. compilerCache = createCache(),
  9238. nonnativeSelectorCache = createCache(),
  9239. sortOrder = function( a, b ) {
  9240. if ( a === b ) {
  9241. hasDuplicate = true;
  9242. }
  9243. return 0;
  9244. },
  9245. // Instance methods
  9246. hasOwn = ({}).hasOwnProperty,
  9247. arr = [],
  9248. pop = arr.pop,
  9249. push_native = arr.push,
  9250. push = arr.push,
  9251. slice = arr.slice,
  9252. // Use a stripped-down indexOf as it's faster than native
  9253. // https://jsperf.com/thor-indexof-vs-for/5
  9254. indexOf = function( list, elem ) {
  9255. var i = 0,
  9256. len = list.length;
  9257. for ( ; i < len; i++ ) {
  9258. if ( list[i] === elem ) {
  9259. return i;
  9260. }
  9261. }
  9262. return -1;
  9263. },
  9264. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9265. // Regular expressions
  9266. // http://www.w3.org/TR/css3-selectors/#whitespace
  9267. whitespace = "[\\x20\\t\\r\\n\\f]",
  9268. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9269. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9270. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9271. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9272. // Operator (capture 2)
  9273. "*([*^$|!~]?=)" + whitespace +
  9274. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9275. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9276. "*\\]",
  9277. pseudos = ":(" + identifier + ")(?:\\((" +
  9278. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9279. // 1. quoted (capture 3; capture 4 or capture 5)
  9280. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9281. // 2. simple (capture 6)
  9282. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9283. // 3. anything else (capture 2)
  9284. ".*" +
  9285. ")\\)|)",
  9286. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9287. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9288. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9289. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9290. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9291. rdescend = new RegExp( whitespace + "|>" ),
  9292. rpseudo = new RegExp( pseudos ),
  9293. ridentifier = new RegExp( "^" + identifier + "$" ),
  9294. matchExpr = {
  9295. "ID": new RegExp( "^#(" + identifier + ")" ),
  9296. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9297. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9298. "ATTR": new RegExp( "^" + attributes ),
  9299. "PSEUDO": new RegExp( "^" + pseudos ),
  9300. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9301. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9302. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9303. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9304. // For use in libraries implementing .is()
  9305. // We use this for POS matching in `select`
  9306. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9307. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9308. },
  9309. rhtml = /HTML$/i,
  9310. rinputs = /^(?:input|select|textarea|button)$/i,
  9311. rheader = /^h\d$/i,
  9312. rnative = /^[^{]+\{\s*\[native \w/,
  9313. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9314. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9315. rsibling = /[+~]/,
  9316. // CSS escapes
  9317. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9318. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9319. funescape = function( _, escaped, escapedWhitespace ) {
  9320. var high = "0x" + escaped - 0x10000;
  9321. // NaN means non-codepoint
  9322. // Support: Firefox<24
  9323. // Workaround erroneous numeric interpretation of +"0x"
  9324. return high !== high || escapedWhitespace ?
  9325. escaped :
  9326. high < 0 ?
  9327. // BMP codepoint
  9328. String.fromCharCode( high + 0x10000 ) :
  9329. // Supplemental Plane codepoint (surrogate pair)
  9330. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9331. },
  9332. // CSS string/identifier serialization
  9333. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9334. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9335. fcssescape = function( ch, asCodePoint ) {
  9336. if ( asCodePoint ) {
  9337. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9338. if ( ch === "\0" ) {
  9339. return "\uFFFD";
  9340. }
  9341. // Control characters and (dependent upon position) numbers get escaped as code points
  9342. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9343. }
  9344. // Other potentially-special ASCII characters get backslash-escaped
  9345. return "\\" + ch;
  9346. },
  9347. // Used for iframes
  9348. // See setDocument()
  9349. // Removing the function wrapper causes a "Permission Denied"
  9350. // error in IE
  9351. unloadHandler = function() {
  9352. setDocument();
  9353. },
  9354. inDisabledFieldset = addCombinator(
  9355. function( elem ) {
  9356. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9357. },
  9358. { dir: "parentNode", next: "legend" }
  9359. );
  9360. // Optimize for push.apply( _, NodeList )
  9361. try {
  9362. push.apply(
  9363. (arr = slice.call( preferredDoc.childNodes )),
  9364. preferredDoc.childNodes
  9365. );
  9366. // Support: Android<4.0
  9367. // Detect silently failing push.apply
  9368. arr[ preferredDoc.childNodes.length ].nodeType;
  9369. } catch ( e ) {
  9370. push = { apply: arr.length ?
  9371. // Leverage slice if possible
  9372. function( target, els ) {
  9373. push_native.apply( target, slice.call(els) );
  9374. } :
  9375. // Support: IE<9
  9376. // Otherwise append directly
  9377. function( target, els ) {
  9378. var j = target.length,
  9379. i = 0;
  9380. // Can't trust NodeList.length
  9381. while ( (target[j++] = els[i++]) ) {}
  9382. target.length = j - 1;
  9383. }
  9384. };
  9385. }
  9386. function Sizzle( selector, context, results, seed ) {
  9387. var m, i, elem, nid, match, groups, newSelector,
  9388. newContext = context && context.ownerDocument,
  9389. // nodeType defaults to 9, since context defaults to document
  9390. nodeType = context ? context.nodeType : 9;
  9391. results = results || [];
  9392. // Return early from calls with invalid selector or context
  9393. if ( typeof selector !== "string" || !selector ||
  9394. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9395. return results;
  9396. }
  9397. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9398. if ( !seed ) {
  9399. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9400. setDocument( context );
  9401. }
  9402. context = context || document;
  9403. if ( documentIsHTML ) {
  9404. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9405. // (excepting DocumentFragment context, where the methods don't exist)
  9406. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9407. // ID selector
  9408. if ( (m = match[1]) ) {
  9409. // Document context
  9410. if ( nodeType === 9 ) {
  9411. if ( (elem = context.getElementById( m )) ) {
  9412. // Support: IE, Opera, Webkit
  9413. // TODO: identify versions
  9414. // getElementById can match elements by name instead of ID
  9415. if ( elem.id === m ) {
  9416. results.push( elem );
  9417. return results;
  9418. }
  9419. } else {
  9420. return results;
  9421. }
  9422. // Element context
  9423. } else {
  9424. // Support: IE, Opera, Webkit
  9425. // TODO: identify versions
  9426. // getElementById can match elements by name instead of ID
  9427. if ( newContext && (elem = newContext.getElementById( m )) &&
  9428. contains( context, elem ) &&
  9429. elem.id === m ) {
  9430. results.push( elem );
  9431. return results;
  9432. }
  9433. }
  9434. // Type selector
  9435. } else if ( match[2] ) {
  9436. push.apply( results, context.getElementsByTagName( selector ) );
  9437. return results;
  9438. // Class selector
  9439. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9440. context.getElementsByClassName ) {
  9441. push.apply( results, context.getElementsByClassName( m ) );
  9442. return results;
  9443. }
  9444. }
  9445. // Take advantage of querySelectorAll
  9446. if ( support.qsa &&
  9447. !nonnativeSelectorCache[ selector + " " ] &&
  9448. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9449. // Support: IE 8 only
  9450. // Exclude object elements
  9451. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9452. newSelector = selector;
  9453. newContext = context;
  9454. // qSA considers elements outside a scoping root when evaluating child or
  9455. // descendant combinators, which is not what we want.
  9456. // In such cases, we work around the behavior by prefixing every selector in the
  9457. // list with an ID selector referencing the scope context.
  9458. // Thanks to Andrew Dupont for this technique.
  9459. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9460. // Capture the context ID, setting it first if necessary
  9461. if ( (nid = context.getAttribute( "id" )) ) {
  9462. nid = nid.replace( rcssescape, fcssescape );
  9463. } else {
  9464. context.setAttribute( "id", (nid = expando) );
  9465. }
  9466. // Prefix every selector in the list
  9467. groups = tokenize( selector );
  9468. i = groups.length;
  9469. while ( i-- ) {
  9470. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9471. }
  9472. newSelector = groups.join( "," );
  9473. // Expand context for sibling selectors
  9474. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9475. context;
  9476. }
  9477. try {
  9478. push.apply( results,
  9479. newContext.querySelectorAll( newSelector )
  9480. );
  9481. return results;
  9482. } catch ( qsaError ) {
  9483. nonnativeSelectorCache( selector, true );
  9484. } finally {
  9485. if ( nid === expando ) {
  9486. context.removeAttribute( "id" );
  9487. }
  9488. }
  9489. }
  9490. }
  9491. }
  9492. // All others
  9493. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9494. }
  9495. /**
  9496. * Create key-value caches of limited size
  9497. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9498. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9499. * deleting the oldest entry
  9500. */
  9501. function createCache() {
  9502. var keys = [];
  9503. function cache( key, value ) {
  9504. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9505. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9506. // Only keep the most recent entries
  9507. delete cache[ keys.shift() ];
  9508. }
  9509. return (cache[ key + " " ] = value);
  9510. }
  9511. return cache;
  9512. }
  9513. /**
  9514. * Mark a function for special use by Sizzle
  9515. * @param {Function} fn The function to mark
  9516. */
  9517. function markFunction( fn ) {
  9518. fn[ expando ] = true;
  9519. return fn;
  9520. }
  9521. /**
  9522. * Support testing using an element
  9523. * @param {Function} fn Passed the created element and returns a boolean result
  9524. */
  9525. function assert( fn ) {
  9526. var el = document.createElement("fieldset");
  9527. try {
  9528. return !!fn( el );
  9529. } catch (e) {
  9530. return false;
  9531. } finally {
  9532. // Remove from its parent by default
  9533. if ( el.parentNode ) {
  9534. el.parentNode.removeChild( el );
  9535. }
  9536. // release memory in IE
  9537. el = null;
  9538. }
  9539. }
  9540. /**
  9541. * Adds the same handler for all of the specified attrs
  9542. * @param {String} attrs Pipe-separated list of attributes
  9543. * @param {Function} handler The method that will be applied
  9544. */
  9545. function addHandle( attrs, handler ) {
  9546. var arr = attrs.split("|"),
  9547. i = arr.length;
  9548. while ( i-- ) {
  9549. Expr.attrHandle[ arr[i] ] = handler;
  9550. }
  9551. }
  9552. /**
  9553. * Checks document order of two siblings
  9554. * @param {Element} a
  9555. * @param {Element} b
  9556. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9557. */
  9558. function siblingCheck( a, b ) {
  9559. var cur = b && a,
  9560. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9561. a.sourceIndex - b.sourceIndex;
  9562. // Use IE sourceIndex if available on both nodes
  9563. if ( diff ) {
  9564. return diff;
  9565. }
  9566. // Check if b follows a
  9567. if ( cur ) {
  9568. while ( (cur = cur.nextSibling) ) {
  9569. if ( cur === b ) {
  9570. return -1;
  9571. }
  9572. }
  9573. }
  9574. return a ? 1 : -1;
  9575. }
  9576. /**
  9577. * Returns a function to use in pseudos for input types
  9578. * @param {String} type
  9579. */
  9580. function createInputPseudo( type ) {
  9581. return function( elem ) {
  9582. var name = elem.nodeName.toLowerCase();
  9583. return name === "input" && elem.type === type;
  9584. };
  9585. }
  9586. /**
  9587. * Returns a function to use in pseudos for buttons
  9588. * @param {String} type
  9589. */
  9590. function createButtonPseudo( type ) {
  9591. return function( elem ) {
  9592. var name = elem.nodeName.toLowerCase();
  9593. return (name === "input" || name === "button") && elem.type === type;
  9594. };
  9595. }
  9596. /**
  9597. * Returns a function to use in pseudos for :enabled/:disabled
  9598. * @param {Boolean} disabled true for :disabled; false for :enabled
  9599. */
  9600. function createDisabledPseudo( disabled ) {
  9601. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9602. return function( elem ) {
  9603. // Only certain elements can match :enabled or :disabled
  9604. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9605. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9606. if ( "form" in elem ) {
  9607. // Check for inherited disabledness on relevant non-disabled elements:
  9608. // * listed form-associated elements in a disabled fieldset
  9609. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9610. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9611. // * option elements in a disabled optgroup
  9612. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9613. // All such elements have a "form" property.
  9614. if ( elem.parentNode && elem.disabled === false ) {
  9615. // Option elements defer to a parent optgroup if present
  9616. if ( "label" in elem ) {
  9617. if ( "label" in elem.parentNode ) {
  9618. return elem.parentNode.disabled === disabled;
  9619. } else {
  9620. return elem.disabled === disabled;
  9621. }
  9622. }
  9623. // Support: IE 6 - 11
  9624. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9625. return elem.isDisabled === disabled ||
  9626. // Where there is no isDisabled, check manually
  9627. /* jshint -W018 */
  9628. elem.isDisabled !== !disabled &&
  9629. inDisabledFieldset( elem ) === disabled;
  9630. }
  9631. return elem.disabled === disabled;
  9632. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9633. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9634. // even exist on them, let alone have a boolean value.
  9635. } else if ( "label" in elem ) {
  9636. return elem.disabled === disabled;
  9637. }
  9638. // Remaining elements are neither :enabled nor :disabled
  9639. return false;
  9640. };
  9641. }
  9642. /**
  9643. * Returns a function to use in pseudos for positionals
  9644. * @param {Function} fn
  9645. */
  9646. function createPositionalPseudo( fn ) {
  9647. return markFunction(function( argument ) {
  9648. argument = +argument;
  9649. return markFunction(function( seed, matches ) {
  9650. var j,
  9651. matchIndexes = fn( [], seed.length, argument ),
  9652. i = matchIndexes.length;
  9653. // Match elements found at the specified indexes
  9654. while ( i-- ) {
  9655. if ( seed[ (j = matchIndexes[i]) ] ) {
  9656. seed[j] = !(matches[j] = seed[j]);
  9657. }
  9658. }
  9659. });
  9660. });
  9661. }
  9662. /**
  9663. * Checks a node for validity as a Sizzle context
  9664. * @param {Element|Object=} context
  9665. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9666. */
  9667. function testContext( context ) {
  9668. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9669. }
  9670. // Expose support vars for convenience
  9671. support = Sizzle.support = {};
  9672. /**
  9673. * Detects XML nodes
  9674. * @param {Element|Object} elem An element or a document
  9675. * @returns {Boolean} True iff elem is a non-HTML XML node
  9676. */
  9677. isXML = Sizzle.isXML = function( elem ) {
  9678. var namespace = elem.namespaceURI,
  9679. docElem = (elem.ownerDocument || elem).documentElement;
  9680. // Support: IE <=8
  9681. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9682. // https://bugs.jquery.com/ticket/4833
  9683. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9684. };
  9685. /**
  9686. * Sets document-related variables once based on the current document
  9687. * @param {Element|Object} [doc] An element or document object to use to set the document
  9688. * @returns {Object} Returns the current document
  9689. */
  9690. setDocument = Sizzle.setDocument = function( node ) {
  9691. var hasCompare, subWindow,
  9692. doc = node ? node.ownerDocument || node : preferredDoc;
  9693. // Return early if doc is invalid or already selected
  9694. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9695. return document;
  9696. }
  9697. // Update global variables
  9698. document = doc;
  9699. docElem = document.documentElement;
  9700. documentIsHTML = !isXML( document );
  9701. // Support: IE 9-11, Edge
  9702. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9703. if ( preferredDoc !== document &&
  9704. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9705. // Support: IE 11, Edge
  9706. if ( subWindow.addEventListener ) {
  9707. subWindow.addEventListener( "unload", unloadHandler, false );
  9708. // Support: IE 9 - 10 only
  9709. } else if ( subWindow.attachEvent ) {
  9710. subWindow.attachEvent( "onunload", unloadHandler );
  9711. }
  9712. }
  9713. /* Attributes
  9714. ---------------------------------------------------------------------- */
  9715. // Support: IE<8
  9716. // Verify that getAttribute really returns attributes and not properties
  9717. // (excepting IE8 booleans)
  9718. support.attributes = assert(function( el ) {
  9719. el.className = "i";
  9720. return !el.getAttribute("className");
  9721. });
  9722. /* getElement(s)By*
  9723. ---------------------------------------------------------------------- */
  9724. // Check if getElementsByTagName("*") returns only elements
  9725. support.getElementsByTagName = assert(function( el ) {
  9726. el.appendChild( document.createComment("") );
  9727. return !el.getElementsByTagName("*").length;
  9728. });
  9729. // Support: IE<9
  9730. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9731. // Support: IE<10
  9732. // Check if getElementById returns elements by name
  9733. // The broken getElementById methods don't pick up programmatically-set names,
  9734. // so use a roundabout getElementsByName test
  9735. support.getById = assert(function( el ) {
  9736. docElem.appendChild( el ).id = expando;
  9737. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9738. });
  9739. // ID filter and find
  9740. if ( support.getById ) {
  9741. Expr.filter["ID"] = function( id ) {
  9742. var attrId = id.replace( runescape, funescape );
  9743. return function( elem ) {
  9744. return elem.getAttribute("id") === attrId;
  9745. };
  9746. };
  9747. Expr.find["ID"] = function( id, context ) {
  9748. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9749. var elem = context.getElementById( id );
  9750. return elem ? [ elem ] : [];
  9751. }
  9752. };
  9753. } else {
  9754. Expr.filter["ID"] = function( id ) {
  9755. var attrId = id.replace( runescape, funescape );
  9756. return function( elem ) {
  9757. var node = typeof elem.getAttributeNode !== "undefined" &&
  9758. elem.getAttributeNode("id");
  9759. return node && node.value === attrId;
  9760. };
  9761. };
  9762. // Support: IE 6 - 7 only
  9763. // getElementById is not reliable as a find shortcut
  9764. Expr.find["ID"] = function( id, context ) {
  9765. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9766. var node, i, elems,
  9767. elem = context.getElementById( id );
  9768. if ( elem ) {
  9769. // Verify the id attribute
  9770. node = elem.getAttributeNode("id");
  9771. if ( node && node.value === id ) {
  9772. return [ elem ];
  9773. }
  9774. // Fall back on getElementsByName
  9775. elems = context.getElementsByName( id );
  9776. i = 0;
  9777. while ( (elem = elems[i++]) ) {
  9778. node = elem.getAttributeNode("id");
  9779. if ( node && node.value === id ) {
  9780. return [ elem ];
  9781. }
  9782. }
  9783. }
  9784. return [];
  9785. }
  9786. };
  9787. }
  9788. // Tag
  9789. Expr.find["TAG"] = support.getElementsByTagName ?
  9790. function( tag, context ) {
  9791. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9792. return context.getElementsByTagName( tag );
  9793. // DocumentFragment nodes don't have gEBTN
  9794. } else if ( support.qsa ) {
  9795. return context.querySelectorAll( tag );
  9796. }
  9797. } :
  9798. function( tag, context ) {
  9799. var elem,
  9800. tmp = [],
  9801. i = 0,
  9802. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9803. results = context.getElementsByTagName( tag );
  9804. // Filter out possible comments
  9805. if ( tag === "*" ) {
  9806. while ( (elem = results[i++]) ) {
  9807. if ( elem.nodeType === 1 ) {
  9808. tmp.push( elem );
  9809. }
  9810. }
  9811. return tmp;
  9812. }
  9813. return results;
  9814. };
  9815. // Class
  9816. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9817. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9818. return context.getElementsByClassName( className );
  9819. }
  9820. };
  9821. /* QSA/matchesSelector
  9822. ---------------------------------------------------------------------- */
  9823. // QSA and matchesSelector support
  9824. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9825. rbuggyMatches = [];
  9826. // qSa(:focus) reports false when true (Chrome 21)
  9827. // We allow this because of a bug in IE8/9 that throws an error
  9828. // whenever `document.activeElement` is accessed on an iframe
  9829. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9830. // See https://bugs.jquery.com/ticket/13378
  9831. rbuggyQSA = [];
  9832. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9833. // Build QSA regex
  9834. // Regex strategy adopted from Diego Perini
  9835. assert(function( el ) {
  9836. // Select is set to empty string on purpose
  9837. // This is to test IE's treatment of not explicitly
  9838. // setting a boolean content attribute,
  9839. // since its presence should be enough
  9840. // https://bugs.jquery.com/ticket/12359
  9841. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9842. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9843. "<option selected=''></option></select>";
  9844. // Support: IE8, Opera 11-12.16
  9845. // Nothing should be selected when empty strings follow ^= or $= or *=
  9846. // The test attribute must be unknown in Opera but "safe" for WinRT
  9847. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9848. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9849. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9850. }
  9851. // Support: IE8
  9852. // Boolean attributes and "value" are not treated correctly
  9853. if ( !el.querySelectorAll("[selected]").length ) {
  9854. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9855. }
  9856. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9857. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9858. rbuggyQSA.push("~=");
  9859. }
  9860. // Webkit/Opera - :checked should return selected option elements
  9861. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9862. // IE8 throws error here and will not see later tests
  9863. if ( !el.querySelectorAll(":checked").length ) {
  9864. rbuggyQSA.push(":checked");
  9865. }
  9866. // Support: Safari 8+, iOS 8+
  9867. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9868. // In-page `selector#id sibling-combinator selector` fails
  9869. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9870. rbuggyQSA.push(".#.+[+~]");
  9871. }
  9872. });
  9873. assert(function( el ) {
  9874. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9875. "<select disabled='disabled'><option/></select>";
  9876. // Support: Windows 8 Native Apps
  9877. // The type and name attributes are restricted during .innerHTML assignment
  9878. var input = document.createElement("input");
  9879. input.setAttribute( "type", "hidden" );
  9880. el.appendChild( input ).setAttribute( "name", "D" );
  9881. // Support: IE8
  9882. // Enforce case-sensitivity of name attribute
  9883. if ( el.querySelectorAll("[name=d]").length ) {
  9884. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9885. }
  9886. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9887. // IE8 throws error here and will not see later tests
  9888. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9889. rbuggyQSA.push( ":enabled", ":disabled" );
  9890. }
  9891. // Support: IE9-11+
  9892. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9893. docElem.appendChild( el ).disabled = true;
  9894. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9895. rbuggyQSA.push( ":enabled", ":disabled" );
  9896. }
  9897. // Opera 10-11 does not throw on post-comma invalid pseudos
  9898. el.querySelectorAll("*,:x");
  9899. rbuggyQSA.push(",.*:");
  9900. });
  9901. }
  9902. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9903. docElem.webkitMatchesSelector ||
  9904. docElem.mozMatchesSelector ||
  9905. docElem.oMatchesSelector ||
  9906. docElem.msMatchesSelector) )) ) {
  9907. assert(function( el ) {
  9908. // Check to see if it's possible to do matchesSelector
  9909. // on a disconnected node (IE 9)
  9910. support.disconnectedMatch = matches.call( el, "*" );
  9911. // This should fail with an exception
  9912. // Gecko does not error, returns false instead
  9913. matches.call( el, "[s!='']:x" );
  9914. rbuggyMatches.push( "!=", pseudos );
  9915. });
  9916. }
  9917. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9918. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9919. /* Contains
  9920. ---------------------------------------------------------------------- */
  9921. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9922. // Element contains another
  9923. // Purposefully self-exclusive
  9924. // As in, an element does not contain itself
  9925. contains = hasCompare || rnative.test( docElem.contains ) ?
  9926. function( a, b ) {
  9927. var adown = a.nodeType === 9 ? a.documentElement : a,
  9928. bup = b && b.parentNode;
  9929. return a === bup || !!( bup && bup.nodeType === 1 && (
  9930. adown.contains ?
  9931. adown.contains( bup ) :
  9932. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9933. ));
  9934. } :
  9935. function( a, b ) {
  9936. if ( b ) {
  9937. while ( (b = b.parentNode) ) {
  9938. if ( b === a ) {
  9939. return true;
  9940. }
  9941. }
  9942. }
  9943. return false;
  9944. };
  9945. /* Sorting
  9946. ---------------------------------------------------------------------- */
  9947. // Document order sorting
  9948. sortOrder = hasCompare ?
  9949. function( a, b ) {
  9950. // Flag for duplicate removal
  9951. if ( a === b ) {
  9952. hasDuplicate = true;
  9953. return 0;
  9954. }
  9955. // Sort on method existence if only one input has compareDocumentPosition
  9956. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9957. if ( compare ) {
  9958. return compare;
  9959. }
  9960. // Calculate position if both inputs belong to the same document
  9961. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9962. a.compareDocumentPosition( b ) :
  9963. // Otherwise we know they are disconnected
  9964. 1;
  9965. // Disconnected nodes
  9966. if ( compare & 1 ||
  9967. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9968. // Choose the first element that is related to our preferred document
  9969. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9970. return -1;
  9971. }
  9972. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9973. return 1;
  9974. }
  9975. // Maintain original order
  9976. return sortInput ?
  9977. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9978. 0;
  9979. }
  9980. return compare & 4 ? -1 : 1;
  9981. } :
  9982. function( a, b ) {
  9983. // Exit early if the nodes are identical
  9984. if ( a === b ) {
  9985. hasDuplicate = true;
  9986. return 0;
  9987. }
  9988. var cur,
  9989. i = 0,
  9990. aup = a.parentNode,
  9991. bup = b.parentNode,
  9992. ap = [ a ],
  9993. bp = [ b ];
  9994. // Parentless nodes are either documents or disconnected
  9995. if ( !aup || !bup ) {
  9996. return a === document ? -1 :
  9997. b === document ? 1 :
  9998. aup ? -1 :
  9999. bup ? 1 :
  10000. sortInput ?
  10001. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10002. 0;
  10003. // If the nodes are siblings, we can do a quick check
  10004. } else if ( aup === bup ) {
  10005. return siblingCheck( a, b );
  10006. }
  10007. // Otherwise we need full lists of their ancestors for comparison
  10008. cur = a;
  10009. while ( (cur = cur.parentNode) ) {
  10010. ap.unshift( cur );
  10011. }
  10012. cur = b;
  10013. while ( (cur = cur.parentNode) ) {
  10014. bp.unshift( cur );
  10015. }
  10016. // Walk down the tree looking for a discrepancy
  10017. while ( ap[i] === bp[i] ) {
  10018. i++;
  10019. }
  10020. return i ?
  10021. // Do a sibling check if the nodes have a common ancestor
  10022. siblingCheck( ap[i], bp[i] ) :
  10023. // Otherwise nodes in our document sort first
  10024. ap[i] === preferredDoc ? -1 :
  10025. bp[i] === preferredDoc ? 1 :
  10026. 0;
  10027. };
  10028. return document;
  10029. };
  10030. Sizzle.matches = function( expr, elements ) {
  10031. return Sizzle( expr, null, null, elements );
  10032. };
  10033. Sizzle.matchesSelector = function( elem, expr ) {
  10034. // Set document vars if needed
  10035. if ( ( elem.ownerDocument || elem ) !== document ) {
  10036. setDocument( elem );
  10037. }
  10038. if ( support.matchesSelector && documentIsHTML &&
  10039. !nonnativeSelectorCache[ expr + " " ] &&
  10040. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10041. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10042. try {
  10043. var ret = matches.call( elem, expr );
  10044. // IE 9's matchesSelector returns false on disconnected nodes
  10045. if ( ret || support.disconnectedMatch ||
  10046. // As well, disconnected nodes are said to be in a document
  10047. // fragment in IE 9
  10048. elem.document && elem.document.nodeType !== 11 ) {
  10049. return ret;
  10050. }
  10051. } catch (e) {
  10052. nonnativeSelectorCache( expr, true );
  10053. }
  10054. }
  10055. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10056. };
  10057. Sizzle.contains = function( context, elem ) {
  10058. // Set document vars if needed
  10059. if ( ( context.ownerDocument || context ) !== document ) {
  10060. setDocument( context );
  10061. }
  10062. return contains( context, elem );
  10063. };
  10064. Sizzle.attr = function( elem, name ) {
  10065. // Set document vars if needed
  10066. if ( ( elem.ownerDocument || elem ) !== document ) {
  10067. setDocument( elem );
  10068. }
  10069. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10070. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10071. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10072. fn( elem, name, !documentIsHTML ) :
  10073. undefined;
  10074. return val !== undefined ?
  10075. val :
  10076. support.attributes || !documentIsHTML ?
  10077. elem.getAttribute( name ) :
  10078. (val = elem.getAttributeNode(name)) && val.specified ?
  10079. val.value :
  10080. null;
  10081. };
  10082. Sizzle.escape = function( sel ) {
  10083. return (sel + "").replace( rcssescape, fcssescape );
  10084. };
  10085. Sizzle.error = function( msg ) {
  10086. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10087. };
  10088. /**
  10089. * Document sorting and removing duplicates
  10090. * @param {ArrayLike} results
  10091. */
  10092. Sizzle.uniqueSort = function( results ) {
  10093. var elem,
  10094. duplicates = [],
  10095. j = 0,
  10096. i = 0;
  10097. // Unless we *know* we can detect duplicates, assume their presence
  10098. hasDuplicate = !support.detectDuplicates;
  10099. sortInput = !support.sortStable && results.slice( 0 );
  10100. results.sort( sortOrder );
  10101. if ( hasDuplicate ) {
  10102. while ( (elem = results[i++]) ) {
  10103. if ( elem === results[ i ] ) {
  10104. j = duplicates.push( i );
  10105. }
  10106. }
  10107. while ( j-- ) {
  10108. results.splice( duplicates[ j ], 1 );
  10109. }
  10110. }
  10111. // Clear input after sorting to release objects
  10112. // See https://github.com/jquery/sizzle/pull/225
  10113. sortInput = null;
  10114. return results;
  10115. };
  10116. /**
  10117. * Utility function for retrieving the text value of an array of DOM nodes
  10118. * @param {Array|Element} elem
  10119. */
  10120. getText = Sizzle.getText = function( elem ) {
  10121. var node,
  10122. ret = "",
  10123. i = 0,
  10124. nodeType = elem.nodeType;
  10125. if ( !nodeType ) {
  10126. // If no nodeType, this is expected to be an array
  10127. while ( (node = elem[i++]) ) {
  10128. // Do not traverse comment nodes
  10129. ret += getText( node );
  10130. }
  10131. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10132. // Use textContent for elements
  10133. // innerText usage removed for consistency of new lines (jQuery #11153)
  10134. if ( typeof elem.textContent === "string" ) {
  10135. return elem.textContent;
  10136. } else {
  10137. // Traverse its children
  10138. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10139. ret += getText( elem );
  10140. }
  10141. }
  10142. } else if ( nodeType === 3 || nodeType === 4 ) {
  10143. return elem.nodeValue;
  10144. }
  10145. // Do not include comment or processing instruction nodes
  10146. return ret;
  10147. };
  10148. Expr = Sizzle.selectors = {
  10149. // Can be adjusted by the user
  10150. cacheLength: 50,
  10151. createPseudo: markFunction,
  10152. match: matchExpr,
  10153. attrHandle: {},
  10154. find: {},
  10155. relative: {
  10156. ">": { dir: "parentNode", first: true },
  10157. " ": { dir: "parentNode" },
  10158. "+": { dir: "previousSibling", first: true },
  10159. "~": { dir: "previousSibling" }
  10160. },
  10161. preFilter: {
  10162. "ATTR": function( match ) {
  10163. match[1] = match[1].replace( runescape, funescape );
  10164. // Move the given value to match[3] whether quoted or unquoted
  10165. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10166. if ( match[2] === "~=" ) {
  10167. match[3] = " " + match[3] + " ";
  10168. }
  10169. return match.slice( 0, 4 );
  10170. },
  10171. "CHILD": function( match ) {
  10172. /* matches from matchExpr["CHILD"]
  10173. 1 type (only|nth|...)
  10174. 2 what (child|of-type)
  10175. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10176. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10177. 5 sign of xn-component
  10178. 6 x of xn-component
  10179. 7 sign of y-component
  10180. 8 y of y-component
  10181. */
  10182. match[1] = match[1].toLowerCase();
  10183. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10184. // nth-* requires argument
  10185. if ( !match[3] ) {
  10186. Sizzle.error( match[0] );
  10187. }
  10188. // numeric x and y parameters for Expr.filter.CHILD
  10189. // remember that false/true cast respectively to 0/1
  10190. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10191. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10192. // other types prohibit arguments
  10193. } else if ( match[3] ) {
  10194. Sizzle.error( match[0] );
  10195. }
  10196. return match;
  10197. },
  10198. "PSEUDO": function( match ) {
  10199. var excess,
  10200. unquoted = !match[6] && match[2];
  10201. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10202. return null;
  10203. }
  10204. // Accept quoted arguments as-is
  10205. if ( match[3] ) {
  10206. match[2] = match[4] || match[5] || "";
  10207. // Strip excess characters from unquoted arguments
  10208. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10209. // Get excess from tokenize (recursively)
  10210. (excess = tokenize( unquoted, true )) &&
  10211. // advance to the next closing parenthesis
  10212. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10213. // excess is a negative index
  10214. match[0] = match[0].slice( 0, excess );
  10215. match[2] = unquoted.slice( 0, excess );
  10216. }
  10217. // Return only captures needed by the pseudo filter method (type and argument)
  10218. return match.slice( 0, 3 );
  10219. }
  10220. },
  10221. filter: {
  10222. "TAG": function( nodeNameSelector ) {
  10223. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10224. return nodeNameSelector === "*" ?
  10225. function() { return true; } :
  10226. function( elem ) {
  10227. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10228. };
  10229. },
  10230. "CLASS": function( className ) {
  10231. var pattern = classCache[ className + " " ];
  10232. return pattern ||
  10233. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10234. classCache( className, function( elem ) {
  10235. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10236. });
  10237. },
  10238. "ATTR": function( name, operator, check ) {
  10239. return function( elem ) {
  10240. var result = Sizzle.attr( elem, name );
  10241. if ( result == null ) {
  10242. return operator === "!=";
  10243. }
  10244. if ( !operator ) {
  10245. return true;
  10246. }
  10247. result += "";
  10248. return operator === "=" ? result === check :
  10249. operator === "!=" ? result !== check :
  10250. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10251. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10252. operator === "$=" ? check && result.slice( -check.length ) === check :
  10253. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10254. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10255. false;
  10256. };
  10257. },
  10258. "CHILD": function( type, what, argument, first, last ) {
  10259. var simple = type.slice( 0, 3 ) !== "nth",
  10260. forward = type.slice( -4 ) !== "last",
  10261. ofType = what === "of-type";
  10262. return first === 1 && last === 0 ?
  10263. // Shortcut for :nth-*(n)
  10264. function( elem ) {
  10265. return !!elem.parentNode;
  10266. } :
  10267. function( elem, context, xml ) {
  10268. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10269. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10270. parent = elem.parentNode,
  10271. name = ofType && elem.nodeName.toLowerCase(),
  10272. useCache = !xml && !ofType,
  10273. diff = false;
  10274. if ( parent ) {
  10275. // :(first|last|only)-(child|of-type)
  10276. if ( simple ) {
  10277. while ( dir ) {
  10278. node = elem;
  10279. while ( (node = node[ dir ]) ) {
  10280. if ( ofType ?
  10281. node.nodeName.toLowerCase() === name :
  10282. node.nodeType === 1 ) {
  10283. return false;
  10284. }
  10285. }
  10286. // Reverse direction for :only-* (if we haven't yet done so)
  10287. start = dir = type === "only" && !start && "nextSibling";
  10288. }
  10289. return true;
  10290. }
  10291. start = [ forward ? parent.firstChild : parent.lastChild ];
  10292. // non-xml :nth-child(...) stores cache data on `parent`
  10293. if ( forward && useCache ) {
  10294. // Seek `elem` from a previously-cached index
  10295. // ...in a gzip-friendly way
  10296. node = parent;
  10297. outerCache = node[ expando ] || (node[ expando ] = {});
  10298. // Support: IE <9 only
  10299. // Defend against cloned attroperties (jQuery gh-1709)
  10300. uniqueCache = outerCache[ node.uniqueID ] ||
  10301. (outerCache[ node.uniqueID ] = {});
  10302. cache = uniqueCache[ type ] || [];
  10303. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10304. diff = nodeIndex && cache[ 2 ];
  10305. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10306. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10307. // Fallback to seeking `elem` from the start
  10308. (diff = nodeIndex = 0) || start.pop()) ) {
  10309. // When found, cache indexes on `parent` and break
  10310. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10311. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10312. break;
  10313. }
  10314. }
  10315. } else {
  10316. // Use previously-cached element index if available
  10317. if ( useCache ) {
  10318. // ...in a gzip-friendly way
  10319. node = elem;
  10320. outerCache = node[ expando ] || (node[ expando ] = {});
  10321. // Support: IE <9 only
  10322. // Defend against cloned attroperties (jQuery gh-1709)
  10323. uniqueCache = outerCache[ node.uniqueID ] ||
  10324. (outerCache[ node.uniqueID ] = {});
  10325. cache = uniqueCache[ type ] || [];
  10326. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10327. diff = nodeIndex;
  10328. }
  10329. // xml :nth-child(...)
  10330. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10331. if ( diff === false ) {
  10332. // Use the same loop as above to seek `elem` from the start
  10333. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10334. (diff = nodeIndex = 0) || start.pop()) ) {
  10335. if ( ( ofType ?
  10336. node.nodeName.toLowerCase() === name :
  10337. node.nodeType === 1 ) &&
  10338. ++diff ) {
  10339. // Cache the index of each encountered element
  10340. if ( useCache ) {
  10341. outerCache = node[ expando ] || (node[ expando ] = {});
  10342. // Support: IE <9 only
  10343. // Defend against cloned attroperties (jQuery gh-1709)
  10344. uniqueCache = outerCache[ node.uniqueID ] ||
  10345. (outerCache[ node.uniqueID ] = {});
  10346. uniqueCache[ type ] = [ dirruns, diff ];
  10347. }
  10348. if ( node === elem ) {
  10349. break;
  10350. }
  10351. }
  10352. }
  10353. }
  10354. }
  10355. // Incorporate the offset, then check against cycle size
  10356. diff -= last;
  10357. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10358. }
  10359. };
  10360. },
  10361. "PSEUDO": function( pseudo, argument ) {
  10362. // pseudo-class names are case-insensitive
  10363. // http://www.w3.org/TR/selectors/#pseudo-classes
  10364. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10365. // Remember that setFilters inherits from pseudos
  10366. var args,
  10367. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10368. Sizzle.error( "unsupported pseudo: " + pseudo );
  10369. // The user may use createPseudo to indicate that
  10370. // arguments are needed to create the filter function
  10371. // just as Sizzle does
  10372. if ( fn[ expando ] ) {
  10373. return fn( argument );
  10374. }
  10375. // But maintain support for old signatures
  10376. if ( fn.length > 1 ) {
  10377. args = [ pseudo, pseudo, "", argument ];
  10378. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10379. markFunction(function( seed, matches ) {
  10380. var idx,
  10381. matched = fn( seed, argument ),
  10382. i = matched.length;
  10383. while ( i-- ) {
  10384. idx = indexOf( seed, matched[i] );
  10385. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10386. }
  10387. }) :
  10388. function( elem ) {
  10389. return fn( elem, 0, args );
  10390. };
  10391. }
  10392. return fn;
  10393. }
  10394. },
  10395. pseudos: {
  10396. // Potentially complex pseudos
  10397. "not": markFunction(function( selector ) {
  10398. // Trim the selector passed to compile
  10399. // to avoid treating leading and trailing
  10400. // spaces as combinators
  10401. var input = [],
  10402. results = [],
  10403. matcher = compile( selector.replace( rtrim, "$1" ) );
  10404. return matcher[ expando ] ?
  10405. markFunction(function( seed, matches, context, xml ) {
  10406. var elem,
  10407. unmatched = matcher( seed, null, xml, [] ),
  10408. i = seed.length;
  10409. // Match elements unmatched by `matcher`
  10410. while ( i-- ) {
  10411. if ( (elem = unmatched[i]) ) {
  10412. seed[i] = !(matches[i] = elem);
  10413. }
  10414. }
  10415. }) :
  10416. function( elem, context, xml ) {
  10417. input[0] = elem;
  10418. matcher( input, null, xml, results );
  10419. // Don't keep the element (issue #299)
  10420. input[0] = null;
  10421. return !results.pop();
  10422. };
  10423. }),
  10424. "has": markFunction(function( selector ) {
  10425. return function( elem ) {
  10426. return Sizzle( selector, elem ).length > 0;
  10427. };
  10428. }),
  10429. "contains": markFunction(function( text ) {
  10430. text = text.replace( runescape, funescape );
  10431. return function( elem ) {
  10432. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10433. };
  10434. }),
  10435. // "Whether an element is represented by a :lang() selector
  10436. // is based solely on the element's language value
  10437. // being equal to the identifier C,
  10438. // or beginning with the identifier C immediately followed by "-".
  10439. // The matching of C against the element's language value is performed case-insensitively.
  10440. // The identifier C does not have to be a valid language name."
  10441. // http://www.w3.org/TR/selectors/#lang-pseudo
  10442. "lang": markFunction( function( lang ) {
  10443. // lang value must be a valid identifier
  10444. if ( !ridentifier.test(lang || "") ) {
  10445. Sizzle.error( "unsupported lang: " + lang );
  10446. }
  10447. lang = lang.replace( runescape, funescape ).toLowerCase();
  10448. return function( elem ) {
  10449. var elemLang;
  10450. do {
  10451. if ( (elemLang = documentIsHTML ?
  10452. elem.lang :
  10453. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10454. elemLang = elemLang.toLowerCase();
  10455. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10456. }
  10457. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10458. return false;
  10459. };
  10460. }),
  10461. // Miscellaneous
  10462. "target": function( elem ) {
  10463. var hash = window.location && window.location.hash;
  10464. return hash && hash.slice( 1 ) === elem.id;
  10465. },
  10466. "root": function( elem ) {
  10467. return elem === docElem;
  10468. },
  10469. "focus": function( elem ) {
  10470. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10471. },
  10472. // Boolean properties
  10473. "enabled": createDisabledPseudo( false ),
  10474. "disabled": createDisabledPseudo( true ),
  10475. "checked": function( elem ) {
  10476. // In CSS3, :checked should return both checked and selected elements
  10477. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10478. var nodeName = elem.nodeName.toLowerCase();
  10479. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10480. },
  10481. "selected": function( elem ) {
  10482. // Accessing this property makes selected-by-default
  10483. // options in Safari work properly
  10484. if ( elem.parentNode ) {
  10485. elem.parentNode.selectedIndex;
  10486. }
  10487. return elem.selected === true;
  10488. },
  10489. // Contents
  10490. "empty": function( elem ) {
  10491. // http://www.w3.org/TR/selectors/#empty-pseudo
  10492. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10493. // but not by others (comment: 8; processing instruction: 7; etc.)
  10494. // nodeType < 6 works because attributes (2) do not appear as children
  10495. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10496. if ( elem.nodeType < 6 ) {
  10497. return false;
  10498. }
  10499. }
  10500. return true;
  10501. },
  10502. "parent": function( elem ) {
  10503. return !Expr.pseudos["empty"]( elem );
  10504. },
  10505. // Element/input types
  10506. "header": function( elem ) {
  10507. return rheader.test( elem.nodeName );
  10508. },
  10509. "input": function( elem ) {
  10510. return rinputs.test( elem.nodeName );
  10511. },
  10512. "button": function( elem ) {
  10513. var name = elem.nodeName.toLowerCase();
  10514. return name === "input" && elem.type === "button" || name === "button";
  10515. },
  10516. "text": function( elem ) {
  10517. var attr;
  10518. return elem.nodeName.toLowerCase() === "input" &&
  10519. elem.type === "text" &&
  10520. // Support: IE<8
  10521. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10522. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10523. },
  10524. // Position-in-collection
  10525. "first": createPositionalPseudo(function() {
  10526. return [ 0 ];
  10527. }),
  10528. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10529. return [ length - 1 ];
  10530. }),
  10531. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10532. return [ argument < 0 ? argument + length : argument ];
  10533. }),
  10534. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10535. var i = 0;
  10536. for ( ; i < length; i += 2 ) {
  10537. matchIndexes.push( i );
  10538. }
  10539. return matchIndexes;
  10540. }),
  10541. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10542. var i = 1;
  10543. for ( ; i < length; i += 2 ) {
  10544. matchIndexes.push( i );
  10545. }
  10546. return matchIndexes;
  10547. }),
  10548. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10549. var i = argument < 0 ?
  10550. argument + length :
  10551. argument > length ?
  10552. length :
  10553. argument;
  10554. for ( ; --i >= 0; ) {
  10555. matchIndexes.push( i );
  10556. }
  10557. return matchIndexes;
  10558. }),
  10559. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10560. var i = argument < 0 ? argument + length : argument;
  10561. for ( ; ++i < length; ) {
  10562. matchIndexes.push( i );
  10563. }
  10564. return matchIndexes;
  10565. })
  10566. }
  10567. };
  10568. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10569. // Add button/input type pseudos
  10570. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10571. Expr.pseudos[ i ] = createInputPseudo( i );
  10572. }
  10573. for ( i in { submit: true, reset: true } ) {
  10574. Expr.pseudos[ i ] = createButtonPseudo( i );
  10575. }
  10576. // Easy API for creating new setFilters
  10577. function setFilters() {}
  10578. setFilters.prototype = Expr.filters = Expr.pseudos;
  10579. Expr.setFilters = new setFilters();
  10580. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10581. var matched, match, tokens, type,
  10582. soFar, groups, preFilters,
  10583. cached = tokenCache[ selector + " " ];
  10584. if ( cached ) {
  10585. return parseOnly ? 0 : cached.slice( 0 );
  10586. }
  10587. soFar = selector;
  10588. groups = [];
  10589. preFilters = Expr.preFilter;
  10590. while ( soFar ) {
  10591. // Comma and first run
  10592. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10593. if ( match ) {
  10594. // Don't consume trailing commas as valid
  10595. soFar = soFar.slice( match[0].length ) || soFar;
  10596. }
  10597. groups.push( (tokens = []) );
  10598. }
  10599. matched = false;
  10600. // Combinators
  10601. if ( (match = rcombinators.exec( soFar )) ) {
  10602. matched = match.shift();
  10603. tokens.push({
  10604. value: matched,
  10605. // Cast descendant combinators to space
  10606. type: match[0].replace( rtrim, " " )
  10607. });
  10608. soFar = soFar.slice( matched.length );
  10609. }
  10610. // Filters
  10611. for ( type in Expr.filter ) {
  10612. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10613. (match = preFilters[ type ]( match ))) ) {
  10614. matched = match.shift();
  10615. tokens.push({
  10616. value: matched,
  10617. type: type,
  10618. matches: match
  10619. });
  10620. soFar = soFar.slice( matched.length );
  10621. }
  10622. }
  10623. if ( !matched ) {
  10624. break;
  10625. }
  10626. }
  10627. // Return the length of the invalid excess
  10628. // if we're just parsing
  10629. // Otherwise, throw an error or return tokens
  10630. return parseOnly ?
  10631. soFar.length :
  10632. soFar ?
  10633. Sizzle.error( selector ) :
  10634. // Cache the tokens
  10635. tokenCache( selector, groups ).slice( 0 );
  10636. };
  10637. function toSelector( tokens ) {
  10638. var i = 0,
  10639. len = tokens.length,
  10640. selector = "";
  10641. for ( ; i < len; i++ ) {
  10642. selector += tokens[i].value;
  10643. }
  10644. return selector;
  10645. }
  10646. function addCombinator( matcher, combinator, base ) {
  10647. var dir = combinator.dir,
  10648. skip = combinator.next,
  10649. key = skip || dir,
  10650. checkNonElements = base && key === "parentNode",
  10651. doneName = done++;
  10652. return combinator.first ?
  10653. // Check against closest ancestor/preceding element
  10654. function( elem, context, xml ) {
  10655. while ( (elem = elem[ dir ]) ) {
  10656. if ( elem.nodeType === 1 || checkNonElements ) {
  10657. return matcher( elem, context, xml );
  10658. }
  10659. }
  10660. return false;
  10661. } :
  10662. // Check against all ancestor/preceding elements
  10663. function( elem, context, xml ) {
  10664. var oldCache, uniqueCache, outerCache,
  10665. newCache = [ dirruns, doneName ];
  10666. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10667. if ( xml ) {
  10668. while ( (elem = elem[ dir ]) ) {
  10669. if ( elem.nodeType === 1 || checkNonElements ) {
  10670. if ( matcher( elem, context, xml ) ) {
  10671. return true;
  10672. }
  10673. }
  10674. }
  10675. } else {
  10676. while ( (elem = elem[ dir ]) ) {
  10677. if ( elem.nodeType === 1 || checkNonElements ) {
  10678. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10679. // Support: IE <9 only
  10680. // Defend against cloned attroperties (jQuery gh-1709)
  10681. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10682. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10683. elem = elem[ dir ] || elem;
  10684. } else if ( (oldCache = uniqueCache[ key ]) &&
  10685. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10686. // Assign to newCache so results back-propagate to previous elements
  10687. return (newCache[ 2 ] = oldCache[ 2 ]);
  10688. } else {
  10689. // Reuse newcache so results back-propagate to previous elements
  10690. uniqueCache[ key ] = newCache;
  10691. // A match means we're done; a fail means we have to keep checking
  10692. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10693. return true;
  10694. }
  10695. }
  10696. }
  10697. }
  10698. }
  10699. return false;
  10700. };
  10701. }
  10702. function elementMatcher( matchers ) {
  10703. return matchers.length > 1 ?
  10704. function( elem, context, xml ) {
  10705. var i = matchers.length;
  10706. while ( i-- ) {
  10707. if ( !matchers[i]( elem, context, xml ) ) {
  10708. return false;
  10709. }
  10710. }
  10711. return true;
  10712. } :
  10713. matchers[0];
  10714. }
  10715. function multipleContexts( selector, contexts, results ) {
  10716. var i = 0,
  10717. len = contexts.length;
  10718. for ( ; i < len; i++ ) {
  10719. Sizzle( selector, contexts[i], results );
  10720. }
  10721. return results;
  10722. }
  10723. function condense( unmatched, map, filter, context, xml ) {
  10724. var elem,
  10725. newUnmatched = [],
  10726. i = 0,
  10727. len = unmatched.length,
  10728. mapped = map != null;
  10729. for ( ; i < len; i++ ) {
  10730. if ( (elem = unmatched[i]) ) {
  10731. if ( !filter || filter( elem, context, xml ) ) {
  10732. newUnmatched.push( elem );
  10733. if ( mapped ) {
  10734. map.push( i );
  10735. }
  10736. }
  10737. }
  10738. }
  10739. return newUnmatched;
  10740. }
  10741. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10742. if ( postFilter && !postFilter[ expando ] ) {
  10743. postFilter = setMatcher( postFilter );
  10744. }
  10745. if ( postFinder && !postFinder[ expando ] ) {
  10746. postFinder = setMatcher( postFinder, postSelector );
  10747. }
  10748. return markFunction(function( seed, results, context, xml ) {
  10749. var temp, i, elem,
  10750. preMap = [],
  10751. postMap = [],
  10752. preexisting = results.length,
  10753. // Get initial elements from seed or context
  10754. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10755. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10756. matcherIn = preFilter && ( seed || !selector ) ?
  10757. condense( elems, preMap, preFilter, context, xml ) :
  10758. elems,
  10759. matcherOut = matcher ?
  10760. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10761. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10762. // ...intermediate processing is necessary
  10763. [] :
  10764. // ...otherwise use results directly
  10765. results :
  10766. matcherIn;
  10767. // Find primary matches
  10768. if ( matcher ) {
  10769. matcher( matcherIn, matcherOut, context, xml );
  10770. }
  10771. // Apply postFilter
  10772. if ( postFilter ) {
  10773. temp = condense( matcherOut, postMap );
  10774. postFilter( temp, [], context, xml );
  10775. // Un-match failing elements by moving them back to matcherIn
  10776. i = temp.length;
  10777. while ( i-- ) {
  10778. if ( (elem = temp[i]) ) {
  10779. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10780. }
  10781. }
  10782. }
  10783. if ( seed ) {
  10784. if ( postFinder || preFilter ) {
  10785. if ( postFinder ) {
  10786. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10787. temp = [];
  10788. i = matcherOut.length;
  10789. while ( i-- ) {
  10790. if ( (elem = matcherOut[i]) ) {
  10791. // Restore matcherIn since elem is not yet a final match
  10792. temp.push( (matcherIn[i] = elem) );
  10793. }
  10794. }
  10795. postFinder( null, (matcherOut = []), temp, xml );
  10796. }
  10797. // Move matched elements from seed to results to keep them synchronized
  10798. i = matcherOut.length;
  10799. while ( i-- ) {
  10800. if ( (elem = matcherOut[i]) &&
  10801. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10802. seed[temp] = !(results[temp] = elem);
  10803. }
  10804. }
  10805. }
  10806. // Add elements to results, through postFinder if defined
  10807. } else {
  10808. matcherOut = condense(
  10809. matcherOut === results ?
  10810. matcherOut.splice( preexisting, matcherOut.length ) :
  10811. matcherOut
  10812. );
  10813. if ( postFinder ) {
  10814. postFinder( null, results, matcherOut, xml );
  10815. } else {
  10816. push.apply( results, matcherOut );
  10817. }
  10818. }
  10819. });
  10820. }
  10821. function matcherFromTokens( tokens ) {
  10822. var checkContext, matcher, j,
  10823. len = tokens.length,
  10824. leadingRelative = Expr.relative[ tokens[0].type ],
  10825. implicitRelative = leadingRelative || Expr.relative[" "],
  10826. i = leadingRelative ? 1 : 0,
  10827. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10828. matchContext = addCombinator( function( elem ) {
  10829. return elem === checkContext;
  10830. }, implicitRelative, true ),
  10831. matchAnyContext = addCombinator( function( elem ) {
  10832. return indexOf( checkContext, elem ) > -1;
  10833. }, implicitRelative, true ),
  10834. matchers = [ function( elem, context, xml ) {
  10835. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10836. (checkContext = context).nodeType ?
  10837. matchContext( elem, context, xml ) :
  10838. matchAnyContext( elem, context, xml ) );
  10839. // Avoid hanging onto element (issue #299)
  10840. checkContext = null;
  10841. return ret;
  10842. } ];
  10843. for ( ; i < len; i++ ) {
  10844. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10845. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10846. } else {
  10847. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10848. // Return special upon seeing a positional matcher
  10849. if ( matcher[ expando ] ) {
  10850. // Find the next relative operator (if any) for proper handling
  10851. j = ++i;
  10852. for ( ; j < len; j++ ) {
  10853. if ( Expr.relative[ tokens[j].type ] ) {
  10854. break;
  10855. }
  10856. }
  10857. return setMatcher(
  10858. i > 1 && elementMatcher( matchers ),
  10859. i > 1 && toSelector(
  10860. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10861. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10862. ).replace( rtrim, "$1" ),
  10863. matcher,
  10864. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10865. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10866. j < len && toSelector( tokens )
  10867. );
  10868. }
  10869. matchers.push( matcher );
  10870. }
  10871. }
  10872. return elementMatcher( matchers );
  10873. }
  10874. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10875. var bySet = setMatchers.length > 0,
  10876. byElement = elementMatchers.length > 0,
  10877. superMatcher = function( seed, context, xml, results, outermost ) {
  10878. var elem, j, matcher,
  10879. matchedCount = 0,
  10880. i = "0",
  10881. unmatched = seed && [],
  10882. setMatched = [],
  10883. contextBackup = outermostContext,
  10884. // We must always have either seed elements or outermost context
  10885. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10886. // Use integer dirruns iff this is the outermost matcher
  10887. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10888. len = elems.length;
  10889. if ( outermost ) {
  10890. outermostContext = context === document || context || outermost;
  10891. }
  10892. // Add elements passing elementMatchers directly to results
  10893. // Support: IE<9, Safari
  10894. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10895. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10896. if ( byElement && elem ) {
  10897. j = 0;
  10898. if ( !context && elem.ownerDocument !== document ) {
  10899. setDocument( elem );
  10900. xml = !documentIsHTML;
  10901. }
  10902. while ( (matcher = elementMatchers[j++]) ) {
  10903. if ( matcher( elem, context || document, xml) ) {
  10904. results.push( elem );
  10905. break;
  10906. }
  10907. }
  10908. if ( outermost ) {
  10909. dirruns = dirrunsUnique;
  10910. }
  10911. }
  10912. // Track unmatched elements for set filters
  10913. if ( bySet ) {
  10914. // They will have gone through all possible matchers
  10915. if ( (elem = !matcher && elem) ) {
  10916. matchedCount--;
  10917. }
  10918. // Lengthen the array for every element, matched or not
  10919. if ( seed ) {
  10920. unmatched.push( elem );
  10921. }
  10922. }
  10923. }
  10924. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10925. // makes the latter nonnegative.
  10926. matchedCount += i;
  10927. // Apply set filters to unmatched elements
  10928. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10929. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10930. // no element matchers and no seed.
  10931. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10932. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10933. // numerically zero.
  10934. if ( bySet && i !== matchedCount ) {
  10935. j = 0;
  10936. while ( (matcher = setMatchers[j++]) ) {
  10937. matcher( unmatched, setMatched, context, xml );
  10938. }
  10939. if ( seed ) {
  10940. // Reintegrate element matches to eliminate the need for sorting
  10941. if ( matchedCount > 0 ) {
  10942. while ( i-- ) {
  10943. if ( !(unmatched[i] || setMatched[i]) ) {
  10944. setMatched[i] = pop.call( results );
  10945. }
  10946. }
  10947. }
  10948. // Discard index placeholder values to get only actual matches
  10949. setMatched = condense( setMatched );
  10950. }
  10951. // Add matches to results
  10952. push.apply( results, setMatched );
  10953. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10954. if ( outermost && !seed && setMatched.length > 0 &&
  10955. ( matchedCount + setMatchers.length ) > 1 ) {
  10956. Sizzle.uniqueSort( results );
  10957. }
  10958. }
  10959. // Override manipulation of globals by nested matchers
  10960. if ( outermost ) {
  10961. dirruns = dirrunsUnique;
  10962. outermostContext = contextBackup;
  10963. }
  10964. return unmatched;
  10965. };
  10966. return bySet ?
  10967. markFunction( superMatcher ) :
  10968. superMatcher;
  10969. }
  10970. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10971. var i,
  10972. setMatchers = [],
  10973. elementMatchers = [],
  10974. cached = compilerCache[ selector + " " ];
  10975. if ( !cached ) {
  10976. // Generate a function of recursive functions that can be used to check each element
  10977. if ( !match ) {
  10978. match = tokenize( selector );
  10979. }
  10980. i = match.length;
  10981. while ( i-- ) {
  10982. cached = matcherFromTokens( match[i] );
  10983. if ( cached[ expando ] ) {
  10984. setMatchers.push( cached );
  10985. } else {
  10986. elementMatchers.push( cached );
  10987. }
  10988. }
  10989. // Cache the compiled function
  10990. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10991. // Save selector and tokenization
  10992. cached.selector = selector;
  10993. }
  10994. return cached;
  10995. };
  10996. /**
  10997. * A low-level selection function that works with Sizzle's compiled
  10998. * selector functions
  10999. * @param {String|Function} selector A selector or a pre-compiled
  11000. * selector function built with Sizzle.compile
  11001. * @param {Element} context
  11002. * @param {Array} [results]
  11003. * @param {Array} [seed] A set of elements to match against
  11004. */
  11005. select = Sizzle.select = function( selector, context, results, seed ) {
  11006. var i, tokens, token, type, find,
  11007. compiled = typeof selector === "function" && selector,
  11008. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11009. results = results || [];
  11010. // Try to minimize operations if there is only one selector in the list and no seed
  11011. // (the latter of which guarantees us context)
  11012. if ( match.length === 1 ) {
  11013. // Reduce context if the leading compound selector is an ID
  11014. tokens = match[0] = match[0].slice( 0 );
  11015. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11016. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11017. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11018. if ( !context ) {
  11019. return results;
  11020. // Precompiled matchers will still verify ancestry, so step up a level
  11021. } else if ( compiled ) {
  11022. context = context.parentNode;
  11023. }
  11024. selector = selector.slice( tokens.shift().value.length );
  11025. }
  11026. // Fetch a seed set for right-to-left matching
  11027. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11028. while ( i-- ) {
  11029. token = tokens[i];
  11030. // Abort if we hit a combinator
  11031. if ( Expr.relative[ (type = token.type) ] ) {
  11032. break;
  11033. }
  11034. if ( (find = Expr.find[ type ]) ) {
  11035. // Search, expanding context for leading sibling combinators
  11036. if ( (seed = find(
  11037. token.matches[0].replace( runescape, funescape ),
  11038. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11039. )) ) {
  11040. // If seed is empty or no tokens remain, we can return early
  11041. tokens.splice( i, 1 );
  11042. selector = seed.length && toSelector( tokens );
  11043. if ( !selector ) {
  11044. push.apply( results, seed );
  11045. return results;
  11046. }
  11047. break;
  11048. }
  11049. }
  11050. }
  11051. }
  11052. // Compile and execute a filtering function if one is not provided
  11053. // Provide `match` to avoid retokenization if we modified the selector above
  11054. ( compiled || compile( selector, match ) )(
  11055. seed,
  11056. context,
  11057. !documentIsHTML,
  11058. results,
  11059. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11060. );
  11061. return results;
  11062. };
  11063. // One-time assignments
  11064. // Sort stability
  11065. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11066. // Support: Chrome 14-35+
  11067. // Always assume duplicates if they aren't passed to the comparison function
  11068. support.detectDuplicates = !!hasDuplicate;
  11069. // Initialize against the default document
  11070. setDocument();
  11071. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11072. // Detached nodes confoundingly follow *each other*
  11073. support.sortDetached = assert(function( el ) {
  11074. // Should return 1, but returns 4 (following)
  11075. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11076. });
  11077. // Support: IE<8
  11078. // Prevent attribute/property "interpolation"
  11079. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11080. if ( !assert(function( el ) {
  11081. el.innerHTML = "<a href='#'></a>";
  11082. return el.firstChild.getAttribute("href") === "#" ;
  11083. }) ) {
  11084. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11085. if ( !isXML ) {
  11086. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11087. }
  11088. });
  11089. }
  11090. // Support: IE<9
  11091. // Use defaultValue in place of getAttribute("value")
  11092. if ( !support.attributes || !assert(function( el ) {
  11093. el.innerHTML = "<input/>";
  11094. el.firstChild.setAttribute( "value", "" );
  11095. return el.firstChild.getAttribute( "value" ) === "";
  11096. }) ) {
  11097. addHandle( "value", function( elem, name, isXML ) {
  11098. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11099. return elem.defaultValue;
  11100. }
  11101. });
  11102. }
  11103. // Support: IE<9
  11104. // Use getAttributeNode to fetch booleans when getAttribute lies
  11105. if ( !assert(function( el ) {
  11106. return el.getAttribute("disabled") == null;
  11107. }) ) {
  11108. addHandle( booleans, function( elem, name, isXML ) {
  11109. var val;
  11110. if ( !isXML ) {
  11111. return elem[ name ] === true ? name.toLowerCase() :
  11112. (val = elem.getAttributeNode( name )) && val.specified ?
  11113. val.value :
  11114. null;
  11115. }
  11116. });
  11117. }
  11118. return Sizzle;
  11119. })( window );
  11120. jQuery.find = Sizzle;
  11121. jQuery.expr = Sizzle.selectors;
  11122. // Deprecated
  11123. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11124. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11125. jQuery.text = Sizzle.getText;
  11126. jQuery.isXMLDoc = Sizzle.isXML;
  11127. jQuery.contains = Sizzle.contains;
  11128. jQuery.escapeSelector = Sizzle.escape;
  11129. var dir = function( elem, dir, until ) {
  11130. var matched = [],
  11131. truncate = until !== undefined;
  11132. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11133. if ( elem.nodeType === 1 ) {
  11134. if ( truncate && jQuery( elem ).is( until ) ) {
  11135. break;
  11136. }
  11137. matched.push( elem );
  11138. }
  11139. }
  11140. return matched;
  11141. };
  11142. var siblings = function( n, elem ) {
  11143. var matched = [];
  11144. for ( ; n; n = n.nextSibling ) {
  11145. if ( n.nodeType === 1 && n !== elem ) {
  11146. matched.push( n );
  11147. }
  11148. }
  11149. return matched;
  11150. };
  11151. var rneedsContext = jQuery.expr.match.needsContext;
  11152. function nodeName( elem, name ) {
  11153. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11154. };
  11155. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11156. // Implement the identical functionality for filter and not
  11157. function winnow( elements, qualifier, not ) {
  11158. if ( isFunction( qualifier ) ) {
  11159. return jQuery.grep( elements, function( elem, i ) {
  11160. return !!qualifier.call( elem, i, elem ) !== not;
  11161. } );
  11162. }
  11163. // Single element
  11164. if ( qualifier.nodeType ) {
  11165. return jQuery.grep( elements, function( elem ) {
  11166. return ( elem === qualifier ) !== not;
  11167. } );
  11168. }
  11169. // Arraylike of elements (jQuery, arguments, Array)
  11170. if ( typeof qualifier !== "string" ) {
  11171. return jQuery.grep( elements, function( elem ) {
  11172. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11173. } );
  11174. }
  11175. // Filtered directly for both simple and complex selectors
  11176. return jQuery.filter( qualifier, elements, not );
  11177. }
  11178. jQuery.filter = function( expr, elems, not ) {
  11179. var elem = elems[ 0 ];
  11180. if ( not ) {
  11181. expr = ":not(" + expr + ")";
  11182. }
  11183. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11184. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11185. }
  11186. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11187. return elem.nodeType === 1;
  11188. } ) );
  11189. };
  11190. jQuery.fn.extend( {
  11191. find: function( selector ) {
  11192. var i, ret,
  11193. len = this.length,
  11194. self = this;
  11195. if ( typeof selector !== "string" ) {
  11196. return this.pushStack( jQuery( selector ).filter( function() {
  11197. for ( i = 0; i < len; i++ ) {
  11198. if ( jQuery.contains( self[ i ], this ) ) {
  11199. return true;
  11200. }
  11201. }
  11202. } ) );
  11203. }
  11204. ret = this.pushStack( [] );
  11205. for ( i = 0; i < len; i++ ) {
  11206. jQuery.find( selector, self[ i ], ret );
  11207. }
  11208. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11209. },
  11210. filter: function( selector ) {
  11211. return this.pushStack( winnow( this, selector || [], false ) );
  11212. },
  11213. not: function( selector ) {
  11214. return this.pushStack( winnow( this, selector || [], true ) );
  11215. },
  11216. is: function( selector ) {
  11217. return !!winnow(
  11218. this,
  11219. // If this is a positional/relative selector, check membership in the returned set
  11220. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11221. typeof selector === "string" && rneedsContext.test( selector ) ?
  11222. jQuery( selector ) :
  11223. selector || [],
  11224. false
  11225. ).length;
  11226. }
  11227. } );
  11228. // Initialize a jQuery object
  11229. // A central reference to the root jQuery(document)
  11230. var rootjQuery,
  11231. // A simple way to check for HTML strings
  11232. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11233. // Strict HTML recognition (#11290: must start with <)
  11234. // Shortcut simple #id case for speed
  11235. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11236. init = jQuery.fn.init = function( selector, context, root ) {
  11237. var match, elem;
  11238. // HANDLE: $(""), $(null), $(undefined), $(false)
  11239. if ( !selector ) {
  11240. return this;
  11241. }
  11242. // Method init() accepts an alternate rootjQuery
  11243. // so migrate can support jQuery.sub (gh-2101)
  11244. root = root || rootjQuery;
  11245. // Handle HTML strings
  11246. if ( typeof selector === "string" ) {
  11247. if ( selector[ 0 ] === "<" &&
  11248. selector[ selector.length - 1 ] === ">" &&
  11249. selector.length >= 3 ) {
  11250. // Assume that strings that start and end with <> are HTML and skip the regex check
  11251. match = [ null, selector, null ];
  11252. } else {
  11253. match = rquickExpr.exec( selector );
  11254. }
  11255. // Match html or make sure no context is specified for #id
  11256. if ( match && ( match[ 1 ] || !context ) ) {
  11257. // HANDLE: $(html) -> $(array)
  11258. if ( match[ 1 ] ) {
  11259. context = context instanceof jQuery ? context[ 0 ] : context;
  11260. // Option to run scripts is true for back-compat
  11261. // Intentionally let the error be thrown if parseHTML is not present
  11262. jQuery.merge( this, jQuery.parseHTML(
  11263. match[ 1 ],
  11264. context && context.nodeType ? context.ownerDocument || context : document,
  11265. true
  11266. ) );
  11267. // HANDLE: $(html, props)
  11268. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11269. for ( match in context ) {
  11270. // Properties of context are called as methods if possible
  11271. if ( isFunction( this[ match ] ) ) {
  11272. this[ match ]( context[ match ] );
  11273. // ...and otherwise set as attributes
  11274. } else {
  11275. this.attr( match, context[ match ] );
  11276. }
  11277. }
  11278. }
  11279. return this;
  11280. // HANDLE: $(#id)
  11281. } else {
  11282. elem = document.getElementById( match[ 2 ] );
  11283. if ( elem ) {
  11284. // Inject the element directly into the jQuery object
  11285. this[ 0 ] = elem;
  11286. this.length = 1;
  11287. }
  11288. return this;
  11289. }
  11290. // HANDLE: $(expr, $(...))
  11291. } else if ( !context || context.jquery ) {
  11292. return ( context || root ).find( selector );
  11293. // HANDLE: $(expr, context)
  11294. // (which is just equivalent to: $(context).find(expr)
  11295. } else {
  11296. return this.constructor( context ).find( selector );
  11297. }
  11298. // HANDLE: $(DOMElement)
  11299. } else if ( selector.nodeType ) {
  11300. this[ 0 ] = selector;
  11301. this.length = 1;
  11302. return this;
  11303. // HANDLE: $(function)
  11304. // Shortcut for document ready
  11305. } else if ( isFunction( selector ) ) {
  11306. return root.ready !== undefined ?
  11307. root.ready( selector ) :
  11308. // Execute immediately if ready is not present
  11309. selector( jQuery );
  11310. }
  11311. return jQuery.makeArray( selector, this );
  11312. };
  11313. // Give the init function the jQuery prototype for later instantiation
  11314. init.prototype = jQuery.fn;
  11315. // Initialize central reference
  11316. rootjQuery = jQuery( document );
  11317. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11318. // Methods guaranteed to produce a unique set when starting from a unique set
  11319. guaranteedUnique = {
  11320. children: true,
  11321. contents: true,
  11322. next: true,
  11323. prev: true
  11324. };
  11325. jQuery.fn.extend( {
  11326. has: function( target ) {
  11327. var targets = jQuery( target, this ),
  11328. l = targets.length;
  11329. return this.filter( function() {
  11330. var i = 0;
  11331. for ( ; i < l; i++ ) {
  11332. if ( jQuery.contains( this, targets[ i ] ) ) {
  11333. return true;
  11334. }
  11335. }
  11336. } );
  11337. },
  11338. closest: function( selectors, context ) {
  11339. var cur,
  11340. i = 0,
  11341. l = this.length,
  11342. matched = [],
  11343. targets = typeof selectors !== "string" && jQuery( selectors );
  11344. // Positional selectors never match, since there's no _selection_ context
  11345. if ( !rneedsContext.test( selectors ) ) {
  11346. for ( ; i < l; i++ ) {
  11347. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11348. // Always skip document fragments
  11349. if ( cur.nodeType < 11 && ( targets ?
  11350. targets.index( cur ) > -1 :
  11351. // Don't pass non-elements to Sizzle
  11352. cur.nodeType === 1 &&
  11353. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11354. matched.push( cur );
  11355. break;
  11356. }
  11357. }
  11358. }
  11359. }
  11360. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11361. },
  11362. // Determine the position of an element within the set
  11363. index: function( elem ) {
  11364. // No argument, return index in parent
  11365. if ( !elem ) {
  11366. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11367. }
  11368. // Index in selector
  11369. if ( typeof elem === "string" ) {
  11370. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11371. }
  11372. // Locate the position of the desired element
  11373. return indexOf.call( this,
  11374. // If it receives a jQuery object, the first element is used
  11375. elem.jquery ? elem[ 0 ] : elem
  11376. );
  11377. },
  11378. add: function( selector, context ) {
  11379. return this.pushStack(
  11380. jQuery.uniqueSort(
  11381. jQuery.merge( this.get(), jQuery( selector, context ) )
  11382. )
  11383. );
  11384. },
  11385. addBack: function( selector ) {
  11386. return this.add( selector == null ?
  11387. this.prevObject : this.prevObject.filter( selector )
  11388. );
  11389. }
  11390. } );
  11391. function sibling( cur, dir ) {
  11392. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11393. return cur;
  11394. }
  11395. jQuery.each( {
  11396. parent: function( elem ) {
  11397. var parent = elem.parentNode;
  11398. return parent && parent.nodeType !== 11 ? parent : null;
  11399. },
  11400. parents: function( elem ) {
  11401. return dir( elem, "parentNode" );
  11402. },
  11403. parentsUntil: function( elem, i, until ) {
  11404. return dir( elem, "parentNode", until );
  11405. },
  11406. next: function( elem ) {
  11407. return sibling( elem, "nextSibling" );
  11408. },
  11409. prev: function( elem ) {
  11410. return sibling( elem, "previousSibling" );
  11411. },
  11412. nextAll: function( elem ) {
  11413. return dir( elem, "nextSibling" );
  11414. },
  11415. prevAll: function( elem ) {
  11416. return dir( elem, "previousSibling" );
  11417. },
  11418. nextUntil: function( elem, i, until ) {
  11419. return dir( elem, "nextSibling", until );
  11420. },
  11421. prevUntil: function( elem, i, until ) {
  11422. return dir( elem, "previousSibling", until );
  11423. },
  11424. siblings: function( elem ) {
  11425. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11426. },
  11427. children: function( elem ) {
  11428. return siblings( elem.firstChild );
  11429. },
  11430. contents: function( elem ) {
  11431. if ( typeof elem.contentDocument !== "undefined" ) {
  11432. return elem.contentDocument;
  11433. }
  11434. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11435. // Treat the template element as a regular one in browsers that
  11436. // don't support it.
  11437. if ( nodeName( elem, "template" ) ) {
  11438. elem = elem.content || elem;
  11439. }
  11440. return jQuery.merge( [], elem.childNodes );
  11441. }
  11442. }, function( name, fn ) {
  11443. jQuery.fn[ name ] = function( until, selector ) {
  11444. var matched = jQuery.map( this, fn, until );
  11445. if ( name.slice( -5 ) !== "Until" ) {
  11446. selector = until;
  11447. }
  11448. if ( selector && typeof selector === "string" ) {
  11449. matched = jQuery.filter( selector, matched );
  11450. }
  11451. if ( this.length > 1 ) {
  11452. // Remove duplicates
  11453. if ( !guaranteedUnique[ name ] ) {
  11454. jQuery.uniqueSort( matched );
  11455. }
  11456. // Reverse order for parents* and prev-derivatives
  11457. if ( rparentsprev.test( name ) ) {
  11458. matched.reverse();
  11459. }
  11460. }
  11461. return this.pushStack( matched );
  11462. };
  11463. } );
  11464. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11465. // Convert String-formatted options into Object-formatted ones
  11466. function createOptions( options ) {
  11467. var object = {};
  11468. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11469. object[ flag ] = true;
  11470. } );
  11471. return object;
  11472. }
  11473. /*
  11474. * Create a callback list using the following parameters:
  11475. *
  11476. * options: an optional list of space-separated options that will change how
  11477. * the callback list behaves or a more traditional option object
  11478. *
  11479. * By default a callback list will act like an event callback list and can be
  11480. * "fired" multiple times.
  11481. *
  11482. * Possible options:
  11483. *
  11484. * once: will ensure the callback list can only be fired once (like a Deferred)
  11485. *
  11486. * memory: will keep track of previous values and will call any callback added
  11487. * after the list has been fired right away with the latest "memorized"
  11488. * values (like a Deferred)
  11489. *
  11490. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11491. *
  11492. * stopOnFalse: interrupt callings when a callback returns false
  11493. *
  11494. */
  11495. jQuery.Callbacks = function( options ) {
  11496. // Convert options from String-formatted to Object-formatted if needed
  11497. // (we check in cache first)
  11498. options = typeof options === "string" ?
  11499. createOptions( options ) :
  11500. jQuery.extend( {}, options );
  11501. var // Flag to know if list is currently firing
  11502. firing,
  11503. // Last fire value for non-forgettable lists
  11504. memory,
  11505. // Flag to know if list was already fired
  11506. fired,
  11507. // Flag to prevent firing
  11508. locked,
  11509. // Actual callback list
  11510. list = [],
  11511. // Queue of execution data for repeatable lists
  11512. queue = [],
  11513. // Index of currently firing callback (modified by add/remove as needed)
  11514. firingIndex = -1,
  11515. // Fire callbacks
  11516. fire = function() {
  11517. // Enforce single-firing
  11518. locked = locked || options.once;
  11519. // Execute callbacks for all pending executions,
  11520. // respecting firingIndex overrides and runtime changes
  11521. fired = firing = true;
  11522. for ( ; queue.length; firingIndex = -1 ) {
  11523. memory = queue.shift();
  11524. while ( ++firingIndex < list.length ) {
  11525. // Run callback and check for early termination
  11526. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11527. options.stopOnFalse ) {
  11528. // Jump to end and forget the data so .add doesn't re-fire
  11529. firingIndex = list.length;
  11530. memory = false;
  11531. }
  11532. }
  11533. }
  11534. // Forget the data if we're done with it
  11535. if ( !options.memory ) {
  11536. memory = false;
  11537. }
  11538. firing = false;
  11539. // Clean up if we're done firing for good
  11540. if ( locked ) {
  11541. // Keep an empty list if we have data for future add calls
  11542. if ( memory ) {
  11543. list = [];
  11544. // Otherwise, this object is spent
  11545. } else {
  11546. list = "";
  11547. }
  11548. }
  11549. },
  11550. // Actual Callbacks object
  11551. self = {
  11552. // Add a callback or a collection of callbacks to the list
  11553. add: function() {
  11554. if ( list ) {
  11555. // If we have memory from a past run, we should fire after adding
  11556. if ( memory && !firing ) {
  11557. firingIndex = list.length - 1;
  11558. queue.push( memory );
  11559. }
  11560. ( function add( args ) {
  11561. jQuery.each( args, function( _, arg ) {
  11562. if ( isFunction( arg ) ) {
  11563. if ( !options.unique || !self.has( arg ) ) {
  11564. list.push( arg );
  11565. }
  11566. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11567. // Inspect recursively
  11568. add( arg );
  11569. }
  11570. } );
  11571. } )( arguments );
  11572. if ( memory && !firing ) {
  11573. fire();
  11574. }
  11575. }
  11576. return this;
  11577. },
  11578. // Remove a callback from the list
  11579. remove: function() {
  11580. jQuery.each( arguments, function( _, arg ) {
  11581. var index;
  11582. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11583. list.splice( index, 1 );
  11584. // Handle firing indexes
  11585. if ( index <= firingIndex ) {
  11586. firingIndex--;
  11587. }
  11588. }
  11589. } );
  11590. return this;
  11591. },
  11592. // Check if a given callback is in the list.
  11593. // If no argument is given, return whether or not list has callbacks attached.
  11594. has: function( fn ) {
  11595. return fn ?
  11596. jQuery.inArray( fn, list ) > -1 :
  11597. list.length > 0;
  11598. },
  11599. // Remove all callbacks from the list
  11600. empty: function() {
  11601. if ( list ) {
  11602. list = [];
  11603. }
  11604. return this;
  11605. },
  11606. // Disable .fire and .add
  11607. // Abort any current/pending executions
  11608. // Clear all callbacks and values
  11609. disable: function() {
  11610. locked = queue = [];
  11611. list = memory = "";
  11612. return this;
  11613. },
  11614. disabled: function() {
  11615. return !list;
  11616. },
  11617. // Disable .fire
  11618. // Also disable .add unless we have memory (since it would have no effect)
  11619. // Abort any pending executions
  11620. lock: function() {
  11621. locked = queue = [];
  11622. if ( !memory && !firing ) {
  11623. list = memory = "";
  11624. }
  11625. return this;
  11626. },
  11627. locked: function() {
  11628. return !!locked;
  11629. },
  11630. // Call all callbacks with the given context and arguments
  11631. fireWith: function( context, args ) {
  11632. if ( !locked ) {
  11633. args = args || [];
  11634. args = [ context, args.slice ? args.slice() : args ];
  11635. queue.push( args );
  11636. if ( !firing ) {
  11637. fire();
  11638. }
  11639. }
  11640. return this;
  11641. },
  11642. // Call all the callbacks with the given arguments
  11643. fire: function() {
  11644. self.fireWith( this, arguments );
  11645. return this;
  11646. },
  11647. // To know if the callbacks have already been called at least once
  11648. fired: function() {
  11649. return !!fired;
  11650. }
  11651. };
  11652. return self;
  11653. };
  11654. function Identity( v ) {
  11655. return v;
  11656. }
  11657. function Thrower( ex ) {
  11658. throw ex;
  11659. }
  11660. function adoptValue( value, resolve, reject, noValue ) {
  11661. var method;
  11662. try {
  11663. // Check for promise aspect first to privilege synchronous behavior
  11664. if ( value && isFunction( ( method = value.promise ) ) ) {
  11665. method.call( value ).done( resolve ).fail( reject );
  11666. // Other thenables
  11667. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11668. method.call( value, resolve, reject );
  11669. // Other non-thenables
  11670. } else {
  11671. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11672. // * false: [ value ].slice( 0 ) => resolve( value )
  11673. // * true: [ value ].slice( 1 ) => resolve()
  11674. resolve.apply( undefined, [ value ].slice( noValue ) );
  11675. }
  11676. // For Promises/A+, convert exceptions into rejections
  11677. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11678. // Deferred#then to conditionally suppress rejection.
  11679. } catch ( value ) {
  11680. // Support: Android 4.0 only
  11681. // Strict mode functions invoked without .call/.apply get global-object context
  11682. reject.apply( undefined, [ value ] );
  11683. }
  11684. }
  11685. jQuery.extend( {
  11686. Deferred: function( func ) {
  11687. var tuples = [
  11688. // action, add listener, callbacks,
  11689. // ... .then handlers, argument index, [final state]
  11690. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11691. jQuery.Callbacks( "memory" ), 2 ],
  11692. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11693. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11694. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11695. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11696. ],
  11697. state = "pending",
  11698. promise = {
  11699. state: function() {
  11700. return state;
  11701. },
  11702. always: function() {
  11703. deferred.done( arguments ).fail( arguments );
  11704. return this;
  11705. },
  11706. "catch": function( fn ) {
  11707. return promise.then( null, fn );
  11708. },
  11709. // Keep pipe for back-compat
  11710. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11711. var fns = arguments;
  11712. return jQuery.Deferred( function( newDefer ) {
  11713. jQuery.each( tuples, function( i, tuple ) {
  11714. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11715. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11716. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11717. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11718. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11719. deferred[ tuple[ 1 ] ]( function() {
  11720. var returned = fn && fn.apply( this, arguments );
  11721. if ( returned && isFunction( returned.promise ) ) {
  11722. returned.promise()
  11723. .progress( newDefer.notify )
  11724. .done( newDefer.resolve )
  11725. .fail( newDefer.reject );
  11726. } else {
  11727. newDefer[ tuple[ 0 ] + "With" ](
  11728. this,
  11729. fn ? [ returned ] : arguments
  11730. );
  11731. }
  11732. } );
  11733. } );
  11734. fns = null;
  11735. } ).promise();
  11736. },
  11737. then: function( onFulfilled, onRejected, onProgress ) {
  11738. var maxDepth = 0;
  11739. function resolve( depth, deferred, handler, special ) {
  11740. return function() {
  11741. var that = this,
  11742. args = arguments,
  11743. mightThrow = function() {
  11744. var returned, then;
  11745. // Support: Promises/A+ section 2.3.3.3.3
  11746. // https://promisesaplus.com/#point-59
  11747. // Ignore double-resolution attempts
  11748. if ( depth < maxDepth ) {
  11749. return;
  11750. }
  11751. returned = handler.apply( that, args );
  11752. // Support: Promises/A+ section 2.3.1
  11753. // https://promisesaplus.com/#point-48
  11754. if ( returned === deferred.promise() ) {
  11755. throw new TypeError( "Thenable self-resolution" );
  11756. }
  11757. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11758. // https://promisesaplus.com/#point-54
  11759. // https://promisesaplus.com/#point-75
  11760. // Retrieve `then` only once
  11761. then = returned &&
  11762. // Support: Promises/A+ section 2.3.4
  11763. // https://promisesaplus.com/#point-64
  11764. // Only check objects and functions for thenability
  11765. ( typeof returned === "object" ||
  11766. typeof returned === "function" ) &&
  11767. returned.then;
  11768. // Handle a returned thenable
  11769. if ( isFunction( then ) ) {
  11770. // Special processors (notify) just wait for resolution
  11771. if ( special ) {
  11772. then.call(
  11773. returned,
  11774. resolve( maxDepth, deferred, Identity, special ),
  11775. resolve( maxDepth, deferred, Thrower, special )
  11776. );
  11777. // Normal processors (resolve) also hook into progress
  11778. } else {
  11779. // ...and disregard older resolution values
  11780. maxDepth++;
  11781. then.call(
  11782. returned,
  11783. resolve( maxDepth, deferred, Identity, special ),
  11784. resolve( maxDepth, deferred, Thrower, special ),
  11785. resolve( maxDepth, deferred, Identity,
  11786. deferred.notifyWith )
  11787. );
  11788. }
  11789. // Handle all other returned values
  11790. } else {
  11791. // Only substitute handlers pass on context
  11792. // and multiple values (non-spec behavior)
  11793. if ( handler !== Identity ) {
  11794. that = undefined;
  11795. args = [ returned ];
  11796. }
  11797. // Process the value(s)
  11798. // Default process is resolve
  11799. ( special || deferred.resolveWith )( that, args );
  11800. }
  11801. },
  11802. // Only normal processors (resolve) catch and reject exceptions
  11803. process = special ?
  11804. mightThrow :
  11805. function() {
  11806. try {
  11807. mightThrow();
  11808. } catch ( e ) {
  11809. if ( jQuery.Deferred.exceptionHook ) {
  11810. jQuery.Deferred.exceptionHook( e,
  11811. process.stackTrace );
  11812. }
  11813. // Support: Promises/A+ section 2.3.3.3.4.1
  11814. // https://promisesaplus.com/#point-61
  11815. // Ignore post-resolution exceptions
  11816. if ( depth + 1 >= maxDepth ) {
  11817. // Only substitute handlers pass on context
  11818. // and multiple values (non-spec behavior)
  11819. if ( handler !== Thrower ) {
  11820. that = undefined;
  11821. args = [ e ];
  11822. }
  11823. deferred.rejectWith( that, args );
  11824. }
  11825. }
  11826. };
  11827. // Support: Promises/A+ section 2.3.3.3.1
  11828. // https://promisesaplus.com/#point-57
  11829. // Re-resolve promises immediately to dodge false rejection from
  11830. // subsequent errors
  11831. if ( depth ) {
  11832. process();
  11833. } else {
  11834. // Call an optional hook to record the stack, in case of exception
  11835. // since it's otherwise lost when execution goes async
  11836. if ( jQuery.Deferred.getStackHook ) {
  11837. process.stackTrace = jQuery.Deferred.getStackHook();
  11838. }
  11839. window.setTimeout( process );
  11840. }
  11841. };
  11842. }
  11843. return jQuery.Deferred( function( newDefer ) {
  11844. // progress_handlers.add( ... )
  11845. tuples[ 0 ][ 3 ].add(
  11846. resolve(
  11847. 0,
  11848. newDefer,
  11849. isFunction( onProgress ) ?
  11850. onProgress :
  11851. Identity,
  11852. newDefer.notifyWith
  11853. )
  11854. );
  11855. // fulfilled_handlers.add( ... )
  11856. tuples[ 1 ][ 3 ].add(
  11857. resolve(
  11858. 0,
  11859. newDefer,
  11860. isFunction( onFulfilled ) ?
  11861. onFulfilled :
  11862. Identity
  11863. )
  11864. );
  11865. // rejected_handlers.add( ... )
  11866. tuples[ 2 ][ 3 ].add(
  11867. resolve(
  11868. 0,
  11869. newDefer,
  11870. isFunction( onRejected ) ?
  11871. onRejected :
  11872. Thrower
  11873. )
  11874. );
  11875. } ).promise();
  11876. },
  11877. // Get a promise for this deferred
  11878. // If obj is provided, the promise aspect is added to the object
  11879. promise: function( obj ) {
  11880. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11881. }
  11882. },
  11883. deferred = {};
  11884. // Add list-specific methods
  11885. jQuery.each( tuples, function( i, tuple ) {
  11886. var list = tuple[ 2 ],
  11887. stateString = tuple[ 5 ];
  11888. // promise.progress = list.add
  11889. // promise.done = list.add
  11890. // promise.fail = list.add
  11891. promise[ tuple[ 1 ] ] = list.add;
  11892. // Handle state
  11893. if ( stateString ) {
  11894. list.add(
  11895. function() {
  11896. // state = "resolved" (i.e., fulfilled)
  11897. // state = "rejected"
  11898. state = stateString;
  11899. },
  11900. // rejected_callbacks.disable
  11901. // fulfilled_callbacks.disable
  11902. tuples[ 3 - i ][ 2 ].disable,
  11903. // rejected_handlers.disable
  11904. // fulfilled_handlers.disable
  11905. tuples[ 3 - i ][ 3 ].disable,
  11906. // progress_callbacks.lock
  11907. tuples[ 0 ][ 2 ].lock,
  11908. // progress_handlers.lock
  11909. tuples[ 0 ][ 3 ].lock
  11910. );
  11911. }
  11912. // progress_handlers.fire
  11913. // fulfilled_handlers.fire
  11914. // rejected_handlers.fire
  11915. list.add( tuple[ 3 ].fire );
  11916. // deferred.notify = function() { deferred.notifyWith(...) }
  11917. // deferred.resolve = function() { deferred.resolveWith(...) }
  11918. // deferred.reject = function() { deferred.rejectWith(...) }
  11919. deferred[ tuple[ 0 ] ] = function() {
  11920. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11921. return this;
  11922. };
  11923. // deferred.notifyWith = list.fireWith
  11924. // deferred.resolveWith = list.fireWith
  11925. // deferred.rejectWith = list.fireWith
  11926. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11927. } );
  11928. // Make the deferred a promise
  11929. promise.promise( deferred );
  11930. // Call given func if any
  11931. if ( func ) {
  11932. func.call( deferred, deferred );
  11933. }
  11934. // All done!
  11935. return deferred;
  11936. },
  11937. // Deferred helper
  11938. when: function( singleValue ) {
  11939. var
  11940. // count of uncompleted subordinates
  11941. remaining = arguments.length,
  11942. // count of unprocessed arguments
  11943. i = remaining,
  11944. // subordinate fulfillment data
  11945. resolveContexts = Array( i ),
  11946. resolveValues = slice.call( arguments ),
  11947. // the master Deferred
  11948. master = jQuery.Deferred(),
  11949. // subordinate callback factory
  11950. updateFunc = function( i ) {
  11951. return function( value ) {
  11952. resolveContexts[ i ] = this;
  11953. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11954. if ( !( --remaining ) ) {
  11955. master.resolveWith( resolveContexts, resolveValues );
  11956. }
  11957. };
  11958. };
  11959. // Single- and empty arguments are adopted like Promise.resolve
  11960. if ( remaining <= 1 ) {
  11961. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11962. !remaining );
  11963. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11964. if ( master.state() === "pending" ||
  11965. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11966. return master.then();
  11967. }
  11968. }
  11969. // Multiple arguments are aggregated like Promise.all array elements
  11970. while ( i-- ) {
  11971. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11972. }
  11973. return master.promise();
  11974. }
  11975. } );
  11976. // These usually indicate a programmer mistake during development,
  11977. // warn about them ASAP rather than swallowing them by default.
  11978. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11979. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11980. // Support: IE 8 - 9 only
  11981. // Console exists when dev tools are open, which can happen at any time
  11982. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11983. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11984. }
  11985. };
  11986. jQuery.readyException = function( error ) {
  11987. window.setTimeout( function() {
  11988. throw error;
  11989. } );
  11990. };
  11991. // The deferred used on DOM ready
  11992. var readyList = jQuery.Deferred();
  11993. jQuery.fn.ready = function( fn ) {
  11994. readyList
  11995. .then( fn )
  11996. // Wrap jQuery.readyException in a function so that the lookup
  11997. // happens at the time of error handling instead of callback
  11998. // registration.
  11999. .catch( function( error ) {
  12000. jQuery.readyException( error );
  12001. } );
  12002. return this;
  12003. };
  12004. jQuery.extend( {
  12005. // Is the DOM ready to be used? Set to true once it occurs.
  12006. isReady: false,
  12007. // A counter to track how many items to wait for before
  12008. // the ready event fires. See #6781
  12009. readyWait: 1,
  12010. // Handle when the DOM is ready
  12011. ready: function( wait ) {
  12012. // Abort if there are pending holds or we're already ready
  12013. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12014. return;
  12015. }
  12016. // Remember that the DOM is ready
  12017. jQuery.isReady = true;
  12018. // If a normal DOM Ready event fired, decrement, and wait if need be
  12019. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12020. return;
  12021. }
  12022. // If there are functions bound, to execute
  12023. readyList.resolveWith( document, [ jQuery ] );
  12024. }
  12025. } );
  12026. jQuery.ready.then = readyList.then;
  12027. // The ready event handler and self cleanup method
  12028. function completed() {
  12029. document.removeEventListener( "DOMContentLoaded", completed );
  12030. window.removeEventListener( "load", completed );
  12031. jQuery.ready();
  12032. }
  12033. // Catch cases where $(document).ready() is called
  12034. // after the browser event has already occurred.
  12035. // Support: IE <=9 - 10 only
  12036. // Older IE sometimes signals "interactive" too soon
  12037. if ( document.readyState === "complete" ||
  12038. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12039. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12040. window.setTimeout( jQuery.ready );
  12041. } else {
  12042. // Use the handy event callback
  12043. document.addEventListener( "DOMContentLoaded", completed );
  12044. // A fallback to window.onload, that will always work
  12045. window.addEventListener( "load", completed );
  12046. }
  12047. // Multifunctional method to get and set values of a collection
  12048. // The value/s can optionally be executed if it's a function
  12049. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12050. var i = 0,
  12051. len = elems.length,
  12052. bulk = key == null;
  12053. // Sets many values
  12054. if ( toType( key ) === "object" ) {
  12055. chainable = true;
  12056. for ( i in key ) {
  12057. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12058. }
  12059. // Sets one value
  12060. } else if ( value !== undefined ) {
  12061. chainable = true;
  12062. if ( !isFunction( value ) ) {
  12063. raw = true;
  12064. }
  12065. if ( bulk ) {
  12066. // Bulk operations run against the entire set
  12067. if ( raw ) {
  12068. fn.call( elems, value );
  12069. fn = null;
  12070. // ...except when executing function values
  12071. } else {
  12072. bulk = fn;
  12073. fn = function( elem, key, value ) {
  12074. return bulk.call( jQuery( elem ), value );
  12075. };
  12076. }
  12077. }
  12078. if ( fn ) {
  12079. for ( ; i < len; i++ ) {
  12080. fn(
  12081. elems[ i ], key, raw ?
  12082. value :
  12083. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12084. );
  12085. }
  12086. }
  12087. }
  12088. if ( chainable ) {
  12089. return elems;
  12090. }
  12091. // Gets
  12092. if ( bulk ) {
  12093. return fn.call( elems );
  12094. }
  12095. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12096. };
  12097. // Matches dashed string for camelizing
  12098. var rmsPrefix = /^-ms-/,
  12099. rdashAlpha = /-([a-z])/g;
  12100. // Used by camelCase as callback to replace()
  12101. function fcamelCase( all, letter ) {
  12102. return letter.toUpperCase();
  12103. }
  12104. // Convert dashed to camelCase; used by the css and data modules
  12105. // Support: IE <=9 - 11, Edge 12 - 15
  12106. // Microsoft forgot to hump their vendor prefix (#9572)
  12107. function camelCase( string ) {
  12108. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12109. }
  12110. var acceptData = function( owner ) {
  12111. // Accepts only:
  12112. // - Node
  12113. // - Node.ELEMENT_NODE
  12114. // - Node.DOCUMENT_NODE
  12115. // - Object
  12116. // - Any
  12117. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12118. };
  12119. function Data() {
  12120. this.expando = jQuery.expando + Data.uid++;
  12121. }
  12122. Data.uid = 1;
  12123. Data.prototype = {
  12124. cache: function( owner ) {
  12125. // Check if the owner object already has a cache
  12126. var value = owner[ this.expando ];
  12127. // If not, create one
  12128. if ( !value ) {
  12129. value = {};
  12130. // We can accept data for non-element nodes in modern browsers,
  12131. // but we should not, see #8335.
  12132. // Always return an empty object.
  12133. if ( acceptData( owner ) ) {
  12134. // If it is a node unlikely to be stringify-ed or looped over
  12135. // use plain assignment
  12136. if ( owner.nodeType ) {
  12137. owner[ this.expando ] = value;
  12138. // Otherwise secure it in a non-enumerable property
  12139. // configurable must be true to allow the property to be
  12140. // deleted when data is removed
  12141. } else {
  12142. Object.defineProperty( owner, this.expando, {
  12143. value: value,
  12144. configurable: true
  12145. } );
  12146. }
  12147. }
  12148. }
  12149. return value;
  12150. },
  12151. set: function( owner, data, value ) {
  12152. var prop,
  12153. cache = this.cache( owner );
  12154. // Handle: [ owner, key, value ] args
  12155. // Always use camelCase key (gh-2257)
  12156. if ( typeof data === "string" ) {
  12157. cache[ camelCase( data ) ] = value;
  12158. // Handle: [ owner, { properties } ] args
  12159. } else {
  12160. // Copy the properties one-by-one to the cache object
  12161. for ( prop in data ) {
  12162. cache[ camelCase( prop ) ] = data[ prop ];
  12163. }
  12164. }
  12165. return cache;
  12166. },
  12167. get: function( owner, key ) {
  12168. return key === undefined ?
  12169. this.cache( owner ) :
  12170. // Always use camelCase key (gh-2257)
  12171. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12172. },
  12173. access: function( owner, key, value ) {
  12174. // In cases where either:
  12175. //
  12176. // 1. No key was specified
  12177. // 2. A string key was specified, but no value provided
  12178. //
  12179. // Take the "read" path and allow the get method to determine
  12180. // which value to return, respectively either:
  12181. //
  12182. // 1. The entire cache object
  12183. // 2. The data stored at the key
  12184. //
  12185. if ( key === undefined ||
  12186. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12187. return this.get( owner, key );
  12188. }
  12189. // When the key is not a string, or both a key and value
  12190. // are specified, set or extend (existing objects) with either:
  12191. //
  12192. // 1. An object of properties
  12193. // 2. A key and value
  12194. //
  12195. this.set( owner, key, value );
  12196. // Since the "set" path can have two possible entry points
  12197. // return the expected data based on which path was taken[*]
  12198. return value !== undefined ? value : key;
  12199. },
  12200. remove: function( owner, key ) {
  12201. var i,
  12202. cache = owner[ this.expando ];
  12203. if ( cache === undefined ) {
  12204. return;
  12205. }
  12206. if ( key !== undefined ) {
  12207. // Support array or space separated string of keys
  12208. if ( Array.isArray( key ) ) {
  12209. // If key is an array of keys...
  12210. // We always set camelCase keys, so remove that.
  12211. key = key.map( camelCase );
  12212. } else {
  12213. key = camelCase( key );
  12214. // If a key with the spaces exists, use it.
  12215. // Otherwise, create an array by matching non-whitespace
  12216. key = key in cache ?
  12217. [ key ] :
  12218. ( key.match( rnothtmlwhite ) || [] );
  12219. }
  12220. i = key.length;
  12221. while ( i-- ) {
  12222. delete cache[ key[ i ] ];
  12223. }
  12224. }
  12225. // Remove the expando if there's no more data
  12226. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12227. // Support: Chrome <=35 - 45
  12228. // Webkit & Blink performance suffers when deleting properties
  12229. // from DOM nodes, so set to undefined instead
  12230. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12231. if ( owner.nodeType ) {
  12232. owner[ this.expando ] = undefined;
  12233. } else {
  12234. delete owner[ this.expando ];
  12235. }
  12236. }
  12237. },
  12238. hasData: function( owner ) {
  12239. var cache = owner[ this.expando ];
  12240. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12241. }
  12242. };
  12243. var dataPriv = new Data();
  12244. var dataUser = new Data();
  12245. // Implementation Summary
  12246. //
  12247. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12248. // 2. Improve the module's maintainability by reducing the storage
  12249. // paths to a single mechanism.
  12250. // 3. Use the same single mechanism to support "private" and "user" data.
  12251. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12252. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12253. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12254. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12255. rmultiDash = /[A-Z]/g;
  12256. function getData( data ) {
  12257. if ( data === "true" ) {
  12258. return true;
  12259. }
  12260. if ( data === "false" ) {
  12261. return false;
  12262. }
  12263. if ( data === "null" ) {
  12264. return null;
  12265. }
  12266. // Only convert to a number if it doesn't change the string
  12267. if ( data === +data + "" ) {
  12268. return +data;
  12269. }
  12270. if ( rbrace.test( data ) ) {
  12271. return JSON.parse( data );
  12272. }
  12273. return data;
  12274. }
  12275. function dataAttr( elem, key, data ) {
  12276. var name;
  12277. // If nothing was found internally, try to fetch any
  12278. // data from the HTML5 data-* attribute
  12279. if ( data === undefined && elem.nodeType === 1 ) {
  12280. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12281. data = elem.getAttribute( name );
  12282. if ( typeof data === "string" ) {
  12283. try {
  12284. data = getData( data );
  12285. } catch ( e ) {}
  12286. // Make sure we set the data so it isn't changed later
  12287. dataUser.set( elem, key, data );
  12288. } else {
  12289. data = undefined;
  12290. }
  12291. }
  12292. return data;
  12293. }
  12294. jQuery.extend( {
  12295. hasData: function( elem ) {
  12296. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12297. },
  12298. data: function( elem, name, data ) {
  12299. return dataUser.access( elem, name, data );
  12300. },
  12301. removeData: function( elem, name ) {
  12302. dataUser.remove( elem, name );
  12303. },
  12304. // TODO: Now that all calls to _data and _removeData have been replaced
  12305. // with direct calls to dataPriv methods, these can be deprecated.
  12306. _data: function( elem, name, data ) {
  12307. return dataPriv.access( elem, name, data );
  12308. },
  12309. _removeData: function( elem, name ) {
  12310. dataPriv.remove( elem, name );
  12311. }
  12312. } );
  12313. jQuery.fn.extend( {
  12314. data: function( key, value ) {
  12315. var i, name, data,
  12316. elem = this[ 0 ],
  12317. attrs = elem && elem.attributes;
  12318. // Gets all values
  12319. if ( key === undefined ) {
  12320. if ( this.length ) {
  12321. data = dataUser.get( elem );
  12322. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12323. i = attrs.length;
  12324. while ( i-- ) {
  12325. // Support: IE 11 only
  12326. // The attrs elements can be null (#14894)
  12327. if ( attrs[ i ] ) {
  12328. name = attrs[ i ].name;
  12329. if ( name.indexOf( "data-" ) === 0 ) {
  12330. name = camelCase( name.slice( 5 ) );
  12331. dataAttr( elem, name, data[ name ] );
  12332. }
  12333. }
  12334. }
  12335. dataPriv.set( elem, "hasDataAttrs", true );
  12336. }
  12337. }
  12338. return data;
  12339. }
  12340. // Sets multiple values
  12341. if ( typeof key === "object" ) {
  12342. return this.each( function() {
  12343. dataUser.set( this, key );
  12344. } );
  12345. }
  12346. return access( this, function( value ) {
  12347. var data;
  12348. // The calling jQuery object (element matches) is not empty
  12349. // (and therefore has an element appears at this[ 0 ]) and the
  12350. // `value` parameter was not undefined. An empty jQuery object
  12351. // will result in `undefined` for elem = this[ 0 ] which will
  12352. // throw an exception if an attempt to read a data cache is made.
  12353. if ( elem && value === undefined ) {
  12354. // Attempt to get data from the cache
  12355. // The key will always be camelCased in Data
  12356. data = dataUser.get( elem, key );
  12357. if ( data !== undefined ) {
  12358. return data;
  12359. }
  12360. // Attempt to "discover" the data in
  12361. // HTML5 custom data-* attrs
  12362. data = dataAttr( elem, key );
  12363. if ( data !== undefined ) {
  12364. return data;
  12365. }
  12366. // We tried really hard, but the data doesn't exist.
  12367. return;
  12368. }
  12369. // Set the data...
  12370. this.each( function() {
  12371. // We always store the camelCased key
  12372. dataUser.set( this, key, value );
  12373. } );
  12374. }, null, value, arguments.length > 1, null, true );
  12375. },
  12376. removeData: function( key ) {
  12377. return this.each( function() {
  12378. dataUser.remove( this, key );
  12379. } );
  12380. }
  12381. } );
  12382. jQuery.extend( {
  12383. queue: function( elem, type, data ) {
  12384. var queue;
  12385. if ( elem ) {
  12386. type = ( type || "fx" ) + "queue";
  12387. queue = dataPriv.get( elem, type );
  12388. // Speed up dequeue by getting out quickly if this is just a lookup
  12389. if ( data ) {
  12390. if ( !queue || Array.isArray( data ) ) {
  12391. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12392. } else {
  12393. queue.push( data );
  12394. }
  12395. }
  12396. return queue || [];
  12397. }
  12398. },
  12399. dequeue: function( elem, type ) {
  12400. type = type || "fx";
  12401. var queue = jQuery.queue( elem, type ),
  12402. startLength = queue.length,
  12403. fn = queue.shift(),
  12404. hooks = jQuery._queueHooks( elem, type ),
  12405. next = function() {
  12406. jQuery.dequeue( elem, type );
  12407. };
  12408. // If the fx queue is dequeued, always remove the progress sentinel
  12409. if ( fn === "inprogress" ) {
  12410. fn = queue.shift();
  12411. startLength--;
  12412. }
  12413. if ( fn ) {
  12414. // Add a progress sentinel to prevent the fx queue from being
  12415. // automatically dequeued
  12416. if ( type === "fx" ) {
  12417. queue.unshift( "inprogress" );
  12418. }
  12419. // Clear up the last queue stop function
  12420. delete hooks.stop;
  12421. fn.call( elem, next, hooks );
  12422. }
  12423. if ( !startLength && hooks ) {
  12424. hooks.empty.fire();
  12425. }
  12426. },
  12427. // Not public - generate a queueHooks object, or return the current one
  12428. _queueHooks: function( elem, type ) {
  12429. var key = type + "queueHooks";
  12430. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12431. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12432. dataPriv.remove( elem, [ type + "queue", key ] );
  12433. } )
  12434. } );
  12435. }
  12436. } );
  12437. jQuery.fn.extend( {
  12438. queue: function( type, data ) {
  12439. var setter = 2;
  12440. if ( typeof type !== "string" ) {
  12441. data = type;
  12442. type = "fx";
  12443. setter--;
  12444. }
  12445. if ( arguments.length < setter ) {
  12446. return jQuery.queue( this[ 0 ], type );
  12447. }
  12448. return data === undefined ?
  12449. this :
  12450. this.each( function() {
  12451. var queue = jQuery.queue( this, type, data );
  12452. // Ensure a hooks for this queue
  12453. jQuery._queueHooks( this, type );
  12454. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12455. jQuery.dequeue( this, type );
  12456. }
  12457. } );
  12458. },
  12459. dequeue: function( type ) {
  12460. return this.each( function() {
  12461. jQuery.dequeue( this, type );
  12462. } );
  12463. },
  12464. clearQueue: function( type ) {
  12465. return this.queue( type || "fx", [] );
  12466. },
  12467. // Get a promise resolved when queues of a certain type
  12468. // are emptied (fx is the type by default)
  12469. promise: function( type, obj ) {
  12470. var tmp,
  12471. count = 1,
  12472. defer = jQuery.Deferred(),
  12473. elements = this,
  12474. i = this.length,
  12475. resolve = function() {
  12476. if ( !( --count ) ) {
  12477. defer.resolveWith( elements, [ elements ] );
  12478. }
  12479. };
  12480. if ( typeof type !== "string" ) {
  12481. obj = type;
  12482. type = undefined;
  12483. }
  12484. type = type || "fx";
  12485. while ( i-- ) {
  12486. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12487. if ( tmp && tmp.empty ) {
  12488. count++;
  12489. tmp.empty.add( resolve );
  12490. }
  12491. }
  12492. resolve();
  12493. return defer.promise( obj );
  12494. }
  12495. } );
  12496. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12497. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12498. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12499. var documentElement = document.documentElement;
  12500. var isAttached = function( elem ) {
  12501. return jQuery.contains( elem.ownerDocument, elem );
  12502. },
  12503. composed = { composed: true };
  12504. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12505. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12506. // Support: iOS 10.0-10.2 only
  12507. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12508. // leading to errors. We need to check for `getRootNode`.
  12509. if ( documentElement.getRootNode ) {
  12510. isAttached = function( elem ) {
  12511. return jQuery.contains( elem.ownerDocument, elem ) ||
  12512. elem.getRootNode( composed ) === elem.ownerDocument;
  12513. };
  12514. }
  12515. var isHiddenWithinTree = function( elem, el ) {
  12516. // isHiddenWithinTree might be called from jQuery#filter function;
  12517. // in that case, element will be second argument
  12518. elem = el || elem;
  12519. // Inline style trumps all
  12520. return elem.style.display === "none" ||
  12521. elem.style.display === "" &&
  12522. // Otherwise, check computed style
  12523. // Support: Firefox <=43 - 45
  12524. // Disconnected elements can have computed display: none, so first confirm that elem is
  12525. // in the document.
  12526. isAttached( elem ) &&
  12527. jQuery.css( elem, "display" ) === "none";
  12528. };
  12529. var swap = function( elem, options, callback, args ) {
  12530. var ret, name,
  12531. old = {};
  12532. // Remember the old values, and insert the new ones
  12533. for ( name in options ) {
  12534. old[ name ] = elem.style[ name ];
  12535. elem.style[ name ] = options[ name ];
  12536. }
  12537. ret = callback.apply( elem, args || [] );
  12538. // Revert the old values
  12539. for ( name in options ) {
  12540. elem.style[ name ] = old[ name ];
  12541. }
  12542. return ret;
  12543. };
  12544. function adjustCSS( elem, prop, valueParts, tween ) {
  12545. var adjusted, scale,
  12546. maxIterations = 20,
  12547. currentValue = tween ?
  12548. function() {
  12549. return tween.cur();
  12550. } :
  12551. function() {
  12552. return jQuery.css( elem, prop, "" );
  12553. },
  12554. initial = currentValue(),
  12555. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12556. // Starting value computation is required for potential unit mismatches
  12557. initialInUnit = elem.nodeType &&
  12558. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12559. rcssNum.exec( jQuery.css( elem, prop ) );
  12560. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12561. // Support: Firefox <=54
  12562. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12563. initial = initial / 2;
  12564. // Trust units reported by jQuery.css
  12565. unit = unit || initialInUnit[ 3 ];
  12566. // Iteratively approximate from a nonzero starting point
  12567. initialInUnit = +initial || 1;
  12568. while ( maxIterations-- ) {
  12569. // Evaluate and update our best guess (doubling guesses that zero out).
  12570. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12571. jQuery.style( elem, prop, initialInUnit + unit );
  12572. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12573. maxIterations = 0;
  12574. }
  12575. initialInUnit = initialInUnit / scale;
  12576. }
  12577. initialInUnit = initialInUnit * 2;
  12578. jQuery.style( elem, prop, initialInUnit + unit );
  12579. // Make sure we update the tween properties later on
  12580. valueParts = valueParts || [];
  12581. }
  12582. if ( valueParts ) {
  12583. initialInUnit = +initialInUnit || +initial || 0;
  12584. // Apply relative offset (+=/-=) if specified
  12585. adjusted = valueParts[ 1 ] ?
  12586. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12587. +valueParts[ 2 ];
  12588. if ( tween ) {
  12589. tween.unit = unit;
  12590. tween.start = initialInUnit;
  12591. tween.end = adjusted;
  12592. }
  12593. }
  12594. return adjusted;
  12595. }
  12596. var defaultDisplayMap = {};
  12597. function getDefaultDisplay( elem ) {
  12598. var temp,
  12599. doc = elem.ownerDocument,
  12600. nodeName = elem.nodeName,
  12601. display = defaultDisplayMap[ nodeName ];
  12602. if ( display ) {
  12603. return display;
  12604. }
  12605. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12606. display = jQuery.css( temp, "display" );
  12607. temp.parentNode.removeChild( temp );
  12608. if ( display === "none" ) {
  12609. display = "block";
  12610. }
  12611. defaultDisplayMap[ nodeName ] = display;
  12612. return display;
  12613. }
  12614. function showHide( elements, show ) {
  12615. var display, elem,
  12616. values = [],
  12617. index = 0,
  12618. length = elements.length;
  12619. // Determine new display value for elements that need to change
  12620. for ( ; index < length; index++ ) {
  12621. elem = elements[ index ];
  12622. if ( !elem.style ) {
  12623. continue;
  12624. }
  12625. display = elem.style.display;
  12626. if ( show ) {
  12627. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12628. // check is required in this first loop unless we have a nonempty display value (either
  12629. // inline or about-to-be-restored)
  12630. if ( display === "none" ) {
  12631. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12632. if ( !values[ index ] ) {
  12633. elem.style.display = "";
  12634. }
  12635. }
  12636. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12637. values[ index ] = getDefaultDisplay( elem );
  12638. }
  12639. } else {
  12640. if ( display !== "none" ) {
  12641. values[ index ] = "none";
  12642. // Remember what we're overwriting
  12643. dataPriv.set( elem, "display", display );
  12644. }
  12645. }
  12646. }
  12647. // Set the display of the elements in a second loop to avoid constant reflow
  12648. for ( index = 0; index < length; index++ ) {
  12649. if ( values[ index ] != null ) {
  12650. elements[ index ].style.display = values[ index ];
  12651. }
  12652. }
  12653. return elements;
  12654. }
  12655. jQuery.fn.extend( {
  12656. show: function() {
  12657. return showHide( this, true );
  12658. },
  12659. hide: function() {
  12660. return showHide( this );
  12661. },
  12662. toggle: function( state ) {
  12663. if ( typeof state === "boolean" ) {
  12664. return state ? this.show() : this.hide();
  12665. }
  12666. return this.each( function() {
  12667. if ( isHiddenWithinTree( this ) ) {
  12668. jQuery( this ).show();
  12669. } else {
  12670. jQuery( this ).hide();
  12671. }
  12672. } );
  12673. }
  12674. } );
  12675. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12676. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12677. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12678. // We have to close these tags to support XHTML (#13200)
  12679. var wrapMap = {
  12680. // Support: IE <=9 only
  12681. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12682. // XHTML parsers do not magically insert elements in the
  12683. // same way that tag soup parsers do. So we cannot shorten
  12684. // this by omitting <tbody> or other required elements.
  12685. thead: [ 1, "<table>", "</table>" ],
  12686. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12687. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12688. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12689. _default: [ 0, "", "" ]
  12690. };
  12691. // Support: IE <=9 only
  12692. wrapMap.optgroup = wrapMap.option;
  12693. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12694. wrapMap.th = wrapMap.td;
  12695. function getAll( context, tag ) {
  12696. // Support: IE <=9 - 11 only
  12697. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12698. var ret;
  12699. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12700. ret = context.getElementsByTagName( tag || "*" );
  12701. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12702. ret = context.querySelectorAll( tag || "*" );
  12703. } else {
  12704. ret = [];
  12705. }
  12706. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12707. return jQuery.merge( [ context ], ret );
  12708. }
  12709. return ret;
  12710. }
  12711. // Mark scripts as having already been evaluated
  12712. function setGlobalEval( elems, refElements ) {
  12713. var i = 0,
  12714. l = elems.length;
  12715. for ( ; i < l; i++ ) {
  12716. dataPriv.set(
  12717. elems[ i ],
  12718. "globalEval",
  12719. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12720. );
  12721. }
  12722. }
  12723. var rhtml = /<|&#?\w+;/;
  12724. function buildFragment( elems, context, scripts, selection, ignored ) {
  12725. var elem, tmp, tag, wrap, attached, j,
  12726. fragment = context.createDocumentFragment(),
  12727. nodes = [],
  12728. i = 0,
  12729. l = elems.length;
  12730. for ( ; i < l; i++ ) {
  12731. elem = elems[ i ];
  12732. if ( elem || elem === 0 ) {
  12733. // Add nodes directly
  12734. if ( toType( elem ) === "object" ) {
  12735. // Support: Android <=4.0 only, PhantomJS 1 only
  12736. // push.apply(_, arraylike) throws on ancient WebKit
  12737. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12738. // Convert non-html into a text node
  12739. } else if ( !rhtml.test( elem ) ) {
  12740. nodes.push( context.createTextNode( elem ) );
  12741. // Convert html into DOM nodes
  12742. } else {
  12743. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12744. // Deserialize a standard representation
  12745. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12746. wrap = wrapMap[ tag ] || wrapMap._default;
  12747. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12748. // Descend through wrappers to the right content
  12749. j = wrap[ 0 ];
  12750. while ( j-- ) {
  12751. tmp = tmp.lastChild;
  12752. }
  12753. // Support: Android <=4.0 only, PhantomJS 1 only
  12754. // push.apply(_, arraylike) throws on ancient WebKit
  12755. jQuery.merge( nodes, tmp.childNodes );
  12756. // Remember the top-level container
  12757. tmp = fragment.firstChild;
  12758. // Ensure the created nodes are orphaned (#12392)
  12759. tmp.textContent = "";
  12760. }
  12761. }
  12762. }
  12763. // Remove wrapper from fragment
  12764. fragment.textContent = "";
  12765. i = 0;
  12766. while ( ( elem = nodes[ i++ ] ) ) {
  12767. // Skip elements already in the context collection (trac-4087)
  12768. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12769. if ( ignored ) {
  12770. ignored.push( elem );
  12771. }
  12772. continue;
  12773. }
  12774. attached = isAttached( elem );
  12775. // Append to fragment
  12776. tmp = getAll( fragment.appendChild( elem ), "script" );
  12777. // Preserve script evaluation history
  12778. if ( attached ) {
  12779. setGlobalEval( tmp );
  12780. }
  12781. // Capture executables
  12782. if ( scripts ) {
  12783. j = 0;
  12784. while ( ( elem = tmp[ j++ ] ) ) {
  12785. if ( rscriptType.test( elem.type || "" ) ) {
  12786. scripts.push( elem );
  12787. }
  12788. }
  12789. }
  12790. }
  12791. return fragment;
  12792. }
  12793. ( function() {
  12794. var fragment = document.createDocumentFragment(),
  12795. div = fragment.appendChild( document.createElement( "div" ) ),
  12796. input = document.createElement( "input" );
  12797. // Support: Android 4.0 - 4.3 only
  12798. // Check state lost if the name is set (#11217)
  12799. // Support: Windows Web Apps (WWA)
  12800. // `name` and `type` must use .setAttribute for WWA (#14901)
  12801. input.setAttribute( "type", "radio" );
  12802. input.setAttribute( "checked", "checked" );
  12803. input.setAttribute( "name", "t" );
  12804. div.appendChild( input );
  12805. // Support: Android <=4.1 only
  12806. // Older WebKit doesn't clone checked state correctly in fragments
  12807. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12808. // Support: IE <=11 only
  12809. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12810. div.innerHTML = "<textarea>x</textarea>";
  12811. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12812. } )();
  12813. var
  12814. rkeyEvent = /^key/,
  12815. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12816. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12817. function returnTrue() {
  12818. return true;
  12819. }
  12820. function returnFalse() {
  12821. return false;
  12822. }
  12823. // Support: IE <=9 - 11+
  12824. // focus() and blur() are asynchronous, except when they are no-op.
  12825. // So expect focus to be synchronous when the element is already active,
  12826. // and blur to be synchronous when the element is not already active.
  12827. // (focus and blur are always synchronous in other supported browsers,
  12828. // this just defines when we can count on it).
  12829. function expectSync( elem, type ) {
  12830. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12831. }
  12832. // Support: IE <=9 only
  12833. // Accessing document.activeElement can throw unexpectedly
  12834. // https://bugs.jquery.com/ticket/13393
  12835. function safeActiveElement() {
  12836. try {
  12837. return document.activeElement;
  12838. } catch ( err ) { }
  12839. }
  12840. function on( elem, types, selector, data, fn, one ) {
  12841. var origFn, type;
  12842. // Types can be a map of types/handlers
  12843. if ( typeof types === "object" ) {
  12844. // ( types-Object, selector, data )
  12845. if ( typeof selector !== "string" ) {
  12846. // ( types-Object, data )
  12847. data = data || selector;
  12848. selector = undefined;
  12849. }
  12850. for ( type in types ) {
  12851. on( elem, type, selector, data, types[ type ], one );
  12852. }
  12853. return elem;
  12854. }
  12855. if ( data == null && fn == null ) {
  12856. // ( types, fn )
  12857. fn = selector;
  12858. data = selector = undefined;
  12859. } else if ( fn == null ) {
  12860. if ( typeof selector === "string" ) {
  12861. // ( types, selector, fn )
  12862. fn = data;
  12863. data = undefined;
  12864. } else {
  12865. // ( types, data, fn )
  12866. fn = data;
  12867. data = selector;
  12868. selector = undefined;
  12869. }
  12870. }
  12871. if ( fn === false ) {
  12872. fn = returnFalse;
  12873. } else if ( !fn ) {
  12874. return elem;
  12875. }
  12876. if ( one === 1 ) {
  12877. origFn = fn;
  12878. fn = function( event ) {
  12879. // Can use an empty set, since event contains the info
  12880. jQuery().off( event );
  12881. return origFn.apply( this, arguments );
  12882. };
  12883. // Use same guid so caller can remove using origFn
  12884. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12885. }
  12886. return elem.each( function() {
  12887. jQuery.event.add( this, types, fn, data, selector );
  12888. } );
  12889. }
  12890. /*
  12891. * Helper functions for managing events -- not part of the public interface.
  12892. * Props to Dean Edwards' addEvent library for many of the ideas.
  12893. */
  12894. jQuery.event = {
  12895. global: {},
  12896. add: function( elem, types, handler, data, selector ) {
  12897. var handleObjIn, eventHandle, tmp,
  12898. events, t, handleObj,
  12899. special, handlers, type, namespaces, origType,
  12900. elemData = dataPriv.get( elem );
  12901. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12902. if ( !elemData ) {
  12903. return;
  12904. }
  12905. // Caller can pass in an object of custom data in lieu of the handler
  12906. if ( handler.handler ) {
  12907. handleObjIn = handler;
  12908. handler = handleObjIn.handler;
  12909. selector = handleObjIn.selector;
  12910. }
  12911. // Ensure that invalid selectors throw exceptions at attach time
  12912. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12913. if ( selector ) {
  12914. jQuery.find.matchesSelector( documentElement, selector );
  12915. }
  12916. // Make sure that the handler has a unique ID, used to find/remove it later
  12917. if ( !handler.guid ) {
  12918. handler.guid = jQuery.guid++;
  12919. }
  12920. // Init the element's event structure and main handler, if this is the first
  12921. if ( !( events = elemData.events ) ) {
  12922. events = elemData.events = {};
  12923. }
  12924. if ( !( eventHandle = elemData.handle ) ) {
  12925. eventHandle = elemData.handle = function( e ) {
  12926. // Discard the second event of a jQuery.event.trigger() and
  12927. // when an event is called after a page has unloaded
  12928. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12929. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12930. };
  12931. }
  12932. // Handle multiple events separated by a space
  12933. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12934. t = types.length;
  12935. while ( t-- ) {
  12936. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12937. type = origType = tmp[ 1 ];
  12938. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12939. // There *must* be a type, no attaching namespace-only handlers
  12940. if ( !type ) {
  12941. continue;
  12942. }
  12943. // If event changes its type, use the special event handlers for the changed type
  12944. special = jQuery.event.special[ type ] || {};
  12945. // If selector defined, determine special event api type, otherwise given type
  12946. type = ( selector ? special.delegateType : special.bindType ) || type;
  12947. // Update special based on newly reset type
  12948. special = jQuery.event.special[ type ] || {};
  12949. // handleObj is passed to all event handlers
  12950. handleObj = jQuery.extend( {
  12951. type: type,
  12952. origType: origType,
  12953. data: data,
  12954. handler: handler,
  12955. guid: handler.guid,
  12956. selector: selector,
  12957. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12958. namespace: namespaces.join( "." )
  12959. }, handleObjIn );
  12960. // Init the event handler queue if we're the first
  12961. if ( !( handlers = events[ type ] ) ) {
  12962. handlers = events[ type ] = [];
  12963. handlers.delegateCount = 0;
  12964. // Only use addEventListener if the special events handler returns false
  12965. if ( !special.setup ||
  12966. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12967. if ( elem.addEventListener ) {
  12968. elem.addEventListener( type, eventHandle );
  12969. }
  12970. }
  12971. }
  12972. if ( special.add ) {
  12973. special.add.call( elem, handleObj );
  12974. if ( !handleObj.handler.guid ) {
  12975. handleObj.handler.guid = handler.guid;
  12976. }
  12977. }
  12978. // Add to the element's handler list, delegates in front
  12979. if ( selector ) {
  12980. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12981. } else {
  12982. handlers.push( handleObj );
  12983. }
  12984. // Keep track of which events have ever been used, for event optimization
  12985. jQuery.event.global[ type ] = true;
  12986. }
  12987. },
  12988. // Detach an event or set of events from an element
  12989. remove: function( elem, types, handler, selector, mappedTypes ) {
  12990. var j, origCount, tmp,
  12991. events, t, handleObj,
  12992. special, handlers, type, namespaces, origType,
  12993. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12994. if ( !elemData || !( events = elemData.events ) ) {
  12995. return;
  12996. }
  12997. // Once for each type.namespace in types; type may be omitted
  12998. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12999. t = types.length;
  13000. while ( t-- ) {
  13001. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13002. type = origType = tmp[ 1 ];
  13003. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13004. // Unbind all events (on this namespace, if provided) for the element
  13005. if ( !type ) {
  13006. for ( type in events ) {
  13007. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13008. }
  13009. continue;
  13010. }
  13011. special = jQuery.event.special[ type ] || {};
  13012. type = ( selector ? special.delegateType : special.bindType ) || type;
  13013. handlers = events[ type ] || [];
  13014. tmp = tmp[ 2 ] &&
  13015. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13016. // Remove matching events
  13017. origCount = j = handlers.length;
  13018. while ( j-- ) {
  13019. handleObj = handlers[ j ];
  13020. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13021. ( !handler || handler.guid === handleObj.guid ) &&
  13022. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13023. ( !selector || selector === handleObj.selector ||
  13024. selector === "**" && handleObj.selector ) ) {
  13025. handlers.splice( j, 1 );
  13026. if ( handleObj.selector ) {
  13027. handlers.delegateCount--;
  13028. }
  13029. if ( special.remove ) {
  13030. special.remove.call( elem, handleObj );
  13031. }
  13032. }
  13033. }
  13034. // Remove generic event handler if we removed something and no more handlers exist
  13035. // (avoids potential for endless recursion during removal of special event handlers)
  13036. if ( origCount && !handlers.length ) {
  13037. if ( !special.teardown ||
  13038. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13039. jQuery.removeEvent( elem, type, elemData.handle );
  13040. }
  13041. delete events[ type ];
  13042. }
  13043. }
  13044. // Remove data and the expando if it's no longer used
  13045. if ( jQuery.isEmptyObject( events ) ) {
  13046. dataPriv.remove( elem, "handle events" );
  13047. }
  13048. },
  13049. dispatch: function( nativeEvent ) {
  13050. // Make a writable jQuery.Event from the native event object
  13051. var event = jQuery.event.fix( nativeEvent );
  13052. var i, j, ret, matched, handleObj, handlerQueue,
  13053. args = new Array( arguments.length ),
  13054. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13055. special = jQuery.event.special[ event.type ] || {};
  13056. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13057. args[ 0 ] = event;
  13058. for ( i = 1; i < arguments.length; i++ ) {
  13059. args[ i ] = arguments[ i ];
  13060. }
  13061. event.delegateTarget = this;
  13062. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13063. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13064. return;
  13065. }
  13066. // Determine handlers
  13067. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13068. // Run delegates first; they may want to stop propagation beneath us
  13069. i = 0;
  13070. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13071. event.currentTarget = matched.elem;
  13072. j = 0;
  13073. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13074. !event.isImmediatePropagationStopped() ) {
  13075. // If the event is namespaced, then each handler is only invoked if it is
  13076. // specially universal or its namespaces are a superset of the event's.
  13077. if ( !event.rnamespace || handleObj.namespace === false ||
  13078. event.rnamespace.test( handleObj.namespace ) ) {
  13079. event.handleObj = handleObj;
  13080. event.data = handleObj.data;
  13081. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13082. handleObj.handler ).apply( matched.elem, args );
  13083. if ( ret !== undefined ) {
  13084. if ( ( event.result = ret ) === false ) {
  13085. event.preventDefault();
  13086. event.stopPropagation();
  13087. }
  13088. }
  13089. }
  13090. }
  13091. }
  13092. // Call the postDispatch hook for the mapped type
  13093. if ( special.postDispatch ) {
  13094. special.postDispatch.call( this, event );
  13095. }
  13096. return event.result;
  13097. },
  13098. handlers: function( event, handlers ) {
  13099. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13100. handlerQueue = [],
  13101. delegateCount = handlers.delegateCount,
  13102. cur = event.target;
  13103. // Find delegate handlers
  13104. if ( delegateCount &&
  13105. // Support: IE <=9
  13106. // Black-hole SVG <use> instance trees (trac-13180)
  13107. cur.nodeType &&
  13108. // Support: Firefox <=42
  13109. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13110. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13111. // Support: IE 11 only
  13112. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13113. !( event.type === "click" && event.button >= 1 ) ) {
  13114. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13115. // Don't check non-elements (#13208)
  13116. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13117. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13118. matchedHandlers = [];
  13119. matchedSelectors = {};
  13120. for ( i = 0; i < delegateCount; i++ ) {
  13121. handleObj = handlers[ i ];
  13122. // Don't conflict with Object.prototype properties (#13203)
  13123. sel = handleObj.selector + " ";
  13124. if ( matchedSelectors[ sel ] === undefined ) {
  13125. matchedSelectors[ sel ] = handleObj.needsContext ?
  13126. jQuery( sel, this ).index( cur ) > -1 :
  13127. jQuery.find( sel, this, null, [ cur ] ).length;
  13128. }
  13129. if ( matchedSelectors[ sel ] ) {
  13130. matchedHandlers.push( handleObj );
  13131. }
  13132. }
  13133. if ( matchedHandlers.length ) {
  13134. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13135. }
  13136. }
  13137. }
  13138. }
  13139. // Add the remaining (directly-bound) handlers
  13140. cur = this;
  13141. if ( delegateCount < handlers.length ) {
  13142. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13143. }
  13144. return handlerQueue;
  13145. },
  13146. addProp: function( name, hook ) {
  13147. Object.defineProperty( jQuery.Event.prototype, name, {
  13148. enumerable: true,
  13149. configurable: true,
  13150. get: isFunction( hook ) ?
  13151. function() {
  13152. if ( this.originalEvent ) {
  13153. return hook( this.originalEvent );
  13154. }
  13155. } :
  13156. function() {
  13157. if ( this.originalEvent ) {
  13158. return this.originalEvent[ name ];
  13159. }
  13160. },
  13161. set: function( value ) {
  13162. Object.defineProperty( this, name, {
  13163. enumerable: true,
  13164. configurable: true,
  13165. writable: true,
  13166. value: value
  13167. } );
  13168. }
  13169. } );
  13170. },
  13171. fix: function( originalEvent ) {
  13172. return originalEvent[ jQuery.expando ] ?
  13173. originalEvent :
  13174. new jQuery.Event( originalEvent );
  13175. },
  13176. special: {
  13177. load: {
  13178. // Prevent triggered image.load events from bubbling to window.load
  13179. noBubble: true
  13180. },
  13181. click: {
  13182. // Utilize native event to ensure correct state for checkable inputs
  13183. setup: function( data ) {
  13184. // For mutual compressibility with _default, replace `this` access with a local var.
  13185. // `|| data` is dead code meant only to preserve the variable through minification.
  13186. var el = this || data;
  13187. // Claim the first handler
  13188. if ( rcheckableType.test( el.type ) &&
  13189. el.click && nodeName( el, "input" ) ) {
  13190. // dataPriv.set( el, "click", ... )
  13191. leverageNative( el, "click", returnTrue );
  13192. }
  13193. // Return false to allow normal processing in the caller
  13194. return false;
  13195. },
  13196. trigger: function( data ) {
  13197. // For mutual compressibility with _default, replace `this` access with a local var.
  13198. // `|| data` is dead code meant only to preserve the variable through minification.
  13199. var el = this || data;
  13200. // Force setup before triggering a click
  13201. if ( rcheckableType.test( el.type ) &&
  13202. el.click && nodeName( el, "input" ) ) {
  13203. leverageNative( el, "click" );
  13204. }
  13205. // Return non-false to allow normal event-path propagation
  13206. return true;
  13207. },
  13208. // For cross-browser consistency, suppress native .click() on links
  13209. // Also prevent it if we're currently inside a leveraged native-event stack
  13210. _default: function( event ) {
  13211. var target = event.target;
  13212. return rcheckableType.test( target.type ) &&
  13213. target.click && nodeName( target, "input" ) &&
  13214. dataPriv.get( target, "click" ) ||
  13215. nodeName( target, "a" );
  13216. }
  13217. },
  13218. beforeunload: {
  13219. postDispatch: function( event ) {
  13220. // Support: Firefox 20+
  13221. // Firefox doesn't alert if the returnValue field is not set.
  13222. if ( event.result !== undefined && event.originalEvent ) {
  13223. event.originalEvent.returnValue = event.result;
  13224. }
  13225. }
  13226. }
  13227. }
  13228. };
  13229. // Ensure the presence of an event listener that handles manually-triggered
  13230. // synthetic events by interrupting progress until reinvoked in response to
  13231. // *native* events that it fires directly, ensuring that state changes have
  13232. // already occurred before other listeners are invoked.
  13233. function leverageNative( el, type, expectSync ) {
  13234. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13235. if ( !expectSync ) {
  13236. if ( dataPriv.get( el, type ) === undefined ) {
  13237. jQuery.event.add( el, type, returnTrue );
  13238. }
  13239. return;
  13240. }
  13241. // Register the controller as a special universal handler for all event namespaces
  13242. dataPriv.set( el, type, false );
  13243. jQuery.event.add( el, type, {
  13244. namespace: false,
  13245. handler: function( event ) {
  13246. var notAsync, result,
  13247. saved = dataPriv.get( this, type );
  13248. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13249. // Interrupt processing of the outer synthetic .trigger()ed event
  13250. // Saved data should be false in such cases, but might be a leftover capture object
  13251. // from an async native handler (gh-4350)
  13252. if ( !saved.length ) {
  13253. // Store arguments for use when handling the inner native event
  13254. // There will always be at least one argument (an event object), so this array
  13255. // will not be confused with a leftover capture object.
  13256. saved = slice.call( arguments );
  13257. dataPriv.set( this, type, saved );
  13258. // Trigger the native event and capture its result
  13259. // Support: IE <=9 - 11+
  13260. // focus() and blur() are asynchronous
  13261. notAsync = expectSync( this, type );
  13262. this[ type ]();
  13263. result = dataPriv.get( this, type );
  13264. if ( saved !== result || notAsync ) {
  13265. dataPriv.set( this, type, false );
  13266. } else {
  13267. result = {};
  13268. }
  13269. if ( saved !== result ) {
  13270. // Cancel the outer synthetic event
  13271. event.stopImmediatePropagation();
  13272. event.preventDefault();
  13273. return result.value;
  13274. }
  13275. // If this is an inner synthetic event for an event with a bubbling surrogate
  13276. // (focus or blur), assume that the surrogate already propagated from triggering the
  13277. // native event and prevent that from happening again here.
  13278. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13279. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13280. // less bad than duplication.
  13281. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13282. event.stopPropagation();
  13283. }
  13284. // If this is a native event triggered above, everything is now in order
  13285. // Fire an inner synthetic event with the original arguments
  13286. } else if ( saved.length ) {
  13287. // ...and capture the result
  13288. dataPriv.set( this, type, {
  13289. value: jQuery.event.trigger(
  13290. // Support: IE <=9 - 11+
  13291. // Extend with the prototype to reset the above stopImmediatePropagation()
  13292. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13293. saved.slice( 1 ),
  13294. this
  13295. )
  13296. } );
  13297. // Abort handling of the native event
  13298. event.stopImmediatePropagation();
  13299. }
  13300. }
  13301. } );
  13302. }
  13303. jQuery.removeEvent = function( elem, type, handle ) {
  13304. // This "if" is needed for plain objects
  13305. if ( elem.removeEventListener ) {
  13306. elem.removeEventListener( type, handle );
  13307. }
  13308. };
  13309. jQuery.Event = function( src, props ) {
  13310. // Allow instantiation without the 'new' keyword
  13311. if ( !( this instanceof jQuery.Event ) ) {
  13312. return new jQuery.Event( src, props );
  13313. }
  13314. // Event object
  13315. if ( src && src.type ) {
  13316. this.originalEvent = src;
  13317. this.type = src.type;
  13318. // Events bubbling up the document may have been marked as prevented
  13319. // by a handler lower down the tree; reflect the correct value.
  13320. this.isDefaultPrevented = src.defaultPrevented ||
  13321. src.defaultPrevented === undefined &&
  13322. // Support: Android <=2.3 only
  13323. src.returnValue === false ?
  13324. returnTrue :
  13325. returnFalse;
  13326. // Create target properties
  13327. // Support: Safari <=6 - 7 only
  13328. // Target should not be a text node (#504, #13143)
  13329. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13330. src.target.parentNode :
  13331. src.target;
  13332. this.currentTarget = src.currentTarget;
  13333. this.relatedTarget = src.relatedTarget;
  13334. // Event type
  13335. } else {
  13336. this.type = src;
  13337. }
  13338. // Put explicitly provided properties onto the event object
  13339. if ( props ) {
  13340. jQuery.extend( this, props );
  13341. }
  13342. // Create a timestamp if incoming event doesn't have one
  13343. this.timeStamp = src && src.timeStamp || Date.now();
  13344. // Mark it as fixed
  13345. this[ jQuery.expando ] = true;
  13346. };
  13347. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13348. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13349. jQuery.Event.prototype = {
  13350. constructor: jQuery.Event,
  13351. isDefaultPrevented: returnFalse,
  13352. isPropagationStopped: returnFalse,
  13353. isImmediatePropagationStopped: returnFalse,
  13354. isSimulated: false,
  13355. preventDefault: function() {
  13356. var e = this.originalEvent;
  13357. this.isDefaultPrevented = returnTrue;
  13358. if ( e && !this.isSimulated ) {
  13359. e.preventDefault();
  13360. }
  13361. },
  13362. stopPropagation: function() {
  13363. var e = this.originalEvent;
  13364. this.isPropagationStopped = returnTrue;
  13365. if ( e && !this.isSimulated ) {
  13366. e.stopPropagation();
  13367. }
  13368. },
  13369. stopImmediatePropagation: function() {
  13370. var e = this.originalEvent;
  13371. this.isImmediatePropagationStopped = returnTrue;
  13372. if ( e && !this.isSimulated ) {
  13373. e.stopImmediatePropagation();
  13374. }
  13375. this.stopPropagation();
  13376. }
  13377. };
  13378. // Includes all common event props including KeyEvent and MouseEvent specific props
  13379. jQuery.each( {
  13380. altKey: true,
  13381. bubbles: true,
  13382. cancelable: true,
  13383. changedTouches: true,
  13384. ctrlKey: true,
  13385. detail: true,
  13386. eventPhase: true,
  13387. metaKey: true,
  13388. pageX: true,
  13389. pageY: true,
  13390. shiftKey: true,
  13391. view: true,
  13392. "char": true,
  13393. code: true,
  13394. charCode: true,
  13395. key: true,
  13396. keyCode: true,
  13397. button: true,
  13398. buttons: true,
  13399. clientX: true,
  13400. clientY: true,
  13401. offsetX: true,
  13402. offsetY: true,
  13403. pointerId: true,
  13404. pointerType: true,
  13405. screenX: true,
  13406. screenY: true,
  13407. targetTouches: true,
  13408. toElement: true,
  13409. touches: true,
  13410. which: function( event ) {
  13411. var button = event.button;
  13412. // Add which for key events
  13413. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13414. return event.charCode != null ? event.charCode : event.keyCode;
  13415. }
  13416. // Add which for click: 1 === left; 2 === middle; 3 === right
  13417. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13418. if ( button & 1 ) {
  13419. return 1;
  13420. }
  13421. if ( button & 2 ) {
  13422. return 3;
  13423. }
  13424. if ( button & 4 ) {
  13425. return 2;
  13426. }
  13427. return 0;
  13428. }
  13429. return event.which;
  13430. }
  13431. }, jQuery.event.addProp );
  13432. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13433. jQuery.event.special[ type ] = {
  13434. // Utilize native event if possible so blur/focus sequence is correct
  13435. setup: function() {
  13436. // Claim the first handler
  13437. // dataPriv.set( this, "focus", ... )
  13438. // dataPriv.set( this, "blur", ... )
  13439. leverageNative( this, type, expectSync );
  13440. // Return false to allow normal processing in the caller
  13441. return false;
  13442. },
  13443. trigger: function() {
  13444. // Force setup before trigger
  13445. leverageNative( this, type );
  13446. // Return non-false to allow normal event-path propagation
  13447. return true;
  13448. },
  13449. delegateType: delegateType
  13450. };
  13451. } );
  13452. // Create mouseenter/leave events using mouseover/out and event-time checks
  13453. // so that event delegation works in jQuery.
  13454. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13455. //
  13456. // Support: Safari 7 only
  13457. // Safari sends mouseenter too often; see:
  13458. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13459. // for the description of the bug (it existed in older Chrome versions as well).
  13460. jQuery.each( {
  13461. mouseenter: "mouseover",
  13462. mouseleave: "mouseout",
  13463. pointerenter: "pointerover",
  13464. pointerleave: "pointerout"
  13465. }, function( orig, fix ) {
  13466. jQuery.event.special[ orig ] = {
  13467. delegateType: fix,
  13468. bindType: fix,
  13469. handle: function( event ) {
  13470. var ret,
  13471. target = this,
  13472. related = event.relatedTarget,
  13473. handleObj = event.handleObj;
  13474. // For mouseenter/leave call the handler if related is outside the target.
  13475. // NB: No relatedTarget if the mouse left/entered the browser window
  13476. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13477. event.type = handleObj.origType;
  13478. ret = handleObj.handler.apply( this, arguments );
  13479. event.type = fix;
  13480. }
  13481. return ret;
  13482. }
  13483. };
  13484. } );
  13485. jQuery.fn.extend( {
  13486. on: function( types, selector, data, fn ) {
  13487. return on( this, types, selector, data, fn );
  13488. },
  13489. one: function( types, selector, data, fn ) {
  13490. return on( this, types, selector, data, fn, 1 );
  13491. },
  13492. off: function( types, selector, fn ) {
  13493. var handleObj, type;
  13494. if ( types && types.preventDefault && types.handleObj ) {
  13495. // ( event ) dispatched jQuery.Event
  13496. handleObj = types.handleObj;
  13497. jQuery( types.delegateTarget ).off(
  13498. handleObj.namespace ?
  13499. handleObj.origType + "." + handleObj.namespace :
  13500. handleObj.origType,
  13501. handleObj.selector,
  13502. handleObj.handler
  13503. );
  13504. return this;
  13505. }
  13506. if ( typeof types === "object" ) {
  13507. // ( types-object [, selector] )
  13508. for ( type in types ) {
  13509. this.off( type, selector, types[ type ] );
  13510. }
  13511. return this;
  13512. }
  13513. if ( selector === false || typeof selector === "function" ) {
  13514. // ( types [, fn] )
  13515. fn = selector;
  13516. selector = undefined;
  13517. }
  13518. if ( fn === false ) {
  13519. fn = returnFalse;
  13520. }
  13521. return this.each( function() {
  13522. jQuery.event.remove( this, types, fn, selector );
  13523. } );
  13524. }
  13525. } );
  13526. var
  13527. /* eslint-disable max-len */
  13528. // See https://github.com/eslint/eslint/issues/3229
  13529. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13530. /* eslint-enable */
  13531. // Support: IE <=10 - 11, Edge 12 - 13 only
  13532. // In IE/Edge using regex groups here causes severe slowdowns.
  13533. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13534. rnoInnerhtml = /<script|<style|<link/i,
  13535. // checked="checked" or checked
  13536. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13537. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13538. // Prefer a tbody over its parent table for containing new rows
  13539. function manipulationTarget( elem, content ) {
  13540. if ( nodeName( elem, "table" ) &&
  13541. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13542. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13543. }
  13544. return elem;
  13545. }
  13546. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13547. function disableScript( elem ) {
  13548. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13549. return elem;
  13550. }
  13551. function restoreScript( elem ) {
  13552. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13553. elem.type = elem.type.slice( 5 );
  13554. } else {
  13555. elem.removeAttribute( "type" );
  13556. }
  13557. return elem;
  13558. }
  13559. function cloneCopyEvent( src, dest ) {
  13560. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13561. if ( dest.nodeType !== 1 ) {
  13562. return;
  13563. }
  13564. // 1. Copy private data: events, handlers, etc.
  13565. if ( dataPriv.hasData( src ) ) {
  13566. pdataOld = dataPriv.access( src );
  13567. pdataCur = dataPriv.set( dest, pdataOld );
  13568. events = pdataOld.events;
  13569. if ( events ) {
  13570. delete pdataCur.handle;
  13571. pdataCur.events = {};
  13572. for ( type in events ) {
  13573. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13574. jQuery.event.add( dest, type, events[ type ][ i ] );
  13575. }
  13576. }
  13577. }
  13578. }
  13579. // 2. Copy user data
  13580. if ( dataUser.hasData( src ) ) {
  13581. udataOld = dataUser.access( src );
  13582. udataCur = jQuery.extend( {}, udataOld );
  13583. dataUser.set( dest, udataCur );
  13584. }
  13585. }
  13586. // Fix IE bugs, see support tests
  13587. function fixInput( src, dest ) {
  13588. var nodeName = dest.nodeName.toLowerCase();
  13589. // Fails to persist the checked state of a cloned checkbox or radio button.
  13590. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13591. dest.checked = src.checked;
  13592. // Fails to return the selected option to the default selected state when cloning options
  13593. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13594. dest.defaultValue = src.defaultValue;
  13595. }
  13596. }
  13597. function domManip( collection, args, callback, ignored ) {
  13598. // Flatten any nested arrays
  13599. args = concat.apply( [], args );
  13600. var fragment, first, scripts, hasScripts, node, doc,
  13601. i = 0,
  13602. l = collection.length,
  13603. iNoClone = l - 1,
  13604. value = args[ 0 ],
  13605. valueIsFunction = isFunction( value );
  13606. // We can't cloneNode fragments that contain checked, in WebKit
  13607. if ( valueIsFunction ||
  13608. ( l > 1 && typeof value === "string" &&
  13609. !support.checkClone && rchecked.test( value ) ) ) {
  13610. return collection.each( function( index ) {
  13611. var self = collection.eq( index );
  13612. if ( valueIsFunction ) {
  13613. args[ 0 ] = value.call( this, index, self.html() );
  13614. }
  13615. domManip( self, args, callback, ignored );
  13616. } );
  13617. }
  13618. if ( l ) {
  13619. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13620. first = fragment.firstChild;
  13621. if ( fragment.childNodes.length === 1 ) {
  13622. fragment = first;
  13623. }
  13624. // Require either new content or an interest in ignored elements to invoke the callback
  13625. if ( first || ignored ) {
  13626. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13627. hasScripts = scripts.length;
  13628. // Use the original fragment for the last item
  13629. // instead of the first because it can end up
  13630. // being emptied incorrectly in certain situations (#8070).
  13631. for ( ; i < l; i++ ) {
  13632. node = fragment;
  13633. if ( i !== iNoClone ) {
  13634. node = jQuery.clone( node, true, true );
  13635. // Keep references to cloned scripts for later restoration
  13636. if ( hasScripts ) {
  13637. // Support: Android <=4.0 only, PhantomJS 1 only
  13638. // push.apply(_, arraylike) throws on ancient WebKit
  13639. jQuery.merge( scripts, getAll( node, "script" ) );
  13640. }
  13641. }
  13642. callback.call( collection[ i ], node, i );
  13643. }
  13644. if ( hasScripts ) {
  13645. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13646. // Reenable scripts
  13647. jQuery.map( scripts, restoreScript );
  13648. // Evaluate executable scripts on first document insertion
  13649. for ( i = 0; i < hasScripts; i++ ) {
  13650. node = scripts[ i ];
  13651. if ( rscriptType.test( node.type || "" ) &&
  13652. !dataPriv.access( node, "globalEval" ) &&
  13653. jQuery.contains( doc, node ) ) {
  13654. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13655. // Optional AJAX dependency, but won't run scripts if not present
  13656. if ( jQuery._evalUrl && !node.noModule ) {
  13657. jQuery._evalUrl( node.src, {
  13658. nonce: node.nonce || node.getAttribute( "nonce" )
  13659. } );
  13660. }
  13661. } else {
  13662. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13663. }
  13664. }
  13665. }
  13666. }
  13667. }
  13668. }
  13669. return collection;
  13670. }
  13671. function remove( elem, selector, keepData ) {
  13672. var node,
  13673. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13674. i = 0;
  13675. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13676. if ( !keepData && node.nodeType === 1 ) {
  13677. jQuery.cleanData( getAll( node ) );
  13678. }
  13679. if ( node.parentNode ) {
  13680. if ( keepData && isAttached( node ) ) {
  13681. setGlobalEval( getAll( node, "script" ) );
  13682. }
  13683. node.parentNode.removeChild( node );
  13684. }
  13685. }
  13686. return elem;
  13687. }
  13688. jQuery.extend( {
  13689. htmlPrefilter: function( html ) {
  13690. return html.replace( rxhtmlTag, "<$1></$2>" );
  13691. },
  13692. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13693. var i, l, srcElements, destElements,
  13694. clone = elem.cloneNode( true ),
  13695. inPage = isAttached( elem );
  13696. // Fix IE cloning issues
  13697. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13698. !jQuery.isXMLDoc( elem ) ) {
  13699. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13700. destElements = getAll( clone );
  13701. srcElements = getAll( elem );
  13702. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13703. fixInput( srcElements[ i ], destElements[ i ] );
  13704. }
  13705. }
  13706. // Copy the events from the original to the clone
  13707. if ( dataAndEvents ) {
  13708. if ( deepDataAndEvents ) {
  13709. srcElements = srcElements || getAll( elem );
  13710. destElements = destElements || getAll( clone );
  13711. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13712. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13713. }
  13714. } else {
  13715. cloneCopyEvent( elem, clone );
  13716. }
  13717. }
  13718. // Preserve script evaluation history
  13719. destElements = getAll( clone, "script" );
  13720. if ( destElements.length > 0 ) {
  13721. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13722. }
  13723. // Return the cloned set
  13724. return clone;
  13725. },
  13726. cleanData: function( elems ) {
  13727. var data, elem, type,
  13728. special = jQuery.event.special,
  13729. i = 0;
  13730. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13731. if ( acceptData( elem ) ) {
  13732. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13733. if ( data.events ) {
  13734. for ( type in data.events ) {
  13735. if ( special[ type ] ) {
  13736. jQuery.event.remove( elem, type );
  13737. // This is a shortcut to avoid jQuery.event.remove's overhead
  13738. } else {
  13739. jQuery.removeEvent( elem, type, data.handle );
  13740. }
  13741. }
  13742. }
  13743. // Support: Chrome <=35 - 45+
  13744. // Assign undefined instead of using delete, see Data#remove
  13745. elem[ dataPriv.expando ] = undefined;
  13746. }
  13747. if ( elem[ dataUser.expando ] ) {
  13748. // Support: Chrome <=35 - 45+
  13749. // Assign undefined instead of using delete, see Data#remove
  13750. elem[ dataUser.expando ] = undefined;
  13751. }
  13752. }
  13753. }
  13754. }
  13755. } );
  13756. jQuery.fn.extend( {
  13757. detach: function( selector ) {
  13758. return remove( this, selector, true );
  13759. },
  13760. remove: function( selector ) {
  13761. return remove( this, selector );
  13762. },
  13763. text: function( value ) {
  13764. return access( this, function( value ) {
  13765. return value === undefined ?
  13766. jQuery.text( this ) :
  13767. this.empty().each( function() {
  13768. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13769. this.textContent = value;
  13770. }
  13771. } );
  13772. }, null, value, arguments.length );
  13773. },
  13774. append: function() {
  13775. return domManip( this, arguments, function( elem ) {
  13776. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13777. var target = manipulationTarget( this, elem );
  13778. target.appendChild( elem );
  13779. }
  13780. } );
  13781. },
  13782. prepend: function() {
  13783. return domManip( this, arguments, function( elem ) {
  13784. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13785. var target = manipulationTarget( this, elem );
  13786. target.insertBefore( elem, target.firstChild );
  13787. }
  13788. } );
  13789. },
  13790. before: function() {
  13791. return domManip( this, arguments, function( elem ) {
  13792. if ( this.parentNode ) {
  13793. this.parentNode.insertBefore( elem, this );
  13794. }
  13795. } );
  13796. },
  13797. after: function() {
  13798. return domManip( this, arguments, function( elem ) {
  13799. if ( this.parentNode ) {
  13800. this.parentNode.insertBefore( elem, this.nextSibling );
  13801. }
  13802. } );
  13803. },
  13804. empty: function() {
  13805. var elem,
  13806. i = 0;
  13807. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13808. if ( elem.nodeType === 1 ) {
  13809. // Prevent memory leaks
  13810. jQuery.cleanData( getAll( elem, false ) );
  13811. // Remove any remaining nodes
  13812. elem.textContent = "";
  13813. }
  13814. }
  13815. return this;
  13816. },
  13817. clone: function( dataAndEvents, deepDataAndEvents ) {
  13818. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13819. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13820. return this.map( function() {
  13821. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13822. } );
  13823. },
  13824. html: function( value ) {
  13825. return access( this, function( value ) {
  13826. var elem = this[ 0 ] || {},
  13827. i = 0,
  13828. l = this.length;
  13829. if ( value === undefined && elem.nodeType === 1 ) {
  13830. return elem.innerHTML;
  13831. }
  13832. // See if we can take a shortcut and just use innerHTML
  13833. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13834. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13835. value = jQuery.htmlPrefilter( value );
  13836. try {
  13837. for ( ; i < l; i++ ) {
  13838. elem = this[ i ] || {};
  13839. // Remove element nodes and prevent memory leaks
  13840. if ( elem.nodeType === 1 ) {
  13841. jQuery.cleanData( getAll( elem, false ) );
  13842. elem.innerHTML = value;
  13843. }
  13844. }
  13845. elem = 0;
  13846. // If using innerHTML throws an exception, use the fallback method
  13847. } catch ( e ) {}
  13848. }
  13849. if ( elem ) {
  13850. this.empty().append( value );
  13851. }
  13852. }, null, value, arguments.length );
  13853. },
  13854. replaceWith: function() {
  13855. var ignored = [];
  13856. // Make the changes, replacing each non-ignored context element with the new content
  13857. return domManip( this, arguments, function( elem ) {
  13858. var parent = this.parentNode;
  13859. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13860. jQuery.cleanData( getAll( this ) );
  13861. if ( parent ) {
  13862. parent.replaceChild( elem, this );
  13863. }
  13864. }
  13865. // Force callback invocation
  13866. }, ignored );
  13867. }
  13868. } );
  13869. jQuery.each( {
  13870. appendTo: "append",
  13871. prependTo: "prepend",
  13872. insertBefore: "before",
  13873. insertAfter: "after",
  13874. replaceAll: "replaceWith"
  13875. }, function( name, original ) {
  13876. jQuery.fn[ name ] = function( selector ) {
  13877. var elems,
  13878. ret = [],
  13879. insert = jQuery( selector ),
  13880. last = insert.length - 1,
  13881. i = 0;
  13882. for ( ; i <= last; i++ ) {
  13883. elems = i === last ? this : this.clone( true );
  13884. jQuery( insert[ i ] )[ original ]( elems );
  13885. // Support: Android <=4.0 only, PhantomJS 1 only
  13886. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13887. push.apply( ret, elems.get() );
  13888. }
  13889. return this.pushStack( ret );
  13890. };
  13891. } );
  13892. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13893. var getStyles = function( elem ) {
  13894. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13895. // IE throws on elements created in popups
  13896. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13897. var view = elem.ownerDocument.defaultView;
  13898. if ( !view || !view.opener ) {
  13899. view = window;
  13900. }
  13901. return view.getComputedStyle( elem );
  13902. };
  13903. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13904. ( function() {
  13905. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13906. // so they're executed at the same time to save the second computation.
  13907. function computeStyleTests() {
  13908. // This is a singleton, we need to execute it only once
  13909. if ( !div ) {
  13910. return;
  13911. }
  13912. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13913. "margin-top:1px;padding:0;border:0";
  13914. div.style.cssText =
  13915. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13916. "margin:auto;border:1px;padding:1px;" +
  13917. "width:60%;top:1%";
  13918. documentElement.appendChild( container ).appendChild( div );
  13919. var divStyle = window.getComputedStyle( div );
  13920. pixelPositionVal = divStyle.top !== "1%";
  13921. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13922. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13923. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13924. // Some styles come back with percentage values, even though they shouldn't
  13925. div.style.right = "60%";
  13926. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13927. // Support: IE 9 - 11 only
  13928. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13929. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13930. // Support: IE 9 only
  13931. // Detect overflow:scroll screwiness (gh-3699)
  13932. // Support: Chrome <=64
  13933. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13934. div.style.position = "absolute";
  13935. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13936. documentElement.removeChild( container );
  13937. // Nullify the div so it wouldn't be stored in the memory and
  13938. // it will also be a sign that checks already performed
  13939. div = null;
  13940. }
  13941. function roundPixelMeasures( measure ) {
  13942. return Math.round( parseFloat( measure ) );
  13943. }
  13944. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13945. reliableMarginLeftVal,
  13946. container = document.createElement( "div" ),
  13947. div = document.createElement( "div" );
  13948. // Finish early in limited (non-browser) environments
  13949. if ( !div.style ) {
  13950. return;
  13951. }
  13952. // Support: IE <=9 - 11 only
  13953. // Style of cloned element affects source element cloned (#8908)
  13954. div.style.backgroundClip = "content-box";
  13955. div.cloneNode( true ).style.backgroundClip = "";
  13956. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13957. jQuery.extend( support, {
  13958. boxSizingReliable: function() {
  13959. computeStyleTests();
  13960. return boxSizingReliableVal;
  13961. },
  13962. pixelBoxStyles: function() {
  13963. computeStyleTests();
  13964. return pixelBoxStylesVal;
  13965. },
  13966. pixelPosition: function() {
  13967. computeStyleTests();
  13968. return pixelPositionVal;
  13969. },
  13970. reliableMarginLeft: function() {
  13971. computeStyleTests();
  13972. return reliableMarginLeftVal;
  13973. },
  13974. scrollboxSize: function() {
  13975. computeStyleTests();
  13976. return scrollboxSizeVal;
  13977. }
  13978. } );
  13979. } )();
  13980. function curCSS( elem, name, computed ) {
  13981. var width, minWidth, maxWidth, ret,
  13982. // Support: Firefox 51+
  13983. // Retrieving style before computed somehow
  13984. // fixes an issue with getting wrong values
  13985. // on detached elements
  13986. style = elem.style;
  13987. computed = computed || getStyles( elem );
  13988. // getPropertyValue is needed for:
  13989. // .css('filter') (IE 9 only, #12537)
  13990. // .css('--customProperty) (#3144)
  13991. if ( computed ) {
  13992. ret = computed.getPropertyValue( name ) || computed[ name ];
  13993. if ( ret === "" && !isAttached( elem ) ) {
  13994. ret = jQuery.style( elem, name );
  13995. }
  13996. // A tribute to the "awesome hack by Dean Edwards"
  13997. // Android Browser returns percentage for some values,
  13998. // but width seems to be reliably pixels.
  13999. // This is against the CSSOM draft spec:
  14000. // https://drafts.csswg.org/cssom/#resolved-values
  14001. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14002. // Remember the original values
  14003. width = style.width;
  14004. minWidth = style.minWidth;
  14005. maxWidth = style.maxWidth;
  14006. // Put in the new values to get a computed value out
  14007. style.minWidth = style.maxWidth = style.width = ret;
  14008. ret = computed.width;
  14009. // Revert the changed values
  14010. style.width = width;
  14011. style.minWidth = minWidth;
  14012. style.maxWidth = maxWidth;
  14013. }
  14014. }
  14015. return ret !== undefined ?
  14016. // Support: IE <=9 - 11 only
  14017. // IE returns zIndex value as an integer.
  14018. ret + "" :
  14019. ret;
  14020. }
  14021. function addGetHookIf( conditionFn, hookFn ) {
  14022. // Define the hook, we'll check on the first run if it's really needed.
  14023. return {
  14024. get: function() {
  14025. if ( conditionFn() ) {
  14026. // Hook not needed (or it's not possible to use it due
  14027. // to missing dependency), remove it.
  14028. delete this.get;
  14029. return;
  14030. }
  14031. // Hook needed; redefine it so that the support test is not executed again.
  14032. return ( this.get = hookFn ).apply( this, arguments );
  14033. }
  14034. };
  14035. }
  14036. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14037. emptyStyle = document.createElement( "div" ).style,
  14038. vendorProps = {};
  14039. // Return a vendor-prefixed property or undefined
  14040. function vendorPropName( name ) {
  14041. // Check for vendor prefixed names
  14042. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14043. i = cssPrefixes.length;
  14044. while ( i-- ) {
  14045. name = cssPrefixes[ i ] + capName;
  14046. if ( name in emptyStyle ) {
  14047. return name;
  14048. }
  14049. }
  14050. }
  14051. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14052. function finalPropName( name ) {
  14053. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14054. if ( final ) {
  14055. return final;
  14056. }
  14057. if ( name in emptyStyle ) {
  14058. return name;
  14059. }
  14060. return vendorProps[ name ] = vendorPropName( name ) || name;
  14061. }
  14062. var
  14063. // Swappable if display is none or starts with table
  14064. // except "table", "table-cell", or "table-caption"
  14065. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14066. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14067. rcustomProp = /^--/,
  14068. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14069. cssNormalTransform = {
  14070. letterSpacing: "0",
  14071. fontWeight: "400"
  14072. };
  14073. function setPositiveNumber( elem, value, subtract ) {
  14074. // Any relative (+/-) values have already been
  14075. // normalized at this point
  14076. var matches = rcssNum.exec( value );
  14077. return matches ?
  14078. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14079. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14080. value;
  14081. }
  14082. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14083. var i = dimension === "width" ? 1 : 0,
  14084. extra = 0,
  14085. delta = 0;
  14086. // Adjustment may not be necessary
  14087. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14088. return 0;
  14089. }
  14090. for ( ; i < 4; i += 2 ) {
  14091. // Both box models exclude margin
  14092. if ( box === "margin" ) {
  14093. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14094. }
  14095. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14096. if ( !isBorderBox ) {
  14097. // Add padding
  14098. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14099. // For "border" or "margin", add border
  14100. if ( box !== "padding" ) {
  14101. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14102. // But still keep track of it otherwise
  14103. } else {
  14104. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14105. }
  14106. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14107. // "padding" or "margin"
  14108. } else {
  14109. // For "content", subtract padding
  14110. if ( box === "content" ) {
  14111. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14112. }
  14113. // For "content" or "padding", subtract border
  14114. if ( box !== "margin" ) {
  14115. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14116. }
  14117. }
  14118. }
  14119. // Account for positive content-box scroll gutter when requested by providing computedVal
  14120. if ( !isBorderBox && computedVal >= 0 ) {
  14121. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14122. // Assuming integer scroll gutter, subtract the rest and round down
  14123. delta += Math.max( 0, Math.ceil(
  14124. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14125. computedVal -
  14126. delta -
  14127. extra -
  14128. 0.5
  14129. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14130. // Use an explicit zero to avoid NaN (gh-3964)
  14131. ) ) || 0;
  14132. }
  14133. return delta;
  14134. }
  14135. function getWidthOrHeight( elem, dimension, extra ) {
  14136. // Start with computed style
  14137. var styles = getStyles( elem ),
  14138. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14139. // Fake content-box until we know it's needed to know the true value.
  14140. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14141. isBorderBox = boxSizingNeeded &&
  14142. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14143. valueIsBorderBox = isBorderBox,
  14144. val = curCSS( elem, dimension, styles ),
  14145. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14146. // Support: Firefox <=54
  14147. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14148. if ( rnumnonpx.test( val ) ) {
  14149. if ( !extra ) {
  14150. return val;
  14151. }
  14152. val = "auto";
  14153. }
  14154. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14155. // This happens for inline elements with no explicit setting (gh-3571)
  14156. // Support: Android <=4.1 - 4.3 only
  14157. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14158. // Support: IE 9-11 only
  14159. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14160. // We use getClientRects() to check for hidden/disconnected.
  14161. // In those cases, the computed value can be trusted to be border-box
  14162. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14163. val === "auto" ||
  14164. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14165. elem.getClientRects().length ) {
  14166. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14167. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14168. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14169. // retrieved value as a content box dimension.
  14170. valueIsBorderBox = offsetProp in elem;
  14171. if ( valueIsBorderBox ) {
  14172. val = elem[ offsetProp ];
  14173. }
  14174. }
  14175. // Normalize "" and auto
  14176. val = parseFloat( val ) || 0;
  14177. // Adjust for the element's box model
  14178. return ( val +
  14179. boxModelAdjustment(
  14180. elem,
  14181. dimension,
  14182. extra || ( isBorderBox ? "border" : "content" ),
  14183. valueIsBorderBox,
  14184. styles,
  14185. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14186. val
  14187. )
  14188. ) + "px";
  14189. }
  14190. jQuery.extend( {
  14191. // Add in style property hooks for overriding the default
  14192. // behavior of getting and setting a style property
  14193. cssHooks: {
  14194. opacity: {
  14195. get: function( elem, computed ) {
  14196. if ( computed ) {
  14197. // We should always get a number back from opacity
  14198. var ret = curCSS( elem, "opacity" );
  14199. return ret === "" ? "1" : ret;
  14200. }
  14201. }
  14202. }
  14203. },
  14204. // Don't automatically add "px" to these possibly-unitless properties
  14205. cssNumber: {
  14206. "animationIterationCount": true,
  14207. "columnCount": true,
  14208. "fillOpacity": true,
  14209. "flexGrow": true,
  14210. "flexShrink": true,
  14211. "fontWeight": true,
  14212. "gridArea": true,
  14213. "gridColumn": true,
  14214. "gridColumnEnd": true,
  14215. "gridColumnStart": true,
  14216. "gridRow": true,
  14217. "gridRowEnd": true,
  14218. "gridRowStart": true,
  14219. "lineHeight": true,
  14220. "opacity": true,
  14221. "order": true,
  14222. "orphans": true,
  14223. "widows": true,
  14224. "zIndex": true,
  14225. "zoom": true
  14226. },
  14227. // Add in properties whose names you wish to fix before
  14228. // setting or getting the value
  14229. cssProps: {},
  14230. // Get and set the style property on a DOM Node
  14231. style: function( elem, name, value, extra ) {
  14232. // Don't set styles on text and comment nodes
  14233. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14234. return;
  14235. }
  14236. // Make sure that we're working with the right name
  14237. var ret, type, hooks,
  14238. origName = camelCase( name ),
  14239. isCustomProp = rcustomProp.test( name ),
  14240. style = elem.style;
  14241. // Make sure that we're working with the right name. We don't
  14242. // want to query the value if it is a CSS custom property
  14243. // since they are user-defined.
  14244. if ( !isCustomProp ) {
  14245. name = finalPropName( origName );
  14246. }
  14247. // Gets hook for the prefixed version, then unprefixed version
  14248. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14249. // Check if we're setting a value
  14250. if ( value !== undefined ) {
  14251. type = typeof value;
  14252. // Convert "+=" or "-=" to relative numbers (#7345)
  14253. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14254. value = adjustCSS( elem, name, ret );
  14255. // Fixes bug #9237
  14256. type = "number";
  14257. }
  14258. // Make sure that null and NaN values aren't set (#7116)
  14259. if ( value == null || value !== value ) {
  14260. return;
  14261. }
  14262. // If a number was passed in, add the unit (except for certain CSS properties)
  14263. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14264. // "px" to a few hardcoded values.
  14265. if ( type === "number" && !isCustomProp ) {
  14266. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14267. }
  14268. // background-* props affect original clone's values
  14269. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14270. style[ name ] = "inherit";
  14271. }
  14272. // If a hook was provided, use that value, otherwise just set the specified value
  14273. if ( !hooks || !( "set" in hooks ) ||
  14274. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14275. if ( isCustomProp ) {
  14276. style.setProperty( name, value );
  14277. } else {
  14278. style[ name ] = value;
  14279. }
  14280. }
  14281. } else {
  14282. // If a hook was provided get the non-computed value from there
  14283. if ( hooks && "get" in hooks &&
  14284. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14285. return ret;
  14286. }
  14287. // Otherwise just get the value from the style object
  14288. return style[ name ];
  14289. }
  14290. },
  14291. css: function( elem, name, extra, styles ) {
  14292. var val, num, hooks,
  14293. origName = camelCase( name ),
  14294. isCustomProp = rcustomProp.test( name );
  14295. // Make sure that we're working with the right name. We don't
  14296. // want to modify the value if it is a CSS custom property
  14297. // since they are user-defined.
  14298. if ( !isCustomProp ) {
  14299. name = finalPropName( origName );
  14300. }
  14301. // Try prefixed name followed by the unprefixed name
  14302. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14303. // If a hook was provided get the computed value from there
  14304. if ( hooks && "get" in hooks ) {
  14305. val = hooks.get( elem, true, extra );
  14306. }
  14307. // Otherwise, if a way to get the computed value exists, use that
  14308. if ( val === undefined ) {
  14309. val = curCSS( elem, name, styles );
  14310. }
  14311. // Convert "normal" to computed value
  14312. if ( val === "normal" && name in cssNormalTransform ) {
  14313. val = cssNormalTransform[ name ];
  14314. }
  14315. // Make numeric if forced or a qualifier was provided and val looks numeric
  14316. if ( extra === "" || extra ) {
  14317. num = parseFloat( val );
  14318. return extra === true || isFinite( num ) ? num || 0 : val;
  14319. }
  14320. return val;
  14321. }
  14322. } );
  14323. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14324. jQuery.cssHooks[ dimension ] = {
  14325. get: function( elem, computed, extra ) {
  14326. if ( computed ) {
  14327. // Certain elements can have dimension info if we invisibly show them
  14328. // but it must have a current display style that would benefit
  14329. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14330. // Support: Safari 8+
  14331. // Table columns in Safari have non-zero offsetWidth & zero
  14332. // getBoundingClientRect().width unless display is changed.
  14333. // Support: IE <=11 only
  14334. // Running getBoundingClientRect on a disconnected node
  14335. // in IE throws an error.
  14336. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14337. swap( elem, cssShow, function() {
  14338. return getWidthOrHeight( elem, dimension, extra );
  14339. } ) :
  14340. getWidthOrHeight( elem, dimension, extra );
  14341. }
  14342. },
  14343. set: function( elem, value, extra ) {
  14344. var matches,
  14345. styles = getStyles( elem ),
  14346. // Only read styles.position if the test has a chance to fail
  14347. // to avoid forcing a reflow.
  14348. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14349. styles.position === "absolute",
  14350. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14351. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14352. isBorderBox = boxSizingNeeded &&
  14353. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14354. subtract = extra ?
  14355. boxModelAdjustment(
  14356. elem,
  14357. dimension,
  14358. extra,
  14359. isBorderBox,
  14360. styles
  14361. ) :
  14362. 0;
  14363. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14364. // faking a content-box to get border and padding (gh-3699)
  14365. if ( isBorderBox && scrollboxSizeBuggy ) {
  14366. subtract -= Math.ceil(
  14367. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14368. parseFloat( styles[ dimension ] ) -
  14369. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14370. 0.5
  14371. );
  14372. }
  14373. // Convert to pixels if value adjustment is needed
  14374. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14375. ( matches[ 3 ] || "px" ) !== "px" ) {
  14376. elem.style[ dimension ] = value;
  14377. value = jQuery.css( elem, dimension );
  14378. }
  14379. return setPositiveNumber( elem, value, subtract );
  14380. }
  14381. };
  14382. } );
  14383. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14384. function( elem, computed ) {
  14385. if ( computed ) {
  14386. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14387. elem.getBoundingClientRect().left -
  14388. swap( elem, { marginLeft: 0 }, function() {
  14389. return elem.getBoundingClientRect().left;
  14390. } )
  14391. ) + "px";
  14392. }
  14393. }
  14394. );
  14395. // These hooks are used by animate to expand properties
  14396. jQuery.each( {
  14397. margin: "",
  14398. padding: "",
  14399. border: "Width"
  14400. }, function( prefix, suffix ) {
  14401. jQuery.cssHooks[ prefix + suffix ] = {
  14402. expand: function( value ) {
  14403. var i = 0,
  14404. expanded = {},
  14405. // Assumes a single number if not a string
  14406. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14407. for ( ; i < 4; i++ ) {
  14408. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14409. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14410. }
  14411. return expanded;
  14412. }
  14413. };
  14414. if ( prefix !== "margin" ) {
  14415. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14416. }
  14417. } );
  14418. jQuery.fn.extend( {
  14419. css: function( name, value ) {
  14420. return access( this, function( elem, name, value ) {
  14421. var styles, len,
  14422. map = {},
  14423. i = 0;
  14424. if ( Array.isArray( name ) ) {
  14425. styles = getStyles( elem );
  14426. len = name.length;
  14427. for ( ; i < len; i++ ) {
  14428. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14429. }
  14430. return map;
  14431. }
  14432. return value !== undefined ?
  14433. jQuery.style( elem, name, value ) :
  14434. jQuery.css( elem, name );
  14435. }, name, value, arguments.length > 1 );
  14436. }
  14437. } );
  14438. function Tween( elem, options, prop, end, easing ) {
  14439. return new Tween.prototype.init( elem, options, prop, end, easing );
  14440. }
  14441. jQuery.Tween = Tween;
  14442. Tween.prototype = {
  14443. constructor: Tween,
  14444. init: function( elem, options, prop, end, easing, unit ) {
  14445. this.elem = elem;
  14446. this.prop = prop;
  14447. this.easing = easing || jQuery.easing._default;
  14448. this.options = options;
  14449. this.start = this.now = this.cur();
  14450. this.end = end;
  14451. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14452. },
  14453. cur: function() {
  14454. var hooks = Tween.propHooks[ this.prop ];
  14455. return hooks && hooks.get ?
  14456. hooks.get( this ) :
  14457. Tween.propHooks._default.get( this );
  14458. },
  14459. run: function( percent ) {
  14460. var eased,
  14461. hooks = Tween.propHooks[ this.prop ];
  14462. if ( this.options.duration ) {
  14463. this.pos = eased = jQuery.easing[ this.easing ](
  14464. percent, this.options.duration * percent, 0, 1, this.options.duration
  14465. );
  14466. } else {
  14467. this.pos = eased = percent;
  14468. }
  14469. this.now = ( this.end - this.start ) * eased + this.start;
  14470. if ( this.options.step ) {
  14471. this.options.step.call( this.elem, this.now, this );
  14472. }
  14473. if ( hooks && hooks.set ) {
  14474. hooks.set( this );
  14475. } else {
  14476. Tween.propHooks._default.set( this );
  14477. }
  14478. return this;
  14479. }
  14480. };
  14481. Tween.prototype.init.prototype = Tween.prototype;
  14482. Tween.propHooks = {
  14483. _default: {
  14484. get: function( tween ) {
  14485. var result;
  14486. // Use a property on the element directly when it is not a DOM element,
  14487. // or when there is no matching style property that exists.
  14488. if ( tween.elem.nodeType !== 1 ||
  14489. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14490. return tween.elem[ tween.prop ];
  14491. }
  14492. // Passing an empty string as a 3rd parameter to .css will automatically
  14493. // attempt a parseFloat and fallback to a string if the parse fails.
  14494. // Simple values such as "10px" are parsed to Float;
  14495. // complex values such as "rotate(1rad)" are returned as-is.
  14496. result = jQuery.css( tween.elem, tween.prop, "" );
  14497. // Empty strings, null, undefined and "auto" are converted to 0.
  14498. return !result || result === "auto" ? 0 : result;
  14499. },
  14500. set: function( tween ) {
  14501. // Use step hook for back compat.
  14502. // Use cssHook if its there.
  14503. // Use .style if available and use plain properties where available.
  14504. if ( jQuery.fx.step[ tween.prop ] ) {
  14505. jQuery.fx.step[ tween.prop ]( tween );
  14506. } else if ( tween.elem.nodeType === 1 && (
  14507. jQuery.cssHooks[ tween.prop ] ||
  14508. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14509. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14510. } else {
  14511. tween.elem[ tween.prop ] = tween.now;
  14512. }
  14513. }
  14514. }
  14515. };
  14516. // Support: IE <=9 only
  14517. // Panic based approach to setting things on disconnected nodes
  14518. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14519. set: function( tween ) {
  14520. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14521. tween.elem[ tween.prop ] = tween.now;
  14522. }
  14523. }
  14524. };
  14525. jQuery.easing = {
  14526. linear: function( p ) {
  14527. return p;
  14528. },
  14529. swing: function( p ) {
  14530. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14531. },
  14532. _default: "swing"
  14533. };
  14534. jQuery.fx = Tween.prototype.init;
  14535. // Back compat <1.8 extension point
  14536. jQuery.fx.step = {};
  14537. var
  14538. fxNow, inProgress,
  14539. rfxtypes = /^(?:toggle|show|hide)$/,
  14540. rrun = /queueHooks$/;
  14541. function schedule() {
  14542. if ( inProgress ) {
  14543. if ( document.hidden === false && window.requestAnimationFrame ) {
  14544. window.requestAnimationFrame( schedule );
  14545. } else {
  14546. window.setTimeout( schedule, jQuery.fx.interval );
  14547. }
  14548. jQuery.fx.tick();
  14549. }
  14550. }
  14551. // Animations created synchronously will run synchronously
  14552. function createFxNow() {
  14553. window.setTimeout( function() {
  14554. fxNow = undefined;
  14555. } );
  14556. return ( fxNow = Date.now() );
  14557. }
  14558. // Generate parameters to create a standard animation
  14559. function genFx( type, includeWidth ) {
  14560. var which,
  14561. i = 0,
  14562. attrs = { height: type };
  14563. // If we include width, step value is 1 to do all cssExpand values,
  14564. // otherwise step value is 2 to skip over Left and Right
  14565. includeWidth = includeWidth ? 1 : 0;
  14566. for ( ; i < 4; i += 2 - includeWidth ) {
  14567. which = cssExpand[ i ];
  14568. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14569. }
  14570. if ( includeWidth ) {
  14571. attrs.opacity = attrs.width = type;
  14572. }
  14573. return attrs;
  14574. }
  14575. function createTween( value, prop, animation ) {
  14576. var tween,
  14577. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14578. index = 0,
  14579. length = collection.length;
  14580. for ( ; index < length; index++ ) {
  14581. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14582. // We're done with this property
  14583. return tween;
  14584. }
  14585. }
  14586. }
  14587. function defaultPrefilter( elem, props, opts ) {
  14588. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14589. isBox = "width" in props || "height" in props,
  14590. anim = this,
  14591. orig = {},
  14592. style = elem.style,
  14593. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14594. dataShow = dataPriv.get( elem, "fxshow" );
  14595. // Queue-skipping animations hijack the fx hooks
  14596. if ( !opts.queue ) {
  14597. hooks = jQuery._queueHooks( elem, "fx" );
  14598. if ( hooks.unqueued == null ) {
  14599. hooks.unqueued = 0;
  14600. oldfire = hooks.empty.fire;
  14601. hooks.empty.fire = function() {
  14602. if ( !hooks.unqueued ) {
  14603. oldfire();
  14604. }
  14605. };
  14606. }
  14607. hooks.unqueued++;
  14608. anim.always( function() {
  14609. // Ensure the complete handler is called before this completes
  14610. anim.always( function() {
  14611. hooks.unqueued--;
  14612. if ( !jQuery.queue( elem, "fx" ).length ) {
  14613. hooks.empty.fire();
  14614. }
  14615. } );
  14616. } );
  14617. }
  14618. // Detect show/hide animations
  14619. for ( prop in props ) {
  14620. value = props[ prop ];
  14621. if ( rfxtypes.test( value ) ) {
  14622. delete props[ prop ];
  14623. toggle = toggle || value === "toggle";
  14624. if ( value === ( hidden ? "hide" : "show" ) ) {
  14625. // Pretend to be hidden if this is a "show" and
  14626. // there is still data from a stopped show/hide
  14627. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14628. hidden = true;
  14629. // Ignore all other no-op show/hide data
  14630. } else {
  14631. continue;
  14632. }
  14633. }
  14634. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14635. }
  14636. }
  14637. // Bail out if this is a no-op like .hide().hide()
  14638. propTween = !jQuery.isEmptyObject( props );
  14639. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14640. return;
  14641. }
  14642. // Restrict "overflow" and "display" styles during box animations
  14643. if ( isBox && elem.nodeType === 1 ) {
  14644. // Support: IE <=9 - 11, Edge 12 - 15
  14645. // Record all 3 overflow attributes because IE does not infer the shorthand
  14646. // from identically-valued overflowX and overflowY and Edge just mirrors
  14647. // the overflowX value there.
  14648. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14649. // Identify a display type, preferring old show/hide data over the CSS cascade
  14650. restoreDisplay = dataShow && dataShow.display;
  14651. if ( restoreDisplay == null ) {
  14652. restoreDisplay = dataPriv.get( elem, "display" );
  14653. }
  14654. display = jQuery.css( elem, "display" );
  14655. if ( display === "none" ) {
  14656. if ( restoreDisplay ) {
  14657. display = restoreDisplay;
  14658. } else {
  14659. // Get nonempty value(s) by temporarily forcing visibility
  14660. showHide( [ elem ], true );
  14661. restoreDisplay = elem.style.display || restoreDisplay;
  14662. display = jQuery.css( elem, "display" );
  14663. showHide( [ elem ] );
  14664. }
  14665. }
  14666. // Animate inline elements as inline-block
  14667. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14668. if ( jQuery.css( elem, "float" ) === "none" ) {
  14669. // Restore the original display value at the end of pure show/hide animations
  14670. if ( !propTween ) {
  14671. anim.done( function() {
  14672. style.display = restoreDisplay;
  14673. } );
  14674. if ( restoreDisplay == null ) {
  14675. display = style.display;
  14676. restoreDisplay = display === "none" ? "" : display;
  14677. }
  14678. }
  14679. style.display = "inline-block";
  14680. }
  14681. }
  14682. }
  14683. if ( opts.overflow ) {
  14684. style.overflow = "hidden";
  14685. anim.always( function() {
  14686. style.overflow = opts.overflow[ 0 ];
  14687. style.overflowX = opts.overflow[ 1 ];
  14688. style.overflowY = opts.overflow[ 2 ];
  14689. } );
  14690. }
  14691. // Implement show/hide animations
  14692. propTween = false;
  14693. for ( prop in orig ) {
  14694. // General show/hide setup for this element animation
  14695. if ( !propTween ) {
  14696. if ( dataShow ) {
  14697. if ( "hidden" in dataShow ) {
  14698. hidden = dataShow.hidden;
  14699. }
  14700. } else {
  14701. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14702. }
  14703. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14704. if ( toggle ) {
  14705. dataShow.hidden = !hidden;
  14706. }
  14707. // Show elements before animating them
  14708. if ( hidden ) {
  14709. showHide( [ elem ], true );
  14710. }
  14711. /* eslint-disable no-loop-func */
  14712. anim.done( function() {
  14713. /* eslint-enable no-loop-func */
  14714. // The final step of a "hide" animation is actually hiding the element
  14715. if ( !hidden ) {
  14716. showHide( [ elem ] );
  14717. }
  14718. dataPriv.remove( elem, "fxshow" );
  14719. for ( prop in orig ) {
  14720. jQuery.style( elem, prop, orig[ prop ] );
  14721. }
  14722. } );
  14723. }
  14724. // Per-property setup
  14725. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14726. if ( !( prop in dataShow ) ) {
  14727. dataShow[ prop ] = propTween.start;
  14728. if ( hidden ) {
  14729. propTween.end = propTween.start;
  14730. propTween.start = 0;
  14731. }
  14732. }
  14733. }
  14734. }
  14735. function propFilter( props, specialEasing ) {
  14736. var index, name, easing, value, hooks;
  14737. // camelCase, specialEasing and expand cssHook pass
  14738. for ( index in props ) {
  14739. name = camelCase( index );
  14740. easing = specialEasing[ name ];
  14741. value = props[ index ];
  14742. if ( Array.isArray( value ) ) {
  14743. easing = value[ 1 ];
  14744. value = props[ index ] = value[ 0 ];
  14745. }
  14746. if ( index !== name ) {
  14747. props[ name ] = value;
  14748. delete props[ index ];
  14749. }
  14750. hooks = jQuery.cssHooks[ name ];
  14751. if ( hooks && "expand" in hooks ) {
  14752. value = hooks.expand( value );
  14753. delete props[ name ];
  14754. // Not quite $.extend, this won't overwrite existing keys.
  14755. // Reusing 'index' because we have the correct "name"
  14756. for ( index in value ) {
  14757. if ( !( index in props ) ) {
  14758. props[ index ] = value[ index ];
  14759. specialEasing[ index ] = easing;
  14760. }
  14761. }
  14762. } else {
  14763. specialEasing[ name ] = easing;
  14764. }
  14765. }
  14766. }
  14767. function Animation( elem, properties, options ) {
  14768. var result,
  14769. stopped,
  14770. index = 0,
  14771. length = Animation.prefilters.length,
  14772. deferred = jQuery.Deferred().always( function() {
  14773. // Don't match elem in the :animated selector
  14774. delete tick.elem;
  14775. } ),
  14776. tick = function() {
  14777. if ( stopped ) {
  14778. return false;
  14779. }
  14780. var currentTime = fxNow || createFxNow(),
  14781. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14782. // Support: Android 2.3 only
  14783. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14784. temp = remaining / animation.duration || 0,
  14785. percent = 1 - temp,
  14786. index = 0,
  14787. length = animation.tweens.length;
  14788. for ( ; index < length; index++ ) {
  14789. animation.tweens[ index ].run( percent );
  14790. }
  14791. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14792. // If there's more to do, yield
  14793. if ( percent < 1 && length ) {
  14794. return remaining;
  14795. }
  14796. // If this was an empty animation, synthesize a final progress notification
  14797. if ( !length ) {
  14798. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14799. }
  14800. // Resolve the animation and report its conclusion
  14801. deferred.resolveWith( elem, [ animation ] );
  14802. return false;
  14803. },
  14804. animation = deferred.promise( {
  14805. elem: elem,
  14806. props: jQuery.extend( {}, properties ),
  14807. opts: jQuery.extend( true, {
  14808. specialEasing: {},
  14809. easing: jQuery.easing._default
  14810. }, options ),
  14811. originalProperties: properties,
  14812. originalOptions: options,
  14813. startTime: fxNow || createFxNow(),
  14814. duration: options.duration,
  14815. tweens: [],
  14816. createTween: function( prop, end ) {
  14817. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14818. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14819. animation.tweens.push( tween );
  14820. return tween;
  14821. },
  14822. stop: function( gotoEnd ) {
  14823. var index = 0,
  14824. // If we are going to the end, we want to run all the tweens
  14825. // otherwise we skip this part
  14826. length = gotoEnd ? animation.tweens.length : 0;
  14827. if ( stopped ) {
  14828. return this;
  14829. }
  14830. stopped = true;
  14831. for ( ; index < length; index++ ) {
  14832. animation.tweens[ index ].run( 1 );
  14833. }
  14834. // Resolve when we played the last frame; otherwise, reject
  14835. if ( gotoEnd ) {
  14836. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14837. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14838. } else {
  14839. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14840. }
  14841. return this;
  14842. }
  14843. } ),
  14844. props = animation.props;
  14845. propFilter( props, animation.opts.specialEasing );
  14846. for ( ; index < length; index++ ) {
  14847. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14848. if ( result ) {
  14849. if ( isFunction( result.stop ) ) {
  14850. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14851. result.stop.bind( result );
  14852. }
  14853. return result;
  14854. }
  14855. }
  14856. jQuery.map( props, createTween, animation );
  14857. if ( isFunction( animation.opts.start ) ) {
  14858. animation.opts.start.call( elem, animation );
  14859. }
  14860. // Attach callbacks from options
  14861. animation
  14862. .progress( animation.opts.progress )
  14863. .done( animation.opts.done, animation.opts.complete )
  14864. .fail( animation.opts.fail )
  14865. .always( animation.opts.always );
  14866. jQuery.fx.timer(
  14867. jQuery.extend( tick, {
  14868. elem: elem,
  14869. anim: animation,
  14870. queue: animation.opts.queue
  14871. } )
  14872. );
  14873. return animation;
  14874. }
  14875. jQuery.Animation = jQuery.extend( Animation, {
  14876. tweeners: {
  14877. "*": [ function( prop, value ) {
  14878. var tween = this.createTween( prop, value );
  14879. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14880. return tween;
  14881. } ]
  14882. },
  14883. tweener: function( props, callback ) {
  14884. if ( isFunction( props ) ) {
  14885. callback = props;
  14886. props = [ "*" ];
  14887. } else {
  14888. props = props.match( rnothtmlwhite );
  14889. }
  14890. var prop,
  14891. index = 0,
  14892. length = props.length;
  14893. for ( ; index < length; index++ ) {
  14894. prop = props[ index ];
  14895. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14896. Animation.tweeners[ prop ].unshift( callback );
  14897. }
  14898. },
  14899. prefilters: [ defaultPrefilter ],
  14900. prefilter: function( callback, prepend ) {
  14901. if ( prepend ) {
  14902. Animation.prefilters.unshift( callback );
  14903. } else {
  14904. Animation.prefilters.push( callback );
  14905. }
  14906. }
  14907. } );
  14908. jQuery.speed = function( speed, easing, fn ) {
  14909. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14910. complete: fn || !fn && easing ||
  14911. isFunction( speed ) && speed,
  14912. duration: speed,
  14913. easing: fn && easing || easing && !isFunction( easing ) && easing
  14914. };
  14915. // Go to the end state if fx are off
  14916. if ( jQuery.fx.off ) {
  14917. opt.duration = 0;
  14918. } else {
  14919. if ( typeof opt.duration !== "number" ) {
  14920. if ( opt.duration in jQuery.fx.speeds ) {
  14921. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14922. } else {
  14923. opt.duration = jQuery.fx.speeds._default;
  14924. }
  14925. }
  14926. }
  14927. // Normalize opt.queue - true/undefined/null -> "fx"
  14928. if ( opt.queue == null || opt.queue === true ) {
  14929. opt.queue = "fx";
  14930. }
  14931. // Queueing
  14932. opt.old = opt.complete;
  14933. opt.complete = function() {
  14934. if ( isFunction( opt.old ) ) {
  14935. opt.old.call( this );
  14936. }
  14937. if ( opt.queue ) {
  14938. jQuery.dequeue( this, opt.queue );
  14939. }
  14940. };
  14941. return opt;
  14942. };
  14943. jQuery.fn.extend( {
  14944. fadeTo: function( speed, to, easing, callback ) {
  14945. // Show any hidden elements after setting opacity to 0
  14946. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14947. // Animate to the value specified
  14948. .end().animate( { opacity: to }, speed, easing, callback );
  14949. },
  14950. animate: function( prop, speed, easing, callback ) {
  14951. var empty = jQuery.isEmptyObject( prop ),
  14952. optall = jQuery.speed( speed, easing, callback ),
  14953. doAnimation = function() {
  14954. // Operate on a copy of prop so per-property easing won't be lost
  14955. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14956. // Empty animations, or finishing resolves immediately
  14957. if ( empty || dataPriv.get( this, "finish" ) ) {
  14958. anim.stop( true );
  14959. }
  14960. };
  14961. doAnimation.finish = doAnimation;
  14962. return empty || optall.queue === false ?
  14963. this.each( doAnimation ) :
  14964. this.queue( optall.queue, doAnimation );
  14965. },
  14966. stop: function( type, clearQueue, gotoEnd ) {
  14967. var stopQueue = function( hooks ) {
  14968. var stop = hooks.stop;
  14969. delete hooks.stop;
  14970. stop( gotoEnd );
  14971. };
  14972. if ( typeof type !== "string" ) {
  14973. gotoEnd = clearQueue;
  14974. clearQueue = type;
  14975. type = undefined;
  14976. }
  14977. if ( clearQueue && type !== false ) {
  14978. this.queue( type || "fx", [] );
  14979. }
  14980. return this.each( function() {
  14981. var dequeue = true,
  14982. index = type != null && type + "queueHooks",
  14983. timers = jQuery.timers,
  14984. data = dataPriv.get( this );
  14985. if ( index ) {
  14986. if ( data[ index ] && data[ index ].stop ) {
  14987. stopQueue( data[ index ] );
  14988. }
  14989. } else {
  14990. for ( index in data ) {
  14991. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14992. stopQueue( data[ index ] );
  14993. }
  14994. }
  14995. }
  14996. for ( index = timers.length; index--; ) {
  14997. if ( timers[ index ].elem === this &&
  14998. ( type == null || timers[ index ].queue === type ) ) {
  14999. timers[ index ].anim.stop( gotoEnd );
  15000. dequeue = false;
  15001. timers.splice( index, 1 );
  15002. }
  15003. }
  15004. // Start the next in the queue if the last step wasn't forced.
  15005. // Timers currently will call their complete callbacks, which
  15006. // will dequeue but only if they were gotoEnd.
  15007. if ( dequeue || !gotoEnd ) {
  15008. jQuery.dequeue( this, type );
  15009. }
  15010. } );
  15011. },
  15012. finish: function( type ) {
  15013. if ( type !== false ) {
  15014. type = type || "fx";
  15015. }
  15016. return this.each( function() {
  15017. var index,
  15018. data = dataPriv.get( this ),
  15019. queue = data[ type + "queue" ],
  15020. hooks = data[ type + "queueHooks" ],
  15021. timers = jQuery.timers,
  15022. length = queue ? queue.length : 0;
  15023. // Enable finishing flag on private data
  15024. data.finish = true;
  15025. // Empty the queue first
  15026. jQuery.queue( this, type, [] );
  15027. if ( hooks && hooks.stop ) {
  15028. hooks.stop.call( this, true );
  15029. }
  15030. // Look for any active animations, and finish them
  15031. for ( index = timers.length; index--; ) {
  15032. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15033. timers[ index ].anim.stop( true );
  15034. timers.splice( index, 1 );
  15035. }
  15036. }
  15037. // Look for any animations in the old queue and finish them
  15038. for ( index = 0; index < length; index++ ) {
  15039. if ( queue[ index ] && queue[ index ].finish ) {
  15040. queue[ index ].finish.call( this );
  15041. }
  15042. }
  15043. // Turn off finishing flag
  15044. delete data.finish;
  15045. } );
  15046. }
  15047. } );
  15048. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15049. var cssFn = jQuery.fn[ name ];
  15050. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15051. return speed == null || typeof speed === "boolean" ?
  15052. cssFn.apply( this, arguments ) :
  15053. this.animate( genFx( name, true ), speed, easing, callback );
  15054. };
  15055. } );
  15056. // Generate shortcuts for custom animations
  15057. jQuery.each( {
  15058. slideDown: genFx( "show" ),
  15059. slideUp: genFx( "hide" ),
  15060. slideToggle: genFx( "toggle" ),
  15061. fadeIn: { opacity: "show" },
  15062. fadeOut: { opacity: "hide" },
  15063. fadeToggle: { opacity: "toggle" }
  15064. }, function( name, props ) {
  15065. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15066. return this.animate( props, speed, easing, callback );
  15067. };
  15068. } );
  15069. jQuery.timers = [];
  15070. jQuery.fx.tick = function() {
  15071. var timer,
  15072. i = 0,
  15073. timers = jQuery.timers;
  15074. fxNow = Date.now();
  15075. for ( ; i < timers.length; i++ ) {
  15076. timer = timers[ i ];
  15077. // Run the timer and safely remove it when done (allowing for external removal)
  15078. if ( !timer() && timers[ i ] === timer ) {
  15079. timers.splice( i--, 1 );
  15080. }
  15081. }
  15082. if ( !timers.length ) {
  15083. jQuery.fx.stop();
  15084. }
  15085. fxNow = undefined;
  15086. };
  15087. jQuery.fx.timer = function( timer ) {
  15088. jQuery.timers.push( timer );
  15089. jQuery.fx.start();
  15090. };
  15091. jQuery.fx.interval = 13;
  15092. jQuery.fx.start = function() {
  15093. if ( inProgress ) {
  15094. return;
  15095. }
  15096. inProgress = true;
  15097. schedule();
  15098. };
  15099. jQuery.fx.stop = function() {
  15100. inProgress = null;
  15101. };
  15102. jQuery.fx.speeds = {
  15103. slow: 600,
  15104. fast: 200,
  15105. // Default speed
  15106. _default: 400
  15107. };
  15108. // Based off of the plugin by Clint Helfers, with permission.
  15109. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15110. jQuery.fn.delay = function( time, type ) {
  15111. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15112. type = type || "fx";
  15113. return this.queue( type, function( next, hooks ) {
  15114. var timeout = window.setTimeout( next, time );
  15115. hooks.stop = function() {
  15116. window.clearTimeout( timeout );
  15117. };
  15118. } );
  15119. };
  15120. ( function() {
  15121. var input = document.createElement( "input" ),
  15122. select = document.createElement( "select" ),
  15123. opt = select.appendChild( document.createElement( "option" ) );
  15124. input.type = "checkbox";
  15125. // Support: Android <=4.3 only
  15126. // Default value for a checkbox should be "on"
  15127. support.checkOn = input.value !== "";
  15128. // Support: IE <=11 only
  15129. // Must access selectedIndex to make default options select
  15130. support.optSelected = opt.selected;
  15131. // Support: IE <=11 only
  15132. // An input loses its value after becoming a radio
  15133. input = document.createElement( "input" );
  15134. input.value = "t";
  15135. input.type = "radio";
  15136. support.radioValue = input.value === "t";
  15137. } )();
  15138. var boolHook,
  15139. attrHandle = jQuery.expr.attrHandle;
  15140. jQuery.fn.extend( {
  15141. attr: function( name, value ) {
  15142. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15143. },
  15144. removeAttr: function( name ) {
  15145. return this.each( function() {
  15146. jQuery.removeAttr( this, name );
  15147. } );
  15148. }
  15149. } );
  15150. jQuery.extend( {
  15151. attr: function( elem, name, value ) {
  15152. var ret, hooks,
  15153. nType = elem.nodeType;
  15154. // Don't get/set attributes on text, comment and attribute nodes
  15155. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15156. return;
  15157. }
  15158. // Fallback to prop when attributes are not supported
  15159. if ( typeof elem.getAttribute === "undefined" ) {
  15160. return jQuery.prop( elem, name, value );
  15161. }
  15162. // Attribute hooks are determined by the lowercase version
  15163. // Grab necessary hook if one is defined
  15164. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15165. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15166. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15167. }
  15168. if ( value !== undefined ) {
  15169. if ( value === null ) {
  15170. jQuery.removeAttr( elem, name );
  15171. return;
  15172. }
  15173. if ( hooks && "set" in hooks &&
  15174. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15175. return ret;
  15176. }
  15177. elem.setAttribute( name, value + "" );
  15178. return value;
  15179. }
  15180. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15181. return ret;
  15182. }
  15183. ret = jQuery.find.attr( elem, name );
  15184. // Non-existent attributes return null, we normalize to undefined
  15185. return ret == null ? undefined : ret;
  15186. },
  15187. attrHooks: {
  15188. type: {
  15189. set: function( elem, value ) {
  15190. if ( !support.radioValue && value === "radio" &&
  15191. nodeName( elem, "input" ) ) {
  15192. var val = elem.value;
  15193. elem.setAttribute( "type", value );
  15194. if ( val ) {
  15195. elem.value = val;
  15196. }
  15197. return value;
  15198. }
  15199. }
  15200. }
  15201. },
  15202. removeAttr: function( elem, value ) {
  15203. var name,
  15204. i = 0,
  15205. // Attribute names can contain non-HTML whitespace characters
  15206. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15207. attrNames = value && value.match( rnothtmlwhite );
  15208. if ( attrNames && elem.nodeType === 1 ) {
  15209. while ( ( name = attrNames[ i++ ] ) ) {
  15210. elem.removeAttribute( name );
  15211. }
  15212. }
  15213. }
  15214. } );
  15215. // Hooks for boolean attributes
  15216. boolHook = {
  15217. set: function( elem, value, name ) {
  15218. if ( value === false ) {
  15219. // Remove boolean attributes when set to false
  15220. jQuery.removeAttr( elem, name );
  15221. } else {
  15222. elem.setAttribute( name, name );
  15223. }
  15224. return name;
  15225. }
  15226. };
  15227. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15228. var getter = attrHandle[ name ] || jQuery.find.attr;
  15229. attrHandle[ name ] = function( elem, name, isXML ) {
  15230. var ret, handle,
  15231. lowercaseName = name.toLowerCase();
  15232. if ( !isXML ) {
  15233. // Avoid an infinite loop by temporarily removing this function from the getter
  15234. handle = attrHandle[ lowercaseName ];
  15235. attrHandle[ lowercaseName ] = ret;
  15236. ret = getter( elem, name, isXML ) != null ?
  15237. lowercaseName :
  15238. null;
  15239. attrHandle[ lowercaseName ] = handle;
  15240. }
  15241. return ret;
  15242. };
  15243. } );
  15244. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15245. rclickable = /^(?:a|area)$/i;
  15246. jQuery.fn.extend( {
  15247. prop: function( name, value ) {
  15248. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15249. },
  15250. removeProp: function( name ) {
  15251. return this.each( function() {
  15252. delete this[ jQuery.propFix[ name ] || name ];
  15253. } );
  15254. }
  15255. } );
  15256. jQuery.extend( {
  15257. prop: function( elem, name, value ) {
  15258. var ret, hooks,
  15259. nType = elem.nodeType;
  15260. // Don't get/set properties on text, comment and attribute nodes
  15261. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15262. return;
  15263. }
  15264. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15265. // Fix name and attach hooks
  15266. name = jQuery.propFix[ name ] || name;
  15267. hooks = jQuery.propHooks[ name ];
  15268. }
  15269. if ( value !== undefined ) {
  15270. if ( hooks && "set" in hooks &&
  15271. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15272. return ret;
  15273. }
  15274. return ( elem[ name ] = value );
  15275. }
  15276. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15277. return ret;
  15278. }
  15279. return elem[ name ];
  15280. },
  15281. propHooks: {
  15282. tabIndex: {
  15283. get: function( elem ) {
  15284. // Support: IE <=9 - 11 only
  15285. // elem.tabIndex doesn't always return the
  15286. // correct value when it hasn't been explicitly set
  15287. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15288. // Use proper attribute retrieval(#12072)
  15289. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15290. if ( tabindex ) {
  15291. return parseInt( tabindex, 10 );
  15292. }
  15293. if (
  15294. rfocusable.test( elem.nodeName ) ||
  15295. rclickable.test( elem.nodeName ) &&
  15296. elem.href
  15297. ) {
  15298. return 0;
  15299. }
  15300. return -1;
  15301. }
  15302. }
  15303. },
  15304. propFix: {
  15305. "for": "htmlFor",
  15306. "class": "className"
  15307. }
  15308. } );
  15309. // Support: IE <=11 only
  15310. // Accessing the selectedIndex property
  15311. // forces the browser to respect setting selected
  15312. // on the option
  15313. // The getter ensures a default option is selected
  15314. // when in an optgroup
  15315. // eslint rule "no-unused-expressions" is disabled for this code
  15316. // since it considers such accessions noop
  15317. if ( !support.optSelected ) {
  15318. jQuery.propHooks.selected = {
  15319. get: function( elem ) {
  15320. /* eslint no-unused-expressions: "off" */
  15321. var parent = elem.parentNode;
  15322. if ( parent && parent.parentNode ) {
  15323. parent.parentNode.selectedIndex;
  15324. }
  15325. return null;
  15326. },
  15327. set: function( elem ) {
  15328. /* eslint no-unused-expressions: "off" */
  15329. var parent = elem.parentNode;
  15330. if ( parent ) {
  15331. parent.selectedIndex;
  15332. if ( parent.parentNode ) {
  15333. parent.parentNode.selectedIndex;
  15334. }
  15335. }
  15336. }
  15337. };
  15338. }
  15339. jQuery.each( [
  15340. "tabIndex",
  15341. "readOnly",
  15342. "maxLength",
  15343. "cellSpacing",
  15344. "cellPadding",
  15345. "rowSpan",
  15346. "colSpan",
  15347. "useMap",
  15348. "frameBorder",
  15349. "contentEditable"
  15350. ], function() {
  15351. jQuery.propFix[ this.toLowerCase() ] = this;
  15352. } );
  15353. // Strip and collapse whitespace according to HTML spec
  15354. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15355. function stripAndCollapse( value ) {
  15356. var tokens = value.match( rnothtmlwhite ) || [];
  15357. return tokens.join( " " );
  15358. }
  15359. function getClass( elem ) {
  15360. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15361. }
  15362. function classesToArray( value ) {
  15363. if ( Array.isArray( value ) ) {
  15364. return value;
  15365. }
  15366. if ( typeof value === "string" ) {
  15367. return value.match( rnothtmlwhite ) || [];
  15368. }
  15369. return [];
  15370. }
  15371. jQuery.fn.extend( {
  15372. addClass: function( value ) {
  15373. var classes, elem, cur, curValue, clazz, j, finalValue,
  15374. i = 0;
  15375. if ( isFunction( value ) ) {
  15376. return this.each( function( j ) {
  15377. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15378. } );
  15379. }
  15380. classes = classesToArray( value );
  15381. if ( classes.length ) {
  15382. while ( ( elem = this[ i++ ] ) ) {
  15383. curValue = getClass( elem );
  15384. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15385. if ( cur ) {
  15386. j = 0;
  15387. while ( ( clazz = classes[ j++ ] ) ) {
  15388. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15389. cur += clazz + " ";
  15390. }
  15391. }
  15392. // Only assign if different to avoid unneeded rendering.
  15393. finalValue = stripAndCollapse( cur );
  15394. if ( curValue !== finalValue ) {
  15395. elem.setAttribute( "class", finalValue );
  15396. }
  15397. }
  15398. }
  15399. }
  15400. return this;
  15401. },
  15402. removeClass: function( value ) {
  15403. var classes, elem, cur, curValue, clazz, j, finalValue,
  15404. i = 0;
  15405. if ( isFunction( value ) ) {
  15406. return this.each( function( j ) {
  15407. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15408. } );
  15409. }
  15410. if ( !arguments.length ) {
  15411. return this.attr( "class", "" );
  15412. }
  15413. classes = classesToArray( value );
  15414. if ( classes.length ) {
  15415. while ( ( elem = this[ i++ ] ) ) {
  15416. curValue = getClass( elem );
  15417. // This expression is here for better compressibility (see addClass)
  15418. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15419. if ( cur ) {
  15420. j = 0;
  15421. while ( ( clazz = classes[ j++ ] ) ) {
  15422. // Remove *all* instances
  15423. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15424. cur = cur.replace( " " + clazz + " ", " " );
  15425. }
  15426. }
  15427. // Only assign if different to avoid unneeded rendering.
  15428. finalValue = stripAndCollapse( cur );
  15429. if ( curValue !== finalValue ) {
  15430. elem.setAttribute( "class", finalValue );
  15431. }
  15432. }
  15433. }
  15434. }
  15435. return this;
  15436. },
  15437. toggleClass: function( value, stateVal ) {
  15438. var type = typeof value,
  15439. isValidValue = type === "string" || Array.isArray( value );
  15440. if ( typeof stateVal === "boolean" && isValidValue ) {
  15441. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15442. }
  15443. if ( isFunction( value ) ) {
  15444. return this.each( function( i ) {
  15445. jQuery( this ).toggleClass(
  15446. value.call( this, i, getClass( this ), stateVal ),
  15447. stateVal
  15448. );
  15449. } );
  15450. }
  15451. return this.each( function() {
  15452. var className, i, self, classNames;
  15453. if ( isValidValue ) {
  15454. // Toggle individual class names
  15455. i = 0;
  15456. self = jQuery( this );
  15457. classNames = classesToArray( value );
  15458. while ( ( className = classNames[ i++ ] ) ) {
  15459. // Check each className given, space separated list
  15460. if ( self.hasClass( className ) ) {
  15461. self.removeClass( className );
  15462. } else {
  15463. self.addClass( className );
  15464. }
  15465. }
  15466. // Toggle whole class name
  15467. } else if ( value === undefined || type === "boolean" ) {
  15468. className = getClass( this );
  15469. if ( className ) {
  15470. // Store className if set
  15471. dataPriv.set( this, "__className__", className );
  15472. }
  15473. // If the element has a class name or if we're passed `false`,
  15474. // then remove the whole classname (if there was one, the above saved it).
  15475. // Otherwise bring back whatever was previously saved (if anything),
  15476. // falling back to the empty string if nothing was stored.
  15477. if ( this.setAttribute ) {
  15478. this.setAttribute( "class",
  15479. className || value === false ?
  15480. "" :
  15481. dataPriv.get( this, "__className__" ) || ""
  15482. );
  15483. }
  15484. }
  15485. } );
  15486. },
  15487. hasClass: function( selector ) {
  15488. var className, elem,
  15489. i = 0;
  15490. className = " " + selector + " ";
  15491. while ( ( elem = this[ i++ ] ) ) {
  15492. if ( elem.nodeType === 1 &&
  15493. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15494. return true;
  15495. }
  15496. }
  15497. return false;
  15498. }
  15499. } );
  15500. var rreturn = /\r/g;
  15501. jQuery.fn.extend( {
  15502. val: function( value ) {
  15503. var hooks, ret, valueIsFunction,
  15504. elem = this[ 0 ];
  15505. if ( !arguments.length ) {
  15506. if ( elem ) {
  15507. hooks = jQuery.valHooks[ elem.type ] ||
  15508. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15509. if ( hooks &&
  15510. "get" in hooks &&
  15511. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15512. ) {
  15513. return ret;
  15514. }
  15515. ret = elem.value;
  15516. // Handle most common string cases
  15517. if ( typeof ret === "string" ) {
  15518. return ret.replace( rreturn, "" );
  15519. }
  15520. // Handle cases where value is null/undef or number
  15521. return ret == null ? "" : ret;
  15522. }
  15523. return;
  15524. }
  15525. valueIsFunction = isFunction( value );
  15526. return this.each( function( i ) {
  15527. var val;
  15528. if ( this.nodeType !== 1 ) {
  15529. return;
  15530. }
  15531. if ( valueIsFunction ) {
  15532. val = value.call( this, i, jQuery( this ).val() );
  15533. } else {
  15534. val = value;
  15535. }
  15536. // Treat null/undefined as ""; convert numbers to string
  15537. if ( val == null ) {
  15538. val = "";
  15539. } else if ( typeof val === "number" ) {
  15540. val += "";
  15541. } else if ( Array.isArray( val ) ) {
  15542. val = jQuery.map( val, function( value ) {
  15543. return value == null ? "" : value + "";
  15544. } );
  15545. }
  15546. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15547. // If set returns undefined, fall back to normal setting
  15548. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15549. this.value = val;
  15550. }
  15551. } );
  15552. }
  15553. } );
  15554. jQuery.extend( {
  15555. valHooks: {
  15556. option: {
  15557. get: function( elem ) {
  15558. var val = jQuery.find.attr( elem, "value" );
  15559. return val != null ?
  15560. val :
  15561. // Support: IE <=10 - 11 only
  15562. // option.text throws exceptions (#14686, #14858)
  15563. // Strip and collapse whitespace
  15564. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15565. stripAndCollapse( jQuery.text( elem ) );
  15566. }
  15567. },
  15568. select: {
  15569. get: function( elem ) {
  15570. var value, option, i,
  15571. options = elem.options,
  15572. index = elem.selectedIndex,
  15573. one = elem.type === "select-one",
  15574. values = one ? null : [],
  15575. max = one ? index + 1 : options.length;
  15576. if ( index < 0 ) {
  15577. i = max;
  15578. } else {
  15579. i = one ? index : 0;
  15580. }
  15581. // Loop through all the selected options
  15582. for ( ; i < max; i++ ) {
  15583. option = options[ i ];
  15584. // Support: IE <=9 only
  15585. // IE8-9 doesn't update selected after form reset (#2551)
  15586. if ( ( option.selected || i === index ) &&
  15587. // Don't return options that are disabled or in a disabled optgroup
  15588. !option.disabled &&
  15589. ( !option.parentNode.disabled ||
  15590. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15591. // Get the specific value for the option
  15592. value = jQuery( option ).val();
  15593. // We don't need an array for one selects
  15594. if ( one ) {
  15595. return value;
  15596. }
  15597. // Multi-Selects return an array
  15598. values.push( value );
  15599. }
  15600. }
  15601. return values;
  15602. },
  15603. set: function( elem, value ) {
  15604. var optionSet, option,
  15605. options = elem.options,
  15606. values = jQuery.makeArray( value ),
  15607. i = options.length;
  15608. while ( i-- ) {
  15609. option = options[ i ];
  15610. /* eslint-disable no-cond-assign */
  15611. if ( option.selected =
  15612. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15613. ) {
  15614. optionSet = true;
  15615. }
  15616. /* eslint-enable no-cond-assign */
  15617. }
  15618. // Force browsers to behave consistently when non-matching value is set
  15619. if ( !optionSet ) {
  15620. elem.selectedIndex = -1;
  15621. }
  15622. return values;
  15623. }
  15624. }
  15625. }
  15626. } );
  15627. // Radios and checkboxes getter/setter
  15628. jQuery.each( [ "radio", "checkbox" ], function() {
  15629. jQuery.valHooks[ this ] = {
  15630. set: function( elem, value ) {
  15631. if ( Array.isArray( value ) ) {
  15632. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15633. }
  15634. }
  15635. };
  15636. if ( !support.checkOn ) {
  15637. jQuery.valHooks[ this ].get = function( elem ) {
  15638. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15639. };
  15640. }
  15641. } );
  15642. // Return jQuery for attributes-only inclusion
  15643. support.focusin = "onfocusin" in window;
  15644. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15645. stopPropagationCallback = function( e ) {
  15646. e.stopPropagation();
  15647. };
  15648. jQuery.extend( jQuery.event, {
  15649. trigger: function( event, data, elem, onlyHandlers ) {
  15650. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15651. eventPath = [ elem || document ],
  15652. type = hasOwn.call( event, "type" ) ? event.type : event,
  15653. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15654. cur = lastElement = tmp = elem = elem || document;
  15655. // Don't do events on text and comment nodes
  15656. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15657. return;
  15658. }
  15659. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15660. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15661. return;
  15662. }
  15663. if ( type.indexOf( "." ) > -1 ) {
  15664. // Namespaced trigger; create a regexp to match event type in handle()
  15665. namespaces = type.split( "." );
  15666. type = namespaces.shift();
  15667. namespaces.sort();
  15668. }
  15669. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15670. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15671. event = event[ jQuery.expando ] ?
  15672. event :
  15673. new jQuery.Event( type, typeof event === "object" && event );
  15674. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15675. event.isTrigger = onlyHandlers ? 2 : 3;
  15676. event.namespace = namespaces.join( "." );
  15677. event.rnamespace = event.namespace ?
  15678. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15679. null;
  15680. // Clean up the event in case it is being reused
  15681. event.result = undefined;
  15682. if ( !event.target ) {
  15683. event.target = elem;
  15684. }
  15685. // Clone any incoming data and prepend the event, creating the handler arg list
  15686. data = data == null ?
  15687. [ event ] :
  15688. jQuery.makeArray( data, [ event ] );
  15689. // Allow special events to draw outside the lines
  15690. special = jQuery.event.special[ type ] || {};
  15691. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15692. return;
  15693. }
  15694. // Determine event propagation path in advance, per W3C events spec (#9951)
  15695. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15696. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15697. bubbleType = special.delegateType || type;
  15698. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15699. cur = cur.parentNode;
  15700. }
  15701. for ( ; cur; cur = cur.parentNode ) {
  15702. eventPath.push( cur );
  15703. tmp = cur;
  15704. }
  15705. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15706. if ( tmp === ( elem.ownerDocument || document ) ) {
  15707. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15708. }
  15709. }
  15710. // Fire handlers on the event path
  15711. i = 0;
  15712. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15713. lastElement = cur;
  15714. event.type = i > 1 ?
  15715. bubbleType :
  15716. special.bindType || type;
  15717. // jQuery handler
  15718. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15719. dataPriv.get( cur, "handle" );
  15720. if ( handle ) {
  15721. handle.apply( cur, data );
  15722. }
  15723. // Native handler
  15724. handle = ontype && cur[ ontype ];
  15725. if ( handle && handle.apply && acceptData( cur ) ) {
  15726. event.result = handle.apply( cur, data );
  15727. if ( event.result === false ) {
  15728. event.preventDefault();
  15729. }
  15730. }
  15731. }
  15732. event.type = type;
  15733. // If nobody prevented the default action, do it now
  15734. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15735. if ( ( !special._default ||
  15736. special._default.apply( eventPath.pop(), data ) === false ) &&
  15737. acceptData( elem ) ) {
  15738. // Call a native DOM method on the target with the same name as the event.
  15739. // Don't do default actions on window, that's where global variables be (#6170)
  15740. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15741. // Don't re-trigger an onFOO event when we call its FOO() method
  15742. tmp = elem[ ontype ];
  15743. if ( tmp ) {
  15744. elem[ ontype ] = null;
  15745. }
  15746. // Prevent re-triggering of the same event, since we already bubbled it above
  15747. jQuery.event.triggered = type;
  15748. if ( event.isPropagationStopped() ) {
  15749. lastElement.addEventListener( type, stopPropagationCallback );
  15750. }
  15751. elem[ type ]();
  15752. if ( event.isPropagationStopped() ) {
  15753. lastElement.removeEventListener( type, stopPropagationCallback );
  15754. }
  15755. jQuery.event.triggered = undefined;
  15756. if ( tmp ) {
  15757. elem[ ontype ] = tmp;
  15758. }
  15759. }
  15760. }
  15761. }
  15762. return event.result;
  15763. },
  15764. // Piggyback on a donor event to simulate a different one
  15765. // Used only for `focus(in | out)` events
  15766. simulate: function( type, elem, event ) {
  15767. var e = jQuery.extend(
  15768. new jQuery.Event(),
  15769. event,
  15770. {
  15771. type: type,
  15772. isSimulated: true
  15773. }
  15774. );
  15775. jQuery.event.trigger( e, null, elem );
  15776. }
  15777. } );
  15778. jQuery.fn.extend( {
  15779. trigger: function( type, data ) {
  15780. return this.each( function() {
  15781. jQuery.event.trigger( type, data, this );
  15782. } );
  15783. },
  15784. triggerHandler: function( type, data ) {
  15785. var elem = this[ 0 ];
  15786. if ( elem ) {
  15787. return jQuery.event.trigger( type, data, elem, true );
  15788. }
  15789. }
  15790. } );
  15791. // Support: Firefox <=44
  15792. // Firefox doesn't have focus(in | out) events
  15793. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15794. //
  15795. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15796. // focus(in | out) events fire after focus & blur events,
  15797. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15798. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15799. if ( !support.focusin ) {
  15800. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15801. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15802. var handler = function( event ) {
  15803. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15804. };
  15805. jQuery.event.special[ fix ] = {
  15806. setup: function() {
  15807. var doc = this.ownerDocument || this,
  15808. attaches = dataPriv.access( doc, fix );
  15809. if ( !attaches ) {
  15810. doc.addEventListener( orig, handler, true );
  15811. }
  15812. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15813. },
  15814. teardown: function() {
  15815. var doc = this.ownerDocument || this,
  15816. attaches = dataPriv.access( doc, fix ) - 1;
  15817. if ( !attaches ) {
  15818. doc.removeEventListener( orig, handler, true );
  15819. dataPriv.remove( doc, fix );
  15820. } else {
  15821. dataPriv.access( doc, fix, attaches );
  15822. }
  15823. }
  15824. };
  15825. } );
  15826. }
  15827. var location = window.location;
  15828. var nonce = Date.now();
  15829. var rquery = ( /\?/ );
  15830. // Cross-browser xml parsing
  15831. jQuery.parseXML = function( data ) {
  15832. var xml;
  15833. if ( !data || typeof data !== "string" ) {
  15834. return null;
  15835. }
  15836. // Support: IE 9 - 11 only
  15837. // IE throws on parseFromString with invalid input.
  15838. try {
  15839. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15840. } catch ( e ) {
  15841. xml = undefined;
  15842. }
  15843. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15844. jQuery.error( "Invalid XML: " + data );
  15845. }
  15846. return xml;
  15847. };
  15848. var
  15849. rbracket = /\[\]$/,
  15850. rCRLF = /\r?\n/g,
  15851. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15852. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15853. function buildParams( prefix, obj, traditional, add ) {
  15854. var name;
  15855. if ( Array.isArray( obj ) ) {
  15856. // Serialize array item.
  15857. jQuery.each( obj, function( i, v ) {
  15858. if ( traditional || rbracket.test( prefix ) ) {
  15859. // Treat each array item as a scalar.
  15860. add( prefix, v );
  15861. } else {
  15862. // Item is non-scalar (array or object), encode its numeric index.
  15863. buildParams(
  15864. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15865. v,
  15866. traditional,
  15867. add
  15868. );
  15869. }
  15870. } );
  15871. } else if ( !traditional && toType( obj ) === "object" ) {
  15872. // Serialize object item.
  15873. for ( name in obj ) {
  15874. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15875. }
  15876. } else {
  15877. // Serialize scalar item.
  15878. add( prefix, obj );
  15879. }
  15880. }
  15881. // Serialize an array of form elements or a set of
  15882. // key/values into a query string
  15883. jQuery.param = function( a, traditional ) {
  15884. var prefix,
  15885. s = [],
  15886. add = function( key, valueOrFunction ) {
  15887. // If value is a function, invoke it and use its return value
  15888. var value = isFunction( valueOrFunction ) ?
  15889. valueOrFunction() :
  15890. valueOrFunction;
  15891. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15892. encodeURIComponent( value == null ? "" : value );
  15893. };
  15894. if ( a == null ) {
  15895. return "";
  15896. }
  15897. // If an array was passed in, assume that it is an array of form elements.
  15898. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15899. // Serialize the form elements
  15900. jQuery.each( a, function() {
  15901. add( this.name, this.value );
  15902. } );
  15903. } else {
  15904. // If traditional, encode the "old" way (the way 1.3.2 or older
  15905. // did it), otherwise encode params recursively.
  15906. for ( prefix in a ) {
  15907. buildParams( prefix, a[ prefix ], traditional, add );
  15908. }
  15909. }
  15910. // Return the resulting serialization
  15911. return s.join( "&" );
  15912. };
  15913. jQuery.fn.extend( {
  15914. serialize: function() {
  15915. return jQuery.param( this.serializeArray() );
  15916. },
  15917. serializeArray: function() {
  15918. return this.map( function() {
  15919. // Can add propHook for "elements" to filter or add form elements
  15920. var elements = jQuery.prop( this, "elements" );
  15921. return elements ? jQuery.makeArray( elements ) : this;
  15922. } )
  15923. .filter( function() {
  15924. var type = this.type;
  15925. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15926. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15927. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15928. ( this.checked || !rcheckableType.test( type ) );
  15929. } )
  15930. .map( function( i, elem ) {
  15931. var val = jQuery( this ).val();
  15932. if ( val == null ) {
  15933. return null;
  15934. }
  15935. if ( Array.isArray( val ) ) {
  15936. return jQuery.map( val, function( val ) {
  15937. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15938. } );
  15939. }
  15940. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15941. } ).get();
  15942. }
  15943. } );
  15944. var
  15945. r20 = /%20/g,
  15946. rhash = /#.*$/,
  15947. rantiCache = /([?&])_=[^&]*/,
  15948. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15949. // #7653, #8125, #8152: local protocol detection
  15950. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15951. rnoContent = /^(?:GET|HEAD)$/,
  15952. rprotocol = /^\/\//,
  15953. /* Prefilters
  15954. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15955. * 2) These are called:
  15956. * - BEFORE asking for a transport
  15957. * - AFTER param serialization (s.data is a string if s.processData is true)
  15958. * 3) key is the dataType
  15959. * 4) the catchall symbol "*" can be used
  15960. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15961. */
  15962. prefilters = {},
  15963. /* Transports bindings
  15964. * 1) key is the dataType
  15965. * 2) the catchall symbol "*" can be used
  15966. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15967. */
  15968. transports = {},
  15969. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15970. allTypes = "*/".concat( "*" ),
  15971. // Anchor tag for parsing the document origin
  15972. originAnchor = document.createElement( "a" );
  15973. originAnchor.href = location.href;
  15974. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15975. function addToPrefiltersOrTransports( structure ) {
  15976. // dataTypeExpression is optional and defaults to "*"
  15977. return function( dataTypeExpression, func ) {
  15978. if ( typeof dataTypeExpression !== "string" ) {
  15979. func = dataTypeExpression;
  15980. dataTypeExpression = "*";
  15981. }
  15982. var dataType,
  15983. i = 0,
  15984. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15985. if ( isFunction( func ) ) {
  15986. // For each dataType in the dataTypeExpression
  15987. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15988. // Prepend if requested
  15989. if ( dataType[ 0 ] === "+" ) {
  15990. dataType = dataType.slice( 1 ) || "*";
  15991. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15992. // Otherwise append
  15993. } else {
  15994. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15995. }
  15996. }
  15997. }
  15998. };
  15999. }
  16000. // Base inspection function for prefilters and transports
  16001. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16002. var inspected = {},
  16003. seekingTransport = ( structure === transports );
  16004. function inspect( dataType ) {
  16005. var selected;
  16006. inspected[ dataType ] = true;
  16007. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16008. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16009. if ( typeof dataTypeOrTransport === "string" &&
  16010. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16011. options.dataTypes.unshift( dataTypeOrTransport );
  16012. inspect( dataTypeOrTransport );
  16013. return false;
  16014. } else if ( seekingTransport ) {
  16015. return !( selected = dataTypeOrTransport );
  16016. }
  16017. } );
  16018. return selected;
  16019. }
  16020. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16021. }
  16022. // A special extend for ajax options
  16023. // that takes "flat" options (not to be deep extended)
  16024. // Fixes #9887
  16025. function ajaxExtend( target, src ) {
  16026. var key, deep,
  16027. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16028. for ( key in src ) {
  16029. if ( src[ key ] !== undefined ) {
  16030. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16031. }
  16032. }
  16033. if ( deep ) {
  16034. jQuery.extend( true, target, deep );
  16035. }
  16036. return target;
  16037. }
  16038. /* Handles responses to an ajax request:
  16039. * - finds the right dataType (mediates between content-type and expected dataType)
  16040. * - returns the corresponding response
  16041. */
  16042. function ajaxHandleResponses( s, jqXHR, responses ) {
  16043. var ct, type, finalDataType, firstDataType,
  16044. contents = s.contents,
  16045. dataTypes = s.dataTypes;
  16046. // Remove auto dataType and get content-type in the process
  16047. while ( dataTypes[ 0 ] === "*" ) {
  16048. dataTypes.shift();
  16049. if ( ct === undefined ) {
  16050. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16051. }
  16052. }
  16053. // Check if we're dealing with a known content-type
  16054. if ( ct ) {
  16055. for ( type in contents ) {
  16056. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16057. dataTypes.unshift( type );
  16058. break;
  16059. }
  16060. }
  16061. }
  16062. // Check to see if we have a response for the expected dataType
  16063. if ( dataTypes[ 0 ] in responses ) {
  16064. finalDataType = dataTypes[ 0 ];
  16065. } else {
  16066. // Try convertible dataTypes
  16067. for ( type in responses ) {
  16068. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16069. finalDataType = type;
  16070. break;
  16071. }
  16072. if ( !firstDataType ) {
  16073. firstDataType = type;
  16074. }
  16075. }
  16076. // Or just use first one
  16077. finalDataType = finalDataType || firstDataType;
  16078. }
  16079. // If we found a dataType
  16080. // We add the dataType to the list if needed
  16081. // and return the corresponding response
  16082. if ( finalDataType ) {
  16083. if ( finalDataType !== dataTypes[ 0 ] ) {
  16084. dataTypes.unshift( finalDataType );
  16085. }
  16086. return responses[ finalDataType ];
  16087. }
  16088. }
  16089. /* Chain conversions given the request and the original response
  16090. * Also sets the responseXXX fields on the jqXHR instance
  16091. */
  16092. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16093. var conv2, current, conv, tmp, prev,
  16094. converters = {},
  16095. // Work with a copy of dataTypes in case we need to modify it for conversion
  16096. dataTypes = s.dataTypes.slice();
  16097. // Create converters map with lowercased keys
  16098. if ( dataTypes[ 1 ] ) {
  16099. for ( conv in s.converters ) {
  16100. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16101. }
  16102. }
  16103. current = dataTypes.shift();
  16104. // Convert to each sequential dataType
  16105. while ( current ) {
  16106. if ( s.responseFields[ current ] ) {
  16107. jqXHR[ s.responseFields[ current ] ] = response;
  16108. }
  16109. // Apply the dataFilter if provided
  16110. if ( !prev && isSuccess && s.dataFilter ) {
  16111. response = s.dataFilter( response, s.dataType );
  16112. }
  16113. prev = current;
  16114. current = dataTypes.shift();
  16115. if ( current ) {
  16116. // There's only work to do if current dataType is non-auto
  16117. if ( current === "*" ) {
  16118. current = prev;
  16119. // Convert response if prev dataType is non-auto and differs from current
  16120. } else if ( prev !== "*" && prev !== current ) {
  16121. // Seek a direct converter
  16122. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16123. // If none found, seek a pair
  16124. if ( !conv ) {
  16125. for ( conv2 in converters ) {
  16126. // If conv2 outputs current
  16127. tmp = conv2.split( " " );
  16128. if ( tmp[ 1 ] === current ) {
  16129. // If prev can be converted to accepted input
  16130. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16131. converters[ "* " + tmp[ 0 ] ];
  16132. if ( conv ) {
  16133. // Condense equivalence converters
  16134. if ( conv === true ) {
  16135. conv = converters[ conv2 ];
  16136. // Otherwise, insert the intermediate dataType
  16137. } else if ( converters[ conv2 ] !== true ) {
  16138. current = tmp[ 0 ];
  16139. dataTypes.unshift( tmp[ 1 ] );
  16140. }
  16141. break;
  16142. }
  16143. }
  16144. }
  16145. }
  16146. // Apply converter (if not an equivalence)
  16147. if ( conv !== true ) {
  16148. // Unless errors are allowed to bubble, catch and return them
  16149. if ( conv && s.throws ) {
  16150. response = conv( response );
  16151. } else {
  16152. try {
  16153. response = conv( response );
  16154. } catch ( e ) {
  16155. return {
  16156. state: "parsererror",
  16157. error: conv ? e : "No conversion from " + prev + " to " + current
  16158. };
  16159. }
  16160. }
  16161. }
  16162. }
  16163. }
  16164. }
  16165. return { state: "success", data: response };
  16166. }
  16167. jQuery.extend( {
  16168. // Counter for holding the number of active queries
  16169. active: 0,
  16170. // Last-Modified header cache for next request
  16171. lastModified: {},
  16172. etag: {},
  16173. ajaxSettings: {
  16174. url: location.href,
  16175. type: "GET",
  16176. isLocal: rlocalProtocol.test( location.protocol ),
  16177. global: true,
  16178. processData: true,
  16179. async: true,
  16180. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16181. /*
  16182. timeout: 0,
  16183. data: null,
  16184. dataType: null,
  16185. username: null,
  16186. password: null,
  16187. cache: null,
  16188. throws: false,
  16189. traditional: false,
  16190. headers: {},
  16191. */
  16192. accepts: {
  16193. "*": allTypes,
  16194. text: "text/plain",
  16195. html: "text/html",
  16196. xml: "application/xml, text/xml",
  16197. json: "application/json, text/javascript"
  16198. },
  16199. contents: {
  16200. xml: /\bxml\b/,
  16201. html: /\bhtml/,
  16202. json: /\bjson\b/
  16203. },
  16204. responseFields: {
  16205. xml: "responseXML",
  16206. text: "responseText",
  16207. json: "responseJSON"
  16208. },
  16209. // Data converters
  16210. // Keys separate source (or catchall "*") and destination types with a single space
  16211. converters: {
  16212. // Convert anything to text
  16213. "* text": String,
  16214. // Text to html (true = no transformation)
  16215. "text html": true,
  16216. // Evaluate text as a json expression
  16217. "text json": JSON.parse,
  16218. // Parse text as xml
  16219. "text xml": jQuery.parseXML
  16220. },
  16221. // For options that shouldn't be deep extended:
  16222. // you can add your own custom options here if
  16223. // and when you create one that shouldn't be
  16224. // deep extended (see ajaxExtend)
  16225. flatOptions: {
  16226. url: true,
  16227. context: true
  16228. }
  16229. },
  16230. // Creates a full fledged settings object into target
  16231. // with both ajaxSettings and settings fields.
  16232. // If target is omitted, writes into ajaxSettings.
  16233. ajaxSetup: function( target, settings ) {
  16234. return settings ?
  16235. // Building a settings object
  16236. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16237. // Extending ajaxSettings
  16238. ajaxExtend( jQuery.ajaxSettings, target );
  16239. },
  16240. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16241. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16242. // Main method
  16243. ajax: function( url, options ) {
  16244. // If url is an object, simulate pre-1.5 signature
  16245. if ( typeof url === "object" ) {
  16246. options = url;
  16247. url = undefined;
  16248. }
  16249. // Force options to be an object
  16250. options = options || {};
  16251. var transport,
  16252. // URL without anti-cache param
  16253. cacheURL,
  16254. // Response headers
  16255. responseHeadersString,
  16256. responseHeaders,
  16257. // timeout handle
  16258. timeoutTimer,
  16259. // Url cleanup var
  16260. urlAnchor,
  16261. // Request state (becomes false upon send and true upon completion)
  16262. completed,
  16263. // To know if global events are to be dispatched
  16264. fireGlobals,
  16265. // Loop variable
  16266. i,
  16267. // uncached part of the url
  16268. uncached,
  16269. // Create the final options object
  16270. s = jQuery.ajaxSetup( {}, options ),
  16271. // Callbacks context
  16272. callbackContext = s.context || s,
  16273. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16274. globalEventContext = s.context &&
  16275. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16276. jQuery( callbackContext ) :
  16277. jQuery.event,
  16278. // Deferreds
  16279. deferred = jQuery.Deferred(),
  16280. completeDeferred = jQuery.Callbacks( "once memory" ),
  16281. // Status-dependent callbacks
  16282. statusCode = s.statusCode || {},
  16283. // Headers (they are sent all at once)
  16284. requestHeaders = {},
  16285. requestHeadersNames = {},
  16286. // Default abort message
  16287. strAbort = "canceled",
  16288. // Fake xhr
  16289. jqXHR = {
  16290. readyState: 0,
  16291. // Builds headers hashtable if needed
  16292. getResponseHeader: function( key ) {
  16293. var match;
  16294. if ( completed ) {
  16295. if ( !responseHeaders ) {
  16296. responseHeaders = {};
  16297. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16298. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16299. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16300. .concat( match[ 2 ] );
  16301. }
  16302. }
  16303. match = responseHeaders[ key.toLowerCase() + " " ];
  16304. }
  16305. return match == null ? null : match.join( ", " );
  16306. },
  16307. // Raw string
  16308. getAllResponseHeaders: function() {
  16309. return completed ? responseHeadersString : null;
  16310. },
  16311. // Caches the header
  16312. setRequestHeader: function( name, value ) {
  16313. if ( completed == null ) {
  16314. name = requestHeadersNames[ name.toLowerCase() ] =
  16315. requestHeadersNames[ name.toLowerCase() ] || name;
  16316. requestHeaders[ name ] = value;
  16317. }
  16318. return this;
  16319. },
  16320. // Overrides response content-type header
  16321. overrideMimeType: function( type ) {
  16322. if ( completed == null ) {
  16323. s.mimeType = type;
  16324. }
  16325. return this;
  16326. },
  16327. // Status-dependent callbacks
  16328. statusCode: function( map ) {
  16329. var code;
  16330. if ( map ) {
  16331. if ( completed ) {
  16332. // Execute the appropriate callbacks
  16333. jqXHR.always( map[ jqXHR.status ] );
  16334. } else {
  16335. // Lazy-add the new callbacks in a way that preserves old ones
  16336. for ( code in map ) {
  16337. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16338. }
  16339. }
  16340. }
  16341. return this;
  16342. },
  16343. // Cancel the request
  16344. abort: function( statusText ) {
  16345. var finalText = statusText || strAbort;
  16346. if ( transport ) {
  16347. transport.abort( finalText );
  16348. }
  16349. done( 0, finalText );
  16350. return this;
  16351. }
  16352. };
  16353. // Attach deferreds
  16354. deferred.promise( jqXHR );
  16355. // Add protocol if not provided (prefilters might expect it)
  16356. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16357. // We also use the url parameter if available
  16358. s.url = ( ( url || s.url || location.href ) + "" )
  16359. .replace( rprotocol, location.protocol + "//" );
  16360. // Alias method option to type as per ticket #12004
  16361. s.type = options.method || options.type || s.method || s.type;
  16362. // Extract dataTypes list
  16363. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16364. // A cross-domain request is in order when the origin doesn't match the current origin.
  16365. if ( s.crossDomain == null ) {
  16366. urlAnchor = document.createElement( "a" );
  16367. // Support: IE <=8 - 11, Edge 12 - 15
  16368. // IE throws exception on accessing the href property if url is malformed,
  16369. // e.g. http://example.com:80x/
  16370. try {
  16371. urlAnchor.href = s.url;
  16372. // Support: IE <=8 - 11 only
  16373. // Anchor's host property isn't correctly set when s.url is relative
  16374. urlAnchor.href = urlAnchor.href;
  16375. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16376. urlAnchor.protocol + "//" + urlAnchor.host;
  16377. } catch ( e ) {
  16378. // If there is an error parsing the URL, assume it is crossDomain,
  16379. // it can be rejected by the transport if it is invalid
  16380. s.crossDomain = true;
  16381. }
  16382. }
  16383. // Convert data if not already a string
  16384. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16385. s.data = jQuery.param( s.data, s.traditional );
  16386. }
  16387. // Apply prefilters
  16388. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16389. // If request was aborted inside a prefilter, stop there
  16390. if ( completed ) {
  16391. return jqXHR;
  16392. }
  16393. // We can fire global events as of now if asked to
  16394. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16395. fireGlobals = jQuery.event && s.global;
  16396. // Watch for a new set of requests
  16397. if ( fireGlobals && jQuery.active++ === 0 ) {
  16398. jQuery.event.trigger( "ajaxStart" );
  16399. }
  16400. // Uppercase the type
  16401. s.type = s.type.toUpperCase();
  16402. // Determine if request has content
  16403. s.hasContent = !rnoContent.test( s.type );
  16404. // Save the URL in case we're toying with the If-Modified-Since
  16405. // and/or If-None-Match header later on
  16406. // Remove hash to simplify url manipulation
  16407. cacheURL = s.url.replace( rhash, "" );
  16408. // More options handling for requests with no content
  16409. if ( !s.hasContent ) {
  16410. // Remember the hash so we can put it back
  16411. uncached = s.url.slice( cacheURL.length );
  16412. // If data is available and should be processed, append data to url
  16413. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16414. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16415. // #9682: remove data so that it's not used in an eventual retry
  16416. delete s.data;
  16417. }
  16418. // Add or update anti-cache param if needed
  16419. if ( s.cache === false ) {
  16420. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16421. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16422. }
  16423. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16424. s.url = cacheURL + uncached;
  16425. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16426. } else if ( s.data && s.processData &&
  16427. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16428. s.data = s.data.replace( r20, "+" );
  16429. }
  16430. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16431. if ( s.ifModified ) {
  16432. if ( jQuery.lastModified[ cacheURL ] ) {
  16433. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16434. }
  16435. if ( jQuery.etag[ cacheURL ] ) {
  16436. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16437. }
  16438. }
  16439. // Set the correct header, if data is being sent
  16440. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16441. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16442. }
  16443. // Set the Accepts header for the server, depending on the dataType
  16444. jqXHR.setRequestHeader(
  16445. "Accept",
  16446. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16447. s.accepts[ s.dataTypes[ 0 ] ] +
  16448. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16449. s.accepts[ "*" ]
  16450. );
  16451. // Check for headers option
  16452. for ( i in s.headers ) {
  16453. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16454. }
  16455. // Allow custom headers/mimetypes and early abort
  16456. if ( s.beforeSend &&
  16457. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16458. // Abort if not done already and return
  16459. return jqXHR.abort();
  16460. }
  16461. // Aborting is no longer a cancellation
  16462. strAbort = "abort";
  16463. // Install callbacks on deferreds
  16464. completeDeferred.add( s.complete );
  16465. jqXHR.done( s.success );
  16466. jqXHR.fail( s.error );
  16467. // Get transport
  16468. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16469. // If no transport, we auto-abort
  16470. if ( !transport ) {
  16471. done( -1, "No Transport" );
  16472. } else {
  16473. jqXHR.readyState = 1;
  16474. // Send global event
  16475. if ( fireGlobals ) {
  16476. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16477. }
  16478. // If request was aborted inside ajaxSend, stop there
  16479. if ( completed ) {
  16480. return jqXHR;
  16481. }
  16482. // Timeout
  16483. if ( s.async && s.timeout > 0 ) {
  16484. timeoutTimer = window.setTimeout( function() {
  16485. jqXHR.abort( "timeout" );
  16486. }, s.timeout );
  16487. }
  16488. try {
  16489. completed = false;
  16490. transport.send( requestHeaders, done );
  16491. } catch ( e ) {
  16492. // Rethrow post-completion exceptions
  16493. if ( completed ) {
  16494. throw e;
  16495. }
  16496. // Propagate others as results
  16497. done( -1, e );
  16498. }
  16499. }
  16500. // Callback for when everything is done
  16501. function done( status, nativeStatusText, responses, headers ) {
  16502. var isSuccess, success, error, response, modified,
  16503. statusText = nativeStatusText;
  16504. // Ignore repeat invocations
  16505. if ( completed ) {
  16506. return;
  16507. }
  16508. completed = true;
  16509. // Clear timeout if it exists
  16510. if ( timeoutTimer ) {
  16511. window.clearTimeout( timeoutTimer );
  16512. }
  16513. // Dereference transport for early garbage collection
  16514. // (no matter how long the jqXHR object will be used)
  16515. transport = undefined;
  16516. // Cache response headers
  16517. responseHeadersString = headers || "";
  16518. // Set readyState
  16519. jqXHR.readyState = status > 0 ? 4 : 0;
  16520. // Determine if successful
  16521. isSuccess = status >= 200 && status < 300 || status === 304;
  16522. // Get response data
  16523. if ( responses ) {
  16524. response = ajaxHandleResponses( s, jqXHR, responses );
  16525. }
  16526. // Convert no matter what (that way responseXXX fields are always set)
  16527. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16528. // If successful, handle type chaining
  16529. if ( isSuccess ) {
  16530. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16531. if ( s.ifModified ) {
  16532. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16533. if ( modified ) {
  16534. jQuery.lastModified[ cacheURL ] = modified;
  16535. }
  16536. modified = jqXHR.getResponseHeader( "etag" );
  16537. if ( modified ) {
  16538. jQuery.etag[ cacheURL ] = modified;
  16539. }
  16540. }
  16541. // if no content
  16542. if ( status === 204 || s.type === "HEAD" ) {
  16543. statusText = "nocontent";
  16544. // if not modified
  16545. } else if ( status === 304 ) {
  16546. statusText = "notmodified";
  16547. // If we have data, let's convert it
  16548. } else {
  16549. statusText = response.state;
  16550. success = response.data;
  16551. error = response.error;
  16552. isSuccess = !error;
  16553. }
  16554. } else {
  16555. // Extract error from statusText and normalize for non-aborts
  16556. error = statusText;
  16557. if ( status || !statusText ) {
  16558. statusText = "error";
  16559. if ( status < 0 ) {
  16560. status = 0;
  16561. }
  16562. }
  16563. }
  16564. // Set data for the fake xhr object
  16565. jqXHR.status = status;
  16566. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16567. // Success/Error
  16568. if ( isSuccess ) {
  16569. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16570. } else {
  16571. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16572. }
  16573. // Status-dependent callbacks
  16574. jqXHR.statusCode( statusCode );
  16575. statusCode = undefined;
  16576. if ( fireGlobals ) {
  16577. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16578. [ jqXHR, s, isSuccess ? success : error ] );
  16579. }
  16580. // Complete
  16581. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16582. if ( fireGlobals ) {
  16583. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16584. // Handle the global AJAX counter
  16585. if ( !( --jQuery.active ) ) {
  16586. jQuery.event.trigger( "ajaxStop" );
  16587. }
  16588. }
  16589. }
  16590. return jqXHR;
  16591. },
  16592. getJSON: function( url, data, callback ) {
  16593. return jQuery.get( url, data, callback, "json" );
  16594. },
  16595. getScript: function( url, callback ) {
  16596. return jQuery.get( url, undefined, callback, "script" );
  16597. }
  16598. } );
  16599. jQuery.each( [ "get", "post" ], function( i, method ) {
  16600. jQuery[ method ] = function( url, data, callback, type ) {
  16601. // Shift arguments if data argument was omitted
  16602. if ( isFunction( data ) ) {
  16603. type = type || callback;
  16604. callback = data;
  16605. data = undefined;
  16606. }
  16607. // The url can be an options object (which then must have .url)
  16608. return jQuery.ajax( jQuery.extend( {
  16609. url: url,
  16610. type: method,
  16611. dataType: type,
  16612. data: data,
  16613. success: callback
  16614. }, jQuery.isPlainObject( url ) && url ) );
  16615. };
  16616. } );
  16617. jQuery._evalUrl = function( url, options ) {
  16618. return jQuery.ajax( {
  16619. url: url,
  16620. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16621. type: "GET",
  16622. dataType: "script",
  16623. cache: true,
  16624. async: false,
  16625. global: false,
  16626. // Only evaluate the response if it is successful (gh-4126)
  16627. // dataFilter is not invoked for failure responses, so using it instead
  16628. // of the default converter is kludgy but it works.
  16629. converters: {
  16630. "text script": function() {}
  16631. },
  16632. dataFilter: function( response ) {
  16633. jQuery.globalEval( response, options );
  16634. }
  16635. } );
  16636. };
  16637. jQuery.fn.extend( {
  16638. wrapAll: function( html ) {
  16639. var wrap;
  16640. if ( this[ 0 ] ) {
  16641. if ( isFunction( html ) ) {
  16642. html = html.call( this[ 0 ] );
  16643. }
  16644. // The elements to wrap the target around
  16645. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16646. if ( this[ 0 ].parentNode ) {
  16647. wrap.insertBefore( this[ 0 ] );
  16648. }
  16649. wrap.map( function() {
  16650. var elem = this;
  16651. while ( elem.firstElementChild ) {
  16652. elem = elem.firstElementChild;
  16653. }
  16654. return elem;
  16655. } ).append( this );
  16656. }
  16657. return this;
  16658. },
  16659. wrapInner: function( html ) {
  16660. if ( isFunction( html ) ) {
  16661. return this.each( function( i ) {
  16662. jQuery( this ).wrapInner( html.call( this, i ) );
  16663. } );
  16664. }
  16665. return this.each( function() {
  16666. var self = jQuery( this ),
  16667. contents = self.contents();
  16668. if ( contents.length ) {
  16669. contents.wrapAll( html );
  16670. } else {
  16671. self.append( html );
  16672. }
  16673. } );
  16674. },
  16675. wrap: function( html ) {
  16676. var htmlIsFunction = isFunction( html );
  16677. return this.each( function( i ) {
  16678. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16679. } );
  16680. },
  16681. unwrap: function( selector ) {
  16682. this.parent( selector ).not( "body" ).each( function() {
  16683. jQuery( this ).replaceWith( this.childNodes );
  16684. } );
  16685. return this;
  16686. }
  16687. } );
  16688. jQuery.expr.pseudos.hidden = function( elem ) {
  16689. return !jQuery.expr.pseudos.visible( elem );
  16690. };
  16691. jQuery.expr.pseudos.visible = function( elem ) {
  16692. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16693. };
  16694. jQuery.ajaxSettings.xhr = function() {
  16695. try {
  16696. return new window.XMLHttpRequest();
  16697. } catch ( e ) {}
  16698. };
  16699. var xhrSuccessStatus = {
  16700. // File protocol always yields status code 0, assume 200
  16701. 0: 200,
  16702. // Support: IE <=9 only
  16703. // #1450: sometimes IE returns 1223 when it should be 204
  16704. 1223: 204
  16705. },
  16706. xhrSupported = jQuery.ajaxSettings.xhr();
  16707. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16708. support.ajax = xhrSupported = !!xhrSupported;
  16709. jQuery.ajaxTransport( function( options ) {
  16710. var callback, errorCallback;
  16711. // Cross domain only allowed if supported through XMLHttpRequest
  16712. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16713. return {
  16714. send: function( headers, complete ) {
  16715. var i,
  16716. xhr = options.xhr();
  16717. xhr.open(
  16718. options.type,
  16719. options.url,
  16720. options.async,
  16721. options.username,
  16722. options.password
  16723. );
  16724. // Apply custom fields if provided
  16725. if ( options.xhrFields ) {
  16726. for ( i in options.xhrFields ) {
  16727. xhr[ i ] = options.xhrFields[ i ];
  16728. }
  16729. }
  16730. // Override mime type if needed
  16731. if ( options.mimeType && xhr.overrideMimeType ) {
  16732. xhr.overrideMimeType( options.mimeType );
  16733. }
  16734. // X-Requested-With header
  16735. // For cross-domain requests, seeing as conditions for a preflight are
  16736. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16737. // (it can always be set on a per-request basis or even using ajaxSetup)
  16738. // For same-domain requests, won't change header if already provided.
  16739. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16740. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16741. }
  16742. // Set headers
  16743. for ( i in headers ) {
  16744. xhr.setRequestHeader( i, headers[ i ] );
  16745. }
  16746. // Callback
  16747. callback = function( type ) {
  16748. return function() {
  16749. if ( callback ) {
  16750. callback = errorCallback = xhr.onload =
  16751. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16752. xhr.onreadystatechange = null;
  16753. if ( type === "abort" ) {
  16754. xhr.abort();
  16755. } else if ( type === "error" ) {
  16756. // Support: IE <=9 only
  16757. // On a manual native abort, IE9 throws
  16758. // errors on any property access that is not readyState
  16759. if ( typeof xhr.status !== "number" ) {
  16760. complete( 0, "error" );
  16761. } else {
  16762. complete(
  16763. // File: protocol always yields status 0; see #8605, #14207
  16764. xhr.status,
  16765. xhr.statusText
  16766. );
  16767. }
  16768. } else {
  16769. complete(
  16770. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16771. xhr.statusText,
  16772. // Support: IE <=9 only
  16773. // IE9 has no XHR2 but throws on binary (trac-11426)
  16774. // For XHR2 non-text, let the caller handle it (gh-2498)
  16775. ( xhr.responseType || "text" ) !== "text" ||
  16776. typeof xhr.responseText !== "string" ?
  16777. { binary: xhr.response } :
  16778. { text: xhr.responseText },
  16779. xhr.getAllResponseHeaders()
  16780. );
  16781. }
  16782. }
  16783. };
  16784. };
  16785. // Listen to events
  16786. xhr.onload = callback();
  16787. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16788. // Support: IE 9 only
  16789. // Use onreadystatechange to replace onabort
  16790. // to handle uncaught aborts
  16791. if ( xhr.onabort !== undefined ) {
  16792. xhr.onabort = errorCallback;
  16793. } else {
  16794. xhr.onreadystatechange = function() {
  16795. // Check readyState before timeout as it changes
  16796. if ( xhr.readyState === 4 ) {
  16797. // Allow onerror to be called first,
  16798. // but that will not handle a native abort
  16799. // Also, save errorCallback to a variable
  16800. // as xhr.onerror cannot be accessed
  16801. window.setTimeout( function() {
  16802. if ( callback ) {
  16803. errorCallback();
  16804. }
  16805. } );
  16806. }
  16807. };
  16808. }
  16809. // Create the abort callback
  16810. callback = callback( "abort" );
  16811. try {
  16812. // Do send the request (this may raise an exception)
  16813. xhr.send( options.hasContent && options.data || null );
  16814. } catch ( e ) {
  16815. // #14683: Only rethrow if this hasn't been notified as an error yet
  16816. if ( callback ) {
  16817. throw e;
  16818. }
  16819. }
  16820. },
  16821. abort: function() {
  16822. if ( callback ) {
  16823. callback();
  16824. }
  16825. }
  16826. };
  16827. }
  16828. } );
  16829. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16830. jQuery.ajaxPrefilter( function( s ) {
  16831. if ( s.crossDomain ) {
  16832. s.contents.script = false;
  16833. }
  16834. } );
  16835. // Install script dataType
  16836. jQuery.ajaxSetup( {
  16837. accepts: {
  16838. script: "text/javascript, application/javascript, " +
  16839. "application/ecmascript, application/x-ecmascript"
  16840. },
  16841. contents: {
  16842. script: /\b(?:java|ecma)script\b/
  16843. },
  16844. converters: {
  16845. "text script": function( text ) {
  16846. jQuery.globalEval( text );
  16847. return text;
  16848. }
  16849. }
  16850. } );
  16851. // Handle cache's special case and crossDomain
  16852. jQuery.ajaxPrefilter( "script", function( s ) {
  16853. if ( s.cache === undefined ) {
  16854. s.cache = false;
  16855. }
  16856. if ( s.crossDomain ) {
  16857. s.type = "GET";
  16858. }
  16859. } );
  16860. // Bind script tag hack transport
  16861. jQuery.ajaxTransport( "script", function( s ) {
  16862. // This transport only deals with cross domain or forced-by-attrs requests
  16863. if ( s.crossDomain || s.scriptAttrs ) {
  16864. var script, callback;
  16865. return {
  16866. send: function( _, complete ) {
  16867. script = jQuery( "<script>" )
  16868. .attr( s.scriptAttrs || {} )
  16869. .prop( { charset: s.scriptCharset, src: s.url } )
  16870. .on( "load error", callback = function( evt ) {
  16871. script.remove();
  16872. callback = null;
  16873. if ( evt ) {
  16874. complete( evt.type === "error" ? 404 : 200, evt.type );
  16875. }
  16876. } );
  16877. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16878. document.head.appendChild( script[ 0 ] );
  16879. },
  16880. abort: function() {
  16881. if ( callback ) {
  16882. callback();
  16883. }
  16884. }
  16885. };
  16886. }
  16887. } );
  16888. var oldCallbacks = [],
  16889. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16890. // Default jsonp settings
  16891. jQuery.ajaxSetup( {
  16892. jsonp: "callback",
  16893. jsonpCallback: function() {
  16894. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16895. this[ callback ] = true;
  16896. return callback;
  16897. }
  16898. } );
  16899. // Detect, normalize options and install callbacks for jsonp requests
  16900. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16901. var callbackName, overwritten, responseContainer,
  16902. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16903. "url" :
  16904. typeof s.data === "string" &&
  16905. ( s.contentType || "" )
  16906. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16907. rjsonp.test( s.data ) && "data"
  16908. );
  16909. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16910. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16911. // Get callback name, remembering preexisting value associated with it
  16912. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16913. s.jsonpCallback() :
  16914. s.jsonpCallback;
  16915. // Insert callback into url or form data
  16916. if ( jsonProp ) {
  16917. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16918. } else if ( s.jsonp !== false ) {
  16919. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16920. }
  16921. // Use data converter to retrieve json after script execution
  16922. s.converters[ "script json" ] = function() {
  16923. if ( !responseContainer ) {
  16924. jQuery.error( callbackName + " was not called" );
  16925. }
  16926. return responseContainer[ 0 ];
  16927. };
  16928. // Force json dataType
  16929. s.dataTypes[ 0 ] = "json";
  16930. // Install callback
  16931. overwritten = window[ callbackName ];
  16932. window[ callbackName ] = function() {
  16933. responseContainer = arguments;
  16934. };
  16935. // Clean-up function (fires after converters)
  16936. jqXHR.always( function() {
  16937. // If previous value didn't exist - remove it
  16938. if ( overwritten === undefined ) {
  16939. jQuery( window ).removeProp( callbackName );
  16940. // Otherwise restore preexisting value
  16941. } else {
  16942. window[ callbackName ] = overwritten;
  16943. }
  16944. // Save back as free
  16945. if ( s[ callbackName ] ) {
  16946. // Make sure that re-using the options doesn't screw things around
  16947. s.jsonpCallback = originalSettings.jsonpCallback;
  16948. // Save the callback name for future use
  16949. oldCallbacks.push( callbackName );
  16950. }
  16951. // Call if it was a function and we have a response
  16952. if ( responseContainer && isFunction( overwritten ) ) {
  16953. overwritten( responseContainer[ 0 ] );
  16954. }
  16955. responseContainer = overwritten = undefined;
  16956. } );
  16957. // Delegate to script
  16958. return "script";
  16959. }
  16960. } );
  16961. // Support: Safari 8 only
  16962. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16963. // collapse sibling forms: the second one becomes a child of the first one.
  16964. // Because of that, this security measure has to be disabled in Safari 8.
  16965. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16966. support.createHTMLDocument = ( function() {
  16967. var body = document.implementation.createHTMLDocument( "" ).body;
  16968. body.innerHTML = "<form></form><form></form>";
  16969. return body.childNodes.length === 2;
  16970. } )();
  16971. // Argument "data" should be string of html
  16972. // context (optional): If specified, the fragment will be created in this context,
  16973. // defaults to document
  16974. // keepScripts (optional): If true, will include scripts passed in the html string
  16975. jQuery.parseHTML = function( data, context, keepScripts ) {
  16976. if ( typeof data !== "string" ) {
  16977. return [];
  16978. }
  16979. if ( typeof context === "boolean" ) {
  16980. keepScripts = context;
  16981. context = false;
  16982. }
  16983. var base, parsed, scripts;
  16984. if ( !context ) {
  16985. // Stop scripts or inline event handlers from being executed immediately
  16986. // by using document.implementation
  16987. if ( support.createHTMLDocument ) {
  16988. context = document.implementation.createHTMLDocument( "" );
  16989. // Set the base href for the created document
  16990. // so any parsed elements with URLs
  16991. // are based on the document's URL (gh-2965)
  16992. base = context.createElement( "base" );
  16993. base.href = document.location.href;
  16994. context.head.appendChild( base );
  16995. } else {
  16996. context = document;
  16997. }
  16998. }
  16999. parsed = rsingleTag.exec( data );
  17000. scripts = !keepScripts && [];
  17001. // Single tag
  17002. if ( parsed ) {
  17003. return [ context.createElement( parsed[ 1 ] ) ];
  17004. }
  17005. parsed = buildFragment( [ data ], context, scripts );
  17006. if ( scripts && scripts.length ) {
  17007. jQuery( scripts ).remove();
  17008. }
  17009. return jQuery.merge( [], parsed.childNodes );
  17010. };
  17011. /**
  17012. * Load a url into a page
  17013. */
  17014. jQuery.fn.load = function( url, params, callback ) {
  17015. var selector, type, response,
  17016. self = this,
  17017. off = url.indexOf( " " );
  17018. if ( off > -1 ) {
  17019. selector = stripAndCollapse( url.slice( off ) );
  17020. url = url.slice( 0, off );
  17021. }
  17022. // If it's a function
  17023. if ( isFunction( params ) ) {
  17024. // We assume that it's the callback
  17025. callback = params;
  17026. params = undefined;
  17027. // Otherwise, build a param string
  17028. } else if ( params && typeof params === "object" ) {
  17029. type = "POST";
  17030. }
  17031. // If we have elements to modify, make the request
  17032. if ( self.length > 0 ) {
  17033. jQuery.ajax( {
  17034. url: url,
  17035. // If "type" variable is undefined, then "GET" method will be used.
  17036. // Make value of this field explicit since
  17037. // user can override it through ajaxSetup method
  17038. type: type || "GET",
  17039. dataType: "html",
  17040. data: params
  17041. } ).done( function( responseText ) {
  17042. // Save response for use in complete callback
  17043. response = arguments;
  17044. self.html( selector ?
  17045. // If a selector was specified, locate the right elements in a dummy div
  17046. // Exclude scripts to avoid IE 'Permission Denied' errors
  17047. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17048. // Otherwise use the full result
  17049. responseText );
  17050. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17051. // but they are ignored because response was set above.
  17052. // If it fails, this function gets "jqXHR", "status", "error"
  17053. } ).always( callback && function( jqXHR, status ) {
  17054. self.each( function() {
  17055. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17056. } );
  17057. } );
  17058. }
  17059. return this;
  17060. };
  17061. // Attach a bunch of functions for handling common AJAX events
  17062. jQuery.each( [
  17063. "ajaxStart",
  17064. "ajaxStop",
  17065. "ajaxComplete",
  17066. "ajaxError",
  17067. "ajaxSuccess",
  17068. "ajaxSend"
  17069. ], function( i, type ) {
  17070. jQuery.fn[ type ] = function( fn ) {
  17071. return this.on( type, fn );
  17072. };
  17073. } );
  17074. jQuery.expr.pseudos.animated = function( elem ) {
  17075. return jQuery.grep( jQuery.timers, function( fn ) {
  17076. return elem === fn.elem;
  17077. } ).length;
  17078. };
  17079. jQuery.offset = {
  17080. setOffset: function( elem, options, i ) {
  17081. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17082. position = jQuery.css( elem, "position" ),
  17083. curElem = jQuery( elem ),
  17084. props = {};
  17085. // Set position first, in-case top/left are set even on static elem
  17086. if ( position === "static" ) {
  17087. elem.style.position = "relative";
  17088. }
  17089. curOffset = curElem.offset();
  17090. curCSSTop = jQuery.css( elem, "top" );
  17091. curCSSLeft = jQuery.css( elem, "left" );
  17092. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17093. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17094. // Need to be able to calculate position if either
  17095. // top or left is auto and position is either absolute or fixed
  17096. if ( calculatePosition ) {
  17097. curPosition = curElem.position();
  17098. curTop = curPosition.top;
  17099. curLeft = curPosition.left;
  17100. } else {
  17101. curTop = parseFloat( curCSSTop ) || 0;
  17102. curLeft = parseFloat( curCSSLeft ) || 0;
  17103. }
  17104. if ( isFunction( options ) ) {
  17105. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17106. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17107. }
  17108. if ( options.top != null ) {
  17109. props.top = ( options.top - curOffset.top ) + curTop;
  17110. }
  17111. if ( options.left != null ) {
  17112. props.left = ( options.left - curOffset.left ) + curLeft;
  17113. }
  17114. if ( "using" in options ) {
  17115. options.using.call( elem, props );
  17116. } else {
  17117. curElem.css( props );
  17118. }
  17119. }
  17120. };
  17121. jQuery.fn.extend( {
  17122. // offset() relates an element's border box to the document origin
  17123. offset: function( options ) {
  17124. // Preserve chaining for setter
  17125. if ( arguments.length ) {
  17126. return options === undefined ?
  17127. this :
  17128. this.each( function( i ) {
  17129. jQuery.offset.setOffset( this, options, i );
  17130. } );
  17131. }
  17132. var rect, win,
  17133. elem = this[ 0 ];
  17134. if ( !elem ) {
  17135. return;
  17136. }
  17137. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17138. // Support: IE <=11 only
  17139. // Running getBoundingClientRect on a
  17140. // disconnected node in IE throws an error
  17141. if ( !elem.getClientRects().length ) {
  17142. return { top: 0, left: 0 };
  17143. }
  17144. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17145. rect = elem.getBoundingClientRect();
  17146. win = elem.ownerDocument.defaultView;
  17147. return {
  17148. top: rect.top + win.pageYOffset,
  17149. left: rect.left + win.pageXOffset
  17150. };
  17151. },
  17152. // position() relates an element's margin box to its offset parent's padding box
  17153. // This corresponds to the behavior of CSS absolute positioning
  17154. position: function() {
  17155. if ( !this[ 0 ] ) {
  17156. return;
  17157. }
  17158. var offsetParent, offset, doc,
  17159. elem = this[ 0 ],
  17160. parentOffset = { top: 0, left: 0 };
  17161. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17162. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17163. // Assume position:fixed implies availability of getBoundingClientRect
  17164. offset = elem.getBoundingClientRect();
  17165. } else {
  17166. offset = this.offset();
  17167. // Account for the *real* offset parent, which can be the document or its root element
  17168. // when a statically positioned element is identified
  17169. doc = elem.ownerDocument;
  17170. offsetParent = elem.offsetParent || doc.documentElement;
  17171. while ( offsetParent &&
  17172. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17173. jQuery.css( offsetParent, "position" ) === "static" ) {
  17174. offsetParent = offsetParent.parentNode;
  17175. }
  17176. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17177. // Incorporate borders into its offset, since they are outside its content origin
  17178. parentOffset = jQuery( offsetParent ).offset();
  17179. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17180. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17181. }
  17182. }
  17183. // Subtract parent offsets and element margins
  17184. return {
  17185. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17186. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17187. };
  17188. },
  17189. // This method will return documentElement in the following cases:
  17190. // 1) For the element inside the iframe without offsetParent, this method will return
  17191. // documentElement of the parent window
  17192. // 2) For the hidden or detached element
  17193. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17194. //
  17195. // but those exceptions were never presented as a real life use-cases
  17196. // and might be considered as more preferable results.
  17197. //
  17198. // This logic, however, is not guaranteed and can change at any point in the future
  17199. offsetParent: function() {
  17200. return this.map( function() {
  17201. var offsetParent = this.offsetParent;
  17202. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17203. offsetParent = offsetParent.offsetParent;
  17204. }
  17205. return offsetParent || documentElement;
  17206. } );
  17207. }
  17208. } );
  17209. // Create scrollLeft and scrollTop methods
  17210. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17211. var top = "pageYOffset" === prop;
  17212. jQuery.fn[ method ] = function( val ) {
  17213. return access( this, function( elem, method, val ) {
  17214. // Coalesce documents and windows
  17215. var win;
  17216. if ( isWindow( elem ) ) {
  17217. win = elem;
  17218. } else if ( elem.nodeType === 9 ) {
  17219. win = elem.defaultView;
  17220. }
  17221. if ( val === undefined ) {
  17222. return win ? win[ prop ] : elem[ method ];
  17223. }
  17224. if ( win ) {
  17225. win.scrollTo(
  17226. !top ? val : win.pageXOffset,
  17227. top ? val : win.pageYOffset
  17228. );
  17229. } else {
  17230. elem[ method ] = val;
  17231. }
  17232. }, method, val, arguments.length );
  17233. };
  17234. } );
  17235. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17236. // Add the top/left cssHooks using jQuery.fn.position
  17237. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17238. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17239. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17240. // rather than make the css module depend on the offset module, just check for it here
  17241. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17242. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17243. function( elem, computed ) {
  17244. if ( computed ) {
  17245. computed = curCSS( elem, prop );
  17246. // If curCSS returns percentage, fallback to offset
  17247. return rnumnonpx.test( computed ) ?
  17248. jQuery( elem ).position()[ prop ] + "px" :
  17249. computed;
  17250. }
  17251. }
  17252. );
  17253. } );
  17254. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17255. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17256. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17257. function( defaultExtra, funcName ) {
  17258. // Margin is only for outerHeight, outerWidth
  17259. jQuery.fn[ funcName ] = function( margin, value ) {
  17260. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17261. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17262. return access( this, function( elem, type, value ) {
  17263. var doc;
  17264. if ( isWindow( elem ) ) {
  17265. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17266. return funcName.indexOf( "outer" ) === 0 ?
  17267. elem[ "inner" + name ] :
  17268. elem.document.documentElement[ "client" + name ];
  17269. }
  17270. // Get document width or height
  17271. if ( elem.nodeType === 9 ) {
  17272. doc = elem.documentElement;
  17273. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17274. // whichever is greatest
  17275. return Math.max(
  17276. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17277. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17278. doc[ "client" + name ]
  17279. );
  17280. }
  17281. return value === undefined ?
  17282. // Get width or height on the element, requesting but not forcing parseFloat
  17283. jQuery.css( elem, type, extra ) :
  17284. // Set width or height on the element
  17285. jQuery.style( elem, type, value, extra );
  17286. }, type, chainable ? margin : undefined, chainable );
  17287. };
  17288. } );
  17289. } );
  17290. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17291. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17292. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17293. function( i, name ) {
  17294. // Handle event binding
  17295. jQuery.fn[ name ] = function( data, fn ) {
  17296. return arguments.length > 0 ?
  17297. this.on( name, null, data, fn ) :
  17298. this.trigger( name );
  17299. };
  17300. } );
  17301. jQuery.fn.extend( {
  17302. hover: function( fnOver, fnOut ) {
  17303. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17304. }
  17305. } );
  17306. jQuery.fn.extend( {
  17307. bind: function( types, data, fn ) {
  17308. return this.on( types, null, data, fn );
  17309. },
  17310. unbind: function( types, fn ) {
  17311. return this.off( types, null, fn );
  17312. },
  17313. delegate: function( selector, types, data, fn ) {
  17314. return this.on( types, selector, data, fn );
  17315. },
  17316. undelegate: function( selector, types, fn ) {
  17317. // ( namespace ) or ( selector, types [, fn] )
  17318. return arguments.length === 1 ?
  17319. this.off( selector, "**" ) :
  17320. this.off( types, selector || "**", fn );
  17321. }
  17322. } );
  17323. // Bind a function to a context, optionally partially applying any
  17324. // arguments.
  17325. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17326. // However, it is not slated for removal any time soon
  17327. jQuery.proxy = function( fn, context ) {
  17328. var tmp, args, proxy;
  17329. if ( typeof context === "string" ) {
  17330. tmp = fn[ context ];
  17331. context = fn;
  17332. fn = tmp;
  17333. }
  17334. // Quick check to determine if target is callable, in the spec
  17335. // this throws a TypeError, but we will just return undefined.
  17336. if ( !isFunction( fn ) ) {
  17337. return undefined;
  17338. }
  17339. // Simulated bind
  17340. args = slice.call( arguments, 2 );
  17341. proxy = function() {
  17342. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17343. };
  17344. // Set the guid of unique handler to the same of original handler, so it can be removed
  17345. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17346. return proxy;
  17347. };
  17348. jQuery.holdReady = function( hold ) {
  17349. if ( hold ) {
  17350. jQuery.readyWait++;
  17351. } else {
  17352. jQuery.ready( true );
  17353. }
  17354. };
  17355. jQuery.isArray = Array.isArray;
  17356. jQuery.parseJSON = JSON.parse;
  17357. jQuery.nodeName = nodeName;
  17358. jQuery.isFunction = isFunction;
  17359. jQuery.isWindow = isWindow;
  17360. jQuery.camelCase = camelCase;
  17361. jQuery.type = toType;
  17362. jQuery.now = Date.now;
  17363. jQuery.isNumeric = function( obj ) {
  17364. // As of jQuery 3.0, isNumeric is limited to
  17365. // strings and numbers (primitives or objects)
  17366. // that can be coerced to finite numbers (gh-2662)
  17367. var type = jQuery.type( obj );
  17368. return ( type === "number" || type === "string" ) &&
  17369. // parseFloat NaNs numeric-cast false positives ("")
  17370. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17371. // subtraction forces infinities to NaN
  17372. !isNaN( obj - parseFloat( obj ) );
  17373. };
  17374. // Register as a named AMD module, since jQuery can be concatenated with other
  17375. // files that may use define, but not via a proper concatenation script that
  17376. // understands anonymous AMD modules. A named AMD is safest and most robust
  17377. // way to register. Lowercase jquery is used because AMD module names are
  17378. // derived from file names, and jQuery is normally delivered in a lowercase
  17379. // file name. Do this after creating the global so that if an AMD module wants
  17380. // to call noConflict to hide this version of jQuery, it will work.
  17381. // Note that for maximum portability, libraries that are not jQuery should
  17382. // declare themselves as anonymous modules, and avoid setting a global if an
  17383. // AMD loader is present. jQuery is a special case. For more information, see
  17384. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17385. if ( true ) {
  17386. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17387. return jQuery;
  17388. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17389. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17390. }
  17391. var
  17392. // Map over jQuery in case of overwrite
  17393. _jQuery = window.jQuery,
  17394. // Map over the $ in case of overwrite
  17395. _$ = window.$;
  17396. jQuery.noConflict = function( deep ) {
  17397. if ( window.$ === jQuery ) {
  17398. window.$ = _$;
  17399. }
  17400. if ( deep && window.jQuery === jQuery ) {
  17401. window.jQuery = _jQuery;
  17402. }
  17403. return jQuery;
  17404. };
  17405. // Expose jQuery and $ identifiers, even in AMD
  17406. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17407. // and CommonJS for browser emulators (#13566)
  17408. if ( !noGlobal ) {
  17409. window.jQuery = window.$ = jQuery;
  17410. }
  17411. return jQuery;
  17412. } );
  17413. /***/ }),
  17414. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17415. /*!************************************************!*\
  17416. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17417. \************************************************/
  17418. /*! exports provided: default */
  17419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17420. "use strict";
  17421. __webpack_require__.r(__webpack_exports__);
  17422. var classCallCheck = function (instance, Constructor) {
  17423. if (!(instance instanceof Constructor)) {
  17424. throw new TypeError("Cannot call a class as a function");
  17425. }
  17426. };
  17427. var createClass = function () {
  17428. function defineProperties(target, props) {
  17429. for (var i = 0; i < props.length; i++) {
  17430. var descriptor = props[i];
  17431. descriptor.enumerable = descriptor.enumerable || false;
  17432. descriptor.configurable = true;
  17433. if ("value" in descriptor) descriptor.writable = true;
  17434. Object.defineProperty(target, descriptor.key, descriptor);
  17435. }
  17436. }
  17437. return function (Constructor, protoProps, staticProps) {
  17438. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17439. if (staticProps) defineProperties(Constructor, staticProps);
  17440. return Constructor;
  17441. };
  17442. }();
  17443. var _extends = Object.assign || function (target) {
  17444. for (var i = 1; i < arguments.length; i++) {
  17445. var source = arguments[i];
  17446. for (var key in source) {
  17447. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17448. target[key] = source[key];
  17449. }
  17450. }
  17451. }
  17452. return target;
  17453. };
  17454. var inherits = function (subClass, superClass) {
  17455. if (typeof superClass !== "function" && superClass !== null) {
  17456. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17457. }
  17458. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17459. constructor: {
  17460. value: subClass,
  17461. enumerable: false,
  17462. writable: true,
  17463. configurable: true
  17464. }
  17465. });
  17466. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17467. };
  17468. var possibleConstructorReturn = function (self, call) {
  17469. if (!self) {
  17470. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17471. }
  17472. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17473. };
  17474. var Connector = function () {
  17475. /**
  17476. * Create a new class instance.
  17477. */
  17478. function Connector(options) {
  17479. classCallCheck(this, Connector);
  17480. /**
  17481. * Default connector options.
  17482. */
  17483. this._defaultOptions = {
  17484. auth: {
  17485. headers: {}
  17486. },
  17487. authEndpoint: '/broadcasting/auth',
  17488. broadcaster: 'pusher',
  17489. csrfToken: null,
  17490. host: null,
  17491. key: null,
  17492. namespace: 'App.Events'
  17493. };
  17494. this.setOptions(options);
  17495. this.connect();
  17496. }
  17497. /**
  17498. * Merge the custom options with the defaults.
  17499. */
  17500. createClass(Connector, [{
  17501. key: 'setOptions',
  17502. value: function setOptions(options) {
  17503. this.options = _extends(this._defaultOptions, options);
  17504. if (this.csrfToken()) {
  17505. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17506. }
  17507. return options;
  17508. }
  17509. /**
  17510. * Extract the CSRF token from the page.
  17511. */
  17512. }, {
  17513. key: 'csrfToken',
  17514. value: function csrfToken() {
  17515. var selector = void 0;
  17516. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17517. return window['Laravel'].csrfToken;
  17518. } else if (this.options.csrfToken) {
  17519. return this.options.csrfToken;
  17520. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17521. return selector.getAttribute('content');
  17522. }
  17523. return null;
  17524. }
  17525. }]);
  17526. return Connector;
  17527. }();
  17528. /**
  17529. * This class represents a basic channel.
  17530. */
  17531. var Channel = function () {
  17532. function Channel() {
  17533. classCallCheck(this, Channel);
  17534. }
  17535. createClass(Channel, [{
  17536. key: 'listenForWhisper',
  17537. /**
  17538. * Listen for a whisper event on the channel instance.
  17539. */
  17540. value: function listenForWhisper(event, callback) {
  17541. return this.listen('.client-' + event, callback);
  17542. }
  17543. /**
  17544. * Listen for an event on the channel instance.
  17545. */
  17546. }, {
  17547. key: 'notification',
  17548. value: function notification(callback) {
  17549. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17550. }
  17551. /**
  17552. * Stop listening for a whispser event on the channel instance.
  17553. */
  17554. }, {
  17555. key: 'stopListeningForWhisper',
  17556. value: function stopListeningForWhisper(event) {
  17557. return this.stopListening('.client-' + event);
  17558. }
  17559. }]);
  17560. return Channel;
  17561. }();
  17562. /**
  17563. * Event name formatter
  17564. */
  17565. var EventFormatter = function () {
  17566. /**
  17567. * Create a new class instance.
  17568. */
  17569. function EventFormatter(namespace) {
  17570. classCallCheck(this, EventFormatter);
  17571. this.setNamespace(namespace);
  17572. }
  17573. /**
  17574. * Format the given event name.
  17575. */
  17576. createClass(EventFormatter, [{
  17577. key: 'format',
  17578. value: function format(event) {
  17579. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17580. return event.substr(1);
  17581. } else if (this.namespace) {
  17582. event = this.namespace + '.' + event;
  17583. }
  17584. return event.replace(/\./g, '\\');
  17585. }
  17586. /**
  17587. * Set the event namespace.
  17588. */
  17589. }, {
  17590. key: 'setNamespace',
  17591. value: function setNamespace(value) {
  17592. this.namespace = value;
  17593. }
  17594. }]);
  17595. return EventFormatter;
  17596. }();
  17597. /**
  17598. * This class represents a Pusher channel.
  17599. */
  17600. var PusherChannel = function (_Channel) {
  17601. inherits(PusherChannel, _Channel);
  17602. /**
  17603. * Create a new class instance.
  17604. */
  17605. function PusherChannel(pusher, name, options) {
  17606. classCallCheck(this, PusherChannel);
  17607. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17608. _this.name = name;
  17609. _this.pusher = pusher;
  17610. _this.options = options;
  17611. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17612. _this.subscribe();
  17613. return _this;
  17614. }
  17615. /**
  17616. * Subscribe to a Pusher channel.
  17617. */
  17618. createClass(PusherChannel, [{
  17619. key: 'subscribe',
  17620. value: function subscribe() {
  17621. this.subscription = this.pusher.subscribe(this.name);
  17622. }
  17623. /**
  17624. * Unsubscribe from a Pusher channel.
  17625. */
  17626. }, {
  17627. key: 'unsubscribe',
  17628. value: function unsubscribe() {
  17629. this.pusher.unsubscribe(this.name);
  17630. }
  17631. /**
  17632. * Listen for an event on the channel instance.
  17633. */
  17634. }, {
  17635. key: 'listen',
  17636. value: function listen(event, callback) {
  17637. this.on(this.eventFormatter.format(event), callback);
  17638. return this;
  17639. }
  17640. /**
  17641. * Stop listening for an event on the channel instance.
  17642. */
  17643. }, {
  17644. key: 'stopListening',
  17645. value: function stopListening(event) {
  17646. this.subscription.unbind(this.eventFormatter.format(event));
  17647. return this;
  17648. }
  17649. /**
  17650. * Bind a channel to an event.
  17651. */
  17652. }, {
  17653. key: 'on',
  17654. value: function on(event, callback) {
  17655. this.subscription.bind(event, callback);
  17656. return this;
  17657. }
  17658. }]);
  17659. return PusherChannel;
  17660. }(Channel);
  17661. /**
  17662. * This class represents a Pusher private channel.
  17663. */
  17664. var PusherPrivateChannel = function (_PusherChannel) {
  17665. inherits(PusherPrivateChannel, _PusherChannel);
  17666. function PusherPrivateChannel() {
  17667. classCallCheck(this, PusherPrivateChannel);
  17668. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17669. }
  17670. createClass(PusherPrivateChannel, [{
  17671. key: 'whisper',
  17672. /**
  17673. * Trigger client event on the channel.
  17674. */
  17675. value: function whisper(eventName, data) {
  17676. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17677. return this;
  17678. }
  17679. }]);
  17680. return PusherPrivateChannel;
  17681. }(PusherChannel);
  17682. /**
  17683. * This class represents a Pusher presence channel.
  17684. */
  17685. var PusherPresenceChannel = function (_PusherChannel) {
  17686. inherits(PusherPresenceChannel, _PusherChannel);
  17687. function PusherPresenceChannel() {
  17688. classCallCheck(this, PusherPresenceChannel);
  17689. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17690. }
  17691. createClass(PusherPresenceChannel, [{
  17692. key: 'here',
  17693. /**
  17694. * Register a callback to be called anytime the member list changes.
  17695. */
  17696. value: function here(callback) {
  17697. this.on('pusher:subscription_succeeded', function (data) {
  17698. callback(Object.keys(data.members).map(function (k) {
  17699. return data.members[k];
  17700. }));
  17701. });
  17702. return this;
  17703. }
  17704. /**
  17705. * Listen for someone joining the channel.
  17706. */
  17707. }, {
  17708. key: 'joining',
  17709. value: function joining(callback) {
  17710. this.on('pusher:member_added', function (member) {
  17711. callback(member.info);
  17712. });
  17713. return this;
  17714. }
  17715. /**
  17716. * Listen for someone leaving the channel.
  17717. */
  17718. }, {
  17719. key: 'leaving',
  17720. value: function leaving(callback) {
  17721. this.on('pusher:member_removed', function (member) {
  17722. callback(member.info);
  17723. });
  17724. return this;
  17725. }
  17726. /**
  17727. * Trigger client event on the channel.
  17728. */
  17729. }, {
  17730. key: 'whisper',
  17731. value: function whisper(eventName, data) {
  17732. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17733. return this;
  17734. }
  17735. }]);
  17736. return PusherPresenceChannel;
  17737. }(PusherChannel);
  17738. /**
  17739. * This class represents a Socket.io channel.
  17740. */
  17741. var SocketIoChannel = function (_Channel) {
  17742. inherits(SocketIoChannel, _Channel);
  17743. /**
  17744. * Create a new class instance.
  17745. */
  17746. function SocketIoChannel(socket, name, options) {
  17747. classCallCheck(this, SocketIoChannel);
  17748. /**
  17749. * The event callbacks applied to the channel.
  17750. */
  17751. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17752. _this.events = {};
  17753. _this.name = name;
  17754. _this.socket = socket;
  17755. _this.options = options;
  17756. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17757. _this.subscribe();
  17758. _this.configureReconnector();
  17759. return _this;
  17760. }
  17761. /**
  17762. * Subscribe to a Socket.io channel.
  17763. */
  17764. createClass(SocketIoChannel, [{
  17765. key: 'subscribe',
  17766. value: function subscribe() {
  17767. this.socket.emit('subscribe', {
  17768. channel: this.name,
  17769. auth: this.options.auth || {}
  17770. });
  17771. }
  17772. /**
  17773. * Unsubscribe from channel and ubind event callbacks.
  17774. */
  17775. }, {
  17776. key: 'unsubscribe',
  17777. value: function unsubscribe() {
  17778. this.unbind();
  17779. this.socket.emit('unsubscribe', {
  17780. channel: this.name,
  17781. auth: this.options.auth || {}
  17782. });
  17783. }
  17784. /**
  17785. * Listen for an event on the channel instance.
  17786. */
  17787. }, {
  17788. key: 'listen',
  17789. value: function listen(event, callback) {
  17790. this.on(this.eventFormatter.format(event), callback);
  17791. return this;
  17792. }
  17793. /**
  17794. * Stop listening for an event on the channel instance.
  17795. */
  17796. }, {
  17797. key: 'stopListening',
  17798. value: function stopListening(event) {
  17799. var name = this.eventFormatter.format(event);
  17800. this.socket.removeListener(name);
  17801. delete this.events[name];
  17802. return this;
  17803. }
  17804. /**
  17805. * Bind the channel's socket to an event and store the callback.
  17806. */
  17807. }, {
  17808. key: 'on',
  17809. value: function on(event, callback) {
  17810. var _this2 = this;
  17811. var listener = function listener(channel, data) {
  17812. if (_this2.name == channel) {
  17813. callback(data);
  17814. }
  17815. };
  17816. this.socket.on(event, listener);
  17817. this.bind(event, listener);
  17818. }
  17819. /**
  17820. * Attach a 'reconnect' listener and bind the event.
  17821. */
  17822. }, {
  17823. key: 'configureReconnector',
  17824. value: function configureReconnector() {
  17825. var _this3 = this;
  17826. var listener = function listener() {
  17827. _this3.subscribe();
  17828. };
  17829. this.socket.on('reconnect', listener);
  17830. this.bind('reconnect', listener);
  17831. }
  17832. /**
  17833. * Bind the channel's socket to an event and store the callback.
  17834. */
  17835. }, {
  17836. key: 'bind',
  17837. value: function bind(event, callback) {
  17838. this.events[event] = this.events[event] || [];
  17839. this.events[event].push(callback);
  17840. }
  17841. /**
  17842. * Unbind the channel's socket from all stored event callbacks.
  17843. */
  17844. }, {
  17845. key: 'unbind',
  17846. value: function unbind() {
  17847. var _this4 = this;
  17848. Object.keys(this.events).forEach(function (event) {
  17849. _this4.events[event].forEach(function (callback) {
  17850. _this4.socket.removeListener(event, callback);
  17851. });
  17852. delete _this4.events[event];
  17853. });
  17854. }
  17855. }]);
  17856. return SocketIoChannel;
  17857. }(Channel);
  17858. /**
  17859. * This class represents a Socket.io presence channel.
  17860. */
  17861. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17862. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17863. function SocketIoPrivateChannel() {
  17864. classCallCheck(this, SocketIoPrivateChannel);
  17865. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17866. }
  17867. createClass(SocketIoPrivateChannel, [{
  17868. key: 'whisper',
  17869. /**
  17870. * Trigger client event on the channel.
  17871. */
  17872. value: function whisper(eventName, data) {
  17873. this.socket.emit('client event', {
  17874. channel: this.name,
  17875. event: 'client-' + eventName,
  17876. data: data
  17877. });
  17878. return this;
  17879. }
  17880. }]);
  17881. return SocketIoPrivateChannel;
  17882. }(SocketIoChannel);
  17883. /**
  17884. * This class represents a Socket.io presence channel.
  17885. */
  17886. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17887. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17888. function SocketIoPresenceChannel() {
  17889. classCallCheck(this, SocketIoPresenceChannel);
  17890. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17891. }
  17892. createClass(SocketIoPresenceChannel, [{
  17893. key: 'here',
  17894. /**
  17895. * Register a callback to be called anytime the member list changes.
  17896. */
  17897. value: function here(callback) {
  17898. this.on('presence:subscribed', function (members) {
  17899. callback(members.map(function (m) {
  17900. return m.user_info;
  17901. }));
  17902. });
  17903. return this;
  17904. }
  17905. /**
  17906. * Listen for someone joining the channel.
  17907. */
  17908. }, {
  17909. key: 'joining',
  17910. value: function joining(callback) {
  17911. this.on('presence:joining', function (member) {
  17912. return callback(member.user_info);
  17913. });
  17914. return this;
  17915. }
  17916. /**
  17917. * Listen for someone leaving the channel.
  17918. */
  17919. }, {
  17920. key: 'leaving',
  17921. value: function leaving(callback) {
  17922. this.on('presence:leaving', function (member) {
  17923. return callback(member.user_info);
  17924. });
  17925. return this;
  17926. }
  17927. }]);
  17928. return SocketIoPresenceChannel;
  17929. }(SocketIoPrivateChannel);
  17930. /**
  17931. * This class represents a null channel.
  17932. */
  17933. var NullChannel = function (_Channel) {
  17934. inherits(NullChannel, _Channel);
  17935. function NullChannel() {
  17936. classCallCheck(this, NullChannel);
  17937. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17938. }
  17939. createClass(NullChannel, [{
  17940. key: 'subscribe',
  17941. /**
  17942. * Subscribe to a channel.
  17943. */
  17944. value: function subscribe() {}
  17945. //
  17946. /**
  17947. * Unsubscribe from a channel.
  17948. */
  17949. }, {
  17950. key: 'unsubscribe',
  17951. value: function unsubscribe() {}
  17952. //
  17953. /**
  17954. * Listen for an event on the channel instance.
  17955. */
  17956. }, {
  17957. key: 'listen',
  17958. value: function listen(event, callback) {
  17959. return this;
  17960. }
  17961. /**
  17962. * Stop listening for an event on the channel instance.
  17963. */
  17964. }, {
  17965. key: 'stopListening',
  17966. value: function stopListening(event) {
  17967. return this;
  17968. }
  17969. /**
  17970. * Bind a channel to an event.
  17971. */
  17972. }, {
  17973. key: 'on',
  17974. value: function on(event, callback) {
  17975. return this;
  17976. }
  17977. }]);
  17978. return NullChannel;
  17979. }(Channel);
  17980. /**
  17981. * This class represents a null private channel.
  17982. */
  17983. var NullPrivateChannel = function (_NullChannel) {
  17984. inherits(NullPrivateChannel, _NullChannel);
  17985. function NullPrivateChannel() {
  17986. classCallCheck(this, NullPrivateChannel);
  17987. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17988. }
  17989. createClass(NullPrivateChannel, [{
  17990. key: 'whisper',
  17991. /**
  17992. * Trigger client event on the channel.
  17993. */
  17994. value: function whisper(eventName, data) {
  17995. return this;
  17996. }
  17997. }]);
  17998. return NullPrivateChannel;
  17999. }(NullChannel);
  18000. /**
  18001. * This class represents a null presence channel.
  18002. */
  18003. var NullPresenceChannel = function (_NullChannel) {
  18004. inherits(NullPresenceChannel, _NullChannel);
  18005. function NullPresenceChannel() {
  18006. classCallCheck(this, NullPresenceChannel);
  18007. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18008. }
  18009. createClass(NullPresenceChannel, [{
  18010. key: 'here',
  18011. /**
  18012. * Register a callback to be called anytime the member list changes.
  18013. */
  18014. value: function here(callback) {
  18015. return this;
  18016. }
  18017. /**
  18018. * Listen for someone joining the channel.
  18019. */
  18020. }, {
  18021. key: 'joining',
  18022. value: function joining(callback) {
  18023. return this;
  18024. }
  18025. /**
  18026. * Listen for someone leaving the channel.
  18027. */
  18028. }, {
  18029. key: 'leaving',
  18030. value: function leaving(callback) {
  18031. return this;
  18032. }
  18033. /**
  18034. * Trigger client event on the channel.
  18035. */
  18036. }, {
  18037. key: 'whisper',
  18038. value: function whisper(eventName, data) {
  18039. return this;
  18040. }
  18041. }]);
  18042. return NullPresenceChannel;
  18043. }(NullChannel);
  18044. /**
  18045. * This class creates a connector to Pusher.
  18046. */
  18047. var PusherConnector = function (_Connector) {
  18048. inherits(PusherConnector, _Connector);
  18049. function PusherConnector() {
  18050. classCallCheck(this, PusherConnector);
  18051. /**
  18052. * All of the subscribed channel names.
  18053. */
  18054. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18055. _this.channels = {};
  18056. return _this;
  18057. }
  18058. /**
  18059. * Create a fresh Pusher connection.
  18060. */
  18061. createClass(PusherConnector, [{
  18062. key: 'connect',
  18063. value: function connect() {
  18064. if (typeof this.options.client !== 'undefined') {
  18065. this.pusher = this.options.client;
  18066. } else {
  18067. this.pusher = new Pusher(this.options.key, this.options);
  18068. }
  18069. }
  18070. /**
  18071. * Listen for an event on a channel instance.
  18072. */
  18073. }, {
  18074. key: 'listen',
  18075. value: function listen(name, event, callback) {
  18076. return this.channel(name).listen(event, callback);
  18077. }
  18078. /**
  18079. * Get a channel instance by name.
  18080. */
  18081. }, {
  18082. key: 'channel',
  18083. value: function channel(name) {
  18084. if (!this.channels[name]) {
  18085. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18086. }
  18087. return this.channels[name];
  18088. }
  18089. /**
  18090. * Get a private channel instance by name.
  18091. */
  18092. }, {
  18093. key: 'privateChannel',
  18094. value: function privateChannel(name) {
  18095. if (!this.channels['private-' + name]) {
  18096. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18097. }
  18098. return this.channels['private-' + name];
  18099. }
  18100. /**
  18101. * Get a presence channel instance by name.
  18102. */
  18103. }, {
  18104. key: 'presenceChannel',
  18105. value: function presenceChannel(name) {
  18106. if (!this.channels['presence-' + name]) {
  18107. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18108. }
  18109. return this.channels['presence-' + name];
  18110. }
  18111. /**
  18112. * Leave the given channel, as well as its private and presence variants.
  18113. */
  18114. }, {
  18115. key: 'leave',
  18116. value: function leave(name) {
  18117. var _this2 = this;
  18118. var channels = [name, 'private-' + name, 'presence-' + name];
  18119. channels.forEach(function (name, index) {
  18120. _this2.leaveChannel(name);
  18121. });
  18122. }
  18123. /**
  18124. * Leave the given channel.
  18125. */
  18126. }, {
  18127. key: 'leaveChannel',
  18128. value: function leaveChannel(name) {
  18129. if (this.channels[name]) {
  18130. this.channels[name].unsubscribe();
  18131. delete this.channels[name];
  18132. }
  18133. }
  18134. /**
  18135. * Get the socket ID for the connection.
  18136. */
  18137. }, {
  18138. key: 'socketId',
  18139. value: function socketId() {
  18140. return this.pusher.connection.socket_id;
  18141. }
  18142. /**
  18143. * Disconnect Pusher connection.
  18144. */
  18145. }, {
  18146. key: 'disconnect',
  18147. value: function disconnect() {
  18148. this.pusher.disconnect();
  18149. }
  18150. }]);
  18151. return PusherConnector;
  18152. }(Connector);
  18153. /**
  18154. * This class creates a connnector to a Socket.io server.
  18155. */
  18156. var SocketIoConnector = function (_Connector) {
  18157. inherits(SocketIoConnector, _Connector);
  18158. function SocketIoConnector() {
  18159. classCallCheck(this, SocketIoConnector);
  18160. /**
  18161. * All of the subscribed channel names.
  18162. */
  18163. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18164. _this.channels = {};
  18165. return _this;
  18166. }
  18167. /**
  18168. * Create a fresh Socket.io connection.
  18169. */
  18170. createClass(SocketIoConnector, [{
  18171. key: 'connect',
  18172. value: function connect() {
  18173. var io = this.getSocketIO();
  18174. this.socket = io(this.options.host, this.options);
  18175. return this.socket;
  18176. }
  18177. /**
  18178. * Get socket.io module from global scope or options.
  18179. */
  18180. }, {
  18181. key: 'getSocketIO',
  18182. value: function getSocketIO() {
  18183. if (typeof this.options.client !== 'undefined') {
  18184. return this.options.client;
  18185. }
  18186. if (typeof io !== 'undefined') {
  18187. return io;
  18188. }
  18189. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18190. }
  18191. /**
  18192. * Listen for an event on a channel instance.
  18193. */
  18194. }, {
  18195. key: 'listen',
  18196. value: function listen(name, event, callback) {
  18197. return this.channel(name).listen(event, callback);
  18198. }
  18199. /**
  18200. * Get a channel instance by name.
  18201. */
  18202. }, {
  18203. key: 'channel',
  18204. value: function channel(name) {
  18205. if (!this.channels[name]) {
  18206. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18207. }
  18208. return this.channels[name];
  18209. }
  18210. /**
  18211. * Get a private channel instance by name.
  18212. */
  18213. }, {
  18214. key: 'privateChannel',
  18215. value: function privateChannel(name) {
  18216. if (!this.channels['private-' + name]) {
  18217. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18218. }
  18219. return this.channels['private-' + name];
  18220. }
  18221. /**
  18222. * Get a presence channel instance by name.
  18223. */
  18224. }, {
  18225. key: 'presenceChannel',
  18226. value: function presenceChannel(name) {
  18227. if (!this.channels['presence-' + name]) {
  18228. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18229. }
  18230. return this.channels['presence-' + name];
  18231. }
  18232. /**
  18233. * Leave the given channel, as well as its private and presence variants.
  18234. */
  18235. }, {
  18236. key: 'leave',
  18237. value: function leave(name) {
  18238. var _this2 = this;
  18239. var channels = [name, 'private-' + name, 'presence-' + name];
  18240. channels.forEach(function (name) {
  18241. _this2.leaveChannel(name);
  18242. });
  18243. }
  18244. /**
  18245. * Leave the given channel.
  18246. */
  18247. }, {
  18248. key: 'leaveChannel',
  18249. value: function leaveChannel(name) {
  18250. if (this.channels[name]) {
  18251. this.channels[name].unsubscribe();
  18252. delete this.channels[name];
  18253. }
  18254. }
  18255. /**
  18256. * Get the socket ID for the connection.
  18257. */
  18258. }, {
  18259. key: 'socketId',
  18260. value: function socketId() {
  18261. return this.socket.id;
  18262. }
  18263. /**
  18264. * Disconnect Socketio connection.
  18265. */
  18266. }, {
  18267. key: 'disconnect',
  18268. value: function disconnect() {
  18269. this.socket.disconnect();
  18270. }
  18271. }]);
  18272. return SocketIoConnector;
  18273. }(Connector);
  18274. /**
  18275. * This class creates a null connector.
  18276. */
  18277. var NullConnector = function (_Connector) {
  18278. inherits(NullConnector, _Connector);
  18279. function NullConnector() {
  18280. classCallCheck(this, NullConnector);
  18281. /**
  18282. * All of the subscribed channel names.
  18283. */
  18284. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18285. _this.channels = {};
  18286. return _this;
  18287. }
  18288. /**
  18289. * Create a fresh connection.
  18290. */
  18291. createClass(NullConnector, [{
  18292. key: 'connect',
  18293. value: function connect() {}
  18294. //
  18295. /**
  18296. * Listen for an event on a channel instance.
  18297. */
  18298. }, {
  18299. key: 'listen',
  18300. value: function listen(name, event, callback) {
  18301. return new NullChannel();
  18302. }
  18303. /**
  18304. * Get a channel instance by name.
  18305. */
  18306. }, {
  18307. key: 'channel',
  18308. value: function channel(name) {
  18309. return new NullChannel();
  18310. }
  18311. /**
  18312. * Get a private channel instance by name.
  18313. */
  18314. }, {
  18315. key: 'privateChannel',
  18316. value: function privateChannel(name) {
  18317. return new NullPrivateChannel();
  18318. }
  18319. /**
  18320. * Get a presence channel instance by name.
  18321. */
  18322. }, {
  18323. key: 'presenceChannel',
  18324. value: function presenceChannel(name) {
  18325. return new NullPresenceChannel();
  18326. }
  18327. /**
  18328. * Leave the given channel, as well as its private and presence variants.
  18329. */
  18330. }, {
  18331. key: 'leave',
  18332. value: function leave(name) {}
  18333. //
  18334. /**
  18335. * Leave the given channel.
  18336. */
  18337. }, {
  18338. key: 'leaveChannel',
  18339. value: function leaveChannel(name) {}
  18340. //
  18341. /**
  18342. * Get the socket ID for the connection.
  18343. */
  18344. }, {
  18345. key: 'socketId',
  18346. value: function socketId() {
  18347. return 'fake-socket-id';
  18348. }
  18349. /**
  18350. * Disconnect the connection.
  18351. */
  18352. }, {
  18353. key: 'disconnect',
  18354. value: function disconnect() {
  18355. //
  18356. }
  18357. }]);
  18358. return NullConnector;
  18359. }(Connector);
  18360. /**
  18361. * This class is the primary API for interacting with broadcasting.
  18362. */
  18363. var Echo = function () {
  18364. /**
  18365. * Create a new class instance.
  18366. */
  18367. function Echo(options) {
  18368. classCallCheck(this, Echo);
  18369. this.options = options;
  18370. this.connect();
  18371. if (!this.options.withoutInterceptors) {
  18372. this.registerInterceptors();
  18373. }
  18374. }
  18375. /**
  18376. * Get a channel instance by name.
  18377. */
  18378. createClass(Echo, [{
  18379. key: 'channel',
  18380. value: function channel(_channel) {
  18381. return this.connector.channel(_channel);
  18382. }
  18383. /**
  18384. * Create a new connection.
  18385. */
  18386. }, {
  18387. key: 'connect',
  18388. value: function connect() {
  18389. if (this.options.broadcaster == 'pusher') {
  18390. this.connector = new PusherConnector(this.options);
  18391. } else if (this.options.broadcaster == 'socket.io') {
  18392. this.connector = new SocketIoConnector(this.options);
  18393. } else if (this.options.broadcaster == 'null') {
  18394. this.connector = new NullConnector(this.options);
  18395. } else if (typeof this.options.broadcaster == 'function') {
  18396. this.connector = new this.options.broadcaster(this.options);
  18397. }
  18398. }
  18399. /**
  18400. * Disconnect from the Echo server.
  18401. */
  18402. }, {
  18403. key: 'disconnect',
  18404. value: function disconnect() {
  18405. this.connector.disconnect();
  18406. }
  18407. /**
  18408. * Get a presence channel instance by name.
  18409. */
  18410. }, {
  18411. key: 'join',
  18412. value: function join(channel) {
  18413. return this.connector.presenceChannel(channel);
  18414. }
  18415. /**
  18416. * Leave the given channel, as well as its private and presence variants.
  18417. */
  18418. }, {
  18419. key: 'leave',
  18420. value: function leave(channel) {
  18421. this.connector.leave(channel);
  18422. }
  18423. /**
  18424. * Leave the given channel.
  18425. */
  18426. }, {
  18427. key: 'leaveChannel',
  18428. value: function leaveChannel(channel) {
  18429. this.connector.leaveChannel(channel);
  18430. }
  18431. /**
  18432. * Listen for an event on a channel instance.
  18433. */
  18434. }, {
  18435. key: 'listen',
  18436. value: function listen(channel, event, callback) {
  18437. return this.connector.listen(channel, event, callback);
  18438. }
  18439. /**
  18440. * Get a private channel instance by name.
  18441. */
  18442. }, {
  18443. key: 'private',
  18444. value: function _private(channel) {
  18445. return this.connector.privateChannel(channel);
  18446. }
  18447. /**
  18448. * Get the Socket ID for the connection.
  18449. */
  18450. }, {
  18451. key: 'socketId',
  18452. value: function socketId() {
  18453. return this.connector.socketId();
  18454. }
  18455. /**
  18456. * Register 3rd party request interceptiors. These are used to automatically
  18457. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18458. */
  18459. }, {
  18460. key: 'registerInterceptors',
  18461. value: function registerInterceptors() {
  18462. if (typeof Vue === 'function' && Vue.http) {
  18463. this.registerVueRequestInterceptor();
  18464. }
  18465. if (typeof axios === 'function') {
  18466. this.registerAxiosRequestInterceptor();
  18467. }
  18468. if (typeof jQuery === 'function') {
  18469. this.registerjQueryAjaxSetup();
  18470. }
  18471. }
  18472. /**
  18473. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18474. */
  18475. }, {
  18476. key: 'registerVueRequestInterceptor',
  18477. value: function registerVueRequestInterceptor() {
  18478. var _this = this;
  18479. Vue.http.interceptors.push(function (request, next) {
  18480. if (_this.socketId()) {
  18481. request.headers.set('X-Socket-ID', _this.socketId());
  18482. }
  18483. next();
  18484. });
  18485. }
  18486. /**
  18487. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18488. */
  18489. }, {
  18490. key: 'registerAxiosRequestInterceptor',
  18491. value: function registerAxiosRequestInterceptor() {
  18492. var _this2 = this;
  18493. axios.interceptors.request.use(function (config) {
  18494. if (_this2.socketId()) {
  18495. config.headers['X-Socket-Id'] = _this2.socketId();
  18496. }
  18497. return config;
  18498. });
  18499. }
  18500. /**
  18501. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18502. */
  18503. }, {
  18504. key: 'registerjQueryAjaxSetup',
  18505. value: function registerjQueryAjaxSetup() {
  18506. var _this3 = this;
  18507. if (typeof jQuery.ajax != 'undefined') {
  18508. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18509. if (_this3.socketId()) {
  18510. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18511. }
  18512. });
  18513. }
  18514. }
  18515. }]);
  18516. return Echo;
  18517. }();
  18518. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18519. /***/ }),
  18520. /***/ "./node_modules/lodash/lodash.js":
  18521. /*!***************************************!*\
  18522. !*** ./node_modules/lodash/lodash.js ***!
  18523. \***************************************/
  18524. /*! no static exports found */
  18525. /***/ (function(module, exports, __webpack_require__) {
  18526. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18527. * @license
  18528. * Lodash <https://lodash.com/>
  18529. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18530. * Released under MIT license <https://lodash.com/license>
  18531. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18532. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18533. */
  18534. ;(function() {
  18535. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18536. var undefined;
  18537. /** Used as the semantic version number. */
  18538. var VERSION = '4.17.15';
  18539. /** Used as the size to enable large array optimizations. */
  18540. var LARGE_ARRAY_SIZE = 200;
  18541. /** Error message constants. */
  18542. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18543. FUNC_ERROR_TEXT = 'Expected a function';
  18544. /** Used to stand-in for `undefined` hash values. */
  18545. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18546. /** Used as the maximum memoize cache size. */
  18547. var MAX_MEMOIZE_SIZE = 500;
  18548. /** Used as the internal argument placeholder. */
  18549. var PLACEHOLDER = '__lodash_placeholder__';
  18550. /** Used to compose bitmasks for cloning. */
  18551. var CLONE_DEEP_FLAG = 1,
  18552. CLONE_FLAT_FLAG = 2,
  18553. CLONE_SYMBOLS_FLAG = 4;
  18554. /** Used to compose bitmasks for value comparisons. */
  18555. var COMPARE_PARTIAL_FLAG = 1,
  18556. COMPARE_UNORDERED_FLAG = 2;
  18557. /** Used to compose bitmasks for function metadata. */
  18558. var WRAP_BIND_FLAG = 1,
  18559. WRAP_BIND_KEY_FLAG = 2,
  18560. WRAP_CURRY_BOUND_FLAG = 4,
  18561. WRAP_CURRY_FLAG = 8,
  18562. WRAP_CURRY_RIGHT_FLAG = 16,
  18563. WRAP_PARTIAL_FLAG = 32,
  18564. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18565. WRAP_ARY_FLAG = 128,
  18566. WRAP_REARG_FLAG = 256,
  18567. WRAP_FLIP_FLAG = 512;
  18568. /** Used as default options for `_.truncate`. */
  18569. var DEFAULT_TRUNC_LENGTH = 30,
  18570. DEFAULT_TRUNC_OMISSION = '...';
  18571. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18572. var HOT_COUNT = 800,
  18573. HOT_SPAN = 16;
  18574. /** Used to indicate the type of lazy iteratees. */
  18575. var LAZY_FILTER_FLAG = 1,
  18576. LAZY_MAP_FLAG = 2,
  18577. LAZY_WHILE_FLAG = 3;
  18578. /** Used as references for various `Number` constants. */
  18579. var INFINITY = 1 / 0,
  18580. MAX_SAFE_INTEGER = 9007199254740991,
  18581. MAX_INTEGER = 1.7976931348623157e+308,
  18582. NAN = 0 / 0;
  18583. /** Used as references for the maximum length and index of an array. */
  18584. var MAX_ARRAY_LENGTH = 4294967295,
  18585. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18586. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18587. /** Used to associate wrap methods with their bit flags. */
  18588. var wrapFlags = [
  18589. ['ary', WRAP_ARY_FLAG],
  18590. ['bind', WRAP_BIND_FLAG],
  18591. ['bindKey', WRAP_BIND_KEY_FLAG],
  18592. ['curry', WRAP_CURRY_FLAG],
  18593. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18594. ['flip', WRAP_FLIP_FLAG],
  18595. ['partial', WRAP_PARTIAL_FLAG],
  18596. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18597. ['rearg', WRAP_REARG_FLAG]
  18598. ];
  18599. /** `Object#toString` result references. */
  18600. var argsTag = '[object Arguments]',
  18601. arrayTag = '[object Array]',
  18602. asyncTag = '[object AsyncFunction]',
  18603. boolTag = '[object Boolean]',
  18604. dateTag = '[object Date]',
  18605. domExcTag = '[object DOMException]',
  18606. errorTag = '[object Error]',
  18607. funcTag = '[object Function]',
  18608. genTag = '[object GeneratorFunction]',
  18609. mapTag = '[object Map]',
  18610. numberTag = '[object Number]',
  18611. nullTag = '[object Null]',
  18612. objectTag = '[object Object]',
  18613. promiseTag = '[object Promise]',
  18614. proxyTag = '[object Proxy]',
  18615. regexpTag = '[object RegExp]',
  18616. setTag = '[object Set]',
  18617. stringTag = '[object String]',
  18618. symbolTag = '[object Symbol]',
  18619. undefinedTag = '[object Undefined]',
  18620. weakMapTag = '[object WeakMap]',
  18621. weakSetTag = '[object WeakSet]';
  18622. var arrayBufferTag = '[object ArrayBuffer]',
  18623. dataViewTag = '[object DataView]',
  18624. float32Tag = '[object Float32Array]',
  18625. float64Tag = '[object Float64Array]',
  18626. int8Tag = '[object Int8Array]',
  18627. int16Tag = '[object Int16Array]',
  18628. int32Tag = '[object Int32Array]',
  18629. uint8Tag = '[object Uint8Array]',
  18630. uint8ClampedTag = '[object Uint8ClampedArray]',
  18631. uint16Tag = '[object Uint16Array]',
  18632. uint32Tag = '[object Uint32Array]';
  18633. /** Used to match empty string literals in compiled template source. */
  18634. var reEmptyStringLeading = /\b__p \+= '';/g,
  18635. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18636. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18637. /** Used to match HTML entities and HTML characters. */
  18638. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18639. reUnescapedHtml = /[&<>"']/g,
  18640. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18641. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18642. /** Used to match template delimiters. */
  18643. var reEscape = /<%-([\s\S]+?)%>/g,
  18644. reEvaluate = /<%([\s\S]+?)%>/g,
  18645. reInterpolate = /<%=([\s\S]+?)%>/g;
  18646. /** Used to match property names within property paths. */
  18647. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18648. reIsPlainProp = /^\w*$/,
  18649. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18650. /**
  18651. * Used to match `RegExp`
  18652. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18653. */
  18654. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18655. reHasRegExpChar = RegExp(reRegExpChar.source);
  18656. /** Used to match leading and trailing whitespace. */
  18657. var reTrim = /^\s+|\s+$/g,
  18658. reTrimStart = /^\s+/,
  18659. reTrimEnd = /\s+$/;
  18660. /** Used to match wrap detail comments. */
  18661. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18662. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18663. reSplitDetails = /,? & /;
  18664. /** Used to match words composed of alphanumeric characters. */
  18665. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18666. /** Used to match backslashes in property paths. */
  18667. var reEscapeChar = /\\(\\)?/g;
  18668. /**
  18669. * Used to match
  18670. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18671. */
  18672. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18673. /** Used to match `RegExp` flags from their coerced string values. */
  18674. var reFlags = /\w*$/;
  18675. /** Used to detect bad signed hexadecimal string values. */
  18676. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18677. /** Used to detect binary string values. */
  18678. var reIsBinary = /^0b[01]+$/i;
  18679. /** Used to detect host constructors (Safari). */
  18680. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18681. /** Used to detect octal string values. */
  18682. var reIsOctal = /^0o[0-7]+$/i;
  18683. /** Used to detect unsigned integer values. */
  18684. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18685. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18686. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18687. /** Used to ensure capturing order of template delimiters. */
  18688. var reNoMatch = /($^)/;
  18689. /** Used to match unescaped characters in compiled string literals. */
  18690. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18691. /** Used to compose unicode character classes. */
  18692. var rsAstralRange = '\\ud800-\\udfff',
  18693. rsComboMarksRange = '\\u0300-\\u036f',
  18694. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18695. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18696. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18697. rsDingbatRange = '\\u2700-\\u27bf',
  18698. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18699. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18700. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18701. rsPunctuationRange = '\\u2000-\\u206f',
  18702. 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',
  18703. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18704. rsVarRange = '\\ufe0e\\ufe0f',
  18705. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18706. /** Used to compose unicode capture groups. */
  18707. var rsApos = "['\u2019]",
  18708. rsAstral = '[' + rsAstralRange + ']',
  18709. rsBreak = '[' + rsBreakRange + ']',
  18710. rsCombo = '[' + rsComboRange + ']',
  18711. rsDigits = '\\d+',
  18712. rsDingbat = '[' + rsDingbatRange + ']',
  18713. rsLower = '[' + rsLowerRange + ']',
  18714. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18715. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18716. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18717. rsNonAstral = '[^' + rsAstralRange + ']',
  18718. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18719. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18720. rsUpper = '[' + rsUpperRange + ']',
  18721. rsZWJ = '\\u200d';
  18722. /** Used to compose unicode regexes. */
  18723. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18724. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18725. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18726. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18727. reOptMod = rsModifier + '?',
  18728. rsOptVar = '[' + rsVarRange + ']?',
  18729. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18730. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18731. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18732. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18733. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18734. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18735. /** Used to match apostrophes. */
  18736. var reApos = RegExp(rsApos, 'g');
  18737. /**
  18738. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18739. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18740. */
  18741. var reComboMark = RegExp(rsCombo, 'g');
  18742. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18743. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18744. /** Used to match complex or compound words. */
  18745. var reUnicodeWord = RegExp([
  18746. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18747. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18748. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18749. rsUpper + '+' + rsOptContrUpper,
  18750. rsOrdUpper,
  18751. rsOrdLower,
  18752. rsDigits,
  18753. rsEmoji
  18754. ].join('|'), 'g');
  18755. /** 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/). */
  18756. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18757. /** Used to detect strings that need a more robust regexp to match words. */
  18758. 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 ]/;
  18759. /** Used to assign default `context` object properties. */
  18760. var contextProps = [
  18761. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18762. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18763. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18764. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18765. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18766. ];
  18767. /** Used to make template sourceURLs easier to identify. */
  18768. var templateCounter = -1;
  18769. /** Used to identify `toStringTag` values of typed arrays. */
  18770. var typedArrayTags = {};
  18771. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18772. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18773. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18774. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18775. typedArrayTags[uint32Tag] = true;
  18776. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18777. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18778. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18779. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18780. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18781. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18782. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18783. typedArrayTags[weakMapTag] = false;
  18784. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18785. var cloneableTags = {};
  18786. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18787. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18788. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18789. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18790. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18791. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18792. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18793. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18794. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18795. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18796. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18797. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18798. cloneableTags[weakMapTag] = false;
  18799. /** Used to map Latin Unicode letters to basic Latin letters. */
  18800. var deburredLetters = {
  18801. // Latin-1 Supplement block.
  18802. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18803. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18804. '\xc7': 'C', '\xe7': 'c',
  18805. '\xd0': 'D', '\xf0': 'd',
  18806. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18807. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18808. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18809. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18810. '\xd1': 'N', '\xf1': 'n',
  18811. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18812. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18813. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18814. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18815. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18816. '\xc6': 'Ae', '\xe6': 'ae',
  18817. '\xde': 'Th', '\xfe': 'th',
  18818. '\xdf': 'ss',
  18819. // Latin Extended-A block.
  18820. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18821. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18822. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18823. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18824. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18825. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18826. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18827. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18828. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18829. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18830. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18831. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18832. '\u0134': 'J', '\u0135': 'j',
  18833. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18834. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18835. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18836. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18837. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18838. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18839. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18840. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18841. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18842. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18843. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18844. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18845. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18846. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18847. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18848. '\u0174': 'W', '\u0175': 'w',
  18849. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18850. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18851. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18852. '\u0132': 'IJ', '\u0133': 'ij',
  18853. '\u0152': 'Oe', '\u0153': 'oe',
  18854. '\u0149': "'n", '\u017f': 's'
  18855. };
  18856. /** Used to map characters to HTML entities. */
  18857. var htmlEscapes = {
  18858. '&': '&amp;',
  18859. '<': '&lt;',
  18860. '>': '&gt;',
  18861. '"': '&quot;',
  18862. "'": '&#39;'
  18863. };
  18864. /** Used to map HTML entities to characters. */
  18865. var htmlUnescapes = {
  18866. '&amp;': '&',
  18867. '&lt;': '<',
  18868. '&gt;': '>',
  18869. '&quot;': '"',
  18870. '&#39;': "'"
  18871. };
  18872. /** Used to escape characters for inclusion in compiled string literals. */
  18873. var stringEscapes = {
  18874. '\\': '\\',
  18875. "'": "'",
  18876. '\n': 'n',
  18877. '\r': 'r',
  18878. '\u2028': 'u2028',
  18879. '\u2029': 'u2029'
  18880. };
  18881. /** Built-in method references without a dependency on `root`. */
  18882. var freeParseFloat = parseFloat,
  18883. freeParseInt = parseInt;
  18884. /** Detect free variable `global` from Node.js. */
  18885. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18886. /** Detect free variable `self`. */
  18887. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18888. /** Used as a reference to the global object. */
  18889. var root = freeGlobal || freeSelf || Function('return this')();
  18890. /** Detect free variable `exports`. */
  18891. var freeExports = true && exports && !exports.nodeType && exports;
  18892. /** Detect free variable `module`. */
  18893. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18894. /** Detect the popular CommonJS extension `module.exports`. */
  18895. var moduleExports = freeModule && freeModule.exports === freeExports;
  18896. /** Detect free variable `process` from Node.js. */
  18897. var freeProcess = moduleExports && freeGlobal.process;
  18898. /** Used to access faster Node.js helpers. */
  18899. var nodeUtil = (function() {
  18900. try {
  18901. // Use `util.types` for Node.js 10+.
  18902. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18903. if (types) {
  18904. return types;
  18905. }
  18906. // Legacy `process.binding('util')` for Node.js < 10.
  18907. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18908. } catch (e) {}
  18909. }());
  18910. /* Node.js helper references. */
  18911. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18912. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18913. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18914. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18915. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18916. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18917. /*--------------------------------------------------------------------------*/
  18918. /**
  18919. * A faster alternative to `Function#apply`, this function invokes `func`
  18920. * with the `this` binding of `thisArg` and the arguments of `args`.
  18921. *
  18922. * @private
  18923. * @param {Function} func The function to invoke.
  18924. * @param {*} thisArg The `this` binding of `func`.
  18925. * @param {Array} args The arguments to invoke `func` with.
  18926. * @returns {*} Returns the result of `func`.
  18927. */
  18928. function apply(func, thisArg, args) {
  18929. switch (args.length) {
  18930. case 0: return func.call(thisArg);
  18931. case 1: return func.call(thisArg, args[0]);
  18932. case 2: return func.call(thisArg, args[0], args[1]);
  18933. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18934. }
  18935. return func.apply(thisArg, args);
  18936. }
  18937. /**
  18938. * A specialized version of `baseAggregator` for arrays.
  18939. *
  18940. * @private
  18941. * @param {Array} [array] The array to iterate over.
  18942. * @param {Function} setter The function to set `accumulator` values.
  18943. * @param {Function} iteratee The iteratee to transform keys.
  18944. * @param {Object} accumulator The initial aggregated object.
  18945. * @returns {Function} Returns `accumulator`.
  18946. */
  18947. function arrayAggregator(array, setter, iteratee, accumulator) {
  18948. var index = -1,
  18949. length = array == null ? 0 : array.length;
  18950. while (++index < length) {
  18951. var value = array[index];
  18952. setter(accumulator, value, iteratee(value), array);
  18953. }
  18954. return accumulator;
  18955. }
  18956. /**
  18957. * A specialized version of `_.forEach` for arrays without support for
  18958. * iteratee shorthands.
  18959. *
  18960. * @private
  18961. * @param {Array} [array] The array to iterate over.
  18962. * @param {Function} iteratee The function invoked per iteration.
  18963. * @returns {Array} Returns `array`.
  18964. */
  18965. function arrayEach(array, iteratee) {
  18966. var index = -1,
  18967. length = array == null ? 0 : array.length;
  18968. while (++index < length) {
  18969. if (iteratee(array[index], index, array) === false) {
  18970. break;
  18971. }
  18972. }
  18973. return array;
  18974. }
  18975. /**
  18976. * A specialized version of `_.forEachRight` for arrays without support for
  18977. * iteratee shorthands.
  18978. *
  18979. * @private
  18980. * @param {Array} [array] The array to iterate over.
  18981. * @param {Function} iteratee The function invoked per iteration.
  18982. * @returns {Array} Returns `array`.
  18983. */
  18984. function arrayEachRight(array, iteratee) {
  18985. var length = array == null ? 0 : array.length;
  18986. while (length--) {
  18987. if (iteratee(array[length], length, array) === false) {
  18988. break;
  18989. }
  18990. }
  18991. return array;
  18992. }
  18993. /**
  18994. * A specialized version of `_.every` for arrays without support for
  18995. * iteratee shorthands.
  18996. *
  18997. * @private
  18998. * @param {Array} [array] The array to iterate over.
  18999. * @param {Function} predicate The function invoked per iteration.
  19000. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19001. * else `false`.
  19002. */
  19003. function arrayEvery(array, predicate) {
  19004. var index = -1,
  19005. length = array == null ? 0 : array.length;
  19006. while (++index < length) {
  19007. if (!predicate(array[index], index, array)) {
  19008. return false;
  19009. }
  19010. }
  19011. return true;
  19012. }
  19013. /**
  19014. * A specialized version of `_.filter` for arrays without support for
  19015. * iteratee shorthands.
  19016. *
  19017. * @private
  19018. * @param {Array} [array] The array to iterate over.
  19019. * @param {Function} predicate The function invoked per iteration.
  19020. * @returns {Array} Returns the new filtered array.
  19021. */
  19022. function arrayFilter(array, predicate) {
  19023. var index = -1,
  19024. length = array == null ? 0 : array.length,
  19025. resIndex = 0,
  19026. result = [];
  19027. while (++index < length) {
  19028. var value = array[index];
  19029. if (predicate(value, index, array)) {
  19030. result[resIndex++] = value;
  19031. }
  19032. }
  19033. return result;
  19034. }
  19035. /**
  19036. * A specialized version of `_.includes` for arrays without support for
  19037. * specifying an index to search from.
  19038. *
  19039. * @private
  19040. * @param {Array} [array] The array to inspect.
  19041. * @param {*} target The value to search for.
  19042. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19043. */
  19044. function arrayIncludes(array, value) {
  19045. var length = array == null ? 0 : array.length;
  19046. return !!length && baseIndexOf(array, value, 0) > -1;
  19047. }
  19048. /**
  19049. * This function is like `arrayIncludes` except that it accepts a comparator.
  19050. *
  19051. * @private
  19052. * @param {Array} [array] The array to inspect.
  19053. * @param {*} target The value to search for.
  19054. * @param {Function} comparator The comparator invoked per element.
  19055. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19056. */
  19057. function arrayIncludesWith(array, value, comparator) {
  19058. var index = -1,
  19059. length = array == null ? 0 : array.length;
  19060. while (++index < length) {
  19061. if (comparator(value, array[index])) {
  19062. return true;
  19063. }
  19064. }
  19065. return false;
  19066. }
  19067. /**
  19068. * A specialized version of `_.map` for arrays without support for iteratee
  19069. * shorthands.
  19070. *
  19071. * @private
  19072. * @param {Array} [array] The array to iterate over.
  19073. * @param {Function} iteratee The function invoked per iteration.
  19074. * @returns {Array} Returns the new mapped array.
  19075. */
  19076. function arrayMap(array, iteratee) {
  19077. var index = -1,
  19078. length = array == null ? 0 : array.length,
  19079. result = Array(length);
  19080. while (++index < length) {
  19081. result[index] = iteratee(array[index], index, array);
  19082. }
  19083. return result;
  19084. }
  19085. /**
  19086. * Appends the elements of `values` to `array`.
  19087. *
  19088. * @private
  19089. * @param {Array} array The array to modify.
  19090. * @param {Array} values The values to append.
  19091. * @returns {Array} Returns `array`.
  19092. */
  19093. function arrayPush(array, values) {
  19094. var index = -1,
  19095. length = values.length,
  19096. offset = array.length;
  19097. while (++index < length) {
  19098. array[offset + index] = values[index];
  19099. }
  19100. return array;
  19101. }
  19102. /**
  19103. * A specialized version of `_.reduce` for arrays without support for
  19104. * iteratee shorthands.
  19105. *
  19106. * @private
  19107. * @param {Array} [array] The array to iterate over.
  19108. * @param {Function} iteratee The function invoked per iteration.
  19109. * @param {*} [accumulator] The initial value.
  19110. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19111. * the initial value.
  19112. * @returns {*} Returns the accumulated value.
  19113. */
  19114. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19115. var index = -1,
  19116. length = array == null ? 0 : array.length;
  19117. if (initAccum && length) {
  19118. accumulator = array[++index];
  19119. }
  19120. while (++index < length) {
  19121. accumulator = iteratee(accumulator, array[index], index, array);
  19122. }
  19123. return accumulator;
  19124. }
  19125. /**
  19126. * A specialized version of `_.reduceRight` for arrays without support for
  19127. * iteratee shorthands.
  19128. *
  19129. * @private
  19130. * @param {Array} [array] The array to iterate over.
  19131. * @param {Function} iteratee The function invoked per iteration.
  19132. * @param {*} [accumulator] The initial value.
  19133. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19134. * the initial value.
  19135. * @returns {*} Returns the accumulated value.
  19136. */
  19137. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19138. var length = array == null ? 0 : array.length;
  19139. if (initAccum && length) {
  19140. accumulator = array[--length];
  19141. }
  19142. while (length--) {
  19143. accumulator = iteratee(accumulator, array[length], length, array);
  19144. }
  19145. return accumulator;
  19146. }
  19147. /**
  19148. * A specialized version of `_.some` for arrays without support for iteratee
  19149. * shorthands.
  19150. *
  19151. * @private
  19152. * @param {Array} [array] The array to iterate over.
  19153. * @param {Function} predicate The function invoked per iteration.
  19154. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19155. * else `false`.
  19156. */
  19157. function arraySome(array, predicate) {
  19158. var index = -1,
  19159. length = array == null ? 0 : array.length;
  19160. while (++index < length) {
  19161. if (predicate(array[index], index, array)) {
  19162. return true;
  19163. }
  19164. }
  19165. return false;
  19166. }
  19167. /**
  19168. * Gets the size of an ASCII `string`.
  19169. *
  19170. * @private
  19171. * @param {string} string The string inspect.
  19172. * @returns {number} Returns the string size.
  19173. */
  19174. var asciiSize = baseProperty('length');
  19175. /**
  19176. * Converts an ASCII `string` to an array.
  19177. *
  19178. * @private
  19179. * @param {string} string The string to convert.
  19180. * @returns {Array} Returns the converted array.
  19181. */
  19182. function asciiToArray(string) {
  19183. return string.split('');
  19184. }
  19185. /**
  19186. * Splits an ASCII `string` into an array of its words.
  19187. *
  19188. * @private
  19189. * @param {string} The string to inspect.
  19190. * @returns {Array} Returns the words of `string`.
  19191. */
  19192. function asciiWords(string) {
  19193. return string.match(reAsciiWord) || [];
  19194. }
  19195. /**
  19196. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19197. * without support for iteratee shorthands, which iterates over `collection`
  19198. * using `eachFunc`.
  19199. *
  19200. * @private
  19201. * @param {Array|Object} collection The collection to inspect.
  19202. * @param {Function} predicate The function invoked per iteration.
  19203. * @param {Function} eachFunc The function to iterate over `collection`.
  19204. * @returns {*} Returns the found element or its key, else `undefined`.
  19205. */
  19206. function baseFindKey(collection, predicate, eachFunc) {
  19207. var result;
  19208. eachFunc(collection, function(value, key, collection) {
  19209. if (predicate(value, key, collection)) {
  19210. result = key;
  19211. return false;
  19212. }
  19213. });
  19214. return result;
  19215. }
  19216. /**
  19217. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19218. * support for iteratee shorthands.
  19219. *
  19220. * @private
  19221. * @param {Array} array The array to inspect.
  19222. * @param {Function} predicate The function invoked per iteration.
  19223. * @param {number} fromIndex The index to search from.
  19224. * @param {boolean} [fromRight] Specify iterating from right to left.
  19225. * @returns {number} Returns the index of the matched value, else `-1`.
  19226. */
  19227. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19228. var length = array.length,
  19229. index = fromIndex + (fromRight ? 1 : -1);
  19230. while ((fromRight ? index-- : ++index < length)) {
  19231. if (predicate(array[index], index, array)) {
  19232. return index;
  19233. }
  19234. }
  19235. return -1;
  19236. }
  19237. /**
  19238. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19239. *
  19240. * @private
  19241. * @param {Array} array The array to inspect.
  19242. * @param {*} value The value to search for.
  19243. * @param {number} fromIndex The index to search from.
  19244. * @returns {number} Returns the index of the matched value, else `-1`.
  19245. */
  19246. function baseIndexOf(array, value, fromIndex) {
  19247. return value === value
  19248. ? strictIndexOf(array, value, fromIndex)
  19249. : baseFindIndex(array, baseIsNaN, fromIndex);
  19250. }
  19251. /**
  19252. * This function is like `baseIndexOf` except that it accepts a comparator.
  19253. *
  19254. * @private
  19255. * @param {Array} array The array to inspect.
  19256. * @param {*} value The value to search for.
  19257. * @param {number} fromIndex The index to search from.
  19258. * @param {Function} comparator The comparator invoked per element.
  19259. * @returns {number} Returns the index of the matched value, else `-1`.
  19260. */
  19261. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19262. var index = fromIndex - 1,
  19263. length = array.length;
  19264. while (++index < length) {
  19265. if (comparator(array[index], value)) {
  19266. return index;
  19267. }
  19268. }
  19269. return -1;
  19270. }
  19271. /**
  19272. * The base implementation of `_.isNaN` without support for number objects.
  19273. *
  19274. * @private
  19275. * @param {*} value The value to check.
  19276. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19277. */
  19278. function baseIsNaN(value) {
  19279. return value !== value;
  19280. }
  19281. /**
  19282. * The base implementation of `_.mean` and `_.meanBy` without support for
  19283. * iteratee shorthands.
  19284. *
  19285. * @private
  19286. * @param {Array} array The array to iterate over.
  19287. * @param {Function} iteratee The function invoked per iteration.
  19288. * @returns {number} Returns the mean.
  19289. */
  19290. function baseMean(array, iteratee) {
  19291. var length = array == null ? 0 : array.length;
  19292. return length ? (baseSum(array, iteratee) / length) : NAN;
  19293. }
  19294. /**
  19295. * The base implementation of `_.property` without support for deep paths.
  19296. *
  19297. * @private
  19298. * @param {string} key The key of the property to get.
  19299. * @returns {Function} Returns the new accessor function.
  19300. */
  19301. function baseProperty(key) {
  19302. return function(object) {
  19303. return object == null ? undefined : object[key];
  19304. };
  19305. }
  19306. /**
  19307. * The base implementation of `_.propertyOf` without support for deep paths.
  19308. *
  19309. * @private
  19310. * @param {Object} object The object to query.
  19311. * @returns {Function} Returns the new accessor function.
  19312. */
  19313. function basePropertyOf(object) {
  19314. return function(key) {
  19315. return object == null ? undefined : object[key];
  19316. };
  19317. }
  19318. /**
  19319. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19320. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19321. *
  19322. * @private
  19323. * @param {Array|Object} collection The collection to iterate over.
  19324. * @param {Function} iteratee The function invoked per iteration.
  19325. * @param {*} accumulator The initial value.
  19326. * @param {boolean} initAccum Specify using the first or last element of
  19327. * `collection` as the initial value.
  19328. * @param {Function} eachFunc The function to iterate over `collection`.
  19329. * @returns {*} Returns the accumulated value.
  19330. */
  19331. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19332. eachFunc(collection, function(value, index, collection) {
  19333. accumulator = initAccum
  19334. ? (initAccum = false, value)
  19335. : iteratee(accumulator, value, index, collection);
  19336. });
  19337. return accumulator;
  19338. }
  19339. /**
  19340. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19341. * sort order of `array` and replaces criteria objects with their corresponding
  19342. * values.
  19343. *
  19344. * @private
  19345. * @param {Array} array The array to sort.
  19346. * @param {Function} comparer The function to define sort order.
  19347. * @returns {Array} Returns `array`.
  19348. */
  19349. function baseSortBy(array, comparer) {
  19350. var length = array.length;
  19351. array.sort(comparer);
  19352. while (length--) {
  19353. array[length] = array[length].value;
  19354. }
  19355. return array;
  19356. }
  19357. /**
  19358. * The base implementation of `_.sum` and `_.sumBy` without support for
  19359. * iteratee shorthands.
  19360. *
  19361. * @private
  19362. * @param {Array} array The array to iterate over.
  19363. * @param {Function} iteratee The function invoked per iteration.
  19364. * @returns {number} Returns the sum.
  19365. */
  19366. function baseSum(array, iteratee) {
  19367. var result,
  19368. index = -1,
  19369. length = array.length;
  19370. while (++index < length) {
  19371. var current = iteratee(array[index]);
  19372. if (current !== undefined) {
  19373. result = result === undefined ? current : (result + current);
  19374. }
  19375. }
  19376. return result;
  19377. }
  19378. /**
  19379. * The base implementation of `_.times` without support for iteratee shorthands
  19380. * or max array length checks.
  19381. *
  19382. * @private
  19383. * @param {number} n The number of times to invoke `iteratee`.
  19384. * @param {Function} iteratee The function invoked per iteration.
  19385. * @returns {Array} Returns the array of results.
  19386. */
  19387. function baseTimes(n, iteratee) {
  19388. var index = -1,
  19389. result = Array(n);
  19390. while (++index < n) {
  19391. result[index] = iteratee(index);
  19392. }
  19393. return result;
  19394. }
  19395. /**
  19396. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19397. * of key-value pairs for `object` corresponding to the property names of `props`.
  19398. *
  19399. * @private
  19400. * @param {Object} object The object to query.
  19401. * @param {Array} props The property names to get values for.
  19402. * @returns {Object} Returns the key-value pairs.
  19403. */
  19404. function baseToPairs(object, props) {
  19405. return arrayMap(props, function(key) {
  19406. return [key, object[key]];
  19407. });
  19408. }
  19409. /**
  19410. * The base implementation of `_.unary` without support for storing metadata.
  19411. *
  19412. * @private
  19413. * @param {Function} func The function to cap arguments for.
  19414. * @returns {Function} Returns the new capped function.
  19415. */
  19416. function baseUnary(func) {
  19417. return function(value) {
  19418. return func(value);
  19419. };
  19420. }
  19421. /**
  19422. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19423. * array of `object` property values corresponding to the property names
  19424. * of `props`.
  19425. *
  19426. * @private
  19427. * @param {Object} object The object to query.
  19428. * @param {Array} props The property names to get values for.
  19429. * @returns {Object} Returns the array of property values.
  19430. */
  19431. function baseValues(object, props) {
  19432. return arrayMap(props, function(key) {
  19433. return object[key];
  19434. });
  19435. }
  19436. /**
  19437. * Checks if a `cache` value for `key` exists.
  19438. *
  19439. * @private
  19440. * @param {Object} cache The cache to query.
  19441. * @param {string} key The key of the entry to check.
  19442. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19443. */
  19444. function cacheHas(cache, key) {
  19445. return cache.has(key);
  19446. }
  19447. /**
  19448. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19449. * that is not found in the character symbols.
  19450. *
  19451. * @private
  19452. * @param {Array} strSymbols The string symbols to inspect.
  19453. * @param {Array} chrSymbols The character symbols to find.
  19454. * @returns {number} Returns the index of the first unmatched string symbol.
  19455. */
  19456. function charsStartIndex(strSymbols, chrSymbols) {
  19457. var index = -1,
  19458. length = strSymbols.length;
  19459. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19460. return index;
  19461. }
  19462. /**
  19463. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19464. * that is not found in the character symbols.
  19465. *
  19466. * @private
  19467. * @param {Array} strSymbols The string symbols to inspect.
  19468. * @param {Array} chrSymbols The character symbols to find.
  19469. * @returns {number} Returns the index of the last unmatched string symbol.
  19470. */
  19471. function charsEndIndex(strSymbols, chrSymbols) {
  19472. var index = strSymbols.length;
  19473. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19474. return index;
  19475. }
  19476. /**
  19477. * Gets the number of `placeholder` occurrences in `array`.
  19478. *
  19479. * @private
  19480. * @param {Array} array The array to inspect.
  19481. * @param {*} placeholder The placeholder to search for.
  19482. * @returns {number} Returns the placeholder count.
  19483. */
  19484. function countHolders(array, placeholder) {
  19485. var length = array.length,
  19486. result = 0;
  19487. while (length--) {
  19488. if (array[length] === placeholder) {
  19489. ++result;
  19490. }
  19491. }
  19492. return result;
  19493. }
  19494. /**
  19495. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19496. * letters to basic Latin letters.
  19497. *
  19498. * @private
  19499. * @param {string} letter The matched letter to deburr.
  19500. * @returns {string} Returns the deburred letter.
  19501. */
  19502. var deburrLetter = basePropertyOf(deburredLetters);
  19503. /**
  19504. * Used by `_.escape` to convert characters to HTML entities.
  19505. *
  19506. * @private
  19507. * @param {string} chr The matched character to escape.
  19508. * @returns {string} Returns the escaped character.
  19509. */
  19510. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19511. /**
  19512. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19513. *
  19514. * @private
  19515. * @param {string} chr The matched character to escape.
  19516. * @returns {string} Returns the escaped character.
  19517. */
  19518. function escapeStringChar(chr) {
  19519. return '\\' + stringEscapes[chr];
  19520. }
  19521. /**
  19522. * Gets the value at `key` of `object`.
  19523. *
  19524. * @private
  19525. * @param {Object} [object] The object to query.
  19526. * @param {string} key The key of the property to get.
  19527. * @returns {*} Returns the property value.
  19528. */
  19529. function getValue(object, key) {
  19530. return object == null ? undefined : object[key];
  19531. }
  19532. /**
  19533. * Checks if `string` contains Unicode symbols.
  19534. *
  19535. * @private
  19536. * @param {string} string The string to inspect.
  19537. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19538. */
  19539. function hasUnicode(string) {
  19540. return reHasUnicode.test(string);
  19541. }
  19542. /**
  19543. * Checks if `string` contains a word composed of Unicode symbols.
  19544. *
  19545. * @private
  19546. * @param {string} string The string to inspect.
  19547. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19548. */
  19549. function hasUnicodeWord(string) {
  19550. return reHasUnicodeWord.test(string);
  19551. }
  19552. /**
  19553. * Converts `iterator` to an array.
  19554. *
  19555. * @private
  19556. * @param {Object} iterator The iterator to convert.
  19557. * @returns {Array} Returns the converted array.
  19558. */
  19559. function iteratorToArray(iterator) {
  19560. var data,
  19561. result = [];
  19562. while (!(data = iterator.next()).done) {
  19563. result.push(data.value);
  19564. }
  19565. return result;
  19566. }
  19567. /**
  19568. * Converts `map` to its key-value pairs.
  19569. *
  19570. * @private
  19571. * @param {Object} map The map to convert.
  19572. * @returns {Array} Returns the key-value pairs.
  19573. */
  19574. function mapToArray(map) {
  19575. var index = -1,
  19576. result = Array(map.size);
  19577. map.forEach(function(value, key) {
  19578. result[++index] = [key, value];
  19579. });
  19580. return result;
  19581. }
  19582. /**
  19583. * Creates a unary function that invokes `func` with its argument transformed.
  19584. *
  19585. * @private
  19586. * @param {Function} func The function to wrap.
  19587. * @param {Function} transform The argument transform.
  19588. * @returns {Function} Returns the new function.
  19589. */
  19590. function overArg(func, transform) {
  19591. return function(arg) {
  19592. return func(transform(arg));
  19593. };
  19594. }
  19595. /**
  19596. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19597. * and returns an array of their indexes.
  19598. *
  19599. * @private
  19600. * @param {Array} array The array to modify.
  19601. * @param {*} placeholder The placeholder to replace.
  19602. * @returns {Array} Returns the new array of placeholder indexes.
  19603. */
  19604. function replaceHolders(array, placeholder) {
  19605. var index = -1,
  19606. length = array.length,
  19607. resIndex = 0,
  19608. result = [];
  19609. while (++index < length) {
  19610. var value = array[index];
  19611. if (value === placeholder || value === PLACEHOLDER) {
  19612. array[index] = PLACEHOLDER;
  19613. result[resIndex++] = index;
  19614. }
  19615. }
  19616. return result;
  19617. }
  19618. /**
  19619. * Converts `set` to an array of its values.
  19620. *
  19621. * @private
  19622. * @param {Object} set The set to convert.
  19623. * @returns {Array} Returns the values.
  19624. */
  19625. function setToArray(set) {
  19626. var index = -1,
  19627. result = Array(set.size);
  19628. set.forEach(function(value) {
  19629. result[++index] = value;
  19630. });
  19631. return result;
  19632. }
  19633. /**
  19634. * Converts `set` to its value-value pairs.
  19635. *
  19636. * @private
  19637. * @param {Object} set The set to convert.
  19638. * @returns {Array} Returns the value-value pairs.
  19639. */
  19640. function setToPairs(set) {
  19641. var index = -1,
  19642. result = Array(set.size);
  19643. set.forEach(function(value) {
  19644. result[++index] = [value, value];
  19645. });
  19646. return result;
  19647. }
  19648. /**
  19649. * A specialized version of `_.indexOf` which performs strict equality
  19650. * comparisons of values, i.e. `===`.
  19651. *
  19652. * @private
  19653. * @param {Array} array The array to inspect.
  19654. * @param {*} value The value to search for.
  19655. * @param {number} fromIndex The index to search from.
  19656. * @returns {number} Returns the index of the matched value, else `-1`.
  19657. */
  19658. function strictIndexOf(array, value, fromIndex) {
  19659. var index = fromIndex - 1,
  19660. length = array.length;
  19661. while (++index < length) {
  19662. if (array[index] === value) {
  19663. return index;
  19664. }
  19665. }
  19666. return -1;
  19667. }
  19668. /**
  19669. * A specialized version of `_.lastIndexOf` which performs strict equality
  19670. * comparisons of values, i.e. `===`.
  19671. *
  19672. * @private
  19673. * @param {Array} array The array to inspect.
  19674. * @param {*} value The value to search for.
  19675. * @param {number} fromIndex The index to search from.
  19676. * @returns {number} Returns the index of the matched value, else `-1`.
  19677. */
  19678. function strictLastIndexOf(array, value, fromIndex) {
  19679. var index = fromIndex + 1;
  19680. while (index--) {
  19681. if (array[index] === value) {
  19682. return index;
  19683. }
  19684. }
  19685. return index;
  19686. }
  19687. /**
  19688. * Gets the number of symbols in `string`.
  19689. *
  19690. * @private
  19691. * @param {string} string The string to inspect.
  19692. * @returns {number} Returns the string size.
  19693. */
  19694. function stringSize(string) {
  19695. return hasUnicode(string)
  19696. ? unicodeSize(string)
  19697. : asciiSize(string);
  19698. }
  19699. /**
  19700. * Converts `string` to an array.
  19701. *
  19702. * @private
  19703. * @param {string} string The string to convert.
  19704. * @returns {Array} Returns the converted array.
  19705. */
  19706. function stringToArray(string) {
  19707. return hasUnicode(string)
  19708. ? unicodeToArray(string)
  19709. : asciiToArray(string);
  19710. }
  19711. /**
  19712. * Used by `_.unescape` to convert HTML entities to characters.
  19713. *
  19714. * @private
  19715. * @param {string} chr The matched character to unescape.
  19716. * @returns {string} Returns the unescaped character.
  19717. */
  19718. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19719. /**
  19720. * Gets the size of a Unicode `string`.
  19721. *
  19722. * @private
  19723. * @param {string} string The string inspect.
  19724. * @returns {number} Returns the string size.
  19725. */
  19726. function unicodeSize(string) {
  19727. var result = reUnicode.lastIndex = 0;
  19728. while (reUnicode.test(string)) {
  19729. ++result;
  19730. }
  19731. return result;
  19732. }
  19733. /**
  19734. * Converts a Unicode `string` to an array.
  19735. *
  19736. * @private
  19737. * @param {string} string The string to convert.
  19738. * @returns {Array} Returns the converted array.
  19739. */
  19740. function unicodeToArray(string) {
  19741. return string.match(reUnicode) || [];
  19742. }
  19743. /**
  19744. * Splits a Unicode `string` into an array of its words.
  19745. *
  19746. * @private
  19747. * @param {string} The string to inspect.
  19748. * @returns {Array} Returns the words of `string`.
  19749. */
  19750. function unicodeWords(string) {
  19751. return string.match(reUnicodeWord) || [];
  19752. }
  19753. /*--------------------------------------------------------------------------*/
  19754. /**
  19755. * Create a new pristine `lodash` function using the `context` object.
  19756. *
  19757. * @static
  19758. * @memberOf _
  19759. * @since 1.1.0
  19760. * @category Util
  19761. * @param {Object} [context=root] The context object.
  19762. * @returns {Function} Returns a new `lodash` function.
  19763. * @example
  19764. *
  19765. * _.mixin({ 'foo': _.constant('foo') });
  19766. *
  19767. * var lodash = _.runInContext();
  19768. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19769. *
  19770. * _.isFunction(_.foo);
  19771. * // => true
  19772. * _.isFunction(_.bar);
  19773. * // => false
  19774. *
  19775. * lodash.isFunction(lodash.foo);
  19776. * // => false
  19777. * lodash.isFunction(lodash.bar);
  19778. * // => true
  19779. *
  19780. * // Create a suped-up `defer` in Node.js.
  19781. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19782. */
  19783. var runInContext = (function runInContext(context) {
  19784. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19785. /** Built-in constructor references. */
  19786. var Array = context.Array,
  19787. Date = context.Date,
  19788. Error = context.Error,
  19789. Function = context.Function,
  19790. Math = context.Math,
  19791. Object = context.Object,
  19792. RegExp = context.RegExp,
  19793. String = context.String,
  19794. TypeError = context.TypeError;
  19795. /** Used for built-in method references. */
  19796. var arrayProto = Array.prototype,
  19797. funcProto = Function.prototype,
  19798. objectProto = Object.prototype;
  19799. /** Used to detect overreaching core-js shims. */
  19800. var coreJsData = context['__core-js_shared__'];
  19801. /** Used to resolve the decompiled source of functions. */
  19802. var funcToString = funcProto.toString;
  19803. /** Used to check objects for own properties. */
  19804. var hasOwnProperty = objectProto.hasOwnProperty;
  19805. /** Used to generate unique IDs. */
  19806. var idCounter = 0;
  19807. /** Used to detect methods masquerading as native. */
  19808. var maskSrcKey = (function() {
  19809. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19810. return uid ? ('Symbol(src)_1.' + uid) : '';
  19811. }());
  19812. /**
  19813. * Used to resolve the
  19814. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19815. * of values.
  19816. */
  19817. var nativeObjectToString = objectProto.toString;
  19818. /** Used to infer the `Object` constructor. */
  19819. var objectCtorString = funcToString.call(Object);
  19820. /** Used to restore the original `_` reference in `_.noConflict`. */
  19821. var oldDash = root._;
  19822. /** Used to detect if a method is native. */
  19823. var reIsNative = RegExp('^' +
  19824. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19825. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19826. );
  19827. /** Built-in value references. */
  19828. var Buffer = moduleExports ? context.Buffer : undefined,
  19829. Symbol = context.Symbol,
  19830. Uint8Array = context.Uint8Array,
  19831. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19832. getPrototype = overArg(Object.getPrototypeOf, Object),
  19833. objectCreate = Object.create,
  19834. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19835. splice = arrayProto.splice,
  19836. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19837. symIterator = Symbol ? Symbol.iterator : undefined,
  19838. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19839. var defineProperty = (function() {
  19840. try {
  19841. var func = getNative(Object, 'defineProperty');
  19842. func({}, '', {});
  19843. return func;
  19844. } catch (e) {}
  19845. }());
  19846. /** Mocked built-ins. */
  19847. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19848. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19849. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19850. /* Built-in method references for those with the same name as other `lodash` methods. */
  19851. var nativeCeil = Math.ceil,
  19852. nativeFloor = Math.floor,
  19853. nativeGetSymbols = Object.getOwnPropertySymbols,
  19854. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19855. nativeIsFinite = context.isFinite,
  19856. nativeJoin = arrayProto.join,
  19857. nativeKeys = overArg(Object.keys, Object),
  19858. nativeMax = Math.max,
  19859. nativeMin = Math.min,
  19860. nativeNow = Date.now,
  19861. nativeParseInt = context.parseInt,
  19862. nativeRandom = Math.random,
  19863. nativeReverse = arrayProto.reverse;
  19864. /* Built-in method references that are verified to be native. */
  19865. var DataView = getNative(context, 'DataView'),
  19866. Map = getNative(context, 'Map'),
  19867. Promise = getNative(context, 'Promise'),
  19868. Set = getNative(context, 'Set'),
  19869. WeakMap = getNative(context, 'WeakMap'),
  19870. nativeCreate = getNative(Object, 'create');
  19871. /** Used to store function metadata. */
  19872. var metaMap = WeakMap && new WeakMap;
  19873. /** Used to lookup unminified function names. */
  19874. var realNames = {};
  19875. /** Used to detect maps, sets, and weakmaps. */
  19876. var dataViewCtorString = toSource(DataView),
  19877. mapCtorString = toSource(Map),
  19878. promiseCtorString = toSource(Promise),
  19879. setCtorString = toSource(Set),
  19880. weakMapCtorString = toSource(WeakMap);
  19881. /** Used to convert symbols to primitives and strings. */
  19882. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19883. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19884. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19885. /*------------------------------------------------------------------------*/
  19886. /**
  19887. * Creates a `lodash` object which wraps `value` to enable implicit method
  19888. * chain sequences. Methods that operate on and return arrays, collections,
  19889. * and functions can be chained together. Methods that retrieve a single value
  19890. * or may return a primitive value will automatically end the chain sequence
  19891. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19892. * with `_#value`.
  19893. *
  19894. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19895. * enabled using `_.chain`.
  19896. *
  19897. * The execution of chained methods is lazy, that is, it's deferred until
  19898. * `_#value` is implicitly or explicitly called.
  19899. *
  19900. * Lazy evaluation allows several methods to support shortcut fusion.
  19901. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19902. * the creation of intermediate arrays and can greatly reduce the number of
  19903. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19904. * fusion if the section is applied to an array and iteratees accept only
  19905. * one argument. The heuristic for whether a section qualifies for shortcut
  19906. * fusion is subject to change.
  19907. *
  19908. * Chaining is supported in custom builds as long as the `_#value` method is
  19909. * directly or indirectly included in the build.
  19910. *
  19911. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19912. *
  19913. * The wrapper `Array` methods are:
  19914. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19915. *
  19916. * The wrapper `String` methods are:
  19917. * `replace` and `split`
  19918. *
  19919. * The wrapper methods that support shortcut fusion are:
  19920. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19921. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19922. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19923. *
  19924. * The chainable wrapper methods are:
  19925. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19926. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19927. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19928. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19929. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19930. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19931. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19932. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19933. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19934. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19935. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19936. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19937. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19938. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19939. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19940. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19941. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19942. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19943. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19944. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19945. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19946. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19947. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19948. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19949. *
  19950. * The wrapper methods that are **not** chainable by default are:
  19951. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19952. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19953. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19954. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19955. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19956. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19957. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19958. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19959. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19960. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19961. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19962. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19963. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19964. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19965. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19966. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19967. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19968. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19969. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19970. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19971. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19972. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19973. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19974. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19975. * `upperFirst`, `value`, and `words`
  19976. *
  19977. * @name _
  19978. * @constructor
  19979. * @category Seq
  19980. * @param {*} value The value to wrap in a `lodash` instance.
  19981. * @returns {Object} Returns the new `lodash` wrapper instance.
  19982. * @example
  19983. *
  19984. * function square(n) {
  19985. * return n * n;
  19986. * }
  19987. *
  19988. * var wrapped = _([1, 2, 3]);
  19989. *
  19990. * // Returns an unwrapped value.
  19991. * wrapped.reduce(_.add);
  19992. * // => 6
  19993. *
  19994. * // Returns a wrapped value.
  19995. * var squares = wrapped.map(square);
  19996. *
  19997. * _.isArray(squares);
  19998. * // => false
  19999. *
  20000. * _.isArray(squares.value());
  20001. * // => true
  20002. */
  20003. function lodash(value) {
  20004. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20005. if (value instanceof LodashWrapper) {
  20006. return value;
  20007. }
  20008. if (hasOwnProperty.call(value, '__wrapped__')) {
  20009. return wrapperClone(value);
  20010. }
  20011. }
  20012. return new LodashWrapper(value);
  20013. }
  20014. /**
  20015. * The base implementation of `_.create` without support for assigning
  20016. * properties to the created object.
  20017. *
  20018. * @private
  20019. * @param {Object} proto The object to inherit from.
  20020. * @returns {Object} Returns the new object.
  20021. */
  20022. var baseCreate = (function() {
  20023. function object() {}
  20024. return function(proto) {
  20025. if (!isObject(proto)) {
  20026. return {};
  20027. }
  20028. if (objectCreate) {
  20029. return objectCreate(proto);
  20030. }
  20031. object.prototype = proto;
  20032. var result = new object;
  20033. object.prototype = undefined;
  20034. return result;
  20035. };
  20036. }());
  20037. /**
  20038. * The function whose prototype chain sequence wrappers inherit from.
  20039. *
  20040. * @private
  20041. */
  20042. function baseLodash() {
  20043. // No operation performed.
  20044. }
  20045. /**
  20046. * The base constructor for creating `lodash` wrapper objects.
  20047. *
  20048. * @private
  20049. * @param {*} value The value to wrap.
  20050. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20051. */
  20052. function LodashWrapper(value, chainAll) {
  20053. this.__wrapped__ = value;
  20054. this.__actions__ = [];
  20055. this.__chain__ = !!chainAll;
  20056. this.__index__ = 0;
  20057. this.__values__ = undefined;
  20058. }
  20059. /**
  20060. * By default, the template delimiters used by lodash are like those in
  20061. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20062. * following template settings to use alternative delimiters.
  20063. *
  20064. * @static
  20065. * @memberOf _
  20066. * @type {Object}
  20067. */
  20068. lodash.templateSettings = {
  20069. /**
  20070. * Used to detect `data` property values to be HTML-escaped.
  20071. *
  20072. * @memberOf _.templateSettings
  20073. * @type {RegExp}
  20074. */
  20075. 'escape': reEscape,
  20076. /**
  20077. * Used to detect code to be evaluated.
  20078. *
  20079. * @memberOf _.templateSettings
  20080. * @type {RegExp}
  20081. */
  20082. 'evaluate': reEvaluate,
  20083. /**
  20084. * Used to detect `data` property values to inject.
  20085. *
  20086. * @memberOf _.templateSettings
  20087. * @type {RegExp}
  20088. */
  20089. 'interpolate': reInterpolate,
  20090. /**
  20091. * Used to reference the data object in the template text.
  20092. *
  20093. * @memberOf _.templateSettings
  20094. * @type {string}
  20095. */
  20096. 'variable': '',
  20097. /**
  20098. * Used to import variables into the compiled template.
  20099. *
  20100. * @memberOf _.templateSettings
  20101. * @type {Object}
  20102. */
  20103. 'imports': {
  20104. /**
  20105. * A reference to the `lodash` function.
  20106. *
  20107. * @memberOf _.templateSettings.imports
  20108. * @type {Function}
  20109. */
  20110. '_': lodash
  20111. }
  20112. };
  20113. // Ensure wrappers are instances of `baseLodash`.
  20114. lodash.prototype = baseLodash.prototype;
  20115. lodash.prototype.constructor = lodash;
  20116. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20117. LodashWrapper.prototype.constructor = LodashWrapper;
  20118. /*------------------------------------------------------------------------*/
  20119. /**
  20120. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20121. *
  20122. * @private
  20123. * @constructor
  20124. * @param {*} value The value to wrap.
  20125. */
  20126. function LazyWrapper(value) {
  20127. this.__wrapped__ = value;
  20128. this.__actions__ = [];
  20129. this.__dir__ = 1;
  20130. this.__filtered__ = false;
  20131. this.__iteratees__ = [];
  20132. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20133. this.__views__ = [];
  20134. }
  20135. /**
  20136. * Creates a clone of the lazy wrapper object.
  20137. *
  20138. * @private
  20139. * @name clone
  20140. * @memberOf LazyWrapper
  20141. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20142. */
  20143. function lazyClone() {
  20144. var result = new LazyWrapper(this.__wrapped__);
  20145. result.__actions__ = copyArray(this.__actions__);
  20146. result.__dir__ = this.__dir__;
  20147. result.__filtered__ = this.__filtered__;
  20148. result.__iteratees__ = copyArray(this.__iteratees__);
  20149. result.__takeCount__ = this.__takeCount__;
  20150. result.__views__ = copyArray(this.__views__);
  20151. return result;
  20152. }
  20153. /**
  20154. * Reverses the direction of lazy iteration.
  20155. *
  20156. * @private
  20157. * @name reverse
  20158. * @memberOf LazyWrapper
  20159. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20160. */
  20161. function lazyReverse() {
  20162. if (this.__filtered__) {
  20163. var result = new LazyWrapper(this);
  20164. result.__dir__ = -1;
  20165. result.__filtered__ = true;
  20166. } else {
  20167. result = this.clone();
  20168. result.__dir__ *= -1;
  20169. }
  20170. return result;
  20171. }
  20172. /**
  20173. * Extracts the unwrapped value from its lazy wrapper.
  20174. *
  20175. * @private
  20176. * @name value
  20177. * @memberOf LazyWrapper
  20178. * @returns {*} Returns the unwrapped value.
  20179. */
  20180. function lazyValue() {
  20181. var array = this.__wrapped__.value(),
  20182. dir = this.__dir__,
  20183. isArr = isArray(array),
  20184. isRight = dir < 0,
  20185. arrLength = isArr ? array.length : 0,
  20186. view = getView(0, arrLength, this.__views__),
  20187. start = view.start,
  20188. end = view.end,
  20189. length = end - start,
  20190. index = isRight ? end : (start - 1),
  20191. iteratees = this.__iteratees__,
  20192. iterLength = iteratees.length,
  20193. resIndex = 0,
  20194. takeCount = nativeMin(length, this.__takeCount__);
  20195. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20196. return baseWrapperValue(array, this.__actions__);
  20197. }
  20198. var result = [];
  20199. outer:
  20200. while (length-- && resIndex < takeCount) {
  20201. index += dir;
  20202. var iterIndex = -1,
  20203. value = array[index];
  20204. while (++iterIndex < iterLength) {
  20205. var data = iteratees[iterIndex],
  20206. iteratee = data.iteratee,
  20207. type = data.type,
  20208. computed = iteratee(value);
  20209. if (type == LAZY_MAP_FLAG) {
  20210. value = computed;
  20211. } else if (!computed) {
  20212. if (type == LAZY_FILTER_FLAG) {
  20213. continue outer;
  20214. } else {
  20215. break outer;
  20216. }
  20217. }
  20218. }
  20219. result[resIndex++] = value;
  20220. }
  20221. return result;
  20222. }
  20223. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20224. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20225. LazyWrapper.prototype.constructor = LazyWrapper;
  20226. /*------------------------------------------------------------------------*/
  20227. /**
  20228. * Creates a hash object.
  20229. *
  20230. * @private
  20231. * @constructor
  20232. * @param {Array} [entries] The key-value pairs to cache.
  20233. */
  20234. function Hash(entries) {
  20235. var index = -1,
  20236. length = entries == null ? 0 : entries.length;
  20237. this.clear();
  20238. while (++index < length) {
  20239. var entry = entries[index];
  20240. this.set(entry[0], entry[1]);
  20241. }
  20242. }
  20243. /**
  20244. * Removes all key-value entries from the hash.
  20245. *
  20246. * @private
  20247. * @name clear
  20248. * @memberOf Hash
  20249. */
  20250. function hashClear() {
  20251. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20252. this.size = 0;
  20253. }
  20254. /**
  20255. * Removes `key` and its value from the hash.
  20256. *
  20257. * @private
  20258. * @name delete
  20259. * @memberOf Hash
  20260. * @param {Object} hash The hash to modify.
  20261. * @param {string} key The key of the value to remove.
  20262. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20263. */
  20264. function hashDelete(key) {
  20265. var result = this.has(key) && delete this.__data__[key];
  20266. this.size -= result ? 1 : 0;
  20267. return result;
  20268. }
  20269. /**
  20270. * Gets the hash value for `key`.
  20271. *
  20272. * @private
  20273. * @name get
  20274. * @memberOf Hash
  20275. * @param {string} key The key of the value to get.
  20276. * @returns {*} Returns the entry value.
  20277. */
  20278. function hashGet(key) {
  20279. var data = this.__data__;
  20280. if (nativeCreate) {
  20281. var result = data[key];
  20282. return result === HASH_UNDEFINED ? undefined : result;
  20283. }
  20284. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20285. }
  20286. /**
  20287. * Checks if a hash value for `key` exists.
  20288. *
  20289. * @private
  20290. * @name has
  20291. * @memberOf Hash
  20292. * @param {string} key The key of the entry to check.
  20293. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20294. */
  20295. function hashHas(key) {
  20296. var data = this.__data__;
  20297. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20298. }
  20299. /**
  20300. * Sets the hash `key` to `value`.
  20301. *
  20302. * @private
  20303. * @name set
  20304. * @memberOf Hash
  20305. * @param {string} key The key of the value to set.
  20306. * @param {*} value The value to set.
  20307. * @returns {Object} Returns the hash instance.
  20308. */
  20309. function hashSet(key, value) {
  20310. var data = this.__data__;
  20311. this.size += this.has(key) ? 0 : 1;
  20312. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20313. return this;
  20314. }
  20315. // Add methods to `Hash`.
  20316. Hash.prototype.clear = hashClear;
  20317. Hash.prototype['delete'] = hashDelete;
  20318. Hash.prototype.get = hashGet;
  20319. Hash.prototype.has = hashHas;
  20320. Hash.prototype.set = hashSet;
  20321. /*------------------------------------------------------------------------*/
  20322. /**
  20323. * Creates an list cache object.
  20324. *
  20325. * @private
  20326. * @constructor
  20327. * @param {Array} [entries] The key-value pairs to cache.
  20328. */
  20329. function ListCache(entries) {
  20330. var index = -1,
  20331. length = entries == null ? 0 : entries.length;
  20332. this.clear();
  20333. while (++index < length) {
  20334. var entry = entries[index];
  20335. this.set(entry[0], entry[1]);
  20336. }
  20337. }
  20338. /**
  20339. * Removes all key-value entries from the list cache.
  20340. *
  20341. * @private
  20342. * @name clear
  20343. * @memberOf ListCache
  20344. */
  20345. function listCacheClear() {
  20346. this.__data__ = [];
  20347. this.size = 0;
  20348. }
  20349. /**
  20350. * Removes `key` and its value from the list cache.
  20351. *
  20352. * @private
  20353. * @name delete
  20354. * @memberOf ListCache
  20355. * @param {string} key The key of the value to remove.
  20356. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20357. */
  20358. function listCacheDelete(key) {
  20359. var data = this.__data__,
  20360. index = assocIndexOf(data, key);
  20361. if (index < 0) {
  20362. return false;
  20363. }
  20364. var lastIndex = data.length - 1;
  20365. if (index == lastIndex) {
  20366. data.pop();
  20367. } else {
  20368. splice.call(data, index, 1);
  20369. }
  20370. --this.size;
  20371. return true;
  20372. }
  20373. /**
  20374. * Gets the list cache value for `key`.
  20375. *
  20376. * @private
  20377. * @name get
  20378. * @memberOf ListCache
  20379. * @param {string} key The key of the value to get.
  20380. * @returns {*} Returns the entry value.
  20381. */
  20382. function listCacheGet(key) {
  20383. var data = this.__data__,
  20384. index = assocIndexOf(data, key);
  20385. return index < 0 ? undefined : data[index][1];
  20386. }
  20387. /**
  20388. * Checks if a list cache value for `key` exists.
  20389. *
  20390. * @private
  20391. * @name has
  20392. * @memberOf ListCache
  20393. * @param {string} key The key of the entry to check.
  20394. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20395. */
  20396. function listCacheHas(key) {
  20397. return assocIndexOf(this.__data__, key) > -1;
  20398. }
  20399. /**
  20400. * Sets the list cache `key` to `value`.
  20401. *
  20402. * @private
  20403. * @name set
  20404. * @memberOf ListCache
  20405. * @param {string} key The key of the value to set.
  20406. * @param {*} value The value to set.
  20407. * @returns {Object} Returns the list cache instance.
  20408. */
  20409. function listCacheSet(key, value) {
  20410. var data = this.__data__,
  20411. index = assocIndexOf(data, key);
  20412. if (index < 0) {
  20413. ++this.size;
  20414. data.push([key, value]);
  20415. } else {
  20416. data[index][1] = value;
  20417. }
  20418. return this;
  20419. }
  20420. // Add methods to `ListCache`.
  20421. ListCache.prototype.clear = listCacheClear;
  20422. ListCache.prototype['delete'] = listCacheDelete;
  20423. ListCache.prototype.get = listCacheGet;
  20424. ListCache.prototype.has = listCacheHas;
  20425. ListCache.prototype.set = listCacheSet;
  20426. /*------------------------------------------------------------------------*/
  20427. /**
  20428. * Creates a map cache object to store key-value pairs.
  20429. *
  20430. * @private
  20431. * @constructor
  20432. * @param {Array} [entries] The key-value pairs to cache.
  20433. */
  20434. function MapCache(entries) {
  20435. var index = -1,
  20436. length = entries == null ? 0 : entries.length;
  20437. this.clear();
  20438. while (++index < length) {
  20439. var entry = entries[index];
  20440. this.set(entry[0], entry[1]);
  20441. }
  20442. }
  20443. /**
  20444. * Removes all key-value entries from the map.
  20445. *
  20446. * @private
  20447. * @name clear
  20448. * @memberOf MapCache
  20449. */
  20450. function mapCacheClear() {
  20451. this.size = 0;
  20452. this.__data__ = {
  20453. 'hash': new Hash,
  20454. 'map': new (Map || ListCache),
  20455. 'string': new Hash
  20456. };
  20457. }
  20458. /**
  20459. * Removes `key` and its value from the map.
  20460. *
  20461. * @private
  20462. * @name delete
  20463. * @memberOf MapCache
  20464. * @param {string} key The key of the value to remove.
  20465. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20466. */
  20467. function mapCacheDelete(key) {
  20468. var result = getMapData(this, key)['delete'](key);
  20469. this.size -= result ? 1 : 0;
  20470. return result;
  20471. }
  20472. /**
  20473. * Gets the map value for `key`.
  20474. *
  20475. * @private
  20476. * @name get
  20477. * @memberOf MapCache
  20478. * @param {string} key The key of the value to get.
  20479. * @returns {*} Returns the entry value.
  20480. */
  20481. function mapCacheGet(key) {
  20482. return getMapData(this, key).get(key);
  20483. }
  20484. /**
  20485. * Checks if a map value for `key` exists.
  20486. *
  20487. * @private
  20488. * @name has
  20489. * @memberOf MapCache
  20490. * @param {string} key The key of the entry to check.
  20491. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20492. */
  20493. function mapCacheHas(key) {
  20494. return getMapData(this, key).has(key);
  20495. }
  20496. /**
  20497. * Sets the map `key` to `value`.
  20498. *
  20499. * @private
  20500. * @name set
  20501. * @memberOf MapCache
  20502. * @param {string} key The key of the value to set.
  20503. * @param {*} value The value to set.
  20504. * @returns {Object} Returns the map cache instance.
  20505. */
  20506. function mapCacheSet(key, value) {
  20507. var data = getMapData(this, key),
  20508. size = data.size;
  20509. data.set(key, value);
  20510. this.size += data.size == size ? 0 : 1;
  20511. return this;
  20512. }
  20513. // Add methods to `MapCache`.
  20514. MapCache.prototype.clear = mapCacheClear;
  20515. MapCache.prototype['delete'] = mapCacheDelete;
  20516. MapCache.prototype.get = mapCacheGet;
  20517. MapCache.prototype.has = mapCacheHas;
  20518. MapCache.prototype.set = mapCacheSet;
  20519. /*------------------------------------------------------------------------*/
  20520. /**
  20521. *
  20522. * Creates an array cache object to store unique values.
  20523. *
  20524. * @private
  20525. * @constructor
  20526. * @param {Array} [values] The values to cache.
  20527. */
  20528. function SetCache(values) {
  20529. var index = -1,
  20530. length = values == null ? 0 : values.length;
  20531. this.__data__ = new MapCache;
  20532. while (++index < length) {
  20533. this.add(values[index]);
  20534. }
  20535. }
  20536. /**
  20537. * Adds `value` to the array cache.
  20538. *
  20539. * @private
  20540. * @name add
  20541. * @memberOf SetCache
  20542. * @alias push
  20543. * @param {*} value The value to cache.
  20544. * @returns {Object} Returns the cache instance.
  20545. */
  20546. function setCacheAdd(value) {
  20547. this.__data__.set(value, HASH_UNDEFINED);
  20548. return this;
  20549. }
  20550. /**
  20551. * Checks if `value` is in the array cache.
  20552. *
  20553. * @private
  20554. * @name has
  20555. * @memberOf SetCache
  20556. * @param {*} value The value to search for.
  20557. * @returns {number} Returns `true` if `value` is found, else `false`.
  20558. */
  20559. function setCacheHas(value) {
  20560. return this.__data__.has(value);
  20561. }
  20562. // Add methods to `SetCache`.
  20563. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20564. SetCache.prototype.has = setCacheHas;
  20565. /*------------------------------------------------------------------------*/
  20566. /**
  20567. * Creates a stack cache object to store key-value pairs.
  20568. *
  20569. * @private
  20570. * @constructor
  20571. * @param {Array} [entries] The key-value pairs to cache.
  20572. */
  20573. function Stack(entries) {
  20574. var data = this.__data__ = new ListCache(entries);
  20575. this.size = data.size;
  20576. }
  20577. /**
  20578. * Removes all key-value entries from the stack.
  20579. *
  20580. * @private
  20581. * @name clear
  20582. * @memberOf Stack
  20583. */
  20584. function stackClear() {
  20585. this.__data__ = new ListCache;
  20586. this.size = 0;
  20587. }
  20588. /**
  20589. * Removes `key` and its value from the stack.
  20590. *
  20591. * @private
  20592. * @name delete
  20593. * @memberOf Stack
  20594. * @param {string} key The key of the value to remove.
  20595. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20596. */
  20597. function stackDelete(key) {
  20598. var data = this.__data__,
  20599. result = data['delete'](key);
  20600. this.size = data.size;
  20601. return result;
  20602. }
  20603. /**
  20604. * Gets the stack value for `key`.
  20605. *
  20606. * @private
  20607. * @name get
  20608. * @memberOf Stack
  20609. * @param {string} key The key of the value to get.
  20610. * @returns {*} Returns the entry value.
  20611. */
  20612. function stackGet(key) {
  20613. return this.__data__.get(key);
  20614. }
  20615. /**
  20616. * Checks if a stack value for `key` exists.
  20617. *
  20618. * @private
  20619. * @name has
  20620. * @memberOf Stack
  20621. * @param {string} key The key of the entry to check.
  20622. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20623. */
  20624. function stackHas(key) {
  20625. return this.__data__.has(key);
  20626. }
  20627. /**
  20628. * Sets the stack `key` to `value`.
  20629. *
  20630. * @private
  20631. * @name set
  20632. * @memberOf Stack
  20633. * @param {string} key The key of the value to set.
  20634. * @param {*} value The value to set.
  20635. * @returns {Object} Returns the stack cache instance.
  20636. */
  20637. function stackSet(key, value) {
  20638. var data = this.__data__;
  20639. if (data instanceof ListCache) {
  20640. var pairs = data.__data__;
  20641. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20642. pairs.push([key, value]);
  20643. this.size = ++data.size;
  20644. return this;
  20645. }
  20646. data = this.__data__ = new MapCache(pairs);
  20647. }
  20648. data.set(key, value);
  20649. this.size = data.size;
  20650. return this;
  20651. }
  20652. // Add methods to `Stack`.
  20653. Stack.prototype.clear = stackClear;
  20654. Stack.prototype['delete'] = stackDelete;
  20655. Stack.prototype.get = stackGet;
  20656. Stack.prototype.has = stackHas;
  20657. Stack.prototype.set = stackSet;
  20658. /*------------------------------------------------------------------------*/
  20659. /**
  20660. * Creates an array of the enumerable property names of the array-like `value`.
  20661. *
  20662. * @private
  20663. * @param {*} value The value to query.
  20664. * @param {boolean} inherited Specify returning inherited property names.
  20665. * @returns {Array} Returns the array of property names.
  20666. */
  20667. function arrayLikeKeys(value, inherited) {
  20668. var isArr = isArray(value),
  20669. isArg = !isArr && isArguments(value),
  20670. isBuff = !isArr && !isArg && isBuffer(value),
  20671. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20672. skipIndexes = isArr || isArg || isBuff || isType,
  20673. result = skipIndexes ? baseTimes(value.length, String) : [],
  20674. length = result.length;
  20675. for (var key in value) {
  20676. if ((inherited || hasOwnProperty.call(value, key)) &&
  20677. !(skipIndexes && (
  20678. // Safari 9 has enumerable `arguments.length` in strict mode.
  20679. key == 'length' ||
  20680. // Node.js 0.10 has enumerable non-index properties on buffers.
  20681. (isBuff && (key == 'offset' || key == 'parent')) ||
  20682. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20683. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20684. // Skip index properties.
  20685. isIndex(key, length)
  20686. ))) {
  20687. result.push(key);
  20688. }
  20689. }
  20690. return result;
  20691. }
  20692. /**
  20693. * A specialized version of `_.sample` for arrays.
  20694. *
  20695. * @private
  20696. * @param {Array} array The array to sample.
  20697. * @returns {*} Returns the random element.
  20698. */
  20699. function arraySample(array) {
  20700. var length = array.length;
  20701. return length ? array[baseRandom(0, length - 1)] : undefined;
  20702. }
  20703. /**
  20704. * A specialized version of `_.sampleSize` for arrays.
  20705. *
  20706. * @private
  20707. * @param {Array} array The array to sample.
  20708. * @param {number} n The number of elements to sample.
  20709. * @returns {Array} Returns the random elements.
  20710. */
  20711. function arraySampleSize(array, n) {
  20712. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20713. }
  20714. /**
  20715. * A specialized version of `_.shuffle` for arrays.
  20716. *
  20717. * @private
  20718. * @param {Array} array The array to shuffle.
  20719. * @returns {Array} Returns the new shuffled array.
  20720. */
  20721. function arrayShuffle(array) {
  20722. return shuffleSelf(copyArray(array));
  20723. }
  20724. /**
  20725. * This function is like `assignValue` except that it doesn't assign
  20726. * `undefined` values.
  20727. *
  20728. * @private
  20729. * @param {Object} object The object to modify.
  20730. * @param {string} key The key of the property to assign.
  20731. * @param {*} value The value to assign.
  20732. */
  20733. function assignMergeValue(object, key, value) {
  20734. if ((value !== undefined && !eq(object[key], value)) ||
  20735. (value === undefined && !(key in object))) {
  20736. baseAssignValue(object, key, value);
  20737. }
  20738. }
  20739. /**
  20740. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20741. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20742. * for equality comparisons.
  20743. *
  20744. * @private
  20745. * @param {Object} object The object to modify.
  20746. * @param {string} key The key of the property to assign.
  20747. * @param {*} value The value to assign.
  20748. */
  20749. function assignValue(object, key, value) {
  20750. var objValue = object[key];
  20751. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20752. (value === undefined && !(key in object))) {
  20753. baseAssignValue(object, key, value);
  20754. }
  20755. }
  20756. /**
  20757. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20758. *
  20759. * @private
  20760. * @param {Array} array The array to inspect.
  20761. * @param {*} key The key to search for.
  20762. * @returns {number} Returns the index of the matched value, else `-1`.
  20763. */
  20764. function assocIndexOf(array, key) {
  20765. var length = array.length;
  20766. while (length--) {
  20767. if (eq(array[length][0], key)) {
  20768. return length;
  20769. }
  20770. }
  20771. return -1;
  20772. }
  20773. /**
  20774. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20775. * by `iteratee` and values set by `setter`.
  20776. *
  20777. * @private
  20778. * @param {Array|Object} collection The collection to iterate over.
  20779. * @param {Function} setter The function to set `accumulator` values.
  20780. * @param {Function} iteratee The iteratee to transform keys.
  20781. * @param {Object} accumulator The initial aggregated object.
  20782. * @returns {Function} Returns `accumulator`.
  20783. */
  20784. function baseAggregator(collection, setter, iteratee, accumulator) {
  20785. baseEach(collection, function(value, key, collection) {
  20786. setter(accumulator, value, iteratee(value), collection);
  20787. });
  20788. return accumulator;
  20789. }
  20790. /**
  20791. * The base implementation of `_.assign` without support for multiple sources
  20792. * or `customizer` functions.
  20793. *
  20794. * @private
  20795. * @param {Object} object The destination object.
  20796. * @param {Object} source The source object.
  20797. * @returns {Object} Returns `object`.
  20798. */
  20799. function baseAssign(object, source) {
  20800. return object && copyObject(source, keys(source), object);
  20801. }
  20802. /**
  20803. * The base implementation of `_.assignIn` without support for multiple sources
  20804. * or `customizer` functions.
  20805. *
  20806. * @private
  20807. * @param {Object} object The destination object.
  20808. * @param {Object} source The source object.
  20809. * @returns {Object} Returns `object`.
  20810. */
  20811. function baseAssignIn(object, source) {
  20812. return object && copyObject(source, keysIn(source), object);
  20813. }
  20814. /**
  20815. * The base implementation of `assignValue` and `assignMergeValue` without
  20816. * value checks.
  20817. *
  20818. * @private
  20819. * @param {Object} object The object to modify.
  20820. * @param {string} key The key of the property to assign.
  20821. * @param {*} value The value to assign.
  20822. */
  20823. function baseAssignValue(object, key, value) {
  20824. if (key == '__proto__' && defineProperty) {
  20825. defineProperty(object, key, {
  20826. 'configurable': true,
  20827. 'enumerable': true,
  20828. 'value': value,
  20829. 'writable': true
  20830. });
  20831. } else {
  20832. object[key] = value;
  20833. }
  20834. }
  20835. /**
  20836. * The base implementation of `_.at` without support for individual paths.
  20837. *
  20838. * @private
  20839. * @param {Object} object The object to iterate over.
  20840. * @param {string[]} paths The property paths to pick.
  20841. * @returns {Array} Returns the picked elements.
  20842. */
  20843. function baseAt(object, paths) {
  20844. var index = -1,
  20845. length = paths.length,
  20846. result = Array(length),
  20847. skip = object == null;
  20848. while (++index < length) {
  20849. result[index] = skip ? undefined : get(object, paths[index]);
  20850. }
  20851. return result;
  20852. }
  20853. /**
  20854. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20855. *
  20856. * @private
  20857. * @param {number} number The number to clamp.
  20858. * @param {number} [lower] The lower bound.
  20859. * @param {number} upper The upper bound.
  20860. * @returns {number} Returns the clamped number.
  20861. */
  20862. function baseClamp(number, lower, upper) {
  20863. if (number === number) {
  20864. if (upper !== undefined) {
  20865. number = number <= upper ? number : upper;
  20866. }
  20867. if (lower !== undefined) {
  20868. number = number >= lower ? number : lower;
  20869. }
  20870. }
  20871. return number;
  20872. }
  20873. /**
  20874. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20875. * traversed objects.
  20876. *
  20877. * @private
  20878. * @param {*} value The value to clone.
  20879. * @param {boolean} bitmask The bitmask flags.
  20880. * 1 - Deep clone
  20881. * 2 - Flatten inherited properties
  20882. * 4 - Clone symbols
  20883. * @param {Function} [customizer] The function to customize cloning.
  20884. * @param {string} [key] The key of `value`.
  20885. * @param {Object} [object] The parent object of `value`.
  20886. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20887. * @returns {*} Returns the cloned value.
  20888. */
  20889. function baseClone(value, bitmask, customizer, key, object, stack) {
  20890. var result,
  20891. isDeep = bitmask & CLONE_DEEP_FLAG,
  20892. isFlat = bitmask & CLONE_FLAT_FLAG,
  20893. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20894. if (customizer) {
  20895. result = object ? customizer(value, key, object, stack) : customizer(value);
  20896. }
  20897. if (result !== undefined) {
  20898. return result;
  20899. }
  20900. if (!isObject(value)) {
  20901. return value;
  20902. }
  20903. var isArr = isArray(value);
  20904. if (isArr) {
  20905. result = initCloneArray(value);
  20906. if (!isDeep) {
  20907. return copyArray(value, result);
  20908. }
  20909. } else {
  20910. var tag = getTag(value),
  20911. isFunc = tag == funcTag || tag == genTag;
  20912. if (isBuffer(value)) {
  20913. return cloneBuffer(value, isDeep);
  20914. }
  20915. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20916. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20917. if (!isDeep) {
  20918. return isFlat
  20919. ? copySymbolsIn(value, baseAssignIn(result, value))
  20920. : copySymbols(value, baseAssign(result, value));
  20921. }
  20922. } else {
  20923. if (!cloneableTags[tag]) {
  20924. return object ? value : {};
  20925. }
  20926. result = initCloneByTag(value, tag, isDeep);
  20927. }
  20928. }
  20929. // Check for circular references and return its corresponding clone.
  20930. stack || (stack = new Stack);
  20931. var stacked = stack.get(value);
  20932. if (stacked) {
  20933. return stacked;
  20934. }
  20935. stack.set(value, result);
  20936. if (isSet(value)) {
  20937. value.forEach(function(subValue) {
  20938. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20939. });
  20940. } else if (isMap(value)) {
  20941. value.forEach(function(subValue, key) {
  20942. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20943. });
  20944. }
  20945. var keysFunc = isFull
  20946. ? (isFlat ? getAllKeysIn : getAllKeys)
  20947. : (isFlat ? keysIn : keys);
  20948. var props = isArr ? undefined : keysFunc(value);
  20949. arrayEach(props || value, function(subValue, key) {
  20950. if (props) {
  20951. key = subValue;
  20952. subValue = value[key];
  20953. }
  20954. // Recursively populate clone (susceptible to call stack limits).
  20955. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20956. });
  20957. return result;
  20958. }
  20959. /**
  20960. * The base implementation of `_.conforms` which doesn't clone `source`.
  20961. *
  20962. * @private
  20963. * @param {Object} source The object of property predicates to conform to.
  20964. * @returns {Function} Returns the new spec function.
  20965. */
  20966. function baseConforms(source) {
  20967. var props = keys(source);
  20968. return function(object) {
  20969. return baseConformsTo(object, source, props);
  20970. };
  20971. }
  20972. /**
  20973. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20974. *
  20975. * @private
  20976. * @param {Object} object The object to inspect.
  20977. * @param {Object} source The object of property predicates to conform to.
  20978. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20979. */
  20980. function baseConformsTo(object, source, props) {
  20981. var length = props.length;
  20982. if (object == null) {
  20983. return !length;
  20984. }
  20985. object = Object(object);
  20986. while (length--) {
  20987. var key = props[length],
  20988. predicate = source[key],
  20989. value = object[key];
  20990. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20991. return false;
  20992. }
  20993. }
  20994. return true;
  20995. }
  20996. /**
  20997. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20998. * to provide to `func`.
  20999. *
  21000. * @private
  21001. * @param {Function} func The function to delay.
  21002. * @param {number} wait The number of milliseconds to delay invocation.
  21003. * @param {Array} args The arguments to provide to `func`.
  21004. * @returns {number|Object} Returns the timer id or timeout object.
  21005. */
  21006. function baseDelay(func, wait, args) {
  21007. if (typeof func != 'function') {
  21008. throw new TypeError(FUNC_ERROR_TEXT);
  21009. }
  21010. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21011. }
  21012. /**
  21013. * The base implementation of methods like `_.difference` without support
  21014. * for excluding multiple arrays or iteratee shorthands.
  21015. *
  21016. * @private
  21017. * @param {Array} array The array to inspect.
  21018. * @param {Array} values The values to exclude.
  21019. * @param {Function} [iteratee] The iteratee invoked per element.
  21020. * @param {Function} [comparator] The comparator invoked per element.
  21021. * @returns {Array} Returns the new array of filtered values.
  21022. */
  21023. function baseDifference(array, values, iteratee, comparator) {
  21024. var index = -1,
  21025. includes = arrayIncludes,
  21026. isCommon = true,
  21027. length = array.length,
  21028. result = [],
  21029. valuesLength = values.length;
  21030. if (!length) {
  21031. return result;
  21032. }
  21033. if (iteratee) {
  21034. values = arrayMap(values, baseUnary(iteratee));
  21035. }
  21036. if (comparator) {
  21037. includes = arrayIncludesWith;
  21038. isCommon = false;
  21039. }
  21040. else if (values.length >= LARGE_ARRAY_SIZE) {
  21041. includes = cacheHas;
  21042. isCommon = false;
  21043. values = new SetCache(values);
  21044. }
  21045. outer:
  21046. while (++index < length) {
  21047. var value = array[index],
  21048. computed = iteratee == null ? value : iteratee(value);
  21049. value = (comparator || value !== 0) ? value : 0;
  21050. if (isCommon && computed === computed) {
  21051. var valuesIndex = valuesLength;
  21052. while (valuesIndex--) {
  21053. if (values[valuesIndex] === computed) {
  21054. continue outer;
  21055. }
  21056. }
  21057. result.push(value);
  21058. }
  21059. else if (!includes(values, computed, comparator)) {
  21060. result.push(value);
  21061. }
  21062. }
  21063. return result;
  21064. }
  21065. /**
  21066. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21067. *
  21068. * @private
  21069. * @param {Array|Object} collection The collection to iterate over.
  21070. * @param {Function} iteratee The function invoked per iteration.
  21071. * @returns {Array|Object} Returns `collection`.
  21072. */
  21073. var baseEach = createBaseEach(baseForOwn);
  21074. /**
  21075. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21076. *
  21077. * @private
  21078. * @param {Array|Object} collection The collection to iterate over.
  21079. * @param {Function} iteratee The function invoked per iteration.
  21080. * @returns {Array|Object} Returns `collection`.
  21081. */
  21082. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21083. /**
  21084. * The base implementation of `_.every` without support for iteratee shorthands.
  21085. *
  21086. * @private
  21087. * @param {Array|Object} collection The collection to iterate over.
  21088. * @param {Function} predicate The function invoked per iteration.
  21089. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21090. * else `false`
  21091. */
  21092. function baseEvery(collection, predicate) {
  21093. var result = true;
  21094. baseEach(collection, function(value, index, collection) {
  21095. result = !!predicate(value, index, collection);
  21096. return result;
  21097. });
  21098. return result;
  21099. }
  21100. /**
  21101. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21102. * `comparator` to determine the extremum value.
  21103. *
  21104. * @private
  21105. * @param {Array} array The array to iterate over.
  21106. * @param {Function} iteratee The iteratee invoked per iteration.
  21107. * @param {Function} comparator The comparator used to compare values.
  21108. * @returns {*} Returns the extremum value.
  21109. */
  21110. function baseExtremum(array, iteratee, comparator) {
  21111. var index = -1,
  21112. length = array.length;
  21113. while (++index < length) {
  21114. var value = array[index],
  21115. current = iteratee(value);
  21116. if (current != null && (computed === undefined
  21117. ? (current === current && !isSymbol(current))
  21118. : comparator(current, computed)
  21119. )) {
  21120. var computed = current,
  21121. result = value;
  21122. }
  21123. }
  21124. return result;
  21125. }
  21126. /**
  21127. * The base implementation of `_.fill` without an iteratee call guard.
  21128. *
  21129. * @private
  21130. * @param {Array} array The array to fill.
  21131. * @param {*} value The value to fill `array` with.
  21132. * @param {number} [start=0] The start position.
  21133. * @param {number} [end=array.length] The end position.
  21134. * @returns {Array} Returns `array`.
  21135. */
  21136. function baseFill(array, value, start, end) {
  21137. var length = array.length;
  21138. start = toInteger(start);
  21139. if (start < 0) {
  21140. start = -start > length ? 0 : (length + start);
  21141. }
  21142. end = (end === undefined || end > length) ? length : toInteger(end);
  21143. if (end < 0) {
  21144. end += length;
  21145. }
  21146. end = start > end ? 0 : toLength(end);
  21147. while (start < end) {
  21148. array[start++] = value;
  21149. }
  21150. return array;
  21151. }
  21152. /**
  21153. * The base implementation of `_.filter` without support for iteratee shorthands.
  21154. *
  21155. * @private
  21156. * @param {Array|Object} collection The collection to iterate over.
  21157. * @param {Function} predicate The function invoked per iteration.
  21158. * @returns {Array} Returns the new filtered array.
  21159. */
  21160. function baseFilter(collection, predicate) {
  21161. var result = [];
  21162. baseEach(collection, function(value, index, collection) {
  21163. if (predicate(value, index, collection)) {
  21164. result.push(value);
  21165. }
  21166. });
  21167. return result;
  21168. }
  21169. /**
  21170. * The base implementation of `_.flatten` with support for restricting flattening.
  21171. *
  21172. * @private
  21173. * @param {Array} array The array to flatten.
  21174. * @param {number} depth The maximum recursion depth.
  21175. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21176. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21177. * @param {Array} [result=[]] The initial result value.
  21178. * @returns {Array} Returns the new flattened array.
  21179. */
  21180. function baseFlatten(array, depth, predicate, isStrict, result) {
  21181. var index = -1,
  21182. length = array.length;
  21183. predicate || (predicate = isFlattenable);
  21184. result || (result = []);
  21185. while (++index < length) {
  21186. var value = array[index];
  21187. if (depth > 0 && predicate(value)) {
  21188. if (depth > 1) {
  21189. // Recursively flatten arrays (susceptible to call stack limits).
  21190. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21191. } else {
  21192. arrayPush(result, value);
  21193. }
  21194. } else if (!isStrict) {
  21195. result[result.length] = value;
  21196. }
  21197. }
  21198. return result;
  21199. }
  21200. /**
  21201. * The base implementation of `baseForOwn` which iterates over `object`
  21202. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21203. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21204. *
  21205. * @private
  21206. * @param {Object} object The object to iterate over.
  21207. * @param {Function} iteratee The function invoked per iteration.
  21208. * @param {Function} keysFunc The function to get the keys of `object`.
  21209. * @returns {Object} Returns `object`.
  21210. */
  21211. var baseFor = createBaseFor();
  21212. /**
  21213. * This function is like `baseFor` except that it iterates over properties
  21214. * in the opposite order.
  21215. *
  21216. * @private
  21217. * @param {Object} object The object to iterate over.
  21218. * @param {Function} iteratee The function invoked per iteration.
  21219. * @param {Function} keysFunc The function to get the keys of `object`.
  21220. * @returns {Object} Returns `object`.
  21221. */
  21222. var baseForRight = createBaseFor(true);
  21223. /**
  21224. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21225. *
  21226. * @private
  21227. * @param {Object} object The object to iterate over.
  21228. * @param {Function} iteratee The function invoked per iteration.
  21229. * @returns {Object} Returns `object`.
  21230. */
  21231. function baseForOwn(object, iteratee) {
  21232. return object && baseFor(object, iteratee, keys);
  21233. }
  21234. /**
  21235. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21236. *
  21237. * @private
  21238. * @param {Object} object The object to iterate over.
  21239. * @param {Function} iteratee The function invoked per iteration.
  21240. * @returns {Object} Returns `object`.
  21241. */
  21242. function baseForOwnRight(object, iteratee) {
  21243. return object && baseForRight(object, iteratee, keys);
  21244. }
  21245. /**
  21246. * The base implementation of `_.functions` which creates an array of
  21247. * `object` function property names filtered from `props`.
  21248. *
  21249. * @private
  21250. * @param {Object} object The object to inspect.
  21251. * @param {Array} props The property names to filter.
  21252. * @returns {Array} Returns the function names.
  21253. */
  21254. function baseFunctions(object, props) {
  21255. return arrayFilter(props, function(key) {
  21256. return isFunction(object[key]);
  21257. });
  21258. }
  21259. /**
  21260. * The base implementation of `_.get` without support for default values.
  21261. *
  21262. * @private
  21263. * @param {Object} object The object to query.
  21264. * @param {Array|string} path The path of the property to get.
  21265. * @returns {*} Returns the resolved value.
  21266. */
  21267. function baseGet(object, path) {
  21268. path = castPath(path, object);
  21269. var index = 0,
  21270. length = path.length;
  21271. while (object != null && index < length) {
  21272. object = object[toKey(path[index++])];
  21273. }
  21274. return (index && index == length) ? object : undefined;
  21275. }
  21276. /**
  21277. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21278. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21279. * symbols of `object`.
  21280. *
  21281. * @private
  21282. * @param {Object} object The object to query.
  21283. * @param {Function} keysFunc The function to get the keys of `object`.
  21284. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21285. * @returns {Array} Returns the array of property names and symbols.
  21286. */
  21287. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21288. var result = keysFunc(object);
  21289. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21290. }
  21291. /**
  21292. * The base implementation of `getTag` without fallbacks for buggy environments.
  21293. *
  21294. * @private
  21295. * @param {*} value The value to query.
  21296. * @returns {string} Returns the `toStringTag`.
  21297. */
  21298. function baseGetTag(value) {
  21299. if (value == null) {
  21300. return value === undefined ? undefinedTag : nullTag;
  21301. }
  21302. return (symToStringTag && symToStringTag in Object(value))
  21303. ? getRawTag(value)
  21304. : objectToString(value);
  21305. }
  21306. /**
  21307. * The base implementation of `_.gt` which doesn't coerce arguments.
  21308. *
  21309. * @private
  21310. * @param {*} value The value to compare.
  21311. * @param {*} other The other value to compare.
  21312. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21313. * else `false`.
  21314. */
  21315. function baseGt(value, other) {
  21316. return value > other;
  21317. }
  21318. /**
  21319. * The base implementation of `_.has` without support for deep paths.
  21320. *
  21321. * @private
  21322. * @param {Object} [object] The object to query.
  21323. * @param {Array|string} key The key to check.
  21324. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21325. */
  21326. function baseHas(object, key) {
  21327. return object != null && hasOwnProperty.call(object, key);
  21328. }
  21329. /**
  21330. * The base implementation of `_.hasIn` without support for deep paths.
  21331. *
  21332. * @private
  21333. * @param {Object} [object] The object to query.
  21334. * @param {Array|string} key The key to check.
  21335. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21336. */
  21337. function baseHasIn(object, key) {
  21338. return object != null && key in Object(object);
  21339. }
  21340. /**
  21341. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21342. *
  21343. * @private
  21344. * @param {number} number The number to check.
  21345. * @param {number} start The start of the range.
  21346. * @param {number} end The end of the range.
  21347. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21348. */
  21349. function baseInRange(number, start, end) {
  21350. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21351. }
  21352. /**
  21353. * The base implementation of methods like `_.intersection`, without support
  21354. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21355. *
  21356. * @private
  21357. * @param {Array} arrays The arrays to inspect.
  21358. * @param {Function} [iteratee] The iteratee invoked per element.
  21359. * @param {Function} [comparator] The comparator invoked per element.
  21360. * @returns {Array} Returns the new array of shared values.
  21361. */
  21362. function baseIntersection(arrays, iteratee, comparator) {
  21363. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21364. length = arrays[0].length,
  21365. othLength = arrays.length,
  21366. othIndex = othLength,
  21367. caches = Array(othLength),
  21368. maxLength = Infinity,
  21369. result = [];
  21370. while (othIndex--) {
  21371. var array = arrays[othIndex];
  21372. if (othIndex && iteratee) {
  21373. array = arrayMap(array, baseUnary(iteratee));
  21374. }
  21375. maxLength = nativeMin(array.length, maxLength);
  21376. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21377. ? new SetCache(othIndex && array)
  21378. : undefined;
  21379. }
  21380. array = arrays[0];
  21381. var index = -1,
  21382. seen = caches[0];
  21383. outer:
  21384. while (++index < length && result.length < maxLength) {
  21385. var value = array[index],
  21386. computed = iteratee ? iteratee(value) : value;
  21387. value = (comparator || value !== 0) ? value : 0;
  21388. if (!(seen
  21389. ? cacheHas(seen, computed)
  21390. : includes(result, computed, comparator)
  21391. )) {
  21392. othIndex = othLength;
  21393. while (--othIndex) {
  21394. var cache = caches[othIndex];
  21395. if (!(cache
  21396. ? cacheHas(cache, computed)
  21397. : includes(arrays[othIndex], computed, comparator))
  21398. ) {
  21399. continue outer;
  21400. }
  21401. }
  21402. if (seen) {
  21403. seen.push(computed);
  21404. }
  21405. result.push(value);
  21406. }
  21407. }
  21408. return result;
  21409. }
  21410. /**
  21411. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21412. * `object` with values transformed by `iteratee` and set by `setter`.
  21413. *
  21414. * @private
  21415. * @param {Object} object The object to iterate over.
  21416. * @param {Function} setter The function to set `accumulator` values.
  21417. * @param {Function} iteratee The iteratee to transform values.
  21418. * @param {Object} accumulator The initial inverted object.
  21419. * @returns {Function} Returns `accumulator`.
  21420. */
  21421. function baseInverter(object, setter, iteratee, accumulator) {
  21422. baseForOwn(object, function(value, key, object) {
  21423. setter(accumulator, iteratee(value), key, object);
  21424. });
  21425. return accumulator;
  21426. }
  21427. /**
  21428. * The base implementation of `_.invoke` without support for individual
  21429. * method arguments.
  21430. *
  21431. * @private
  21432. * @param {Object} object The object to query.
  21433. * @param {Array|string} path The path of the method to invoke.
  21434. * @param {Array} args The arguments to invoke the method with.
  21435. * @returns {*} Returns the result of the invoked method.
  21436. */
  21437. function baseInvoke(object, path, args) {
  21438. path = castPath(path, object);
  21439. object = parent(object, path);
  21440. var func = object == null ? object : object[toKey(last(path))];
  21441. return func == null ? undefined : apply(func, object, args);
  21442. }
  21443. /**
  21444. * The base implementation of `_.isArguments`.
  21445. *
  21446. * @private
  21447. * @param {*} value The value to check.
  21448. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21449. */
  21450. function baseIsArguments(value) {
  21451. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21452. }
  21453. /**
  21454. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21455. *
  21456. * @private
  21457. * @param {*} value The value to check.
  21458. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21459. */
  21460. function baseIsArrayBuffer(value) {
  21461. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21462. }
  21463. /**
  21464. * The base implementation of `_.isDate` without Node.js optimizations.
  21465. *
  21466. * @private
  21467. * @param {*} value The value to check.
  21468. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21469. */
  21470. function baseIsDate(value) {
  21471. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21472. }
  21473. /**
  21474. * The base implementation of `_.isEqual` which supports partial comparisons
  21475. * and tracks traversed objects.
  21476. *
  21477. * @private
  21478. * @param {*} value The value to compare.
  21479. * @param {*} other The other value to compare.
  21480. * @param {boolean} bitmask The bitmask flags.
  21481. * 1 - Unordered comparison
  21482. * 2 - Partial comparison
  21483. * @param {Function} [customizer] The function to customize comparisons.
  21484. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21485. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21486. */
  21487. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21488. if (value === other) {
  21489. return true;
  21490. }
  21491. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21492. return value !== value && other !== other;
  21493. }
  21494. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21495. }
  21496. /**
  21497. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21498. * deep comparisons and tracks traversed objects enabling objects with circular
  21499. * references to be compared.
  21500. *
  21501. * @private
  21502. * @param {Object} object The object to compare.
  21503. * @param {Object} other The other object to compare.
  21504. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21505. * @param {Function} customizer The function to customize comparisons.
  21506. * @param {Function} equalFunc The function to determine equivalents of values.
  21507. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21508. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21509. */
  21510. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21511. var objIsArr = isArray(object),
  21512. othIsArr = isArray(other),
  21513. objTag = objIsArr ? arrayTag : getTag(object),
  21514. othTag = othIsArr ? arrayTag : getTag(other);
  21515. objTag = objTag == argsTag ? objectTag : objTag;
  21516. othTag = othTag == argsTag ? objectTag : othTag;
  21517. var objIsObj = objTag == objectTag,
  21518. othIsObj = othTag == objectTag,
  21519. isSameTag = objTag == othTag;
  21520. if (isSameTag && isBuffer(object)) {
  21521. if (!isBuffer(other)) {
  21522. return false;
  21523. }
  21524. objIsArr = true;
  21525. objIsObj = false;
  21526. }
  21527. if (isSameTag && !objIsObj) {
  21528. stack || (stack = new Stack);
  21529. return (objIsArr || isTypedArray(object))
  21530. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21531. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21532. }
  21533. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21534. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21535. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21536. if (objIsWrapped || othIsWrapped) {
  21537. var objUnwrapped = objIsWrapped ? object.value() : object,
  21538. othUnwrapped = othIsWrapped ? other.value() : other;
  21539. stack || (stack = new Stack);
  21540. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21541. }
  21542. }
  21543. if (!isSameTag) {
  21544. return false;
  21545. }
  21546. stack || (stack = new Stack);
  21547. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21548. }
  21549. /**
  21550. * The base implementation of `_.isMap` without Node.js optimizations.
  21551. *
  21552. * @private
  21553. * @param {*} value The value to check.
  21554. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21555. */
  21556. function baseIsMap(value) {
  21557. return isObjectLike(value) && getTag(value) == mapTag;
  21558. }
  21559. /**
  21560. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21561. *
  21562. * @private
  21563. * @param {Object} object The object to inspect.
  21564. * @param {Object} source The object of property values to match.
  21565. * @param {Array} matchData The property names, values, and compare flags to match.
  21566. * @param {Function} [customizer] The function to customize comparisons.
  21567. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21568. */
  21569. function baseIsMatch(object, source, matchData, customizer) {
  21570. var index = matchData.length,
  21571. length = index,
  21572. noCustomizer = !customizer;
  21573. if (object == null) {
  21574. return !length;
  21575. }
  21576. object = Object(object);
  21577. while (index--) {
  21578. var data = matchData[index];
  21579. if ((noCustomizer && data[2])
  21580. ? data[1] !== object[data[0]]
  21581. : !(data[0] in object)
  21582. ) {
  21583. return false;
  21584. }
  21585. }
  21586. while (++index < length) {
  21587. data = matchData[index];
  21588. var key = data[0],
  21589. objValue = object[key],
  21590. srcValue = data[1];
  21591. if (noCustomizer && data[2]) {
  21592. if (objValue === undefined && !(key in object)) {
  21593. return false;
  21594. }
  21595. } else {
  21596. var stack = new Stack;
  21597. if (customizer) {
  21598. var result = customizer(objValue, srcValue, key, object, source, stack);
  21599. }
  21600. if (!(result === undefined
  21601. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21602. : result
  21603. )) {
  21604. return false;
  21605. }
  21606. }
  21607. }
  21608. return true;
  21609. }
  21610. /**
  21611. * The base implementation of `_.isNative` without bad shim checks.
  21612. *
  21613. * @private
  21614. * @param {*} value The value to check.
  21615. * @returns {boolean} Returns `true` if `value` is a native function,
  21616. * else `false`.
  21617. */
  21618. function baseIsNative(value) {
  21619. if (!isObject(value) || isMasked(value)) {
  21620. return false;
  21621. }
  21622. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21623. return pattern.test(toSource(value));
  21624. }
  21625. /**
  21626. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21627. *
  21628. * @private
  21629. * @param {*} value The value to check.
  21630. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21631. */
  21632. function baseIsRegExp(value) {
  21633. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21634. }
  21635. /**
  21636. * The base implementation of `_.isSet` without Node.js optimizations.
  21637. *
  21638. * @private
  21639. * @param {*} value The value to check.
  21640. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21641. */
  21642. function baseIsSet(value) {
  21643. return isObjectLike(value) && getTag(value) == setTag;
  21644. }
  21645. /**
  21646. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21647. *
  21648. * @private
  21649. * @param {*} value The value to check.
  21650. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21651. */
  21652. function baseIsTypedArray(value) {
  21653. return isObjectLike(value) &&
  21654. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21655. }
  21656. /**
  21657. * The base implementation of `_.iteratee`.
  21658. *
  21659. * @private
  21660. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21661. * @returns {Function} Returns the iteratee.
  21662. */
  21663. function baseIteratee(value) {
  21664. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21665. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21666. if (typeof value == 'function') {
  21667. return value;
  21668. }
  21669. if (value == null) {
  21670. return identity;
  21671. }
  21672. if (typeof value == 'object') {
  21673. return isArray(value)
  21674. ? baseMatchesProperty(value[0], value[1])
  21675. : baseMatches(value);
  21676. }
  21677. return property(value);
  21678. }
  21679. /**
  21680. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21681. *
  21682. * @private
  21683. * @param {Object} object The object to query.
  21684. * @returns {Array} Returns the array of property names.
  21685. */
  21686. function baseKeys(object) {
  21687. if (!isPrototype(object)) {
  21688. return nativeKeys(object);
  21689. }
  21690. var result = [];
  21691. for (var key in Object(object)) {
  21692. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21693. result.push(key);
  21694. }
  21695. }
  21696. return result;
  21697. }
  21698. /**
  21699. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21700. *
  21701. * @private
  21702. * @param {Object} object The object to query.
  21703. * @returns {Array} Returns the array of property names.
  21704. */
  21705. function baseKeysIn(object) {
  21706. if (!isObject(object)) {
  21707. return nativeKeysIn(object);
  21708. }
  21709. var isProto = isPrototype(object),
  21710. result = [];
  21711. for (var key in object) {
  21712. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21713. result.push(key);
  21714. }
  21715. }
  21716. return result;
  21717. }
  21718. /**
  21719. * The base implementation of `_.lt` which doesn't coerce arguments.
  21720. *
  21721. * @private
  21722. * @param {*} value The value to compare.
  21723. * @param {*} other The other value to compare.
  21724. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21725. * else `false`.
  21726. */
  21727. function baseLt(value, other) {
  21728. return value < other;
  21729. }
  21730. /**
  21731. * The base implementation of `_.map` without support for iteratee shorthands.
  21732. *
  21733. * @private
  21734. * @param {Array|Object} collection The collection to iterate over.
  21735. * @param {Function} iteratee The function invoked per iteration.
  21736. * @returns {Array} Returns the new mapped array.
  21737. */
  21738. function baseMap(collection, iteratee) {
  21739. var index = -1,
  21740. result = isArrayLike(collection) ? Array(collection.length) : [];
  21741. baseEach(collection, function(value, key, collection) {
  21742. result[++index] = iteratee(value, key, collection);
  21743. });
  21744. return result;
  21745. }
  21746. /**
  21747. * The base implementation of `_.matches` which doesn't clone `source`.
  21748. *
  21749. * @private
  21750. * @param {Object} source The object of property values to match.
  21751. * @returns {Function} Returns the new spec function.
  21752. */
  21753. function baseMatches(source) {
  21754. var matchData = getMatchData(source);
  21755. if (matchData.length == 1 && matchData[0][2]) {
  21756. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21757. }
  21758. return function(object) {
  21759. return object === source || baseIsMatch(object, source, matchData);
  21760. };
  21761. }
  21762. /**
  21763. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21764. *
  21765. * @private
  21766. * @param {string} path The path of the property to get.
  21767. * @param {*} srcValue The value to match.
  21768. * @returns {Function} Returns the new spec function.
  21769. */
  21770. function baseMatchesProperty(path, srcValue) {
  21771. if (isKey(path) && isStrictComparable(srcValue)) {
  21772. return matchesStrictComparable(toKey(path), srcValue);
  21773. }
  21774. return function(object) {
  21775. var objValue = get(object, path);
  21776. return (objValue === undefined && objValue === srcValue)
  21777. ? hasIn(object, path)
  21778. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21779. };
  21780. }
  21781. /**
  21782. * The base implementation of `_.merge` without support for multiple sources.
  21783. *
  21784. * @private
  21785. * @param {Object} object The destination object.
  21786. * @param {Object} source The source object.
  21787. * @param {number} srcIndex The index of `source`.
  21788. * @param {Function} [customizer] The function to customize merged values.
  21789. * @param {Object} [stack] Tracks traversed source values and their merged
  21790. * counterparts.
  21791. */
  21792. function baseMerge(object, source, srcIndex, customizer, stack) {
  21793. if (object === source) {
  21794. return;
  21795. }
  21796. baseFor(source, function(srcValue, key) {
  21797. stack || (stack = new Stack);
  21798. if (isObject(srcValue)) {
  21799. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21800. }
  21801. else {
  21802. var newValue = customizer
  21803. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21804. : undefined;
  21805. if (newValue === undefined) {
  21806. newValue = srcValue;
  21807. }
  21808. assignMergeValue(object, key, newValue);
  21809. }
  21810. }, keysIn);
  21811. }
  21812. /**
  21813. * A specialized version of `baseMerge` for arrays and objects which performs
  21814. * deep merges and tracks traversed objects enabling objects with circular
  21815. * references to be merged.
  21816. *
  21817. * @private
  21818. * @param {Object} object The destination object.
  21819. * @param {Object} source The source object.
  21820. * @param {string} key The key of the value to merge.
  21821. * @param {number} srcIndex The index of `source`.
  21822. * @param {Function} mergeFunc The function to merge values.
  21823. * @param {Function} [customizer] The function to customize assigned values.
  21824. * @param {Object} [stack] Tracks traversed source values and their merged
  21825. * counterparts.
  21826. */
  21827. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21828. var objValue = safeGet(object, key),
  21829. srcValue = safeGet(source, key),
  21830. stacked = stack.get(srcValue);
  21831. if (stacked) {
  21832. assignMergeValue(object, key, stacked);
  21833. return;
  21834. }
  21835. var newValue = customizer
  21836. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21837. : undefined;
  21838. var isCommon = newValue === undefined;
  21839. if (isCommon) {
  21840. var isArr = isArray(srcValue),
  21841. isBuff = !isArr && isBuffer(srcValue),
  21842. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21843. newValue = srcValue;
  21844. if (isArr || isBuff || isTyped) {
  21845. if (isArray(objValue)) {
  21846. newValue = objValue;
  21847. }
  21848. else if (isArrayLikeObject(objValue)) {
  21849. newValue = copyArray(objValue);
  21850. }
  21851. else if (isBuff) {
  21852. isCommon = false;
  21853. newValue = cloneBuffer(srcValue, true);
  21854. }
  21855. else if (isTyped) {
  21856. isCommon = false;
  21857. newValue = cloneTypedArray(srcValue, true);
  21858. }
  21859. else {
  21860. newValue = [];
  21861. }
  21862. }
  21863. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21864. newValue = objValue;
  21865. if (isArguments(objValue)) {
  21866. newValue = toPlainObject(objValue);
  21867. }
  21868. else if (!isObject(objValue) || isFunction(objValue)) {
  21869. newValue = initCloneObject(srcValue);
  21870. }
  21871. }
  21872. else {
  21873. isCommon = false;
  21874. }
  21875. }
  21876. if (isCommon) {
  21877. // Recursively merge objects and arrays (susceptible to call stack limits).
  21878. stack.set(srcValue, newValue);
  21879. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21880. stack['delete'](srcValue);
  21881. }
  21882. assignMergeValue(object, key, newValue);
  21883. }
  21884. /**
  21885. * The base implementation of `_.nth` which doesn't coerce arguments.
  21886. *
  21887. * @private
  21888. * @param {Array} array The array to query.
  21889. * @param {number} n The index of the element to return.
  21890. * @returns {*} Returns the nth element of `array`.
  21891. */
  21892. function baseNth(array, n) {
  21893. var length = array.length;
  21894. if (!length) {
  21895. return;
  21896. }
  21897. n += n < 0 ? length : 0;
  21898. return isIndex(n, length) ? array[n] : undefined;
  21899. }
  21900. /**
  21901. * The base implementation of `_.orderBy` without param guards.
  21902. *
  21903. * @private
  21904. * @param {Array|Object} collection The collection to iterate over.
  21905. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21906. * @param {string[]} orders The sort orders of `iteratees`.
  21907. * @returns {Array} Returns the new sorted array.
  21908. */
  21909. function baseOrderBy(collection, iteratees, orders) {
  21910. var index = -1;
  21911. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21912. var result = baseMap(collection, function(value, key, collection) {
  21913. var criteria = arrayMap(iteratees, function(iteratee) {
  21914. return iteratee(value);
  21915. });
  21916. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21917. });
  21918. return baseSortBy(result, function(object, other) {
  21919. return compareMultiple(object, other, orders);
  21920. });
  21921. }
  21922. /**
  21923. * The base implementation of `_.pick` without support for individual
  21924. * property identifiers.
  21925. *
  21926. * @private
  21927. * @param {Object} object The source object.
  21928. * @param {string[]} paths The property paths to pick.
  21929. * @returns {Object} Returns the new object.
  21930. */
  21931. function basePick(object, paths) {
  21932. return basePickBy(object, paths, function(value, path) {
  21933. return hasIn(object, path);
  21934. });
  21935. }
  21936. /**
  21937. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21938. *
  21939. * @private
  21940. * @param {Object} object The source object.
  21941. * @param {string[]} paths The property paths to pick.
  21942. * @param {Function} predicate The function invoked per property.
  21943. * @returns {Object} Returns the new object.
  21944. */
  21945. function basePickBy(object, paths, predicate) {
  21946. var index = -1,
  21947. length = paths.length,
  21948. result = {};
  21949. while (++index < length) {
  21950. var path = paths[index],
  21951. value = baseGet(object, path);
  21952. if (predicate(value, path)) {
  21953. baseSet(result, castPath(path, object), value);
  21954. }
  21955. }
  21956. return result;
  21957. }
  21958. /**
  21959. * A specialized version of `baseProperty` which supports deep paths.
  21960. *
  21961. * @private
  21962. * @param {Array|string} path The path of the property to get.
  21963. * @returns {Function} Returns the new accessor function.
  21964. */
  21965. function basePropertyDeep(path) {
  21966. return function(object) {
  21967. return baseGet(object, path);
  21968. };
  21969. }
  21970. /**
  21971. * The base implementation of `_.pullAllBy` without support for iteratee
  21972. * shorthands.
  21973. *
  21974. * @private
  21975. * @param {Array} array The array to modify.
  21976. * @param {Array} values The values to remove.
  21977. * @param {Function} [iteratee] The iteratee invoked per element.
  21978. * @param {Function} [comparator] The comparator invoked per element.
  21979. * @returns {Array} Returns `array`.
  21980. */
  21981. function basePullAll(array, values, iteratee, comparator) {
  21982. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21983. index = -1,
  21984. length = values.length,
  21985. seen = array;
  21986. if (array === values) {
  21987. values = copyArray(values);
  21988. }
  21989. if (iteratee) {
  21990. seen = arrayMap(array, baseUnary(iteratee));
  21991. }
  21992. while (++index < length) {
  21993. var fromIndex = 0,
  21994. value = values[index],
  21995. computed = iteratee ? iteratee(value) : value;
  21996. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21997. if (seen !== array) {
  21998. splice.call(seen, fromIndex, 1);
  21999. }
  22000. splice.call(array, fromIndex, 1);
  22001. }
  22002. }
  22003. return array;
  22004. }
  22005. /**
  22006. * The base implementation of `_.pullAt` without support for individual
  22007. * indexes or capturing the removed elements.
  22008. *
  22009. * @private
  22010. * @param {Array} array The array to modify.
  22011. * @param {number[]} indexes The indexes of elements to remove.
  22012. * @returns {Array} Returns `array`.
  22013. */
  22014. function basePullAt(array, indexes) {
  22015. var length = array ? indexes.length : 0,
  22016. lastIndex = length - 1;
  22017. while (length--) {
  22018. var index = indexes[length];
  22019. if (length == lastIndex || index !== previous) {
  22020. var previous = index;
  22021. if (isIndex(index)) {
  22022. splice.call(array, index, 1);
  22023. } else {
  22024. baseUnset(array, index);
  22025. }
  22026. }
  22027. }
  22028. return array;
  22029. }
  22030. /**
  22031. * The base implementation of `_.random` without support for returning
  22032. * floating-point numbers.
  22033. *
  22034. * @private
  22035. * @param {number} lower The lower bound.
  22036. * @param {number} upper The upper bound.
  22037. * @returns {number} Returns the random number.
  22038. */
  22039. function baseRandom(lower, upper) {
  22040. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22041. }
  22042. /**
  22043. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22044. * coerce arguments.
  22045. *
  22046. * @private
  22047. * @param {number} start The start of the range.
  22048. * @param {number} end The end of the range.
  22049. * @param {number} step The value to increment or decrement by.
  22050. * @param {boolean} [fromRight] Specify iterating from right to left.
  22051. * @returns {Array} Returns the range of numbers.
  22052. */
  22053. function baseRange(start, end, step, fromRight) {
  22054. var index = -1,
  22055. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22056. result = Array(length);
  22057. while (length--) {
  22058. result[fromRight ? length : ++index] = start;
  22059. start += step;
  22060. }
  22061. return result;
  22062. }
  22063. /**
  22064. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22065. *
  22066. * @private
  22067. * @param {string} string The string to repeat.
  22068. * @param {number} n The number of times to repeat the string.
  22069. * @returns {string} Returns the repeated string.
  22070. */
  22071. function baseRepeat(string, n) {
  22072. var result = '';
  22073. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22074. return result;
  22075. }
  22076. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22077. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22078. do {
  22079. if (n % 2) {
  22080. result += string;
  22081. }
  22082. n = nativeFloor(n / 2);
  22083. if (n) {
  22084. string += string;
  22085. }
  22086. } while (n);
  22087. return result;
  22088. }
  22089. /**
  22090. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22091. *
  22092. * @private
  22093. * @param {Function} func The function to apply a rest parameter to.
  22094. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22095. * @returns {Function} Returns the new function.
  22096. */
  22097. function baseRest(func, start) {
  22098. return setToString(overRest(func, start, identity), func + '');
  22099. }
  22100. /**
  22101. * The base implementation of `_.sample`.
  22102. *
  22103. * @private
  22104. * @param {Array|Object} collection The collection to sample.
  22105. * @returns {*} Returns the random element.
  22106. */
  22107. function baseSample(collection) {
  22108. return arraySample(values(collection));
  22109. }
  22110. /**
  22111. * The base implementation of `_.sampleSize` without param guards.
  22112. *
  22113. * @private
  22114. * @param {Array|Object} collection The collection to sample.
  22115. * @param {number} n The number of elements to sample.
  22116. * @returns {Array} Returns the random elements.
  22117. */
  22118. function baseSampleSize(collection, n) {
  22119. var array = values(collection);
  22120. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22121. }
  22122. /**
  22123. * The base implementation of `_.set`.
  22124. *
  22125. * @private
  22126. * @param {Object} object The object to modify.
  22127. * @param {Array|string} path The path of the property to set.
  22128. * @param {*} value The value to set.
  22129. * @param {Function} [customizer] The function to customize path creation.
  22130. * @returns {Object} Returns `object`.
  22131. */
  22132. function baseSet(object, path, value, customizer) {
  22133. if (!isObject(object)) {
  22134. return object;
  22135. }
  22136. path = castPath(path, object);
  22137. var index = -1,
  22138. length = path.length,
  22139. lastIndex = length - 1,
  22140. nested = object;
  22141. while (nested != null && ++index < length) {
  22142. var key = toKey(path[index]),
  22143. newValue = value;
  22144. if (index != lastIndex) {
  22145. var objValue = nested[key];
  22146. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22147. if (newValue === undefined) {
  22148. newValue = isObject(objValue)
  22149. ? objValue
  22150. : (isIndex(path[index + 1]) ? [] : {});
  22151. }
  22152. }
  22153. assignValue(nested, key, newValue);
  22154. nested = nested[key];
  22155. }
  22156. return object;
  22157. }
  22158. /**
  22159. * The base implementation of `setData` without support for hot loop shorting.
  22160. *
  22161. * @private
  22162. * @param {Function} func The function to associate metadata with.
  22163. * @param {*} data The metadata.
  22164. * @returns {Function} Returns `func`.
  22165. */
  22166. var baseSetData = !metaMap ? identity : function(func, data) {
  22167. metaMap.set(func, data);
  22168. return func;
  22169. };
  22170. /**
  22171. * The base implementation of `setToString` without support for hot loop shorting.
  22172. *
  22173. * @private
  22174. * @param {Function} func The function to modify.
  22175. * @param {Function} string The `toString` result.
  22176. * @returns {Function} Returns `func`.
  22177. */
  22178. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22179. return defineProperty(func, 'toString', {
  22180. 'configurable': true,
  22181. 'enumerable': false,
  22182. 'value': constant(string),
  22183. 'writable': true
  22184. });
  22185. };
  22186. /**
  22187. * The base implementation of `_.shuffle`.
  22188. *
  22189. * @private
  22190. * @param {Array|Object} collection The collection to shuffle.
  22191. * @returns {Array} Returns the new shuffled array.
  22192. */
  22193. function baseShuffle(collection) {
  22194. return shuffleSelf(values(collection));
  22195. }
  22196. /**
  22197. * The base implementation of `_.slice` without an iteratee call guard.
  22198. *
  22199. * @private
  22200. * @param {Array} array The array to slice.
  22201. * @param {number} [start=0] The start position.
  22202. * @param {number} [end=array.length] The end position.
  22203. * @returns {Array} Returns the slice of `array`.
  22204. */
  22205. function baseSlice(array, start, end) {
  22206. var index = -1,
  22207. length = array.length;
  22208. if (start < 0) {
  22209. start = -start > length ? 0 : (length + start);
  22210. }
  22211. end = end > length ? length : end;
  22212. if (end < 0) {
  22213. end += length;
  22214. }
  22215. length = start > end ? 0 : ((end - start) >>> 0);
  22216. start >>>= 0;
  22217. var result = Array(length);
  22218. while (++index < length) {
  22219. result[index] = array[index + start];
  22220. }
  22221. return result;
  22222. }
  22223. /**
  22224. * The base implementation of `_.some` without support for iteratee shorthands.
  22225. *
  22226. * @private
  22227. * @param {Array|Object} collection The collection to iterate over.
  22228. * @param {Function} predicate The function invoked per iteration.
  22229. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22230. * else `false`.
  22231. */
  22232. function baseSome(collection, predicate) {
  22233. var result;
  22234. baseEach(collection, function(value, index, collection) {
  22235. result = predicate(value, index, collection);
  22236. return !result;
  22237. });
  22238. return !!result;
  22239. }
  22240. /**
  22241. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22242. * performs a binary search of `array` to determine the index at which `value`
  22243. * should be inserted into `array` in order to maintain its sort order.
  22244. *
  22245. * @private
  22246. * @param {Array} array The sorted array to inspect.
  22247. * @param {*} value The value to evaluate.
  22248. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22249. * @returns {number} Returns the index at which `value` should be inserted
  22250. * into `array`.
  22251. */
  22252. function baseSortedIndex(array, value, retHighest) {
  22253. var low = 0,
  22254. high = array == null ? low : array.length;
  22255. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22256. while (low < high) {
  22257. var mid = (low + high) >>> 1,
  22258. computed = array[mid];
  22259. if (computed !== null && !isSymbol(computed) &&
  22260. (retHighest ? (computed <= value) : (computed < value))) {
  22261. low = mid + 1;
  22262. } else {
  22263. high = mid;
  22264. }
  22265. }
  22266. return high;
  22267. }
  22268. return baseSortedIndexBy(array, value, identity, retHighest);
  22269. }
  22270. /**
  22271. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22272. * which invokes `iteratee` for `value` and each element of `array` to compute
  22273. * their sort ranking. The iteratee is invoked with one argument; (value).
  22274. *
  22275. * @private
  22276. * @param {Array} array The sorted array to inspect.
  22277. * @param {*} value The value to evaluate.
  22278. * @param {Function} iteratee The iteratee invoked per element.
  22279. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22280. * @returns {number} Returns the index at which `value` should be inserted
  22281. * into `array`.
  22282. */
  22283. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22284. value = iteratee(value);
  22285. var low = 0,
  22286. high = array == null ? 0 : array.length,
  22287. valIsNaN = value !== value,
  22288. valIsNull = value === null,
  22289. valIsSymbol = isSymbol(value),
  22290. valIsUndefined = value === undefined;
  22291. while (low < high) {
  22292. var mid = nativeFloor((low + high) / 2),
  22293. computed = iteratee(array[mid]),
  22294. othIsDefined = computed !== undefined,
  22295. othIsNull = computed === null,
  22296. othIsReflexive = computed === computed,
  22297. othIsSymbol = isSymbol(computed);
  22298. if (valIsNaN) {
  22299. var setLow = retHighest || othIsReflexive;
  22300. } else if (valIsUndefined) {
  22301. setLow = othIsReflexive && (retHighest || othIsDefined);
  22302. } else if (valIsNull) {
  22303. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22304. } else if (valIsSymbol) {
  22305. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22306. } else if (othIsNull || othIsSymbol) {
  22307. setLow = false;
  22308. } else {
  22309. setLow = retHighest ? (computed <= value) : (computed < value);
  22310. }
  22311. if (setLow) {
  22312. low = mid + 1;
  22313. } else {
  22314. high = mid;
  22315. }
  22316. }
  22317. return nativeMin(high, MAX_ARRAY_INDEX);
  22318. }
  22319. /**
  22320. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22321. * support for iteratee shorthands.
  22322. *
  22323. * @private
  22324. * @param {Array} array The array to inspect.
  22325. * @param {Function} [iteratee] The iteratee invoked per element.
  22326. * @returns {Array} Returns the new duplicate free array.
  22327. */
  22328. function baseSortedUniq(array, iteratee) {
  22329. var index = -1,
  22330. length = array.length,
  22331. resIndex = 0,
  22332. result = [];
  22333. while (++index < length) {
  22334. var value = array[index],
  22335. computed = iteratee ? iteratee(value) : value;
  22336. if (!index || !eq(computed, seen)) {
  22337. var seen = computed;
  22338. result[resIndex++] = value === 0 ? 0 : value;
  22339. }
  22340. }
  22341. return result;
  22342. }
  22343. /**
  22344. * The base implementation of `_.toNumber` which doesn't ensure correct
  22345. * conversions of binary, hexadecimal, or octal string values.
  22346. *
  22347. * @private
  22348. * @param {*} value The value to process.
  22349. * @returns {number} Returns the number.
  22350. */
  22351. function baseToNumber(value) {
  22352. if (typeof value == 'number') {
  22353. return value;
  22354. }
  22355. if (isSymbol(value)) {
  22356. return NAN;
  22357. }
  22358. return +value;
  22359. }
  22360. /**
  22361. * The base implementation of `_.toString` which doesn't convert nullish
  22362. * values to empty strings.
  22363. *
  22364. * @private
  22365. * @param {*} value The value to process.
  22366. * @returns {string} Returns the string.
  22367. */
  22368. function baseToString(value) {
  22369. // Exit early for strings to avoid a performance hit in some environments.
  22370. if (typeof value == 'string') {
  22371. return value;
  22372. }
  22373. if (isArray(value)) {
  22374. // Recursively convert values (susceptible to call stack limits).
  22375. return arrayMap(value, baseToString) + '';
  22376. }
  22377. if (isSymbol(value)) {
  22378. return symbolToString ? symbolToString.call(value) : '';
  22379. }
  22380. var result = (value + '');
  22381. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22382. }
  22383. /**
  22384. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22385. *
  22386. * @private
  22387. * @param {Array} array The array to inspect.
  22388. * @param {Function} [iteratee] The iteratee invoked per element.
  22389. * @param {Function} [comparator] The comparator invoked per element.
  22390. * @returns {Array} Returns the new duplicate free array.
  22391. */
  22392. function baseUniq(array, iteratee, comparator) {
  22393. var index = -1,
  22394. includes = arrayIncludes,
  22395. length = array.length,
  22396. isCommon = true,
  22397. result = [],
  22398. seen = result;
  22399. if (comparator) {
  22400. isCommon = false;
  22401. includes = arrayIncludesWith;
  22402. }
  22403. else if (length >= LARGE_ARRAY_SIZE) {
  22404. var set = iteratee ? null : createSet(array);
  22405. if (set) {
  22406. return setToArray(set);
  22407. }
  22408. isCommon = false;
  22409. includes = cacheHas;
  22410. seen = new SetCache;
  22411. }
  22412. else {
  22413. seen = iteratee ? [] : result;
  22414. }
  22415. outer:
  22416. while (++index < length) {
  22417. var value = array[index],
  22418. computed = iteratee ? iteratee(value) : value;
  22419. value = (comparator || value !== 0) ? value : 0;
  22420. if (isCommon && computed === computed) {
  22421. var seenIndex = seen.length;
  22422. while (seenIndex--) {
  22423. if (seen[seenIndex] === computed) {
  22424. continue outer;
  22425. }
  22426. }
  22427. if (iteratee) {
  22428. seen.push(computed);
  22429. }
  22430. result.push(value);
  22431. }
  22432. else if (!includes(seen, computed, comparator)) {
  22433. if (seen !== result) {
  22434. seen.push(computed);
  22435. }
  22436. result.push(value);
  22437. }
  22438. }
  22439. return result;
  22440. }
  22441. /**
  22442. * The base implementation of `_.unset`.
  22443. *
  22444. * @private
  22445. * @param {Object} object The object to modify.
  22446. * @param {Array|string} path The property path to unset.
  22447. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22448. */
  22449. function baseUnset(object, path) {
  22450. path = castPath(path, object);
  22451. object = parent(object, path);
  22452. return object == null || delete object[toKey(last(path))];
  22453. }
  22454. /**
  22455. * The base implementation of `_.update`.
  22456. *
  22457. * @private
  22458. * @param {Object} object The object to modify.
  22459. * @param {Array|string} path The path of the property to update.
  22460. * @param {Function} updater The function to produce the updated value.
  22461. * @param {Function} [customizer] The function to customize path creation.
  22462. * @returns {Object} Returns `object`.
  22463. */
  22464. function baseUpdate(object, path, updater, customizer) {
  22465. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22466. }
  22467. /**
  22468. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22469. * without support for iteratee shorthands.
  22470. *
  22471. * @private
  22472. * @param {Array} array The array to query.
  22473. * @param {Function} predicate The function invoked per iteration.
  22474. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22475. * @param {boolean} [fromRight] Specify iterating from right to left.
  22476. * @returns {Array} Returns the slice of `array`.
  22477. */
  22478. function baseWhile(array, predicate, isDrop, fromRight) {
  22479. var length = array.length,
  22480. index = fromRight ? length : -1;
  22481. while ((fromRight ? index-- : ++index < length) &&
  22482. predicate(array[index], index, array)) {}
  22483. return isDrop
  22484. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22485. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22486. }
  22487. /**
  22488. * The base implementation of `wrapperValue` which returns the result of
  22489. * performing a sequence of actions on the unwrapped `value`, where each
  22490. * successive action is supplied the return value of the previous.
  22491. *
  22492. * @private
  22493. * @param {*} value The unwrapped value.
  22494. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22495. * @returns {*} Returns the resolved value.
  22496. */
  22497. function baseWrapperValue(value, actions) {
  22498. var result = value;
  22499. if (result instanceof LazyWrapper) {
  22500. result = result.value();
  22501. }
  22502. return arrayReduce(actions, function(result, action) {
  22503. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22504. }, result);
  22505. }
  22506. /**
  22507. * The base implementation of methods like `_.xor`, without support for
  22508. * iteratee shorthands, that accepts an array of arrays to inspect.
  22509. *
  22510. * @private
  22511. * @param {Array} arrays The arrays to inspect.
  22512. * @param {Function} [iteratee] The iteratee invoked per element.
  22513. * @param {Function} [comparator] The comparator invoked per element.
  22514. * @returns {Array} Returns the new array of values.
  22515. */
  22516. function baseXor(arrays, iteratee, comparator) {
  22517. var length = arrays.length;
  22518. if (length < 2) {
  22519. return length ? baseUniq(arrays[0]) : [];
  22520. }
  22521. var index = -1,
  22522. result = Array(length);
  22523. while (++index < length) {
  22524. var array = arrays[index],
  22525. othIndex = -1;
  22526. while (++othIndex < length) {
  22527. if (othIndex != index) {
  22528. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22529. }
  22530. }
  22531. }
  22532. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22533. }
  22534. /**
  22535. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22536. *
  22537. * @private
  22538. * @param {Array} props The property identifiers.
  22539. * @param {Array} values The property values.
  22540. * @param {Function} assignFunc The function to assign values.
  22541. * @returns {Object} Returns the new object.
  22542. */
  22543. function baseZipObject(props, values, assignFunc) {
  22544. var index = -1,
  22545. length = props.length,
  22546. valsLength = values.length,
  22547. result = {};
  22548. while (++index < length) {
  22549. var value = index < valsLength ? values[index] : undefined;
  22550. assignFunc(result, props[index], value);
  22551. }
  22552. return result;
  22553. }
  22554. /**
  22555. * Casts `value` to an empty array if it's not an array like object.
  22556. *
  22557. * @private
  22558. * @param {*} value The value to inspect.
  22559. * @returns {Array|Object} Returns the cast array-like object.
  22560. */
  22561. function castArrayLikeObject(value) {
  22562. return isArrayLikeObject(value) ? value : [];
  22563. }
  22564. /**
  22565. * Casts `value` to `identity` if it's not a function.
  22566. *
  22567. * @private
  22568. * @param {*} value The value to inspect.
  22569. * @returns {Function} Returns cast function.
  22570. */
  22571. function castFunction(value) {
  22572. return typeof value == 'function' ? value : identity;
  22573. }
  22574. /**
  22575. * Casts `value` to a path array if it's not one.
  22576. *
  22577. * @private
  22578. * @param {*} value The value to inspect.
  22579. * @param {Object} [object] The object to query keys on.
  22580. * @returns {Array} Returns the cast property path array.
  22581. */
  22582. function castPath(value, object) {
  22583. if (isArray(value)) {
  22584. return value;
  22585. }
  22586. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22587. }
  22588. /**
  22589. * A `baseRest` alias which can be replaced with `identity` by module
  22590. * replacement plugins.
  22591. *
  22592. * @private
  22593. * @type {Function}
  22594. * @param {Function} func The function to apply a rest parameter to.
  22595. * @returns {Function} Returns the new function.
  22596. */
  22597. var castRest = baseRest;
  22598. /**
  22599. * Casts `array` to a slice if it's needed.
  22600. *
  22601. * @private
  22602. * @param {Array} array The array to inspect.
  22603. * @param {number} start The start position.
  22604. * @param {number} [end=array.length] The end position.
  22605. * @returns {Array} Returns the cast slice.
  22606. */
  22607. function castSlice(array, start, end) {
  22608. var length = array.length;
  22609. end = end === undefined ? length : end;
  22610. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22611. }
  22612. /**
  22613. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22614. *
  22615. * @private
  22616. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22617. */
  22618. var clearTimeout = ctxClearTimeout || function(id) {
  22619. return root.clearTimeout(id);
  22620. };
  22621. /**
  22622. * Creates a clone of `buffer`.
  22623. *
  22624. * @private
  22625. * @param {Buffer} buffer The buffer to clone.
  22626. * @param {boolean} [isDeep] Specify a deep clone.
  22627. * @returns {Buffer} Returns the cloned buffer.
  22628. */
  22629. function cloneBuffer(buffer, isDeep) {
  22630. if (isDeep) {
  22631. return buffer.slice();
  22632. }
  22633. var length = buffer.length,
  22634. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22635. buffer.copy(result);
  22636. return result;
  22637. }
  22638. /**
  22639. * Creates a clone of `arrayBuffer`.
  22640. *
  22641. * @private
  22642. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22643. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22644. */
  22645. function cloneArrayBuffer(arrayBuffer) {
  22646. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22647. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22648. return result;
  22649. }
  22650. /**
  22651. * Creates a clone of `dataView`.
  22652. *
  22653. * @private
  22654. * @param {Object} dataView The data view to clone.
  22655. * @param {boolean} [isDeep] Specify a deep clone.
  22656. * @returns {Object} Returns the cloned data view.
  22657. */
  22658. function cloneDataView(dataView, isDeep) {
  22659. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22660. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22661. }
  22662. /**
  22663. * Creates a clone of `regexp`.
  22664. *
  22665. * @private
  22666. * @param {Object} regexp The regexp to clone.
  22667. * @returns {Object} Returns the cloned regexp.
  22668. */
  22669. function cloneRegExp(regexp) {
  22670. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22671. result.lastIndex = regexp.lastIndex;
  22672. return result;
  22673. }
  22674. /**
  22675. * Creates a clone of the `symbol` object.
  22676. *
  22677. * @private
  22678. * @param {Object} symbol The symbol object to clone.
  22679. * @returns {Object} Returns the cloned symbol object.
  22680. */
  22681. function cloneSymbol(symbol) {
  22682. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22683. }
  22684. /**
  22685. * Creates a clone of `typedArray`.
  22686. *
  22687. * @private
  22688. * @param {Object} typedArray The typed array to clone.
  22689. * @param {boolean} [isDeep] Specify a deep clone.
  22690. * @returns {Object} Returns the cloned typed array.
  22691. */
  22692. function cloneTypedArray(typedArray, isDeep) {
  22693. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22694. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22695. }
  22696. /**
  22697. * Compares values to sort them in ascending order.
  22698. *
  22699. * @private
  22700. * @param {*} value The value to compare.
  22701. * @param {*} other The other value to compare.
  22702. * @returns {number} Returns the sort order indicator for `value`.
  22703. */
  22704. function compareAscending(value, other) {
  22705. if (value !== other) {
  22706. var valIsDefined = value !== undefined,
  22707. valIsNull = value === null,
  22708. valIsReflexive = value === value,
  22709. valIsSymbol = isSymbol(value);
  22710. var othIsDefined = other !== undefined,
  22711. othIsNull = other === null,
  22712. othIsReflexive = other === other,
  22713. othIsSymbol = isSymbol(other);
  22714. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22715. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22716. (valIsNull && othIsDefined && othIsReflexive) ||
  22717. (!valIsDefined && othIsReflexive) ||
  22718. !valIsReflexive) {
  22719. return 1;
  22720. }
  22721. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22722. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22723. (othIsNull && valIsDefined && valIsReflexive) ||
  22724. (!othIsDefined && valIsReflexive) ||
  22725. !othIsReflexive) {
  22726. return -1;
  22727. }
  22728. }
  22729. return 0;
  22730. }
  22731. /**
  22732. * Used by `_.orderBy` to compare multiple properties of a value to another
  22733. * and stable sort them.
  22734. *
  22735. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22736. * specify an order of "desc" for descending or "asc" for ascending sort order
  22737. * of corresponding values.
  22738. *
  22739. * @private
  22740. * @param {Object} object The object to compare.
  22741. * @param {Object} other The other object to compare.
  22742. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22743. * @returns {number} Returns the sort order indicator for `object`.
  22744. */
  22745. function compareMultiple(object, other, orders) {
  22746. var index = -1,
  22747. objCriteria = object.criteria,
  22748. othCriteria = other.criteria,
  22749. length = objCriteria.length,
  22750. ordersLength = orders.length;
  22751. while (++index < length) {
  22752. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22753. if (result) {
  22754. if (index >= ordersLength) {
  22755. return result;
  22756. }
  22757. var order = orders[index];
  22758. return result * (order == 'desc' ? -1 : 1);
  22759. }
  22760. }
  22761. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22762. // that causes it, under certain circumstances, to provide the same value for
  22763. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22764. // for more details.
  22765. //
  22766. // This also ensures a stable sort in V8 and other engines.
  22767. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22768. return object.index - other.index;
  22769. }
  22770. /**
  22771. * Creates an array that is the composition of partially applied arguments,
  22772. * placeholders, and provided arguments into a single array of arguments.
  22773. *
  22774. * @private
  22775. * @param {Array} args The provided arguments.
  22776. * @param {Array} partials The arguments to prepend to those provided.
  22777. * @param {Array} holders The `partials` placeholder indexes.
  22778. * @params {boolean} [isCurried] Specify composing for a curried function.
  22779. * @returns {Array} Returns the new array of composed arguments.
  22780. */
  22781. function composeArgs(args, partials, holders, isCurried) {
  22782. var argsIndex = -1,
  22783. argsLength = args.length,
  22784. holdersLength = holders.length,
  22785. leftIndex = -1,
  22786. leftLength = partials.length,
  22787. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22788. result = Array(leftLength + rangeLength),
  22789. isUncurried = !isCurried;
  22790. while (++leftIndex < leftLength) {
  22791. result[leftIndex] = partials[leftIndex];
  22792. }
  22793. while (++argsIndex < holdersLength) {
  22794. if (isUncurried || argsIndex < argsLength) {
  22795. result[holders[argsIndex]] = args[argsIndex];
  22796. }
  22797. }
  22798. while (rangeLength--) {
  22799. result[leftIndex++] = args[argsIndex++];
  22800. }
  22801. return result;
  22802. }
  22803. /**
  22804. * This function is like `composeArgs` except that the arguments composition
  22805. * is tailored for `_.partialRight`.
  22806. *
  22807. * @private
  22808. * @param {Array} args The provided arguments.
  22809. * @param {Array} partials The arguments to append to those provided.
  22810. * @param {Array} holders The `partials` placeholder indexes.
  22811. * @params {boolean} [isCurried] Specify composing for a curried function.
  22812. * @returns {Array} Returns the new array of composed arguments.
  22813. */
  22814. function composeArgsRight(args, partials, holders, isCurried) {
  22815. var argsIndex = -1,
  22816. argsLength = args.length,
  22817. holdersIndex = -1,
  22818. holdersLength = holders.length,
  22819. rightIndex = -1,
  22820. rightLength = partials.length,
  22821. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22822. result = Array(rangeLength + rightLength),
  22823. isUncurried = !isCurried;
  22824. while (++argsIndex < rangeLength) {
  22825. result[argsIndex] = args[argsIndex];
  22826. }
  22827. var offset = argsIndex;
  22828. while (++rightIndex < rightLength) {
  22829. result[offset + rightIndex] = partials[rightIndex];
  22830. }
  22831. while (++holdersIndex < holdersLength) {
  22832. if (isUncurried || argsIndex < argsLength) {
  22833. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22834. }
  22835. }
  22836. return result;
  22837. }
  22838. /**
  22839. * Copies the values of `source` to `array`.
  22840. *
  22841. * @private
  22842. * @param {Array} source The array to copy values from.
  22843. * @param {Array} [array=[]] The array to copy values to.
  22844. * @returns {Array} Returns `array`.
  22845. */
  22846. function copyArray(source, array) {
  22847. var index = -1,
  22848. length = source.length;
  22849. array || (array = Array(length));
  22850. while (++index < length) {
  22851. array[index] = source[index];
  22852. }
  22853. return array;
  22854. }
  22855. /**
  22856. * Copies properties of `source` to `object`.
  22857. *
  22858. * @private
  22859. * @param {Object} source The object to copy properties from.
  22860. * @param {Array} props The property identifiers to copy.
  22861. * @param {Object} [object={}] The object to copy properties to.
  22862. * @param {Function} [customizer] The function to customize copied values.
  22863. * @returns {Object} Returns `object`.
  22864. */
  22865. function copyObject(source, props, object, customizer) {
  22866. var isNew = !object;
  22867. object || (object = {});
  22868. var index = -1,
  22869. length = props.length;
  22870. while (++index < length) {
  22871. var key = props[index];
  22872. var newValue = customizer
  22873. ? customizer(object[key], source[key], key, object, source)
  22874. : undefined;
  22875. if (newValue === undefined) {
  22876. newValue = source[key];
  22877. }
  22878. if (isNew) {
  22879. baseAssignValue(object, key, newValue);
  22880. } else {
  22881. assignValue(object, key, newValue);
  22882. }
  22883. }
  22884. return object;
  22885. }
  22886. /**
  22887. * Copies own symbols of `source` to `object`.
  22888. *
  22889. * @private
  22890. * @param {Object} source The object to copy symbols from.
  22891. * @param {Object} [object={}] The object to copy symbols to.
  22892. * @returns {Object} Returns `object`.
  22893. */
  22894. function copySymbols(source, object) {
  22895. return copyObject(source, getSymbols(source), object);
  22896. }
  22897. /**
  22898. * Copies own and inherited symbols of `source` to `object`.
  22899. *
  22900. * @private
  22901. * @param {Object} source The object to copy symbols from.
  22902. * @param {Object} [object={}] The object to copy symbols to.
  22903. * @returns {Object} Returns `object`.
  22904. */
  22905. function copySymbolsIn(source, object) {
  22906. return copyObject(source, getSymbolsIn(source), object);
  22907. }
  22908. /**
  22909. * Creates a function like `_.groupBy`.
  22910. *
  22911. * @private
  22912. * @param {Function} setter The function to set accumulator values.
  22913. * @param {Function} [initializer] The accumulator object initializer.
  22914. * @returns {Function} Returns the new aggregator function.
  22915. */
  22916. function createAggregator(setter, initializer) {
  22917. return function(collection, iteratee) {
  22918. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22919. accumulator = initializer ? initializer() : {};
  22920. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22921. };
  22922. }
  22923. /**
  22924. * Creates a function like `_.assign`.
  22925. *
  22926. * @private
  22927. * @param {Function} assigner The function to assign values.
  22928. * @returns {Function} Returns the new assigner function.
  22929. */
  22930. function createAssigner(assigner) {
  22931. return baseRest(function(object, sources) {
  22932. var index = -1,
  22933. length = sources.length,
  22934. customizer = length > 1 ? sources[length - 1] : undefined,
  22935. guard = length > 2 ? sources[2] : undefined;
  22936. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22937. ? (length--, customizer)
  22938. : undefined;
  22939. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22940. customizer = length < 3 ? undefined : customizer;
  22941. length = 1;
  22942. }
  22943. object = Object(object);
  22944. while (++index < length) {
  22945. var source = sources[index];
  22946. if (source) {
  22947. assigner(object, source, index, customizer);
  22948. }
  22949. }
  22950. return object;
  22951. });
  22952. }
  22953. /**
  22954. * Creates a `baseEach` or `baseEachRight` function.
  22955. *
  22956. * @private
  22957. * @param {Function} eachFunc The function to iterate over a collection.
  22958. * @param {boolean} [fromRight] Specify iterating from right to left.
  22959. * @returns {Function} Returns the new base function.
  22960. */
  22961. function createBaseEach(eachFunc, fromRight) {
  22962. return function(collection, iteratee) {
  22963. if (collection == null) {
  22964. return collection;
  22965. }
  22966. if (!isArrayLike(collection)) {
  22967. return eachFunc(collection, iteratee);
  22968. }
  22969. var length = collection.length,
  22970. index = fromRight ? length : -1,
  22971. iterable = Object(collection);
  22972. while ((fromRight ? index-- : ++index < length)) {
  22973. if (iteratee(iterable[index], index, iterable) === false) {
  22974. break;
  22975. }
  22976. }
  22977. return collection;
  22978. };
  22979. }
  22980. /**
  22981. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22982. *
  22983. * @private
  22984. * @param {boolean} [fromRight] Specify iterating from right to left.
  22985. * @returns {Function} Returns the new base function.
  22986. */
  22987. function createBaseFor(fromRight) {
  22988. return function(object, iteratee, keysFunc) {
  22989. var index = -1,
  22990. iterable = Object(object),
  22991. props = keysFunc(object),
  22992. length = props.length;
  22993. while (length--) {
  22994. var key = props[fromRight ? length : ++index];
  22995. if (iteratee(iterable[key], key, iterable) === false) {
  22996. break;
  22997. }
  22998. }
  22999. return object;
  23000. };
  23001. }
  23002. /**
  23003. * Creates a function that wraps `func` to invoke it with the optional `this`
  23004. * binding of `thisArg`.
  23005. *
  23006. * @private
  23007. * @param {Function} func The function to wrap.
  23008. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23009. * @param {*} [thisArg] The `this` binding of `func`.
  23010. * @returns {Function} Returns the new wrapped function.
  23011. */
  23012. function createBind(func, bitmask, thisArg) {
  23013. var isBind = bitmask & WRAP_BIND_FLAG,
  23014. Ctor = createCtor(func);
  23015. function wrapper() {
  23016. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23017. return fn.apply(isBind ? thisArg : this, arguments);
  23018. }
  23019. return wrapper;
  23020. }
  23021. /**
  23022. * Creates a function like `_.lowerFirst`.
  23023. *
  23024. * @private
  23025. * @param {string} methodName The name of the `String` case method to use.
  23026. * @returns {Function} Returns the new case function.
  23027. */
  23028. function createCaseFirst(methodName) {
  23029. return function(string) {
  23030. string = toString(string);
  23031. var strSymbols = hasUnicode(string)
  23032. ? stringToArray(string)
  23033. : undefined;
  23034. var chr = strSymbols
  23035. ? strSymbols[0]
  23036. : string.charAt(0);
  23037. var trailing = strSymbols
  23038. ? castSlice(strSymbols, 1).join('')
  23039. : string.slice(1);
  23040. return chr[methodName]() + trailing;
  23041. };
  23042. }
  23043. /**
  23044. * Creates a function like `_.camelCase`.
  23045. *
  23046. * @private
  23047. * @param {Function} callback The function to combine each word.
  23048. * @returns {Function} Returns the new compounder function.
  23049. */
  23050. function createCompounder(callback) {
  23051. return function(string) {
  23052. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23053. };
  23054. }
  23055. /**
  23056. * Creates a function that produces an instance of `Ctor` regardless of
  23057. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23058. *
  23059. * @private
  23060. * @param {Function} Ctor The constructor to wrap.
  23061. * @returns {Function} Returns the new wrapped function.
  23062. */
  23063. function createCtor(Ctor) {
  23064. return function() {
  23065. // Use a `switch` statement to work with class constructors. See
  23066. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23067. // for more details.
  23068. var args = arguments;
  23069. switch (args.length) {
  23070. case 0: return new Ctor;
  23071. case 1: return new Ctor(args[0]);
  23072. case 2: return new Ctor(args[0], args[1]);
  23073. case 3: return new Ctor(args[0], args[1], args[2]);
  23074. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23075. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23076. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23077. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23078. }
  23079. var thisBinding = baseCreate(Ctor.prototype),
  23080. result = Ctor.apply(thisBinding, args);
  23081. // Mimic the constructor's `return` behavior.
  23082. // See https://es5.github.io/#x13.2.2 for more details.
  23083. return isObject(result) ? result : thisBinding;
  23084. };
  23085. }
  23086. /**
  23087. * Creates a function that wraps `func` to enable currying.
  23088. *
  23089. * @private
  23090. * @param {Function} func The function to wrap.
  23091. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23092. * @param {number} arity The arity of `func`.
  23093. * @returns {Function} Returns the new wrapped function.
  23094. */
  23095. function createCurry(func, bitmask, arity) {
  23096. var Ctor = createCtor(func);
  23097. function wrapper() {
  23098. var length = arguments.length,
  23099. args = Array(length),
  23100. index = length,
  23101. placeholder = getHolder(wrapper);
  23102. while (index--) {
  23103. args[index] = arguments[index];
  23104. }
  23105. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23106. ? []
  23107. : replaceHolders(args, placeholder);
  23108. length -= holders.length;
  23109. if (length < arity) {
  23110. return createRecurry(
  23111. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23112. args, holders, undefined, undefined, arity - length);
  23113. }
  23114. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23115. return apply(fn, this, args);
  23116. }
  23117. return wrapper;
  23118. }
  23119. /**
  23120. * Creates a `_.find` or `_.findLast` function.
  23121. *
  23122. * @private
  23123. * @param {Function} findIndexFunc The function to find the collection index.
  23124. * @returns {Function} Returns the new find function.
  23125. */
  23126. function createFind(findIndexFunc) {
  23127. return function(collection, predicate, fromIndex) {
  23128. var iterable = Object(collection);
  23129. if (!isArrayLike(collection)) {
  23130. var iteratee = getIteratee(predicate, 3);
  23131. collection = keys(collection);
  23132. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23133. }
  23134. var index = findIndexFunc(collection, predicate, fromIndex);
  23135. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23136. };
  23137. }
  23138. /**
  23139. * Creates a `_.flow` or `_.flowRight` function.
  23140. *
  23141. * @private
  23142. * @param {boolean} [fromRight] Specify iterating from right to left.
  23143. * @returns {Function} Returns the new flow function.
  23144. */
  23145. function createFlow(fromRight) {
  23146. return flatRest(function(funcs) {
  23147. var length = funcs.length,
  23148. index = length,
  23149. prereq = LodashWrapper.prototype.thru;
  23150. if (fromRight) {
  23151. funcs.reverse();
  23152. }
  23153. while (index--) {
  23154. var func = funcs[index];
  23155. if (typeof func != 'function') {
  23156. throw new TypeError(FUNC_ERROR_TEXT);
  23157. }
  23158. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23159. var wrapper = new LodashWrapper([], true);
  23160. }
  23161. }
  23162. index = wrapper ? index : length;
  23163. while (++index < length) {
  23164. func = funcs[index];
  23165. var funcName = getFuncName(func),
  23166. data = funcName == 'wrapper' ? getData(func) : undefined;
  23167. if (data && isLaziable(data[0]) &&
  23168. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23169. !data[4].length && data[9] == 1
  23170. ) {
  23171. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23172. } else {
  23173. wrapper = (func.length == 1 && isLaziable(func))
  23174. ? wrapper[funcName]()
  23175. : wrapper.thru(func);
  23176. }
  23177. }
  23178. return function() {
  23179. var args = arguments,
  23180. value = args[0];
  23181. if (wrapper && args.length == 1 && isArray(value)) {
  23182. return wrapper.plant(value).value();
  23183. }
  23184. var index = 0,
  23185. result = length ? funcs[index].apply(this, args) : value;
  23186. while (++index < length) {
  23187. result = funcs[index].call(this, result);
  23188. }
  23189. return result;
  23190. };
  23191. });
  23192. }
  23193. /**
  23194. * Creates a function that wraps `func` to invoke it with optional `this`
  23195. * binding of `thisArg`, partial application, and currying.
  23196. *
  23197. * @private
  23198. * @param {Function|string} func The function or method name to wrap.
  23199. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23200. * @param {*} [thisArg] The `this` binding of `func`.
  23201. * @param {Array} [partials] The arguments to prepend to those provided to
  23202. * the new function.
  23203. * @param {Array} [holders] The `partials` placeholder indexes.
  23204. * @param {Array} [partialsRight] The arguments to append to those provided
  23205. * to the new function.
  23206. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23207. * @param {Array} [argPos] The argument positions of the new function.
  23208. * @param {number} [ary] The arity cap of `func`.
  23209. * @param {number} [arity] The arity of `func`.
  23210. * @returns {Function} Returns the new wrapped function.
  23211. */
  23212. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23213. var isAry = bitmask & WRAP_ARY_FLAG,
  23214. isBind = bitmask & WRAP_BIND_FLAG,
  23215. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23216. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23217. isFlip = bitmask & WRAP_FLIP_FLAG,
  23218. Ctor = isBindKey ? undefined : createCtor(func);
  23219. function wrapper() {
  23220. var length = arguments.length,
  23221. args = Array(length),
  23222. index = length;
  23223. while (index--) {
  23224. args[index] = arguments[index];
  23225. }
  23226. if (isCurried) {
  23227. var placeholder = getHolder(wrapper),
  23228. holdersCount = countHolders(args, placeholder);
  23229. }
  23230. if (partials) {
  23231. args = composeArgs(args, partials, holders, isCurried);
  23232. }
  23233. if (partialsRight) {
  23234. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23235. }
  23236. length -= holdersCount;
  23237. if (isCurried && length < arity) {
  23238. var newHolders = replaceHolders(args, placeholder);
  23239. return createRecurry(
  23240. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23241. args, newHolders, argPos, ary, arity - length
  23242. );
  23243. }
  23244. var thisBinding = isBind ? thisArg : this,
  23245. fn = isBindKey ? thisBinding[func] : func;
  23246. length = args.length;
  23247. if (argPos) {
  23248. args = reorder(args, argPos);
  23249. } else if (isFlip && length > 1) {
  23250. args.reverse();
  23251. }
  23252. if (isAry && ary < length) {
  23253. args.length = ary;
  23254. }
  23255. if (this && this !== root && this instanceof wrapper) {
  23256. fn = Ctor || createCtor(fn);
  23257. }
  23258. return fn.apply(thisBinding, args);
  23259. }
  23260. return wrapper;
  23261. }
  23262. /**
  23263. * Creates a function like `_.invertBy`.
  23264. *
  23265. * @private
  23266. * @param {Function} setter The function to set accumulator values.
  23267. * @param {Function} toIteratee The function to resolve iteratees.
  23268. * @returns {Function} Returns the new inverter function.
  23269. */
  23270. function createInverter(setter, toIteratee) {
  23271. return function(object, iteratee) {
  23272. return baseInverter(object, setter, toIteratee(iteratee), {});
  23273. };
  23274. }
  23275. /**
  23276. * Creates a function that performs a mathematical operation on two values.
  23277. *
  23278. * @private
  23279. * @param {Function} operator The function to perform the operation.
  23280. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23281. * @returns {Function} Returns the new mathematical operation function.
  23282. */
  23283. function createMathOperation(operator, defaultValue) {
  23284. return function(value, other) {
  23285. var result;
  23286. if (value === undefined && other === undefined) {
  23287. return defaultValue;
  23288. }
  23289. if (value !== undefined) {
  23290. result = value;
  23291. }
  23292. if (other !== undefined) {
  23293. if (result === undefined) {
  23294. return other;
  23295. }
  23296. if (typeof value == 'string' || typeof other == 'string') {
  23297. value = baseToString(value);
  23298. other = baseToString(other);
  23299. } else {
  23300. value = baseToNumber(value);
  23301. other = baseToNumber(other);
  23302. }
  23303. result = operator(value, other);
  23304. }
  23305. return result;
  23306. };
  23307. }
  23308. /**
  23309. * Creates a function like `_.over`.
  23310. *
  23311. * @private
  23312. * @param {Function} arrayFunc The function to iterate over iteratees.
  23313. * @returns {Function} Returns the new over function.
  23314. */
  23315. function createOver(arrayFunc) {
  23316. return flatRest(function(iteratees) {
  23317. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23318. return baseRest(function(args) {
  23319. var thisArg = this;
  23320. return arrayFunc(iteratees, function(iteratee) {
  23321. return apply(iteratee, thisArg, args);
  23322. });
  23323. });
  23324. });
  23325. }
  23326. /**
  23327. * Creates the padding for `string` based on `length`. The `chars` string
  23328. * is truncated if the number of characters exceeds `length`.
  23329. *
  23330. * @private
  23331. * @param {number} length The padding length.
  23332. * @param {string} [chars=' '] The string used as padding.
  23333. * @returns {string} Returns the padding for `string`.
  23334. */
  23335. function createPadding(length, chars) {
  23336. chars = chars === undefined ? ' ' : baseToString(chars);
  23337. var charsLength = chars.length;
  23338. if (charsLength < 2) {
  23339. return charsLength ? baseRepeat(chars, length) : chars;
  23340. }
  23341. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23342. return hasUnicode(chars)
  23343. ? castSlice(stringToArray(result), 0, length).join('')
  23344. : result.slice(0, length);
  23345. }
  23346. /**
  23347. * Creates a function that wraps `func` to invoke it with the `this` binding
  23348. * of `thisArg` and `partials` prepended to the arguments it receives.
  23349. *
  23350. * @private
  23351. * @param {Function} func The function to wrap.
  23352. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23353. * @param {*} thisArg The `this` binding of `func`.
  23354. * @param {Array} partials The arguments to prepend to those provided to
  23355. * the new function.
  23356. * @returns {Function} Returns the new wrapped function.
  23357. */
  23358. function createPartial(func, bitmask, thisArg, partials) {
  23359. var isBind = bitmask & WRAP_BIND_FLAG,
  23360. Ctor = createCtor(func);
  23361. function wrapper() {
  23362. var argsIndex = -1,
  23363. argsLength = arguments.length,
  23364. leftIndex = -1,
  23365. leftLength = partials.length,
  23366. args = Array(leftLength + argsLength),
  23367. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23368. while (++leftIndex < leftLength) {
  23369. args[leftIndex] = partials[leftIndex];
  23370. }
  23371. while (argsLength--) {
  23372. args[leftIndex++] = arguments[++argsIndex];
  23373. }
  23374. return apply(fn, isBind ? thisArg : this, args);
  23375. }
  23376. return wrapper;
  23377. }
  23378. /**
  23379. * Creates a `_.range` or `_.rangeRight` function.
  23380. *
  23381. * @private
  23382. * @param {boolean} [fromRight] Specify iterating from right to left.
  23383. * @returns {Function} Returns the new range function.
  23384. */
  23385. function createRange(fromRight) {
  23386. return function(start, end, step) {
  23387. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23388. end = step = undefined;
  23389. }
  23390. // Ensure the sign of `-0` is preserved.
  23391. start = toFinite(start);
  23392. if (end === undefined) {
  23393. end = start;
  23394. start = 0;
  23395. } else {
  23396. end = toFinite(end);
  23397. }
  23398. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23399. return baseRange(start, end, step, fromRight);
  23400. };
  23401. }
  23402. /**
  23403. * Creates a function that performs a relational operation on two values.
  23404. *
  23405. * @private
  23406. * @param {Function} operator The function to perform the operation.
  23407. * @returns {Function} Returns the new relational operation function.
  23408. */
  23409. function createRelationalOperation(operator) {
  23410. return function(value, other) {
  23411. if (!(typeof value == 'string' && typeof other == 'string')) {
  23412. value = toNumber(value);
  23413. other = toNumber(other);
  23414. }
  23415. return operator(value, other);
  23416. };
  23417. }
  23418. /**
  23419. * Creates a function that wraps `func` to continue currying.
  23420. *
  23421. * @private
  23422. * @param {Function} func The function to wrap.
  23423. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23424. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23425. * @param {*} placeholder The placeholder value.
  23426. * @param {*} [thisArg] The `this` binding of `func`.
  23427. * @param {Array} [partials] The arguments to prepend to those provided to
  23428. * the new function.
  23429. * @param {Array} [holders] The `partials` placeholder indexes.
  23430. * @param {Array} [argPos] The argument positions of the new function.
  23431. * @param {number} [ary] The arity cap of `func`.
  23432. * @param {number} [arity] The arity of `func`.
  23433. * @returns {Function} Returns the new wrapped function.
  23434. */
  23435. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23436. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23437. newHolders = isCurry ? holders : undefined,
  23438. newHoldersRight = isCurry ? undefined : holders,
  23439. newPartials = isCurry ? partials : undefined,
  23440. newPartialsRight = isCurry ? undefined : partials;
  23441. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23442. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23443. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23444. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23445. }
  23446. var newData = [
  23447. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23448. newHoldersRight, argPos, ary, arity
  23449. ];
  23450. var result = wrapFunc.apply(undefined, newData);
  23451. if (isLaziable(func)) {
  23452. setData(result, newData);
  23453. }
  23454. result.placeholder = placeholder;
  23455. return setWrapToString(result, func, bitmask);
  23456. }
  23457. /**
  23458. * Creates a function like `_.round`.
  23459. *
  23460. * @private
  23461. * @param {string} methodName The name of the `Math` method to use when rounding.
  23462. * @returns {Function} Returns the new round function.
  23463. */
  23464. function createRound(methodName) {
  23465. var func = Math[methodName];
  23466. return function(number, precision) {
  23467. number = toNumber(number);
  23468. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23469. if (precision && nativeIsFinite(number)) {
  23470. // Shift with exponential notation to avoid floating-point issues.
  23471. // See [MDN](https://mdn.io/round#Examples) for more details.
  23472. var pair = (toString(number) + 'e').split('e'),
  23473. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23474. pair = (toString(value) + 'e').split('e');
  23475. return +(pair[0] + 'e' + (+pair[1] - precision));
  23476. }
  23477. return func(number);
  23478. };
  23479. }
  23480. /**
  23481. * Creates a set object of `values`.
  23482. *
  23483. * @private
  23484. * @param {Array} values The values to add to the set.
  23485. * @returns {Object} Returns the new set.
  23486. */
  23487. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23488. return new Set(values);
  23489. };
  23490. /**
  23491. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23492. *
  23493. * @private
  23494. * @param {Function} keysFunc The function to get the keys of a given object.
  23495. * @returns {Function} Returns the new pairs function.
  23496. */
  23497. function createToPairs(keysFunc) {
  23498. return function(object) {
  23499. var tag = getTag(object);
  23500. if (tag == mapTag) {
  23501. return mapToArray(object);
  23502. }
  23503. if (tag == setTag) {
  23504. return setToPairs(object);
  23505. }
  23506. return baseToPairs(object, keysFunc(object));
  23507. };
  23508. }
  23509. /**
  23510. * Creates a function that either curries or invokes `func` with optional
  23511. * `this` binding and partially applied arguments.
  23512. *
  23513. * @private
  23514. * @param {Function|string} func The function or method name to wrap.
  23515. * @param {number} bitmask The bitmask flags.
  23516. * 1 - `_.bind`
  23517. * 2 - `_.bindKey`
  23518. * 4 - `_.curry` or `_.curryRight` of a bound function
  23519. * 8 - `_.curry`
  23520. * 16 - `_.curryRight`
  23521. * 32 - `_.partial`
  23522. * 64 - `_.partialRight`
  23523. * 128 - `_.rearg`
  23524. * 256 - `_.ary`
  23525. * 512 - `_.flip`
  23526. * @param {*} [thisArg] The `this` binding of `func`.
  23527. * @param {Array} [partials] The arguments to be partially applied.
  23528. * @param {Array} [holders] The `partials` placeholder indexes.
  23529. * @param {Array} [argPos] The argument positions of the new function.
  23530. * @param {number} [ary] The arity cap of `func`.
  23531. * @param {number} [arity] The arity of `func`.
  23532. * @returns {Function} Returns the new wrapped function.
  23533. */
  23534. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23535. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23536. if (!isBindKey && typeof func != 'function') {
  23537. throw new TypeError(FUNC_ERROR_TEXT);
  23538. }
  23539. var length = partials ? partials.length : 0;
  23540. if (!length) {
  23541. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23542. partials = holders = undefined;
  23543. }
  23544. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23545. arity = arity === undefined ? arity : toInteger(arity);
  23546. length -= holders ? holders.length : 0;
  23547. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23548. var partialsRight = partials,
  23549. holdersRight = holders;
  23550. partials = holders = undefined;
  23551. }
  23552. var data = isBindKey ? undefined : getData(func);
  23553. var newData = [
  23554. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23555. argPos, ary, arity
  23556. ];
  23557. if (data) {
  23558. mergeData(newData, data);
  23559. }
  23560. func = newData[0];
  23561. bitmask = newData[1];
  23562. thisArg = newData[2];
  23563. partials = newData[3];
  23564. holders = newData[4];
  23565. arity = newData[9] = newData[9] === undefined
  23566. ? (isBindKey ? 0 : func.length)
  23567. : nativeMax(newData[9] - length, 0);
  23568. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23569. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23570. }
  23571. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23572. var result = createBind(func, bitmask, thisArg);
  23573. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23574. result = createCurry(func, bitmask, arity);
  23575. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23576. result = createPartial(func, bitmask, thisArg, partials);
  23577. } else {
  23578. result = createHybrid.apply(undefined, newData);
  23579. }
  23580. var setter = data ? baseSetData : setData;
  23581. return setWrapToString(setter(result, newData), func, bitmask);
  23582. }
  23583. /**
  23584. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23585. * of source objects to the destination object for all destination properties
  23586. * that resolve to `undefined`.
  23587. *
  23588. * @private
  23589. * @param {*} objValue The destination value.
  23590. * @param {*} srcValue The source value.
  23591. * @param {string} key The key of the property to assign.
  23592. * @param {Object} object The parent object of `objValue`.
  23593. * @returns {*} Returns the value to assign.
  23594. */
  23595. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23596. if (objValue === undefined ||
  23597. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23598. return srcValue;
  23599. }
  23600. return objValue;
  23601. }
  23602. /**
  23603. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23604. * objects into destination objects that are passed thru.
  23605. *
  23606. * @private
  23607. * @param {*} objValue The destination value.
  23608. * @param {*} srcValue The source value.
  23609. * @param {string} key The key of the property to merge.
  23610. * @param {Object} object The parent object of `objValue`.
  23611. * @param {Object} source The parent object of `srcValue`.
  23612. * @param {Object} [stack] Tracks traversed source values and their merged
  23613. * counterparts.
  23614. * @returns {*} Returns the value to assign.
  23615. */
  23616. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23617. if (isObject(objValue) && isObject(srcValue)) {
  23618. // Recursively merge objects and arrays (susceptible to call stack limits).
  23619. stack.set(srcValue, objValue);
  23620. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23621. stack['delete'](srcValue);
  23622. }
  23623. return objValue;
  23624. }
  23625. /**
  23626. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23627. * objects.
  23628. *
  23629. * @private
  23630. * @param {*} value The value to inspect.
  23631. * @param {string} key The key of the property to inspect.
  23632. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23633. */
  23634. function customOmitClone(value) {
  23635. return isPlainObject(value) ? undefined : value;
  23636. }
  23637. /**
  23638. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23639. * partial deep comparisons.
  23640. *
  23641. * @private
  23642. * @param {Array} array The array to compare.
  23643. * @param {Array} other The other array 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 `array` and `other` objects.
  23648. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23649. */
  23650. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23651. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23652. arrLength = array.length,
  23653. othLength = other.length;
  23654. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23655. return false;
  23656. }
  23657. // Assume cyclic values are equal.
  23658. var stacked = stack.get(array);
  23659. if (stacked && stack.get(other)) {
  23660. return stacked == other;
  23661. }
  23662. var index = -1,
  23663. result = true,
  23664. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23665. stack.set(array, other);
  23666. stack.set(other, array);
  23667. // Ignore non-index properties.
  23668. while (++index < arrLength) {
  23669. var arrValue = array[index],
  23670. othValue = other[index];
  23671. if (customizer) {
  23672. var compared = isPartial
  23673. ? customizer(othValue, arrValue, index, other, array, stack)
  23674. : customizer(arrValue, othValue, index, array, other, stack);
  23675. }
  23676. if (compared !== undefined) {
  23677. if (compared) {
  23678. continue;
  23679. }
  23680. result = false;
  23681. break;
  23682. }
  23683. // Recursively compare arrays (susceptible to call stack limits).
  23684. if (seen) {
  23685. if (!arraySome(other, function(othValue, othIndex) {
  23686. if (!cacheHas(seen, othIndex) &&
  23687. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23688. return seen.push(othIndex);
  23689. }
  23690. })) {
  23691. result = false;
  23692. break;
  23693. }
  23694. } else if (!(
  23695. arrValue === othValue ||
  23696. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23697. )) {
  23698. result = false;
  23699. break;
  23700. }
  23701. }
  23702. stack['delete'](array);
  23703. stack['delete'](other);
  23704. return result;
  23705. }
  23706. /**
  23707. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23708. * the same `toStringTag`.
  23709. *
  23710. * **Note:** This function only supports comparing values with tags of
  23711. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23712. *
  23713. * @private
  23714. * @param {Object} object The object to compare.
  23715. * @param {Object} other The other object to compare.
  23716. * @param {string} tag The `toStringTag` of the objects to compare.
  23717. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23718. * @param {Function} customizer The function to customize comparisons.
  23719. * @param {Function} equalFunc The function to determine equivalents of values.
  23720. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23721. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23722. */
  23723. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23724. switch (tag) {
  23725. case dataViewTag:
  23726. if ((object.byteLength != other.byteLength) ||
  23727. (object.byteOffset != other.byteOffset)) {
  23728. return false;
  23729. }
  23730. object = object.buffer;
  23731. other = other.buffer;
  23732. case arrayBufferTag:
  23733. if ((object.byteLength != other.byteLength) ||
  23734. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23735. return false;
  23736. }
  23737. return true;
  23738. case boolTag:
  23739. case dateTag:
  23740. case numberTag:
  23741. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23742. // Invalid dates are coerced to `NaN`.
  23743. return eq(+object, +other);
  23744. case errorTag:
  23745. return object.name == other.name && object.message == other.message;
  23746. case regexpTag:
  23747. case stringTag:
  23748. // Coerce regexes to strings and treat strings, primitives and objects,
  23749. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23750. // for more details.
  23751. return object == (other + '');
  23752. case mapTag:
  23753. var convert = mapToArray;
  23754. case setTag:
  23755. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23756. convert || (convert = setToArray);
  23757. if (object.size != other.size && !isPartial) {
  23758. return false;
  23759. }
  23760. // Assume cyclic values are equal.
  23761. var stacked = stack.get(object);
  23762. if (stacked) {
  23763. return stacked == other;
  23764. }
  23765. bitmask |= COMPARE_UNORDERED_FLAG;
  23766. // Recursively compare objects (susceptible to call stack limits).
  23767. stack.set(object, other);
  23768. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23769. stack['delete'](object);
  23770. return result;
  23771. case symbolTag:
  23772. if (symbolValueOf) {
  23773. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23774. }
  23775. }
  23776. return false;
  23777. }
  23778. /**
  23779. * A specialized version of `baseIsEqualDeep` for objects with support for
  23780. * partial deep comparisons.
  23781. *
  23782. * @private
  23783. * @param {Object} object The object to compare.
  23784. * @param {Object} other The other object to compare.
  23785. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23786. * @param {Function} customizer The function to customize comparisons.
  23787. * @param {Function} equalFunc The function to determine equivalents of values.
  23788. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23789. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23790. */
  23791. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23792. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23793. objProps = getAllKeys(object),
  23794. objLength = objProps.length,
  23795. othProps = getAllKeys(other),
  23796. othLength = othProps.length;
  23797. if (objLength != othLength && !isPartial) {
  23798. return false;
  23799. }
  23800. var index = objLength;
  23801. while (index--) {
  23802. var key = objProps[index];
  23803. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23804. return false;
  23805. }
  23806. }
  23807. // Assume cyclic values are equal.
  23808. var stacked = stack.get(object);
  23809. if (stacked && stack.get(other)) {
  23810. return stacked == other;
  23811. }
  23812. var result = true;
  23813. stack.set(object, other);
  23814. stack.set(other, object);
  23815. var skipCtor = isPartial;
  23816. while (++index < objLength) {
  23817. key = objProps[index];
  23818. var objValue = object[key],
  23819. othValue = other[key];
  23820. if (customizer) {
  23821. var compared = isPartial
  23822. ? customizer(othValue, objValue, key, other, object, stack)
  23823. : customizer(objValue, othValue, key, object, other, stack);
  23824. }
  23825. // Recursively compare objects (susceptible to call stack limits).
  23826. if (!(compared === undefined
  23827. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23828. : compared
  23829. )) {
  23830. result = false;
  23831. break;
  23832. }
  23833. skipCtor || (skipCtor = key == 'constructor');
  23834. }
  23835. if (result && !skipCtor) {
  23836. var objCtor = object.constructor,
  23837. othCtor = other.constructor;
  23838. // Non `Object` object instances with different constructors are not equal.
  23839. if (objCtor != othCtor &&
  23840. ('constructor' in object && 'constructor' in other) &&
  23841. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23842. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23843. result = false;
  23844. }
  23845. }
  23846. stack['delete'](object);
  23847. stack['delete'](other);
  23848. return result;
  23849. }
  23850. /**
  23851. * A specialized version of `baseRest` which flattens the rest array.
  23852. *
  23853. * @private
  23854. * @param {Function} func The function to apply a rest parameter to.
  23855. * @returns {Function} Returns the new function.
  23856. */
  23857. function flatRest(func) {
  23858. return setToString(overRest(func, undefined, flatten), func + '');
  23859. }
  23860. /**
  23861. * Creates an array of own enumerable property names and symbols of `object`.
  23862. *
  23863. * @private
  23864. * @param {Object} object The object to query.
  23865. * @returns {Array} Returns the array of property names and symbols.
  23866. */
  23867. function getAllKeys(object) {
  23868. return baseGetAllKeys(object, keys, getSymbols);
  23869. }
  23870. /**
  23871. * Creates an array of own and inherited enumerable property names and
  23872. * symbols of `object`.
  23873. *
  23874. * @private
  23875. * @param {Object} object The object to query.
  23876. * @returns {Array} Returns the array of property names and symbols.
  23877. */
  23878. function getAllKeysIn(object) {
  23879. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23880. }
  23881. /**
  23882. * Gets metadata for `func`.
  23883. *
  23884. * @private
  23885. * @param {Function} func The function to query.
  23886. * @returns {*} Returns the metadata for `func`.
  23887. */
  23888. var getData = !metaMap ? noop : function(func) {
  23889. return metaMap.get(func);
  23890. };
  23891. /**
  23892. * Gets the name of `func`.
  23893. *
  23894. * @private
  23895. * @param {Function} func The function to query.
  23896. * @returns {string} Returns the function name.
  23897. */
  23898. function getFuncName(func) {
  23899. var result = (func.name + ''),
  23900. array = realNames[result],
  23901. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23902. while (length--) {
  23903. var data = array[length],
  23904. otherFunc = data.func;
  23905. if (otherFunc == null || otherFunc == func) {
  23906. return data.name;
  23907. }
  23908. }
  23909. return result;
  23910. }
  23911. /**
  23912. * Gets the argument placeholder value for `func`.
  23913. *
  23914. * @private
  23915. * @param {Function} func The function to inspect.
  23916. * @returns {*} Returns the placeholder value.
  23917. */
  23918. function getHolder(func) {
  23919. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23920. return object.placeholder;
  23921. }
  23922. /**
  23923. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23924. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23925. * If arguments are provided, the chosen function is invoked with them and
  23926. * its result is returned.
  23927. *
  23928. * @private
  23929. * @param {*} [value] The value to convert to an iteratee.
  23930. * @param {number} [arity] The arity of the created iteratee.
  23931. * @returns {Function} Returns the chosen function or its result.
  23932. */
  23933. function getIteratee() {
  23934. var result = lodash.iteratee || iteratee;
  23935. result = result === iteratee ? baseIteratee : result;
  23936. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23937. }
  23938. /**
  23939. * Gets the data for `map`.
  23940. *
  23941. * @private
  23942. * @param {Object} map The map to query.
  23943. * @param {string} key The reference key.
  23944. * @returns {*} Returns the map data.
  23945. */
  23946. function getMapData(map, key) {
  23947. var data = map.__data__;
  23948. return isKeyable(key)
  23949. ? data[typeof key == 'string' ? 'string' : 'hash']
  23950. : data.map;
  23951. }
  23952. /**
  23953. * Gets the property names, values, and compare flags of `object`.
  23954. *
  23955. * @private
  23956. * @param {Object} object The object to query.
  23957. * @returns {Array} Returns the match data of `object`.
  23958. */
  23959. function getMatchData(object) {
  23960. var result = keys(object),
  23961. length = result.length;
  23962. while (length--) {
  23963. var key = result[length],
  23964. value = object[key];
  23965. result[length] = [key, value, isStrictComparable(value)];
  23966. }
  23967. return result;
  23968. }
  23969. /**
  23970. * Gets the native function at `key` of `object`.
  23971. *
  23972. * @private
  23973. * @param {Object} object The object to query.
  23974. * @param {string} key The key of the method to get.
  23975. * @returns {*} Returns the function if it's native, else `undefined`.
  23976. */
  23977. function getNative(object, key) {
  23978. var value = getValue(object, key);
  23979. return baseIsNative(value) ? value : undefined;
  23980. }
  23981. /**
  23982. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23983. *
  23984. * @private
  23985. * @param {*} value The value to query.
  23986. * @returns {string} Returns the raw `toStringTag`.
  23987. */
  23988. function getRawTag(value) {
  23989. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23990. tag = value[symToStringTag];
  23991. try {
  23992. value[symToStringTag] = undefined;
  23993. var unmasked = true;
  23994. } catch (e) {}
  23995. var result = nativeObjectToString.call(value);
  23996. if (unmasked) {
  23997. if (isOwn) {
  23998. value[symToStringTag] = tag;
  23999. } else {
  24000. delete value[symToStringTag];
  24001. }
  24002. }
  24003. return result;
  24004. }
  24005. /**
  24006. * Creates an array of the own enumerable symbols of `object`.
  24007. *
  24008. * @private
  24009. * @param {Object} object The object to query.
  24010. * @returns {Array} Returns the array of symbols.
  24011. */
  24012. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24013. if (object == null) {
  24014. return [];
  24015. }
  24016. object = Object(object);
  24017. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24018. return propertyIsEnumerable.call(object, symbol);
  24019. });
  24020. };
  24021. /**
  24022. * Creates an array of the own and inherited enumerable symbols of `object`.
  24023. *
  24024. * @private
  24025. * @param {Object} object The object to query.
  24026. * @returns {Array} Returns the array of symbols.
  24027. */
  24028. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24029. var result = [];
  24030. while (object) {
  24031. arrayPush(result, getSymbols(object));
  24032. object = getPrototype(object);
  24033. }
  24034. return result;
  24035. };
  24036. /**
  24037. * Gets the `toStringTag` of `value`.
  24038. *
  24039. * @private
  24040. * @param {*} value The value to query.
  24041. * @returns {string} Returns the `toStringTag`.
  24042. */
  24043. var getTag = baseGetTag;
  24044. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24045. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24046. (Map && getTag(new Map) != mapTag) ||
  24047. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24048. (Set && getTag(new Set) != setTag) ||
  24049. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24050. getTag = function(value) {
  24051. var result = baseGetTag(value),
  24052. Ctor = result == objectTag ? value.constructor : undefined,
  24053. ctorString = Ctor ? toSource(Ctor) : '';
  24054. if (ctorString) {
  24055. switch (ctorString) {
  24056. case dataViewCtorString: return dataViewTag;
  24057. case mapCtorString: return mapTag;
  24058. case promiseCtorString: return promiseTag;
  24059. case setCtorString: return setTag;
  24060. case weakMapCtorString: return weakMapTag;
  24061. }
  24062. }
  24063. return result;
  24064. };
  24065. }
  24066. /**
  24067. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24068. *
  24069. * @private
  24070. * @param {number} start The start of the view.
  24071. * @param {number} end The end of the view.
  24072. * @param {Array} transforms The transformations to apply to the view.
  24073. * @returns {Object} Returns an object containing the `start` and `end`
  24074. * positions of the view.
  24075. */
  24076. function getView(start, end, transforms) {
  24077. var index = -1,
  24078. length = transforms.length;
  24079. while (++index < length) {
  24080. var data = transforms[index],
  24081. size = data.size;
  24082. switch (data.type) {
  24083. case 'drop': start += size; break;
  24084. case 'dropRight': end -= size; break;
  24085. case 'take': end = nativeMin(end, start + size); break;
  24086. case 'takeRight': start = nativeMax(start, end - size); break;
  24087. }
  24088. }
  24089. return { 'start': start, 'end': end };
  24090. }
  24091. /**
  24092. * Extracts wrapper details from the `source` body comment.
  24093. *
  24094. * @private
  24095. * @param {string} source The source to inspect.
  24096. * @returns {Array} Returns the wrapper details.
  24097. */
  24098. function getWrapDetails(source) {
  24099. var match = source.match(reWrapDetails);
  24100. return match ? match[1].split(reSplitDetails) : [];
  24101. }
  24102. /**
  24103. * Checks if `path` exists on `object`.
  24104. *
  24105. * @private
  24106. * @param {Object} object The object to query.
  24107. * @param {Array|string} path The path to check.
  24108. * @param {Function} hasFunc The function to check properties.
  24109. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24110. */
  24111. function hasPath(object, path, hasFunc) {
  24112. path = castPath(path, object);
  24113. var index = -1,
  24114. length = path.length,
  24115. result = false;
  24116. while (++index < length) {
  24117. var key = toKey(path[index]);
  24118. if (!(result = object != null && hasFunc(object, key))) {
  24119. break;
  24120. }
  24121. object = object[key];
  24122. }
  24123. if (result || ++index != length) {
  24124. return result;
  24125. }
  24126. length = object == null ? 0 : object.length;
  24127. return !!length && isLength(length) && isIndex(key, length) &&
  24128. (isArray(object) || isArguments(object));
  24129. }
  24130. /**
  24131. * Initializes an array clone.
  24132. *
  24133. * @private
  24134. * @param {Array} array The array to clone.
  24135. * @returns {Array} Returns the initialized clone.
  24136. */
  24137. function initCloneArray(array) {
  24138. var length = array.length,
  24139. result = new array.constructor(length);
  24140. // Add properties assigned by `RegExp#exec`.
  24141. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24142. result.index = array.index;
  24143. result.input = array.input;
  24144. }
  24145. return result;
  24146. }
  24147. /**
  24148. * Initializes an object clone.
  24149. *
  24150. * @private
  24151. * @param {Object} object The object to clone.
  24152. * @returns {Object} Returns the initialized clone.
  24153. */
  24154. function initCloneObject(object) {
  24155. return (typeof object.constructor == 'function' && !isPrototype(object))
  24156. ? baseCreate(getPrototype(object))
  24157. : {};
  24158. }
  24159. /**
  24160. * Initializes an object clone based on its `toStringTag`.
  24161. *
  24162. * **Note:** This function only supports cloning values with tags of
  24163. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24164. *
  24165. * @private
  24166. * @param {Object} object The object to clone.
  24167. * @param {string} tag The `toStringTag` of the object to clone.
  24168. * @param {boolean} [isDeep] Specify a deep clone.
  24169. * @returns {Object} Returns the initialized clone.
  24170. */
  24171. function initCloneByTag(object, tag, isDeep) {
  24172. var Ctor = object.constructor;
  24173. switch (tag) {
  24174. case arrayBufferTag:
  24175. return cloneArrayBuffer(object);
  24176. case boolTag:
  24177. case dateTag:
  24178. return new Ctor(+object);
  24179. case dataViewTag:
  24180. return cloneDataView(object, isDeep);
  24181. case float32Tag: case float64Tag:
  24182. case int8Tag: case int16Tag: case int32Tag:
  24183. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24184. return cloneTypedArray(object, isDeep);
  24185. case mapTag:
  24186. return new Ctor;
  24187. case numberTag:
  24188. case stringTag:
  24189. return new Ctor(object);
  24190. case regexpTag:
  24191. return cloneRegExp(object);
  24192. case setTag:
  24193. return new Ctor;
  24194. case symbolTag:
  24195. return cloneSymbol(object);
  24196. }
  24197. }
  24198. /**
  24199. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24200. *
  24201. * @private
  24202. * @param {string} source The source to modify.
  24203. * @returns {Array} details The details to insert.
  24204. * @returns {string} Returns the modified source.
  24205. */
  24206. function insertWrapDetails(source, details) {
  24207. var length = details.length;
  24208. if (!length) {
  24209. return source;
  24210. }
  24211. var lastIndex = length - 1;
  24212. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24213. details = details.join(length > 2 ? ', ' : ' ');
  24214. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24215. }
  24216. /**
  24217. * Checks if `value` is a flattenable `arguments` object or array.
  24218. *
  24219. * @private
  24220. * @param {*} value The value to check.
  24221. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24222. */
  24223. function isFlattenable(value) {
  24224. return isArray(value) || isArguments(value) ||
  24225. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24226. }
  24227. /**
  24228. * Checks if `value` is a valid array-like index.
  24229. *
  24230. * @private
  24231. * @param {*} value The value to check.
  24232. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24233. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24234. */
  24235. function isIndex(value, length) {
  24236. var type = typeof value;
  24237. length = length == null ? MAX_SAFE_INTEGER : length;
  24238. return !!length &&
  24239. (type == 'number' ||
  24240. (type != 'symbol' && reIsUint.test(value))) &&
  24241. (value > -1 && value % 1 == 0 && value < length);
  24242. }
  24243. /**
  24244. * Checks if the given arguments are from an iteratee call.
  24245. *
  24246. * @private
  24247. * @param {*} value The potential iteratee value argument.
  24248. * @param {*} index The potential iteratee index or key argument.
  24249. * @param {*} object The potential iteratee object argument.
  24250. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24251. * else `false`.
  24252. */
  24253. function isIterateeCall(value, index, object) {
  24254. if (!isObject(object)) {
  24255. return false;
  24256. }
  24257. var type = typeof index;
  24258. if (type == 'number'
  24259. ? (isArrayLike(object) && isIndex(index, object.length))
  24260. : (type == 'string' && index in object)
  24261. ) {
  24262. return eq(object[index], value);
  24263. }
  24264. return false;
  24265. }
  24266. /**
  24267. * Checks if `value` is a property name and not a property path.
  24268. *
  24269. * @private
  24270. * @param {*} value The value to check.
  24271. * @param {Object} [object] The object to query keys on.
  24272. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24273. */
  24274. function isKey(value, object) {
  24275. if (isArray(value)) {
  24276. return false;
  24277. }
  24278. var type = typeof value;
  24279. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24280. value == null || isSymbol(value)) {
  24281. return true;
  24282. }
  24283. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24284. (object != null && value in Object(object));
  24285. }
  24286. /**
  24287. * Checks if `value` is suitable for use as unique object key.
  24288. *
  24289. * @private
  24290. * @param {*} value The value to check.
  24291. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24292. */
  24293. function isKeyable(value) {
  24294. var type = typeof value;
  24295. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24296. ? (value !== '__proto__')
  24297. : (value === null);
  24298. }
  24299. /**
  24300. * Checks if `func` has a lazy counterpart.
  24301. *
  24302. * @private
  24303. * @param {Function} func The function to check.
  24304. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24305. * else `false`.
  24306. */
  24307. function isLaziable(func) {
  24308. var funcName = getFuncName(func),
  24309. other = lodash[funcName];
  24310. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24311. return false;
  24312. }
  24313. if (func === other) {
  24314. return true;
  24315. }
  24316. var data = getData(other);
  24317. return !!data && func === data[0];
  24318. }
  24319. /**
  24320. * Checks if `func` has its source masked.
  24321. *
  24322. * @private
  24323. * @param {Function} func The function to check.
  24324. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24325. */
  24326. function isMasked(func) {
  24327. return !!maskSrcKey && (maskSrcKey in func);
  24328. }
  24329. /**
  24330. * Checks if `func` is capable of being masked.
  24331. *
  24332. * @private
  24333. * @param {*} value The value to check.
  24334. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24335. */
  24336. var isMaskable = coreJsData ? isFunction : stubFalse;
  24337. /**
  24338. * Checks if `value` is likely a prototype object.
  24339. *
  24340. * @private
  24341. * @param {*} value The value to check.
  24342. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24343. */
  24344. function isPrototype(value) {
  24345. var Ctor = value && value.constructor,
  24346. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24347. return value === proto;
  24348. }
  24349. /**
  24350. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24351. *
  24352. * @private
  24353. * @param {*} value The value to check.
  24354. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24355. * equality comparisons, else `false`.
  24356. */
  24357. function isStrictComparable(value) {
  24358. return value === value && !isObject(value);
  24359. }
  24360. /**
  24361. * A specialized version of `matchesProperty` for source values suitable
  24362. * for strict equality comparisons, i.e. `===`.
  24363. *
  24364. * @private
  24365. * @param {string} key The key of the property to get.
  24366. * @param {*} srcValue The value to match.
  24367. * @returns {Function} Returns the new spec function.
  24368. */
  24369. function matchesStrictComparable(key, srcValue) {
  24370. return function(object) {
  24371. if (object == null) {
  24372. return false;
  24373. }
  24374. return object[key] === srcValue &&
  24375. (srcValue !== undefined || (key in Object(object)));
  24376. };
  24377. }
  24378. /**
  24379. * A specialized version of `_.memoize` which clears the memoized function's
  24380. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24381. *
  24382. * @private
  24383. * @param {Function} func The function to have its output memoized.
  24384. * @returns {Function} Returns the new memoized function.
  24385. */
  24386. function memoizeCapped(func) {
  24387. var result = memoize(func, function(key) {
  24388. if (cache.size === MAX_MEMOIZE_SIZE) {
  24389. cache.clear();
  24390. }
  24391. return key;
  24392. });
  24393. var cache = result.cache;
  24394. return result;
  24395. }
  24396. /**
  24397. * Merges the function metadata of `source` into `data`.
  24398. *
  24399. * Merging metadata reduces the number of wrappers used to invoke a function.
  24400. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24401. * may be applied regardless of execution order. Methods like `_.ary` and
  24402. * `_.rearg` modify function arguments, making the order in which they are
  24403. * executed important, preventing the merging of metadata. However, we make
  24404. * an exception for a safe combined case where curried functions have `_.ary`
  24405. * and or `_.rearg` applied.
  24406. *
  24407. * @private
  24408. * @param {Array} data The destination metadata.
  24409. * @param {Array} source The source metadata.
  24410. * @returns {Array} Returns `data`.
  24411. */
  24412. function mergeData(data, source) {
  24413. var bitmask = data[1],
  24414. srcBitmask = source[1],
  24415. newBitmask = bitmask | srcBitmask,
  24416. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24417. var isCombo =
  24418. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24419. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24420. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24421. // Exit early if metadata can't be merged.
  24422. if (!(isCommon || isCombo)) {
  24423. return data;
  24424. }
  24425. // Use source `thisArg` if available.
  24426. if (srcBitmask & WRAP_BIND_FLAG) {
  24427. data[2] = source[2];
  24428. // Set when currying a bound function.
  24429. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24430. }
  24431. // Compose partial arguments.
  24432. var value = source[3];
  24433. if (value) {
  24434. var partials = data[3];
  24435. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24436. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24437. }
  24438. // Compose partial right arguments.
  24439. value = source[5];
  24440. if (value) {
  24441. partials = data[5];
  24442. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24443. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24444. }
  24445. // Use source `argPos` if available.
  24446. value = source[7];
  24447. if (value) {
  24448. data[7] = value;
  24449. }
  24450. // Use source `ary` if it's smaller.
  24451. if (srcBitmask & WRAP_ARY_FLAG) {
  24452. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24453. }
  24454. // Use source `arity` if one is not provided.
  24455. if (data[9] == null) {
  24456. data[9] = source[9];
  24457. }
  24458. // Use source `func` and merge bitmasks.
  24459. data[0] = source[0];
  24460. data[1] = newBitmask;
  24461. return data;
  24462. }
  24463. /**
  24464. * This function is like
  24465. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24466. * except that it includes inherited enumerable properties.
  24467. *
  24468. * @private
  24469. * @param {Object} object The object to query.
  24470. * @returns {Array} Returns the array of property names.
  24471. */
  24472. function nativeKeysIn(object) {
  24473. var result = [];
  24474. if (object != null) {
  24475. for (var key in Object(object)) {
  24476. result.push(key);
  24477. }
  24478. }
  24479. return result;
  24480. }
  24481. /**
  24482. * Converts `value` to a string using `Object.prototype.toString`.
  24483. *
  24484. * @private
  24485. * @param {*} value The value to convert.
  24486. * @returns {string} Returns the converted string.
  24487. */
  24488. function objectToString(value) {
  24489. return nativeObjectToString.call(value);
  24490. }
  24491. /**
  24492. * A specialized version of `baseRest` which transforms the rest array.
  24493. *
  24494. * @private
  24495. * @param {Function} func The function to apply a rest parameter to.
  24496. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24497. * @param {Function} transform The rest array transform.
  24498. * @returns {Function} Returns the new function.
  24499. */
  24500. function overRest(func, start, transform) {
  24501. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24502. return function() {
  24503. var args = arguments,
  24504. index = -1,
  24505. length = nativeMax(args.length - start, 0),
  24506. array = Array(length);
  24507. while (++index < length) {
  24508. array[index] = args[start + index];
  24509. }
  24510. index = -1;
  24511. var otherArgs = Array(start + 1);
  24512. while (++index < start) {
  24513. otherArgs[index] = args[index];
  24514. }
  24515. otherArgs[start] = transform(array);
  24516. return apply(func, this, otherArgs);
  24517. };
  24518. }
  24519. /**
  24520. * Gets the parent value at `path` of `object`.
  24521. *
  24522. * @private
  24523. * @param {Object} object The object to query.
  24524. * @param {Array} path The path to get the parent value of.
  24525. * @returns {*} Returns the parent value.
  24526. */
  24527. function parent(object, path) {
  24528. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24529. }
  24530. /**
  24531. * Reorder `array` according to the specified indexes where the element at
  24532. * the first index is assigned as the first element, the element at
  24533. * the second index is assigned as the second element, and so on.
  24534. *
  24535. * @private
  24536. * @param {Array} array The array to reorder.
  24537. * @param {Array} indexes The arranged array indexes.
  24538. * @returns {Array} Returns `array`.
  24539. */
  24540. function reorder(array, indexes) {
  24541. var arrLength = array.length,
  24542. length = nativeMin(indexes.length, arrLength),
  24543. oldArray = copyArray(array);
  24544. while (length--) {
  24545. var index = indexes[length];
  24546. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24547. }
  24548. return array;
  24549. }
  24550. /**
  24551. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24552. *
  24553. * @private
  24554. * @param {Object} object The object to query.
  24555. * @param {string} key The key of the property to get.
  24556. * @returns {*} Returns the property value.
  24557. */
  24558. function safeGet(object, key) {
  24559. if (key === 'constructor' && typeof object[key] === 'function') {
  24560. return;
  24561. }
  24562. if (key == '__proto__') {
  24563. return;
  24564. }
  24565. return object[key];
  24566. }
  24567. /**
  24568. * Sets metadata for `func`.
  24569. *
  24570. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24571. * period of time, it will trip its breaker and transition to an identity
  24572. * function to avoid garbage collection pauses in V8. See
  24573. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24574. * for more details.
  24575. *
  24576. * @private
  24577. * @param {Function} func The function to associate metadata with.
  24578. * @param {*} data The metadata.
  24579. * @returns {Function} Returns `func`.
  24580. */
  24581. var setData = shortOut(baseSetData);
  24582. /**
  24583. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24584. *
  24585. * @private
  24586. * @param {Function} func The function to delay.
  24587. * @param {number} wait The number of milliseconds to delay invocation.
  24588. * @returns {number|Object} Returns the timer id or timeout object.
  24589. */
  24590. var setTimeout = ctxSetTimeout || function(func, wait) {
  24591. return root.setTimeout(func, wait);
  24592. };
  24593. /**
  24594. * Sets the `toString` method of `func` to return `string`.
  24595. *
  24596. * @private
  24597. * @param {Function} func The function to modify.
  24598. * @param {Function} string The `toString` result.
  24599. * @returns {Function} Returns `func`.
  24600. */
  24601. var setToString = shortOut(baseSetToString);
  24602. /**
  24603. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24604. * with wrapper details in a comment at the top of the source body.
  24605. *
  24606. * @private
  24607. * @param {Function} wrapper The function to modify.
  24608. * @param {Function} reference The reference function.
  24609. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24610. * @returns {Function} Returns `wrapper`.
  24611. */
  24612. function setWrapToString(wrapper, reference, bitmask) {
  24613. var source = (reference + '');
  24614. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24615. }
  24616. /**
  24617. * Creates a function that'll short out and invoke `identity` instead
  24618. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24619. * milliseconds.
  24620. *
  24621. * @private
  24622. * @param {Function} func The function to restrict.
  24623. * @returns {Function} Returns the new shortable function.
  24624. */
  24625. function shortOut(func) {
  24626. var count = 0,
  24627. lastCalled = 0;
  24628. return function() {
  24629. var stamp = nativeNow(),
  24630. remaining = HOT_SPAN - (stamp - lastCalled);
  24631. lastCalled = stamp;
  24632. if (remaining > 0) {
  24633. if (++count >= HOT_COUNT) {
  24634. return arguments[0];
  24635. }
  24636. } else {
  24637. count = 0;
  24638. }
  24639. return func.apply(undefined, arguments);
  24640. };
  24641. }
  24642. /**
  24643. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24644. *
  24645. * @private
  24646. * @param {Array} array The array to shuffle.
  24647. * @param {number} [size=array.length] The size of `array`.
  24648. * @returns {Array} Returns `array`.
  24649. */
  24650. function shuffleSelf(array, size) {
  24651. var index = -1,
  24652. length = array.length,
  24653. lastIndex = length - 1;
  24654. size = size === undefined ? length : size;
  24655. while (++index < size) {
  24656. var rand = baseRandom(index, lastIndex),
  24657. value = array[rand];
  24658. array[rand] = array[index];
  24659. array[index] = value;
  24660. }
  24661. array.length = size;
  24662. return array;
  24663. }
  24664. /**
  24665. * Converts `string` to a property path array.
  24666. *
  24667. * @private
  24668. * @param {string} string The string to convert.
  24669. * @returns {Array} Returns the property path array.
  24670. */
  24671. var stringToPath = memoizeCapped(function(string) {
  24672. var result = [];
  24673. if (string.charCodeAt(0) === 46 /* . */) {
  24674. result.push('');
  24675. }
  24676. string.replace(rePropName, function(match, number, quote, subString) {
  24677. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24678. });
  24679. return result;
  24680. });
  24681. /**
  24682. * Converts `value` to a string key if it's not a string or symbol.
  24683. *
  24684. * @private
  24685. * @param {*} value The value to inspect.
  24686. * @returns {string|symbol} Returns the key.
  24687. */
  24688. function toKey(value) {
  24689. if (typeof value == 'string' || isSymbol(value)) {
  24690. return value;
  24691. }
  24692. var result = (value + '');
  24693. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24694. }
  24695. /**
  24696. * Converts `func` to its source code.
  24697. *
  24698. * @private
  24699. * @param {Function} func The function to convert.
  24700. * @returns {string} Returns the source code.
  24701. */
  24702. function toSource(func) {
  24703. if (func != null) {
  24704. try {
  24705. return funcToString.call(func);
  24706. } catch (e) {}
  24707. try {
  24708. return (func + '');
  24709. } catch (e) {}
  24710. }
  24711. return '';
  24712. }
  24713. /**
  24714. * Updates wrapper `details` based on `bitmask` flags.
  24715. *
  24716. * @private
  24717. * @returns {Array} details The details to modify.
  24718. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24719. * @returns {Array} Returns `details`.
  24720. */
  24721. function updateWrapDetails(details, bitmask) {
  24722. arrayEach(wrapFlags, function(pair) {
  24723. var value = '_.' + pair[0];
  24724. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24725. details.push(value);
  24726. }
  24727. });
  24728. return details.sort();
  24729. }
  24730. /**
  24731. * Creates a clone of `wrapper`.
  24732. *
  24733. * @private
  24734. * @param {Object} wrapper The wrapper to clone.
  24735. * @returns {Object} Returns the cloned wrapper.
  24736. */
  24737. function wrapperClone(wrapper) {
  24738. if (wrapper instanceof LazyWrapper) {
  24739. return wrapper.clone();
  24740. }
  24741. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24742. result.__actions__ = copyArray(wrapper.__actions__);
  24743. result.__index__ = wrapper.__index__;
  24744. result.__values__ = wrapper.__values__;
  24745. return result;
  24746. }
  24747. /*------------------------------------------------------------------------*/
  24748. /**
  24749. * Creates an array of elements split into groups the length of `size`.
  24750. * If `array` can't be split evenly, the final chunk will be the remaining
  24751. * elements.
  24752. *
  24753. * @static
  24754. * @memberOf _
  24755. * @since 3.0.0
  24756. * @category Array
  24757. * @param {Array} array The array to process.
  24758. * @param {number} [size=1] The length of each chunk
  24759. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24760. * @returns {Array} Returns the new array of chunks.
  24761. * @example
  24762. *
  24763. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24764. * // => [['a', 'b'], ['c', 'd']]
  24765. *
  24766. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24767. * // => [['a', 'b', 'c'], ['d']]
  24768. */
  24769. function chunk(array, size, guard) {
  24770. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24771. size = 1;
  24772. } else {
  24773. size = nativeMax(toInteger(size), 0);
  24774. }
  24775. var length = array == null ? 0 : array.length;
  24776. if (!length || size < 1) {
  24777. return [];
  24778. }
  24779. var index = 0,
  24780. resIndex = 0,
  24781. result = Array(nativeCeil(length / size));
  24782. while (index < length) {
  24783. result[resIndex++] = baseSlice(array, index, (index += size));
  24784. }
  24785. return result;
  24786. }
  24787. /**
  24788. * Creates an array with all falsey values removed. The values `false`, `null`,
  24789. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24790. *
  24791. * @static
  24792. * @memberOf _
  24793. * @since 0.1.0
  24794. * @category Array
  24795. * @param {Array} array The array to compact.
  24796. * @returns {Array} Returns the new array of filtered values.
  24797. * @example
  24798. *
  24799. * _.compact([0, 1, false, 2, '', 3]);
  24800. * // => [1, 2, 3]
  24801. */
  24802. function compact(array) {
  24803. var index = -1,
  24804. length = array == null ? 0 : array.length,
  24805. resIndex = 0,
  24806. result = [];
  24807. while (++index < length) {
  24808. var value = array[index];
  24809. if (value) {
  24810. result[resIndex++] = value;
  24811. }
  24812. }
  24813. return result;
  24814. }
  24815. /**
  24816. * Creates a new array concatenating `array` with any additional arrays
  24817. * and/or values.
  24818. *
  24819. * @static
  24820. * @memberOf _
  24821. * @since 4.0.0
  24822. * @category Array
  24823. * @param {Array} array The array to concatenate.
  24824. * @param {...*} [values] The values to concatenate.
  24825. * @returns {Array} Returns the new concatenated array.
  24826. * @example
  24827. *
  24828. * var array = [1];
  24829. * var other = _.concat(array, 2, [3], [[4]]);
  24830. *
  24831. * console.log(other);
  24832. * // => [1, 2, 3, [4]]
  24833. *
  24834. * console.log(array);
  24835. * // => [1]
  24836. */
  24837. function concat() {
  24838. var length = arguments.length;
  24839. if (!length) {
  24840. return [];
  24841. }
  24842. var args = Array(length - 1),
  24843. array = arguments[0],
  24844. index = length;
  24845. while (index--) {
  24846. args[index - 1] = arguments[index];
  24847. }
  24848. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24849. }
  24850. /**
  24851. * Creates an array of `array` values not included in the other given arrays
  24852. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24853. * for equality comparisons. The order and references of result values are
  24854. * determined by the first array.
  24855. *
  24856. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24857. *
  24858. * @static
  24859. * @memberOf _
  24860. * @since 0.1.0
  24861. * @category Array
  24862. * @param {Array} array The array to inspect.
  24863. * @param {...Array} [values] The values to exclude.
  24864. * @returns {Array} Returns the new array of filtered values.
  24865. * @see _.without, _.xor
  24866. * @example
  24867. *
  24868. * _.difference([2, 1], [2, 3]);
  24869. * // => [1]
  24870. */
  24871. var difference = baseRest(function(array, values) {
  24872. return isArrayLikeObject(array)
  24873. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24874. : [];
  24875. });
  24876. /**
  24877. * This method is like `_.difference` except that it accepts `iteratee` which
  24878. * is invoked for each element of `array` and `values` to generate the criterion
  24879. * by which they're compared. The order and references of result values are
  24880. * determined by the first array. The iteratee is invoked with one argument:
  24881. * (value).
  24882. *
  24883. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24884. *
  24885. * @static
  24886. * @memberOf _
  24887. * @since 4.0.0
  24888. * @category Array
  24889. * @param {Array} array The array to inspect.
  24890. * @param {...Array} [values] The values to exclude.
  24891. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24892. * @returns {Array} Returns the new array of filtered values.
  24893. * @example
  24894. *
  24895. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24896. * // => [1.2]
  24897. *
  24898. * // The `_.property` iteratee shorthand.
  24899. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24900. * // => [{ 'x': 2 }]
  24901. */
  24902. var differenceBy = baseRest(function(array, values) {
  24903. var iteratee = last(values);
  24904. if (isArrayLikeObject(iteratee)) {
  24905. iteratee = undefined;
  24906. }
  24907. return isArrayLikeObject(array)
  24908. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24909. : [];
  24910. });
  24911. /**
  24912. * This method is like `_.difference` except that it accepts `comparator`
  24913. * which is invoked to compare elements of `array` to `values`. The order and
  24914. * references of result values are determined by the first array. The comparator
  24915. * is invoked with two arguments: (arrVal, othVal).
  24916. *
  24917. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24918. *
  24919. * @static
  24920. * @memberOf _
  24921. * @since 4.0.0
  24922. * @category Array
  24923. * @param {Array} array The array to inspect.
  24924. * @param {...Array} [values] The values to exclude.
  24925. * @param {Function} [comparator] The comparator invoked per element.
  24926. * @returns {Array} Returns the new array of filtered values.
  24927. * @example
  24928. *
  24929. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24930. *
  24931. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24932. * // => [{ 'x': 2, 'y': 1 }]
  24933. */
  24934. var differenceWith = baseRest(function(array, values) {
  24935. var comparator = last(values);
  24936. if (isArrayLikeObject(comparator)) {
  24937. comparator = undefined;
  24938. }
  24939. return isArrayLikeObject(array)
  24940. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24941. : [];
  24942. });
  24943. /**
  24944. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24945. *
  24946. * @static
  24947. * @memberOf _
  24948. * @since 0.5.0
  24949. * @category Array
  24950. * @param {Array} array The array to query.
  24951. * @param {number} [n=1] The number of elements to drop.
  24952. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24953. * @returns {Array} Returns the slice of `array`.
  24954. * @example
  24955. *
  24956. * _.drop([1, 2, 3]);
  24957. * // => [2, 3]
  24958. *
  24959. * _.drop([1, 2, 3], 2);
  24960. * // => [3]
  24961. *
  24962. * _.drop([1, 2, 3], 5);
  24963. * // => []
  24964. *
  24965. * _.drop([1, 2, 3], 0);
  24966. * // => [1, 2, 3]
  24967. */
  24968. function drop(array, n, guard) {
  24969. var length = array == null ? 0 : array.length;
  24970. if (!length) {
  24971. return [];
  24972. }
  24973. n = (guard || n === undefined) ? 1 : toInteger(n);
  24974. return baseSlice(array, n < 0 ? 0 : n, length);
  24975. }
  24976. /**
  24977. * Creates a slice of `array` with `n` elements dropped from the end.
  24978. *
  24979. * @static
  24980. * @memberOf _
  24981. * @since 3.0.0
  24982. * @category Array
  24983. * @param {Array} array The array to query.
  24984. * @param {number} [n=1] The number of elements to drop.
  24985. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24986. * @returns {Array} Returns the slice of `array`.
  24987. * @example
  24988. *
  24989. * _.dropRight([1, 2, 3]);
  24990. * // => [1, 2]
  24991. *
  24992. * _.dropRight([1, 2, 3], 2);
  24993. * // => [1]
  24994. *
  24995. * _.dropRight([1, 2, 3], 5);
  24996. * // => []
  24997. *
  24998. * _.dropRight([1, 2, 3], 0);
  24999. * // => [1, 2, 3]
  25000. */
  25001. function dropRight(array, n, guard) {
  25002. var length = array == null ? 0 : array.length;
  25003. if (!length) {
  25004. return [];
  25005. }
  25006. n = (guard || n === undefined) ? 1 : toInteger(n);
  25007. n = length - n;
  25008. return baseSlice(array, 0, n < 0 ? 0 : n);
  25009. }
  25010. /**
  25011. * Creates a slice of `array` excluding elements dropped from the end.
  25012. * Elements are dropped until `predicate` returns falsey. The predicate is
  25013. * invoked with three arguments: (value, index, array).
  25014. *
  25015. * @static
  25016. * @memberOf _
  25017. * @since 3.0.0
  25018. * @category Array
  25019. * @param {Array} array The array to query.
  25020. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25021. * @returns {Array} Returns the slice of `array`.
  25022. * @example
  25023. *
  25024. * var users = [
  25025. * { 'user': 'barney', 'active': true },
  25026. * { 'user': 'fred', 'active': false },
  25027. * { 'user': 'pebbles', 'active': false }
  25028. * ];
  25029. *
  25030. * _.dropRightWhile(users, function(o) { return !o.active; });
  25031. * // => objects for ['barney']
  25032. *
  25033. * // The `_.matches` iteratee shorthand.
  25034. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25035. * // => objects for ['barney', 'fred']
  25036. *
  25037. * // The `_.matchesProperty` iteratee shorthand.
  25038. * _.dropRightWhile(users, ['active', false]);
  25039. * // => objects for ['barney']
  25040. *
  25041. * // The `_.property` iteratee shorthand.
  25042. * _.dropRightWhile(users, 'active');
  25043. * // => objects for ['barney', 'fred', 'pebbles']
  25044. */
  25045. function dropRightWhile(array, predicate) {
  25046. return (array && array.length)
  25047. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25048. : [];
  25049. }
  25050. /**
  25051. * Creates a slice of `array` excluding elements dropped from the beginning.
  25052. * Elements are dropped until `predicate` returns falsey. The predicate is
  25053. * invoked with three arguments: (value, index, array).
  25054. *
  25055. * @static
  25056. * @memberOf _
  25057. * @since 3.0.0
  25058. * @category Array
  25059. * @param {Array} array The array to query.
  25060. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25061. * @returns {Array} Returns the slice of `array`.
  25062. * @example
  25063. *
  25064. * var users = [
  25065. * { 'user': 'barney', 'active': false },
  25066. * { 'user': 'fred', 'active': false },
  25067. * { 'user': 'pebbles', 'active': true }
  25068. * ];
  25069. *
  25070. * _.dropWhile(users, function(o) { return !o.active; });
  25071. * // => objects for ['pebbles']
  25072. *
  25073. * // The `_.matches` iteratee shorthand.
  25074. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25075. * // => objects for ['fred', 'pebbles']
  25076. *
  25077. * // The `_.matchesProperty` iteratee shorthand.
  25078. * _.dropWhile(users, ['active', false]);
  25079. * // => objects for ['pebbles']
  25080. *
  25081. * // The `_.property` iteratee shorthand.
  25082. * _.dropWhile(users, 'active');
  25083. * // => objects for ['barney', 'fred', 'pebbles']
  25084. */
  25085. function dropWhile(array, predicate) {
  25086. return (array && array.length)
  25087. ? baseWhile(array, getIteratee(predicate, 3), true)
  25088. : [];
  25089. }
  25090. /**
  25091. * Fills elements of `array` with `value` from `start` up to, but not
  25092. * including, `end`.
  25093. *
  25094. * **Note:** This method mutates `array`.
  25095. *
  25096. * @static
  25097. * @memberOf _
  25098. * @since 3.2.0
  25099. * @category Array
  25100. * @param {Array} array The array to fill.
  25101. * @param {*} value The value to fill `array` with.
  25102. * @param {number} [start=0] The start position.
  25103. * @param {number} [end=array.length] The end position.
  25104. * @returns {Array} Returns `array`.
  25105. * @example
  25106. *
  25107. * var array = [1, 2, 3];
  25108. *
  25109. * _.fill(array, 'a');
  25110. * console.log(array);
  25111. * // => ['a', 'a', 'a']
  25112. *
  25113. * _.fill(Array(3), 2);
  25114. * // => [2, 2, 2]
  25115. *
  25116. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25117. * // => [4, '*', '*', 10]
  25118. */
  25119. function fill(array, value, start, end) {
  25120. var length = array == null ? 0 : array.length;
  25121. if (!length) {
  25122. return [];
  25123. }
  25124. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25125. start = 0;
  25126. end = length;
  25127. }
  25128. return baseFill(array, value, start, end);
  25129. }
  25130. /**
  25131. * This method is like `_.find` except that it returns the index of the first
  25132. * element `predicate` returns truthy for instead of the element itself.
  25133. *
  25134. * @static
  25135. * @memberOf _
  25136. * @since 1.1.0
  25137. * @category Array
  25138. * @param {Array} array The array to inspect.
  25139. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25140. * @param {number} [fromIndex=0] The index to search from.
  25141. * @returns {number} Returns the index of the found element, else `-1`.
  25142. * @example
  25143. *
  25144. * var users = [
  25145. * { 'user': 'barney', 'active': false },
  25146. * { 'user': 'fred', 'active': false },
  25147. * { 'user': 'pebbles', 'active': true }
  25148. * ];
  25149. *
  25150. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25151. * // => 0
  25152. *
  25153. * // The `_.matches` iteratee shorthand.
  25154. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25155. * // => 1
  25156. *
  25157. * // The `_.matchesProperty` iteratee shorthand.
  25158. * _.findIndex(users, ['active', false]);
  25159. * // => 0
  25160. *
  25161. * // The `_.property` iteratee shorthand.
  25162. * _.findIndex(users, 'active');
  25163. * // => 2
  25164. */
  25165. function findIndex(array, predicate, fromIndex) {
  25166. var length = array == null ? 0 : array.length;
  25167. if (!length) {
  25168. return -1;
  25169. }
  25170. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25171. if (index < 0) {
  25172. index = nativeMax(length + index, 0);
  25173. }
  25174. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25175. }
  25176. /**
  25177. * This method is like `_.findIndex` except that it iterates over elements
  25178. * of `collection` from right to left.
  25179. *
  25180. * @static
  25181. * @memberOf _
  25182. * @since 2.0.0
  25183. * @category Array
  25184. * @param {Array} array The array to inspect.
  25185. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25186. * @param {number} [fromIndex=array.length-1] The index to search from.
  25187. * @returns {number} Returns the index of the found element, else `-1`.
  25188. * @example
  25189. *
  25190. * var users = [
  25191. * { 'user': 'barney', 'active': true },
  25192. * { 'user': 'fred', 'active': false },
  25193. * { 'user': 'pebbles', 'active': false }
  25194. * ];
  25195. *
  25196. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25197. * // => 2
  25198. *
  25199. * // The `_.matches` iteratee shorthand.
  25200. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25201. * // => 0
  25202. *
  25203. * // The `_.matchesProperty` iteratee shorthand.
  25204. * _.findLastIndex(users, ['active', false]);
  25205. * // => 2
  25206. *
  25207. * // The `_.property` iteratee shorthand.
  25208. * _.findLastIndex(users, 'active');
  25209. * // => 0
  25210. */
  25211. function findLastIndex(array, predicate, fromIndex) {
  25212. var length = array == null ? 0 : array.length;
  25213. if (!length) {
  25214. return -1;
  25215. }
  25216. var index = length - 1;
  25217. if (fromIndex !== undefined) {
  25218. index = toInteger(fromIndex);
  25219. index = fromIndex < 0
  25220. ? nativeMax(length + index, 0)
  25221. : nativeMin(index, length - 1);
  25222. }
  25223. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25224. }
  25225. /**
  25226. * Flattens `array` a single level deep.
  25227. *
  25228. * @static
  25229. * @memberOf _
  25230. * @since 0.1.0
  25231. * @category Array
  25232. * @param {Array} array The array to flatten.
  25233. * @returns {Array} Returns the new flattened array.
  25234. * @example
  25235. *
  25236. * _.flatten([1, [2, [3, [4]], 5]]);
  25237. * // => [1, 2, [3, [4]], 5]
  25238. */
  25239. function flatten(array) {
  25240. var length = array == null ? 0 : array.length;
  25241. return length ? baseFlatten(array, 1) : [];
  25242. }
  25243. /**
  25244. * Recursively flattens `array`.
  25245. *
  25246. * @static
  25247. * @memberOf _
  25248. * @since 3.0.0
  25249. * @category Array
  25250. * @param {Array} array The array to flatten.
  25251. * @returns {Array} Returns the new flattened array.
  25252. * @example
  25253. *
  25254. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25255. * // => [1, 2, 3, 4, 5]
  25256. */
  25257. function flattenDeep(array) {
  25258. var length = array == null ? 0 : array.length;
  25259. return length ? baseFlatten(array, INFINITY) : [];
  25260. }
  25261. /**
  25262. * Recursively flatten `array` up to `depth` times.
  25263. *
  25264. * @static
  25265. * @memberOf _
  25266. * @since 4.4.0
  25267. * @category Array
  25268. * @param {Array} array The array to flatten.
  25269. * @param {number} [depth=1] The maximum recursion depth.
  25270. * @returns {Array} Returns the new flattened array.
  25271. * @example
  25272. *
  25273. * var array = [1, [2, [3, [4]], 5]];
  25274. *
  25275. * _.flattenDepth(array, 1);
  25276. * // => [1, 2, [3, [4]], 5]
  25277. *
  25278. * _.flattenDepth(array, 2);
  25279. * // => [1, 2, 3, [4], 5]
  25280. */
  25281. function flattenDepth(array, depth) {
  25282. var length = array == null ? 0 : array.length;
  25283. if (!length) {
  25284. return [];
  25285. }
  25286. depth = depth === undefined ? 1 : toInteger(depth);
  25287. return baseFlatten(array, depth);
  25288. }
  25289. /**
  25290. * The inverse of `_.toPairs`; this method returns an object composed
  25291. * from key-value `pairs`.
  25292. *
  25293. * @static
  25294. * @memberOf _
  25295. * @since 4.0.0
  25296. * @category Array
  25297. * @param {Array} pairs The key-value pairs.
  25298. * @returns {Object} Returns the new object.
  25299. * @example
  25300. *
  25301. * _.fromPairs([['a', 1], ['b', 2]]);
  25302. * // => { 'a': 1, 'b': 2 }
  25303. */
  25304. function fromPairs(pairs) {
  25305. var index = -1,
  25306. length = pairs == null ? 0 : pairs.length,
  25307. result = {};
  25308. while (++index < length) {
  25309. var pair = pairs[index];
  25310. result[pair[0]] = pair[1];
  25311. }
  25312. return result;
  25313. }
  25314. /**
  25315. * Gets the first element of `array`.
  25316. *
  25317. * @static
  25318. * @memberOf _
  25319. * @since 0.1.0
  25320. * @alias first
  25321. * @category Array
  25322. * @param {Array} array The array to query.
  25323. * @returns {*} Returns the first element of `array`.
  25324. * @example
  25325. *
  25326. * _.head([1, 2, 3]);
  25327. * // => 1
  25328. *
  25329. * _.head([]);
  25330. * // => undefined
  25331. */
  25332. function head(array) {
  25333. return (array && array.length) ? array[0] : undefined;
  25334. }
  25335. /**
  25336. * Gets the index at which the first occurrence of `value` is found in `array`
  25337. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25338. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25339. * offset from the end of `array`.
  25340. *
  25341. * @static
  25342. * @memberOf _
  25343. * @since 0.1.0
  25344. * @category Array
  25345. * @param {Array} array The array to inspect.
  25346. * @param {*} value The value to search for.
  25347. * @param {number} [fromIndex=0] The index to search from.
  25348. * @returns {number} Returns the index of the matched value, else `-1`.
  25349. * @example
  25350. *
  25351. * _.indexOf([1, 2, 1, 2], 2);
  25352. * // => 1
  25353. *
  25354. * // Search from the `fromIndex`.
  25355. * _.indexOf([1, 2, 1, 2], 2, 2);
  25356. * // => 3
  25357. */
  25358. function indexOf(array, value, fromIndex) {
  25359. var length = array == null ? 0 : array.length;
  25360. if (!length) {
  25361. return -1;
  25362. }
  25363. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25364. if (index < 0) {
  25365. index = nativeMax(length + index, 0);
  25366. }
  25367. return baseIndexOf(array, value, index);
  25368. }
  25369. /**
  25370. * Gets all but the last element of `array`.
  25371. *
  25372. * @static
  25373. * @memberOf _
  25374. * @since 0.1.0
  25375. * @category Array
  25376. * @param {Array} array The array to query.
  25377. * @returns {Array} Returns the slice of `array`.
  25378. * @example
  25379. *
  25380. * _.initial([1, 2, 3]);
  25381. * // => [1, 2]
  25382. */
  25383. function initial(array) {
  25384. var length = array == null ? 0 : array.length;
  25385. return length ? baseSlice(array, 0, -1) : [];
  25386. }
  25387. /**
  25388. * Creates an array of unique values that are included in all given arrays
  25389. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25390. * for equality comparisons. The order and references of result values are
  25391. * determined by the first array.
  25392. *
  25393. * @static
  25394. * @memberOf _
  25395. * @since 0.1.0
  25396. * @category Array
  25397. * @param {...Array} [arrays] The arrays to inspect.
  25398. * @returns {Array} Returns the new array of intersecting values.
  25399. * @example
  25400. *
  25401. * _.intersection([2, 1], [2, 3]);
  25402. * // => [2]
  25403. */
  25404. var intersection = baseRest(function(arrays) {
  25405. var mapped = arrayMap(arrays, castArrayLikeObject);
  25406. return (mapped.length && mapped[0] === arrays[0])
  25407. ? baseIntersection(mapped)
  25408. : [];
  25409. });
  25410. /**
  25411. * This method is like `_.intersection` except that it accepts `iteratee`
  25412. * which is invoked for each element of each `arrays` to generate the criterion
  25413. * by which they're compared. The order and references of result values are
  25414. * determined by the first array. The iteratee is invoked with one argument:
  25415. * (value).
  25416. *
  25417. * @static
  25418. * @memberOf _
  25419. * @since 4.0.0
  25420. * @category Array
  25421. * @param {...Array} [arrays] The arrays to inspect.
  25422. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25423. * @returns {Array} Returns the new array of intersecting values.
  25424. * @example
  25425. *
  25426. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25427. * // => [2.1]
  25428. *
  25429. * // The `_.property` iteratee shorthand.
  25430. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25431. * // => [{ 'x': 1 }]
  25432. */
  25433. var intersectionBy = baseRest(function(arrays) {
  25434. var iteratee = last(arrays),
  25435. mapped = arrayMap(arrays, castArrayLikeObject);
  25436. if (iteratee === last(mapped)) {
  25437. iteratee = undefined;
  25438. } else {
  25439. mapped.pop();
  25440. }
  25441. return (mapped.length && mapped[0] === arrays[0])
  25442. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25443. : [];
  25444. });
  25445. /**
  25446. * This method is like `_.intersection` except that it accepts `comparator`
  25447. * which is invoked to compare elements of `arrays`. The order and references
  25448. * of result values are determined by the first array. The comparator is
  25449. * invoked with two arguments: (arrVal, othVal).
  25450. *
  25451. * @static
  25452. * @memberOf _
  25453. * @since 4.0.0
  25454. * @category Array
  25455. * @param {...Array} [arrays] The arrays to inspect.
  25456. * @param {Function} [comparator] The comparator invoked per element.
  25457. * @returns {Array} Returns the new array of intersecting values.
  25458. * @example
  25459. *
  25460. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25461. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25462. *
  25463. * _.intersectionWith(objects, others, _.isEqual);
  25464. * // => [{ 'x': 1, 'y': 2 }]
  25465. */
  25466. var intersectionWith = baseRest(function(arrays) {
  25467. var comparator = last(arrays),
  25468. mapped = arrayMap(arrays, castArrayLikeObject);
  25469. comparator = typeof comparator == 'function' ? comparator : undefined;
  25470. if (comparator) {
  25471. mapped.pop();
  25472. }
  25473. return (mapped.length && mapped[0] === arrays[0])
  25474. ? baseIntersection(mapped, undefined, comparator)
  25475. : [];
  25476. });
  25477. /**
  25478. * Converts all elements in `array` into a string separated by `separator`.
  25479. *
  25480. * @static
  25481. * @memberOf _
  25482. * @since 4.0.0
  25483. * @category Array
  25484. * @param {Array} array The array to convert.
  25485. * @param {string} [separator=','] The element separator.
  25486. * @returns {string} Returns the joined string.
  25487. * @example
  25488. *
  25489. * _.join(['a', 'b', 'c'], '~');
  25490. * // => 'a~b~c'
  25491. */
  25492. function join(array, separator) {
  25493. return array == null ? '' : nativeJoin.call(array, separator);
  25494. }
  25495. /**
  25496. * Gets the last element of `array`.
  25497. *
  25498. * @static
  25499. * @memberOf _
  25500. * @since 0.1.0
  25501. * @category Array
  25502. * @param {Array} array The array to query.
  25503. * @returns {*} Returns the last element of `array`.
  25504. * @example
  25505. *
  25506. * _.last([1, 2, 3]);
  25507. * // => 3
  25508. */
  25509. function last(array) {
  25510. var length = array == null ? 0 : array.length;
  25511. return length ? array[length - 1] : undefined;
  25512. }
  25513. /**
  25514. * This method is like `_.indexOf` except that it iterates over elements of
  25515. * `array` from right to left.
  25516. *
  25517. * @static
  25518. * @memberOf _
  25519. * @since 0.1.0
  25520. * @category Array
  25521. * @param {Array} array The array to inspect.
  25522. * @param {*} value The value to search for.
  25523. * @param {number} [fromIndex=array.length-1] The index to search from.
  25524. * @returns {number} Returns the index of the matched value, else `-1`.
  25525. * @example
  25526. *
  25527. * _.lastIndexOf([1, 2, 1, 2], 2);
  25528. * // => 3
  25529. *
  25530. * // Search from the `fromIndex`.
  25531. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25532. * // => 1
  25533. */
  25534. function lastIndexOf(array, value, fromIndex) {
  25535. var length = array == null ? 0 : array.length;
  25536. if (!length) {
  25537. return -1;
  25538. }
  25539. var index = length;
  25540. if (fromIndex !== undefined) {
  25541. index = toInteger(fromIndex);
  25542. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25543. }
  25544. return value === value
  25545. ? strictLastIndexOf(array, value, index)
  25546. : baseFindIndex(array, baseIsNaN, index, true);
  25547. }
  25548. /**
  25549. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25550. * element from the end is returned.
  25551. *
  25552. * @static
  25553. * @memberOf _
  25554. * @since 4.11.0
  25555. * @category Array
  25556. * @param {Array} array The array to query.
  25557. * @param {number} [n=0] The index of the element to return.
  25558. * @returns {*} Returns the nth element of `array`.
  25559. * @example
  25560. *
  25561. * var array = ['a', 'b', 'c', 'd'];
  25562. *
  25563. * _.nth(array, 1);
  25564. * // => 'b'
  25565. *
  25566. * _.nth(array, -2);
  25567. * // => 'c';
  25568. */
  25569. function nth(array, n) {
  25570. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25571. }
  25572. /**
  25573. * Removes all given values from `array` using
  25574. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25575. * for equality comparisons.
  25576. *
  25577. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25578. * to remove elements from an array by predicate.
  25579. *
  25580. * @static
  25581. * @memberOf _
  25582. * @since 2.0.0
  25583. * @category Array
  25584. * @param {Array} array The array to modify.
  25585. * @param {...*} [values] The values to remove.
  25586. * @returns {Array} Returns `array`.
  25587. * @example
  25588. *
  25589. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25590. *
  25591. * _.pull(array, 'a', 'c');
  25592. * console.log(array);
  25593. * // => ['b', 'b']
  25594. */
  25595. var pull = baseRest(pullAll);
  25596. /**
  25597. * This method is like `_.pull` except that it accepts an array of values to remove.
  25598. *
  25599. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25600. *
  25601. * @static
  25602. * @memberOf _
  25603. * @since 4.0.0
  25604. * @category Array
  25605. * @param {Array} array The array to modify.
  25606. * @param {Array} values The values to remove.
  25607. * @returns {Array} Returns `array`.
  25608. * @example
  25609. *
  25610. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25611. *
  25612. * _.pullAll(array, ['a', 'c']);
  25613. * console.log(array);
  25614. * // => ['b', 'b']
  25615. */
  25616. function pullAll(array, values) {
  25617. return (array && array.length && values && values.length)
  25618. ? basePullAll(array, values)
  25619. : array;
  25620. }
  25621. /**
  25622. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25623. * invoked for each element of `array` and `values` to generate the criterion
  25624. * by which they're compared. The iteratee is invoked with one argument: (value).
  25625. *
  25626. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 4.0.0
  25631. * @category Array
  25632. * @param {Array} array The array to modify.
  25633. * @param {Array} values The values to remove.
  25634. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25635. * @returns {Array} Returns `array`.
  25636. * @example
  25637. *
  25638. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25639. *
  25640. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25641. * console.log(array);
  25642. * // => [{ 'x': 2 }]
  25643. */
  25644. function pullAllBy(array, values, iteratee) {
  25645. return (array && array.length && values && values.length)
  25646. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25647. : array;
  25648. }
  25649. /**
  25650. * This method is like `_.pullAll` except that it accepts `comparator` which
  25651. * is invoked to compare elements of `array` to `values`. The comparator is
  25652. * invoked with two arguments: (arrVal, othVal).
  25653. *
  25654. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25655. *
  25656. * @static
  25657. * @memberOf _
  25658. * @since 4.6.0
  25659. * @category Array
  25660. * @param {Array} array The array to modify.
  25661. * @param {Array} values The values to remove.
  25662. * @param {Function} [comparator] The comparator invoked per element.
  25663. * @returns {Array} Returns `array`.
  25664. * @example
  25665. *
  25666. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25667. *
  25668. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25669. * console.log(array);
  25670. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25671. */
  25672. function pullAllWith(array, values, comparator) {
  25673. return (array && array.length && values && values.length)
  25674. ? basePullAll(array, values, undefined, comparator)
  25675. : array;
  25676. }
  25677. /**
  25678. * Removes elements from `array` corresponding to `indexes` and returns an
  25679. * array of removed elements.
  25680. *
  25681. * **Note:** Unlike `_.at`, this method mutates `array`.
  25682. *
  25683. * @static
  25684. * @memberOf _
  25685. * @since 3.0.0
  25686. * @category Array
  25687. * @param {Array} array The array to modify.
  25688. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25689. * @returns {Array} Returns the new array of removed elements.
  25690. * @example
  25691. *
  25692. * var array = ['a', 'b', 'c', 'd'];
  25693. * var pulled = _.pullAt(array, [1, 3]);
  25694. *
  25695. * console.log(array);
  25696. * // => ['a', 'c']
  25697. *
  25698. * console.log(pulled);
  25699. * // => ['b', 'd']
  25700. */
  25701. var pullAt = flatRest(function(array, indexes) {
  25702. var length = array == null ? 0 : array.length,
  25703. result = baseAt(array, indexes);
  25704. basePullAt(array, arrayMap(indexes, function(index) {
  25705. return isIndex(index, length) ? +index : index;
  25706. }).sort(compareAscending));
  25707. return result;
  25708. });
  25709. /**
  25710. * Removes all elements from `array` that `predicate` returns truthy for
  25711. * and returns an array of the removed elements. The predicate is invoked
  25712. * with three arguments: (value, index, array).
  25713. *
  25714. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25715. * to pull elements from an array by value.
  25716. *
  25717. * @static
  25718. * @memberOf _
  25719. * @since 2.0.0
  25720. * @category Array
  25721. * @param {Array} array The array to modify.
  25722. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25723. * @returns {Array} Returns the new array of removed elements.
  25724. * @example
  25725. *
  25726. * var array = [1, 2, 3, 4];
  25727. * var evens = _.remove(array, function(n) {
  25728. * return n % 2 == 0;
  25729. * });
  25730. *
  25731. * console.log(array);
  25732. * // => [1, 3]
  25733. *
  25734. * console.log(evens);
  25735. * // => [2, 4]
  25736. */
  25737. function remove(array, predicate) {
  25738. var result = [];
  25739. if (!(array && array.length)) {
  25740. return result;
  25741. }
  25742. var index = -1,
  25743. indexes = [],
  25744. length = array.length;
  25745. predicate = getIteratee(predicate, 3);
  25746. while (++index < length) {
  25747. var value = array[index];
  25748. if (predicate(value, index, array)) {
  25749. result.push(value);
  25750. indexes.push(index);
  25751. }
  25752. }
  25753. basePullAt(array, indexes);
  25754. return result;
  25755. }
  25756. /**
  25757. * Reverses `array` so that the first element becomes the last, the second
  25758. * element becomes the second to last, and so on.
  25759. *
  25760. * **Note:** This method mutates `array` and is based on
  25761. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25762. *
  25763. * @static
  25764. * @memberOf _
  25765. * @since 4.0.0
  25766. * @category Array
  25767. * @param {Array} array The array to modify.
  25768. * @returns {Array} Returns `array`.
  25769. * @example
  25770. *
  25771. * var array = [1, 2, 3];
  25772. *
  25773. * _.reverse(array);
  25774. * // => [3, 2, 1]
  25775. *
  25776. * console.log(array);
  25777. * // => [3, 2, 1]
  25778. */
  25779. function reverse(array) {
  25780. return array == null ? array : nativeReverse.call(array);
  25781. }
  25782. /**
  25783. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25784. *
  25785. * **Note:** This method is used instead of
  25786. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25787. * returned.
  25788. *
  25789. * @static
  25790. * @memberOf _
  25791. * @since 3.0.0
  25792. * @category Array
  25793. * @param {Array} array The array to slice.
  25794. * @param {number} [start=0] The start position.
  25795. * @param {number} [end=array.length] The end position.
  25796. * @returns {Array} Returns the slice of `array`.
  25797. */
  25798. function slice(array, start, end) {
  25799. var length = array == null ? 0 : array.length;
  25800. if (!length) {
  25801. return [];
  25802. }
  25803. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25804. start = 0;
  25805. end = length;
  25806. }
  25807. else {
  25808. start = start == null ? 0 : toInteger(start);
  25809. end = end === undefined ? length : toInteger(end);
  25810. }
  25811. return baseSlice(array, start, end);
  25812. }
  25813. /**
  25814. * Uses a binary search to determine the lowest index at which `value`
  25815. * should be inserted into `array` in order to maintain its sort order.
  25816. *
  25817. * @static
  25818. * @memberOf _
  25819. * @since 0.1.0
  25820. * @category Array
  25821. * @param {Array} array The sorted array to inspect.
  25822. * @param {*} value The value to evaluate.
  25823. * @returns {number} Returns the index at which `value` should be inserted
  25824. * into `array`.
  25825. * @example
  25826. *
  25827. * _.sortedIndex([30, 50], 40);
  25828. * // => 1
  25829. */
  25830. function sortedIndex(array, value) {
  25831. return baseSortedIndex(array, value);
  25832. }
  25833. /**
  25834. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25835. * which is invoked for `value` and each element of `array` to compute their
  25836. * sort ranking. The iteratee is invoked with one argument: (value).
  25837. *
  25838. * @static
  25839. * @memberOf _
  25840. * @since 4.0.0
  25841. * @category Array
  25842. * @param {Array} array The sorted array to inspect.
  25843. * @param {*} value The value to evaluate.
  25844. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25845. * @returns {number} Returns the index at which `value` should be inserted
  25846. * into `array`.
  25847. * @example
  25848. *
  25849. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25850. *
  25851. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25852. * // => 0
  25853. *
  25854. * // The `_.property` iteratee shorthand.
  25855. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25856. * // => 0
  25857. */
  25858. function sortedIndexBy(array, value, iteratee) {
  25859. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25860. }
  25861. /**
  25862. * This method is like `_.indexOf` except that it performs a binary
  25863. * search on a sorted `array`.
  25864. *
  25865. * @static
  25866. * @memberOf _
  25867. * @since 4.0.0
  25868. * @category Array
  25869. * @param {Array} array The array to inspect.
  25870. * @param {*} value The value to search for.
  25871. * @returns {number} Returns the index of the matched value, else `-1`.
  25872. * @example
  25873. *
  25874. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25875. * // => 1
  25876. */
  25877. function sortedIndexOf(array, value) {
  25878. var length = array == null ? 0 : array.length;
  25879. if (length) {
  25880. var index = baseSortedIndex(array, value);
  25881. if (index < length && eq(array[index], value)) {
  25882. return index;
  25883. }
  25884. }
  25885. return -1;
  25886. }
  25887. /**
  25888. * This method is like `_.sortedIndex` except that it returns the highest
  25889. * index at which `value` should be inserted into `array` in order to
  25890. * maintain its sort order.
  25891. *
  25892. * @static
  25893. * @memberOf _
  25894. * @since 3.0.0
  25895. * @category Array
  25896. * @param {Array} array The sorted array to inspect.
  25897. * @param {*} value The value to evaluate.
  25898. * @returns {number} Returns the index at which `value` should be inserted
  25899. * into `array`.
  25900. * @example
  25901. *
  25902. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25903. * // => 4
  25904. */
  25905. function sortedLastIndex(array, value) {
  25906. return baseSortedIndex(array, value, true);
  25907. }
  25908. /**
  25909. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25910. * which is invoked for `value` and each element of `array` to compute their
  25911. * sort ranking. The iteratee is invoked with one argument: (value).
  25912. *
  25913. * @static
  25914. * @memberOf _
  25915. * @since 4.0.0
  25916. * @category Array
  25917. * @param {Array} array The sorted array to inspect.
  25918. * @param {*} value The value to evaluate.
  25919. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25920. * @returns {number} Returns the index at which `value` should be inserted
  25921. * into `array`.
  25922. * @example
  25923. *
  25924. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25925. *
  25926. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25927. * // => 1
  25928. *
  25929. * // The `_.property` iteratee shorthand.
  25930. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25931. * // => 1
  25932. */
  25933. function sortedLastIndexBy(array, value, iteratee) {
  25934. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25935. }
  25936. /**
  25937. * This method is like `_.lastIndexOf` except that it performs a binary
  25938. * search on a sorted `array`.
  25939. *
  25940. * @static
  25941. * @memberOf _
  25942. * @since 4.0.0
  25943. * @category Array
  25944. * @param {Array} array The array to inspect.
  25945. * @param {*} value The value to search for.
  25946. * @returns {number} Returns the index of the matched value, else `-1`.
  25947. * @example
  25948. *
  25949. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25950. * // => 3
  25951. */
  25952. function sortedLastIndexOf(array, value) {
  25953. var length = array == null ? 0 : array.length;
  25954. if (length) {
  25955. var index = baseSortedIndex(array, value, true) - 1;
  25956. if (eq(array[index], value)) {
  25957. return index;
  25958. }
  25959. }
  25960. return -1;
  25961. }
  25962. /**
  25963. * This method is like `_.uniq` except that it's designed and optimized
  25964. * for sorted arrays.
  25965. *
  25966. * @static
  25967. * @memberOf _
  25968. * @since 4.0.0
  25969. * @category Array
  25970. * @param {Array} array The array to inspect.
  25971. * @returns {Array} Returns the new duplicate free array.
  25972. * @example
  25973. *
  25974. * _.sortedUniq([1, 1, 2]);
  25975. * // => [1, 2]
  25976. */
  25977. function sortedUniq(array) {
  25978. return (array && array.length)
  25979. ? baseSortedUniq(array)
  25980. : [];
  25981. }
  25982. /**
  25983. * This method is like `_.uniqBy` except that it's designed and optimized
  25984. * for sorted arrays.
  25985. *
  25986. * @static
  25987. * @memberOf _
  25988. * @since 4.0.0
  25989. * @category Array
  25990. * @param {Array} array The array to inspect.
  25991. * @param {Function} [iteratee] The iteratee invoked per element.
  25992. * @returns {Array} Returns the new duplicate free array.
  25993. * @example
  25994. *
  25995. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25996. * // => [1.1, 2.3]
  25997. */
  25998. function sortedUniqBy(array, iteratee) {
  25999. return (array && array.length)
  26000. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26001. : [];
  26002. }
  26003. /**
  26004. * Gets all but the first element of `array`.
  26005. *
  26006. * @static
  26007. * @memberOf _
  26008. * @since 4.0.0
  26009. * @category Array
  26010. * @param {Array} array The array to query.
  26011. * @returns {Array} Returns the slice of `array`.
  26012. * @example
  26013. *
  26014. * _.tail([1, 2, 3]);
  26015. * // => [2, 3]
  26016. */
  26017. function tail(array) {
  26018. var length = array == null ? 0 : array.length;
  26019. return length ? baseSlice(array, 1, length) : [];
  26020. }
  26021. /**
  26022. * Creates a slice of `array` with `n` elements taken from the beginning.
  26023. *
  26024. * @static
  26025. * @memberOf _
  26026. * @since 0.1.0
  26027. * @category Array
  26028. * @param {Array} array The array to query.
  26029. * @param {number} [n=1] The number of elements to take.
  26030. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26031. * @returns {Array} Returns the slice of `array`.
  26032. * @example
  26033. *
  26034. * _.take([1, 2, 3]);
  26035. * // => [1]
  26036. *
  26037. * _.take([1, 2, 3], 2);
  26038. * // => [1, 2]
  26039. *
  26040. * _.take([1, 2, 3], 5);
  26041. * // => [1, 2, 3]
  26042. *
  26043. * _.take([1, 2, 3], 0);
  26044. * // => []
  26045. */
  26046. function take(array, n, guard) {
  26047. if (!(array && array.length)) {
  26048. return [];
  26049. }
  26050. n = (guard || n === undefined) ? 1 : toInteger(n);
  26051. return baseSlice(array, 0, n < 0 ? 0 : n);
  26052. }
  26053. /**
  26054. * Creates a slice of `array` with `n` elements taken from the end.
  26055. *
  26056. * @static
  26057. * @memberOf _
  26058. * @since 3.0.0
  26059. * @category Array
  26060. * @param {Array} array The array to query.
  26061. * @param {number} [n=1] The number of elements to take.
  26062. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26063. * @returns {Array} Returns the slice of `array`.
  26064. * @example
  26065. *
  26066. * _.takeRight([1, 2, 3]);
  26067. * // => [3]
  26068. *
  26069. * _.takeRight([1, 2, 3], 2);
  26070. * // => [2, 3]
  26071. *
  26072. * _.takeRight([1, 2, 3], 5);
  26073. * // => [1, 2, 3]
  26074. *
  26075. * _.takeRight([1, 2, 3], 0);
  26076. * // => []
  26077. */
  26078. function takeRight(array, n, guard) {
  26079. var length = array == null ? 0 : array.length;
  26080. if (!length) {
  26081. return [];
  26082. }
  26083. n = (guard || n === undefined) ? 1 : toInteger(n);
  26084. n = length - n;
  26085. return baseSlice(array, n < 0 ? 0 : n, length);
  26086. }
  26087. /**
  26088. * Creates a slice of `array` with elements taken from the end. Elements are
  26089. * taken until `predicate` returns falsey. The predicate is invoked with
  26090. * three arguments: (value, index, array).
  26091. *
  26092. * @static
  26093. * @memberOf _
  26094. * @since 3.0.0
  26095. * @category Array
  26096. * @param {Array} array The array to query.
  26097. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26098. * @returns {Array} Returns the slice of `array`.
  26099. * @example
  26100. *
  26101. * var users = [
  26102. * { 'user': 'barney', 'active': true },
  26103. * { 'user': 'fred', 'active': false },
  26104. * { 'user': 'pebbles', 'active': false }
  26105. * ];
  26106. *
  26107. * _.takeRightWhile(users, function(o) { return !o.active; });
  26108. * // => objects for ['fred', 'pebbles']
  26109. *
  26110. * // The `_.matches` iteratee shorthand.
  26111. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26112. * // => objects for ['pebbles']
  26113. *
  26114. * // The `_.matchesProperty` iteratee shorthand.
  26115. * _.takeRightWhile(users, ['active', false]);
  26116. * // => objects for ['fred', 'pebbles']
  26117. *
  26118. * // The `_.property` iteratee shorthand.
  26119. * _.takeRightWhile(users, 'active');
  26120. * // => []
  26121. */
  26122. function takeRightWhile(array, predicate) {
  26123. return (array && array.length)
  26124. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26125. : [];
  26126. }
  26127. /**
  26128. * Creates a slice of `array` with elements taken from the beginning. Elements
  26129. * are taken until `predicate` returns falsey. The predicate is invoked with
  26130. * three arguments: (value, index, array).
  26131. *
  26132. * @static
  26133. * @memberOf _
  26134. * @since 3.0.0
  26135. * @category Array
  26136. * @param {Array} array The array to query.
  26137. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26138. * @returns {Array} Returns the slice of `array`.
  26139. * @example
  26140. *
  26141. * var users = [
  26142. * { 'user': 'barney', 'active': false },
  26143. * { 'user': 'fred', 'active': false },
  26144. * { 'user': 'pebbles', 'active': true }
  26145. * ];
  26146. *
  26147. * _.takeWhile(users, function(o) { return !o.active; });
  26148. * // => objects for ['barney', 'fred']
  26149. *
  26150. * // The `_.matches` iteratee shorthand.
  26151. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26152. * // => objects for ['barney']
  26153. *
  26154. * // The `_.matchesProperty` iteratee shorthand.
  26155. * _.takeWhile(users, ['active', false]);
  26156. * // => objects for ['barney', 'fred']
  26157. *
  26158. * // The `_.property` iteratee shorthand.
  26159. * _.takeWhile(users, 'active');
  26160. * // => []
  26161. */
  26162. function takeWhile(array, predicate) {
  26163. return (array && array.length)
  26164. ? baseWhile(array, getIteratee(predicate, 3))
  26165. : [];
  26166. }
  26167. /**
  26168. * Creates an array of unique values, in order, from all given arrays using
  26169. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26170. * for equality comparisons.
  26171. *
  26172. * @static
  26173. * @memberOf _
  26174. * @since 0.1.0
  26175. * @category Array
  26176. * @param {...Array} [arrays] The arrays to inspect.
  26177. * @returns {Array} Returns the new array of combined values.
  26178. * @example
  26179. *
  26180. * _.union([2], [1, 2]);
  26181. * // => [2, 1]
  26182. */
  26183. var union = baseRest(function(arrays) {
  26184. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26185. });
  26186. /**
  26187. * This method is like `_.union` except that it accepts `iteratee` which is
  26188. * invoked for each element of each `arrays` to generate the criterion by
  26189. * which uniqueness is computed. Result values are chosen from the first
  26190. * array in which the value occurs. The iteratee is invoked with one argument:
  26191. * (value).
  26192. *
  26193. * @static
  26194. * @memberOf _
  26195. * @since 4.0.0
  26196. * @category Array
  26197. * @param {...Array} [arrays] The arrays to inspect.
  26198. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26199. * @returns {Array} Returns the new array of combined values.
  26200. * @example
  26201. *
  26202. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26203. * // => [2.1, 1.2]
  26204. *
  26205. * // The `_.property` iteratee shorthand.
  26206. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26207. * // => [{ 'x': 1 }, { 'x': 2 }]
  26208. */
  26209. var unionBy = baseRest(function(arrays) {
  26210. var iteratee = last(arrays);
  26211. if (isArrayLikeObject(iteratee)) {
  26212. iteratee = undefined;
  26213. }
  26214. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26215. });
  26216. /**
  26217. * This method is like `_.union` except that it accepts `comparator` which
  26218. * is invoked to compare elements of `arrays`. Result values are chosen from
  26219. * the first array in which the value occurs. The comparator is invoked
  26220. * with two arguments: (arrVal, othVal).
  26221. *
  26222. * @static
  26223. * @memberOf _
  26224. * @since 4.0.0
  26225. * @category Array
  26226. * @param {...Array} [arrays] The arrays to inspect.
  26227. * @param {Function} [comparator] The comparator invoked per element.
  26228. * @returns {Array} Returns the new array of combined values.
  26229. * @example
  26230. *
  26231. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26232. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26233. *
  26234. * _.unionWith(objects, others, _.isEqual);
  26235. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26236. */
  26237. var unionWith = baseRest(function(arrays) {
  26238. var comparator = last(arrays);
  26239. comparator = typeof comparator == 'function' ? comparator : undefined;
  26240. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26241. });
  26242. /**
  26243. * Creates a duplicate-free version of an array, using
  26244. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26245. * for equality comparisons, in which only the first occurrence of each element
  26246. * is kept. The order of result values is determined by the order they occur
  26247. * in the array.
  26248. *
  26249. * @static
  26250. * @memberOf _
  26251. * @since 0.1.0
  26252. * @category Array
  26253. * @param {Array} array The array to inspect.
  26254. * @returns {Array} Returns the new duplicate free array.
  26255. * @example
  26256. *
  26257. * _.uniq([2, 1, 2]);
  26258. * // => [2, 1]
  26259. */
  26260. function uniq(array) {
  26261. return (array && array.length) ? baseUniq(array) : [];
  26262. }
  26263. /**
  26264. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26265. * invoked for each element in `array` to generate the criterion by which
  26266. * uniqueness is computed. The order of result values is determined by the
  26267. * order they occur in the array. The iteratee is invoked with one argument:
  26268. * (value).
  26269. *
  26270. * @static
  26271. * @memberOf _
  26272. * @since 4.0.0
  26273. * @category Array
  26274. * @param {Array} array The array to inspect.
  26275. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26276. * @returns {Array} Returns the new duplicate free array.
  26277. * @example
  26278. *
  26279. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26280. * // => [2.1, 1.2]
  26281. *
  26282. * // The `_.property` iteratee shorthand.
  26283. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26284. * // => [{ 'x': 1 }, { 'x': 2 }]
  26285. */
  26286. function uniqBy(array, iteratee) {
  26287. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26288. }
  26289. /**
  26290. * This method is like `_.uniq` except that it accepts `comparator` which
  26291. * is invoked to compare elements of `array`. The order of result values is
  26292. * determined by the order they occur in the array.The comparator is invoked
  26293. * with two arguments: (arrVal, othVal).
  26294. *
  26295. * @static
  26296. * @memberOf _
  26297. * @since 4.0.0
  26298. * @category Array
  26299. * @param {Array} array The array to inspect.
  26300. * @param {Function} [comparator] The comparator invoked per element.
  26301. * @returns {Array} Returns the new duplicate free array.
  26302. * @example
  26303. *
  26304. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26305. *
  26306. * _.uniqWith(objects, _.isEqual);
  26307. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26308. */
  26309. function uniqWith(array, comparator) {
  26310. comparator = typeof comparator == 'function' ? comparator : undefined;
  26311. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26312. }
  26313. /**
  26314. * This method is like `_.zip` except that it accepts an array of grouped
  26315. * elements and creates an array regrouping the elements to their pre-zip
  26316. * configuration.
  26317. *
  26318. * @static
  26319. * @memberOf _
  26320. * @since 1.2.0
  26321. * @category Array
  26322. * @param {Array} array The array of grouped elements to process.
  26323. * @returns {Array} Returns the new array of regrouped elements.
  26324. * @example
  26325. *
  26326. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26327. * // => [['a', 1, true], ['b', 2, false]]
  26328. *
  26329. * _.unzip(zipped);
  26330. * // => [['a', 'b'], [1, 2], [true, false]]
  26331. */
  26332. function unzip(array) {
  26333. if (!(array && array.length)) {
  26334. return [];
  26335. }
  26336. var length = 0;
  26337. array = arrayFilter(array, function(group) {
  26338. if (isArrayLikeObject(group)) {
  26339. length = nativeMax(group.length, length);
  26340. return true;
  26341. }
  26342. });
  26343. return baseTimes(length, function(index) {
  26344. return arrayMap(array, baseProperty(index));
  26345. });
  26346. }
  26347. /**
  26348. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26349. * how regrouped values should be combined. The iteratee is invoked with the
  26350. * elements of each group: (...group).
  26351. *
  26352. * @static
  26353. * @memberOf _
  26354. * @since 3.8.0
  26355. * @category Array
  26356. * @param {Array} array The array of grouped elements to process.
  26357. * @param {Function} [iteratee=_.identity] The function to combine
  26358. * regrouped values.
  26359. * @returns {Array} Returns the new array of regrouped elements.
  26360. * @example
  26361. *
  26362. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26363. * // => [[1, 10, 100], [2, 20, 200]]
  26364. *
  26365. * _.unzipWith(zipped, _.add);
  26366. * // => [3, 30, 300]
  26367. */
  26368. function unzipWith(array, iteratee) {
  26369. if (!(array && array.length)) {
  26370. return [];
  26371. }
  26372. var result = unzip(array);
  26373. if (iteratee == null) {
  26374. return result;
  26375. }
  26376. return arrayMap(result, function(group) {
  26377. return apply(iteratee, undefined, group);
  26378. });
  26379. }
  26380. /**
  26381. * Creates an array excluding all given values using
  26382. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26383. * for equality comparisons.
  26384. *
  26385. * **Note:** Unlike `_.pull`, this method returns a new array.
  26386. *
  26387. * @static
  26388. * @memberOf _
  26389. * @since 0.1.0
  26390. * @category Array
  26391. * @param {Array} array The array to inspect.
  26392. * @param {...*} [values] The values to exclude.
  26393. * @returns {Array} Returns the new array of filtered values.
  26394. * @see _.difference, _.xor
  26395. * @example
  26396. *
  26397. * _.without([2, 1, 2, 3], 1, 2);
  26398. * // => [3]
  26399. */
  26400. var without = baseRest(function(array, values) {
  26401. return isArrayLikeObject(array)
  26402. ? baseDifference(array, values)
  26403. : [];
  26404. });
  26405. /**
  26406. * Creates an array of unique values that is the
  26407. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26408. * of the given arrays. The order of result values is determined by the order
  26409. * they occur in the arrays.
  26410. *
  26411. * @static
  26412. * @memberOf _
  26413. * @since 2.4.0
  26414. * @category Array
  26415. * @param {...Array} [arrays] The arrays to inspect.
  26416. * @returns {Array} Returns the new array of filtered values.
  26417. * @see _.difference, _.without
  26418. * @example
  26419. *
  26420. * _.xor([2, 1], [2, 3]);
  26421. * // => [1, 3]
  26422. */
  26423. var xor = baseRest(function(arrays) {
  26424. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26425. });
  26426. /**
  26427. * This method is like `_.xor` except that it accepts `iteratee` which is
  26428. * invoked for each element of each `arrays` to generate the criterion by
  26429. * which by which they're compared. The order of result values is determined
  26430. * by the order they occur in the arrays. The iteratee is invoked with one
  26431. * argument: (value).
  26432. *
  26433. * @static
  26434. * @memberOf _
  26435. * @since 4.0.0
  26436. * @category Array
  26437. * @param {...Array} [arrays] The arrays to inspect.
  26438. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26439. * @returns {Array} Returns the new array of filtered values.
  26440. * @example
  26441. *
  26442. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26443. * // => [1.2, 3.4]
  26444. *
  26445. * // The `_.property` iteratee shorthand.
  26446. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26447. * // => [{ 'x': 2 }]
  26448. */
  26449. var xorBy = baseRest(function(arrays) {
  26450. var iteratee = last(arrays);
  26451. if (isArrayLikeObject(iteratee)) {
  26452. iteratee = undefined;
  26453. }
  26454. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26455. });
  26456. /**
  26457. * This method is like `_.xor` except that it accepts `comparator` which is
  26458. * invoked to compare elements of `arrays`. The order of result values is
  26459. * determined by the order they occur in the arrays. The comparator is invoked
  26460. * with two arguments: (arrVal, othVal).
  26461. *
  26462. * @static
  26463. * @memberOf _
  26464. * @since 4.0.0
  26465. * @category Array
  26466. * @param {...Array} [arrays] The arrays to inspect.
  26467. * @param {Function} [comparator] The comparator invoked per element.
  26468. * @returns {Array} Returns the new array of filtered values.
  26469. * @example
  26470. *
  26471. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26472. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26473. *
  26474. * _.xorWith(objects, others, _.isEqual);
  26475. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26476. */
  26477. var xorWith = baseRest(function(arrays) {
  26478. var comparator = last(arrays);
  26479. comparator = typeof comparator == 'function' ? comparator : undefined;
  26480. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26481. });
  26482. /**
  26483. * Creates an array of grouped elements, the first of which contains the
  26484. * first elements of the given arrays, the second of which contains the
  26485. * second elements of the given arrays, and so on.
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 0.1.0
  26490. * @category Array
  26491. * @param {...Array} [arrays] The arrays to process.
  26492. * @returns {Array} Returns the new array of grouped elements.
  26493. * @example
  26494. *
  26495. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26496. * // => [['a', 1, true], ['b', 2, false]]
  26497. */
  26498. var zip = baseRest(unzip);
  26499. /**
  26500. * This method is like `_.fromPairs` except that it accepts two arrays,
  26501. * one of property identifiers and one of corresponding values.
  26502. *
  26503. * @static
  26504. * @memberOf _
  26505. * @since 0.4.0
  26506. * @category Array
  26507. * @param {Array} [props=[]] The property identifiers.
  26508. * @param {Array} [values=[]] The property values.
  26509. * @returns {Object} Returns the new object.
  26510. * @example
  26511. *
  26512. * _.zipObject(['a', 'b'], [1, 2]);
  26513. * // => { 'a': 1, 'b': 2 }
  26514. */
  26515. function zipObject(props, values) {
  26516. return baseZipObject(props || [], values || [], assignValue);
  26517. }
  26518. /**
  26519. * This method is like `_.zipObject` except that it supports property paths.
  26520. *
  26521. * @static
  26522. * @memberOf _
  26523. * @since 4.1.0
  26524. * @category Array
  26525. * @param {Array} [props=[]] The property identifiers.
  26526. * @param {Array} [values=[]] The property values.
  26527. * @returns {Object} Returns the new object.
  26528. * @example
  26529. *
  26530. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26531. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26532. */
  26533. function zipObjectDeep(props, values) {
  26534. return baseZipObject(props || [], values || [], baseSet);
  26535. }
  26536. /**
  26537. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26538. * how grouped values should be combined. The iteratee is invoked with the
  26539. * elements of each group: (...group).
  26540. *
  26541. * @static
  26542. * @memberOf _
  26543. * @since 3.8.0
  26544. * @category Array
  26545. * @param {...Array} [arrays] The arrays to process.
  26546. * @param {Function} [iteratee=_.identity] The function to combine
  26547. * grouped values.
  26548. * @returns {Array} Returns the new array of grouped elements.
  26549. * @example
  26550. *
  26551. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26552. * return a + b + c;
  26553. * });
  26554. * // => [111, 222]
  26555. */
  26556. var zipWith = baseRest(function(arrays) {
  26557. var length = arrays.length,
  26558. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26559. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26560. return unzipWith(arrays, iteratee);
  26561. });
  26562. /*------------------------------------------------------------------------*/
  26563. /**
  26564. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26565. * chain sequences enabled. The result of such sequences must be unwrapped
  26566. * with `_#value`.
  26567. *
  26568. * @static
  26569. * @memberOf _
  26570. * @since 1.3.0
  26571. * @category Seq
  26572. * @param {*} value The value to wrap.
  26573. * @returns {Object} Returns the new `lodash` wrapper instance.
  26574. * @example
  26575. *
  26576. * var users = [
  26577. * { 'user': 'barney', 'age': 36 },
  26578. * { 'user': 'fred', 'age': 40 },
  26579. * { 'user': 'pebbles', 'age': 1 }
  26580. * ];
  26581. *
  26582. * var youngest = _
  26583. * .chain(users)
  26584. * .sortBy('age')
  26585. * .map(function(o) {
  26586. * return o.user + ' is ' + o.age;
  26587. * })
  26588. * .head()
  26589. * .value();
  26590. * // => 'pebbles is 1'
  26591. */
  26592. function chain(value) {
  26593. var result = lodash(value);
  26594. result.__chain__ = true;
  26595. return result;
  26596. }
  26597. /**
  26598. * This method invokes `interceptor` and returns `value`. The interceptor
  26599. * is invoked with one argument; (value). The purpose of this method is to
  26600. * "tap into" a method chain sequence in order to modify intermediate results.
  26601. *
  26602. * @static
  26603. * @memberOf _
  26604. * @since 0.1.0
  26605. * @category Seq
  26606. * @param {*} value The value to provide to `interceptor`.
  26607. * @param {Function} interceptor The function to invoke.
  26608. * @returns {*} Returns `value`.
  26609. * @example
  26610. *
  26611. * _([1, 2, 3])
  26612. * .tap(function(array) {
  26613. * // Mutate input array.
  26614. * array.pop();
  26615. * })
  26616. * .reverse()
  26617. * .value();
  26618. * // => [2, 1]
  26619. */
  26620. function tap(value, interceptor) {
  26621. interceptor(value);
  26622. return value;
  26623. }
  26624. /**
  26625. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26626. * The purpose of this method is to "pass thru" values replacing intermediate
  26627. * results in a method chain sequence.
  26628. *
  26629. * @static
  26630. * @memberOf _
  26631. * @since 3.0.0
  26632. * @category Seq
  26633. * @param {*} value The value to provide to `interceptor`.
  26634. * @param {Function} interceptor The function to invoke.
  26635. * @returns {*} Returns the result of `interceptor`.
  26636. * @example
  26637. *
  26638. * _(' abc ')
  26639. * .chain()
  26640. * .trim()
  26641. * .thru(function(value) {
  26642. * return [value];
  26643. * })
  26644. * .value();
  26645. * // => ['abc']
  26646. */
  26647. function thru(value, interceptor) {
  26648. return interceptor(value);
  26649. }
  26650. /**
  26651. * This method is the wrapper version of `_.at`.
  26652. *
  26653. * @name at
  26654. * @memberOf _
  26655. * @since 1.0.0
  26656. * @category Seq
  26657. * @param {...(string|string[])} [paths] The property paths to pick.
  26658. * @returns {Object} Returns the new `lodash` wrapper instance.
  26659. * @example
  26660. *
  26661. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26662. *
  26663. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26664. * // => [3, 4]
  26665. */
  26666. var wrapperAt = flatRest(function(paths) {
  26667. var length = paths.length,
  26668. start = length ? paths[0] : 0,
  26669. value = this.__wrapped__,
  26670. interceptor = function(object) { return baseAt(object, paths); };
  26671. if (length > 1 || this.__actions__.length ||
  26672. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26673. return this.thru(interceptor);
  26674. }
  26675. value = value.slice(start, +start + (length ? 1 : 0));
  26676. value.__actions__.push({
  26677. 'func': thru,
  26678. 'args': [interceptor],
  26679. 'thisArg': undefined
  26680. });
  26681. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26682. if (length && !array.length) {
  26683. array.push(undefined);
  26684. }
  26685. return array;
  26686. });
  26687. });
  26688. /**
  26689. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26690. *
  26691. * @name chain
  26692. * @memberOf _
  26693. * @since 0.1.0
  26694. * @category Seq
  26695. * @returns {Object} Returns the new `lodash` wrapper instance.
  26696. * @example
  26697. *
  26698. * var users = [
  26699. * { 'user': 'barney', 'age': 36 },
  26700. * { 'user': 'fred', 'age': 40 }
  26701. * ];
  26702. *
  26703. * // A sequence without explicit chaining.
  26704. * _(users).head();
  26705. * // => { 'user': 'barney', 'age': 36 }
  26706. *
  26707. * // A sequence with explicit chaining.
  26708. * _(users)
  26709. * .chain()
  26710. * .head()
  26711. * .pick('user')
  26712. * .value();
  26713. * // => { 'user': 'barney' }
  26714. */
  26715. function wrapperChain() {
  26716. return chain(this);
  26717. }
  26718. /**
  26719. * Executes the chain sequence and returns the wrapped result.
  26720. *
  26721. * @name commit
  26722. * @memberOf _
  26723. * @since 3.2.0
  26724. * @category Seq
  26725. * @returns {Object} Returns the new `lodash` wrapper instance.
  26726. * @example
  26727. *
  26728. * var array = [1, 2];
  26729. * var wrapped = _(array).push(3);
  26730. *
  26731. * console.log(array);
  26732. * // => [1, 2]
  26733. *
  26734. * wrapped = wrapped.commit();
  26735. * console.log(array);
  26736. * // => [1, 2, 3]
  26737. *
  26738. * wrapped.last();
  26739. * // => 3
  26740. *
  26741. * console.log(array);
  26742. * // => [1, 2, 3]
  26743. */
  26744. function wrapperCommit() {
  26745. return new LodashWrapper(this.value(), this.__chain__);
  26746. }
  26747. /**
  26748. * Gets the next value on a wrapped object following the
  26749. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26750. *
  26751. * @name next
  26752. * @memberOf _
  26753. * @since 4.0.0
  26754. * @category Seq
  26755. * @returns {Object} Returns the next iterator value.
  26756. * @example
  26757. *
  26758. * var wrapped = _([1, 2]);
  26759. *
  26760. * wrapped.next();
  26761. * // => { 'done': false, 'value': 1 }
  26762. *
  26763. * wrapped.next();
  26764. * // => { 'done': false, 'value': 2 }
  26765. *
  26766. * wrapped.next();
  26767. * // => { 'done': true, 'value': undefined }
  26768. */
  26769. function wrapperNext() {
  26770. if (this.__values__ === undefined) {
  26771. this.__values__ = toArray(this.value());
  26772. }
  26773. var done = this.__index__ >= this.__values__.length,
  26774. value = done ? undefined : this.__values__[this.__index__++];
  26775. return { 'done': done, 'value': value };
  26776. }
  26777. /**
  26778. * Enables the wrapper to be iterable.
  26779. *
  26780. * @name Symbol.iterator
  26781. * @memberOf _
  26782. * @since 4.0.0
  26783. * @category Seq
  26784. * @returns {Object} Returns the wrapper object.
  26785. * @example
  26786. *
  26787. * var wrapped = _([1, 2]);
  26788. *
  26789. * wrapped[Symbol.iterator]() === wrapped;
  26790. * // => true
  26791. *
  26792. * Array.from(wrapped);
  26793. * // => [1, 2]
  26794. */
  26795. function wrapperToIterator() {
  26796. return this;
  26797. }
  26798. /**
  26799. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26800. *
  26801. * @name plant
  26802. * @memberOf _
  26803. * @since 3.2.0
  26804. * @category Seq
  26805. * @param {*} value The value to plant.
  26806. * @returns {Object} Returns the new `lodash` wrapper instance.
  26807. * @example
  26808. *
  26809. * function square(n) {
  26810. * return n * n;
  26811. * }
  26812. *
  26813. * var wrapped = _([1, 2]).map(square);
  26814. * var other = wrapped.plant([3, 4]);
  26815. *
  26816. * other.value();
  26817. * // => [9, 16]
  26818. *
  26819. * wrapped.value();
  26820. * // => [1, 4]
  26821. */
  26822. function wrapperPlant(value) {
  26823. var result,
  26824. parent = this;
  26825. while (parent instanceof baseLodash) {
  26826. var clone = wrapperClone(parent);
  26827. clone.__index__ = 0;
  26828. clone.__values__ = undefined;
  26829. if (result) {
  26830. previous.__wrapped__ = clone;
  26831. } else {
  26832. result = clone;
  26833. }
  26834. var previous = clone;
  26835. parent = parent.__wrapped__;
  26836. }
  26837. previous.__wrapped__ = value;
  26838. return result;
  26839. }
  26840. /**
  26841. * This method is the wrapper version of `_.reverse`.
  26842. *
  26843. * **Note:** This method mutates the wrapped array.
  26844. *
  26845. * @name reverse
  26846. * @memberOf _
  26847. * @since 0.1.0
  26848. * @category Seq
  26849. * @returns {Object} Returns the new `lodash` wrapper instance.
  26850. * @example
  26851. *
  26852. * var array = [1, 2, 3];
  26853. *
  26854. * _(array).reverse().value()
  26855. * // => [3, 2, 1]
  26856. *
  26857. * console.log(array);
  26858. * // => [3, 2, 1]
  26859. */
  26860. function wrapperReverse() {
  26861. var value = this.__wrapped__;
  26862. if (value instanceof LazyWrapper) {
  26863. var wrapped = value;
  26864. if (this.__actions__.length) {
  26865. wrapped = new LazyWrapper(this);
  26866. }
  26867. wrapped = wrapped.reverse();
  26868. wrapped.__actions__.push({
  26869. 'func': thru,
  26870. 'args': [reverse],
  26871. 'thisArg': undefined
  26872. });
  26873. return new LodashWrapper(wrapped, this.__chain__);
  26874. }
  26875. return this.thru(reverse);
  26876. }
  26877. /**
  26878. * Executes the chain sequence to resolve the unwrapped value.
  26879. *
  26880. * @name value
  26881. * @memberOf _
  26882. * @since 0.1.0
  26883. * @alias toJSON, valueOf
  26884. * @category Seq
  26885. * @returns {*} Returns the resolved unwrapped value.
  26886. * @example
  26887. *
  26888. * _([1, 2, 3]).value();
  26889. * // => [1, 2, 3]
  26890. */
  26891. function wrapperValue() {
  26892. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26893. }
  26894. /*------------------------------------------------------------------------*/
  26895. /**
  26896. * Creates an object composed of keys generated from the results of running
  26897. * each element of `collection` thru `iteratee`. The corresponding value of
  26898. * each key is the number of times the key was returned by `iteratee`. The
  26899. * iteratee is invoked with one argument: (value).
  26900. *
  26901. * @static
  26902. * @memberOf _
  26903. * @since 0.5.0
  26904. * @category Collection
  26905. * @param {Array|Object} collection The collection to iterate over.
  26906. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26907. * @returns {Object} Returns the composed aggregate object.
  26908. * @example
  26909. *
  26910. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26911. * // => { '4': 1, '6': 2 }
  26912. *
  26913. * // The `_.property` iteratee shorthand.
  26914. * _.countBy(['one', 'two', 'three'], 'length');
  26915. * // => { '3': 2, '5': 1 }
  26916. */
  26917. var countBy = createAggregator(function(result, value, key) {
  26918. if (hasOwnProperty.call(result, key)) {
  26919. ++result[key];
  26920. } else {
  26921. baseAssignValue(result, key, 1);
  26922. }
  26923. });
  26924. /**
  26925. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26926. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26927. * invoked with three arguments: (value, index|key, collection).
  26928. *
  26929. * **Note:** This method returns `true` for
  26930. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26931. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26932. * elements of empty collections.
  26933. *
  26934. * @static
  26935. * @memberOf _
  26936. * @since 0.1.0
  26937. * @category Collection
  26938. * @param {Array|Object} collection The collection to iterate over.
  26939. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26940. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26941. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26942. * else `false`.
  26943. * @example
  26944. *
  26945. * _.every([true, 1, null, 'yes'], Boolean);
  26946. * // => false
  26947. *
  26948. * var users = [
  26949. * { 'user': 'barney', 'age': 36, 'active': false },
  26950. * { 'user': 'fred', 'age': 40, 'active': false }
  26951. * ];
  26952. *
  26953. * // The `_.matches` iteratee shorthand.
  26954. * _.every(users, { 'user': 'barney', 'active': false });
  26955. * // => false
  26956. *
  26957. * // The `_.matchesProperty` iteratee shorthand.
  26958. * _.every(users, ['active', false]);
  26959. * // => true
  26960. *
  26961. * // The `_.property` iteratee shorthand.
  26962. * _.every(users, 'active');
  26963. * // => false
  26964. */
  26965. function every(collection, predicate, guard) {
  26966. var func = isArray(collection) ? arrayEvery : baseEvery;
  26967. if (guard && isIterateeCall(collection, predicate, guard)) {
  26968. predicate = undefined;
  26969. }
  26970. return func(collection, getIteratee(predicate, 3));
  26971. }
  26972. /**
  26973. * Iterates over elements of `collection`, returning an array of all elements
  26974. * `predicate` returns truthy for. The predicate is invoked with three
  26975. * arguments: (value, index|key, collection).
  26976. *
  26977. * **Note:** Unlike `_.remove`, this method returns a new array.
  26978. *
  26979. * @static
  26980. * @memberOf _
  26981. * @since 0.1.0
  26982. * @category Collection
  26983. * @param {Array|Object} collection The collection to iterate over.
  26984. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26985. * @returns {Array} Returns the new filtered array.
  26986. * @see _.reject
  26987. * @example
  26988. *
  26989. * var users = [
  26990. * { 'user': 'barney', 'age': 36, 'active': true },
  26991. * { 'user': 'fred', 'age': 40, 'active': false }
  26992. * ];
  26993. *
  26994. * _.filter(users, function(o) { return !o.active; });
  26995. * // => objects for ['fred']
  26996. *
  26997. * // The `_.matches` iteratee shorthand.
  26998. * _.filter(users, { 'age': 36, 'active': true });
  26999. * // => objects for ['barney']
  27000. *
  27001. * // The `_.matchesProperty` iteratee shorthand.
  27002. * _.filter(users, ['active', false]);
  27003. * // => objects for ['fred']
  27004. *
  27005. * // The `_.property` iteratee shorthand.
  27006. * _.filter(users, 'active');
  27007. * // => objects for ['barney']
  27008. */
  27009. function filter(collection, predicate) {
  27010. var func = isArray(collection) ? arrayFilter : baseFilter;
  27011. return func(collection, getIteratee(predicate, 3));
  27012. }
  27013. /**
  27014. * Iterates over elements of `collection`, returning the first element
  27015. * `predicate` returns truthy for. The predicate is invoked with three
  27016. * arguments: (value, index|key, collection).
  27017. *
  27018. * @static
  27019. * @memberOf _
  27020. * @since 0.1.0
  27021. * @category Collection
  27022. * @param {Array|Object} collection The collection to inspect.
  27023. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27024. * @param {number} [fromIndex=0] The index to search from.
  27025. * @returns {*} Returns the matched element, else `undefined`.
  27026. * @example
  27027. *
  27028. * var users = [
  27029. * { 'user': 'barney', 'age': 36, 'active': true },
  27030. * { 'user': 'fred', 'age': 40, 'active': false },
  27031. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27032. * ];
  27033. *
  27034. * _.find(users, function(o) { return o.age < 40; });
  27035. * // => object for 'barney'
  27036. *
  27037. * // The `_.matches` iteratee shorthand.
  27038. * _.find(users, { 'age': 1, 'active': true });
  27039. * // => object for 'pebbles'
  27040. *
  27041. * // The `_.matchesProperty` iteratee shorthand.
  27042. * _.find(users, ['active', false]);
  27043. * // => object for 'fred'
  27044. *
  27045. * // The `_.property` iteratee shorthand.
  27046. * _.find(users, 'active');
  27047. * // => object for 'barney'
  27048. */
  27049. var find = createFind(findIndex);
  27050. /**
  27051. * This method is like `_.find` except that it iterates over elements of
  27052. * `collection` from right to left.
  27053. *
  27054. * @static
  27055. * @memberOf _
  27056. * @since 2.0.0
  27057. * @category Collection
  27058. * @param {Array|Object} collection The collection to inspect.
  27059. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27060. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27061. * @returns {*} Returns the matched element, else `undefined`.
  27062. * @example
  27063. *
  27064. * _.findLast([1, 2, 3, 4], function(n) {
  27065. * return n % 2 == 1;
  27066. * });
  27067. * // => 3
  27068. */
  27069. var findLast = createFind(findLastIndex);
  27070. /**
  27071. * Creates a flattened array of values by running each element in `collection`
  27072. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27073. * with three arguments: (value, index|key, collection).
  27074. *
  27075. * @static
  27076. * @memberOf _
  27077. * @since 4.0.0
  27078. * @category Collection
  27079. * @param {Array|Object} collection The collection to iterate over.
  27080. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27081. * @returns {Array} Returns the new flattened array.
  27082. * @example
  27083. *
  27084. * function duplicate(n) {
  27085. * return [n, n];
  27086. * }
  27087. *
  27088. * _.flatMap([1, 2], duplicate);
  27089. * // => [1, 1, 2, 2]
  27090. */
  27091. function flatMap(collection, iteratee) {
  27092. return baseFlatten(map(collection, iteratee), 1);
  27093. }
  27094. /**
  27095. * This method is like `_.flatMap` except that it recursively flattens the
  27096. * mapped results.
  27097. *
  27098. * @static
  27099. * @memberOf _
  27100. * @since 4.7.0
  27101. * @category Collection
  27102. * @param {Array|Object} collection The collection to iterate over.
  27103. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27104. * @returns {Array} Returns the new flattened array.
  27105. * @example
  27106. *
  27107. * function duplicate(n) {
  27108. * return [[[n, n]]];
  27109. * }
  27110. *
  27111. * _.flatMapDeep([1, 2], duplicate);
  27112. * // => [1, 1, 2, 2]
  27113. */
  27114. function flatMapDeep(collection, iteratee) {
  27115. return baseFlatten(map(collection, iteratee), INFINITY);
  27116. }
  27117. /**
  27118. * This method is like `_.flatMap` except that it recursively flattens the
  27119. * mapped results up to `depth` times.
  27120. *
  27121. * @static
  27122. * @memberOf _
  27123. * @since 4.7.0
  27124. * @category Collection
  27125. * @param {Array|Object} collection The collection to iterate over.
  27126. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27127. * @param {number} [depth=1] The maximum recursion depth.
  27128. * @returns {Array} Returns the new flattened array.
  27129. * @example
  27130. *
  27131. * function duplicate(n) {
  27132. * return [[[n, n]]];
  27133. * }
  27134. *
  27135. * _.flatMapDepth([1, 2], duplicate, 2);
  27136. * // => [[1, 1], [2, 2]]
  27137. */
  27138. function flatMapDepth(collection, iteratee, depth) {
  27139. depth = depth === undefined ? 1 : toInteger(depth);
  27140. return baseFlatten(map(collection, iteratee), depth);
  27141. }
  27142. /**
  27143. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27144. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27145. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27146. *
  27147. * **Note:** As with other "Collections" methods, objects with a "length"
  27148. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27149. * or `_.forOwn` for object iteration.
  27150. *
  27151. * @static
  27152. * @memberOf _
  27153. * @since 0.1.0
  27154. * @alias each
  27155. * @category Collection
  27156. * @param {Array|Object} collection The collection to iterate over.
  27157. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27158. * @returns {Array|Object} Returns `collection`.
  27159. * @see _.forEachRight
  27160. * @example
  27161. *
  27162. * _.forEach([1, 2], function(value) {
  27163. * console.log(value);
  27164. * });
  27165. * // => Logs `1` then `2`.
  27166. *
  27167. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27168. * console.log(key);
  27169. * });
  27170. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27171. */
  27172. function forEach(collection, iteratee) {
  27173. var func = isArray(collection) ? arrayEach : baseEach;
  27174. return func(collection, getIteratee(iteratee, 3));
  27175. }
  27176. /**
  27177. * This method is like `_.forEach` except that it iterates over elements of
  27178. * `collection` from right to left.
  27179. *
  27180. * @static
  27181. * @memberOf _
  27182. * @since 2.0.0
  27183. * @alias eachRight
  27184. * @category Collection
  27185. * @param {Array|Object} collection The collection to iterate over.
  27186. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27187. * @returns {Array|Object} Returns `collection`.
  27188. * @see _.forEach
  27189. * @example
  27190. *
  27191. * _.forEachRight([1, 2], function(value) {
  27192. * console.log(value);
  27193. * });
  27194. * // => Logs `2` then `1`.
  27195. */
  27196. function forEachRight(collection, iteratee) {
  27197. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27198. return func(collection, getIteratee(iteratee, 3));
  27199. }
  27200. /**
  27201. * Creates an object composed of keys generated from the results of running
  27202. * each element of `collection` thru `iteratee`. The order of grouped values
  27203. * is determined by the order they occur in `collection`. The corresponding
  27204. * value of each key is an array of elements responsible for generating the
  27205. * key. The iteratee is invoked with one argument: (value).
  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 iteratee to transform keys.
  27213. * @returns {Object} Returns the composed aggregate object.
  27214. * @example
  27215. *
  27216. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27217. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27218. *
  27219. * // The `_.property` iteratee shorthand.
  27220. * _.groupBy(['one', 'two', 'three'], 'length');
  27221. * // => { '3': ['one', 'two'], '5': ['three'] }
  27222. */
  27223. var groupBy = createAggregator(function(result, value, key) {
  27224. if (hasOwnProperty.call(result, key)) {
  27225. result[key].push(value);
  27226. } else {
  27227. baseAssignValue(result, key, [value]);
  27228. }
  27229. });
  27230. /**
  27231. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27232. * checked for a substring of `value`, otherwise
  27233. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27234. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27235. * the offset from the end of `collection`.
  27236. *
  27237. * @static
  27238. * @memberOf _
  27239. * @since 0.1.0
  27240. * @category Collection
  27241. * @param {Array|Object|string} collection The collection to inspect.
  27242. * @param {*} value The value to search for.
  27243. * @param {number} [fromIndex=0] The index to search from.
  27244. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27245. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27246. * @example
  27247. *
  27248. * _.includes([1, 2, 3], 1);
  27249. * // => true
  27250. *
  27251. * _.includes([1, 2, 3], 1, 2);
  27252. * // => false
  27253. *
  27254. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27255. * // => true
  27256. *
  27257. * _.includes('abcd', 'bc');
  27258. * // => true
  27259. */
  27260. function includes(collection, value, fromIndex, guard) {
  27261. collection = isArrayLike(collection) ? collection : values(collection);
  27262. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27263. var length = collection.length;
  27264. if (fromIndex < 0) {
  27265. fromIndex = nativeMax(length + fromIndex, 0);
  27266. }
  27267. return isString(collection)
  27268. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27269. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27270. }
  27271. /**
  27272. * Invokes the method at `path` of each element in `collection`, returning
  27273. * an array of the results of each invoked method. Any additional arguments
  27274. * are provided to each invoked method. If `path` is a function, it's invoked
  27275. * for, and `this` bound to, each element in `collection`.
  27276. *
  27277. * @static
  27278. * @memberOf _
  27279. * @since 4.0.0
  27280. * @category Collection
  27281. * @param {Array|Object} collection The collection to iterate over.
  27282. * @param {Array|Function|string} path The path of the method to invoke or
  27283. * the function invoked per iteration.
  27284. * @param {...*} [args] The arguments to invoke each method with.
  27285. * @returns {Array} Returns the array of results.
  27286. * @example
  27287. *
  27288. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27289. * // => [[1, 5, 7], [1, 2, 3]]
  27290. *
  27291. * _.invokeMap([123, 456], String.prototype.split, '');
  27292. * // => [['1', '2', '3'], ['4', '5', '6']]
  27293. */
  27294. var invokeMap = baseRest(function(collection, path, args) {
  27295. var index = -1,
  27296. isFunc = typeof path == 'function',
  27297. result = isArrayLike(collection) ? Array(collection.length) : [];
  27298. baseEach(collection, function(value) {
  27299. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27300. });
  27301. return result;
  27302. });
  27303. /**
  27304. * Creates an object composed of keys generated from the results of running
  27305. * each element of `collection` thru `iteratee`. The corresponding value of
  27306. * each key is the last element responsible for generating the key. The
  27307. * iteratee is invoked with one argument: (value).
  27308. *
  27309. * @static
  27310. * @memberOf _
  27311. * @since 4.0.0
  27312. * @category Collection
  27313. * @param {Array|Object} collection The collection to iterate over.
  27314. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27315. * @returns {Object} Returns the composed aggregate object.
  27316. * @example
  27317. *
  27318. * var array = [
  27319. * { 'dir': 'left', 'code': 97 },
  27320. * { 'dir': 'right', 'code': 100 }
  27321. * ];
  27322. *
  27323. * _.keyBy(array, function(o) {
  27324. * return String.fromCharCode(o.code);
  27325. * });
  27326. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27327. *
  27328. * _.keyBy(array, 'dir');
  27329. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27330. */
  27331. var keyBy = createAggregator(function(result, value, key) {
  27332. baseAssignValue(result, key, value);
  27333. });
  27334. /**
  27335. * Creates an array of values by running each element in `collection` thru
  27336. * `iteratee`. The iteratee is invoked with three arguments:
  27337. * (value, index|key, collection).
  27338. *
  27339. * Many lodash methods are guarded to work as iteratees for methods like
  27340. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27341. *
  27342. * The guarded methods are:
  27343. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27344. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27345. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27346. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27347. *
  27348. * @static
  27349. * @memberOf _
  27350. * @since 0.1.0
  27351. * @category Collection
  27352. * @param {Array|Object} collection The collection to iterate over.
  27353. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27354. * @returns {Array} Returns the new mapped array.
  27355. * @example
  27356. *
  27357. * function square(n) {
  27358. * return n * n;
  27359. * }
  27360. *
  27361. * _.map([4, 8], square);
  27362. * // => [16, 64]
  27363. *
  27364. * _.map({ 'a': 4, 'b': 8 }, square);
  27365. * // => [16, 64] (iteration order is not guaranteed)
  27366. *
  27367. * var users = [
  27368. * { 'user': 'barney' },
  27369. * { 'user': 'fred' }
  27370. * ];
  27371. *
  27372. * // The `_.property` iteratee shorthand.
  27373. * _.map(users, 'user');
  27374. * // => ['barney', 'fred']
  27375. */
  27376. function map(collection, iteratee) {
  27377. var func = isArray(collection) ? arrayMap : baseMap;
  27378. return func(collection, getIteratee(iteratee, 3));
  27379. }
  27380. /**
  27381. * This method is like `_.sortBy` except that it allows specifying the sort
  27382. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27383. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27384. * descending or "asc" for ascending sort order of corresponding values.
  27385. *
  27386. * @static
  27387. * @memberOf _
  27388. * @since 4.0.0
  27389. * @category Collection
  27390. * @param {Array|Object} collection The collection to iterate over.
  27391. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27392. * The iteratees to sort by.
  27393. * @param {string[]} [orders] The sort orders of `iteratees`.
  27394. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27395. * @returns {Array} Returns the new sorted array.
  27396. * @example
  27397. *
  27398. * var users = [
  27399. * { 'user': 'fred', 'age': 48 },
  27400. * { 'user': 'barney', 'age': 34 },
  27401. * { 'user': 'fred', 'age': 40 },
  27402. * { 'user': 'barney', 'age': 36 }
  27403. * ];
  27404. *
  27405. * // Sort by `user` in ascending order and by `age` in descending order.
  27406. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27407. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27408. */
  27409. function orderBy(collection, iteratees, orders, guard) {
  27410. if (collection == null) {
  27411. return [];
  27412. }
  27413. if (!isArray(iteratees)) {
  27414. iteratees = iteratees == null ? [] : [iteratees];
  27415. }
  27416. orders = guard ? undefined : orders;
  27417. if (!isArray(orders)) {
  27418. orders = orders == null ? [] : [orders];
  27419. }
  27420. return baseOrderBy(collection, iteratees, orders);
  27421. }
  27422. /**
  27423. * Creates an array of elements split into two groups, the first of which
  27424. * contains elements `predicate` returns truthy for, the second of which
  27425. * contains elements `predicate` returns falsey for. The predicate is
  27426. * invoked with one argument: (value).
  27427. *
  27428. * @static
  27429. * @memberOf _
  27430. * @since 3.0.0
  27431. * @category Collection
  27432. * @param {Array|Object} collection The collection to iterate over.
  27433. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27434. * @returns {Array} Returns the array of grouped elements.
  27435. * @example
  27436. *
  27437. * var users = [
  27438. * { 'user': 'barney', 'age': 36, 'active': false },
  27439. * { 'user': 'fred', 'age': 40, 'active': true },
  27440. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27441. * ];
  27442. *
  27443. * _.partition(users, function(o) { return o.active; });
  27444. * // => objects for [['fred'], ['barney', 'pebbles']]
  27445. *
  27446. * // The `_.matches` iteratee shorthand.
  27447. * _.partition(users, { 'age': 1, 'active': false });
  27448. * // => objects for [['pebbles'], ['barney', 'fred']]
  27449. *
  27450. * // The `_.matchesProperty` iteratee shorthand.
  27451. * _.partition(users, ['active', false]);
  27452. * // => objects for [['barney', 'pebbles'], ['fred']]
  27453. *
  27454. * // The `_.property` iteratee shorthand.
  27455. * _.partition(users, 'active');
  27456. * // => objects for [['fred'], ['barney', 'pebbles']]
  27457. */
  27458. var partition = createAggregator(function(result, value, key) {
  27459. result[key ? 0 : 1].push(value);
  27460. }, function() { return [[], []]; });
  27461. /**
  27462. * Reduces `collection` to a value which is the accumulated result of running
  27463. * each element in `collection` thru `iteratee`, where each successive
  27464. * invocation is supplied the return value of the previous. If `accumulator`
  27465. * is not given, the first element of `collection` is used as the initial
  27466. * value. The iteratee is invoked with four arguments:
  27467. * (accumulator, value, index|key, collection).
  27468. *
  27469. * Many lodash methods are guarded to work as iteratees for methods like
  27470. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27471. *
  27472. * The guarded methods are:
  27473. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27474. * and `sortBy`
  27475. *
  27476. * @static
  27477. * @memberOf _
  27478. * @since 0.1.0
  27479. * @category Collection
  27480. * @param {Array|Object} collection The collection to iterate over.
  27481. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27482. * @param {*} [accumulator] The initial value.
  27483. * @returns {*} Returns the accumulated value.
  27484. * @see _.reduceRight
  27485. * @example
  27486. *
  27487. * _.reduce([1, 2], function(sum, n) {
  27488. * return sum + n;
  27489. * }, 0);
  27490. * // => 3
  27491. *
  27492. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27493. * (result[value] || (result[value] = [])).push(key);
  27494. * return result;
  27495. * }, {});
  27496. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27497. */
  27498. function reduce(collection, iteratee, accumulator) {
  27499. var func = isArray(collection) ? arrayReduce : baseReduce,
  27500. initAccum = arguments.length < 3;
  27501. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27502. }
  27503. /**
  27504. * This method is like `_.reduce` except that it iterates over elements of
  27505. * `collection` from right to left.
  27506. *
  27507. * @static
  27508. * @memberOf _
  27509. * @since 0.1.0
  27510. * @category Collection
  27511. * @param {Array|Object} collection The collection to iterate over.
  27512. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27513. * @param {*} [accumulator] The initial value.
  27514. * @returns {*} Returns the accumulated value.
  27515. * @see _.reduce
  27516. * @example
  27517. *
  27518. * var array = [[0, 1], [2, 3], [4, 5]];
  27519. *
  27520. * _.reduceRight(array, function(flattened, other) {
  27521. * return flattened.concat(other);
  27522. * }, []);
  27523. * // => [4, 5, 2, 3, 0, 1]
  27524. */
  27525. function reduceRight(collection, iteratee, accumulator) {
  27526. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27527. initAccum = arguments.length < 3;
  27528. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27529. }
  27530. /**
  27531. * The opposite of `_.filter`; this method returns the elements of `collection`
  27532. * that `predicate` does **not** return truthy for.
  27533. *
  27534. * @static
  27535. * @memberOf _
  27536. * @since 0.1.0
  27537. * @category Collection
  27538. * @param {Array|Object} collection The collection to iterate over.
  27539. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27540. * @returns {Array} Returns the new filtered array.
  27541. * @see _.filter
  27542. * @example
  27543. *
  27544. * var users = [
  27545. * { 'user': 'barney', 'age': 36, 'active': false },
  27546. * { 'user': 'fred', 'age': 40, 'active': true }
  27547. * ];
  27548. *
  27549. * _.reject(users, function(o) { return !o.active; });
  27550. * // => objects for ['fred']
  27551. *
  27552. * // The `_.matches` iteratee shorthand.
  27553. * _.reject(users, { 'age': 40, 'active': true });
  27554. * // => objects for ['barney']
  27555. *
  27556. * // The `_.matchesProperty` iteratee shorthand.
  27557. * _.reject(users, ['active', false]);
  27558. * // => objects for ['fred']
  27559. *
  27560. * // The `_.property` iteratee shorthand.
  27561. * _.reject(users, 'active');
  27562. * // => objects for ['barney']
  27563. */
  27564. function reject(collection, predicate) {
  27565. var func = isArray(collection) ? arrayFilter : baseFilter;
  27566. return func(collection, negate(getIteratee(predicate, 3)));
  27567. }
  27568. /**
  27569. * Gets a random element from `collection`.
  27570. *
  27571. * @static
  27572. * @memberOf _
  27573. * @since 2.0.0
  27574. * @category Collection
  27575. * @param {Array|Object} collection The collection to sample.
  27576. * @returns {*} Returns the random element.
  27577. * @example
  27578. *
  27579. * _.sample([1, 2, 3, 4]);
  27580. * // => 2
  27581. */
  27582. function sample(collection) {
  27583. var func = isArray(collection) ? arraySample : baseSample;
  27584. return func(collection);
  27585. }
  27586. /**
  27587. * Gets `n` random elements at unique keys from `collection` up to the
  27588. * size of `collection`.
  27589. *
  27590. * @static
  27591. * @memberOf _
  27592. * @since 4.0.0
  27593. * @category Collection
  27594. * @param {Array|Object} collection The collection to sample.
  27595. * @param {number} [n=1] The number of elements to sample.
  27596. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27597. * @returns {Array} Returns the random elements.
  27598. * @example
  27599. *
  27600. * _.sampleSize([1, 2, 3], 2);
  27601. * // => [3, 1]
  27602. *
  27603. * _.sampleSize([1, 2, 3], 4);
  27604. * // => [2, 3, 1]
  27605. */
  27606. function sampleSize(collection, n, guard) {
  27607. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27608. n = 1;
  27609. } else {
  27610. n = toInteger(n);
  27611. }
  27612. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27613. return func(collection, n);
  27614. }
  27615. /**
  27616. * Creates an array of shuffled values, using a version of the
  27617. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27618. *
  27619. * @static
  27620. * @memberOf _
  27621. * @since 0.1.0
  27622. * @category Collection
  27623. * @param {Array|Object} collection The collection to shuffle.
  27624. * @returns {Array} Returns the new shuffled array.
  27625. * @example
  27626. *
  27627. * _.shuffle([1, 2, 3, 4]);
  27628. * // => [4, 1, 3, 2]
  27629. */
  27630. function shuffle(collection) {
  27631. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27632. return func(collection);
  27633. }
  27634. /**
  27635. * Gets the size of `collection` by returning its length for array-like
  27636. * values or the number of own enumerable string keyed properties for objects.
  27637. *
  27638. * @static
  27639. * @memberOf _
  27640. * @since 0.1.0
  27641. * @category Collection
  27642. * @param {Array|Object|string} collection The collection to inspect.
  27643. * @returns {number} Returns the collection size.
  27644. * @example
  27645. *
  27646. * _.size([1, 2, 3]);
  27647. * // => 3
  27648. *
  27649. * _.size({ 'a': 1, 'b': 2 });
  27650. * // => 2
  27651. *
  27652. * _.size('pebbles');
  27653. * // => 7
  27654. */
  27655. function size(collection) {
  27656. if (collection == null) {
  27657. return 0;
  27658. }
  27659. if (isArrayLike(collection)) {
  27660. return isString(collection) ? stringSize(collection) : collection.length;
  27661. }
  27662. var tag = getTag(collection);
  27663. if (tag == mapTag || tag == setTag) {
  27664. return collection.size;
  27665. }
  27666. return baseKeys(collection).length;
  27667. }
  27668. /**
  27669. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27670. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27671. * invoked with three arguments: (value, index|key, collection).
  27672. *
  27673. * @static
  27674. * @memberOf _
  27675. * @since 0.1.0
  27676. * @category Collection
  27677. * @param {Array|Object} collection The collection to iterate over.
  27678. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27679. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27680. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27681. * else `false`.
  27682. * @example
  27683. *
  27684. * _.some([null, 0, 'yes', false], Boolean);
  27685. * // => true
  27686. *
  27687. * var users = [
  27688. * { 'user': 'barney', 'active': true },
  27689. * { 'user': 'fred', 'active': false }
  27690. * ];
  27691. *
  27692. * // The `_.matches` iteratee shorthand.
  27693. * _.some(users, { 'user': 'barney', 'active': false });
  27694. * // => false
  27695. *
  27696. * // The `_.matchesProperty` iteratee shorthand.
  27697. * _.some(users, ['active', false]);
  27698. * // => true
  27699. *
  27700. * // The `_.property` iteratee shorthand.
  27701. * _.some(users, 'active');
  27702. * // => true
  27703. */
  27704. function some(collection, predicate, guard) {
  27705. var func = isArray(collection) ? arraySome : baseSome;
  27706. if (guard && isIterateeCall(collection, predicate, guard)) {
  27707. predicate = undefined;
  27708. }
  27709. return func(collection, getIteratee(predicate, 3));
  27710. }
  27711. /**
  27712. * Creates an array of elements, sorted in ascending order by the results of
  27713. * running each element in a collection thru each iteratee. This method
  27714. * performs a stable sort, that is, it preserves the original sort order of
  27715. * equal elements. The iteratees are invoked with one argument: (value).
  27716. *
  27717. * @static
  27718. * @memberOf _
  27719. * @since 0.1.0
  27720. * @category Collection
  27721. * @param {Array|Object} collection The collection to iterate over.
  27722. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27723. * The iteratees to sort by.
  27724. * @returns {Array} Returns the new sorted array.
  27725. * @example
  27726. *
  27727. * var users = [
  27728. * { 'user': 'fred', 'age': 48 },
  27729. * { 'user': 'barney', 'age': 36 },
  27730. * { 'user': 'fred', 'age': 40 },
  27731. * { 'user': 'barney', 'age': 34 }
  27732. * ];
  27733. *
  27734. * _.sortBy(users, [function(o) { return o.user; }]);
  27735. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27736. *
  27737. * _.sortBy(users, ['user', 'age']);
  27738. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27739. */
  27740. var sortBy = baseRest(function(collection, iteratees) {
  27741. if (collection == null) {
  27742. return [];
  27743. }
  27744. var length = iteratees.length;
  27745. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27746. iteratees = [];
  27747. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27748. iteratees = [iteratees[0]];
  27749. }
  27750. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27751. });
  27752. /*------------------------------------------------------------------------*/
  27753. /**
  27754. * Gets the timestamp of the number of milliseconds that have elapsed since
  27755. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27756. *
  27757. * @static
  27758. * @memberOf _
  27759. * @since 2.4.0
  27760. * @category Date
  27761. * @returns {number} Returns the timestamp.
  27762. * @example
  27763. *
  27764. * _.defer(function(stamp) {
  27765. * console.log(_.now() - stamp);
  27766. * }, _.now());
  27767. * // => Logs the number of milliseconds it took for the deferred invocation.
  27768. */
  27769. var now = ctxNow || function() {
  27770. return root.Date.now();
  27771. };
  27772. /*------------------------------------------------------------------------*/
  27773. /**
  27774. * The opposite of `_.before`; this method creates a function that invokes
  27775. * `func` once it's called `n` or more times.
  27776. *
  27777. * @static
  27778. * @memberOf _
  27779. * @since 0.1.0
  27780. * @category Function
  27781. * @param {number} n The number of calls before `func` is invoked.
  27782. * @param {Function} func The function to restrict.
  27783. * @returns {Function} Returns the new restricted function.
  27784. * @example
  27785. *
  27786. * var saves = ['profile', 'settings'];
  27787. *
  27788. * var done = _.after(saves.length, function() {
  27789. * console.log('done saving!');
  27790. * });
  27791. *
  27792. * _.forEach(saves, function(type) {
  27793. * asyncSave({ 'type': type, 'complete': done });
  27794. * });
  27795. * // => Logs 'done saving!' after the two async saves have completed.
  27796. */
  27797. function after(n, func) {
  27798. if (typeof func != 'function') {
  27799. throw new TypeError(FUNC_ERROR_TEXT);
  27800. }
  27801. n = toInteger(n);
  27802. return function() {
  27803. if (--n < 1) {
  27804. return func.apply(this, arguments);
  27805. }
  27806. };
  27807. }
  27808. /**
  27809. * Creates a function that invokes `func`, with up to `n` arguments,
  27810. * ignoring any additional arguments.
  27811. *
  27812. * @static
  27813. * @memberOf _
  27814. * @since 3.0.0
  27815. * @category Function
  27816. * @param {Function} func The function to cap arguments for.
  27817. * @param {number} [n=func.length] The arity cap.
  27818. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27819. * @returns {Function} Returns the new capped function.
  27820. * @example
  27821. *
  27822. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27823. * // => [6, 8, 10]
  27824. */
  27825. function ary(func, n, guard) {
  27826. n = guard ? undefined : n;
  27827. n = (func && n == null) ? func.length : n;
  27828. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27829. }
  27830. /**
  27831. * Creates a function that invokes `func`, with the `this` binding and arguments
  27832. * of the created function, while it's called less than `n` times. Subsequent
  27833. * calls to the created function return the result of the last `func` invocation.
  27834. *
  27835. * @static
  27836. * @memberOf _
  27837. * @since 3.0.0
  27838. * @category Function
  27839. * @param {number} n The number of calls at which `func` is no longer invoked.
  27840. * @param {Function} func The function to restrict.
  27841. * @returns {Function} Returns the new restricted function.
  27842. * @example
  27843. *
  27844. * jQuery(element).on('click', _.before(5, addContactToList));
  27845. * // => Allows adding up to 4 contacts to the list.
  27846. */
  27847. function before(n, func) {
  27848. var result;
  27849. if (typeof func != 'function') {
  27850. throw new TypeError(FUNC_ERROR_TEXT);
  27851. }
  27852. n = toInteger(n);
  27853. return function() {
  27854. if (--n > 0) {
  27855. result = func.apply(this, arguments);
  27856. }
  27857. if (n <= 1) {
  27858. func = undefined;
  27859. }
  27860. return result;
  27861. };
  27862. }
  27863. /**
  27864. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27865. * and `partials` prepended to the arguments it receives.
  27866. *
  27867. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27868. * may be used as a placeholder for partially applied arguments.
  27869. *
  27870. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27871. * property of bound functions.
  27872. *
  27873. * @static
  27874. * @memberOf _
  27875. * @since 0.1.0
  27876. * @category Function
  27877. * @param {Function} func The function to bind.
  27878. * @param {*} thisArg The `this` binding of `func`.
  27879. * @param {...*} [partials] The arguments to be partially applied.
  27880. * @returns {Function} Returns the new bound function.
  27881. * @example
  27882. *
  27883. * function greet(greeting, punctuation) {
  27884. * return greeting + ' ' + this.user + punctuation;
  27885. * }
  27886. *
  27887. * var object = { 'user': 'fred' };
  27888. *
  27889. * var bound = _.bind(greet, object, 'hi');
  27890. * bound('!');
  27891. * // => 'hi fred!'
  27892. *
  27893. * // Bound with placeholders.
  27894. * var bound = _.bind(greet, object, _, '!');
  27895. * bound('hi');
  27896. * // => 'hi fred!'
  27897. */
  27898. var bind = baseRest(function(func, thisArg, partials) {
  27899. var bitmask = WRAP_BIND_FLAG;
  27900. if (partials.length) {
  27901. var holders = replaceHolders(partials, getHolder(bind));
  27902. bitmask |= WRAP_PARTIAL_FLAG;
  27903. }
  27904. return createWrap(func, bitmask, thisArg, partials, holders);
  27905. });
  27906. /**
  27907. * Creates a function that invokes the method at `object[key]` with `partials`
  27908. * prepended to the arguments it receives.
  27909. *
  27910. * This method differs from `_.bind` by allowing bound functions to reference
  27911. * methods that may be redefined or don't yet exist. See
  27912. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27913. * for more details.
  27914. *
  27915. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27916. * builds, may be used as a placeholder for partially applied arguments.
  27917. *
  27918. * @static
  27919. * @memberOf _
  27920. * @since 0.10.0
  27921. * @category Function
  27922. * @param {Object} object The object to invoke the method on.
  27923. * @param {string} key The key of the method.
  27924. * @param {...*} [partials] The arguments to be partially applied.
  27925. * @returns {Function} Returns the new bound function.
  27926. * @example
  27927. *
  27928. * var object = {
  27929. * 'user': 'fred',
  27930. * 'greet': function(greeting, punctuation) {
  27931. * return greeting + ' ' + this.user + punctuation;
  27932. * }
  27933. * };
  27934. *
  27935. * var bound = _.bindKey(object, 'greet', 'hi');
  27936. * bound('!');
  27937. * // => 'hi fred!'
  27938. *
  27939. * object.greet = function(greeting, punctuation) {
  27940. * return greeting + 'ya ' + this.user + punctuation;
  27941. * };
  27942. *
  27943. * bound('!');
  27944. * // => 'hiya fred!'
  27945. *
  27946. * // Bound with placeholders.
  27947. * var bound = _.bindKey(object, 'greet', _, '!');
  27948. * bound('hi');
  27949. * // => 'hiya fred!'
  27950. */
  27951. var bindKey = baseRest(function(object, key, partials) {
  27952. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27953. if (partials.length) {
  27954. var holders = replaceHolders(partials, getHolder(bindKey));
  27955. bitmask |= WRAP_PARTIAL_FLAG;
  27956. }
  27957. return createWrap(key, bitmask, object, partials, holders);
  27958. });
  27959. /**
  27960. * Creates a function that accepts arguments of `func` and either invokes
  27961. * `func` returning its result, if at least `arity` number of arguments have
  27962. * been provided, or returns a function that accepts the remaining `func`
  27963. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27964. * is not sufficient.
  27965. *
  27966. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27967. * may be used as a placeholder for provided arguments.
  27968. *
  27969. * **Note:** This method doesn't set the "length" property of curried functions.
  27970. *
  27971. * @static
  27972. * @memberOf _
  27973. * @since 2.0.0
  27974. * @category Function
  27975. * @param {Function} func The function to curry.
  27976. * @param {number} [arity=func.length] The arity of `func`.
  27977. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27978. * @returns {Function} Returns the new curried function.
  27979. * @example
  27980. *
  27981. * var abc = function(a, b, c) {
  27982. * return [a, b, c];
  27983. * };
  27984. *
  27985. * var curried = _.curry(abc);
  27986. *
  27987. * curried(1)(2)(3);
  27988. * // => [1, 2, 3]
  27989. *
  27990. * curried(1, 2)(3);
  27991. * // => [1, 2, 3]
  27992. *
  27993. * curried(1, 2, 3);
  27994. * // => [1, 2, 3]
  27995. *
  27996. * // Curried with placeholders.
  27997. * curried(1)(_, 3)(2);
  27998. * // => [1, 2, 3]
  27999. */
  28000. function curry(func, arity, guard) {
  28001. arity = guard ? undefined : arity;
  28002. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28003. result.placeholder = curry.placeholder;
  28004. return result;
  28005. }
  28006. /**
  28007. * This method is like `_.curry` except that arguments are applied to `func`
  28008. * in the manner of `_.partialRight` instead of `_.partial`.
  28009. *
  28010. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28011. * builds, may be used as a placeholder for provided arguments.
  28012. *
  28013. * **Note:** This method doesn't set the "length" property of curried functions.
  28014. *
  28015. * @static
  28016. * @memberOf _
  28017. * @since 3.0.0
  28018. * @category Function
  28019. * @param {Function} func The function to curry.
  28020. * @param {number} [arity=func.length] The arity of `func`.
  28021. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28022. * @returns {Function} Returns the new curried function.
  28023. * @example
  28024. *
  28025. * var abc = function(a, b, c) {
  28026. * return [a, b, c];
  28027. * };
  28028. *
  28029. * var curried = _.curryRight(abc);
  28030. *
  28031. * curried(3)(2)(1);
  28032. * // => [1, 2, 3]
  28033. *
  28034. * curried(2, 3)(1);
  28035. * // => [1, 2, 3]
  28036. *
  28037. * curried(1, 2, 3);
  28038. * // => [1, 2, 3]
  28039. *
  28040. * // Curried with placeholders.
  28041. * curried(3)(1, _)(2);
  28042. * // => [1, 2, 3]
  28043. */
  28044. function curryRight(func, arity, guard) {
  28045. arity = guard ? undefined : arity;
  28046. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28047. result.placeholder = curryRight.placeholder;
  28048. return result;
  28049. }
  28050. /**
  28051. * Creates a debounced function that delays invoking `func` until after `wait`
  28052. * milliseconds have elapsed since the last time the debounced function was
  28053. * invoked. The debounced function comes with a `cancel` method to cancel
  28054. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28055. * Provide `options` to indicate whether `func` should be invoked on the
  28056. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28057. * with the last arguments provided to the debounced function. Subsequent
  28058. * calls to the debounced function return the result of the last `func`
  28059. * invocation.
  28060. *
  28061. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28062. * invoked on the trailing edge of the timeout only if the debounced function
  28063. * is invoked more than once during the `wait` timeout.
  28064. *
  28065. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28066. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28067. *
  28068. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28069. * for details over the differences between `_.debounce` and `_.throttle`.
  28070. *
  28071. * @static
  28072. * @memberOf _
  28073. * @since 0.1.0
  28074. * @category Function
  28075. * @param {Function} func The function to debounce.
  28076. * @param {number} [wait=0] The number of milliseconds to delay.
  28077. * @param {Object} [options={}] The options object.
  28078. * @param {boolean} [options.leading=false]
  28079. * Specify invoking on the leading edge of the timeout.
  28080. * @param {number} [options.maxWait]
  28081. * The maximum time `func` is allowed to be delayed before it's invoked.
  28082. * @param {boolean} [options.trailing=true]
  28083. * Specify invoking on the trailing edge of the timeout.
  28084. * @returns {Function} Returns the new debounced function.
  28085. * @example
  28086. *
  28087. * // Avoid costly calculations while the window size is in flux.
  28088. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28089. *
  28090. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28091. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28092. * 'leading': true,
  28093. * 'trailing': false
  28094. * }));
  28095. *
  28096. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28097. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28098. * var source = new EventSource('/stream');
  28099. * jQuery(source).on('message', debounced);
  28100. *
  28101. * // Cancel the trailing debounced invocation.
  28102. * jQuery(window).on('popstate', debounced.cancel);
  28103. */
  28104. function debounce(func, wait, options) {
  28105. var lastArgs,
  28106. lastThis,
  28107. maxWait,
  28108. result,
  28109. timerId,
  28110. lastCallTime,
  28111. lastInvokeTime = 0,
  28112. leading = false,
  28113. maxing = false,
  28114. trailing = true;
  28115. if (typeof func != 'function') {
  28116. throw new TypeError(FUNC_ERROR_TEXT);
  28117. }
  28118. wait = toNumber(wait) || 0;
  28119. if (isObject(options)) {
  28120. leading = !!options.leading;
  28121. maxing = 'maxWait' in options;
  28122. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28123. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28124. }
  28125. function invokeFunc(time) {
  28126. var args = lastArgs,
  28127. thisArg = lastThis;
  28128. lastArgs = lastThis = undefined;
  28129. lastInvokeTime = time;
  28130. result = func.apply(thisArg, args);
  28131. return result;
  28132. }
  28133. function leadingEdge(time) {
  28134. // Reset any `maxWait` timer.
  28135. lastInvokeTime = time;
  28136. // Start the timer for the trailing edge.
  28137. timerId = setTimeout(timerExpired, wait);
  28138. // Invoke the leading edge.
  28139. return leading ? invokeFunc(time) : result;
  28140. }
  28141. function remainingWait(time) {
  28142. var timeSinceLastCall = time - lastCallTime,
  28143. timeSinceLastInvoke = time - lastInvokeTime,
  28144. timeWaiting = wait - timeSinceLastCall;
  28145. return maxing
  28146. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28147. : timeWaiting;
  28148. }
  28149. function shouldInvoke(time) {
  28150. var timeSinceLastCall = time - lastCallTime,
  28151. timeSinceLastInvoke = time - lastInvokeTime;
  28152. // Either this is the first call, activity has stopped and we're at the
  28153. // trailing edge, the system time has gone backwards and we're treating
  28154. // it as the trailing edge, or we've hit the `maxWait` limit.
  28155. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28156. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28157. }
  28158. function timerExpired() {
  28159. var time = now();
  28160. if (shouldInvoke(time)) {
  28161. return trailingEdge(time);
  28162. }
  28163. // Restart the timer.
  28164. timerId = setTimeout(timerExpired, remainingWait(time));
  28165. }
  28166. function trailingEdge(time) {
  28167. timerId = undefined;
  28168. // Only invoke if we have `lastArgs` which means `func` has been
  28169. // debounced at least once.
  28170. if (trailing && lastArgs) {
  28171. return invokeFunc(time);
  28172. }
  28173. lastArgs = lastThis = undefined;
  28174. return result;
  28175. }
  28176. function cancel() {
  28177. if (timerId !== undefined) {
  28178. clearTimeout(timerId);
  28179. }
  28180. lastInvokeTime = 0;
  28181. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28182. }
  28183. function flush() {
  28184. return timerId === undefined ? result : trailingEdge(now());
  28185. }
  28186. function debounced() {
  28187. var time = now(),
  28188. isInvoking = shouldInvoke(time);
  28189. lastArgs = arguments;
  28190. lastThis = this;
  28191. lastCallTime = time;
  28192. if (isInvoking) {
  28193. if (timerId === undefined) {
  28194. return leadingEdge(lastCallTime);
  28195. }
  28196. if (maxing) {
  28197. // Handle invocations in a tight loop.
  28198. clearTimeout(timerId);
  28199. timerId = setTimeout(timerExpired, wait);
  28200. return invokeFunc(lastCallTime);
  28201. }
  28202. }
  28203. if (timerId === undefined) {
  28204. timerId = setTimeout(timerExpired, wait);
  28205. }
  28206. return result;
  28207. }
  28208. debounced.cancel = cancel;
  28209. debounced.flush = flush;
  28210. return debounced;
  28211. }
  28212. /**
  28213. * Defers invoking the `func` until the current call stack has cleared. Any
  28214. * additional arguments are provided to `func` when it's invoked.
  28215. *
  28216. * @static
  28217. * @memberOf _
  28218. * @since 0.1.0
  28219. * @category Function
  28220. * @param {Function} func The function to defer.
  28221. * @param {...*} [args] The arguments to invoke `func` with.
  28222. * @returns {number} Returns the timer id.
  28223. * @example
  28224. *
  28225. * _.defer(function(text) {
  28226. * console.log(text);
  28227. * }, 'deferred');
  28228. * // => Logs 'deferred' after one millisecond.
  28229. */
  28230. var defer = baseRest(function(func, args) {
  28231. return baseDelay(func, 1, args);
  28232. });
  28233. /**
  28234. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28235. * provided to `func` when it's invoked.
  28236. *
  28237. * @static
  28238. * @memberOf _
  28239. * @since 0.1.0
  28240. * @category Function
  28241. * @param {Function} func The function to delay.
  28242. * @param {number} wait The number of milliseconds to delay invocation.
  28243. * @param {...*} [args] The arguments to invoke `func` with.
  28244. * @returns {number} Returns the timer id.
  28245. * @example
  28246. *
  28247. * _.delay(function(text) {
  28248. * console.log(text);
  28249. * }, 1000, 'later');
  28250. * // => Logs 'later' after one second.
  28251. */
  28252. var delay = baseRest(function(func, wait, args) {
  28253. return baseDelay(func, toNumber(wait) || 0, args);
  28254. });
  28255. /**
  28256. * Creates a function that invokes `func` with arguments reversed.
  28257. *
  28258. * @static
  28259. * @memberOf _
  28260. * @since 4.0.0
  28261. * @category Function
  28262. * @param {Function} func The function to flip arguments for.
  28263. * @returns {Function} Returns the new flipped function.
  28264. * @example
  28265. *
  28266. * var flipped = _.flip(function() {
  28267. * return _.toArray(arguments);
  28268. * });
  28269. *
  28270. * flipped('a', 'b', 'c', 'd');
  28271. * // => ['d', 'c', 'b', 'a']
  28272. */
  28273. function flip(func) {
  28274. return createWrap(func, WRAP_FLIP_FLAG);
  28275. }
  28276. /**
  28277. * Creates a function that memoizes the result of `func`. If `resolver` is
  28278. * provided, it determines the cache key for storing the result based on the
  28279. * arguments provided to the memoized function. By default, the first argument
  28280. * provided to the memoized function is used as the map cache key. The `func`
  28281. * is invoked with the `this` binding of the memoized function.
  28282. *
  28283. * **Note:** The cache is exposed as the `cache` property on the memoized
  28284. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28285. * constructor with one whose instances implement the
  28286. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28287. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28288. *
  28289. * @static
  28290. * @memberOf _
  28291. * @since 0.1.0
  28292. * @category Function
  28293. * @param {Function} func The function to have its output memoized.
  28294. * @param {Function} [resolver] The function to resolve the cache key.
  28295. * @returns {Function} Returns the new memoized function.
  28296. * @example
  28297. *
  28298. * var object = { 'a': 1, 'b': 2 };
  28299. * var other = { 'c': 3, 'd': 4 };
  28300. *
  28301. * var values = _.memoize(_.values);
  28302. * values(object);
  28303. * // => [1, 2]
  28304. *
  28305. * values(other);
  28306. * // => [3, 4]
  28307. *
  28308. * object.a = 2;
  28309. * values(object);
  28310. * // => [1, 2]
  28311. *
  28312. * // Modify the result cache.
  28313. * values.cache.set(object, ['a', 'b']);
  28314. * values(object);
  28315. * // => ['a', 'b']
  28316. *
  28317. * // Replace `_.memoize.Cache`.
  28318. * _.memoize.Cache = WeakMap;
  28319. */
  28320. function memoize(func, resolver) {
  28321. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28322. throw new TypeError(FUNC_ERROR_TEXT);
  28323. }
  28324. var memoized = function() {
  28325. var args = arguments,
  28326. key = resolver ? resolver.apply(this, args) : args[0],
  28327. cache = memoized.cache;
  28328. if (cache.has(key)) {
  28329. return cache.get(key);
  28330. }
  28331. var result = func.apply(this, args);
  28332. memoized.cache = cache.set(key, result) || cache;
  28333. return result;
  28334. };
  28335. memoized.cache = new (memoize.Cache || MapCache);
  28336. return memoized;
  28337. }
  28338. // Expose `MapCache`.
  28339. memoize.Cache = MapCache;
  28340. /**
  28341. * Creates a function that negates the result of the predicate `func`. The
  28342. * `func` predicate is invoked with the `this` binding and arguments of the
  28343. * created function.
  28344. *
  28345. * @static
  28346. * @memberOf _
  28347. * @since 3.0.0
  28348. * @category Function
  28349. * @param {Function} predicate The predicate to negate.
  28350. * @returns {Function} Returns the new negated function.
  28351. * @example
  28352. *
  28353. * function isEven(n) {
  28354. * return n % 2 == 0;
  28355. * }
  28356. *
  28357. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28358. * // => [1, 3, 5]
  28359. */
  28360. function negate(predicate) {
  28361. if (typeof predicate != 'function') {
  28362. throw new TypeError(FUNC_ERROR_TEXT);
  28363. }
  28364. return function() {
  28365. var args = arguments;
  28366. switch (args.length) {
  28367. case 0: return !predicate.call(this);
  28368. case 1: return !predicate.call(this, args[0]);
  28369. case 2: return !predicate.call(this, args[0], args[1]);
  28370. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28371. }
  28372. return !predicate.apply(this, args);
  28373. };
  28374. }
  28375. /**
  28376. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28377. * to the function return the value of the first invocation. The `func` is
  28378. * invoked with the `this` binding and arguments of the created function.
  28379. *
  28380. * @static
  28381. * @memberOf _
  28382. * @since 0.1.0
  28383. * @category Function
  28384. * @param {Function} func The function to restrict.
  28385. * @returns {Function} Returns the new restricted function.
  28386. * @example
  28387. *
  28388. * var initialize = _.once(createApplication);
  28389. * initialize();
  28390. * initialize();
  28391. * // => `createApplication` is invoked once
  28392. */
  28393. function once(func) {
  28394. return before(2, func);
  28395. }
  28396. /**
  28397. * Creates a function that invokes `func` with its arguments transformed.
  28398. *
  28399. * @static
  28400. * @since 4.0.0
  28401. * @memberOf _
  28402. * @category Function
  28403. * @param {Function} func The function to wrap.
  28404. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28405. * The argument transforms.
  28406. * @returns {Function} Returns the new function.
  28407. * @example
  28408. *
  28409. * function doubled(n) {
  28410. * return n * 2;
  28411. * }
  28412. *
  28413. * function square(n) {
  28414. * return n * n;
  28415. * }
  28416. *
  28417. * var func = _.overArgs(function(x, y) {
  28418. * return [x, y];
  28419. * }, [square, doubled]);
  28420. *
  28421. * func(9, 3);
  28422. * // => [81, 6]
  28423. *
  28424. * func(10, 5);
  28425. * // => [100, 10]
  28426. */
  28427. var overArgs = castRest(function(func, transforms) {
  28428. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28429. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28430. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28431. var funcsLength = transforms.length;
  28432. return baseRest(function(args) {
  28433. var index = -1,
  28434. length = nativeMin(args.length, funcsLength);
  28435. while (++index < length) {
  28436. args[index] = transforms[index].call(this, args[index]);
  28437. }
  28438. return apply(func, this, args);
  28439. });
  28440. });
  28441. /**
  28442. * Creates a function that invokes `func` with `partials` prepended to the
  28443. * arguments it receives. This method is like `_.bind` except it does **not**
  28444. * alter the `this` binding.
  28445. *
  28446. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28447. * builds, may be used as a placeholder for partially applied arguments.
  28448. *
  28449. * **Note:** This method doesn't set the "length" property of partially
  28450. * applied functions.
  28451. *
  28452. * @static
  28453. * @memberOf _
  28454. * @since 0.2.0
  28455. * @category Function
  28456. * @param {Function} func The function to partially apply arguments to.
  28457. * @param {...*} [partials] The arguments to be partially applied.
  28458. * @returns {Function} Returns the new partially applied function.
  28459. * @example
  28460. *
  28461. * function greet(greeting, name) {
  28462. * return greeting + ' ' + name;
  28463. * }
  28464. *
  28465. * var sayHelloTo = _.partial(greet, 'hello');
  28466. * sayHelloTo('fred');
  28467. * // => 'hello fred'
  28468. *
  28469. * // Partially applied with placeholders.
  28470. * var greetFred = _.partial(greet, _, 'fred');
  28471. * greetFred('hi');
  28472. * // => 'hi fred'
  28473. */
  28474. var partial = baseRest(function(func, partials) {
  28475. var holders = replaceHolders(partials, getHolder(partial));
  28476. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28477. });
  28478. /**
  28479. * This method is like `_.partial` except that partially applied arguments
  28480. * are appended to the arguments it receives.
  28481. *
  28482. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28483. * builds, may be used as a placeholder for partially applied arguments.
  28484. *
  28485. * **Note:** This method doesn't set the "length" property of partially
  28486. * applied functions.
  28487. *
  28488. * @static
  28489. * @memberOf _
  28490. * @since 1.0.0
  28491. * @category Function
  28492. * @param {Function} func The function to partially apply arguments to.
  28493. * @param {...*} [partials] The arguments to be partially applied.
  28494. * @returns {Function} Returns the new partially applied function.
  28495. * @example
  28496. *
  28497. * function greet(greeting, name) {
  28498. * return greeting + ' ' + name;
  28499. * }
  28500. *
  28501. * var greetFred = _.partialRight(greet, 'fred');
  28502. * greetFred('hi');
  28503. * // => 'hi fred'
  28504. *
  28505. * // Partially applied with placeholders.
  28506. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28507. * sayHelloTo('fred');
  28508. * // => 'hello fred'
  28509. */
  28510. var partialRight = baseRest(function(func, partials) {
  28511. var holders = replaceHolders(partials, getHolder(partialRight));
  28512. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28513. });
  28514. /**
  28515. * Creates a function that invokes `func` with arguments arranged according
  28516. * to the specified `indexes` where the argument value at the first index is
  28517. * provided as the first argument, the argument value at the second index is
  28518. * provided as the second argument, and so on.
  28519. *
  28520. * @static
  28521. * @memberOf _
  28522. * @since 3.0.0
  28523. * @category Function
  28524. * @param {Function} func The function to rearrange arguments for.
  28525. * @param {...(number|number[])} indexes The arranged argument indexes.
  28526. * @returns {Function} Returns the new function.
  28527. * @example
  28528. *
  28529. * var rearged = _.rearg(function(a, b, c) {
  28530. * return [a, b, c];
  28531. * }, [2, 0, 1]);
  28532. *
  28533. * rearged('b', 'c', 'a')
  28534. * // => ['a', 'b', 'c']
  28535. */
  28536. var rearg = flatRest(function(func, indexes) {
  28537. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28538. });
  28539. /**
  28540. * Creates a function that invokes `func` with the `this` binding of the
  28541. * created function and arguments from `start` and beyond provided as
  28542. * an array.
  28543. *
  28544. * **Note:** This method is based on the
  28545. * [rest parameter](https://mdn.io/rest_parameters).
  28546. *
  28547. * @static
  28548. * @memberOf _
  28549. * @since 4.0.0
  28550. * @category Function
  28551. * @param {Function} func The function to apply a rest parameter to.
  28552. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28553. * @returns {Function} Returns the new function.
  28554. * @example
  28555. *
  28556. * var say = _.rest(function(what, names) {
  28557. * return what + ' ' + _.initial(names).join(', ') +
  28558. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28559. * });
  28560. *
  28561. * say('hello', 'fred', 'barney', 'pebbles');
  28562. * // => 'hello fred, barney, & pebbles'
  28563. */
  28564. function rest(func, start) {
  28565. if (typeof func != 'function') {
  28566. throw new TypeError(FUNC_ERROR_TEXT);
  28567. }
  28568. start = start === undefined ? start : toInteger(start);
  28569. return baseRest(func, start);
  28570. }
  28571. /**
  28572. * Creates a function that invokes `func` with the `this` binding of the
  28573. * create function and an array of arguments much like
  28574. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28575. *
  28576. * **Note:** This method is based on the
  28577. * [spread operator](https://mdn.io/spread_operator).
  28578. *
  28579. * @static
  28580. * @memberOf _
  28581. * @since 3.2.0
  28582. * @category Function
  28583. * @param {Function} func The function to spread arguments over.
  28584. * @param {number} [start=0] The start position of the spread.
  28585. * @returns {Function} Returns the new function.
  28586. * @example
  28587. *
  28588. * var say = _.spread(function(who, what) {
  28589. * return who + ' says ' + what;
  28590. * });
  28591. *
  28592. * say(['fred', 'hello']);
  28593. * // => 'fred says hello'
  28594. *
  28595. * var numbers = Promise.all([
  28596. * Promise.resolve(40),
  28597. * Promise.resolve(36)
  28598. * ]);
  28599. *
  28600. * numbers.then(_.spread(function(x, y) {
  28601. * return x + y;
  28602. * }));
  28603. * // => a Promise of 76
  28604. */
  28605. function spread(func, start) {
  28606. if (typeof func != 'function') {
  28607. throw new TypeError(FUNC_ERROR_TEXT);
  28608. }
  28609. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28610. return baseRest(function(args) {
  28611. var array = args[start],
  28612. otherArgs = castSlice(args, 0, start);
  28613. if (array) {
  28614. arrayPush(otherArgs, array);
  28615. }
  28616. return apply(func, this, otherArgs);
  28617. });
  28618. }
  28619. /**
  28620. * Creates a throttled function that only invokes `func` at most once per
  28621. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28622. * method to cancel delayed `func` invocations and a `flush` method to
  28623. * immediately invoke them. Provide `options` to indicate whether `func`
  28624. * should be invoked on the leading and/or trailing edge of the `wait`
  28625. * timeout. The `func` is invoked with the last arguments provided to the
  28626. * throttled function. Subsequent calls to the throttled function return the
  28627. * result of the last `func` invocation.
  28628. *
  28629. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28630. * invoked on the trailing edge of the timeout only if the throttled function
  28631. * is invoked more than once during the `wait` timeout.
  28632. *
  28633. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28634. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28635. *
  28636. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28637. * for details over the differences between `_.throttle` and `_.debounce`.
  28638. *
  28639. * @static
  28640. * @memberOf _
  28641. * @since 0.1.0
  28642. * @category Function
  28643. * @param {Function} func The function to throttle.
  28644. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28645. * @param {Object} [options={}] The options object.
  28646. * @param {boolean} [options.leading=true]
  28647. * Specify invoking on the leading edge of the timeout.
  28648. * @param {boolean} [options.trailing=true]
  28649. * Specify invoking on the trailing edge of the timeout.
  28650. * @returns {Function} Returns the new throttled function.
  28651. * @example
  28652. *
  28653. * // Avoid excessively updating the position while scrolling.
  28654. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28655. *
  28656. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28657. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28658. * jQuery(element).on('click', throttled);
  28659. *
  28660. * // Cancel the trailing throttled invocation.
  28661. * jQuery(window).on('popstate', throttled.cancel);
  28662. */
  28663. function throttle(func, wait, options) {
  28664. var leading = true,
  28665. trailing = true;
  28666. if (typeof func != 'function') {
  28667. throw new TypeError(FUNC_ERROR_TEXT);
  28668. }
  28669. if (isObject(options)) {
  28670. leading = 'leading' in options ? !!options.leading : leading;
  28671. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28672. }
  28673. return debounce(func, wait, {
  28674. 'leading': leading,
  28675. 'maxWait': wait,
  28676. 'trailing': trailing
  28677. });
  28678. }
  28679. /**
  28680. * Creates a function that accepts up to one argument, ignoring any
  28681. * additional arguments.
  28682. *
  28683. * @static
  28684. * @memberOf _
  28685. * @since 4.0.0
  28686. * @category Function
  28687. * @param {Function} func The function to cap arguments for.
  28688. * @returns {Function} Returns the new capped function.
  28689. * @example
  28690. *
  28691. * _.map(['6', '8', '10'], _.unary(parseInt));
  28692. * // => [6, 8, 10]
  28693. */
  28694. function unary(func) {
  28695. return ary(func, 1);
  28696. }
  28697. /**
  28698. * Creates a function that provides `value` to `wrapper` as its first
  28699. * argument. Any additional arguments provided to the function are appended
  28700. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28701. * binding of the created function.
  28702. *
  28703. * @static
  28704. * @memberOf _
  28705. * @since 0.1.0
  28706. * @category Function
  28707. * @param {*} value The value to wrap.
  28708. * @param {Function} [wrapper=identity] The wrapper function.
  28709. * @returns {Function} Returns the new function.
  28710. * @example
  28711. *
  28712. * var p = _.wrap(_.escape, function(func, text) {
  28713. * return '<p>' + func(text) + '</p>';
  28714. * });
  28715. *
  28716. * p('fred, barney, & pebbles');
  28717. * // => '<p>fred, barney, &amp; pebbles</p>'
  28718. */
  28719. function wrap(value, wrapper) {
  28720. return partial(castFunction(wrapper), value);
  28721. }
  28722. /*------------------------------------------------------------------------*/
  28723. /**
  28724. * Casts `value` as an array if it's not one.
  28725. *
  28726. * @static
  28727. * @memberOf _
  28728. * @since 4.4.0
  28729. * @category Lang
  28730. * @param {*} value The value to inspect.
  28731. * @returns {Array} Returns the cast array.
  28732. * @example
  28733. *
  28734. * _.castArray(1);
  28735. * // => [1]
  28736. *
  28737. * _.castArray({ 'a': 1 });
  28738. * // => [{ 'a': 1 }]
  28739. *
  28740. * _.castArray('abc');
  28741. * // => ['abc']
  28742. *
  28743. * _.castArray(null);
  28744. * // => [null]
  28745. *
  28746. * _.castArray(undefined);
  28747. * // => [undefined]
  28748. *
  28749. * _.castArray();
  28750. * // => []
  28751. *
  28752. * var array = [1, 2, 3];
  28753. * console.log(_.castArray(array) === array);
  28754. * // => true
  28755. */
  28756. function castArray() {
  28757. if (!arguments.length) {
  28758. return [];
  28759. }
  28760. var value = arguments[0];
  28761. return isArray(value) ? value : [value];
  28762. }
  28763. /**
  28764. * Creates a shallow clone of `value`.
  28765. *
  28766. * **Note:** This method is loosely based on the
  28767. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28768. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28769. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28770. * arrays. The own enumerable properties of `arguments` objects are cloned
  28771. * as plain objects. An empty object is returned for uncloneable values such
  28772. * as error objects, functions, DOM nodes, and WeakMaps.
  28773. *
  28774. * @static
  28775. * @memberOf _
  28776. * @since 0.1.0
  28777. * @category Lang
  28778. * @param {*} value The value to clone.
  28779. * @returns {*} Returns the cloned value.
  28780. * @see _.cloneDeep
  28781. * @example
  28782. *
  28783. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28784. *
  28785. * var shallow = _.clone(objects);
  28786. * console.log(shallow[0] === objects[0]);
  28787. * // => true
  28788. */
  28789. function clone(value) {
  28790. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28791. }
  28792. /**
  28793. * This method is like `_.clone` except that it accepts `customizer` which
  28794. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28795. * cloning is handled by the method instead. The `customizer` is invoked with
  28796. * up to four arguments; (value [, index|key, object, stack]).
  28797. *
  28798. * @static
  28799. * @memberOf _
  28800. * @since 4.0.0
  28801. * @category Lang
  28802. * @param {*} value The value to clone.
  28803. * @param {Function} [customizer] The function to customize cloning.
  28804. * @returns {*} Returns the cloned value.
  28805. * @see _.cloneDeepWith
  28806. * @example
  28807. *
  28808. * function customizer(value) {
  28809. * if (_.isElement(value)) {
  28810. * return value.cloneNode(false);
  28811. * }
  28812. * }
  28813. *
  28814. * var el = _.cloneWith(document.body, customizer);
  28815. *
  28816. * console.log(el === document.body);
  28817. * // => false
  28818. * console.log(el.nodeName);
  28819. * // => 'BODY'
  28820. * console.log(el.childNodes.length);
  28821. * // => 0
  28822. */
  28823. function cloneWith(value, customizer) {
  28824. customizer = typeof customizer == 'function' ? customizer : undefined;
  28825. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28826. }
  28827. /**
  28828. * This method is like `_.clone` except that it recursively clones `value`.
  28829. *
  28830. * @static
  28831. * @memberOf _
  28832. * @since 1.0.0
  28833. * @category Lang
  28834. * @param {*} value The value to recursively clone.
  28835. * @returns {*} Returns the deep cloned value.
  28836. * @see _.clone
  28837. * @example
  28838. *
  28839. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28840. *
  28841. * var deep = _.cloneDeep(objects);
  28842. * console.log(deep[0] === objects[0]);
  28843. * // => false
  28844. */
  28845. function cloneDeep(value) {
  28846. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28847. }
  28848. /**
  28849. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28850. *
  28851. * @static
  28852. * @memberOf _
  28853. * @since 4.0.0
  28854. * @category Lang
  28855. * @param {*} value The value to recursively clone.
  28856. * @param {Function} [customizer] The function to customize cloning.
  28857. * @returns {*} Returns the deep cloned value.
  28858. * @see _.cloneWith
  28859. * @example
  28860. *
  28861. * function customizer(value) {
  28862. * if (_.isElement(value)) {
  28863. * return value.cloneNode(true);
  28864. * }
  28865. * }
  28866. *
  28867. * var el = _.cloneDeepWith(document.body, customizer);
  28868. *
  28869. * console.log(el === document.body);
  28870. * // => false
  28871. * console.log(el.nodeName);
  28872. * // => 'BODY'
  28873. * console.log(el.childNodes.length);
  28874. * // => 20
  28875. */
  28876. function cloneDeepWith(value, customizer) {
  28877. customizer = typeof customizer == 'function' ? customizer : undefined;
  28878. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28879. }
  28880. /**
  28881. * Checks if `object` conforms to `source` by invoking the predicate
  28882. * properties of `source` with the corresponding property values of `object`.
  28883. *
  28884. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28885. * partially applied.
  28886. *
  28887. * @static
  28888. * @memberOf _
  28889. * @since 4.14.0
  28890. * @category Lang
  28891. * @param {Object} object The object to inspect.
  28892. * @param {Object} source The object of property predicates to conform to.
  28893. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28894. * @example
  28895. *
  28896. * var object = { 'a': 1, 'b': 2 };
  28897. *
  28898. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28899. * // => true
  28900. *
  28901. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28902. * // => false
  28903. */
  28904. function conformsTo(object, source) {
  28905. return source == null || baseConformsTo(object, source, keys(source));
  28906. }
  28907. /**
  28908. * Performs a
  28909. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28910. * comparison between two values to determine if they are equivalent.
  28911. *
  28912. * @static
  28913. * @memberOf _
  28914. * @since 4.0.0
  28915. * @category Lang
  28916. * @param {*} value The value to compare.
  28917. * @param {*} other The other value to compare.
  28918. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28919. * @example
  28920. *
  28921. * var object = { 'a': 1 };
  28922. * var other = { 'a': 1 };
  28923. *
  28924. * _.eq(object, object);
  28925. * // => true
  28926. *
  28927. * _.eq(object, other);
  28928. * // => false
  28929. *
  28930. * _.eq('a', 'a');
  28931. * // => true
  28932. *
  28933. * _.eq('a', Object('a'));
  28934. * // => false
  28935. *
  28936. * _.eq(NaN, NaN);
  28937. * // => true
  28938. */
  28939. function eq(value, other) {
  28940. return value === other || (value !== value && other !== other);
  28941. }
  28942. /**
  28943. * Checks if `value` is greater than `other`.
  28944. *
  28945. * @static
  28946. * @memberOf _
  28947. * @since 3.9.0
  28948. * @category Lang
  28949. * @param {*} value The value to compare.
  28950. * @param {*} other The other value to compare.
  28951. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28952. * else `false`.
  28953. * @see _.lt
  28954. * @example
  28955. *
  28956. * _.gt(3, 1);
  28957. * // => true
  28958. *
  28959. * _.gt(3, 3);
  28960. * // => false
  28961. *
  28962. * _.gt(1, 3);
  28963. * // => false
  28964. */
  28965. var gt = createRelationalOperation(baseGt);
  28966. /**
  28967. * Checks if `value` is greater than or equal to `other`.
  28968. *
  28969. * @static
  28970. * @memberOf _
  28971. * @since 3.9.0
  28972. * @category Lang
  28973. * @param {*} value The value to compare.
  28974. * @param {*} other The other value to compare.
  28975. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28976. * `other`, else `false`.
  28977. * @see _.lte
  28978. * @example
  28979. *
  28980. * _.gte(3, 1);
  28981. * // => true
  28982. *
  28983. * _.gte(3, 3);
  28984. * // => true
  28985. *
  28986. * _.gte(1, 3);
  28987. * // => false
  28988. */
  28989. var gte = createRelationalOperation(function(value, other) {
  28990. return value >= other;
  28991. });
  28992. /**
  28993. * Checks if `value` is likely an `arguments` object.
  28994. *
  28995. * @static
  28996. * @memberOf _
  28997. * @since 0.1.0
  28998. * @category Lang
  28999. * @param {*} value The value to check.
  29000. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29001. * else `false`.
  29002. * @example
  29003. *
  29004. * _.isArguments(function() { return arguments; }());
  29005. * // => true
  29006. *
  29007. * _.isArguments([1, 2, 3]);
  29008. * // => false
  29009. */
  29010. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29011. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29012. !propertyIsEnumerable.call(value, 'callee');
  29013. };
  29014. /**
  29015. * Checks if `value` is classified as an `Array` object.
  29016. *
  29017. * @static
  29018. * @memberOf _
  29019. * @since 0.1.0
  29020. * @category Lang
  29021. * @param {*} value The value to check.
  29022. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29023. * @example
  29024. *
  29025. * _.isArray([1, 2, 3]);
  29026. * // => true
  29027. *
  29028. * _.isArray(document.body.children);
  29029. * // => false
  29030. *
  29031. * _.isArray('abc');
  29032. * // => false
  29033. *
  29034. * _.isArray(_.noop);
  29035. * // => false
  29036. */
  29037. var isArray = Array.isArray;
  29038. /**
  29039. * Checks if `value` is classified as an `ArrayBuffer` object.
  29040. *
  29041. * @static
  29042. * @memberOf _
  29043. * @since 4.3.0
  29044. * @category Lang
  29045. * @param {*} value The value to check.
  29046. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29047. * @example
  29048. *
  29049. * _.isArrayBuffer(new ArrayBuffer(2));
  29050. * // => true
  29051. *
  29052. * _.isArrayBuffer(new Array(2));
  29053. * // => false
  29054. */
  29055. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29056. /**
  29057. * Checks if `value` is array-like. A value is considered array-like if it's
  29058. * not a function and has a `value.length` that's an integer greater than or
  29059. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29060. *
  29061. * @static
  29062. * @memberOf _
  29063. * @since 4.0.0
  29064. * @category Lang
  29065. * @param {*} value The value to check.
  29066. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29067. * @example
  29068. *
  29069. * _.isArrayLike([1, 2, 3]);
  29070. * // => true
  29071. *
  29072. * _.isArrayLike(document.body.children);
  29073. * // => true
  29074. *
  29075. * _.isArrayLike('abc');
  29076. * // => true
  29077. *
  29078. * _.isArrayLike(_.noop);
  29079. * // => false
  29080. */
  29081. function isArrayLike(value) {
  29082. return value != null && isLength(value.length) && !isFunction(value);
  29083. }
  29084. /**
  29085. * This method is like `_.isArrayLike` except that it also checks if `value`
  29086. * is an object.
  29087. *
  29088. * @static
  29089. * @memberOf _
  29090. * @since 4.0.0
  29091. * @category Lang
  29092. * @param {*} value The value to check.
  29093. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29094. * else `false`.
  29095. * @example
  29096. *
  29097. * _.isArrayLikeObject([1, 2, 3]);
  29098. * // => true
  29099. *
  29100. * _.isArrayLikeObject(document.body.children);
  29101. * // => true
  29102. *
  29103. * _.isArrayLikeObject('abc');
  29104. * // => false
  29105. *
  29106. * _.isArrayLikeObject(_.noop);
  29107. * // => false
  29108. */
  29109. function isArrayLikeObject(value) {
  29110. return isObjectLike(value) && isArrayLike(value);
  29111. }
  29112. /**
  29113. * Checks if `value` is classified as a boolean primitive or object.
  29114. *
  29115. * @static
  29116. * @memberOf _
  29117. * @since 0.1.0
  29118. * @category Lang
  29119. * @param {*} value The value to check.
  29120. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29121. * @example
  29122. *
  29123. * _.isBoolean(false);
  29124. * // => true
  29125. *
  29126. * _.isBoolean(null);
  29127. * // => false
  29128. */
  29129. function isBoolean(value) {
  29130. return value === true || value === false ||
  29131. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29132. }
  29133. /**
  29134. * Checks if `value` is a buffer.
  29135. *
  29136. * @static
  29137. * @memberOf _
  29138. * @since 4.3.0
  29139. * @category Lang
  29140. * @param {*} value The value to check.
  29141. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29142. * @example
  29143. *
  29144. * _.isBuffer(new Buffer(2));
  29145. * // => true
  29146. *
  29147. * _.isBuffer(new Uint8Array(2));
  29148. * // => false
  29149. */
  29150. var isBuffer = nativeIsBuffer || stubFalse;
  29151. /**
  29152. * Checks if `value` is classified as a `Date` object.
  29153. *
  29154. * @static
  29155. * @memberOf _
  29156. * @since 0.1.0
  29157. * @category Lang
  29158. * @param {*} value The value to check.
  29159. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29160. * @example
  29161. *
  29162. * _.isDate(new Date);
  29163. * // => true
  29164. *
  29165. * _.isDate('Mon April 23 2012');
  29166. * // => false
  29167. */
  29168. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29169. /**
  29170. * Checks if `value` is likely a DOM element.
  29171. *
  29172. * @static
  29173. * @memberOf _
  29174. * @since 0.1.0
  29175. * @category Lang
  29176. * @param {*} value The value to check.
  29177. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29178. * @example
  29179. *
  29180. * _.isElement(document.body);
  29181. * // => true
  29182. *
  29183. * _.isElement('<body>');
  29184. * // => false
  29185. */
  29186. function isElement(value) {
  29187. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29188. }
  29189. /**
  29190. * Checks if `value` is an empty object, collection, map, or set.
  29191. *
  29192. * Objects are considered empty if they have no own enumerable string keyed
  29193. * properties.
  29194. *
  29195. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29196. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29197. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29198. *
  29199. * @static
  29200. * @memberOf _
  29201. * @since 0.1.0
  29202. * @category Lang
  29203. * @param {*} value The value to check.
  29204. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29205. * @example
  29206. *
  29207. * _.isEmpty(null);
  29208. * // => true
  29209. *
  29210. * _.isEmpty(true);
  29211. * // => true
  29212. *
  29213. * _.isEmpty(1);
  29214. * // => true
  29215. *
  29216. * _.isEmpty([1, 2, 3]);
  29217. * // => false
  29218. *
  29219. * _.isEmpty({ 'a': 1 });
  29220. * // => false
  29221. */
  29222. function isEmpty(value) {
  29223. if (value == null) {
  29224. return true;
  29225. }
  29226. if (isArrayLike(value) &&
  29227. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29228. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29229. return !value.length;
  29230. }
  29231. var tag = getTag(value);
  29232. if (tag == mapTag || tag == setTag) {
  29233. return !value.size;
  29234. }
  29235. if (isPrototype(value)) {
  29236. return !baseKeys(value).length;
  29237. }
  29238. for (var key in value) {
  29239. if (hasOwnProperty.call(value, key)) {
  29240. return false;
  29241. }
  29242. }
  29243. return true;
  29244. }
  29245. /**
  29246. * Performs a deep comparison between two values to determine if they are
  29247. * equivalent.
  29248. *
  29249. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29250. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29251. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29252. * by their own, not inherited, enumerable properties. Functions and DOM
  29253. * nodes are compared by strict equality, i.e. `===`.
  29254. *
  29255. * @static
  29256. * @memberOf _
  29257. * @since 0.1.0
  29258. * @category Lang
  29259. * @param {*} value The value to compare.
  29260. * @param {*} other The other value to compare.
  29261. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29262. * @example
  29263. *
  29264. * var object = { 'a': 1 };
  29265. * var other = { 'a': 1 };
  29266. *
  29267. * _.isEqual(object, other);
  29268. * // => true
  29269. *
  29270. * object === other;
  29271. * // => false
  29272. */
  29273. function isEqual(value, other) {
  29274. return baseIsEqual(value, other);
  29275. }
  29276. /**
  29277. * This method is like `_.isEqual` except that it accepts `customizer` which
  29278. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29279. * are handled by the method instead. The `customizer` is invoked with up to
  29280. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29281. *
  29282. * @static
  29283. * @memberOf _
  29284. * @since 4.0.0
  29285. * @category Lang
  29286. * @param {*} value The value to compare.
  29287. * @param {*} other The other value to compare.
  29288. * @param {Function} [customizer] The function to customize comparisons.
  29289. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29290. * @example
  29291. *
  29292. * function isGreeting(value) {
  29293. * return /^h(?:i|ello)$/.test(value);
  29294. * }
  29295. *
  29296. * function customizer(objValue, othValue) {
  29297. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29298. * return true;
  29299. * }
  29300. * }
  29301. *
  29302. * var array = ['hello', 'goodbye'];
  29303. * var other = ['hi', 'goodbye'];
  29304. *
  29305. * _.isEqualWith(array, other, customizer);
  29306. * // => true
  29307. */
  29308. function isEqualWith(value, other, customizer) {
  29309. customizer = typeof customizer == 'function' ? customizer : undefined;
  29310. var result = customizer ? customizer(value, other) : undefined;
  29311. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29312. }
  29313. /**
  29314. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29315. * `SyntaxError`, `TypeError`, or `URIError` object.
  29316. *
  29317. * @static
  29318. * @memberOf _
  29319. * @since 3.0.0
  29320. * @category Lang
  29321. * @param {*} value The value to check.
  29322. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29323. * @example
  29324. *
  29325. * _.isError(new Error);
  29326. * // => true
  29327. *
  29328. * _.isError(Error);
  29329. * // => false
  29330. */
  29331. function isError(value) {
  29332. if (!isObjectLike(value)) {
  29333. return false;
  29334. }
  29335. var tag = baseGetTag(value);
  29336. return tag == errorTag || tag == domExcTag ||
  29337. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29338. }
  29339. /**
  29340. * Checks if `value` is a finite primitive number.
  29341. *
  29342. * **Note:** This method is based on
  29343. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29344. *
  29345. * @static
  29346. * @memberOf _
  29347. * @since 0.1.0
  29348. * @category Lang
  29349. * @param {*} value The value to check.
  29350. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29351. * @example
  29352. *
  29353. * _.isFinite(3);
  29354. * // => true
  29355. *
  29356. * _.isFinite(Number.MIN_VALUE);
  29357. * // => true
  29358. *
  29359. * _.isFinite(Infinity);
  29360. * // => false
  29361. *
  29362. * _.isFinite('3');
  29363. * // => false
  29364. */
  29365. function isFinite(value) {
  29366. return typeof value == 'number' && nativeIsFinite(value);
  29367. }
  29368. /**
  29369. * Checks if `value` is classified as a `Function` object.
  29370. *
  29371. * @static
  29372. * @memberOf _
  29373. * @since 0.1.0
  29374. * @category Lang
  29375. * @param {*} value The value to check.
  29376. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29377. * @example
  29378. *
  29379. * _.isFunction(_);
  29380. * // => true
  29381. *
  29382. * _.isFunction(/abc/);
  29383. * // => false
  29384. */
  29385. function isFunction(value) {
  29386. if (!isObject(value)) {
  29387. return false;
  29388. }
  29389. // The use of `Object#toString` avoids issues with the `typeof` operator
  29390. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29391. var tag = baseGetTag(value);
  29392. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29393. }
  29394. /**
  29395. * Checks if `value` is an integer.
  29396. *
  29397. * **Note:** This method is based on
  29398. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29399. *
  29400. * @static
  29401. * @memberOf _
  29402. * @since 4.0.0
  29403. * @category Lang
  29404. * @param {*} value The value to check.
  29405. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29406. * @example
  29407. *
  29408. * _.isInteger(3);
  29409. * // => true
  29410. *
  29411. * _.isInteger(Number.MIN_VALUE);
  29412. * // => false
  29413. *
  29414. * _.isInteger(Infinity);
  29415. * // => false
  29416. *
  29417. * _.isInteger('3');
  29418. * // => false
  29419. */
  29420. function isInteger(value) {
  29421. return typeof value == 'number' && value == toInteger(value);
  29422. }
  29423. /**
  29424. * Checks if `value` is a valid array-like length.
  29425. *
  29426. * **Note:** This method is loosely based on
  29427. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29428. *
  29429. * @static
  29430. * @memberOf _
  29431. * @since 4.0.0
  29432. * @category Lang
  29433. * @param {*} value The value to check.
  29434. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29435. * @example
  29436. *
  29437. * _.isLength(3);
  29438. * // => true
  29439. *
  29440. * _.isLength(Number.MIN_VALUE);
  29441. * // => false
  29442. *
  29443. * _.isLength(Infinity);
  29444. * // => false
  29445. *
  29446. * _.isLength('3');
  29447. * // => false
  29448. */
  29449. function isLength(value) {
  29450. return typeof value == 'number' &&
  29451. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29452. }
  29453. /**
  29454. * Checks if `value` is the
  29455. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29456. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29457. *
  29458. * @static
  29459. * @memberOf _
  29460. * @since 0.1.0
  29461. * @category Lang
  29462. * @param {*} value The value to check.
  29463. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29464. * @example
  29465. *
  29466. * _.isObject({});
  29467. * // => true
  29468. *
  29469. * _.isObject([1, 2, 3]);
  29470. * // => true
  29471. *
  29472. * _.isObject(_.noop);
  29473. * // => true
  29474. *
  29475. * _.isObject(null);
  29476. * // => false
  29477. */
  29478. function isObject(value) {
  29479. var type = typeof value;
  29480. return value != null && (type == 'object' || type == 'function');
  29481. }
  29482. /**
  29483. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29484. * and has a `typeof` result of "object".
  29485. *
  29486. * @static
  29487. * @memberOf _
  29488. * @since 4.0.0
  29489. * @category Lang
  29490. * @param {*} value The value to check.
  29491. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29492. * @example
  29493. *
  29494. * _.isObjectLike({});
  29495. * // => true
  29496. *
  29497. * _.isObjectLike([1, 2, 3]);
  29498. * // => true
  29499. *
  29500. * _.isObjectLike(_.noop);
  29501. * // => false
  29502. *
  29503. * _.isObjectLike(null);
  29504. * // => false
  29505. */
  29506. function isObjectLike(value) {
  29507. return value != null && typeof value == 'object';
  29508. }
  29509. /**
  29510. * Checks if `value` is classified as a `Map` object.
  29511. *
  29512. * @static
  29513. * @memberOf _
  29514. * @since 4.3.0
  29515. * @category Lang
  29516. * @param {*} value The value to check.
  29517. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29518. * @example
  29519. *
  29520. * _.isMap(new Map);
  29521. * // => true
  29522. *
  29523. * _.isMap(new WeakMap);
  29524. * // => false
  29525. */
  29526. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29527. /**
  29528. * Performs a partial deep comparison between `object` and `source` to
  29529. * determine if `object` contains equivalent property values.
  29530. *
  29531. * **Note:** This method is equivalent to `_.matches` when `source` is
  29532. * partially applied.
  29533. *
  29534. * Partial comparisons will match empty array and empty object `source`
  29535. * values against any array or object value, respectively. See `_.isEqual`
  29536. * for a list of supported value comparisons.
  29537. *
  29538. * @static
  29539. * @memberOf _
  29540. * @since 3.0.0
  29541. * @category Lang
  29542. * @param {Object} object The object to inspect.
  29543. * @param {Object} source The object of property values to match.
  29544. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29545. * @example
  29546. *
  29547. * var object = { 'a': 1, 'b': 2 };
  29548. *
  29549. * _.isMatch(object, { 'b': 2 });
  29550. * // => true
  29551. *
  29552. * _.isMatch(object, { 'b': 1 });
  29553. * // => false
  29554. */
  29555. function isMatch(object, source) {
  29556. return object === source || baseIsMatch(object, source, getMatchData(source));
  29557. }
  29558. /**
  29559. * This method is like `_.isMatch` except that it accepts `customizer` which
  29560. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29561. * are handled by the method instead. The `customizer` is invoked with five
  29562. * arguments: (objValue, srcValue, index|key, object, source).
  29563. *
  29564. * @static
  29565. * @memberOf _
  29566. * @since 4.0.0
  29567. * @category Lang
  29568. * @param {Object} object The object to inspect.
  29569. * @param {Object} source The object of property values to match.
  29570. * @param {Function} [customizer] The function to customize comparisons.
  29571. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29572. * @example
  29573. *
  29574. * function isGreeting(value) {
  29575. * return /^h(?:i|ello)$/.test(value);
  29576. * }
  29577. *
  29578. * function customizer(objValue, srcValue) {
  29579. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29580. * return true;
  29581. * }
  29582. * }
  29583. *
  29584. * var object = { 'greeting': 'hello' };
  29585. * var source = { 'greeting': 'hi' };
  29586. *
  29587. * _.isMatchWith(object, source, customizer);
  29588. * // => true
  29589. */
  29590. function isMatchWith(object, source, customizer) {
  29591. customizer = typeof customizer == 'function' ? customizer : undefined;
  29592. return baseIsMatch(object, source, getMatchData(source), customizer);
  29593. }
  29594. /**
  29595. * Checks if `value` is `NaN`.
  29596. *
  29597. * **Note:** This method is based on
  29598. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29599. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29600. * `undefined` and other non-number values.
  29601. *
  29602. * @static
  29603. * @memberOf _
  29604. * @since 0.1.0
  29605. * @category Lang
  29606. * @param {*} value The value to check.
  29607. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29608. * @example
  29609. *
  29610. * _.isNaN(NaN);
  29611. * // => true
  29612. *
  29613. * _.isNaN(new Number(NaN));
  29614. * // => true
  29615. *
  29616. * isNaN(undefined);
  29617. * // => true
  29618. *
  29619. * _.isNaN(undefined);
  29620. * // => false
  29621. */
  29622. function isNaN(value) {
  29623. // An `NaN` primitive is the only value that is not equal to itself.
  29624. // Perform the `toStringTag` check first to avoid errors with some
  29625. // ActiveX objects in IE.
  29626. return isNumber(value) && value != +value;
  29627. }
  29628. /**
  29629. * Checks if `value` is a pristine native function.
  29630. *
  29631. * **Note:** This method can't reliably detect native functions in the presence
  29632. * of the core-js package because core-js circumvents this kind of detection.
  29633. * Despite multiple requests, the core-js maintainer has made it clear: any
  29634. * attempt to fix the detection will be obstructed. As a result, we're left
  29635. * with little choice but to throw an error. Unfortunately, this also affects
  29636. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29637. * which rely on core-js.
  29638. *
  29639. * @static
  29640. * @memberOf _
  29641. * @since 3.0.0
  29642. * @category Lang
  29643. * @param {*} value The value to check.
  29644. * @returns {boolean} Returns `true` if `value` is a native function,
  29645. * else `false`.
  29646. * @example
  29647. *
  29648. * _.isNative(Array.prototype.push);
  29649. * // => true
  29650. *
  29651. * _.isNative(_);
  29652. * // => false
  29653. */
  29654. function isNative(value) {
  29655. if (isMaskable(value)) {
  29656. throw new Error(CORE_ERROR_TEXT);
  29657. }
  29658. return baseIsNative(value);
  29659. }
  29660. /**
  29661. * Checks if `value` is `null`.
  29662. *
  29663. * @static
  29664. * @memberOf _
  29665. * @since 0.1.0
  29666. * @category Lang
  29667. * @param {*} value The value to check.
  29668. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29669. * @example
  29670. *
  29671. * _.isNull(null);
  29672. * // => true
  29673. *
  29674. * _.isNull(void 0);
  29675. * // => false
  29676. */
  29677. function isNull(value) {
  29678. return value === null;
  29679. }
  29680. /**
  29681. * Checks if `value` is `null` or `undefined`.
  29682. *
  29683. * @static
  29684. * @memberOf _
  29685. * @since 4.0.0
  29686. * @category Lang
  29687. * @param {*} value The value to check.
  29688. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29689. * @example
  29690. *
  29691. * _.isNil(null);
  29692. * // => true
  29693. *
  29694. * _.isNil(void 0);
  29695. * // => true
  29696. *
  29697. * _.isNil(NaN);
  29698. * // => false
  29699. */
  29700. function isNil(value) {
  29701. return value == null;
  29702. }
  29703. /**
  29704. * Checks if `value` is classified as a `Number` primitive or object.
  29705. *
  29706. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29707. * classified as numbers, use the `_.isFinite` method.
  29708. *
  29709. * @static
  29710. * @memberOf _
  29711. * @since 0.1.0
  29712. * @category Lang
  29713. * @param {*} value The value to check.
  29714. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29715. * @example
  29716. *
  29717. * _.isNumber(3);
  29718. * // => true
  29719. *
  29720. * _.isNumber(Number.MIN_VALUE);
  29721. * // => true
  29722. *
  29723. * _.isNumber(Infinity);
  29724. * // => true
  29725. *
  29726. * _.isNumber('3');
  29727. * // => false
  29728. */
  29729. function isNumber(value) {
  29730. return typeof value == 'number' ||
  29731. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29732. }
  29733. /**
  29734. * Checks if `value` is a plain object, that is, an object created by the
  29735. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29736. *
  29737. * @static
  29738. * @memberOf _
  29739. * @since 0.8.0
  29740. * @category Lang
  29741. * @param {*} value The value to check.
  29742. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29743. * @example
  29744. *
  29745. * function Foo() {
  29746. * this.a = 1;
  29747. * }
  29748. *
  29749. * _.isPlainObject(new Foo);
  29750. * // => false
  29751. *
  29752. * _.isPlainObject([1, 2, 3]);
  29753. * // => false
  29754. *
  29755. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29756. * // => true
  29757. *
  29758. * _.isPlainObject(Object.create(null));
  29759. * // => true
  29760. */
  29761. function isPlainObject(value) {
  29762. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29763. return false;
  29764. }
  29765. var proto = getPrototype(value);
  29766. if (proto === null) {
  29767. return true;
  29768. }
  29769. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29770. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29771. funcToString.call(Ctor) == objectCtorString;
  29772. }
  29773. /**
  29774. * Checks if `value` is classified as a `RegExp` object.
  29775. *
  29776. * @static
  29777. * @memberOf _
  29778. * @since 0.1.0
  29779. * @category Lang
  29780. * @param {*} value The value to check.
  29781. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29782. * @example
  29783. *
  29784. * _.isRegExp(/abc/);
  29785. * // => true
  29786. *
  29787. * _.isRegExp('/abc/');
  29788. * // => false
  29789. */
  29790. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29791. /**
  29792. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29793. * double precision number which isn't the result of a rounded unsafe integer.
  29794. *
  29795. * **Note:** This method is based on
  29796. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29797. *
  29798. * @static
  29799. * @memberOf _
  29800. * @since 4.0.0
  29801. * @category Lang
  29802. * @param {*} value The value to check.
  29803. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29804. * @example
  29805. *
  29806. * _.isSafeInteger(3);
  29807. * // => true
  29808. *
  29809. * _.isSafeInteger(Number.MIN_VALUE);
  29810. * // => false
  29811. *
  29812. * _.isSafeInteger(Infinity);
  29813. * // => false
  29814. *
  29815. * _.isSafeInteger('3');
  29816. * // => false
  29817. */
  29818. function isSafeInteger(value) {
  29819. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29820. }
  29821. /**
  29822. * Checks if `value` is classified as a `Set` object.
  29823. *
  29824. * @static
  29825. * @memberOf _
  29826. * @since 4.3.0
  29827. * @category Lang
  29828. * @param {*} value The value to check.
  29829. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29830. * @example
  29831. *
  29832. * _.isSet(new Set);
  29833. * // => true
  29834. *
  29835. * _.isSet(new WeakSet);
  29836. * // => false
  29837. */
  29838. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29839. /**
  29840. * Checks if `value` is classified as a `String` primitive or object.
  29841. *
  29842. * @static
  29843. * @since 0.1.0
  29844. * @memberOf _
  29845. * @category Lang
  29846. * @param {*} value The value to check.
  29847. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29848. * @example
  29849. *
  29850. * _.isString('abc');
  29851. * // => true
  29852. *
  29853. * _.isString(1);
  29854. * // => false
  29855. */
  29856. function isString(value) {
  29857. return typeof value == 'string' ||
  29858. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29859. }
  29860. /**
  29861. * Checks if `value` is classified as a `Symbol` primitive or object.
  29862. *
  29863. * @static
  29864. * @memberOf _
  29865. * @since 4.0.0
  29866. * @category Lang
  29867. * @param {*} value The value to check.
  29868. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29869. * @example
  29870. *
  29871. * _.isSymbol(Symbol.iterator);
  29872. * // => true
  29873. *
  29874. * _.isSymbol('abc');
  29875. * // => false
  29876. */
  29877. function isSymbol(value) {
  29878. return typeof value == 'symbol' ||
  29879. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29880. }
  29881. /**
  29882. * Checks if `value` is classified as a typed array.
  29883. *
  29884. * @static
  29885. * @memberOf _
  29886. * @since 3.0.0
  29887. * @category Lang
  29888. * @param {*} value The value to check.
  29889. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29890. * @example
  29891. *
  29892. * _.isTypedArray(new Uint8Array);
  29893. * // => true
  29894. *
  29895. * _.isTypedArray([]);
  29896. * // => false
  29897. */
  29898. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29899. /**
  29900. * Checks if `value` is `undefined`.
  29901. *
  29902. * @static
  29903. * @since 0.1.0
  29904. * @memberOf _
  29905. * @category Lang
  29906. * @param {*} value The value to check.
  29907. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29908. * @example
  29909. *
  29910. * _.isUndefined(void 0);
  29911. * // => true
  29912. *
  29913. * _.isUndefined(null);
  29914. * // => false
  29915. */
  29916. function isUndefined(value) {
  29917. return value === undefined;
  29918. }
  29919. /**
  29920. * Checks if `value` is classified as a `WeakMap` object.
  29921. *
  29922. * @static
  29923. * @memberOf _
  29924. * @since 4.3.0
  29925. * @category Lang
  29926. * @param {*} value The value to check.
  29927. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29928. * @example
  29929. *
  29930. * _.isWeakMap(new WeakMap);
  29931. * // => true
  29932. *
  29933. * _.isWeakMap(new Map);
  29934. * // => false
  29935. */
  29936. function isWeakMap(value) {
  29937. return isObjectLike(value) && getTag(value) == weakMapTag;
  29938. }
  29939. /**
  29940. * Checks if `value` is classified as a `WeakSet` object.
  29941. *
  29942. * @static
  29943. * @memberOf _
  29944. * @since 4.3.0
  29945. * @category Lang
  29946. * @param {*} value The value to check.
  29947. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29948. * @example
  29949. *
  29950. * _.isWeakSet(new WeakSet);
  29951. * // => true
  29952. *
  29953. * _.isWeakSet(new Set);
  29954. * // => false
  29955. */
  29956. function isWeakSet(value) {
  29957. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29958. }
  29959. /**
  29960. * Checks if `value` is less than `other`.
  29961. *
  29962. * @static
  29963. * @memberOf _
  29964. * @since 3.9.0
  29965. * @category Lang
  29966. * @param {*} value The value to compare.
  29967. * @param {*} other The other value to compare.
  29968. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29969. * else `false`.
  29970. * @see _.gt
  29971. * @example
  29972. *
  29973. * _.lt(1, 3);
  29974. * // => true
  29975. *
  29976. * _.lt(3, 3);
  29977. * // => false
  29978. *
  29979. * _.lt(3, 1);
  29980. * // => false
  29981. */
  29982. var lt = createRelationalOperation(baseLt);
  29983. /**
  29984. * Checks if `value` is less than or equal to `other`.
  29985. *
  29986. * @static
  29987. * @memberOf _
  29988. * @since 3.9.0
  29989. * @category Lang
  29990. * @param {*} value The value to compare.
  29991. * @param {*} other The other value to compare.
  29992. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29993. * `other`, else `false`.
  29994. * @see _.gte
  29995. * @example
  29996. *
  29997. * _.lte(1, 3);
  29998. * // => true
  29999. *
  30000. * _.lte(3, 3);
  30001. * // => true
  30002. *
  30003. * _.lte(3, 1);
  30004. * // => false
  30005. */
  30006. var lte = createRelationalOperation(function(value, other) {
  30007. return value <= other;
  30008. });
  30009. /**
  30010. * Converts `value` to an array.
  30011. *
  30012. * @static
  30013. * @since 0.1.0
  30014. * @memberOf _
  30015. * @category Lang
  30016. * @param {*} value The value to convert.
  30017. * @returns {Array} Returns the converted array.
  30018. * @example
  30019. *
  30020. * _.toArray({ 'a': 1, 'b': 2 });
  30021. * // => [1, 2]
  30022. *
  30023. * _.toArray('abc');
  30024. * // => ['a', 'b', 'c']
  30025. *
  30026. * _.toArray(1);
  30027. * // => []
  30028. *
  30029. * _.toArray(null);
  30030. * // => []
  30031. */
  30032. function toArray(value) {
  30033. if (!value) {
  30034. return [];
  30035. }
  30036. if (isArrayLike(value)) {
  30037. return isString(value) ? stringToArray(value) : copyArray(value);
  30038. }
  30039. if (symIterator && value[symIterator]) {
  30040. return iteratorToArray(value[symIterator]());
  30041. }
  30042. var tag = getTag(value),
  30043. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30044. return func(value);
  30045. }
  30046. /**
  30047. * Converts `value` to a finite number.
  30048. *
  30049. * @static
  30050. * @memberOf _
  30051. * @since 4.12.0
  30052. * @category Lang
  30053. * @param {*} value The value to convert.
  30054. * @returns {number} Returns the converted number.
  30055. * @example
  30056. *
  30057. * _.toFinite(3.2);
  30058. * // => 3.2
  30059. *
  30060. * _.toFinite(Number.MIN_VALUE);
  30061. * // => 5e-324
  30062. *
  30063. * _.toFinite(Infinity);
  30064. * // => 1.7976931348623157e+308
  30065. *
  30066. * _.toFinite('3.2');
  30067. * // => 3.2
  30068. */
  30069. function toFinite(value) {
  30070. if (!value) {
  30071. return value === 0 ? value : 0;
  30072. }
  30073. value = toNumber(value);
  30074. if (value === INFINITY || value === -INFINITY) {
  30075. var sign = (value < 0 ? -1 : 1);
  30076. return sign * MAX_INTEGER;
  30077. }
  30078. return value === value ? value : 0;
  30079. }
  30080. /**
  30081. * Converts `value` to an integer.
  30082. *
  30083. * **Note:** This method is loosely based on
  30084. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30085. *
  30086. * @static
  30087. * @memberOf _
  30088. * @since 4.0.0
  30089. * @category Lang
  30090. * @param {*} value The value to convert.
  30091. * @returns {number} Returns the converted integer.
  30092. * @example
  30093. *
  30094. * _.toInteger(3.2);
  30095. * // => 3
  30096. *
  30097. * _.toInteger(Number.MIN_VALUE);
  30098. * // => 0
  30099. *
  30100. * _.toInteger(Infinity);
  30101. * // => 1.7976931348623157e+308
  30102. *
  30103. * _.toInteger('3.2');
  30104. * // => 3
  30105. */
  30106. function toInteger(value) {
  30107. var result = toFinite(value),
  30108. remainder = result % 1;
  30109. return result === result ? (remainder ? result - remainder : result) : 0;
  30110. }
  30111. /**
  30112. * Converts `value` to an integer suitable for use as the length of an
  30113. * array-like object.
  30114. *
  30115. * **Note:** This method is based on
  30116. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30117. *
  30118. * @static
  30119. * @memberOf _
  30120. * @since 4.0.0
  30121. * @category Lang
  30122. * @param {*} value The value to convert.
  30123. * @returns {number} Returns the converted integer.
  30124. * @example
  30125. *
  30126. * _.toLength(3.2);
  30127. * // => 3
  30128. *
  30129. * _.toLength(Number.MIN_VALUE);
  30130. * // => 0
  30131. *
  30132. * _.toLength(Infinity);
  30133. * // => 4294967295
  30134. *
  30135. * _.toLength('3.2');
  30136. * // => 3
  30137. */
  30138. function toLength(value) {
  30139. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30140. }
  30141. /**
  30142. * Converts `value` to a number.
  30143. *
  30144. * @static
  30145. * @memberOf _
  30146. * @since 4.0.0
  30147. * @category Lang
  30148. * @param {*} value The value to process.
  30149. * @returns {number} Returns the number.
  30150. * @example
  30151. *
  30152. * _.toNumber(3.2);
  30153. * // => 3.2
  30154. *
  30155. * _.toNumber(Number.MIN_VALUE);
  30156. * // => 5e-324
  30157. *
  30158. * _.toNumber(Infinity);
  30159. * // => Infinity
  30160. *
  30161. * _.toNumber('3.2');
  30162. * // => 3.2
  30163. */
  30164. function toNumber(value) {
  30165. if (typeof value == 'number') {
  30166. return value;
  30167. }
  30168. if (isSymbol(value)) {
  30169. return NAN;
  30170. }
  30171. if (isObject(value)) {
  30172. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30173. value = isObject(other) ? (other + '') : other;
  30174. }
  30175. if (typeof value != 'string') {
  30176. return value === 0 ? value : +value;
  30177. }
  30178. value = value.replace(reTrim, '');
  30179. var isBinary = reIsBinary.test(value);
  30180. return (isBinary || reIsOctal.test(value))
  30181. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30182. : (reIsBadHex.test(value) ? NAN : +value);
  30183. }
  30184. /**
  30185. * Converts `value` to a plain object flattening inherited enumerable string
  30186. * keyed properties of `value` to own properties of the plain object.
  30187. *
  30188. * @static
  30189. * @memberOf _
  30190. * @since 3.0.0
  30191. * @category Lang
  30192. * @param {*} value The value to convert.
  30193. * @returns {Object} Returns the converted plain object.
  30194. * @example
  30195. *
  30196. * function Foo() {
  30197. * this.b = 2;
  30198. * }
  30199. *
  30200. * Foo.prototype.c = 3;
  30201. *
  30202. * _.assign({ 'a': 1 }, new Foo);
  30203. * // => { 'a': 1, 'b': 2 }
  30204. *
  30205. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30206. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30207. */
  30208. function toPlainObject(value) {
  30209. return copyObject(value, keysIn(value));
  30210. }
  30211. /**
  30212. * Converts `value` to a safe integer. A safe integer can be compared and
  30213. * represented correctly.
  30214. *
  30215. * @static
  30216. * @memberOf _
  30217. * @since 4.0.0
  30218. * @category Lang
  30219. * @param {*} value The value to convert.
  30220. * @returns {number} Returns the converted integer.
  30221. * @example
  30222. *
  30223. * _.toSafeInteger(3.2);
  30224. * // => 3
  30225. *
  30226. * _.toSafeInteger(Number.MIN_VALUE);
  30227. * // => 0
  30228. *
  30229. * _.toSafeInteger(Infinity);
  30230. * // => 9007199254740991
  30231. *
  30232. * _.toSafeInteger('3.2');
  30233. * // => 3
  30234. */
  30235. function toSafeInteger(value) {
  30236. return value
  30237. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30238. : (value === 0 ? value : 0);
  30239. }
  30240. /**
  30241. * Converts `value` to a string. An empty string is returned for `null`
  30242. * and `undefined` values. The sign of `-0` is preserved.
  30243. *
  30244. * @static
  30245. * @memberOf _
  30246. * @since 4.0.0
  30247. * @category Lang
  30248. * @param {*} value The value to convert.
  30249. * @returns {string} Returns the converted string.
  30250. * @example
  30251. *
  30252. * _.toString(null);
  30253. * // => ''
  30254. *
  30255. * _.toString(-0);
  30256. * // => '-0'
  30257. *
  30258. * _.toString([1, 2, 3]);
  30259. * // => '1,2,3'
  30260. */
  30261. function toString(value) {
  30262. return value == null ? '' : baseToString(value);
  30263. }
  30264. /*------------------------------------------------------------------------*/
  30265. /**
  30266. * Assigns own enumerable string keyed properties of source objects to the
  30267. * destination object. Source objects are applied from left to right.
  30268. * Subsequent sources overwrite property assignments of previous sources.
  30269. *
  30270. * **Note:** This method mutates `object` and is loosely based on
  30271. * [`Object.assign`](https://mdn.io/Object/assign).
  30272. *
  30273. * @static
  30274. * @memberOf _
  30275. * @since 0.10.0
  30276. * @category Object
  30277. * @param {Object} object The destination object.
  30278. * @param {...Object} [sources] The source objects.
  30279. * @returns {Object} Returns `object`.
  30280. * @see _.assignIn
  30281. * @example
  30282. *
  30283. * function Foo() {
  30284. * this.a = 1;
  30285. * }
  30286. *
  30287. * function Bar() {
  30288. * this.c = 3;
  30289. * }
  30290. *
  30291. * Foo.prototype.b = 2;
  30292. * Bar.prototype.d = 4;
  30293. *
  30294. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30295. * // => { 'a': 1, 'c': 3 }
  30296. */
  30297. var assign = createAssigner(function(object, source) {
  30298. if (isPrototype(source) || isArrayLike(source)) {
  30299. copyObject(source, keys(source), object);
  30300. return;
  30301. }
  30302. for (var key in source) {
  30303. if (hasOwnProperty.call(source, key)) {
  30304. assignValue(object, key, source[key]);
  30305. }
  30306. }
  30307. });
  30308. /**
  30309. * This method is like `_.assign` except that it iterates over own and
  30310. * inherited source properties.
  30311. *
  30312. * **Note:** This method mutates `object`.
  30313. *
  30314. * @static
  30315. * @memberOf _
  30316. * @since 4.0.0
  30317. * @alias extend
  30318. * @category Object
  30319. * @param {Object} object The destination object.
  30320. * @param {...Object} [sources] The source objects.
  30321. * @returns {Object} Returns `object`.
  30322. * @see _.assign
  30323. * @example
  30324. *
  30325. * function Foo() {
  30326. * this.a = 1;
  30327. * }
  30328. *
  30329. * function Bar() {
  30330. * this.c = 3;
  30331. * }
  30332. *
  30333. * Foo.prototype.b = 2;
  30334. * Bar.prototype.d = 4;
  30335. *
  30336. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30337. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30338. */
  30339. var assignIn = createAssigner(function(object, source) {
  30340. copyObject(source, keysIn(source), object);
  30341. });
  30342. /**
  30343. * This method is like `_.assignIn` except that it accepts `customizer`
  30344. * which is invoked to produce the assigned values. If `customizer` returns
  30345. * `undefined`, assignment is handled by the method instead. The `customizer`
  30346. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30347. *
  30348. * **Note:** This method mutates `object`.
  30349. *
  30350. * @static
  30351. * @memberOf _
  30352. * @since 4.0.0
  30353. * @alias extendWith
  30354. * @category Object
  30355. * @param {Object} object The destination object.
  30356. * @param {...Object} sources The source objects.
  30357. * @param {Function} [customizer] The function to customize assigned values.
  30358. * @returns {Object} Returns `object`.
  30359. * @see _.assignWith
  30360. * @example
  30361. *
  30362. * function customizer(objValue, srcValue) {
  30363. * return _.isUndefined(objValue) ? srcValue : objValue;
  30364. * }
  30365. *
  30366. * var defaults = _.partialRight(_.assignInWith, customizer);
  30367. *
  30368. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30369. * // => { 'a': 1, 'b': 2 }
  30370. */
  30371. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30372. copyObject(source, keysIn(source), object, customizer);
  30373. });
  30374. /**
  30375. * This method is like `_.assign` except that it accepts `customizer`
  30376. * which is invoked to produce the assigned values. If `customizer` returns
  30377. * `undefined`, assignment is handled by the method instead. The `customizer`
  30378. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30379. *
  30380. * **Note:** This method mutates `object`.
  30381. *
  30382. * @static
  30383. * @memberOf _
  30384. * @since 4.0.0
  30385. * @category Object
  30386. * @param {Object} object The destination object.
  30387. * @param {...Object} sources The source objects.
  30388. * @param {Function} [customizer] The function to customize assigned values.
  30389. * @returns {Object} Returns `object`.
  30390. * @see _.assignInWith
  30391. * @example
  30392. *
  30393. * function customizer(objValue, srcValue) {
  30394. * return _.isUndefined(objValue) ? srcValue : objValue;
  30395. * }
  30396. *
  30397. * var defaults = _.partialRight(_.assignWith, customizer);
  30398. *
  30399. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30400. * // => { 'a': 1, 'b': 2 }
  30401. */
  30402. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30403. copyObject(source, keys(source), object, customizer);
  30404. });
  30405. /**
  30406. * Creates an array of values corresponding to `paths` of `object`.
  30407. *
  30408. * @static
  30409. * @memberOf _
  30410. * @since 1.0.0
  30411. * @category Object
  30412. * @param {Object} object The object to iterate over.
  30413. * @param {...(string|string[])} [paths] The property paths to pick.
  30414. * @returns {Array} Returns the picked values.
  30415. * @example
  30416. *
  30417. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30418. *
  30419. * _.at(object, ['a[0].b.c', 'a[1]']);
  30420. * // => [3, 4]
  30421. */
  30422. var at = flatRest(baseAt);
  30423. /**
  30424. * Creates an object that inherits from the `prototype` object. If a
  30425. * `properties` object is given, its own enumerable string keyed properties
  30426. * are assigned to the created object.
  30427. *
  30428. * @static
  30429. * @memberOf _
  30430. * @since 2.3.0
  30431. * @category Object
  30432. * @param {Object} prototype The object to inherit from.
  30433. * @param {Object} [properties] The properties to assign to the object.
  30434. * @returns {Object} Returns the new object.
  30435. * @example
  30436. *
  30437. * function Shape() {
  30438. * this.x = 0;
  30439. * this.y = 0;
  30440. * }
  30441. *
  30442. * function Circle() {
  30443. * Shape.call(this);
  30444. * }
  30445. *
  30446. * Circle.prototype = _.create(Shape.prototype, {
  30447. * 'constructor': Circle
  30448. * });
  30449. *
  30450. * var circle = new Circle;
  30451. * circle instanceof Circle;
  30452. * // => true
  30453. *
  30454. * circle instanceof Shape;
  30455. * // => true
  30456. */
  30457. function create(prototype, properties) {
  30458. var result = baseCreate(prototype);
  30459. return properties == null ? result : baseAssign(result, properties);
  30460. }
  30461. /**
  30462. * Assigns own and inherited enumerable string keyed properties of source
  30463. * objects to the destination object for all destination properties that
  30464. * resolve to `undefined`. Source objects are applied from left to right.
  30465. * Once a property is set, additional values of the same property are ignored.
  30466. *
  30467. * **Note:** This method mutates `object`.
  30468. *
  30469. * @static
  30470. * @since 0.1.0
  30471. * @memberOf _
  30472. * @category Object
  30473. * @param {Object} object The destination object.
  30474. * @param {...Object} [sources] The source objects.
  30475. * @returns {Object} Returns `object`.
  30476. * @see _.defaultsDeep
  30477. * @example
  30478. *
  30479. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30480. * // => { 'a': 1, 'b': 2 }
  30481. */
  30482. var defaults = baseRest(function(object, sources) {
  30483. object = Object(object);
  30484. var index = -1;
  30485. var length = sources.length;
  30486. var guard = length > 2 ? sources[2] : undefined;
  30487. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30488. length = 1;
  30489. }
  30490. while (++index < length) {
  30491. var source = sources[index];
  30492. var props = keysIn(source);
  30493. var propsIndex = -1;
  30494. var propsLength = props.length;
  30495. while (++propsIndex < propsLength) {
  30496. var key = props[propsIndex];
  30497. var value = object[key];
  30498. if (value === undefined ||
  30499. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30500. object[key] = source[key];
  30501. }
  30502. }
  30503. }
  30504. return object;
  30505. });
  30506. /**
  30507. * This method is like `_.defaults` except that it recursively assigns
  30508. * default properties.
  30509. *
  30510. * **Note:** This method mutates `object`.
  30511. *
  30512. * @static
  30513. * @memberOf _
  30514. * @since 3.10.0
  30515. * @category Object
  30516. * @param {Object} object The destination object.
  30517. * @param {...Object} [sources] The source objects.
  30518. * @returns {Object} Returns `object`.
  30519. * @see _.defaults
  30520. * @example
  30521. *
  30522. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30523. * // => { 'a': { 'b': 2, 'c': 3 } }
  30524. */
  30525. var defaultsDeep = baseRest(function(args) {
  30526. args.push(undefined, customDefaultsMerge);
  30527. return apply(mergeWith, undefined, args);
  30528. });
  30529. /**
  30530. * This method is like `_.find` except that it returns the key of the first
  30531. * element `predicate` returns truthy for instead of the element itself.
  30532. *
  30533. * @static
  30534. * @memberOf _
  30535. * @since 1.1.0
  30536. * @category Object
  30537. * @param {Object} object The object to inspect.
  30538. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30539. * @returns {string|undefined} Returns the key of the matched element,
  30540. * else `undefined`.
  30541. * @example
  30542. *
  30543. * var users = {
  30544. * 'barney': { 'age': 36, 'active': true },
  30545. * 'fred': { 'age': 40, 'active': false },
  30546. * 'pebbles': { 'age': 1, 'active': true }
  30547. * };
  30548. *
  30549. * _.findKey(users, function(o) { return o.age < 40; });
  30550. * // => 'barney' (iteration order is not guaranteed)
  30551. *
  30552. * // The `_.matches` iteratee shorthand.
  30553. * _.findKey(users, { 'age': 1, 'active': true });
  30554. * // => 'pebbles'
  30555. *
  30556. * // The `_.matchesProperty` iteratee shorthand.
  30557. * _.findKey(users, ['active', false]);
  30558. * // => 'fred'
  30559. *
  30560. * // The `_.property` iteratee shorthand.
  30561. * _.findKey(users, 'active');
  30562. * // => 'barney'
  30563. */
  30564. function findKey(object, predicate) {
  30565. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30566. }
  30567. /**
  30568. * This method is like `_.findKey` except that it iterates over elements of
  30569. * a collection in the opposite order.
  30570. *
  30571. * @static
  30572. * @memberOf _
  30573. * @since 2.0.0
  30574. * @category Object
  30575. * @param {Object} object The object to inspect.
  30576. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30577. * @returns {string|undefined} Returns the key of the matched element,
  30578. * else `undefined`.
  30579. * @example
  30580. *
  30581. * var users = {
  30582. * 'barney': { 'age': 36, 'active': true },
  30583. * 'fred': { 'age': 40, 'active': false },
  30584. * 'pebbles': { 'age': 1, 'active': true }
  30585. * };
  30586. *
  30587. * _.findLastKey(users, function(o) { return o.age < 40; });
  30588. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30589. *
  30590. * // The `_.matches` iteratee shorthand.
  30591. * _.findLastKey(users, { 'age': 36, 'active': true });
  30592. * // => 'barney'
  30593. *
  30594. * // The `_.matchesProperty` iteratee shorthand.
  30595. * _.findLastKey(users, ['active', false]);
  30596. * // => 'fred'
  30597. *
  30598. * // The `_.property` iteratee shorthand.
  30599. * _.findLastKey(users, 'active');
  30600. * // => 'pebbles'
  30601. */
  30602. function findLastKey(object, predicate) {
  30603. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30604. }
  30605. /**
  30606. * Iterates over own and inherited enumerable string keyed properties of an
  30607. * object and invokes `iteratee` for each property. The iteratee is invoked
  30608. * with three arguments: (value, key, object). Iteratee functions may exit
  30609. * iteration early by explicitly returning `false`.
  30610. *
  30611. * @static
  30612. * @memberOf _
  30613. * @since 0.3.0
  30614. * @category Object
  30615. * @param {Object} object The object to iterate over.
  30616. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30617. * @returns {Object} Returns `object`.
  30618. * @see _.forInRight
  30619. * @example
  30620. *
  30621. * function Foo() {
  30622. * this.a = 1;
  30623. * this.b = 2;
  30624. * }
  30625. *
  30626. * Foo.prototype.c = 3;
  30627. *
  30628. * _.forIn(new Foo, function(value, key) {
  30629. * console.log(key);
  30630. * });
  30631. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30632. */
  30633. function forIn(object, iteratee) {
  30634. return object == null
  30635. ? object
  30636. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30637. }
  30638. /**
  30639. * This method is like `_.forIn` except that it iterates over properties of
  30640. * `object` in the opposite order.
  30641. *
  30642. * @static
  30643. * @memberOf _
  30644. * @since 2.0.0
  30645. * @category Object
  30646. * @param {Object} object The object to iterate over.
  30647. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30648. * @returns {Object} Returns `object`.
  30649. * @see _.forIn
  30650. * @example
  30651. *
  30652. * function Foo() {
  30653. * this.a = 1;
  30654. * this.b = 2;
  30655. * }
  30656. *
  30657. * Foo.prototype.c = 3;
  30658. *
  30659. * _.forInRight(new Foo, function(value, key) {
  30660. * console.log(key);
  30661. * });
  30662. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30663. */
  30664. function forInRight(object, iteratee) {
  30665. return object == null
  30666. ? object
  30667. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30668. }
  30669. /**
  30670. * Iterates over own enumerable string keyed properties of an object and
  30671. * invokes `iteratee` for each property. The iteratee is invoked with three
  30672. * arguments: (value, key, object). Iteratee functions may exit iteration
  30673. * early by explicitly returning `false`.
  30674. *
  30675. * @static
  30676. * @memberOf _
  30677. * @since 0.3.0
  30678. * @category Object
  30679. * @param {Object} object The object to iterate over.
  30680. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30681. * @returns {Object} Returns `object`.
  30682. * @see _.forOwnRight
  30683. * @example
  30684. *
  30685. * function Foo() {
  30686. * this.a = 1;
  30687. * this.b = 2;
  30688. * }
  30689. *
  30690. * Foo.prototype.c = 3;
  30691. *
  30692. * _.forOwn(new Foo, function(value, key) {
  30693. * console.log(key);
  30694. * });
  30695. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30696. */
  30697. function forOwn(object, iteratee) {
  30698. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30699. }
  30700. /**
  30701. * This method is like `_.forOwn` except that it iterates over properties of
  30702. * `object` in the opposite order.
  30703. *
  30704. * @static
  30705. * @memberOf _
  30706. * @since 2.0.0
  30707. * @category Object
  30708. * @param {Object} object The object to iterate over.
  30709. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30710. * @returns {Object} Returns `object`.
  30711. * @see _.forOwn
  30712. * @example
  30713. *
  30714. * function Foo() {
  30715. * this.a = 1;
  30716. * this.b = 2;
  30717. * }
  30718. *
  30719. * Foo.prototype.c = 3;
  30720. *
  30721. * _.forOwnRight(new Foo, function(value, key) {
  30722. * console.log(key);
  30723. * });
  30724. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30725. */
  30726. function forOwnRight(object, iteratee) {
  30727. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30728. }
  30729. /**
  30730. * Creates an array of function property names from own enumerable properties
  30731. * of `object`.
  30732. *
  30733. * @static
  30734. * @since 0.1.0
  30735. * @memberOf _
  30736. * @category Object
  30737. * @param {Object} object The object to inspect.
  30738. * @returns {Array} Returns the function names.
  30739. * @see _.functionsIn
  30740. * @example
  30741. *
  30742. * function Foo() {
  30743. * this.a = _.constant('a');
  30744. * this.b = _.constant('b');
  30745. * }
  30746. *
  30747. * Foo.prototype.c = _.constant('c');
  30748. *
  30749. * _.functions(new Foo);
  30750. * // => ['a', 'b']
  30751. */
  30752. function functions(object) {
  30753. return object == null ? [] : baseFunctions(object, keys(object));
  30754. }
  30755. /**
  30756. * Creates an array of function property names from own and inherited
  30757. * enumerable properties of `object`.
  30758. *
  30759. * @static
  30760. * @memberOf _
  30761. * @since 4.0.0
  30762. * @category Object
  30763. * @param {Object} object The object to inspect.
  30764. * @returns {Array} Returns the function names.
  30765. * @see _.functions
  30766. * @example
  30767. *
  30768. * function Foo() {
  30769. * this.a = _.constant('a');
  30770. * this.b = _.constant('b');
  30771. * }
  30772. *
  30773. * Foo.prototype.c = _.constant('c');
  30774. *
  30775. * _.functionsIn(new Foo);
  30776. * // => ['a', 'b', 'c']
  30777. */
  30778. function functionsIn(object) {
  30779. return object == null ? [] : baseFunctions(object, keysIn(object));
  30780. }
  30781. /**
  30782. * Gets the value at `path` of `object`. If the resolved value is
  30783. * `undefined`, the `defaultValue` is returned in its place.
  30784. *
  30785. * @static
  30786. * @memberOf _
  30787. * @since 3.7.0
  30788. * @category Object
  30789. * @param {Object} object The object to query.
  30790. * @param {Array|string} path The path of the property to get.
  30791. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30792. * @returns {*} Returns the resolved value.
  30793. * @example
  30794. *
  30795. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30796. *
  30797. * _.get(object, 'a[0].b.c');
  30798. * // => 3
  30799. *
  30800. * _.get(object, ['a', '0', 'b', 'c']);
  30801. * // => 3
  30802. *
  30803. * _.get(object, 'a.b.c', 'default');
  30804. * // => 'default'
  30805. */
  30806. function get(object, path, defaultValue) {
  30807. var result = object == null ? undefined : baseGet(object, path);
  30808. return result === undefined ? defaultValue : result;
  30809. }
  30810. /**
  30811. * Checks if `path` is a direct property of `object`.
  30812. *
  30813. * @static
  30814. * @since 0.1.0
  30815. * @memberOf _
  30816. * @category Object
  30817. * @param {Object} object The object to query.
  30818. * @param {Array|string} path The path to check.
  30819. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30820. * @example
  30821. *
  30822. * var object = { 'a': { 'b': 2 } };
  30823. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30824. *
  30825. * _.has(object, 'a');
  30826. * // => true
  30827. *
  30828. * _.has(object, 'a.b');
  30829. * // => true
  30830. *
  30831. * _.has(object, ['a', 'b']);
  30832. * // => true
  30833. *
  30834. * _.has(other, 'a');
  30835. * // => false
  30836. */
  30837. function has(object, path) {
  30838. return object != null && hasPath(object, path, baseHas);
  30839. }
  30840. /**
  30841. * Checks if `path` is a direct or inherited property of `object`.
  30842. *
  30843. * @static
  30844. * @memberOf _
  30845. * @since 4.0.0
  30846. * @category Object
  30847. * @param {Object} object The object to query.
  30848. * @param {Array|string} path The path to check.
  30849. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30850. * @example
  30851. *
  30852. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30853. *
  30854. * _.hasIn(object, 'a');
  30855. * // => true
  30856. *
  30857. * _.hasIn(object, 'a.b');
  30858. * // => true
  30859. *
  30860. * _.hasIn(object, ['a', 'b']);
  30861. * // => true
  30862. *
  30863. * _.hasIn(object, 'b');
  30864. * // => false
  30865. */
  30866. function hasIn(object, path) {
  30867. return object != null && hasPath(object, path, baseHasIn);
  30868. }
  30869. /**
  30870. * Creates an object composed of the inverted keys and values of `object`.
  30871. * If `object` contains duplicate values, subsequent values overwrite
  30872. * property assignments of previous values.
  30873. *
  30874. * @static
  30875. * @memberOf _
  30876. * @since 0.7.0
  30877. * @category Object
  30878. * @param {Object} object The object to invert.
  30879. * @returns {Object} Returns the new inverted object.
  30880. * @example
  30881. *
  30882. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30883. *
  30884. * _.invert(object);
  30885. * // => { '1': 'c', '2': 'b' }
  30886. */
  30887. var invert = createInverter(function(result, value, key) {
  30888. if (value != null &&
  30889. typeof value.toString != 'function') {
  30890. value = nativeObjectToString.call(value);
  30891. }
  30892. result[value] = key;
  30893. }, constant(identity));
  30894. /**
  30895. * This method is like `_.invert` except that the inverted object is generated
  30896. * from the results of running each element of `object` thru `iteratee`. The
  30897. * corresponding inverted value of each inverted key is an array of keys
  30898. * responsible for generating the inverted value. The iteratee is invoked
  30899. * with one argument: (value).
  30900. *
  30901. * @static
  30902. * @memberOf _
  30903. * @since 4.1.0
  30904. * @category Object
  30905. * @param {Object} object The object to invert.
  30906. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30907. * @returns {Object} Returns the new inverted object.
  30908. * @example
  30909. *
  30910. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30911. *
  30912. * _.invertBy(object);
  30913. * // => { '1': ['a', 'c'], '2': ['b'] }
  30914. *
  30915. * _.invertBy(object, function(value) {
  30916. * return 'group' + value;
  30917. * });
  30918. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30919. */
  30920. var invertBy = createInverter(function(result, value, key) {
  30921. if (value != null &&
  30922. typeof value.toString != 'function') {
  30923. value = nativeObjectToString.call(value);
  30924. }
  30925. if (hasOwnProperty.call(result, value)) {
  30926. result[value].push(key);
  30927. } else {
  30928. result[value] = [key];
  30929. }
  30930. }, getIteratee);
  30931. /**
  30932. * Invokes the method at `path` of `object`.
  30933. *
  30934. * @static
  30935. * @memberOf _
  30936. * @since 4.0.0
  30937. * @category Object
  30938. * @param {Object} object The object to query.
  30939. * @param {Array|string} path The path of the method to invoke.
  30940. * @param {...*} [args] The arguments to invoke the method with.
  30941. * @returns {*} Returns the result of the invoked method.
  30942. * @example
  30943. *
  30944. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30945. *
  30946. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30947. * // => [2, 3]
  30948. */
  30949. var invoke = baseRest(baseInvoke);
  30950. /**
  30951. * Creates an array of the own enumerable property names of `object`.
  30952. *
  30953. * **Note:** Non-object values are coerced to objects. See the
  30954. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30955. * for more details.
  30956. *
  30957. * @static
  30958. * @since 0.1.0
  30959. * @memberOf _
  30960. * @category Object
  30961. * @param {Object} object The object to query.
  30962. * @returns {Array} Returns the array of property names.
  30963. * @example
  30964. *
  30965. * function Foo() {
  30966. * this.a = 1;
  30967. * this.b = 2;
  30968. * }
  30969. *
  30970. * Foo.prototype.c = 3;
  30971. *
  30972. * _.keys(new Foo);
  30973. * // => ['a', 'b'] (iteration order is not guaranteed)
  30974. *
  30975. * _.keys('hi');
  30976. * // => ['0', '1']
  30977. */
  30978. function keys(object) {
  30979. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30980. }
  30981. /**
  30982. * Creates an array of the own and inherited enumerable property names of `object`.
  30983. *
  30984. * **Note:** Non-object values are coerced to objects.
  30985. *
  30986. * @static
  30987. * @memberOf _
  30988. * @since 3.0.0
  30989. * @category Object
  30990. * @param {Object} object The object to query.
  30991. * @returns {Array} Returns the array of property names.
  30992. * @example
  30993. *
  30994. * function Foo() {
  30995. * this.a = 1;
  30996. * this.b = 2;
  30997. * }
  30998. *
  30999. * Foo.prototype.c = 3;
  31000. *
  31001. * _.keysIn(new Foo);
  31002. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31003. */
  31004. function keysIn(object) {
  31005. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31006. }
  31007. /**
  31008. * The opposite of `_.mapValues`; this method creates an object with the
  31009. * same values as `object` and keys generated by running each own enumerable
  31010. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31011. * with three arguments: (value, key, object).
  31012. *
  31013. * @static
  31014. * @memberOf _
  31015. * @since 3.8.0
  31016. * @category Object
  31017. * @param {Object} object The object to iterate over.
  31018. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31019. * @returns {Object} Returns the new mapped object.
  31020. * @see _.mapValues
  31021. * @example
  31022. *
  31023. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31024. * return key + value;
  31025. * });
  31026. * // => { 'a1': 1, 'b2': 2 }
  31027. */
  31028. function mapKeys(object, iteratee) {
  31029. var result = {};
  31030. iteratee = getIteratee(iteratee, 3);
  31031. baseForOwn(object, function(value, key, object) {
  31032. baseAssignValue(result, iteratee(value, key, object), value);
  31033. });
  31034. return result;
  31035. }
  31036. /**
  31037. * Creates an object with the same keys as `object` and values generated
  31038. * by running each own enumerable string keyed property of `object` thru
  31039. * `iteratee`. The iteratee is invoked with three arguments:
  31040. * (value, key, object).
  31041. *
  31042. * @static
  31043. * @memberOf _
  31044. * @since 2.4.0
  31045. * @category Object
  31046. * @param {Object} object The object to iterate over.
  31047. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31048. * @returns {Object} Returns the new mapped object.
  31049. * @see _.mapKeys
  31050. * @example
  31051. *
  31052. * var users = {
  31053. * 'fred': { 'user': 'fred', 'age': 40 },
  31054. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31055. * };
  31056. *
  31057. * _.mapValues(users, function(o) { return o.age; });
  31058. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31059. *
  31060. * // The `_.property` iteratee shorthand.
  31061. * _.mapValues(users, 'age');
  31062. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31063. */
  31064. function mapValues(object, iteratee) {
  31065. var result = {};
  31066. iteratee = getIteratee(iteratee, 3);
  31067. baseForOwn(object, function(value, key, object) {
  31068. baseAssignValue(result, key, iteratee(value, key, object));
  31069. });
  31070. return result;
  31071. }
  31072. /**
  31073. * This method is like `_.assign` except that it recursively merges own and
  31074. * inherited enumerable string keyed properties of source objects into the
  31075. * destination object. Source properties that resolve to `undefined` are
  31076. * skipped if a destination value exists. Array and plain object properties
  31077. * are merged recursively. Other objects and value types are overridden by
  31078. * assignment. Source objects are applied from left to right. Subsequent
  31079. * sources overwrite property assignments of previous sources.
  31080. *
  31081. * **Note:** This method mutates `object`.
  31082. *
  31083. * @static
  31084. * @memberOf _
  31085. * @since 0.5.0
  31086. * @category Object
  31087. * @param {Object} object The destination object.
  31088. * @param {...Object} [sources] The source objects.
  31089. * @returns {Object} Returns `object`.
  31090. * @example
  31091. *
  31092. * var object = {
  31093. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31094. * };
  31095. *
  31096. * var other = {
  31097. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31098. * };
  31099. *
  31100. * _.merge(object, other);
  31101. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31102. */
  31103. var merge = createAssigner(function(object, source, srcIndex) {
  31104. baseMerge(object, source, srcIndex);
  31105. });
  31106. /**
  31107. * This method is like `_.merge` except that it accepts `customizer` which
  31108. * is invoked to produce the merged values of the destination and source
  31109. * properties. If `customizer` returns `undefined`, merging is handled by the
  31110. * method instead. The `customizer` is invoked with six arguments:
  31111. * (objValue, srcValue, key, object, source, stack).
  31112. *
  31113. * **Note:** This method mutates `object`.
  31114. *
  31115. * @static
  31116. * @memberOf _
  31117. * @since 4.0.0
  31118. * @category Object
  31119. * @param {Object} object The destination object.
  31120. * @param {...Object} sources The source objects.
  31121. * @param {Function} customizer The function to customize assigned values.
  31122. * @returns {Object} Returns `object`.
  31123. * @example
  31124. *
  31125. * function customizer(objValue, srcValue) {
  31126. * if (_.isArray(objValue)) {
  31127. * return objValue.concat(srcValue);
  31128. * }
  31129. * }
  31130. *
  31131. * var object = { 'a': [1], 'b': [2] };
  31132. * var other = { 'a': [3], 'b': [4] };
  31133. *
  31134. * _.mergeWith(object, other, customizer);
  31135. * // => { 'a': [1, 3], 'b': [2, 4] }
  31136. */
  31137. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31138. baseMerge(object, source, srcIndex, customizer);
  31139. });
  31140. /**
  31141. * The opposite of `_.pick`; this method creates an object composed of the
  31142. * own and inherited enumerable property paths of `object` that are not omitted.
  31143. *
  31144. * **Note:** This method is considerably slower than `_.pick`.
  31145. *
  31146. * @static
  31147. * @since 0.1.0
  31148. * @memberOf _
  31149. * @category Object
  31150. * @param {Object} object The source object.
  31151. * @param {...(string|string[])} [paths] The property paths to omit.
  31152. * @returns {Object} Returns the new object.
  31153. * @example
  31154. *
  31155. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31156. *
  31157. * _.omit(object, ['a', 'c']);
  31158. * // => { 'b': '2' }
  31159. */
  31160. var omit = flatRest(function(object, paths) {
  31161. var result = {};
  31162. if (object == null) {
  31163. return result;
  31164. }
  31165. var isDeep = false;
  31166. paths = arrayMap(paths, function(path) {
  31167. path = castPath(path, object);
  31168. isDeep || (isDeep = path.length > 1);
  31169. return path;
  31170. });
  31171. copyObject(object, getAllKeysIn(object), result);
  31172. if (isDeep) {
  31173. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31174. }
  31175. var length = paths.length;
  31176. while (length--) {
  31177. baseUnset(result, paths[length]);
  31178. }
  31179. return result;
  31180. });
  31181. /**
  31182. * The opposite of `_.pickBy`; this method creates an object composed of
  31183. * the own and inherited enumerable string keyed properties of `object` that
  31184. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31185. * arguments: (value, key).
  31186. *
  31187. * @static
  31188. * @memberOf _
  31189. * @since 4.0.0
  31190. * @category Object
  31191. * @param {Object} object The source object.
  31192. * @param {Function} [predicate=_.identity] The function invoked per property.
  31193. * @returns {Object} Returns the new object.
  31194. * @example
  31195. *
  31196. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31197. *
  31198. * _.omitBy(object, _.isNumber);
  31199. * // => { 'b': '2' }
  31200. */
  31201. function omitBy(object, predicate) {
  31202. return pickBy(object, negate(getIteratee(predicate)));
  31203. }
  31204. /**
  31205. * Creates an object composed of the picked `object` properties.
  31206. *
  31207. * @static
  31208. * @since 0.1.0
  31209. * @memberOf _
  31210. * @category Object
  31211. * @param {Object} object The source object.
  31212. * @param {...(string|string[])} [paths] The property paths to pick.
  31213. * @returns {Object} Returns the new object.
  31214. * @example
  31215. *
  31216. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31217. *
  31218. * _.pick(object, ['a', 'c']);
  31219. * // => { 'a': 1, 'c': 3 }
  31220. */
  31221. var pick = flatRest(function(object, paths) {
  31222. return object == null ? {} : basePick(object, paths);
  31223. });
  31224. /**
  31225. * Creates an object composed of the `object` properties `predicate` returns
  31226. * truthy for. The predicate is invoked with two arguments: (value, key).
  31227. *
  31228. * @static
  31229. * @memberOf _
  31230. * @since 4.0.0
  31231. * @category Object
  31232. * @param {Object} object The source object.
  31233. * @param {Function} [predicate=_.identity] The function invoked per property.
  31234. * @returns {Object} Returns the new object.
  31235. * @example
  31236. *
  31237. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31238. *
  31239. * _.pickBy(object, _.isNumber);
  31240. * // => { 'a': 1, 'c': 3 }
  31241. */
  31242. function pickBy(object, predicate) {
  31243. if (object == null) {
  31244. return {};
  31245. }
  31246. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31247. return [prop];
  31248. });
  31249. predicate = getIteratee(predicate);
  31250. return basePickBy(object, props, function(value, path) {
  31251. return predicate(value, path[0]);
  31252. });
  31253. }
  31254. /**
  31255. * This method is like `_.get` except that if the resolved value is a
  31256. * function it's invoked with the `this` binding of its parent object and
  31257. * its result is returned.
  31258. *
  31259. * @static
  31260. * @since 0.1.0
  31261. * @memberOf _
  31262. * @category Object
  31263. * @param {Object} object The object to query.
  31264. * @param {Array|string} path The path of the property to resolve.
  31265. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31266. * @returns {*} Returns the resolved value.
  31267. * @example
  31268. *
  31269. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31270. *
  31271. * _.result(object, 'a[0].b.c1');
  31272. * // => 3
  31273. *
  31274. * _.result(object, 'a[0].b.c2');
  31275. * // => 4
  31276. *
  31277. * _.result(object, 'a[0].b.c3', 'default');
  31278. * // => 'default'
  31279. *
  31280. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31281. * // => 'default'
  31282. */
  31283. function result(object, path, defaultValue) {
  31284. path = castPath(path, object);
  31285. var index = -1,
  31286. length = path.length;
  31287. // Ensure the loop is entered when path is empty.
  31288. if (!length) {
  31289. length = 1;
  31290. object = undefined;
  31291. }
  31292. while (++index < length) {
  31293. var value = object == null ? undefined : object[toKey(path[index])];
  31294. if (value === undefined) {
  31295. index = length;
  31296. value = defaultValue;
  31297. }
  31298. object = isFunction(value) ? value.call(object) : value;
  31299. }
  31300. return object;
  31301. }
  31302. /**
  31303. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31304. * it's created. Arrays are created for missing index properties while objects
  31305. * are created for all other missing properties. Use `_.setWith` to customize
  31306. * `path` creation.
  31307. *
  31308. * **Note:** This method mutates `object`.
  31309. *
  31310. * @static
  31311. * @memberOf _
  31312. * @since 3.7.0
  31313. * @category Object
  31314. * @param {Object} object The object to modify.
  31315. * @param {Array|string} path The path of the property to set.
  31316. * @param {*} value The value to set.
  31317. * @returns {Object} Returns `object`.
  31318. * @example
  31319. *
  31320. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31321. *
  31322. * _.set(object, 'a[0].b.c', 4);
  31323. * console.log(object.a[0].b.c);
  31324. * // => 4
  31325. *
  31326. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31327. * console.log(object.x[0].y.z);
  31328. * // => 5
  31329. */
  31330. function set(object, path, value) {
  31331. return object == null ? object : baseSet(object, path, value);
  31332. }
  31333. /**
  31334. * This method is like `_.set` except that it accepts `customizer` which is
  31335. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31336. * path creation is handled by the method instead. The `customizer` is invoked
  31337. * with three arguments: (nsValue, key, nsObject).
  31338. *
  31339. * **Note:** This method mutates `object`.
  31340. *
  31341. * @static
  31342. * @memberOf _
  31343. * @since 4.0.0
  31344. * @category Object
  31345. * @param {Object} object The object to modify.
  31346. * @param {Array|string} path The path of the property to set.
  31347. * @param {*} value The value to set.
  31348. * @param {Function} [customizer] The function to customize assigned values.
  31349. * @returns {Object} Returns `object`.
  31350. * @example
  31351. *
  31352. * var object = {};
  31353. *
  31354. * _.setWith(object, '[0][1]', 'a', Object);
  31355. * // => { '0': { '1': 'a' } }
  31356. */
  31357. function setWith(object, path, value, customizer) {
  31358. customizer = typeof customizer == 'function' ? customizer : undefined;
  31359. return object == null ? object : baseSet(object, path, value, customizer);
  31360. }
  31361. /**
  31362. * Creates an array of own enumerable string keyed-value pairs for `object`
  31363. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31364. * entries are returned.
  31365. *
  31366. * @static
  31367. * @memberOf _
  31368. * @since 4.0.0
  31369. * @alias entries
  31370. * @category Object
  31371. * @param {Object} object The object to query.
  31372. * @returns {Array} Returns the key-value pairs.
  31373. * @example
  31374. *
  31375. * function Foo() {
  31376. * this.a = 1;
  31377. * this.b = 2;
  31378. * }
  31379. *
  31380. * Foo.prototype.c = 3;
  31381. *
  31382. * _.toPairs(new Foo);
  31383. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31384. */
  31385. var toPairs = createToPairs(keys);
  31386. /**
  31387. * Creates an array of own and inherited enumerable string keyed-value pairs
  31388. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31389. * or set, its entries are returned.
  31390. *
  31391. * @static
  31392. * @memberOf _
  31393. * @since 4.0.0
  31394. * @alias entriesIn
  31395. * @category Object
  31396. * @param {Object} object The object to query.
  31397. * @returns {Array} Returns the key-value pairs.
  31398. * @example
  31399. *
  31400. * function Foo() {
  31401. * this.a = 1;
  31402. * this.b = 2;
  31403. * }
  31404. *
  31405. * Foo.prototype.c = 3;
  31406. *
  31407. * _.toPairsIn(new Foo);
  31408. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31409. */
  31410. var toPairsIn = createToPairs(keysIn);
  31411. /**
  31412. * An alternative to `_.reduce`; this method transforms `object` to a new
  31413. * `accumulator` object which is the result of running each of its own
  31414. * enumerable string keyed properties thru `iteratee`, with each invocation
  31415. * potentially mutating the `accumulator` object. If `accumulator` is not
  31416. * provided, a new object with the same `[[Prototype]]` will be used. The
  31417. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31418. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31419. *
  31420. * @static
  31421. * @memberOf _
  31422. * @since 1.3.0
  31423. * @category Object
  31424. * @param {Object} object The object to iterate over.
  31425. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31426. * @param {*} [accumulator] The custom accumulator value.
  31427. * @returns {*} Returns the accumulated value.
  31428. * @example
  31429. *
  31430. * _.transform([2, 3, 4], function(result, n) {
  31431. * result.push(n *= n);
  31432. * return n % 2 == 0;
  31433. * }, []);
  31434. * // => [4, 9]
  31435. *
  31436. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31437. * (result[value] || (result[value] = [])).push(key);
  31438. * }, {});
  31439. * // => { '1': ['a', 'c'], '2': ['b'] }
  31440. */
  31441. function transform(object, iteratee, accumulator) {
  31442. var isArr = isArray(object),
  31443. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31444. iteratee = getIteratee(iteratee, 4);
  31445. if (accumulator == null) {
  31446. var Ctor = object && object.constructor;
  31447. if (isArrLike) {
  31448. accumulator = isArr ? new Ctor : [];
  31449. }
  31450. else if (isObject(object)) {
  31451. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31452. }
  31453. else {
  31454. accumulator = {};
  31455. }
  31456. }
  31457. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31458. return iteratee(accumulator, value, index, object);
  31459. });
  31460. return accumulator;
  31461. }
  31462. /**
  31463. * Removes the property at `path` of `object`.
  31464. *
  31465. * **Note:** This method mutates `object`.
  31466. *
  31467. * @static
  31468. * @memberOf _
  31469. * @since 4.0.0
  31470. * @category Object
  31471. * @param {Object} object The object to modify.
  31472. * @param {Array|string} path The path of the property to unset.
  31473. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31474. * @example
  31475. *
  31476. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31477. * _.unset(object, 'a[0].b.c');
  31478. * // => true
  31479. *
  31480. * console.log(object);
  31481. * // => { 'a': [{ 'b': {} }] };
  31482. *
  31483. * _.unset(object, ['a', '0', 'b', 'c']);
  31484. * // => true
  31485. *
  31486. * console.log(object);
  31487. * // => { 'a': [{ 'b': {} }] };
  31488. */
  31489. function unset(object, path) {
  31490. return object == null ? true : baseUnset(object, path);
  31491. }
  31492. /**
  31493. * This method is like `_.set` except that accepts `updater` to produce the
  31494. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31495. * is invoked with one argument: (value).
  31496. *
  31497. * **Note:** This method mutates `object`.
  31498. *
  31499. * @static
  31500. * @memberOf _
  31501. * @since 4.6.0
  31502. * @category Object
  31503. * @param {Object} object The object to modify.
  31504. * @param {Array|string} path The path of the property to set.
  31505. * @param {Function} updater The function to produce the updated value.
  31506. * @returns {Object} Returns `object`.
  31507. * @example
  31508. *
  31509. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31510. *
  31511. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31512. * console.log(object.a[0].b.c);
  31513. * // => 9
  31514. *
  31515. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31516. * console.log(object.x[0].y.z);
  31517. * // => 0
  31518. */
  31519. function update(object, path, updater) {
  31520. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31521. }
  31522. /**
  31523. * This method is like `_.update` except that it accepts `customizer` which is
  31524. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31525. * path creation is handled by the method instead. The `customizer` is invoked
  31526. * with three arguments: (nsValue, key, nsObject).
  31527. *
  31528. * **Note:** This method mutates `object`.
  31529. *
  31530. * @static
  31531. * @memberOf _
  31532. * @since 4.6.0
  31533. * @category Object
  31534. * @param {Object} object The object to modify.
  31535. * @param {Array|string} path The path of the property to set.
  31536. * @param {Function} updater The function to produce the updated value.
  31537. * @param {Function} [customizer] The function to customize assigned values.
  31538. * @returns {Object} Returns `object`.
  31539. * @example
  31540. *
  31541. * var object = {};
  31542. *
  31543. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31544. * // => { '0': { '1': 'a' } }
  31545. */
  31546. function updateWith(object, path, updater, customizer) {
  31547. customizer = typeof customizer == 'function' ? customizer : undefined;
  31548. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31549. }
  31550. /**
  31551. * Creates an array of the own enumerable string keyed property values of `object`.
  31552. *
  31553. * **Note:** Non-object values are coerced to objects.
  31554. *
  31555. * @static
  31556. * @since 0.1.0
  31557. * @memberOf _
  31558. * @category Object
  31559. * @param {Object} object The object to query.
  31560. * @returns {Array} Returns the array of property values.
  31561. * @example
  31562. *
  31563. * function Foo() {
  31564. * this.a = 1;
  31565. * this.b = 2;
  31566. * }
  31567. *
  31568. * Foo.prototype.c = 3;
  31569. *
  31570. * _.values(new Foo);
  31571. * // => [1, 2] (iteration order is not guaranteed)
  31572. *
  31573. * _.values('hi');
  31574. * // => ['h', 'i']
  31575. */
  31576. function values(object) {
  31577. return object == null ? [] : baseValues(object, keys(object));
  31578. }
  31579. /**
  31580. * Creates an array of the own and inherited enumerable string keyed property
  31581. * values of `object`.
  31582. *
  31583. * **Note:** Non-object values are coerced to objects.
  31584. *
  31585. * @static
  31586. * @memberOf _
  31587. * @since 3.0.0
  31588. * @category Object
  31589. * @param {Object} object The object to query.
  31590. * @returns {Array} Returns the array of property values.
  31591. * @example
  31592. *
  31593. * function Foo() {
  31594. * this.a = 1;
  31595. * this.b = 2;
  31596. * }
  31597. *
  31598. * Foo.prototype.c = 3;
  31599. *
  31600. * _.valuesIn(new Foo);
  31601. * // => [1, 2, 3] (iteration order is not guaranteed)
  31602. */
  31603. function valuesIn(object) {
  31604. return object == null ? [] : baseValues(object, keysIn(object));
  31605. }
  31606. /*------------------------------------------------------------------------*/
  31607. /**
  31608. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31609. *
  31610. * @static
  31611. * @memberOf _
  31612. * @since 4.0.0
  31613. * @category Number
  31614. * @param {number} number The number to clamp.
  31615. * @param {number} [lower] The lower bound.
  31616. * @param {number} upper The upper bound.
  31617. * @returns {number} Returns the clamped number.
  31618. * @example
  31619. *
  31620. * _.clamp(-10, -5, 5);
  31621. * // => -5
  31622. *
  31623. * _.clamp(10, -5, 5);
  31624. * // => 5
  31625. */
  31626. function clamp(number, lower, upper) {
  31627. if (upper === undefined) {
  31628. upper = lower;
  31629. lower = undefined;
  31630. }
  31631. if (upper !== undefined) {
  31632. upper = toNumber(upper);
  31633. upper = upper === upper ? upper : 0;
  31634. }
  31635. if (lower !== undefined) {
  31636. lower = toNumber(lower);
  31637. lower = lower === lower ? lower : 0;
  31638. }
  31639. return baseClamp(toNumber(number), lower, upper);
  31640. }
  31641. /**
  31642. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31643. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31644. * If `start` is greater than `end` the params are swapped to support
  31645. * negative ranges.
  31646. *
  31647. * @static
  31648. * @memberOf _
  31649. * @since 3.3.0
  31650. * @category Number
  31651. * @param {number} number The number to check.
  31652. * @param {number} [start=0] The start of the range.
  31653. * @param {number} end The end of the range.
  31654. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31655. * @see _.range, _.rangeRight
  31656. * @example
  31657. *
  31658. * _.inRange(3, 2, 4);
  31659. * // => true
  31660. *
  31661. * _.inRange(4, 8);
  31662. * // => true
  31663. *
  31664. * _.inRange(4, 2);
  31665. * // => false
  31666. *
  31667. * _.inRange(2, 2);
  31668. * // => false
  31669. *
  31670. * _.inRange(1.2, 2);
  31671. * // => true
  31672. *
  31673. * _.inRange(5.2, 4);
  31674. * // => false
  31675. *
  31676. * _.inRange(-3, -2, -6);
  31677. * // => true
  31678. */
  31679. function inRange(number, start, end) {
  31680. start = toFinite(start);
  31681. if (end === undefined) {
  31682. end = start;
  31683. start = 0;
  31684. } else {
  31685. end = toFinite(end);
  31686. }
  31687. number = toNumber(number);
  31688. return baseInRange(number, start, end);
  31689. }
  31690. /**
  31691. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31692. * If only one argument is provided a number between `0` and the given number
  31693. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31694. * floats, a floating-point number is returned instead of an integer.
  31695. *
  31696. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31697. * floating-point values which can produce unexpected results.
  31698. *
  31699. * @static
  31700. * @memberOf _
  31701. * @since 0.7.0
  31702. * @category Number
  31703. * @param {number} [lower=0] The lower bound.
  31704. * @param {number} [upper=1] The upper bound.
  31705. * @param {boolean} [floating] Specify returning a floating-point number.
  31706. * @returns {number} Returns the random number.
  31707. * @example
  31708. *
  31709. * _.random(0, 5);
  31710. * // => an integer between 0 and 5
  31711. *
  31712. * _.random(5);
  31713. * // => also an integer between 0 and 5
  31714. *
  31715. * _.random(5, true);
  31716. * // => a floating-point number between 0 and 5
  31717. *
  31718. * _.random(1.2, 5.2);
  31719. * // => a floating-point number between 1.2 and 5.2
  31720. */
  31721. function random(lower, upper, floating) {
  31722. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31723. upper = floating = undefined;
  31724. }
  31725. if (floating === undefined) {
  31726. if (typeof upper == 'boolean') {
  31727. floating = upper;
  31728. upper = undefined;
  31729. }
  31730. else if (typeof lower == 'boolean') {
  31731. floating = lower;
  31732. lower = undefined;
  31733. }
  31734. }
  31735. if (lower === undefined && upper === undefined) {
  31736. lower = 0;
  31737. upper = 1;
  31738. }
  31739. else {
  31740. lower = toFinite(lower);
  31741. if (upper === undefined) {
  31742. upper = lower;
  31743. lower = 0;
  31744. } else {
  31745. upper = toFinite(upper);
  31746. }
  31747. }
  31748. if (lower > upper) {
  31749. var temp = lower;
  31750. lower = upper;
  31751. upper = temp;
  31752. }
  31753. if (floating || lower % 1 || upper % 1) {
  31754. var rand = nativeRandom();
  31755. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31756. }
  31757. return baseRandom(lower, upper);
  31758. }
  31759. /*------------------------------------------------------------------------*/
  31760. /**
  31761. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31762. *
  31763. * @static
  31764. * @memberOf _
  31765. * @since 3.0.0
  31766. * @category String
  31767. * @param {string} [string=''] The string to convert.
  31768. * @returns {string} Returns the camel cased string.
  31769. * @example
  31770. *
  31771. * _.camelCase('Foo Bar');
  31772. * // => 'fooBar'
  31773. *
  31774. * _.camelCase('--foo-bar--');
  31775. * // => 'fooBar'
  31776. *
  31777. * _.camelCase('__FOO_BAR__');
  31778. * // => 'fooBar'
  31779. */
  31780. var camelCase = createCompounder(function(result, word, index) {
  31781. word = word.toLowerCase();
  31782. return result + (index ? capitalize(word) : word);
  31783. });
  31784. /**
  31785. * Converts the first character of `string` to upper case and the remaining
  31786. * to lower case.
  31787. *
  31788. * @static
  31789. * @memberOf _
  31790. * @since 3.0.0
  31791. * @category String
  31792. * @param {string} [string=''] The string to capitalize.
  31793. * @returns {string} Returns the capitalized string.
  31794. * @example
  31795. *
  31796. * _.capitalize('FRED');
  31797. * // => 'Fred'
  31798. */
  31799. function capitalize(string) {
  31800. return upperFirst(toString(string).toLowerCase());
  31801. }
  31802. /**
  31803. * Deburrs `string` by converting
  31804. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31805. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31806. * letters to basic Latin letters and removing
  31807. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31808. *
  31809. * @static
  31810. * @memberOf _
  31811. * @since 3.0.0
  31812. * @category String
  31813. * @param {string} [string=''] The string to deburr.
  31814. * @returns {string} Returns the deburred string.
  31815. * @example
  31816. *
  31817. * _.deburr('déjà vu');
  31818. * // => 'deja vu'
  31819. */
  31820. function deburr(string) {
  31821. string = toString(string);
  31822. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31823. }
  31824. /**
  31825. * Checks if `string` ends with the given target string.
  31826. *
  31827. * @static
  31828. * @memberOf _
  31829. * @since 3.0.0
  31830. * @category String
  31831. * @param {string} [string=''] The string to inspect.
  31832. * @param {string} [target] The string to search for.
  31833. * @param {number} [position=string.length] The position to search up to.
  31834. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31835. * else `false`.
  31836. * @example
  31837. *
  31838. * _.endsWith('abc', 'c');
  31839. * // => true
  31840. *
  31841. * _.endsWith('abc', 'b');
  31842. * // => false
  31843. *
  31844. * _.endsWith('abc', 'b', 2);
  31845. * // => true
  31846. */
  31847. function endsWith(string, target, position) {
  31848. string = toString(string);
  31849. target = baseToString(target);
  31850. var length = string.length;
  31851. position = position === undefined
  31852. ? length
  31853. : baseClamp(toInteger(position), 0, length);
  31854. var end = position;
  31855. position -= target.length;
  31856. return position >= 0 && string.slice(position, end) == target;
  31857. }
  31858. /**
  31859. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31860. * corresponding HTML entities.
  31861. *
  31862. * **Note:** No other characters are escaped. To escape additional
  31863. * characters use a third-party library like [_he_](https://mths.be/he).
  31864. *
  31865. * Though the ">" character is escaped for symmetry, characters like
  31866. * ">" and "/" don't need escaping in HTML and have no special meaning
  31867. * unless they're part of a tag or unquoted attribute value. See
  31868. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31869. * (under "semi-related fun fact") for more details.
  31870. *
  31871. * When working with HTML you should always
  31872. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31873. * XSS vectors.
  31874. *
  31875. * @static
  31876. * @since 0.1.0
  31877. * @memberOf _
  31878. * @category String
  31879. * @param {string} [string=''] The string to escape.
  31880. * @returns {string} Returns the escaped string.
  31881. * @example
  31882. *
  31883. * _.escape('fred, barney, & pebbles');
  31884. * // => 'fred, barney, &amp; pebbles'
  31885. */
  31886. function escape(string) {
  31887. string = toString(string);
  31888. return (string && reHasUnescapedHtml.test(string))
  31889. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31890. : string;
  31891. }
  31892. /**
  31893. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31894. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31895. *
  31896. * @static
  31897. * @memberOf _
  31898. * @since 3.0.0
  31899. * @category String
  31900. * @param {string} [string=''] The string to escape.
  31901. * @returns {string} Returns the escaped string.
  31902. * @example
  31903. *
  31904. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31905. * // => '\[lodash\]\(https://lodash\.com/\)'
  31906. */
  31907. function escapeRegExp(string) {
  31908. string = toString(string);
  31909. return (string && reHasRegExpChar.test(string))
  31910. ? string.replace(reRegExpChar, '\\$&')
  31911. : string;
  31912. }
  31913. /**
  31914. * Converts `string` to
  31915. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31916. *
  31917. * @static
  31918. * @memberOf _
  31919. * @since 3.0.0
  31920. * @category String
  31921. * @param {string} [string=''] The string to convert.
  31922. * @returns {string} Returns the kebab cased string.
  31923. * @example
  31924. *
  31925. * _.kebabCase('Foo Bar');
  31926. * // => 'foo-bar'
  31927. *
  31928. * _.kebabCase('fooBar');
  31929. * // => 'foo-bar'
  31930. *
  31931. * _.kebabCase('__FOO_BAR__');
  31932. * // => 'foo-bar'
  31933. */
  31934. var kebabCase = createCompounder(function(result, word, index) {
  31935. return result + (index ? '-' : '') + word.toLowerCase();
  31936. });
  31937. /**
  31938. * Converts `string`, as space separated words, to lower case.
  31939. *
  31940. * @static
  31941. * @memberOf _
  31942. * @since 4.0.0
  31943. * @category String
  31944. * @param {string} [string=''] The string to convert.
  31945. * @returns {string} Returns the lower cased string.
  31946. * @example
  31947. *
  31948. * _.lowerCase('--Foo-Bar--');
  31949. * // => 'foo bar'
  31950. *
  31951. * _.lowerCase('fooBar');
  31952. * // => 'foo bar'
  31953. *
  31954. * _.lowerCase('__FOO_BAR__');
  31955. * // => 'foo bar'
  31956. */
  31957. var lowerCase = createCompounder(function(result, word, index) {
  31958. return result + (index ? ' ' : '') + word.toLowerCase();
  31959. });
  31960. /**
  31961. * Converts the first character of `string` to lower case.
  31962. *
  31963. * @static
  31964. * @memberOf _
  31965. * @since 4.0.0
  31966. * @category String
  31967. * @param {string} [string=''] The string to convert.
  31968. * @returns {string} Returns the converted string.
  31969. * @example
  31970. *
  31971. * _.lowerFirst('Fred');
  31972. * // => 'fred'
  31973. *
  31974. * _.lowerFirst('FRED');
  31975. * // => 'fRED'
  31976. */
  31977. var lowerFirst = createCaseFirst('toLowerCase');
  31978. /**
  31979. * Pads `string` on the left and right sides if it's shorter than `length`.
  31980. * Padding characters are truncated if they can't be evenly divided by `length`.
  31981. *
  31982. * @static
  31983. * @memberOf _
  31984. * @since 3.0.0
  31985. * @category String
  31986. * @param {string} [string=''] The string to pad.
  31987. * @param {number} [length=0] The padding length.
  31988. * @param {string} [chars=' '] The string used as padding.
  31989. * @returns {string} Returns the padded string.
  31990. * @example
  31991. *
  31992. * _.pad('abc', 8);
  31993. * // => ' abc '
  31994. *
  31995. * _.pad('abc', 8, '_-');
  31996. * // => '_-abc_-_'
  31997. *
  31998. * _.pad('abc', 3);
  31999. * // => 'abc'
  32000. */
  32001. function pad(string, length, chars) {
  32002. string = toString(string);
  32003. length = toInteger(length);
  32004. var strLength = length ? stringSize(string) : 0;
  32005. if (!length || strLength >= length) {
  32006. return string;
  32007. }
  32008. var mid = (length - strLength) / 2;
  32009. return (
  32010. createPadding(nativeFloor(mid), chars) +
  32011. string +
  32012. createPadding(nativeCeil(mid), chars)
  32013. );
  32014. }
  32015. /**
  32016. * Pads `string` on the right side if it's shorter than `length`. Padding
  32017. * characters are truncated if they exceed `length`.
  32018. *
  32019. * @static
  32020. * @memberOf _
  32021. * @since 4.0.0
  32022. * @category String
  32023. * @param {string} [string=''] The string to pad.
  32024. * @param {number} [length=0] The padding length.
  32025. * @param {string} [chars=' '] The string used as padding.
  32026. * @returns {string} Returns the padded string.
  32027. * @example
  32028. *
  32029. * _.padEnd('abc', 6);
  32030. * // => 'abc '
  32031. *
  32032. * _.padEnd('abc', 6, '_-');
  32033. * // => 'abc_-_'
  32034. *
  32035. * _.padEnd('abc', 3);
  32036. * // => 'abc'
  32037. */
  32038. function padEnd(string, length, chars) {
  32039. string = toString(string);
  32040. length = toInteger(length);
  32041. var strLength = length ? stringSize(string) : 0;
  32042. return (length && strLength < length)
  32043. ? (string + createPadding(length - strLength, chars))
  32044. : string;
  32045. }
  32046. /**
  32047. * Pads `string` on the left side if it's shorter than `length`. Padding
  32048. * characters are truncated if they exceed `length`.
  32049. *
  32050. * @static
  32051. * @memberOf _
  32052. * @since 4.0.0
  32053. * @category String
  32054. * @param {string} [string=''] The string to pad.
  32055. * @param {number} [length=0] The padding length.
  32056. * @param {string} [chars=' '] The string used as padding.
  32057. * @returns {string} Returns the padded string.
  32058. * @example
  32059. *
  32060. * _.padStart('abc', 6);
  32061. * // => ' abc'
  32062. *
  32063. * _.padStart('abc', 6, '_-');
  32064. * // => '_-_abc'
  32065. *
  32066. * _.padStart('abc', 3);
  32067. * // => 'abc'
  32068. */
  32069. function padStart(string, length, chars) {
  32070. string = toString(string);
  32071. length = toInteger(length);
  32072. var strLength = length ? stringSize(string) : 0;
  32073. return (length && strLength < length)
  32074. ? (createPadding(length - strLength, chars) + string)
  32075. : string;
  32076. }
  32077. /**
  32078. * Converts `string` to an integer of the specified radix. If `radix` is
  32079. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32080. * hexadecimal, in which case a `radix` of `16` is used.
  32081. *
  32082. * **Note:** This method aligns with the
  32083. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32084. *
  32085. * @static
  32086. * @memberOf _
  32087. * @since 1.1.0
  32088. * @category String
  32089. * @param {string} string The string to convert.
  32090. * @param {number} [radix=10] The radix to interpret `value` by.
  32091. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32092. * @returns {number} Returns the converted integer.
  32093. * @example
  32094. *
  32095. * _.parseInt('08');
  32096. * // => 8
  32097. *
  32098. * _.map(['6', '08', '10'], _.parseInt);
  32099. * // => [6, 8, 10]
  32100. */
  32101. function parseInt(string, radix, guard) {
  32102. if (guard || radix == null) {
  32103. radix = 0;
  32104. } else if (radix) {
  32105. radix = +radix;
  32106. }
  32107. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32108. }
  32109. /**
  32110. * Repeats the given string `n` times.
  32111. *
  32112. * @static
  32113. * @memberOf _
  32114. * @since 3.0.0
  32115. * @category String
  32116. * @param {string} [string=''] The string to repeat.
  32117. * @param {number} [n=1] The number of times to repeat the string.
  32118. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32119. * @returns {string} Returns the repeated string.
  32120. * @example
  32121. *
  32122. * _.repeat('*', 3);
  32123. * // => '***'
  32124. *
  32125. * _.repeat('abc', 2);
  32126. * // => 'abcabc'
  32127. *
  32128. * _.repeat('abc', 0);
  32129. * // => ''
  32130. */
  32131. function repeat(string, n, guard) {
  32132. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32133. n = 1;
  32134. } else {
  32135. n = toInteger(n);
  32136. }
  32137. return baseRepeat(toString(string), n);
  32138. }
  32139. /**
  32140. * Replaces matches for `pattern` in `string` with `replacement`.
  32141. *
  32142. * **Note:** This method is based on
  32143. * [`String#replace`](https://mdn.io/String/replace).
  32144. *
  32145. * @static
  32146. * @memberOf _
  32147. * @since 4.0.0
  32148. * @category String
  32149. * @param {string} [string=''] The string to modify.
  32150. * @param {RegExp|string} pattern The pattern to replace.
  32151. * @param {Function|string} replacement The match replacement.
  32152. * @returns {string} Returns the modified string.
  32153. * @example
  32154. *
  32155. * _.replace('Hi Fred', 'Fred', 'Barney');
  32156. * // => 'Hi Barney'
  32157. */
  32158. function replace() {
  32159. var args = arguments,
  32160. string = toString(args[0]);
  32161. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32162. }
  32163. /**
  32164. * Converts `string` to
  32165. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32166. *
  32167. * @static
  32168. * @memberOf _
  32169. * @since 3.0.0
  32170. * @category String
  32171. * @param {string} [string=''] The string to convert.
  32172. * @returns {string} Returns the snake cased string.
  32173. * @example
  32174. *
  32175. * _.snakeCase('Foo Bar');
  32176. * // => 'foo_bar'
  32177. *
  32178. * _.snakeCase('fooBar');
  32179. * // => 'foo_bar'
  32180. *
  32181. * _.snakeCase('--FOO-BAR--');
  32182. * // => 'foo_bar'
  32183. */
  32184. var snakeCase = createCompounder(function(result, word, index) {
  32185. return result + (index ? '_' : '') + word.toLowerCase();
  32186. });
  32187. /**
  32188. * Splits `string` by `separator`.
  32189. *
  32190. * **Note:** This method is based on
  32191. * [`String#split`](https://mdn.io/String/split).
  32192. *
  32193. * @static
  32194. * @memberOf _
  32195. * @since 4.0.0
  32196. * @category String
  32197. * @param {string} [string=''] The string to split.
  32198. * @param {RegExp|string} separator The separator pattern to split by.
  32199. * @param {number} [limit] The length to truncate results to.
  32200. * @returns {Array} Returns the string segments.
  32201. * @example
  32202. *
  32203. * _.split('a-b-c', '-', 2);
  32204. * // => ['a', 'b']
  32205. */
  32206. function split(string, separator, limit) {
  32207. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32208. separator = limit = undefined;
  32209. }
  32210. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32211. if (!limit) {
  32212. return [];
  32213. }
  32214. string = toString(string);
  32215. if (string && (
  32216. typeof separator == 'string' ||
  32217. (separator != null && !isRegExp(separator))
  32218. )) {
  32219. separator = baseToString(separator);
  32220. if (!separator && hasUnicode(string)) {
  32221. return castSlice(stringToArray(string), 0, limit);
  32222. }
  32223. }
  32224. return string.split(separator, limit);
  32225. }
  32226. /**
  32227. * Converts `string` to
  32228. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32229. *
  32230. * @static
  32231. * @memberOf _
  32232. * @since 3.1.0
  32233. * @category String
  32234. * @param {string} [string=''] The string to convert.
  32235. * @returns {string} Returns the start cased string.
  32236. * @example
  32237. *
  32238. * _.startCase('--foo-bar--');
  32239. * // => 'Foo Bar'
  32240. *
  32241. * _.startCase('fooBar');
  32242. * // => 'Foo Bar'
  32243. *
  32244. * _.startCase('__FOO_BAR__');
  32245. * // => 'FOO BAR'
  32246. */
  32247. var startCase = createCompounder(function(result, word, index) {
  32248. return result + (index ? ' ' : '') + upperFirst(word);
  32249. });
  32250. /**
  32251. * Checks if `string` starts with the given target string.
  32252. *
  32253. * @static
  32254. * @memberOf _
  32255. * @since 3.0.0
  32256. * @category String
  32257. * @param {string} [string=''] The string to inspect.
  32258. * @param {string} [target] The string to search for.
  32259. * @param {number} [position=0] The position to search from.
  32260. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32261. * else `false`.
  32262. * @example
  32263. *
  32264. * _.startsWith('abc', 'a');
  32265. * // => true
  32266. *
  32267. * _.startsWith('abc', 'b');
  32268. * // => false
  32269. *
  32270. * _.startsWith('abc', 'b', 1);
  32271. * // => true
  32272. */
  32273. function startsWith(string, target, position) {
  32274. string = toString(string);
  32275. position = position == null
  32276. ? 0
  32277. : baseClamp(toInteger(position), 0, string.length);
  32278. target = baseToString(target);
  32279. return string.slice(position, position + target.length) == target;
  32280. }
  32281. /**
  32282. * Creates a compiled template function that can interpolate data properties
  32283. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32284. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32285. * properties may be accessed as free variables in the template. If a setting
  32286. * object is given, it takes precedence over `_.templateSettings` values.
  32287. *
  32288. * **Note:** In the development build `_.template` utilizes
  32289. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32290. * for easier debugging.
  32291. *
  32292. * For more information on precompiling templates see
  32293. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32294. *
  32295. * For more information on Chrome extension sandboxes see
  32296. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32297. *
  32298. * @static
  32299. * @since 0.1.0
  32300. * @memberOf _
  32301. * @category String
  32302. * @param {string} [string=''] The template string.
  32303. * @param {Object} [options={}] The options object.
  32304. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32305. * The HTML "escape" delimiter.
  32306. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32307. * The "evaluate" delimiter.
  32308. * @param {Object} [options.imports=_.templateSettings.imports]
  32309. * An object to import into the template as free variables.
  32310. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32311. * The "interpolate" delimiter.
  32312. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32313. * The sourceURL of the compiled template.
  32314. * @param {string} [options.variable='obj']
  32315. * The data object variable name.
  32316. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32317. * @returns {Function} Returns the compiled template function.
  32318. * @example
  32319. *
  32320. * // Use the "interpolate" delimiter to create a compiled template.
  32321. * var compiled = _.template('hello <%= user %>!');
  32322. * compiled({ 'user': 'fred' });
  32323. * // => 'hello fred!'
  32324. *
  32325. * // Use the HTML "escape" delimiter to escape data property values.
  32326. * var compiled = _.template('<b><%- value %></b>');
  32327. * compiled({ 'value': '<script>' });
  32328. * // => '<b>&lt;script&gt;</b>'
  32329. *
  32330. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32331. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32332. * compiled({ 'users': ['fred', 'barney'] });
  32333. * // => '<li>fred</li><li>barney</li>'
  32334. *
  32335. * // Use the internal `print` function in "evaluate" delimiters.
  32336. * var compiled = _.template('<% print("hello " + user); %>!');
  32337. * compiled({ 'user': 'barney' });
  32338. * // => 'hello barney!'
  32339. *
  32340. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32341. * // Disable support by replacing the "interpolate" delimiter.
  32342. * var compiled = _.template('hello ${ user }!');
  32343. * compiled({ 'user': 'pebbles' });
  32344. * // => 'hello pebbles!'
  32345. *
  32346. * // Use backslashes to treat delimiters as plain text.
  32347. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32348. * compiled({ 'value': 'ignored' });
  32349. * // => '<%- value %>'
  32350. *
  32351. * // Use the `imports` option to import `jQuery` as `jq`.
  32352. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32353. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32354. * compiled({ 'users': ['fred', 'barney'] });
  32355. * // => '<li>fred</li><li>barney</li>'
  32356. *
  32357. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32358. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32359. * compiled(data);
  32360. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32361. *
  32362. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32363. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32364. * compiled.source;
  32365. * // => function(data) {
  32366. * // var __t, __p = '';
  32367. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32368. * // return __p;
  32369. * // }
  32370. *
  32371. * // Use custom template delimiters.
  32372. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32373. * var compiled = _.template('hello {{ user }}!');
  32374. * compiled({ 'user': 'mustache' });
  32375. * // => 'hello mustache!'
  32376. *
  32377. * // Use the `source` property to inline compiled templates for meaningful
  32378. * // line numbers in error messages and stack traces.
  32379. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32380. * var JST = {\
  32381. * "main": ' + _.template(mainText).source + '\
  32382. * };\
  32383. * ');
  32384. */
  32385. function template(string, options, guard) {
  32386. // Based on John Resig's `tmpl` implementation
  32387. // (http://ejohn.org/blog/javascript-micro-templating/)
  32388. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32389. var settings = lodash.templateSettings;
  32390. if (guard && isIterateeCall(string, options, guard)) {
  32391. options = undefined;
  32392. }
  32393. string = toString(string);
  32394. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32395. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32396. importsKeys = keys(imports),
  32397. importsValues = baseValues(imports, importsKeys);
  32398. var isEscaping,
  32399. isEvaluating,
  32400. index = 0,
  32401. interpolate = options.interpolate || reNoMatch,
  32402. source = "__p += '";
  32403. // Compile the regexp to match each delimiter.
  32404. var reDelimiters = RegExp(
  32405. (options.escape || reNoMatch).source + '|' +
  32406. interpolate.source + '|' +
  32407. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32408. (options.evaluate || reNoMatch).source + '|$'
  32409. , 'g');
  32410. // Use a sourceURL for easier debugging.
  32411. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32412. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32413. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32414. var sourceURL = '//# sourceURL=' +
  32415. (hasOwnProperty.call(options, 'sourceURL')
  32416. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32417. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32418. ) + '\n';
  32419. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32420. interpolateValue || (interpolateValue = esTemplateValue);
  32421. // Escape characters that can't be included in string literals.
  32422. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32423. // Replace delimiters with snippets.
  32424. if (escapeValue) {
  32425. isEscaping = true;
  32426. source += "' +\n__e(" + escapeValue + ") +\n'";
  32427. }
  32428. if (evaluateValue) {
  32429. isEvaluating = true;
  32430. source += "';\n" + evaluateValue + ";\n__p += '";
  32431. }
  32432. if (interpolateValue) {
  32433. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32434. }
  32435. index = offset + match.length;
  32436. // The JS engine embedded in Adobe products needs `match` returned in
  32437. // order to produce the correct `offset` value.
  32438. return match;
  32439. });
  32440. source += "';\n";
  32441. // If `variable` is not specified wrap a with-statement around the generated
  32442. // code to add the data object to the top of the scope chain.
  32443. // Like with sourceURL, we take care to not check the option's prototype,
  32444. // as this configuration is a code injection vector.
  32445. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32446. if (!variable) {
  32447. source = 'with (obj) {\n' + source + '\n}\n';
  32448. }
  32449. // Cleanup code by stripping empty strings.
  32450. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32451. .replace(reEmptyStringMiddle, '$1')
  32452. .replace(reEmptyStringTrailing, '$1;');
  32453. // Frame code as the function body.
  32454. source = 'function(' + (variable || 'obj') + ') {\n' +
  32455. (variable
  32456. ? ''
  32457. : 'obj || (obj = {});\n'
  32458. ) +
  32459. "var __t, __p = ''" +
  32460. (isEscaping
  32461. ? ', __e = _.escape'
  32462. : ''
  32463. ) +
  32464. (isEvaluating
  32465. ? ', __j = Array.prototype.join;\n' +
  32466. "function print() { __p += __j.call(arguments, '') }\n"
  32467. : ';\n'
  32468. ) +
  32469. source +
  32470. 'return __p\n}';
  32471. var result = attempt(function() {
  32472. return Function(importsKeys, sourceURL + 'return ' + source)
  32473. .apply(undefined, importsValues);
  32474. });
  32475. // Provide the compiled function's source by its `toString` method or
  32476. // the `source` property as a convenience for inlining compiled templates.
  32477. result.source = source;
  32478. if (isError(result)) {
  32479. throw result;
  32480. }
  32481. return result;
  32482. }
  32483. /**
  32484. * Converts `string`, as a whole, to lower case just like
  32485. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32486. *
  32487. * @static
  32488. * @memberOf _
  32489. * @since 4.0.0
  32490. * @category String
  32491. * @param {string} [string=''] The string to convert.
  32492. * @returns {string} Returns the lower cased string.
  32493. * @example
  32494. *
  32495. * _.toLower('--Foo-Bar--');
  32496. * // => '--foo-bar--'
  32497. *
  32498. * _.toLower('fooBar');
  32499. * // => 'foobar'
  32500. *
  32501. * _.toLower('__FOO_BAR__');
  32502. * // => '__foo_bar__'
  32503. */
  32504. function toLower(value) {
  32505. return toString(value).toLowerCase();
  32506. }
  32507. /**
  32508. * Converts `string`, as a whole, to upper case just like
  32509. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32510. *
  32511. * @static
  32512. * @memberOf _
  32513. * @since 4.0.0
  32514. * @category String
  32515. * @param {string} [string=''] The string to convert.
  32516. * @returns {string} Returns the upper cased string.
  32517. * @example
  32518. *
  32519. * _.toUpper('--foo-bar--');
  32520. * // => '--FOO-BAR--'
  32521. *
  32522. * _.toUpper('fooBar');
  32523. * // => 'FOOBAR'
  32524. *
  32525. * _.toUpper('__foo_bar__');
  32526. * // => '__FOO_BAR__'
  32527. */
  32528. function toUpper(value) {
  32529. return toString(value).toUpperCase();
  32530. }
  32531. /**
  32532. * Removes leading and trailing whitespace or specified characters from `string`.
  32533. *
  32534. * @static
  32535. * @memberOf _
  32536. * @since 3.0.0
  32537. * @category String
  32538. * @param {string} [string=''] The string to trim.
  32539. * @param {string} [chars=whitespace] The characters to trim.
  32540. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32541. * @returns {string} Returns the trimmed string.
  32542. * @example
  32543. *
  32544. * _.trim(' abc ');
  32545. * // => 'abc'
  32546. *
  32547. * _.trim('-_-abc-_-', '_-');
  32548. * // => 'abc'
  32549. *
  32550. * _.map([' foo ', ' bar '], _.trim);
  32551. * // => ['foo', 'bar']
  32552. */
  32553. function trim(string, chars, guard) {
  32554. string = toString(string);
  32555. if (string && (guard || chars === undefined)) {
  32556. return string.replace(reTrim, '');
  32557. }
  32558. if (!string || !(chars = baseToString(chars))) {
  32559. return string;
  32560. }
  32561. var strSymbols = stringToArray(string),
  32562. chrSymbols = stringToArray(chars),
  32563. start = charsStartIndex(strSymbols, chrSymbols),
  32564. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32565. return castSlice(strSymbols, start, end).join('');
  32566. }
  32567. /**
  32568. * Removes trailing whitespace or specified characters from `string`.
  32569. *
  32570. * @static
  32571. * @memberOf _
  32572. * @since 4.0.0
  32573. * @category String
  32574. * @param {string} [string=''] The string to trim.
  32575. * @param {string} [chars=whitespace] The characters to trim.
  32576. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32577. * @returns {string} Returns the trimmed string.
  32578. * @example
  32579. *
  32580. * _.trimEnd(' abc ');
  32581. * // => ' abc'
  32582. *
  32583. * _.trimEnd('-_-abc-_-', '_-');
  32584. * // => '-_-abc'
  32585. */
  32586. function trimEnd(string, chars, guard) {
  32587. string = toString(string);
  32588. if (string && (guard || chars === undefined)) {
  32589. return string.replace(reTrimEnd, '');
  32590. }
  32591. if (!string || !(chars = baseToString(chars))) {
  32592. return string;
  32593. }
  32594. var strSymbols = stringToArray(string),
  32595. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32596. return castSlice(strSymbols, 0, end).join('');
  32597. }
  32598. /**
  32599. * Removes leading whitespace or specified characters from `string`.
  32600. *
  32601. * @static
  32602. * @memberOf _
  32603. * @since 4.0.0
  32604. * @category String
  32605. * @param {string} [string=''] The string to trim.
  32606. * @param {string} [chars=whitespace] The characters to trim.
  32607. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32608. * @returns {string} Returns the trimmed string.
  32609. * @example
  32610. *
  32611. * _.trimStart(' abc ');
  32612. * // => 'abc '
  32613. *
  32614. * _.trimStart('-_-abc-_-', '_-');
  32615. * // => 'abc-_-'
  32616. */
  32617. function trimStart(string, chars, guard) {
  32618. string = toString(string);
  32619. if (string && (guard || chars === undefined)) {
  32620. return string.replace(reTrimStart, '');
  32621. }
  32622. if (!string || !(chars = baseToString(chars))) {
  32623. return string;
  32624. }
  32625. var strSymbols = stringToArray(string),
  32626. start = charsStartIndex(strSymbols, stringToArray(chars));
  32627. return castSlice(strSymbols, start).join('');
  32628. }
  32629. /**
  32630. * Truncates `string` if it's longer than the given maximum string length.
  32631. * The last characters of the truncated string are replaced with the omission
  32632. * string which defaults to "...".
  32633. *
  32634. * @static
  32635. * @memberOf _
  32636. * @since 4.0.0
  32637. * @category String
  32638. * @param {string} [string=''] The string to truncate.
  32639. * @param {Object} [options={}] The options object.
  32640. * @param {number} [options.length=30] The maximum string length.
  32641. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32642. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32643. * @returns {string} Returns the truncated string.
  32644. * @example
  32645. *
  32646. * _.truncate('hi-diddly-ho there, neighborino');
  32647. * // => 'hi-diddly-ho there, neighbo...'
  32648. *
  32649. * _.truncate('hi-diddly-ho there, neighborino', {
  32650. * 'length': 24,
  32651. * 'separator': ' '
  32652. * });
  32653. * // => 'hi-diddly-ho there,...'
  32654. *
  32655. * _.truncate('hi-diddly-ho there, neighborino', {
  32656. * 'length': 24,
  32657. * 'separator': /,? +/
  32658. * });
  32659. * // => 'hi-diddly-ho there...'
  32660. *
  32661. * _.truncate('hi-diddly-ho there, neighborino', {
  32662. * 'omission': ' [...]'
  32663. * });
  32664. * // => 'hi-diddly-ho there, neig [...]'
  32665. */
  32666. function truncate(string, options) {
  32667. var length = DEFAULT_TRUNC_LENGTH,
  32668. omission = DEFAULT_TRUNC_OMISSION;
  32669. if (isObject(options)) {
  32670. var separator = 'separator' in options ? options.separator : separator;
  32671. length = 'length' in options ? toInteger(options.length) : length;
  32672. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32673. }
  32674. string = toString(string);
  32675. var strLength = string.length;
  32676. if (hasUnicode(string)) {
  32677. var strSymbols = stringToArray(string);
  32678. strLength = strSymbols.length;
  32679. }
  32680. if (length >= strLength) {
  32681. return string;
  32682. }
  32683. var end = length - stringSize(omission);
  32684. if (end < 1) {
  32685. return omission;
  32686. }
  32687. var result = strSymbols
  32688. ? castSlice(strSymbols, 0, end).join('')
  32689. : string.slice(0, end);
  32690. if (separator === undefined) {
  32691. return result + omission;
  32692. }
  32693. if (strSymbols) {
  32694. end += (result.length - end);
  32695. }
  32696. if (isRegExp(separator)) {
  32697. if (string.slice(end).search(separator)) {
  32698. var match,
  32699. substring = result;
  32700. if (!separator.global) {
  32701. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32702. }
  32703. separator.lastIndex = 0;
  32704. while ((match = separator.exec(substring))) {
  32705. var newEnd = match.index;
  32706. }
  32707. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32708. }
  32709. } else if (string.indexOf(baseToString(separator), end) != end) {
  32710. var index = result.lastIndexOf(separator);
  32711. if (index > -1) {
  32712. result = result.slice(0, index);
  32713. }
  32714. }
  32715. return result + omission;
  32716. }
  32717. /**
  32718. * The inverse of `_.escape`; this method converts the HTML entities
  32719. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32720. * their corresponding characters.
  32721. *
  32722. * **Note:** No other HTML entities are unescaped. To unescape additional
  32723. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32724. *
  32725. * @static
  32726. * @memberOf _
  32727. * @since 0.6.0
  32728. * @category String
  32729. * @param {string} [string=''] The string to unescape.
  32730. * @returns {string} Returns the unescaped string.
  32731. * @example
  32732. *
  32733. * _.unescape('fred, barney, &amp; pebbles');
  32734. * // => 'fred, barney, & pebbles'
  32735. */
  32736. function unescape(string) {
  32737. string = toString(string);
  32738. return (string && reHasEscapedHtml.test(string))
  32739. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32740. : string;
  32741. }
  32742. /**
  32743. * Converts `string`, as space separated words, to upper case.
  32744. *
  32745. * @static
  32746. * @memberOf _
  32747. * @since 4.0.0
  32748. * @category String
  32749. * @param {string} [string=''] The string to convert.
  32750. * @returns {string} Returns the upper cased string.
  32751. * @example
  32752. *
  32753. * _.upperCase('--foo-bar');
  32754. * // => 'FOO BAR'
  32755. *
  32756. * _.upperCase('fooBar');
  32757. * // => 'FOO BAR'
  32758. *
  32759. * _.upperCase('__foo_bar__');
  32760. * // => 'FOO BAR'
  32761. */
  32762. var upperCase = createCompounder(function(result, word, index) {
  32763. return result + (index ? ' ' : '') + word.toUpperCase();
  32764. });
  32765. /**
  32766. * Converts the first character of `string` to upper case.
  32767. *
  32768. * @static
  32769. * @memberOf _
  32770. * @since 4.0.0
  32771. * @category String
  32772. * @param {string} [string=''] The string to convert.
  32773. * @returns {string} Returns the converted string.
  32774. * @example
  32775. *
  32776. * _.upperFirst('fred');
  32777. * // => 'Fred'
  32778. *
  32779. * _.upperFirst('FRED');
  32780. * // => 'FRED'
  32781. */
  32782. var upperFirst = createCaseFirst('toUpperCase');
  32783. /**
  32784. * Splits `string` into an array of its words.
  32785. *
  32786. * @static
  32787. * @memberOf _
  32788. * @since 3.0.0
  32789. * @category String
  32790. * @param {string} [string=''] The string to inspect.
  32791. * @param {RegExp|string} [pattern] The pattern to match words.
  32792. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32793. * @returns {Array} Returns the words of `string`.
  32794. * @example
  32795. *
  32796. * _.words('fred, barney, & pebbles');
  32797. * // => ['fred', 'barney', 'pebbles']
  32798. *
  32799. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32800. * // => ['fred', 'barney', '&', 'pebbles']
  32801. */
  32802. function words(string, pattern, guard) {
  32803. string = toString(string);
  32804. pattern = guard ? undefined : pattern;
  32805. if (pattern === undefined) {
  32806. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32807. }
  32808. return string.match(pattern) || [];
  32809. }
  32810. /*------------------------------------------------------------------------*/
  32811. /**
  32812. * Attempts to invoke `func`, returning either the result or the caught error
  32813. * object. Any additional arguments are provided to `func` when it's invoked.
  32814. *
  32815. * @static
  32816. * @memberOf _
  32817. * @since 3.0.0
  32818. * @category Util
  32819. * @param {Function} func The function to attempt.
  32820. * @param {...*} [args] The arguments to invoke `func` with.
  32821. * @returns {*} Returns the `func` result or error object.
  32822. * @example
  32823. *
  32824. * // Avoid throwing errors for invalid selectors.
  32825. * var elements = _.attempt(function(selector) {
  32826. * return document.querySelectorAll(selector);
  32827. * }, '>_>');
  32828. *
  32829. * if (_.isError(elements)) {
  32830. * elements = [];
  32831. * }
  32832. */
  32833. var attempt = baseRest(function(func, args) {
  32834. try {
  32835. return apply(func, undefined, args);
  32836. } catch (e) {
  32837. return isError(e) ? e : new Error(e);
  32838. }
  32839. });
  32840. /**
  32841. * Binds methods of an object to the object itself, overwriting the existing
  32842. * method.
  32843. *
  32844. * **Note:** This method doesn't set the "length" property of bound functions.
  32845. *
  32846. * @static
  32847. * @since 0.1.0
  32848. * @memberOf _
  32849. * @category Util
  32850. * @param {Object} object The object to bind and assign the bound methods to.
  32851. * @param {...(string|string[])} methodNames The object method names to bind.
  32852. * @returns {Object} Returns `object`.
  32853. * @example
  32854. *
  32855. * var view = {
  32856. * 'label': 'docs',
  32857. * 'click': function() {
  32858. * console.log('clicked ' + this.label);
  32859. * }
  32860. * };
  32861. *
  32862. * _.bindAll(view, ['click']);
  32863. * jQuery(element).on('click', view.click);
  32864. * // => Logs 'clicked docs' when clicked.
  32865. */
  32866. var bindAll = flatRest(function(object, methodNames) {
  32867. arrayEach(methodNames, function(key) {
  32868. key = toKey(key);
  32869. baseAssignValue(object, key, bind(object[key], object));
  32870. });
  32871. return object;
  32872. });
  32873. /**
  32874. * Creates a function that iterates over `pairs` and invokes the corresponding
  32875. * function of the first predicate to return truthy. The predicate-function
  32876. * pairs are invoked with the `this` binding and arguments of the created
  32877. * function.
  32878. *
  32879. * @static
  32880. * @memberOf _
  32881. * @since 4.0.0
  32882. * @category Util
  32883. * @param {Array} pairs The predicate-function pairs.
  32884. * @returns {Function} Returns the new composite function.
  32885. * @example
  32886. *
  32887. * var func = _.cond([
  32888. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32889. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32890. * [_.stubTrue, _.constant('no match')]
  32891. * ]);
  32892. *
  32893. * func({ 'a': 1, 'b': 2 });
  32894. * // => 'matches A'
  32895. *
  32896. * func({ 'a': 0, 'b': 1 });
  32897. * // => 'matches B'
  32898. *
  32899. * func({ 'a': '1', 'b': '2' });
  32900. * // => 'no match'
  32901. */
  32902. function cond(pairs) {
  32903. var length = pairs == null ? 0 : pairs.length,
  32904. toIteratee = getIteratee();
  32905. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32906. if (typeof pair[1] != 'function') {
  32907. throw new TypeError(FUNC_ERROR_TEXT);
  32908. }
  32909. return [toIteratee(pair[0]), pair[1]];
  32910. });
  32911. return baseRest(function(args) {
  32912. var index = -1;
  32913. while (++index < length) {
  32914. var pair = pairs[index];
  32915. if (apply(pair[0], this, args)) {
  32916. return apply(pair[1], this, args);
  32917. }
  32918. }
  32919. });
  32920. }
  32921. /**
  32922. * Creates a function that invokes the predicate properties of `source` with
  32923. * the corresponding property values of a given object, returning `true` if
  32924. * all predicates return truthy, else `false`.
  32925. *
  32926. * **Note:** The created function is equivalent to `_.conformsTo` with
  32927. * `source` partially applied.
  32928. *
  32929. * @static
  32930. * @memberOf _
  32931. * @since 4.0.0
  32932. * @category Util
  32933. * @param {Object} source The object of property predicates to conform to.
  32934. * @returns {Function} Returns the new spec function.
  32935. * @example
  32936. *
  32937. * var objects = [
  32938. * { 'a': 2, 'b': 1 },
  32939. * { 'a': 1, 'b': 2 }
  32940. * ];
  32941. *
  32942. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32943. * // => [{ 'a': 1, 'b': 2 }]
  32944. */
  32945. function conforms(source) {
  32946. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32947. }
  32948. /**
  32949. * Creates a function that returns `value`.
  32950. *
  32951. * @static
  32952. * @memberOf _
  32953. * @since 2.4.0
  32954. * @category Util
  32955. * @param {*} value The value to return from the new function.
  32956. * @returns {Function} Returns the new constant function.
  32957. * @example
  32958. *
  32959. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32960. *
  32961. * console.log(objects);
  32962. * // => [{ 'a': 1 }, { 'a': 1 }]
  32963. *
  32964. * console.log(objects[0] === objects[1]);
  32965. * // => true
  32966. */
  32967. function constant(value) {
  32968. return function() {
  32969. return value;
  32970. };
  32971. }
  32972. /**
  32973. * Checks `value` to determine whether a default value should be returned in
  32974. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32975. * or `undefined`.
  32976. *
  32977. * @static
  32978. * @memberOf _
  32979. * @since 4.14.0
  32980. * @category Util
  32981. * @param {*} value The value to check.
  32982. * @param {*} defaultValue The default value.
  32983. * @returns {*} Returns the resolved value.
  32984. * @example
  32985. *
  32986. * _.defaultTo(1, 10);
  32987. * // => 1
  32988. *
  32989. * _.defaultTo(undefined, 10);
  32990. * // => 10
  32991. */
  32992. function defaultTo(value, defaultValue) {
  32993. return (value == null || value !== value) ? defaultValue : value;
  32994. }
  32995. /**
  32996. * Creates a function that returns the result of invoking the given functions
  32997. * with the `this` binding of the created function, where each successive
  32998. * invocation is supplied the return value of the previous.
  32999. *
  33000. * @static
  33001. * @memberOf _
  33002. * @since 3.0.0
  33003. * @category Util
  33004. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33005. * @returns {Function} Returns the new composite function.
  33006. * @see _.flowRight
  33007. * @example
  33008. *
  33009. * function square(n) {
  33010. * return n * n;
  33011. * }
  33012. *
  33013. * var addSquare = _.flow([_.add, square]);
  33014. * addSquare(1, 2);
  33015. * // => 9
  33016. */
  33017. var flow = createFlow();
  33018. /**
  33019. * This method is like `_.flow` except that it creates a function that
  33020. * invokes the given functions from right to left.
  33021. *
  33022. * @static
  33023. * @since 3.0.0
  33024. * @memberOf _
  33025. * @category Util
  33026. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33027. * @returns {Function} Returns the new composite function.
  33028. * @see _.flow
  33029. * @example
  33030. *
  33031. * function square(n) {
  33032. * return n * n;
  33033. * }
  33034. *
  33035. * var addSquare = _.flowRight([square, _.add]);
  33036. * addSquare(1, 2);
  33037. * // => 9
  33038. */
  33039. var flowRight = createFlow(true);
  33040. /**
  33041. * This method returns the first argument it receives.
  33042. *
  33043. * @static
  33044. * @since 0.1.0
  33045. * @memberOf _
  33046. * @category Util
  33047. * @param {*} value Any value.
  33048. * @returns {*} Returns `value`.
  33049. * @example
  33050. *
  33051. * var object = { 'a': 1 };
  33052. *
  33053. * console.log(_.identity(object) === object);
  33054. * // => true
  33055. */
  33056. function identity(value) {
  33057. return value;
  33058. }
  33059. /**
  33060. * Creates a function that invokes `func` with the arguments of the created
  33061. * function. If `func` is a property name, the created function returns the
  33062. * property value for a given element. If `func` is an array or object, the
  33063. * created function returns `true` for elements that contain the equivalent
  33064. * source properties, otherwise it returns `false`.
  33065. *
  33066. * @static
  33067. * @since 4.0.0
  33068. * @memberOf _
  33069. * @category Util
  33070. * @param {*} [func=_.identity] The value to convert to a callback.
  33071. * @returns {Function} Returns the callback.
  33072. * @example
  33073. *
  33074. * var users = [
  33075. * { 'user': 'barney', 'age': 36, 'active': true },
  33076. * { 'user': 'fred', 'age': 40, 'active': false }
  33077. * ];
  33078. *
  33079. * // The `_.matches` iteratee shorthand.
  33080. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33081. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33082. *
  33083. * // The `_.matchesProperty` iteratee shorthand.
  33084. * _.filter(users, _.iteratee(['user', 'fred']));
  33085. * // => [{ 'user': 'fred', 'age': 40 }]
  33086. *
  33087. * // The `_.property` iteratee shorthand.
  33088. * _.map(users, _.iteratee('user'));
  33089. * // => ['barney', 'fred']
  33090. *
  33091. * // Create custom iteratee shorthands.
  33092. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33093. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33094. * return func.test(string);
  33095. * };
  33096. * });
  33097. *
  33098. * _.filter(['abc', 'def'], /ef/);
  33099. * // => ['def']
  33100. */
  33101. function iteratee(func) {
  33102. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33103. }
  33104. /**
  33105. * Creates a function that performs a partial deep comparison between a given
  33106. * object and `source`, returning `true` if the given object has equivalent
  33107. * property values, else `false`.
  33108. *
  33109. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33110. * partially applied.
  33111. *
  33112. * Partial comparisons will match empty array and empty object `source`
  33113. * values against any array or object value, respectively. See `_.isEqual`
  33114. * for a list of supported value comparisons.
  33115. *
  33116. * @static
  33117. * @memberOf _
  33118. * @since 3.0.0
  33119. * @category Util
  33120. * @param {Object} source The object of property values to match.
  33121. * @returns {Function} Returns the new spec function.
  33122. * @example
  33123. *
  33124. * var objects = [
  33125. * { 'a': 1, 'b': 2, 'c': 3 },
  33126. * { 'a': 4, 'b': 5, 'c': 6 }
  33127. * ];
  33128. *
  33129. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33130. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33131. */
  33132. function matches(source) {
  33133. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33134. }
  33135. /**
  33136. * Creates a function that performs a partial deep comparison between the
  33137. * value at `path` of a given object to `srcValue`, returning `true` if the
  33138. * object value is equivalent, else `false`.
  33139. *
  33140. * **Note:** Partial comparisons will match empty array and empty object
  33141. * `srcValue` values against any array or object value, respectively. See
  33142. * `_.isEqual` for a list of supported value comparisons.
  33143. *
  33144. * @static
  33145. * @memberOf _
  33146. * @since 3.2.0
  33147. * @category Util
  33148. * @param {Array|string} path The path of the property to get.
  33149. * @param {*} srcValue The value to match.
  33150. * @returns {Function} Returns the new spec function.
  33151. * @example
  33152. *
  33153. * var objects = [
  33154. * { 'a': 1, 'b': 2, 'c': 3 },
  33155. * { 'a': 4, 'b': 5, 'c': 6 }
  33156. * ];
  33157. *
  33158. * _.find(objects, _.matchesProperty('a', 4));
  33159. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33160. */
  33161. function matchesProperty(path, srcValue) {
  33162. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33163. }
  33164. /**
  33165. * Creates a function that invokes the method at `path` of a given object.
  33166. * Any additional arguments are provided to the invoked method.
  33167. *
  33168. * @static
  33169. * @memberOf _
  33170. * @since 3.7.0
  33171. * @category Util
  33172. * @param {Array|string} path The path of the method to invoke.
  33173. * @param {...*} [args] The arguments to invoke the method with.
  33174. * @returns {Function} Returns the new invoker function.
  33175. * @example
  33176. *
  33177. * var objects = [
  33178. * { 'a': { 'b': _.constant(2) } },
  33179. * { 'a': { 'b': _.constant(1) } }
  33180. * ];
  33181. *
  33182. * _.map(objects, _.method('a.b'));
  33183. * // => [2, 1]
  33184. *
  33185. * _.map(objects, _.method(['a', 'b']));
  33186. * // => [2, 1]
  33187. */
  33188. var method = baseRest(function(path, args) {
  33189. return function(object) {
  33190. return baseInvoke(object, path, args);
  33191. };
  33192. });
  33193. /**
  33194. * The opposite of `_.method`; this method creates a function that invokes
  33195. * the method at a given path of `object`. Any additional arguments are
  33196. * provided to the invoked method.
  33197. *
  33198. * @static
  33199. * @memberOf _
  33200. * @since 3.7.0
  33201. * @category Util
  33202. * @param {Object} object The object to query.
  33203. * @param {...*} [args] The arguments to invoke the method with.
  33204. * @returns {Function} Returns the new invoker function.
  33205. * @example
  33206. *
  33207. * var array = _.times(3, _.constant),
  33208. * object = { 'a': array, 'b': array, 'c': array };
  33209. *
  33210. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33211. * // => [2, 0]
  33212. *
  33213. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33214. * // => [2, 0]
  33215. */
  33216. var methodOf = baseRest(function(object, args) {
  33217. return function(path) {
  33218. return baseInvoke(object, path, args);
  33219. };
  33220. });
  33221. /**
  33222. * Adds all own enumerable string keyed function properties of a source
  33223. * object to the destination object. If `object` is a function, then methods
  33224. * are added to its prototype as well.
  33225. *
  33226. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33227. * avoid conflicts caused by modifying the original.
  33228. *
  33229. * @static
  33230. * @since 0.1.0
  33231. * @memberOf _
  33232. * @category Util
  33233. * @param {Function|Object} [object=lodash] The destination object.
  33234. * @param {Object} source The object of functions to add.
  33235. * @param {Object} [options={}] The options object.
  33236. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33237. * @returns {Function|Object} Returns `object`.
  33238. * @example
  33239. *
  33240. * function vowels(string) {
  33241. * return _.filter(string, function(v) {
  33242. * return /[aeiou]/i.test(v);
  33243. * });
  33244. * }
  33245. *
  33246. * _.mixin({ 'vowels': vowels });
  33247. * _.vowels('fred');
  33248. * // => ['e']
  33249. *
  33250. * _('fred').vowels().value();
  33251. * // => ['e']
  33252. *
  33253. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33254. * _('fred').vowels();
  33255. * // => ['e']
  33256. */
  33257. function mixin(object, source, options) {
  33258. var props = keys(source),
  33259. methodNames = baseFunctions(source, props);
  33260. if (options == null &&
  33261. !(isObject(source) && (methodNames.length || !props.length))) {
  33262. options = source;
  33263. source = object;
  33264. object = this;
  33265. methodNames = baseFunctions(source, keys(source));
  33266. }
  33267. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33268. isFunc = isFunction(object);
  33269. arrayEach(methodNames, function(methodName) {
  33270. var func = source[methodName];
  33271. object[methodName] = func;
  33272. if (isFunc) {
  33273. object.prototype[methodName] = function() {
  33274. var chainAll = this.__chain__;
  33275. if (chain || chainAll) {
  33276. var result = object(this.__wrapped__),
  33277. actions = result.__actions__ = copyArray(this.__actions__);
  33278. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33279. result.__chain__ = chainAll;
  33280. return result;
  33281. }
  33282. return func.apply(object, arrayPush([this.value()], arguments));
  33283. };
  33284. }
  33285. });
  33286. return object;
  33287. }
  33288. /**
  33289. * Reverts the `_` variable to its previous value and returns a reference to
  33290. * the `lodash` function.
  33291. *
  33292. * @static
  33293. * @since 0.1.0
  33294. * @memberOf _
  33295. * @category Util
  33296. * @returns {Function} Returns the `lodash` function.
  33297. * @example
  33298. *
  33299. * var lodash = _.noConflict();
  33300. */
  33301. function noConflict() {
  33302. if (root._ === this) {
  33303. root._ = oldDash;
  33304. }
  33305. return this;
  33306. }
  33307. /**
  33308. * This method returns `undefined`.
  33309. *
  33310. * @static
  33311. * @memberOf _
  33312. * @since 2.3.0
  33313. * @category Util
  33314. * @example
  33315. *
  33316. * _.times(2, _.noop);
  33317. * // => [undefined, undefined]
  33318. */
  33319. function noop() {
  33320. // No operation performed.
  33321. }
  33322. /**
  33323. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33324. * the nth argument from the end is returned.
  33325. *
  33326. * @static
  33327. * @memberOf _
  33328. * @since 4.0.0
  33329. * @category Util
  33330. * @param {number} [n=0] The index of the argument to return.
  33331. * @returns {Function} Returns the new pass-thru function.
  33332. * @example
  33333. *
  33334. * var func = _.nthArg(1);
  33335. * func('a', 'b', 'c', 'd');
  33336. * // => 'b'
  33337. *
  33338. * var func = _.nthArg(-2);
  33339. * func('a', 'b', 'c', 'd');
  33340. * // => 'c'
  33341. */
  33342. function nthArg(n) {
  33343. n = toInteger(n);
  33344. return baseRest(function(args) {
  33345. return baseNth(args, n);
  33346. });
  33347. }
  33348. /**
  33349. * Creates a function that invokes `iteratees` with the arguments it receives
  33350. * and returns their results.
  33351. *
  33352. * @static
  33353. * @memberOf _
  33354. * @since 4.0.0
  33355. * @category Util
  33356. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33357. * The iteratees to invoke.
  33358. * @returns {Function} Returns the new function.
  33359. * @example
  33360. *
  33361. * var func = _.over([Math.max, Math.min]);
  33362. *
  33363. * func(1, 2, 3, 4);
  33364. * // => [4, 1]
  33365. */
  33366. var over = createOver(arrayMap);
  33367. /**
  33368. * Creates a function that checks if **all** of the `predicates` return
  33369. * truthy when invoked with the arguments it receives.
  33370. *
  33371. * @static
  33372. * @memberOf _
  33373. * @since 4.0.0
  33374. * @category Util
  33375. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33376. * The predicates to check.
  33377. * @returns {Function} Returns the new function.
  33378. * @example
  33379. *
  33380. * var func = _.overEvery([Boolean, isFinite]);
  33381. *
  33382. * func('1');
  33383. * // => true
  33384. *
  33385. * func(null);
  33386. * // => false
  33387. *
  33388. * func(NaN);
  33389. * // => false
  33390. */
  33391. var overEvery = createOver(arrayEvery);
  33392. /**
  33393. * Creates a function that checks if **any** of the `predicates` return
  33394. * truthy when invoked with the arguments it receives.
  33395. *
  33396. * @static
  33397. * @memberOf _
  33398. * @since 4.0.0
  33399. * @category Util
  33400. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33401. * The predicates to check.
  33402. * @returns {Function} Returns the new function.
  33403. * @example
  33404. *
  33405. * var func = _.overSome([Boolean, isFinite]);
  33406. *
  33407. * func('1');
  33408. * // => true
  33409. *
  33410. * func(null);
  33411. * // => true
  33412. *
  33413. * func(NaN);
  33414. * // => false
  33415. */
  33416. var overSome = createOver(arraySome);
  33417. /**
  33418. * Creates a function that returns the value at `path` of a given object.
  33419. *
  33420. * @static
  33421. * @memberOf _
  33422. * @since 2.4.0
  33423. * @category Util
  33424. * @param {Array|string} path The path of the property to get.
  33425. * @returns {Function} Returns the new accessor function.
  33426. * @example
  33427. *
  33428. * var objects = [
  33429. * { 'a': { 'b': 2 } },
  33430. * { 'a': { 'b': 1 } }
  33431. * ];
  33432. *
  33433. * _.map(objects, _.property('a.b'));
  33434. * // => [2, 1]
  33435. *
  33436. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33437. * // => [1, 2]
  33438. */
  33439. function property(path) {
  33440. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33441. }
  33442. /**
  33443. * The opposite of `_.property`; this method creates a function that returns
  33444. * the value at a given path of `object`.
  33445. *
  33446. * @static
  33447. * @memberOf _
  33448. * @since 3.0.0
  33449. * @category Util
  33450. * @param {Object} object The object to query.
  33451. * @returns {Function} Returns the new accessor function.
  33452. * @example
  33453. *
  33454. * var array = [0, 1, 2],
  33455. * object = { 'a': array, 'b': array, 'c': array };
  33456. *
  33457. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33458. * // => [2, 0]
  33459. *
  33460. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33461. * // => [2, 0]
  33462. */
  33463. function propertyOf(object) {
  33464. return function(path) {
  33465. return object == null ? undefined : baseGet(object, path);
  33466. };
  33467. }
  33468. /**
  33469. * Creates an array of numbers (positive and/or negative) progressing from
  33470. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33471. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33472. * it's set to `start` with `start` then set to `0`.
  33473. *
  33474. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33475. * floating-point values which can produce unexpected results.
  33476. *
  33477. * @static
  33478. * @since 0.1.0
  33479. * @memberOf _
  33480. * @category Util
  33481. * @param {number} [start=0] The start of the range.
  33482. * @param {number} end The end of the range.
  33483. * @param {number} [step=1] The value to increment or decrement by.
  33484. * @returns {Array} Returns the range of numbers.
  33485. * @see _.inRange, _.rangeRight
  33486. * @example
  33487. *
  33488. * _.range(4);
  33489. * // => [0, 1, 2, 3]
  33490. *
  33491. * _.range(-4);
  33492. * // => [0, -1, -2, -3]
  33493. *
  33494. * _.range(1, 5);
  33495. * // => [1, 2, 3, 4]
  33496. *
  33497. * _.range(0, 20, 5);
  33498. * // => [0, 5, 10, 15]
  33499. *
  33500. * _.range(0, -4, -1);
  33501. * // => [0, -1, -2, -3]
  33502. *
  33503. * _.range(1, 4, 0);
  33504. * // => [1, 1, 1]
  33505. *
  33506. * _.range(0);
  33507. * // => []
  33508. */
  33509. var range = createRange();
  33510. /**
  33511. * This method is like `_.range` except that it populates values in
  33512. * descending order.
  33513. *
  33514. * @static
  33515. * @memberOf _
  33516. * @since 4.0.0
  33517. * @category Util
  33518. * @param {number} [start=0] The start of the range.
  33519. * @param {number} end The end of the range.
  33520. * @param {number} [step=1] The value to increment or decrement by.
  33521. * @returns {Array} Returns the range of numbers.
  33522. * @see _.inRange, _.range
  33523. * @example
  33524. *
  33525. * _.rangeRight(4);
  33526. * // => [3, 2, 1, 0]
  33527. *
  33528. * _.rangeRight(-4);
  33529. * // => [-3, -2, -1, 0]
  33530. *
  33531. * _.rangeRight(1, 5);
  33532. * // => [4, 3, 2, 1]
  33533. *
  33534. * _.rangeRight(0, 20, 5);
  33535. * // => [15, 10, 5, 0]
  33536. *
  33537. * _.rangeRight(0, -4, -1);
  33538. * // => [-3, -2, -1, 0]
  33539. *
  33540. * _.rangeRight(1, 4, 0);
  33541. * // => [1, 1, 1]
  33542. *
  33543. * _.rangeRight(0);
  33544. * // => []
  33545. */
  33546. var rangeRight = createRange(true);
  33547. /**
  33548. * This method returns a new empty array.
  33549. *
  33550. * @static
  33551. * @memberOf _
  33552. * @since 4.13.0
  33553. * @category Util
  33554. * @returns {Array} Returns the new empty array.
  33555. * @example
  33556. *
  33557. * var arrays = _.times(2, _.stubArray);
  33558. *
  33559. * console.log(arrays);
  33560. * // => [[], []]
  33561. *
  33562. * console.log(arrays[0] === arrays[1]);
  33563. * // => false
  33564. */
  33565. function stubArray() {
  33566. return [];
  33567. }
  33568. /**
  33569. * This method returns `false`.
  33570. *
  33571. * @static
  33572. * @memberOf _
  33573. * @since 4.13.0
  33574. * @category Util
  33575. * @returns {boolean} Returns `false`.
  33576. * @example
  33577. *
  33578. * _.times(2, _.stubFalse);
  33579. * // => [false, false]
  33580. */
  33581. function stubFalse() {
  33582. return false;
  33583. }
  33584. /**
  33585. * This method returns a new empty object.
  33586. *
  33587. * @static
  33588. * @memberOf _
  33589. * @since 4.13.0
  33590. * @category Util
  33591. * @returns {Object} Returns the new empty object.
  33592. * @example
  33593. *
  33594. * var objects = _.times(2, _.stubObject);
  33595. *
  33596. * console.log(objects);
  33597. * // => [{}, {}]
  33598. *
  33599. * console.log(objects[0] === objects[1]);
  33600. * // => false
  33601. */
  33602. function stubObject() {
  33603. return {};
  33604. }
  33605. /**
  33606. * This method returns an empty string.
  33607. *
  33608. * @static
  33609. * @memberOf _
  33610. * @since 4.13.0
  33611. * @category Util
  33612. * @returns {string} Returns the empty string.
  33613. * @example
  33614. *
  33615. * _.times(2, _.stubString);
  33616. * // => ['', '']
  33617. */
  33618. function stubString() {
  33619. return '';
  33620. }
  33621. /**
  33622. * This method returns `true`.
  33623. *
  33624. * @static
  33625. * @memberOf _
  33626. * @since 4.13.0
  33627. * @category Util
  33628. * @returns {boolean} Returns `true`.
  33629. * @example
  33630. *
  33631. * _.times(2, _.stubTrue);
  33632. * // => [true, true]
  33633. */
  33634. function stubTrue() {
  33635. return true;
  33636. }
  33637. /**
  33638. * Invokes the iteratee `n` times, returning an array of the results of
  33639. * each invocation. The iteratee is invoked with one argument; (index).
  33640. *
  33641. * @static
  33642. * @since 0.1.0
  33643. * @memberOf _
  33644. * @category Util
  33645. * @param {number} n The number of times to invoke `iteratee`.
  33646. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33647. * @returns {Array} Returns the array of results.
  33648. * @example
  33649. *
  33650. * _.times(3, String);
  33651. * // => ['0', '1', '2']
  33652. *
  33653. * _.times(4, _.constant(0));
  33654. * // => [0, 0, 0, 0]
  33655. */
  33656. function times(n, iteratee) {
  33657. n = toInteger(n);
  33658. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33659. return [];
  33660. }
  33661. var index = MAX_ARRAY_LENGTH,
  33662. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33663. iteratee = getIteratee(iteratee);
  33664. n -= MAX_ARRAY_LENGTH;
  33665. var result = baseTimes(length, iteratee);
  33666. while (++index < n) {
  33667. iteratee(index);
  33668. }
  33669. return result;
  33670. }
  33671. /**
  33672. * Converts `value` to a property path array.
  33673. *
  33674. * @static
  33675. * @memberOf _
  33676. * @since 4.0.0
  33677. * @category Util
  33678. * @param {*} value The value to convert.
  33679. * @returns {Array} Returns the new property path array.
  33680. * @example
  33681. *
  33682. * _.toPath('a.b.c');
  33683. * // => ['a', 'b', 'c']
  33684. *
  33685. * _.toPath('a[0].b.c');
  33686. * // => ['a', '0', 'b', 'c']
  33687. */
  33688. function toPath(value) {
  33689. if (isArray(value)) {
  33690. return arrayMap(value, toKey);
  33691. }
  33692. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33693. }
  33694. /**
  33695. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33696. *
  33697. * @static
  33698. * @since 0.1.0
  33699. * @memberOf _
  33700. * @category Util
  33701. * @param {string} [prefix=''] The value to prefix the ID with.
  33702. * @returns {string} Returns the unique ID.
  33703. * @example
  33704. *
  33705. * _.uniqueId('contact_');
  33706. * // => 'contact_104'
  33707. *
  33708. * _.uniqueId();
  33709. * // => '105'
  33710. */
  33711. function uniqueId(prefix) {
  33712. var id = ++idCounter;
  33713. return toString(prefix) + id;
  33714. }
  33715. /*------------------------------------------------------------------------*/
  33716. /**
  33717. * Adds two numbers.
  33718. *
  33719. * @static
  33720. * @memberOf _
  33721. * @since 3.4.0
  33722. * @category Math
  33723. * @param {number} augend The first number in an addition.
  33724. * @param {number} addend The second number in an addition.
  33725. * @returns {number} Returns the total.
  33726. * @example
  33727. *
  33728. * _.add(6, 4);
  33729. * // => 10
  33730. */
  33731. var add = createMathOperation(function(augend, addend) {
  33732. return augend + addend;
  33733. }, 0);
  33734. /**
  33735. * Computes `number` rounded up to `precision`.
  33736. *
  33737. * @static
  33738. * @memberOf _
  33739. * @since 3.10.0
  33740. * @category Math
  33741. * @param {number} number The number to round up.
  33742. * @param {number} [precision=0] The precision to round up to.
  33743. * @returns {number} Returns the rounded up number.
  33744. * @example
  33745. *
  33746. * _.ceil(4.006);
  33747. * // => 5
  33748. *
  33749. * _.ceil(6.004, 2);
  33750. * // => 6.01
  33751. *
  33752. * _.ceil(6040, -2);
  33753. * // => 6100
  33754. */
  33755. var ceil = createRound('ceil');
  33756. /**
  33757. * Divide two numbers.
  33758. *
  33759. * @static
  33760. * @memberOf _
  33761. * @since 4.7.0
  33762. * @category Math
  33763. * @param {number} dividend The first number in a division.
  33764. * @param {number} divisor The second number in a division.
  33765. * @returns {number} Returns the quotient.
  33766. * @example
  33767. *
  33768. * _.divide(6, 4);
  33769. * // => 1.5
  33770. */
  33771. var divide = createMathOperation(function(dividend, divisor) {
  33772. return dividend / divisor;
  33773. }, 1);
  33774. /**
  33775. * Computes `number` rounded down to `precision`.
  33776. *
  33777. * @static
  33778. * @memberOf _
  33779. * @since 3.10.0
  33780. * @category Math
  33781. * @param {number} number The number to round down.
  33782. * @param {number} [precision=0] The precision to round down to.
  33783. * @returns {number} Returns the rounded down number.
  33784. * @example
  33785. *
  33786. * _.floor(4.006);
  33787. * // => 4
  33788. *
  33789. * _.floor(0.046, 2);
  33790. * // => 0.04
  33791. *
  33792. * _.floor(4060, -2);
  33793. * // => 4000
  33794. */
  33795. var floor = createRound('floor');
  33796. /**
  33797. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33798. * `undefined` is returned.
  33799. *
  33800. * @static
  33801. * @since 0.1.0
  33802. * @memberOf _
  33803. * @category Math
  33804. * @param {Array} array The array to iterate over.
  33805. * @returns {*} Returns the maximum value.
  33806. * @example
  33807. *
  33808. * _.max([4, 2, 8, 6]);
  33809. * // => 8
  33810. *
  33811. * _.max([]);
  33812. * // => undefined
  33813. */
  33814. function max(array) {
  33815. return (array && array.length)
  33816. ? baseExtremum(array, identity, baseGt)
  33817. : undefined;
  33818. }
  33819. /**
  33820. * This method is like `_.max` except that it accepts `iteratee` which is
  33821. * invoked for each element in `array` to generate the criterion by which
  33822. * the value is ranked. The iteratee is invoked with one argument: (value).
  33823. *
  33824. * @static
  33825. * @memberOf _
  33826. * @since 4.0.0
  33827. * @category Math
  33828. * @param {Array} array The array to iterate over.
  33829. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33830. * @returns {*} Returns the maximum value.
  33831. * @example
  33832. *
  33833. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33834. *
  33835. * _.maxBy(objects, function(o) { return o.n; });
  33836. * // => { 'n': 2 }
  33837. *
  33838. * // The `_.property` iteratee shorthand.
  33839. * _.maxBy(objects, 'n');
  33840. * // => { 'n': 2 }
  33841. */
  33842. function maxBy(array, iteratee) {
  33843. return (array && array.length)
  33844. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33845. : undefined;
  33846. }
  33847. /**
  33848. * Computes the mean of the values in `array`.
  33849. *
  33850. * @static
  33851. * @memberOf _
  33852. * @since 4.0.0
  33853. * @category Math
  33854. * @param {Array} array The array to iterate over.
  33855. * @returns {number} Returns the mean.
  33856. * @example
  33857. *
  33858. * _.mean([4, 2, 8, 6]);
  33859. * // => 5
  33860. */
  33861. function mean(array) {
  33862. return baseMean(array, identity);
  33863. }
  33864. /**
  33865. * This method is like `_.mean` except that it accepts `iteratee` which is
  33866. * invoked for each element in `array` to generate the value to be averaged.
  33867. * The iteratee is invoked with one argument: (value).
  33868. *
  33869. * @static
  33870. * @memberOf _
  33871. * @since 4.7.0
  33872. * @category Math
  33873. * @param {Array} array The array to iterate over.
  33874. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33875. * @returns {number} Returns the mean.
  33876. * @example
  33877. *
  33878. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33879. *
  33880. * _.meanBy(objects, function(o) { return o.n; });
  33881. * // => 5
  33882. *
  33883. * // The `_.property` iteratee shorthand.
  33884. * _.meanBy(objects, 'n');
  33885. * // => 5
  33886. */
  33887. function meanBy(array, iteratee) {
  33888. return baseMean(array, getIteratee(iteratee, 2));
  33889. }
  33890. /**
  33891. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33892. * `undefined` is returned.
  33893. *
  33894. * @static
  33895. * @since 0.1.0
  33896. * @memberOf _
  33897. * @category Math
  33898. * @param {Array} array The array to iterate over.
  33899. * @returns {*} Returns the minimum value.
  33900. * @example
  33901. *
  33902. * _.min([4, 2, 8, 6]);
  33903. * // => 2
  33904. *
  33905. * _.min([]);
  33906. * // => undefined
  33907. */
  33908. function min(array) {
  33909. return (array && array.length)
  33910. ? baseExtremum(array, identity, baseLt)
  33911. : undefined;
  33912. }
  33913. /**
  33914. * This method is like `_.min` except that it accepts `iteratee` which is
  33915. * invoked for each element in `array` to generate the criterion by which
  33916. * the value is ranked. The iteratee is invoked with one argument: (value).
  33917. *
  33918. * @static
  33919. * @memberOf _
  33920. * @since 4.0.0
  33921. * @category Math
  33922. * @param {Array} array The array to iterate over.
  33923. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33924. * @returns {*} Returns the minimum value.
  33925. * @example
  33926. *
  33927. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33928. *
  33929. * _.minBy(objects, function(o) { return o.n; });
  33930. * // => { 'n': 1 }
  33931. *
  33932. * // The `_.property` iteratee shorthand.
  33933. * _.minBy(objects, 'n');
  33934. * // => { 'n': 1 }
  33935. */
  33936. function minBy(array, iteratee) {
  33937. return (array && array.length)
  33938. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33939. : undefined;
  33940. }
  33941. /**
  33942. * Multiply two numbers.
  33943. *
  33944. * @static
  33945. * @memberOf _
  33946. * @since 4.7.0
  33947. * @category Math
  33948. * @param {number} multiplier The first number in a multiplication.
  33949. * @param {number} multiplicand The second number in a multiplication.
  33950. * @returns {number} Returns the product.
  33951. * @example
  33952. *
  33953. * _.multiply(6, 4);
  33954. * // => 24
  33955. */
  33956. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33957. return multiplier * multiplicand;
  33958. }, 1);
  33959. /**
  33960. * Computes `number` rounded to `precision`.
  33961. *
  33962. * @static
  33963. * @memberOf _
  33964. * @since 3.10.0
  33965. * @category Math
  33966. * @param {number} number The number to round.
  33967. * @param {number} [precision=0] The precision to round to.
  33968. * @returns {number} Returns the rounded number.
  33969. * @example
  33970. *
  33971. * _.round(4.006);
  33972. * // => 4
  33973. *
  33974. * _.round(4.006, 2);
  33975. * // => 4.01
  33976. *
  33977. * _.round(4060, -2);
  33978. * // => 4100
  33979. */
  33980. var round = createRound('round');
  33981. /**
  33982. * Subtract two numbers.
  33983. *
  33984. * @static
  33985. * @memberOf _
  33986. * @since 4.0.0
  33987. * @category Math
  33988. * @param {number} minuend The first number in a subtraction.
  33989. * @param {number} subtrahend The second number in a subtraction.
  33990. * @returns {number} Returns the difference.
  33991. * @example
  33992. *
  33993. * _.subtract(6, 4);
  33994. * // => 2
  33995. */
  33996. var subtract = createMathOperation(function(minuend, subtrahend) {
  33997. return minuend - subtrahend;
  33998. }, 0);
  33999. /**
  34000. * Computes the sum of the values in `array`.
  34001. *
  34002. * @static
  34003. * @memberOf _
  34004. * @since 3.4.0
  34005. * @category Math
  34006. * @param {Array} array The array to iterate over.
  34007. * @returns {number} Returns the sum.
  34008. * @example
  34009. *
  34010. * _.sum([4, 2, 8, 6]);
  34011. * // => 20
  34012. */
  34013. function sum(array) {
  34014. return (array && array.length)
  34015. ? baseSum(array, identity)
  34016. : 0;
  34017. }
  34018. /**
  34019. * This method is like `_.sum` except that it accepts `iteratee` which is
  34020. * invoked for each element in `array` to generate the value to be summed.
  34021. * The iteratee is invoked with one argument: (value).
  34022. *
  34023. * @static
  34024. * @memberOf _
  34025. * @since 4.0.0
  34026. * @category Math
  34027. * @param {Array} array The array to iterate over.
  34028. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34029. * @returns {number} Returns the sum.
  34030. * @example
  34031. *
  34032. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34033. *
  34034. * _.sumBy(objects, function(o) { return o.n; });
  34035. * // => 20
  34036. *
  34037. * // The `_.property` iteratee shorthand.
  34038. * _.sumBy(objects, 'n');
  34039. * // => 20
  34040. */
  34041. function sumBy(array, iteratee) {
  34042. return (array && array.length)
  34043. ? baseSum(array, getIteratee(iteratee, 2))
  34044. : 0;
  34045. }
  34046. /*------------------------------------------------------------------------*/
  34047. // Add methods that return wrapped values in chain sequences.
  34048. lodash.after = after;
  34049. lodash.ary = ary;
  34050. lodash.assign = assign;
  34051. lodash.assignIn = assignIn;
  34052. lodash.assignInWith = assignInWith;
  34053. lodash.assignWith = assignWith;
  34054. lodash.at = at;
  34055. lodash.before = before;
  34056. lodash.bind = bind;
  34057. lodash.bindAll = bindAll;
  34058. lodash.bindKey = bindKey;
  34059. lodash.castArray = castArray;
  34060. lodash.chain = chain;
  34061. lodash.chunk = chunk;
  34062. lodash.compact = compact;
  34063. lodash.concat = concat;
  34064. lodash.cond = cond;
  34065. lodash.conforms = conforms;
  34066. lodash.constant = constant;
  34067. lodash.countBy = countBy;
  34068. lodash.create = create;
  34069. lodash.curry = curry;
  34070. lodash.curryRight = curryRight;
  34071. lodash.debounce = debounce;
  34072. lodash.defaults = defaults;
  34073. lodash.defaultsDeep = defaultsDeep;
  34074. lodash.defer = defer;
  34075. lodash.delay = delay;
  34076. lodash.difference = difference;
  34077. lodash.differenceBy = differenceBy;
  34078. lodash.differenceWith = differenceWith;
  34079. lodash.drop = drop;
  34080. lodash.dropRight = dropRight;
  34081. lodash.dropRightWhile = dropRightWhile;
  34082. lodash.dropWhile = dropWhile;
  34083. lodash.fill = fill;
  34084. lodash.filter = filter;
  34085. lodash.flatMap = flatMap;
  34086. lodash.flatMapDeep = flatMapDeep;
  34087. lodash.flatMapDepth = flatMapDepth;
  34088. lodash.flatten = flatten;
  34089. lodash.flattenDeep = flattenDeep;
  34090. lodash.flattenDepth = flattenDepth;
  34091. lodash.flip = flip;
  34092. lodash.flow = flow;
  34093. lodash.flowRight = flowRight;
  34094. lodash.fromPairs = fromPairs;
  34095. lodash.functions = functions;
  34096. lodash.functionsIn = functionsIn;
  34097. lodash.groupBy = groupBy;
  34098. lodash.initial = initial;
  34099. lodash.intersection = intersection;
  34100. lodash.intersectionBy = intersectionBy;
  34101. lodash.intersectionWith = intersectionWith;
  34102. lodash.invert = invert;
  34103. lodash.invertBy = invertBy;
  34104. lodash.invokeMap = invokeMap;
  34105. lodash.iteratee = iteratee;
  34106. lodash.keyBy = keyBy;
  34107. lodash.keys = keys;
  34108. lodash.keysIn = keysIn;
  34109. lodash.map = map;
  34110. lodash.mapKeys = mapKeys;
  34111. lodash.mapValues = mapValues;
  34112. lodash.matches = matches;
  34113. lodash.matchesProperty = matchesProperty;
  34114. lodash.memoize = memoize;
  34115. lodash.merge = merge;
  34116. lodash.mergeWith = mergeWith;
  34117. lodash.method = method;
  34118. lodash.methodOf = methodOf;
  34119. lodash.mixin = mixin;
  34120. lodash.negate = negate;
  34121. lodash.nthArg = nthArg;
  34122. lodash.omit = omit;
  34123. lodash.omitBy = omitBy;
  34124. lodash.once = once;
  34125. lodash.orderBy = orderBy;
  34126. lodash.over = over;
  34127. lodash.overArgs = overArgs;
  34128. lodash.overEvery = overEvery;
  34129. lodash.overSome = overSome;
  34130. lodash.partial = partial;
  34131. lodash.partialRight = partialRight;
  34132. lodash.partition = partition;
  34133. lodash.pick = pick;
  34134. lodash.pickBy = pickBy;
  34135. lodash.property = property;
  34136. lodash.propertyOf = propertyOf;
  34137. lodash.pull = pull;
  34138. lodash.pullAll = pullAll;
  34139. lodash.pullAllBy = pullAllBy;
  34140. lodash.pullAllWith = pullAllWith;
  34141. lodash.pullAt = pullAt;
  34142. lodash.range = range;
  34143. lodash.rangeRight = rangeRight;
  34144. lodash.rearg = rearg;
  34145. lodash.reject = reject;
  34146. lodash.remove = remove;
  34147. lodash.rest = rest;
  34148. lodash.reverse = reverse;
  34149. lodash.sampleSize = sampleSize;
  34150. lodash.set = set;
  34151. lodash.setWith = setWith;
  34152. lodash.shuffle = shuffle;
  34153. lodash.slice = slice;
  34154. lodash.sortBy = sortBy;
  34155. lodash.sortedUniq = sortedUniq;
  34156. lodash.sortedUniqBy = sortedUniqBy;
  34157. lodash.split = split;
  34158. lodash.spread = spread;
  34159. lodash.tail = tail;
  34160. lodash.take = take;
  34161. lodash.takeRight = takeRight;
  34162. lodash.takeRightWhile = takeRightWhile;
  34163. lodash.takeWhile = takeWhile;
  34164. lodash.tap = tap;
  34165. lodash.throttle = throttle;
  34166. lodash.thru = thru;
  34167. lodash.toArray = toArray;
  34168. lodash.toPairs = toPairs;
  34169. lodash.toPairsIn = toPairsIn;
  34170. lodash.toPath = toPath;
  34171. lodash.toPlainObject = toPlainObject;
  34172. lodash.transform = transform;
  34173. lodash.unary = unary;
  34174. lodash.union = union;
  34175. lodash.unionBy = unionBy;
  34176. lodash.unionWith = unionWith;
  34177. lodash.uniq = uniq;
  34178. lodash.uniqBy = uniqBy;
  34179. lodash.uniqWith = uniqWith;
  34180. lodash.unset = unset;
  34181. lodash.unzip = unzip;
  34182. lodash.unzipWith = unzipWith;
  34183. lodash.update = update;
  34184. lodash.updateWith = updateWith;
  34185. lodash.values = values;
  34186. lodash.valuesIn = valuesIn;
  34187. lodash.without = without;
  34188. lodash.words = words;
  34189. lodash.wrap = wrap;
  34190. lodash.xor = xor;
  34191. lodash.xorBy = xorBy;
  34192. lodash.xorWith = xorWith;
  34193. lodash.zip = zip;
  34194. lodash.zipObject = zipObject;
  34195. lodash.zipObjectDeep = zipObjectDeep;
  34196. lodash.zipWith = zipWith;
  34197. // Add aliases.
  34198. lodash.entries = toPairs;
  34199. lodash.entriesIn = toPairsIn;
  34200. lodash.extend = assignIn;
  34201. lodash.extendWith = assignInWith;
  34202. // Add methods to `lodash.prototype`.
  34203. mixin(lodash, lodash);
  34204. /*------------------------------------------------------------------------*/
  34205. // Add methods that return unwrapped values in chain sequences.
  34206. lodash.add = add;
  34207. lodash.attempt = attempt;
  34208. lodash.camelCase = camelCase;
  34209. lodash.capitalize = capitalize;
  34210. lodash.ceil = ceil;
  34211. lodash.clamp = clamp;
  34212. lodash.clone = clone;
  34213. lodash.cloneDeep = cloneDeep;
  34214. lodash.cloneDeepWith = cloneDeepWith;
  34215. lodash.cloneWith = cloneWith;
  34216. lodash.conformsTo = conformsTo;
  34217. lodash.deburr = deburr;
  34218. lodash.defaultTo = defaultTo;
  34219. lodash.divide = divide;
  34220. lodash.endsWith = endsWith;
  34221. lodash.eq = eq;
  34222. lodash.escape = escape;
  34223. lodash.escapeRegExp = escapeRegExp;
  34224. lodash.every = every;
  34225. lodash.find = find;
  34226. lodash.findIndex = findIndex;
  34227. lodash.findKey = findKey;
  34228. lodash.findLast = findLast;
  34229. lodash.findLastIndex = findLastIndex;
  34230. lodash.findLastKey = findLastKey;
  34231. lodash.floor = floor;
  34232. lodash.forEach = forEach;
  34233. lodash.forEachRight = forEachRight;
  34234. lodash.forIn = forIn;
  34235. lodash.forInRight = forInRight;
  34236. lodash.forOwn = forOwn;
  34237. lodash.forOwnRight = forOwnRight;
  34238. lodash.get = get;
  34239. lodash.gt = gt;
  34240. lodash.gte = gte;
  34241. lodash.has = has;
  34242. lodash.hasIn = hasIn;
  34243. lodash.head = head;
  34244. lodash.identity = identity;
  34245. lodash.includes = includes;
  34246. lodash.indexOf = indexOf;
  34247. lodash.inRange = inRange;
  34248. lodash.invoke = invoke;
  34249. lodash.isArguments = isArguments;
  34250. lodash.isArray = isArray;
  34251. lodash.isArrayBuffer = isArrayBuffer;
  34252. lodash.isArrayLike = isArrayLike;
  34253. lodash.isArrayLikeObject = isArrayLikeObject;
  34254. lodash.isBoolean = isBoolean;
  34255. lodash.isBuffer = isBuffer;
  34256. lodash.isDate = isDate;
  34257. lodash.isElement = isElement;
  34258. lodash.isEmpty = isEmpty;
  34259. lodash.isEqual = isEqual;
  34260. lodash.isEqualWith = isEqualWith;
  34261. lodash.isError = isError;
  34262. lodash.isFinite = isFinite;
  34263. lodash.isFunction = isFunction;
  34264. lodash.isInteger = isInteger;
  34265. lodash.isLength = isLength;
  34266. lodash.isMap = isMap;
  34267. lodash.isMatch = isMatch;
  34268. lodash.isMatchWith = isMatchWith;
  34269. lodash.isNaN = isNaN;
  34270. lodash.isNative = isNative;
  34271. lodash.isNil = isNil;
  34272. lodash.isNull = isNull;
  34273. lodash.isNumber = isNumber;
  34274. lodash.isObject = isObject;
  34275. lodash.isObjectLike = isObjectLike;
  34276. lodash.isPlainObject = isPlainObject;
  34277. lodash.isRegExp = isRegExp;
  34278. lodash.isSafeInteger = isSafeInteger;
  34279. lodash.isSet = isSet;
  34280. lodash.isString = isString;
  34281. lodash.isSymbol = isSymbol;
  34282. lodash.isTypedArray = isTypedArray;
  34283. lodash.isUndefined = isUndefined;
  34284. lodash.isWeakMap = isWeakMap;
  34285. lodash.isWeakSet = isWeakSet;
  34286. lodash.join = join;
  34287. lodash.kebabCase = kebabCase;
  34288. lodash.last = last;
  34289. lodash.lastIndexOf = lastIndexOf;
  34290. lodash.lowerCase = lowerCase;
  34291. lodash.lowerFirst = lowerFirst;
  34292. lodash.lt = lt;
  34293. lodash.lte = lte;
  34294. lodash.max = max;
  34295. lodash.maxBy = maxBy;
  34296. lodash.mean = mean;
  34297. lodash.meanBy = meanBy;
  34298. lodash.min = min;
  34299. lodash.minBy = minBy;
  34300. lodash.stubArray = stubArray;
  34301. lodash.stubFalse = stubFalse;
  34302. lodash.stubObject = stubObject;
  34303. lodash.stubString = stubString;
  34304. lodash.stubTrue = stubTrue;
  34305. lodash.multiply = multiply;
  34306. lodash.nth = nth;
  34307. lodash.noConflict = noConflict;
  34308. lodash.noop = noop;
  34309. lodash.now = now;
  34310. lodash.pad = pad;
  34311. lodash.padEnd = padEnd;
  34312. lodash.padStart = padStart;
  34313. lodash.parseInt = parseInt;
  34314. lodash.random = random;
  34315. lodash.reduce = reduce;
  34316. lodash.reduceRight = reduceRight;
  34317. lodash.repeat = repeat;
  34318. lodash.replace = replace;
  34319. lodash.result = result;
  34320. lodash.round = round;
  34321. lodash.runInContext = runInContext;
  34322. lodash.sample = sample;
  34323. lodash.size = size;
  34324. lodash.snakeCase = snakeCase;
  34325. lodash.some = some;
  34326. lodash.sortedIndex = sortedIndex;
  34327. lodash.sortedIndexBy = sortedIndexBy;
  34328. lodash.sortedIndexOf = sortedIndexOf;
  34329. lodash.sortedLastIndex = sortedLastIndex;
  34330. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34331. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34332. lodash.startCase = startCase;
  34333. lodash.startsWith = startsWith;
  34334. lodash.subtract = subtract;
  34335. lodash.sum = sum;
  34336. lodash.sumBy = sumBy;
  34337. lodash.template = template;
  34338. lodash.times = times;
  34339. lodash.toFinite = toFinite;
  34340. lodash.toInteger = toInteger;
  34341. lodash.toLength = toLength;
  34342. lodash.toLower = toLower;
  34343. lodash.toNumber = toNumber;
  34344. lodash.toSafeInteger = toSafeInteger;
  34345. lodash.toString = toString;
  34346. lodash.toUpper = toUpper;
  34347. lodash.trim = trim;
  34348. lodash.trimEnd = trimEnd;
  34349. lodash.trimStart = trimStart;
  34350. lodash.truncate = truncate;
  34351. lodash.unescape = unescape;
  34352. lodash.uniqueId = uniqueId;
  34353. lodash.upperCase = upperCase;
  34354. lodash.upperFirst = upperFirst;
  34355. // Add aliases.
  34356. lodash.each = forEach;
  34357. lodash.eachRight = forEachRight;
  34358. lodash.first = head;
  34359. mixin(lodash, (function() {
  34360. var source = {};
  34361. baseForOwn(lodash, function(func, methodName) {
  34362. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34363. source[methodName] = func;
  34364. }
  34365. });
  34366. return source;
  34367. }()), { 'chain': false });
  34368. /*------------------------------------------------------------------------*/
  34369. /**
  34370. * The semantic version number.
  34371. *
  34372. * @static
  34373. * @memberOf _
  34374. * @type {string}
  34375. */
  34376. lodash.VERSION = VERSION;
  34377. // Assign default placeholders.
  34378. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34379. lodash[methodName].placeholder = lodash;
  34380. });
  34381. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34382. arrayEach(['drop', 'take'], function(methodName, index) {
  34383. LazyWrapper.prototype[methodName] = function(n) {
  34384. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34385. var result = (this.__filtered__ && !index)
  34386. ? new LazyWrapper(this)
  34387. : this.clone();
  34388. if (result.__filtered__) {
  34389. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34390. } else {
  34391. result.__views__.push({
  34392. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34393. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34394. });
  34395. }
  34396. return result;
  34397. };
  34398. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34399. return this.reverse()[methodName](n).reverse();
  34400. };
  34401. });
  34402. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34403. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34404. var type = index + 1,
  34405. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34406. LazyWrapper.prototype[methodName] = function(iteratee) {
  34407. var result = this.clone();
  34408. result.__iteratees__.push({
  34409. 'iteratee': getIteratee(iteratee, 3),
  34410. 'type': type
  34411. });
  34412. result.__filtered__ = result.__filtered__ || isFilter;
  34413. return result;
  34414. };
  34415. });
  34416. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34417. arrayEach(['head', 'last'], function(methodName, index) {
  34418. var takeName = 'take' + (index ? 'Right' : '');
  34419. LazyWrapper.prototype[methodName] = function() {
  34420. return this[takeName](1).value()[0];
  34421. };
  34422. });
  34423. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34424. arrayEach(['initial', 'tail'], function(methodName, index) {
  34425. var dropName = 'drop' + (index ? '' : 'Right');
  34426. LazyWrapper.prototype[methodName] = function() {
  34427. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34428. };
  34429. });
  34430. LazyWrapper.prototype.compact = function() {
  34431. return this.filter(identity);
  34432. };
  34433. LazyWrapper.prototype.find = function(predicate) {
  34434. return this.filter(predicate).head();
  34435. };
  34436. LazyWrapper.prototype.findLast = function(predicate) {
  34437. return this.reverse().find(predicate);
  34438. };
  34439. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34440. if (typeof path == 'function') {
  34441. return new LazyWrapper(this);
  34442. }
  34443. return this.map(function(value) {
  34444. return baseInvoke(value, path, args);
  34445. });
  34446. });
  34447. LazyWrapper.prototype.reject = function(predicate) {
  34448. return this.filter(negate(getIteratee(predicate)));
  34449. };
  34450. LazyWrapper.prototype.slice = function(start, end) {
  34451. start = toInteger(start);
  34452. var result = this;
  34453. if (result.__filtered__ && (start > 0 || end < 0)) {
  34454. return new LazyWrapper(result);
  34455. }
  34456. if (start < 0) {
  34457. result = result.takeRight(-start);
  34458. } else if (start) {
  34459. result = result.drop(start);
  34460. }
  34461. if (end !== undefined) {
  34462. end = toInteger(end);
  34463. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34464. }
  34465. return result;
  34466. };
  34467. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34468. return this.reverse().takeWhile(predicate).reverse();
  34469. };
  34470. LazyWrapper.prototype.toArray = function() {
  34471. return this.take(MAX_ARRAY_LENGTH);
  34472. };
  34473. // Add `LazyWrapper` methods to `lodash.prototype`.
  34474. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34475. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34476. isTaker = /^(?:head|last)$/.test(methodName),
  34477. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34478. retUnwrapped = isTaker || /^find/.test(methodName);
  34479. if (!lodashFunc) {
  34480. return;
  34481. }
  34482. lodash.prototype[methodName] = function() {
  34483. var value = this.__wrapped__,
  34484. args = isTaker ? [1] : arguments,
  34485. isLazy = value instanceof LazyWrapper,
  34486. iteratee = args[0],
  34487. useLazy = isLazy || isArray(value);
  34488. var interceptor = function(value) {
  34489. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34490. return (isTaker && chainAll) ? result[0] : result;
  34491. };
  34492. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34493. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34494. isLazy = useLazy = false;
  34495. }
  34496. var chainAll = this.__chain__,
  34497. isHybrid = !!this.__actions__.length,
  34498. isUnwrapped = retUnwrapped && !chainAll,
  34499. onlyLazy = isLazy && !isHybrid;
  34500. if (!retUnwrapped && useLazy) {
  34501. value = onlyLazy ? value : new LazyWrapper(this);
  34502. var result = func.apply(value, args);
  34503. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34504. return new LodashWrapper(result, chainAll);
  34505. }
  34506. if (isUnwrapped && onlyLazy) {
  34507. return func.apply(this, args);
  34508. }
  34509. result = this.thru(interceptor);
  34510. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34511. };
  34512. });
  34513. // Add `Array` methods to `lodash.prototype`.
  34514. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34515. var func = arrayProto[methodName],
  34516. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34517. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34518. lodash.prototype[methodName] = function() {
  34519. var args = arguments;
  34520. if (retUnwrapped && !this.__chain__) {
  34521. var value = this.value();
  34522. return func.apply(isArray(value) ? value : [], args);
  34523. }
  34524. return this[chainName](function(value) {
  34525. return func.apply(isArray(value) ? value : [], args);
  34526. });
  34527. };
  34528. });
  34529. // Map minified method names to their real names.
  34530. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34531. var lodashFunc = lodash[methodName];
  34532. if (lodashFunc) {
  34533. var key = lodashFunc.name + '';
  34534. if (!hasOwnProperty.call(realNames, key)) {
  34535. realNames[key] = [];
  34536. }
  34537. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34538. }
  34539. });
  34540. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34541. 'name': 'wrapper',
  34542. 'func': undefined
  34543. }];
  34544. // Add methods to `LazyWrapper`.
  34545. LazyWrapper.prototype.clone = lazyClone;
  34546. LazyWrapper.prototype.reverse = lazyReverse;
  34547. LazyWrapper.prototype.value = lazyValue;
  34548. // Add chain sequence methods to the `lodash` wrapper.
  34549. lodash.prototype.at = wrapperAt;
  34550. lodash.prototype.chain = wrapperChain;
  34551. lodash.prototype.commit = wrapperCommit;
  34552. lodash.prototype.next = wrapperNext;
  34553. lodash.prototype.plant = wrapperPlant;
  34554. lodash.prototype.reverse = wrapperReverse;
  34555. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34556. // Add lazy aliases.
  34557. lodash.prototype.first = lodash.prototype.head;
  34558. if (symIterator) {
  34559. lodash.prototype[symIterator] = wrapperToIterator;
  34560. }
  34561. return lodash;
  34562. });
  34563. /*--------------------------------------------------------------------------*/
  34564. // Export lodash.
  34565. var _ = runInContext();
  34566. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34567. if (true) {
  34568. // Expose Lodash on the global object to prevent errors when Lodash is
  34569. // loaded by a script tag in the presence of an AMD loader.
  34570. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34571. // Use `_.noConflict` to remove Lodash from the global object.
  34572. root._ = _;
  34573. // Define as an anonymous module so, through path mapping, it can be
  34574. // referenced as the "underscore" module.
  34575. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34576. return _;
  34577. }).call(exports, __webpack_require__, exports, module),
  34578. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34579. }
  34580. // Check for `exports` after `define` in case a build optimizer adds it.
  34581. else {}
  34582. }.call(this));
  34583. /* 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)))
  34584. /***/ }),
  34585. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34586. /*!***************************************************!*\
  34587. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34588. \***************************************************/
  34589. /*! exports provided: default */
  34590. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34591. "use strict";
  34592. __webpack_require__.r(__webpack_exports__);
  34593. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34594. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34595. * @version 1.16.1
  34596. * @license
  34597. * Copyright (c) 2016 Federico Zivolo and contributors
  34598. *
  34599. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34600. * of this software and associated documentation files (the "Software"), to deal
  34601. * in the Software without restriction, including without limitation the rights
  34602. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34603. * copies of the Software, and to permit persons to whom the Software is
  34604. * furnished to do so, subject to the following conditions:
  34605. *
  34606. * The above copyright notice and this permission notice shall be included in all
  34607. * copies or substantial portions of the Software.
  34608. *
  34609. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34610. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34611. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34612. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34613. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34614. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34615. * SOFTWARE.
  34616. */
  34617. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34618. var timeoutDuration = function () {
  34619. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34620. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34621. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34622. return 1;
  34623. }
  34624. }
  34625. return 0;
  34626. }();
  34627. function microtaskDebounce(fn) {
  34628. var called = false;
  34629. return function () {
  34630. if (called) {
  34631. return;
  34632. }
  34633. called = true;
  34634. window.Promise.resolve().then(function () {
  34635. called = false;
  34636. fn();
  34637. });
  34638. };
  34639. }
  34640. function taskDebounce(fn) {
  34641. var scheduled = false;
  34642. return function () {
  34643. if (!scheduled) {
  34644. scheduled = true;
  34645. setTimeout(function () {
  34646. scheduled = false;
  34647. fn();
  34648. }, timeoutDuration);
  34649. }
  34650. };
  34651. }
  34652. var supportsMicroTasks = isBrowser && window.Promise;
  34653. /**
  34654. * Create a debounced version of a method, that's asynchronously deferred
  34655. * but called in the minimum time possible.
  34656. *
  34657. * @method
  34658. * @memberof Popper.Utils
  34659. * @argument {Function} fn
  34660. * @returns {Function}
  34661. */
  34662. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34663. /**
  34664. * Check if the given variable is a function
  34665. * @method
  34666. * @memberof Popper.Utils
  34667. * @argument {Any} functionToCheck - variable to check
  34668. * @returns {Boolean} answer to: is a function?
  34669. */
  34670. function isFunction(functionToCheck) {
  34671. var getType = {};
  34672. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34673. }
  34674. /**
  34675. * Get CSS computed property of the given element
  34676. * @method
  34677. * @memberof Popper.Utils
  34678. * @argument {Eement} element
  34679. * @argument {String} property
  34680. */
  34681. function getStyleComputedProperty(element, property) {
  34682. if (element.nodeType !== 1) {
  34683. return [];
  34684. }
  34685. // NOTE: 1 DOM access here
  34686. var window = element.ownerDocument.defaultView;
  34687. var css = window.getComputedStyle(element, null);
  34688. return property ? css[property] : css;
  34689. }
  34690. /**
  34691. * Returns the parentNode or the host of the element
  34692. * @method
  34693. * @memberof Popper.Utils
  34694. * @argument {Element} element
  34695. * @returns {Element} parent
  34696. */
  34697. function getParentNode(element) {
  34698. if (element.nodeName === 'HTML') {
  34699. return element;
  34700. }
  34701. return element.parentNode || element.host;
  34702. }
  34703. /**
  34704. * Returns the scrolling parent of the given element
  34705. * @method
  34706. * @memberof Popper.Utils
  34707. * @argument {Element} element
  34708. * @returns {Element} scroll parent
  34709. */
  34710. function getScrollParent(element) {
  34711. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34712. if (!element) {
  34713. return document.body;
  34714. }
  34715. switch (element.nodeName) {
  34716. case 'HTML':
  34717. case 'BODY':
  34718. return element.ownerDocument.body;
  34719. case '#document':
  34720. return element.body;
  34721. }
  34722. // Firefox want us to check `-x` and `-y` variations as well
  34723. var _getStyleComputedProp = getStyleComputedProperty(element),
  34724. overflow = _getStyleComputedProp.overflow,
  34725. overflowX = _getStyleComputedProp.overflowX,
  34726. overflowY = _getStyleComputedProp.overflowY;
  34727. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34728. return element;
  34729. }
  34730. return getScrollParent(getParentNode(element));
  34731. }
  34732. /**
  34733. * Returns the reference node of the reference object, or the reference object itself.
  34734. * @method
  34735. * @memberof Popper.Utils
  34736. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34737. * @returns {Element} parent
  34738. */
  34739. function getReferenceNode(reference) {
  34740. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34741. }
  34742. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34743. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34744. /**
  34745. * Determines if the browser is Internet Explorer
  34746. * @method
  34747. * @memberof Popper.Utils
  34748. * @param {Number} version to check
  34749. * @returns {Boolean} isIE
  34750. */
  34751. function isIE(version) {
  34752. if (version === 11) {
  34753. return isIE11;
  34754. }
  34755. if (version === 10) {
  34756. return isIE10;
  34757. }
  34758. return isIE11 || isIE10;
  34759. }
  34760. /**
  34761. * Returns the offset parent of the given element
  34762. * @method
  34763. * @memberof Popper.Utils
  34764. * @argument {Element} element
  34765. * @returns {Element} offset parent
  34766. */
  34767. function getOffsetParent(element) {
  34768. if (!element) {
  34769. return document.documentElement;
  34770. }
  34771. var noOffsetParent = isIE(10) ? document.body : null;
  34772. // NOTE: 1 DOM access here
  34773. var offsetParent = element.offsetParent || null;
  34774. // Skip hidden elements which don't have an offsetParent
  34775. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34776. offsetParent = (element = element.nextElementSibling).offsetParent;
  34777. }
  34778. var nodeName = offsetParent && offsetParent.nodeName;
  34779. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34780. return element ? element.ownerDocument.documentElement : document.documentElement;
  34781. }
  34782. // .offsetParent will return the closest TH, TD or TABLE in case
  34783. // no offsetParent is present, I hate this job...
  34784. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34785. return getOffsetParent(offsetParent);
  34786. }
  34787. return offsetParent;
  34788. }
  34789. function isOffsetContainer(element) {
  34790. var nodeName = element.nodeName;
  34791. if (nodeName === 'BODY') {
  34792. return false;
  34793. }
  34794. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34795. }
  34796. /**
  34797. * Finds the root node (document, shadowDOM root) of the given element
  34798. * @method
  34799. * @memberof Popper.Utils
  34800. * @argument {Element} node
  34801. * @returns {Element} root node
  34802. */
  34803. function getRoot(node) {
  34804. if (node.parentNode !== null) {
  34805. return getRoot(node.parentNode);
  34806. }
  34807. return node;
  34808. }
  34809. /**
  34810. * Finds the offset parent common to the two provided nodes
  34811. * @method
  34812. * @memberof Popper.Utils
  34813. * @argument {Element} element1
  34814. * @argument {Element} element2
  34815. * @returns {Element} common offset parent
  34816. */
  34817. function findCommonOffsetParent(element1, element2) {
  34818. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34819. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34820. return document.documentElement;
  34821. }
  34822. // Here we make sure to give as "start" the element that comes first in the DOM
  34823. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34824. var start = order ? element1 : element2;
  34825. var end = order ? element2 : element1;
  34826. // Get common ancestor container
  34827. var range = document.createRange();
  34828. range.setStart(start, 0);
  34829. range.setEnd(end, 0);
  34830. var commonAncestorContainer = range.commonAncestorContainer;
  34831. // Both nodes are inside #document
  34832. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34833. if (isOffsetContainer(commonAncestorContainer)) {
  34834. return commonAncestorContainer;
  34835. }
  34836. return getOffsetParent(commonAncestorContainer);
  34837. }
  34838. // one of the nodes is inside shadowDOM, find which one
  34839. var element1root = getRoot(element1);
  34840. if (element1root.host) {
  34841. return findCommonOffsetParent(element1root.host, element2);
  34842. } else {
  34843. return findCommonOffsetParent(element1, getRoot(element2).host);
  34844. }
  34845. }
  34846. /**
  34847. * Gets the scroll value of the given element in the given side (top and left)
  34848. * @method
  34849. * @memberof Popper.Utils
  34850. * @argument {Element} element
  34851. * @argument {String} side `top` or `left`
  34852. * @returns {number} amount of scrolled pixels
  34853. */
  34854. function getScroll(element) {
  34855. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34856. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34857. var nodeName = element.nodeName;
  34858. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34859. var html = element.ownerDocument.documentElement;
  34860. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34861. return scrollingElement[upperSide];
  34862. }
  34863. return element[upperSide];
  34864. }
  34865. /*
  34866. * Sum or subtract the element scroll values (left and top) from a given rect object
  34867. * @method
  34868. * @memberof Popper.Utils
  34869. * @param {Object} rect - Rect object you want to change
  34870. * @param {HTMLElement} element - The element from the function reads the scroll values
  34871. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34872. * @return {Object} rect - The modifier rect object
  34873. */
  34874. function includeScroll(rect, element) {
  34875. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34876. var scrollTop = getScroll(element, 'top');
  34877. var scrollLeft = getScroll(element, 'left');
  34878. var modifier = subtract ? -1 : 1;
  34879. rect.top += scrollTop * modifier;
  34880. rect.bottom += scrollTop * modifier;
  34881. rect.left += scrollLeft * modifier;
  34882. rect.right += scrollLeft * modifier;
  34883. return rect;
  34884. }
  34885. /*
  34886. * Helper to detect borders of a given element
  34887. * @method
  34888. * @memberof Popper.Utils
  34889. * @param {CSSStyleDeclaration} styles
  34890. * Result of `getStyleComputedProperty` on the given element
  34891. * @param {String} axis - `x` or `y`
  34892. * @return {number} borders - The borders size of the given axis
  34893. */
  34894. function getBordersSize(styles, axis) {
  34895. var sideA = axis === 'x' ? 'Left' : 'Top';
  34896. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34897. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34898. }
  34899. function getSize(axis, body, html, computedStyle) {
  34900. 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);
  34901. }
  34902. function getWindowSizes(document) {
  34903. var body = document.body;
  34904. var html = document.documentElement;
  34905. var computedStyle = isIE(10) && getComputedStyle(html);
  34906. return {
  34907. height: getSize('Height', body, html, computedStyle),
  34908. width: getSize('Width', body, html, computedStyle)
  34909. };
  34910. }
  34911. var classCallCheck = function (instance, Constructor) {
  34912. if (!(instance instanceof Constructor)) {
  34913. throw new TypeError("Cannot call a class as a function");
  34914. }
  34915. };
  34916. var createClass = function () {
  34917. function defineProperties(target, props) {
  34918. for (var i = 0; i < props.length; i++) {
  34919. var descriptor = props[i];
  34920. descriptor.enumerable = descriptor.enumerable || false;
  34921. descriptor.configurable = true;
  34922. if ("value" in descriptor) descriptor.writable = true;
  34923. Object.defineProperty(target, descriptor.key, descriptor);
  34924. }
  34925. }
  34926. return function (Constructor, protoProps, staticProps) {
  34927. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34928. if (staticProps) defineProperties(Constructor, staticProps);
  34929. return Constructor;
  34930. };
  34931. }();
  34932. var defineProperty = function (obj, key, value) {
  34933. if (key in obj) {
  34934. Object.defineProperty(obj, key, {
  34935. value: value,
  34936. enumerable: true,
  34937. configurable: true,
  34938. writable: true
  34939. });
  34940. } else {
  34941. obj[key] = value;
  34942. }
  34943. return obj;
  34944. };
  34945. var _extends = Object.assign || function (target) {
  34946. for (var i = 1; i < arguments.length; i++) {
  34947. var source = arguments[i];
  34948. for (var key in source) {
  34949. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34950. target[key] = source[key];
  34951. }
  34952. }
  34953. }
  34954. return target;
  34955. };
  34956. /**
  34957. * Given element offsets, generate an output similar to getBoundingClientRect
  34958. * @method
  34959. * @memberof Popper.Utils
  34960. * @argument {Object} offsets
  34961. * @returns {Object} ClientRect like output
  34962. */
  34963. function getClientRect(offsets) {
  34964. return _extends({}, offsets, {
  34965. right: offsets.left + offsets.width,
  34966. bottom: offsets.top + offsets.height
  34967. });
  34968. }
  34969. /**
  34970. * Get bounding client rect of given element
  34971. * @method
  34972. * @memberof Popper.Utils
  34973. * @param {HTMLElement} element
  34974. * @return {Object} client rect
  34975. */
  34976. function getBoundingClientRect(element) {
  34977. var rect = {};
  34978. // IE10 10 FIX: Please, don't ask, the element isn't
  34979. // considered in DOM in some circumstances...
  34980. // This isn't reproducible in IE10 compatibility mode of IE11
  34981. try {
  34982. if (isIE(10)) {
  34983. rect = element.getBoundingClientRect();
  34984. var scrollTop = getScroll(element, 'top');
  34985. var scrollLeft = getScroll(element, 'left');
  34986. rect.top += scrollTop;
  34987. rect.left += scrollLeft;
  34988. rect.bottom += scrollTop;
  34989. rect.right += scrollLeft;
  34990. } else {
  34991. rect = element.getBoundingClientRect();
  34992. }
  34993. } catch (e) {}
  34994. var result = {
  34995. left: rect.left,
  34996. top: rect.top,
  34997. width: rect.right - rect.left,
  34998. height: rect.bottom - rect.top
  34999. };
  35000. // subtract scrollbar size from sizes
  35001. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35002. var width = sizes.width || element.clientWidth || result.width;
  35003. var height = sizes.height || element.clientHeight || result.height;
  35004. var horizScrollbar = element.offsetWidth - width;
  35005. var vertScrollbar = element.offsetHeight - height;
  35006. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35007. // we make this check conditional for performance reasons
  35008. if (horizScrollbar || vertScrollbar) {
  35009. var styles = getStyleComputedProperty(element);
  35010. horizScrollbar -= getBordersSize(styles, 'x');
  35011. vertScrollbar -= getBordersSize(styles, 'y');
  35012. result.width -= horizScrollbar;
  35013. result.height -= vertScrollbar;
  35014. }
  35015. return getClientRect(result);
  35016. }
  35017. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35018. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35019. var isIE10 = isIE(10);
  35020. var isHTML = parent.nodeName === 'HTML';
  35021. var childrenRect = getBoundingClientRect(children);
  35022. var parentRect = getBoundingClientRect(parent);
  35023. var scrollParent = getScrollParent(children);
  35024. var styles = getStyleComputedProperty(parent);
  35025. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35026. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35027. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35028. if (fixedPosition && isHTML) {
  35029. parentRect.top = Math.max(parentRect.top, 0);
  35030. parentRect.left = Math.max(parentRect.left, 0);
  35031. }
  35032. var offsets = getClientRect({
  35033. top: childrenRect.top - parentRect.top - borderTopWidth,
  35034. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35035. width: childrenRect.width,
  35036. height: childrenRect.height
  35037. });
  35038. offsets.marginTop = 0;
  35039. offsets.marginLeft = 0;
  35040. // Subtract margins of documentElement in case it's being used as parent
  35041. // we do this only on HTML because it's the only element that behaves
  35042. // differently when margins are applied to it. The margins are included in
  35043. // the box of the documentElement, in the other cases not.
  35044. if (!isIE10 && isHTML) {
  35045. var marginTop = parseFloat(styles.marginTop);
  35046. var marginLeft = parseFloat(styles.marginLeft);
  35047. offsets.top -= borderTopWidth - marginTop;
  35048. offsets.bottom -= borderTopWidth - marginTop;
  35049. offsets.left -= borderLeftWidth - marginLeft;
  35050. offsets.right -= borderLeftWidth - marginLeft;
  35051. // Attach marginTop and marginLeft because in some circumstances we may need them
  35052. offsets.marginTop = marginTop;
  35053. offsets.marginLeft = marginLeft;
  35054. }
  35055. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35056. offsets = includeScroll(offsets, parent);
  35057. }
  35058. return offsets;
  35059. }
  35060. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35061. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35062. var html = element.ownerDocument.documentElement;
  35063. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35064. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35065. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35066. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35067. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35068. var offset = {
  35069. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35070. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35071. width: width,
  35072. height: height
  35073. };
  35074. return getClientRect(offset);
  35075. }
  35076. /**
  35077. * Check if the given element is fixed or is inside a fixed parent
  35078. * @method
  35079. * @memberof Popper.Utils
  35080. * @argument {Element} element
  35081. * @argument {Element} customContainer
  35082. * @returns {Boolean} answer to "isFixed?"
  35083. */
  35084. function isFixed(element) {
  35085. var nodeName = element.nodeName;
  35086. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35087. return false;
  35088. }
  35089. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35090. return true;
  35091. }
  35092. var parentNode = getParentNode(element);
  35093. if (!parentNode) {
  35094. return false;
  35095. }
  35096. return isFixed(parentNode);
  35097. }
  35098. /**
  35099. * Finds the first parent of an element that has a transformed property defined
  35100. * @method
  35101. * @memberof Popper.Utils
  35102. * @argument {Element} element
  35103. * @returns {Element} first transformed parent or documentElement
  35104. */
  35105. function getFixedPositionOffsetParent(element) {
  35106. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35107. if (!element || !element.parentElement || isIE()) {
  35108. return document.documentElement;
  35109. }
  35110. var el = element.parentElement;
  35111. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35112. el = el.parentElement;
  35113. }
  35114. return el || document.documentElement;
  35115. }
  35116. /**
  35117. * Computed the boundaries limits and return them
  35118. * @method
  35119. * @memberof Popper.Utils
  35120. * @param {HTMLElement} popper
  35121. * @param {HTMLElement} reference
  35122. * @param {number} padding
  35123. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35124. * @param {Boolean} fixedPosition - Is in fixed position mode
  35125. * @returns {Object} Coordinates of the boundaries
  35126. */
  35127. function getBoundaries(popper, reference, padding, boundariesElement) {
  35128. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35129. // NOTE: 1 DOM access here
  35130. var boundaries = { top: 0, left: 0 };
  35131. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35132. // Handle viewport case
  35133. if (boundariesElement === 'viewport') {
  35134. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35135. } else {
  35136. // Handle other cases based on DOM element used as boundaries
  35137. var boundariesNode = void 0;
  35138. if (boundariesElement === 'scrollParent') {
  35139. boundariesNode = getScrollParent(getParentNode(reference));
  35140. if (boundariesNode.nodeName === 'BODY') {
  35141. boundariesNode = popper.ownerDocument.documentElement;
  35142. }
  35143. } else if (boundariesElement === 'window') {
  35144. boundariesNode = popper.ownerDocument.documentElement;
  35145. } else {
  35146. boundariesNode = boundariesElement;
  35147. }
  35148. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35149. // In case of HTML, we need a different computation
  35150. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35151. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35152. height = _getWindowSizes.height,
  35153. width = _getWindowSizes.width;
  35154. boundaries.top += offsets.top - offsets.marginTop;
  35155. boundaries.bottom = height + offsets.top;
  35156. boundaries.left += offsets.left - offsets.marginLeft;
  35157. boundaries.right = width + offsets.left;
  35158. } else {
  35159. // for all the other DOM elements, this one is good
  35160. boundaries = offsets;
  35161. }
  35162. }
  35163. // Add paddings
  35164. padding = padding || 0;
  35165. var isPaddingNumber = typeof padding === 'number';
  35166. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35167. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35168. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35169. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35170. return boundaries;
  35171. }
  35172. function getArea(_ref) {
  35173. var width = _ref.width,
  35174. height = _ref.height;
  35175. return width * height;
  35176. }
  35177. /**
  35178. * Utility used to transform the `auto` placement to the placement with more
  35179. * available space.
  35180. * @method
  35181. * @memberof Popper.Utils
  35182. * @argument {Object} data - The data object generated by update method
  35183. * @argument {Object} options - Modifiers configuration and options
  35184. * @returns {Object} The data object, properly modified
  35185. */
  35186. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35187. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35188. if (placement.indexOf('auto') === -1) {
  35189. return placement;
  35190. }
  35191. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35192. var rects = {
  35193. top: {
  35194. width: boundaries.width,
  35195. height: refRect.top - boundaries.top
  35196. },
  35197. right: {
  35198. width: boundaries.right - refRect.right,
  35199. height: boundaries.height
  35200. },
  35201. bottom: {
  35202. width: boundaries.width,
  35203. height: boundaries.bottom - refRect.bottom
  35204. },
  35205. left: {
  35206. width: refRect.left - boundaries.left,
  35207. height: boundaries.height
  35208. }
  35209. };
  35210. var sortedAreas = Object.keys(rects).map(function (key) {
  35211. return _extends({
  35212. key: key
  35213. }, rects[key], {
  35214. area: getArea(rects[key])
  35215. });
  35216. }).sort(function (a, b) {
  35217. return b.area - a.area;
  35218. });
  35219. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35220. var width = _ref2.width,
  35221. height = _ref2.height;
  35222. return width >= popper.clientWidth && height >= popper.clientHeight;
  35223. });
  35224. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35225. var variation = placement.split('-')[1];
  35226. return computedPlacement + (variation ? '-' + variation : '');
  35227. }
  35228. /**
  35229. * Get offsets to the reference element
  35230. * @method
  35231. * @memberof Popper.Utils
  35232. * @param {Object} state
  35233. * @param {Element} popper - the popper element
  35234. * @param {Element} reference - the reference element (the popper will be relative to this)
  35235. * @param {Element} fixedPosition - is in fixed position mode
  35236. * @returns {Object} An object containing the offsets which will be applied to the popper
  35237. */
  35238. function getReferenceOffsets(state, popper, reference) {
  35239. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35240. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35241. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35242. }
  35243. /**
  35244. * Get the outer sizes of the given element (offset size + margins)
  35245. * @method
  35246. * @memberof Popper.Utils
  35247. * @argument {Element} element
  35248. * @returns {Object} object containing width and height properties
  35249. */
  35250. function getOuterSizes(element) {
  35251. var window = element.ownerDocument.defaultView;
  35252. var styles = window.getComputedStyle(element);
  35253. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35254. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35255. var result = {
  35256. width: element.offsetWidth + y,
  35257. height: element.offsetHeight + x
  35258. };
  35259. return result;
  35260. }
  35261. /**
  35262. * Get the opposite placement of the given one
  35263. * @method
  35264. * @memberof Popper.Utils
  35265. * @argument {String} placement
  35266. * @returns {String} flipped placement
  35267. */
  35268. function getOppositePlacement(placement) {
  35269. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35270. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35271. return hash[matched];
  35272. });
  35273. }
  35274. /**
  35275. * Get offsets to the popper
  35276. * @method
  35277. * @memberof Popper.Utils
  35278. * @param {Object} position - CSS position the Popper will get applied
  35279. * @param {HTMLElement} popper - the popper element
  35280. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35281. * @param {String} placement - one of the valid placement options
  35282. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35283. */
  35284. function getPopperOffsets(popper, referenceOffsets, placement) {
  35285. placement = placement.split('-')[0];
  35286. // Get popper node sizes
  35287. var popperRect = getOuterSizes(popper);
  35288. // Add position, width and height to our offsets object
  35289. var popperOffsets = {
  35290. width: popperRect.width,
  35291. height: popperRect.height
  35292. };
  35293. // depending by the popper placement we have to compute its offsets slightly differently
  35294. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35295. var mainSide = isHoriz ? 'top' : 'left';
  35296. var secondarySide = isHoriz ? 'left' : 'top';
  35297. var measurement = isHoriz ? 'height' : 'width';
  35298. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35299. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35300. if (placement === secondarySide) {
  35301. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35302. } else {
  35303. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35304. }
  35305. return popperOffsets;
  35306. }
  35307. /**
  35308. * Mimics the `find` method of Array
  35309. * @method
  35310. * @memberof Popper.Utils
  35311. * @argument {Array} arr
  35312. * @argument prop
  35313. * @argument value
  35314. * @returns index or -1
  35315. */
  35316. function find(arr, check) {
  35317. // use native find if supported
  35318. if (Array.prototype.find) {
  35319. return arr.find(check);
  35320. }
  35321. // use `filter` to obtain the same behavior of `find`
  35322. return arr.filter(check)[0];
  35323. }
  35324. /**
  35325. * Return the index of the matching object
  35326. * @method
  35327. * @memberof Popper.Utils
  35328. * @argument {Array} arr
  35329. * @argument prop
  35330. * @argument value
  35331. * @returns index or -1
  35332. */
  35333. function findIndex(arr, prop, value) {
  35334. // use native findIndex if supported
  35335. if (Array.prototype.findIndex) {
  35336. return arr.findIndex(function (cur) {
  35337. return cur[prop] === value;
  35338. });
  35339. }
  35340. // use `find` + `indexOf` if `findIndex` isn't supported
  35341. var match = find(arr, function (obj) {
  35342. return obj[prop] === value;
  35343. });
  35344. return arr.indexOf(match);
  35345. }
  35346. /**
  35347. * Loop trough the list of modifiers and run them in order,
  35348. * each of them will then edit the data object.
  35349. * @method
  35350. * @memberof Popper.Utils
  35351. * @param {dataObject} data
  35352. * @param {Array} modifiers
  35353. * @param {String} ends - Optional modifier name used as stopper
  35354. * @returns {dataObject}
  35355. */
  35356. function runModifiers(modifiers, data, ends) {
  35357. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35358. modifiersToRun.forEach(function (modifier) {
  35359. if (modifier['function']) {
  35360. // eslint-disable-line dot-notation
  35361. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35362. }
  35363. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35364. if (modifier.enabled && isFunction(fn)) {
  35365. // Add properties to offsets to make them a complete clientRect object
  35366. // we do this before each modifier to make sure the previous one doesn't
  35367. // mess with these values
  35368. data.offsets.popper = getClientRect(data.offsets.popper);
  35369. data.offsets.reference = getClientRect(data.offsets.reference);
  35370. data = fn(data, modifier);
  35371. }
  35372. });
  35373. return data;
  35374. }
  35375. /**
  35376. * Updates the position of the popper, computing the new offsets and applying
  35377. * the new style.<br />
  35378. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35379. * @method
  35380. * @memberof Popper
  35381. */
  35382. function update() {
  35383. // if popper is destroyed, don't perform any further update
  35384. if (this.state.isDestroyed) {
  35385. return;
  35386. }
  35387. var data = {
  35388. instance: this,
  35389. styles: {},
  35390. arrowStyles: {},
  35391. attributes: {},
  35392. flipped: false,
  35393. offsets: {}
  35394. };
  35395. // compute reference element offsets
  35396. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35397. // compute auto placement, store placement inside the data object,
  35398. // modifiers will be able to edit `placement` if needed
  35399. // and refer to originalPlacement to know the original value
  35400. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35401. // store the computed placement inside `originalPlacement`
  35402. data.originalPlacement = data.placement;
  35403. data.positionFixed = this.options.positionFixed;
  35404. // compute the popper offsets
  35405. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35406. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35407. // run the modifiers
  35408. data = runModifiers(this.modifiers, data);
  35409. // the first `update` will call `onCreate` callback
  35410. // the other ones will call `onUpdate` callback
  35411. if (!this.state.isCreated) {
  35412. this.state.isCreated = true;
  35413. this.options.onCreate(data);
  35414. } else {
  35415. this.options.onUpdate(data);
  35416. }
  35417. }
  35418. /**
  35419. * Helper used to know if the given modifier is enabled.
  35420. * @method
  35421. * @memberof Popper.Utils
  35422. * @returns {Boolean}
  35423. */
  35424. function isModifierEnabled(modifiers, modifierName) {
  35425. return modifiers.some(function (_ref) {
  35426. var name = _ref.name,
  35427. enabled = _ref.enabled;
  35428. return enabled && name === modifierName;
  35429. });
  35430. }
  35431. /**
  35432. * Get the prefixed supported property name
  35433. * @method
  35434. * @memberof Popper.Utils
  35435. * @argument {String} property (camelCase)
  35436. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35437. */
  35438. function getSupportedPropertyName(property) {
  35439. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35440. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35441. for (var i = 0; i < prefixes.length; i++) {
  35442. var prefix = prefixes[i];
  35443. var toCheck = prefix ? '' + prefix + upperProp : property;
  35444. if (typeof document.body.style[toCheck] !== 'undefined') {
  35445. return toCheck;
  35446. }
  35447. }
  35448. return null;
  35449. }
  35450. /**
  35451. * Destroys the popper.
  35452. * @method
  35453. * @memberof Popper
  35454. */
  35455. function destroy() {
  35456. this.state.isDestroyed = true;
  35457. // touch DOM only if `applyStyle` modifier is enabled
  35458. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35459. this.popper.removeAttribute('x-placement');
  35460. this.popper.style.position = '';
  35461. this.popper.style.top = '';
  35462. this.popper.style.left = '';
  35463. this.popper.style.right = '';
  35464. this.popper.style.bottom = '';
  35465. this.popper.style.willChange = '';
  35466. this.popper.style[getSupportedPropertyName('transform')] = '';
  35467. }
  35468. this.disableEventListeners();
  35469. // remove the popper if user explicitly asked for the deletion on destroy
  35470. // do not use `remove` because IE11 doesn't support it
  35471. if (this.options.removeOnDestroy) {
  35472. this.popper.parentNode.removeChild(this.popper);
  35473. }
  35474. return this;
  35475. }
  35476. /**
  35477. * Get the window associated with the element
  35478. * @argument {Element} element
  35479. * @returns {Window}
  35480. */
  35481. function getWindow(element) {
  35482. var ownerDocument = element.ownerDocument;
  35483. return ownerDocument ? ownerDocument.defaultView : window;
  35484. }
  35485. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35486. var isBody = scrollParent.nodeName === 'BODY';
  35487. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35488. target.addEventListener(event, callback, { passive: true });
  35489. if (!isBody) {
  35490. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35491. }
  35492. scrollParents.push(target);
  35493. }
  35494. /**
  35495. * Setup needed event listeners used to update the popper position
  35496. * @method
  35497. * @memberof Popper.Utils
  35498. * @private
  35499. */
  35500. function setupEventListeners(reference, options, state, updateBound) {
  35501. // Resize event listener on window
  35502. state.updateBound = updateBound;
  35503. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35504. // Scroll event listener on scroll parents
  35505. var scrollElement = getScrollParent(reference);
  35506. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35507. state.scrollElement = scrollElement;
  35508. state.eventsEnabled = true;
  35509. return state;
  35510. }
  35511. /**
  35512. * It will add resize/scroll events and start recalculating
  35513. * position of the popper element when they are triggered.
  35514. * @method
  35515. * @memberof Popper
  35516. */
  35517. function enableEventListeners() {
  35518. if (!this.state.eventsEnabled) {
  35519. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35520. }
  35521. }
  35522. /**
  35523. * Remove event listeners used to update the popper position
  35524. * @method
  35525. * @memberof Popper.Utils
  35526. * @private
  35527. */
  35528. function removeEventListeners(reference, state) {
  35529. // Remove resize event listener on window
  35530. getWindow(reference).removeEventListener('resize', state.updateBound);
  35531. // Remove scroll event listener on scroll parents
  35532. state.scrollParents.forEach(function (target) {
  35533. target.removeEventListener('scroll', state.updateBound);
  35534. });
  35535. // Reset state
  35536. state.updateBound = null;
  35537. state.scrollParents = [];
  35538. state.scrollElement = null;
  35539. state.eventsEnabled = false;
  35540. return state;
  35541. }
  35542. /**
  35543. * It will remove resize/scroll events and won't recalculate popper position
  35544. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35545. * unless you call `update` method manually.
  35546. * @method
  35547. * @memberof Popper
  35548. */
  35549. function disableEventListeners() {
  35550. if (this.state.eventsEnabled) {
  35551. cancelAnimationFrame(this.scheduleUpdate);
  35552. this.state = removeEventListeners(this.reference, this.state);
  35553. }
  35554. }
  35555. /**
  35556. * Tells if a given input is a number
  35557. * @method
  35558. * @memberof Popper.Utils
  35559. * @param {*} input to check
  35560. * @return {Boolean}
  35561. */
  35562. function isNumeric(n) {
  35563. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35564. }
  35565. /**
  35566. * Set the style to the given popper
  35567. * @method
  35568. * @memberof Popper.Utils
  35569. * @argument {Element} element - Element to apply the style to
  35570. * @argument {Object} styles
  35571. * Object with a list of properties and values which will be applied to the element
  35572. */
  35573. function setStyles(element, styles) {
  35574. Object.keys(styles).forEach(function (prop) {
  35575. var unit = '';
  35576. // add unit if the value is numeric and is one of the following
  35577. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35578. unit = 'px';
  35579. }
  35580. element.style[prop] = styles[prop] + unit;
  35581. });
  35582. }
  35583. /**
  35584. * Set the attributes to the given popper
  35585. * @method
  35586. * @memberof Popper.Utils
  35587. * @argument {Element} element - Element to apply the attributes to
  35588. * @argument {Object} styles
  35589. * Object with a list of properties and values which will be applied to the element
  35590. */
  35591. function setAttributes(element, attributes) {
  35592. Object.keys(attributes).forEach(function (prop) {
  35593. var value = attributes[prop];
  35594. if (value !== false) {
  35595. element.setAttribute(prop, attributes[prop]);
  35596. } else {
  35597. element.removeAttribute(prop);
  35598. }
  35599. });
  35600. }
  35601. /**
  35602. * @function
  35603. * @memberof Modifiers
  35604. * @argument {Object} data - The data object generated by `update` method
  35605. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35606. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35607. * @argument {Object} options - Modifiers configuration and options
  35608. * @returns {Object} The same data object
  35609. */
  35610. function applyStyle(data) {
  35611. // any property present in `data.styles` will be applied to the popper,
  35612. // in this way we can make the 3rd party modifiers add custom styles to it
  35613. // Be aware, modifiers could override the properties defined in the previous
  35614. // lines of this modifier!
  35615. setStyles(data.instance.popper, data.styles);
  35616. // any property present in `data.attributes` will be applied to the popper,
  35617. // they will be set as HTML attributes of the element
  35618. setAttributes(data.instance.popper, data.attributes);
  35619. // if arrowElement is defined and arrowStyles has some properties
  35620. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35621. setStyles(data.arrowElement, data.arrowStyles);
  35622. }
  35623. return data;
  35624. }
  35625. /**
  35626. * Set the x-placement attribute before everything else because it could be used
  35627. * to add margins to the popper margins needs to be calculated to get the
  35628. * correct popper offsets.
  35629. * @method
  35630. * @memberof Popper.modifiers
  35631. * @param {HTMLElement} reference - The reference element used to position the popper
  35632. * @param {HTMLElement} popper - The HTML element used as popper
  35633. * @param {Object} options - Popper.js options
  35634. */
  35635. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35636. // compute reference element offsets
  35637. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35638. // compute auto placement, store placement inside the data object,
  35639. // modifiers will be able to edit `placement` if needed
  35640. // and refer to originalPlacement to know the original value
  35641. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35642. popper.setAttribute('x-placement', placement);
  35643. // Apply `position` to popper before anything else because
  35644. // without the position applied we can't guarantee correct computations
  35645. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35646. return options;
  35647. }
  35648. /**
  35649. * @function
  35650. * @memberof Popper.Utils
  35651. * @argument {Object} data - The data object generated by `update` method
  35652. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35653. * @returns {Object} The popper's position offsets rounded
  35654. *
  35655. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35656. * good as it can be within reason.
  35657. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35658. *
  35659. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35660. * as well on High DPI screens).
  35661. *
  35662. * Firefox prefers no rounding for positioning and does not have blurriness on
  35663. * high DPI screens.
  35664. *
  35665. * Only horizontal placement and left/right values need to be considered.
  35666. */
  35667. function getRoundedOffsets(data, shouldRound) {
  35668. var _data$offsets = data.offsets,
  35669. popper = _data$offsets.popper,
  35670. reference = _data$offsets.reference;
  35671. var round = Math.round,
  35672. floor = Math.floor;
  35673. var noRound = function noRound(v) {
  35674. return v;
  35675. };
  35676. var referenceWidth = round(reference.width);
  35677. var popperWidth = round(popper.width);
  35678. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35679. var isVariation = data.placement.indexOf('-') !== -1;
  35680. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35681. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35682. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35683. var verticalToInteger = !shouldRound ? noRound : round;
  35684. return {
  35685. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35686. top: verticalToInteger(popper.top),
  35687. bottom: verticalToInteger(popper.bottom),
  35688. right: horizontalToInteger(popper.right)
  35689. };
  35690. }
  35691. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35692. /**
  35693. * @function
  35694. * @memberof Modifiers
  35695. * @argument {Object} data - The data object generated by `update` method
  35696. * @argument {Object} options - Modifiers configuration and options
  35697. * @returns {Object} The data object, properly modified
  35698. */
  35699. function computeStyle(data, options) {
  35700. var x = options.x,
  35701. y = options.y;
  35702. var popper = data.offsets.popper;
  35703. // Remove this legacy support in Popper.js v2
  35704. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35705. return modifier.name === 'applyStyle';
  35706. }).gpuAcceleration;
  35707. if (legacyGpuAccelerationOption !== undefined) {
  35708. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35709. }
  35710. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35711. var offsetParent = getOffsetParent(data.instance.popper);
  35712. var offsetParentRect = getBoundingClientRect(offsetParent);
  35713. // Styles
  35714. var styles = {
  35715. position: popper.position
  35716. };
  35717. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35718. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35719. var sideB = y === 'right' ? 'left' : 'right';
  35720. // if gpuAcceleration is set to `true` and transform is supported,
  35721. // we use `translate3d` to apply the position to the popper we
  35722. // automatically use the supported prefixed version if needed
  35723. var prefixedProperty = getSupportedPropertyName('transform');
  35724. // now, let's make a step back and look at this code closely (wtf?)
  35725. // If the content of the popper grows once it's been positioned, it
  35726. // may happen that the popper gets misplaced because of the new content
  35727. // overflowing its reference element
  35728. // To avoid this problem, we provide two options (x and y), which allow
  35729. // the consumer to define the offset origin.
  35730. // If we position a popper on top of a reference element, we can set
  35731. // `x` to `top` to make the popper grow towards its top instead of
  35732. // its bottom.
  35733. var left = void 0,
  35734. top = void 0;
  35735. if (sideA === 'bottom') {
  35736. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35737. // and not the bottom of the html element
  35738. if (offsetParent.nodeName === 'HTML') {
  35739. top = -offsetParent.clientHeight + offsets.bottom;
  35740. } else {
  35741. top = -offsetParentRect.height + offsets.bottom;
  35742. }
  35743. } else {
  35744. top = offsets.top;
  35745. }
  35746. if (sideB === 'right') {
  35747. if (offsetParent.nodeName === 'HTML') {
  35748. left = -offsetParent.clientWidth + offsets.right;
  35749. } else {
  35750. left = -offsetParentRect.width + offsets.right;
  35751. }
  35752. } else {
  35753. left = offsets.left;
  35754. }
  35755. if (gpuAcceleration && prefixedProperty) {
  35756. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35757. styles[sideA] = 0;
  35758. styles[sideB] = 0;
  35759. styles.willChange = 'transform';
  35760. } else {
  35761. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35762. var invertTop = sideA === 'bottom' ? -1 : 1;
  35763. var invertLeft = sideB === 'right' ? -1 : 1;
  35764. styles[sideA] = top * invertTop;
  35765. styles[sideB] = left * invertLeft;
  35766. styles.willChange = sideA + ', ' + sideB;
  35767. }
  35768. // Attributes
  35769. var attributes = {
  35770. 'x-placement': data.placement
  35771. };
  35772. // Update `data` attributes, styles and arrowStyles
  35773. data.attributes = _extends({}, attributes, data.attributes);
  35774. data.styles = _extends({}, styles, data.styles);
  35775. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35776. return data;
  35777. }
  35778. /**
  35779. * Helper used to know if the given modifier depends from another one.<br />
  35780. * It checks if the needed modifier is listed and enabled.
  35781. * @method
  35782. * @memberof Popper.Utils
  35783. * @param {Array} modifiers - list of modifiers
  35784. * @param {String} requestingName - name of requesting modifier
  35785. * @param {String} requestedName - name of requested modifier
  35786. * @returns {Boolean}
  35787. */
  35788. function isModifierRequired(modifiers, requestingName, requestedName) {
  35789. var requesting = find(modifiers, function (_ref) {
  35790. var name = _ref.name;
  35791. return name === requestingName;
  35792. });
  35793. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35794. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35795. });
  35796. if (!isRequired) {
  35797. var _requesting = '`' + requestingName + '`';
  35798. var requested = '`' + requestedName + '`';
  35799. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35800. }
  35801. return isRequired;
  35802. }
  35803. /**
  35804. * @function
  35805. * @memberof Modifiers
  35806. * @argument {Object} data - The data object generated by update method
  35807. * @argument {Object} options - Modifiers configuration and options
  35808. * @returns {Object} The data object, properly modified
  35809. */
  35810. function arrow(data, options) {
  35811. var _data$offsets$arrow;
  35812. // arrow depends on keepTogether in order to work
  35813. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35814. return data;
  35815. }
  35816. var arrowElement = options.element;
  35817. // if arrowElement is a string, suppose it's a CSS selector
  35818. if (typeof arrowElement === 'string') {
  35819. arrowElement = data.instance.popper.querySelector(arrowElement);
  35820. // if arrowElement is not found, don't run the modifier
  35821. if (!arrowElement) {
  35822. return data;
  35823. }
  35824. } else {
  35825. // if the arrowElement isn't a query selector we must check that the
  35826. // provided DOM node is child of its popper node
  35827. if (!data.instance.popper.contains(arrowElement)) {
  35828. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35829. return data;
  35830. }
  35831. }
  35832. var placement = data.placement.split('-')[0];
  35833. var _data$offsets = data.offsets,
  35834. popper = _data$offsets.popper,
  35835. reference = _data$offsets.reference;
  35836. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35837. var len = isVertical ? 'height' : 'width';
  35838. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35839. var side = sideCapitalized.toLowerCase();
  35840. var altSide = isVertical ? 'left' : 'top';
  35841. var opSide = isVertical ? 'bottom' : 'right';
  35842. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35843. //
  35844. // extends keepTogether behavior making sure the popper and its
  35845. // reference have enough pixels in conjunction
  35846. //
  35847. // top/left side
  35848. if (reference[opSide] - arrowElementSize < popper[side]) {
  35849. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35850. }
  35851. // bottom/right side
  35852. if (reference[side] + arrowElementSize > popper[opSide]) {
  35853. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35854. }
  35855. data.offsets.popper = getClientRect(data.offsets.popper);
  35856. // compute center of the popper
  35857. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35858. // Compute the sideValue using the updated popper offsets
  35859. // take popper margin in account because we don't have this info available
  35860. var css = getStyleComputedProperty(data.instance.popper);
  35861. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35862. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35863. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35864. // prevent arrowElement from being placed not contiguously to its popper
  35865. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35866. data.arrowElement = arrowElement;
  35867. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35868. return data;
  35869. }
  35870. /**
  35871. * Get the opposite placement variation of the given one
  35872. * @method
  35873. * @memberof Popper.Utils
  35874. * @argument {String} placement variation
  35875. * @returns {String} flipped placement variation
  35876. */
  35877. function getOppositeVariation(variation) {
  35878. if (variation === 'end') {
  35879. return 'start';
  35880. } else if (variation === 'start') {
  35881. return 'end';
  35882. }
  35883. return variation;
  35884. }
  35885. /**
  35886. * List of accepted placements to use as values of the `placement` option.<br />
  35887. * Valid placements are:
  35888. * - `auto`
  35889. * - `top`
  35890. * - `right`
  35891. * - `bottom`
  35892. * - `left`
  35893. *
  35894. * Each placement can have a variation from this list:
  35895. * - `-start`
  35896. * - `-end`
  35897. *
  35898. * Variations are interpreted easily if you think of them as the left to right
  35899. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35900. * is right.<br />
  35901. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35902. *
  35903. * Some valid examples are:
  35904. * - `top-end` (on top of reference, right aligned)
  35905. * - `right-start` (on right of reference, top aligned)
  35906. * - `bottom` (on bottom, centered)
  35907. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35908. *
  35909. * @static
  35910. * @type {Array}
  35911. * @enum {String}
  35912. * @readonly
  35913. * @method placements
  35914. * @memberof Popper
  35915. */
  35916. 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'];
  35917. // Get rid of `auto` `auto-start` and `auto-end`
  35918. var validPlacements = placements.slice(3);
  35919. /**
  35920. * Given an initial placement, returns all the subsequent placements
  35921. * clockwise (or counter-clockwise).
  35922. *
  35923. * @method
  35924. * @memberof Popper.Utils
  35925. * @argument {String} placement - A valid placement (it accepts variations)
  35926. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35927. * @returns {Array} placements including their variations
  35928. */
  35929. function clockwise(placement) {
  35930. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35931. var index = validPlacements.indexOf(placement);
  35932. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35933. return counter ? arr.reverse() : arr;
  35934. }
  35935. var BEHAVIORS = {
  35936. FLIP: 'flip',
  35937. CLOCKWISE: 'clockwise',
  35938. COUNTERCLOCKWISE: 'counterclockwise'
  35939. };
  35940. /**
  35941. * @function
  35942. * @memberof Modifiers
  35943. * @argument {Object} data - The data object generated by update method
  35944. * @argument {Object} options - Modifiers configuration and options
  35945. * @returns {Object} The data object, properly modified
  35946. */
  35947. function flip(data, options) {
  35948. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35949. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35950. return data;
  35951. }
  35952. if (data.flipped && data.placement === data.originalPlacement) {
  35953. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35954. return data;
  35955. }
  35956. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35957. var placement = data.placement.split('-')[0];
  35958. var placementOpposite = getOppositePlacement(placement);
  35959. var variation = data.placement.split('-')[1] || '';
  35960. var flipOrder = [];
  35961. switch (options.behavior) {
  35962. case BEHAVIORS.FLIP:
  35963. flipOrder = [placement, placementOpposite];
  35964. break;
  35965. case BEHAVIORS.CLOCKWISE:
  35966. flipOrder = clockwise(placement);
  35967. break;
  35968. case BEHAVIORS.COUNTERCLOCKWISE:
  35969. flipOrder = clockwise(placement, true);
  35970. break;
  35971. default:
  35972. flipOrder = options.behavior;
  35973. }
  35974. flipOrder.forEach(function (step, index) {
  35975. if (placement !== step || flipOrder.length === index + 1) {
  35976. return data;
  35977. }
  35978. placement = data.placement.split('-')[0];
  35979. placementOpposite = getOppositePlacement(placement);
  35980. var popperOffsets = data.offsets.popper;
  35981. var refOffsets = data.offsets.reference;
  35982. // using floor because the reference offsets may contain decimals we are not going to consider here
  35983. var floor = Math.floor;
  35984. 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);
  35985. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35986. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35987. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35988. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35989. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35990. // flip the variation if required
  35991. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35992. // flips variation if reference element overflows boundaries
  35993. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35994. // flips variation if popper content overflows boundaries
  35995. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35996. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35997. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35998. // this boolean to detect any flip loop
  35999. data.flipped = true;
  36000. if (overlapsRef || overflowsBoundaries) {
  36001. placement = flipOrder[index + 1];
  36002. }
  36003. if (flippedVariation) {
  36004. variation = getOppositeVariation(variation);
  36005. }
  36006. data.placement = placement + (variation ? '-' + variation : '');
  36007. // this object contains `position`, we want to preserve it along with
  36008. // any additional property we may add in the future
  36009. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36010. data = runModifiers(data.instance.modifiers, data, 'flip');
  36011. }
  36012. });
  36013. return data;
  36014. }
  36015. /**
  36016. * @function
  36017. * @memberof Modifiers
  36018. * @argument {Object} data - The data object generated by update method
  36019. * @argument {Object} options - Modifiers configuration and options
  36020. * @returns {Object} The data object, properly modified
  36021. */
  36022. function keepTogether(data) {
  36023. var _data$offsets = data.offsets,
  36024. popper = _data$offsets.popper,
  36025. reference = _data$offsets.reference;
  36026. var placement = data.placement.split('-')[0];
  36027. var floor = Math.floor;
  36028. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36029. var side = isVertical ? 'right' : 'bottom';
  36030. var opSide = isVertical ? 'left' : 'top';
  36031. var measurement = isVertical ? 'width' : 'height';
  36032. if (popper[side] < floor(reference[opSide])) {
  36033. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36034. }
  36035. if (popper[opSide] > floor(reference[side])) {
  36036. data.offsets.popper[opSide] = floor(reference[side]);
  36037. }
  36038. return data;
  36039. }
  36040. /**
  36041. * Converts a string containing value + unit into a px value number
  36042. * @function
  36043. * @memberof {modifiers~offset}
  36044. * @private
  36045. * @argument {String} str - Value + unit string
  36046. * @argument {String} measurement - `height` or `width`
  36047. * @argument {Object} popperOffsets
  36048. * @argument {Object} referenceOffsets
  36049. * @returns {Number|String}
  36050. * Value in pixels, or original string if no values were extracted
  36051. */
  36052. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36053. // separate value from unit
  36054. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36055. var value = +split[1];
  36056. var unit = split[2];
  36057. // If it's not a number it's an operator, I guess
  36058. if (!value) {
  36059. return str;
  36060. }
  36061. if (unit.indexOf('%') === 0) {
  36062. var element = void 0;
  36063. switch (unit) {
  36064. case '%p':
  36065. element = popperOffsets;
  36066. break;
  36067. case '%':
  36068. case '%r':
  36069. default:
  36070. element = referenceOffsets;
  36071. }
  36072. var rect = getClientRect(element);
  36073. return rect[measurement] / 100 * value;
  36074. } else if (unit === 'vh' || unit === 'vw') {
  36075. // if is a vh or vw, we calculate the size based on the viewport
  36076. var size = void 0;
  36077. if (unit === 'vh') {
  36078. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36079. } else {
  36080. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36081. }
  36082. return size / 100 * value;
  36083. } else {
  36084. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36085. // if is an implicit unit, it's px, and we return just the value
  36086. return value;
  36087. }
  36088. }
  36089. /**
  36090. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36091. * @function
  36092. * @memberof {modifiers~offset}
  36093. * @private
  36094. * @argument {String} offset
  36095. * @argument {Object} popperOffsets
  36096. * @argument {Object} referenceOffsets
  36097. * @argument {String} basePlacement
  36098. * @returns {Array} a two cells array with x and y offsets in numbers
  36099. */
  36100. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36101. var offsets = [0, 0];
  36102. // Use height if placement is left or right and index is 0 otherwise use width
  36103. // in this way the first offset will use an axis and the second one
  36104. // will use the other one
  36105. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36106. // Split the offset string to obtain a list of values and operands
  36107. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36108. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36109. return frag.trim();
  36110. });
  36111. // Detect if the offset string contains a pair of values or a single one
  36112. // they could be separated by comma or space
  36113. var divider = fragments.indexOf(find(fragments, function (frag) {
  36114. return frag.search(/,|\s/) !== -1;
  36115. }));
  36116. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36117. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36118. }
  36119. // If divider is found, we divide the list of values and operands to divide
  36120. // them by ofset X and Y.
  36121. var splitRegex = /\s*,\s*|\s+/;
  36122. 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];
  36123. // Convert the values with units to absolute pixels to allow our computations
  36124. ops = ops.map(function (op, index) {
  36125. // Most of the units rely on the orientation of the popper
  36126. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36127. var mergeWithPrevious = false;
  36128. return op
  36129. // This aggregates any `+` or `-` sign that aren't considered operators
  36130. // e.g.: 10 + +5 => [10, +, +5]
  36131. .reduce(function (a, b) {
  36132. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36133. a[a.length - 1] = b;
  36134. mergeWithPrevious = true;
  36135. return a;
  36136. } else if (mergeWithPrevious) {
  36137. a[a.length - 1] += b;
  36138. mergeWithPrevious = false;
  36139. return a;
  36140. } else {
  36141. return a.concat(b);
  36142. }
  36143. }, [])
  36144. // Here we convert the string values into number values (in px)
  36145. .map(function (str) {
  36146. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36147. });
  36148. });
  36149. // Loop trough the offsets arrays and execute the operations
  36150. ops.forEach(function (op, index) {
  36151. op.forEach(function (frag, index2) {
  36152. if (isNumeric(frag)) {
  36153. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36154. }
  36155. });
  36156. });
  36157. return offsets;
  36158. }
  36159. /**
  36160. * @function
  36161. * @memberof Modifiers
  36162. * @argument {Object} data - The data object generated by update method
  36163. * @argument {Object} options - Modifiers configuration and options
  36164. * @argument {Number|String} options.offset=0
  36165. * The offset value as described in the modifier description
  36166. * @returns {Object} The data object, properly modified
  36167. */
  36168. function offset(data, _ref) {
  36169. var offset = _ref.offset;
  36170. var placement = data.placement,
  36171. _data$offsets = data.offsets,
  36172. popper = _data$offsets.popper,
  36173. reference = _data$offsets.reference;
  36174. var basePlacement = placement.split('-')[0];
  36175. var offsets = void 0;
  36176. if (isNumeric(+offset)) {
  36177. offsets = [+offset, 0];
  36178. } else {
  36179. offsets = parseOffset(offset, popper, reference, basePlacement);
  36180. }
  36181. if (basePlacement === 'left') {
  36182. popper.top += offsets[0];
  36183. popper.left -= offsets[1];
  36184. } else if (basePlacement === 'right') {
  36185. popper.top += offsets[0];
  36186. popper.left += offsets[1];
  36187. } else if (basePlacement === 'top') {
  36188. popper.left += offsets[0];
  36189. popper.top -= offsets[1];
  36190. } else if (basePlacement === 'bottom') {
  36191. popper.left += offsets[0];
  36192. popper.top += offsets[1];
  36193. }
  36194. data.popper = popper;
  36195. return data;
  36196. }
  36197. /**
  36198. * @function
  36199. * @memberof Modifiers
  36200. * @argument {Object} data - The data object generated by `update` method
  36201. * @argument {Object} options - Modifiers configuration and options
  36202. * @returns {Object} The data object, properly modified
  36203. */
  36204. function preventOverflow(data, options) {
  36205. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36206. // If offsetParent is the reference element, we really want to
  36207. // go one step up and use the next offsetParent as reference to
  36208. // avoid to make this modifier completely useless and look like broken
  36209. if (data.instance.reference === boundariesElement) {
  36210. boundariesElement = getOffsetParent(boundariesElement);
  36211. }
  36212. // NOTE: DOM access here
  36213. // resets the popper's position so that the document size can be calculated excluding
  36214. // the size of the popper element itself
  36215. var transformProp = getSupportedPropertyName('transform');
  36216. var popperStyles = data.instance.popper.style; // assignment to help minification
  36217. var top = popperStyles.top,
  36218. left = popperStyles.left,
  36219. transform = popperStyles[transformProp];
  36220. popperStyles.top = '';
  36221. popperStyles.left = '';
  36222. popperStyles[transformProp] = '';
  36223. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36224. // NOTE: DOM access here
  36225. // restores the original style properties after the offsets have been computed
  36226. popperStyles.top = top;
  36227. popperStyles.left = left;
  36228. popperStyles[transformProp] = transform;
  36229. options.boundaries = boundaries;
  36230. var order = options.priority;
  36231. var popper = data.offsets.popper;
  36232. var check = {
  36233. primary: function primary(placement) {
  36234. var value = popper[placement];
  36235. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36236. value = Math.max(popper[placement], boundaries[placement]);
  36237. }
  36238. return defineProperty({}, placement, value);
  36239. },
  36240. secondary: function secondary(placement) {
  36241. var mainSide = placement === 'right' ? 'left' : 'top';
  36242. var value = popper[mainSide];
  36243. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36244. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36245. }
  36246. return defineProperty({}, mainSide, value);
  36247. }
  36248. };
  36249. order.forEach(function (placement) {
  36250. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36251. popper = _extends({}, popper, check[side](placement));
  36252. });
  36253. data.offsets.popper = popper;
  36254. return data;
  36255. }
  36256. /**
  36257. * @function
  36258. * @memberof Modifiers
  36259. * @argument {Object} data - The data object generated by `update` method
  36260. * @argument {Object} options - Modifiers configuration and options
  36261. * @returns {Object} The data object, properly modified
  36262. */
  36263. function shift(data) {
  36264. var placement = data.placement;
  36265. var basePlacement = placement.split('-')[0];
  36266. var shiftvariation = placement.split('-')[1];
  36267. // if shift shiftvariation is specified, run the modifier
  36268. if (shiftvariation) {
  36269. var _data$offsets = data.offsets,
  36270. reference = _data$offsets.reference,
  36271. popper = _data$offsets.popper;
  36272. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36273. var side = isVertical ? 'left' : 'top';
  36274. var measurement = isVertical ? 'width' : 'height';
  36275. var shiftOffsets = {
  36276. start: defineProperty({}, side, reference[side]),
  36277. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36278. };
  36279. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36280. }
  36281. return data;
  36282. }
  36283. /**
  36284. * @function
  36285. * @memberof Modifiers
  36286. * @argument {Object} data - The data object generated by update method
  36287. * @argument {Object} options - Modifiers configuration and options
  36288. * @returns {Object} The data object, properly modified
  36289. */
  36290. function hide(data) {
  36291. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36292. return data;
  36293. }
  36294. var refRect = data.offsets.reference;
  36295. var bound = find(data.instance.modifiers, function (modifier) {
  36296. return modifier.name === 'preventOverflow';
  36297. }).boundaries;
  36298. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36299. // Avoid unnecessary DOM access if visibility hasn't changed
  36300. if (data.hide === true) {
  36301. return data;
  36302. }
  36303. data.hide = true;
  36304. data.attributes['x-out-of-boundaries'] = '';
  36305. } else {
  36306. // Avoid unnecessary DOM access if visibility hasn't changed
  36307. if (data.hide === false) {
  36308. return data;
  36309. }
  36310. data.hide = false;
  36311. data.attributes['x-out-of-boundaries'] = false;
  36312. }
  36313. return data;
  36314. }
  36315. /**
  36316. * @function
  36317. * @memberof Modifiers
  36318. * @argument {Object} data - The data object generated by `update` method
  36319. * @argument {Object} options - Modifiers configuration and options
  36320. * @returns {Object} The data object, properly modified
  36321. */
  36322. function inner(data) {
  36323. var placement = data.placement;
  36324. var basePlacement = placement.split('-')[0];
  36325. var _data$offsets = data.offsets,
  36326. popper = _data$offsets.popper,
  36327. reference = _data$offsets.reference;
  36328. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36329. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36330. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36331. data.placement = getOppositePlacement(placement);
  36332. data.offsets.popper = getClientRect(popper);
  36333. return data;
  36334. }
  36335. /**
  36336. * Modifier function, each modifier can have a function of this type assigned
  36337. * to its `fn` property.<br />
  36338. * These functions will be called on each update, this means that you must
  36339. * make sure they are performant enough to avoid performance bottlenecks.
  36340. *
  36341. * @function ModifierFn
  36342. * @argument {dataObject} data - The data object generated by `update` method
  36343. * @argument {Object} options - Modifiers configuration and options
  36344. * @returns {dataObject} The data object, properly modified
  36345. */
  36346. /**
  36347. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36348. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36349. * needed by the library.
  36350. *
  36351. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36352. * All the other properties are configurations that could be tweaked.
  36353. * @namespace modifiers
  36354. */
  36355. var modifiers = {
  36356. /**
  36357. * Modifier used to shift the popper on the start or end of its reference
  36358. * element.<br />
  36359. * It will read the variation of the `placement` property.<br />
  36360. * It can be one either `-end` or `-start`.
  36361. * @memberof modifiers
  36362. * @inner
  36363. */
  36364. shift: {
  36365. /** @prop {number} order=100 - Index used to define the order of execution */
  36366. order: 100,
  36367. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36368. enabled: true,
  36369. /** @prop {ModifierFn} */
  36370. fn: shift
  36371. },
  36372. /**
  36373. * The `offset` modifier can shift your popper on both its axis.
  36374. *
  36375. * It accepts the following units:
  36376. * - `px` or unit-less, interpreted as pixels
  36377. * - `%` or `%r`, percentage relative to the length of the reference element
  36378. * - `%p`, percentage relative to the length of the popper element
  36379. * - `vw`, CSS viewport width unit
  36380. * - `vh`, CSS viewport height unit
  36381. *
  36382. * For length is intended the main axis relative to the placement of the popper.<br />
  36383. * This means that if the placement is `top` or `bottom`, the length will be the
  36384. * `width`. In case of `left` or `right`, it will be the `height`.
  36385. *
  36386. * You can provide a single value (as `Number` or `String`), or a pair of values
  36387. * as `String` divided by a comma or one (or more) white spaces.<br />
  36388. * The latter is a deprecated method because it leads to confusion and will be
  36389. * removed in v2.<br />
  36390. * Additionally, it accepts additions and subtractions between different units.
  36391. * Note that multiplications and divisions aren't supported.
  36392. *
  36393. * Valid examples are:
  36394. * ```
  36395. * 10
  36396. * '10%'
  36397. * '10, 10'
  36398. * '10%, 10'
  36399. * '10 + 10%'
  36400. * '10 - 5vh + 3%'
  36401. * '-10px + 5vh, 5px - 6%'
  36402. * ```
  36403. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36404. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36405. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36406. *
  36407. * @memberof modifiers
  36408. * @inner
  36409. */
  36410. offset: {
  36411. /** @prop {number} order=200 - Index used to define the order of execution */
  36412. order: 200,
  36413. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36414. enabled: true,
  36415. /** @prop {ModifierFn} */
  36416. fn: offset,
  36417. /** @prop {Number|String} offset=0
  36418. * The offset value as described in the modifier description
  36419. */
  36420. offset: 0
  36421. },
  36422. /**
  36423. * Modifier used to prevent the popper from being positioned outside the boundary.
  36424. *
  36425. * A scenario exists where the reference itself is not within the boundaries.<br />
  36426. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36427. * In this case we need to decide whether the popper should either:
  36428. *
  36429. * - detach from the reference and remain "trapped" in the boundaries, or
  36430. * - if it should ignore the boundary and "escape with its reference"
  36431. *
  36432. * When `escapeWithReference` is set to`true` and reference is completely
  36433. * outside its boundaries, the popper will overflow (or completely leave)
  36434. * the boundaries in order to remain attached to the edge of the reference.
  36435. *
  36436. * @memberof modifiers
  36437. * @inner
  36438. */
  36439. preventOverflow: {
  36440. /** @prop {number} order=300 - Index used to define the order of execution */
  36441. order: 300,
  36442. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36443. enabled: true,
  36444. /** @prop {ModifierFn} */
  36445. fn: preventOverflow,
  36446. /**
  36447. * @prop {Array} [priority=['left','right','top','bottom']]
  36448. * Popper will try to prevent overflow following these priorities by default,
  36449. * then, it could overflow on the left and on top of the `boundariesElement`
  36450. */
  36451. priority: ['left', 'right', 'top', 'bottom'],
  36452. /**
  36453. * @prop {number} padding=5
  36454. * Amount of pixel used to define a minimum distance between the boundaries
  36455. * and the popper. This makes sure the popper always has a little padding
  36456. * between the edges of its container
  36457. */
  36458. padding: 5,
  36459. /**
  36460. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36461. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36462. * `viewport` or any DOM element.
  36463. */
  36464. boundariesElement: 'scrollParent'
  36465. },
  36466. /**
  36467. * Modifier used to make sure the reference and its popper stay near each other
  36468. * without leaving any gap between the two. Especially useful when the arrow is
  36469. * enabled and you want to ensure that it points to its reference element.
  36470. * It cares only about the first axis. You can still have poppers with margin
  36471. * between the popper and its reference element.
  36472. * @memberof modifiers
  36473. * @inner
  36474. */
  36475. keepTogether: {
  36476. /** @prop {number} order=400 - Index used to define the order of execution */
  36477. order: 400,
  36478. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36479. enabled: true,
  36480. /** @prop {ModifierFn} */
  36481. fn: keepTogether
  36482. },
  36483. /**
  36484. * This modifier is used to move the `arrowElement` of the popper to make
  36485. * sure it is positioned between the reference element and its popper element.
  36486. * It will read the outer size of the `arrowElement` node to detect how many
  36487. * pixels of conjunction are needed.
  36488. *
  36489. * It has no effect if no `arrowElement` is provided.
  36490. * @memberof modifiers
  36491. * @inner
  36492. */
  36493. arrow: {
  36494. /** @prop {number} order=500 - Index used to define the order of execution */
  36495. order: 500,
  36496. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36497. enabled: true,
  36498. /** @prop {ModifierFn} */
  36499. fn: arrow,
  36500. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36501. element: '[x-arrow]'
  36502. },
  36503. /**
  36504. * Modifier used to flip the popper's placement when it starts to overlap its
  36505. * reference element.
  36506. *
  36507. * Requires the `preventOverflow` modifier before it in order to work.
  36508. *
  36509. * **NOTE:** this modifier will interrupt the current update cycle and will
  36510. * restart it if it detects the need to flip the placement.
  36511. * @memberof modifiers
  36512. * @inner
  36513. */
  36514. flip: {
  36515. /** @prop {number} order=600 - Index used to define the order of execution */
  36516. order: 600,
  36517. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36518. enabled: true,
  36519. /** @prop {ModifierFn} */
  36520. fn: flip,
  36521. /**
  36522. * @prop {String|Array} behavior='flip'
  36523. * The behavior used to change the popper's placement. It can be one of
  36524. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36525. * placements (with optional variations)
  36526. */
  36527. behavior: 'flip',
  36528. /**
  36529. * @prop {number} padding=5
  36530. * The popper will flip if it hits the edges of the `boundariesElement`
  36531. */
  36532. padding: 5,
  36533. /**
  36534. * @prop {String|HTMLElement} boundariesElement='viewport'
  36535. * The element which will define the boundaries of the popper position.
  36536. * The popper will never be placed outside of the defined boundaries
  36537. * (except if `keepTogether` is enabled)
  36538. */
  36539. boundariesElement: 'viewport',
  36540. /**
  36541. * @prop {Boolean} flipVariations=false
  36542. * The popper will switch placement variation between `-start` and `-end` when
  36543. * the reference element overlaps its boundaries.
  36544. *
  36545. * The original placement should have a set variation.
  36546. */
  36547. flipVariations: false,
  36548. /**
  36549. * @prop {Boolean} flipVariationsByContent=false
  36550. * The popper will switch placement variation between `-start` and `-end` when
  36551. * the popper element overlaps its reference boundaries.
  36552. *
  36553. * The original placement should have a set variation.
  36554. */
  36555. flipVariationsByContent: false
  36556. },
  36557. /**
  36558. * Modifier used to make the popper flow toward the inner of the reference element.
  36559. * By default, when this modifier is disabled, the popper will be placed outside
  36560. * the reference element.
  36561. * @memberof modifiers
  36562. * @inner
  36563. */
  36564. inner: {
  36565. /** @prop {number} order=700 - Index used to define the order of execution */
  36566. order: 700,
  36567. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36568. enabled: false,
  36569. /** @prop {ModifierFn} */
  36570. fn: inner
  36571. },
  36572. /**
  36573. * Modifier used to hide the popper when its reference element is outside of the
  36574. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36575. * be used to hide with a CSS selector the popper when its reference is
  36576. * out of boundaries.
  36577. *
  36578. * Requires the `preventOverflow` modifier before it in order to work.
  36579. * @memberof modifiers
  36580. * @inner
  36581. */
  36582. hide: {
  36583. /** @prop {number} order=800 - Index used to define the order of execution */
  36584. order: 800,
  36585. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36586. enabled: true,
  36587. /** @prop {ModifierFn} */
  36588. fn: hide
  36589. },
  36590. /**
  36591. * Computes the style that will be applied to the popper element to gets
  36592. * properly positioned.
  36593. *
  36594. * Note that this modifier will not touch the DOM, it just prepares the styles
  36595. * so that `applyStyle` modifier can apply it. This separation is useful
  36596. * in case you need to replace `applyStyle` with a custom implementation.
  36597. *
  36598. * This modifier has `850` as `order` value to maintain backward compatibility
  36599. * with previous versions of Popper.js. Expect the modifiers ordering method
  36600. * to change in future major versions of the library.
  36601. *
  36602. * @memberof modifiers
  36603. * @inner
  36604. */
  36605. computeStyle: {
  36606. /** @prop {number} order=850 - Index used to define the order of execution */
  36607. order: 850,
  36608. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36609. enabled: true,
  36610. /** @prop {ModifierFn} */
  36611. fn: computeStyle,
  36612. /**
  36613. * @prop {Boolean} gpuAcceleration=true
  36614. * If true, it uses the CSS 3D transformation to position the popper.
  36615. * Otherwise, it will use the `top` and `left` properties
  36616. */
  36617. gpuAcceleration: true,
  36618. /**
  36619. * @prop {string} [x='bottom']
  36620. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36621. * Change this if your popper should grow in a direction different from `bottom`
  36622. */
  36623. x: 'bottom',
  36624. /**
  36625. * @prop {string} [x='left']
  36626. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36627. * Change this if your popper should grow in a direction different from `right`
  36628. */
  36629. y: 'right'
  36630. },
  36631. /**
  36632. * Applies the computed styles to the popper element.
  36633. *
  36634. * All the DOM manipulations are limited to this modifier. This is useful in case
  36635. * you want to integrate Popper.js inside a framework or view library and you
  36636. * want to delegate all the DOM manipulations to it.
  36637. *
  36638. * Note that if you disable this modifier, you must make sure the popper element
  36639. * has its position set to `absolute` before Popper.js can do its work!
  36640. *
  36641. * Just disable this modifier and define your own to achieve the desired effect.
  36642. *
  36643. * @memberof modifiers
  36644. * @inner
  36645. */
  36646. applyStyle: {
  36647. /** @prop {number} order=900 - Index used to define the order of execution */
  36648. order: 900,
  36649. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36650. enabled: true,
  36651. /** @prop {ModifierFn} */
  36652. fn: applyStyle,
  36653. /** @prop {Function} */
  36654. onLoad: applyStyleOnLoad,
  36655. /**
  36656. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36657. * @prop {Boolean} gpuAcceleration=true
  36658. * If true, it uses the CSS 3D transformation to position the popper.
  36659. * Otherwise, it will use the `top` and `left` properties
  36660. */
  36661. gpuAcceleration: undefined
  36662. }
  36663. };
  36664. /**
  36665. * The `dataObject` is an object containing all the information used by Popper.js.
  36666. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36667. * @name dataObject
  36668. * @property {Object} data.instance The Popper.js instance
  36669. * @property {String} data.placement Placement applied to popper
  36670. * @property {String} data.originalPlacement Placement originally defined on init
  36671. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36672. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36673. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36674. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36675. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36676. * @property {Object} data.boundaries Offsets of the popper boundaries
  36677. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36678. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36679. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36680. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36681. */
  36682. /**
  36683. * Default options provided to Popper.js constructor.<br />
  36684. * These can be overridden using the `options` argument of Popper.js.<br />
  36685. * To override an option, simply pass an object with the same
  36686. * structure of the `options` object, as the 3rd argument. For example:
  36687. * ```
  36688. * new Popper(ref, pop, {
  36689. * modifiers: {
  36690. * preventOverflow: { enabled: false }
  36691. * }
  36692. * })
  36693. * ```
  36694. * @type {Object}
  36695. * @static
  36696. * @memberof Popper
  36697. */
  36698. var Defaults = {
  36699. /**
  36700. * Popper's placement.
  36701. * @prop {Popper.placements} placement='bottom'
  36702. */
  36703. placement: 'bottom',
  36704. /**
  36705. * Set this to true if you want popper to position it self in 'fixed' mode
  36706. * @prop {Boolean} positionFixed=false
  36707. */
  36708. positionFixed: false,
  36709. /**
  36710. * Whether events (resize, scroll) are initially enabled.
  36711. * @prop {Boolean} eventsEnabled=true
  36712. */
  36713. eventsEnabled: true,
  36714. /**
  36715. * Set to true if you want to automatically remove the popper when
  36716. * you call the `destroy` method.
  36717. * @prop {Boolean} removeOnDestroy=false
  36718. */
  36719. removeOnDestroy: false,
  36720. /**
  36721. * Callback called when the popper is created.<br />
  36722. * By default, it is set to no-op.<br />
  36723. * Access Popper.js instance with `data.instance`.
  36724. * @prop {onCreate}
  36725. */
  36726. onCreate: function onCreate() {},
  36727. /**
  36728. * Callback called when the popper is updated. This callback is not called
  36729. * on the initialization/creation of the popper, but only on subsequent
  36730. * updates.<br />
  36731. * By default, it is set to no-op.<br />
  36732. * Access Popper.js instance with `data.instance`.
  36733. * @prop {onUpdate}
  36734. */
  36735. onUpdate: function onUpdate() {},
  36736. /**
  36737. * List of modifiers used to modify the offsets before they are applied to the popper.
  36738. * They provide most of the functionalities of Popper.js.
  36739. * @prop {modifiers}
  36740. */
  36741. modifiers: modifiers
  36742. };
  36743. /**
  36744. * @callback onCreate
  36745. * @param {dataObject} data
  36746. */
  36747. /**
  36748. * @callback onUpdate
  36749. * @param {dataObject} data
  36750. */
  36751. // Utils
  36752. // Methods
  36753. var Popper = function () {
  36754. /**
  36755. * Creates a new Popper.js instance.
  36756. * @class Popper
  36757. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36758. * @param {Element} popper - The HTML / XML element used as the popper
  36759. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36760. * @return {Object} instance - The generated Popper.js instance
  36761. */
  36762. function Popper(reference, popper) {
  36763. var _this = this;
  36764. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36765. classCallCheck(this, Popper);
  36766. this.scheduleUpdate = function () {
  36767. return requestAnimationFrame(_this.update);
  36768. };
  36769. // make update() debounced, so that it only runs at most once-per-tick
  36770. this.update = debounce(this.update.bind(this));
  36771. // with {} we create a new object with the options inside it
  36772. this.options = _extends({}, Popper.Defaults, options);
  36773. // init state
  36774. this.state = {
  36775. isDestroyed: false,
  36776. isCreated: false,
  36777. scrollParents: []
  36778. };
  36779. // get reference and popper elements (allow jQuery wrappers)
  36780. this.reference = reference && reference.jquery ? reference[0] : reference;
  36781. this.popper = popper && popper.jquery ? popper[0] : popper;
  36782. // Deep merge modifiers options
  36783. this.options.modifiers = {};
  36784. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36785. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36786. });
  36787. // Refactoring modifiers' list (Object => Array)
  36788. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36789. return _extends({
  36790. name: name
  36791. }, _this.options.modifiers[name]);
  36792. })
  36793. // sort the modifiers by order
  36794. .sort(function (a, b) {
  36795. return a.order - b.order;
  36796. });
  36797. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36798. // such code is executed in the same order of its modifier
  36799. // they could add new properties to their options configuration
  36800. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36801. this.modifiers.forEach(function (modifierOptions) {
  36802. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36803. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36804. }
  36805. });
  36806. // fire the first update to position the popper in the right place
  36807. this.update();
  36808. var eventsEnabled = this.options.eventsEnabled;
  36809. if (eventsEnabled) {
  36810. // setup event listeners, they will take care of update the position in specific situations
  36811. this.enableEventListeners();
  36812. }
  36813. this.state.eventsEnabled = eventsEnabled;
  36814. }
  36815. // We can't use class properties because they don't get listed in the
  36816. // class prototype and break stuff like Sinon stubs
  36817. createClass(Popper, [{
  36818. key: 'update',
  36819. value: function update$$1() {
  36820. return update.call(this);
  36821. }
  36822. }, {
  36823. key: 'destroy',
  36824. value: function destroy$$1() {
  36825. return destroy.call(this);
  36826. }
  36827. }, {
  36828. key: 'enableEventListeners',
  36829. value: function enableEventListeners$$1() {
  36830. return enableEventListeners.call(this);
  36831. }
  36832. }, {
  36833. key: 'disableEventListeners',
  36834. value: function disableEventListeners$$1() {
  36835. return disableEventListeners.call(this);
  36836. }
  36837. /**
  36838. * Schedules an update. It will run on the next UI update available.
  36839. * @method scheduleUpdate
  36840. * @memberof Popper
  36841. */
  36842. /**
  36843. * Collection of utilities useful when writing custom modifiers.
  36844. * Starting from version 1.7, this method is available only if you
  36845. * include `popper-utils.js` before `popper.js`.
  36846. *
  36847. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36848. * and will be removed in v2! Use the PopperUtils module directly instead.
  36849. * Due to the high instability of the methods contained in Utils, we can't
  36850. * guarantee them to follow semver. Use them at your own risk!
  36851. * @static
  36852. * @private
  36853. * @type {Object}
  36854. * @deprecated since version 1.8
  36855. * @member Utils
  36856. * @memberof Popper
  36857. */
  36858. }]);
  36859. return Popper;
  36860. }();
  36861. /**
  36862. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36863. * and lets you use it as replacement of a real DOM node.<br />
  36864. * You can use this method to position a popper relatively to a set of coordinates
  36865. * in case you don't have a DOM node to use as reference.
  36866. *
  36867. * ```
  36868. * new Popper(referenceObject, popperNode);
  36869. * ```
  36870. *
  36871. * NB: This feature isn't supported in Internet Explorer 10.
  36872. * @name referenceObject
  36873. * @property {Function} data.getBoundingClientRect
  36874. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36875. * @property {number} data.clientWidth
  36876. * An ES6 getter that will return the width of the virtual reference element.
  36877. * @property {number} data.clientHeight
  36878. * An ES6 getter that will return the height of the virtual reference element.
  36879. */
  36880. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36881. Popper.placements = placements;
  36882. Popper.Defaults = Defaults;
  36883. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36884. //# sourceMappingURL=popper.js.map
  36885. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36886. /***/ }),
  36887. /***/ "./node_modules/process/browser.js":
  36888. /*!*****************************************!*\
  36889. !*** ./node_modules/process/browser.js ***!
  36890. \*****************************************/
  36891. /*! no static exports found */
  36892. /***/ (function(module, exports) {
  36893. // shim for using process in browser
  36894. var process = module.exports = {};
  36895. // cached from whatever global is present so that test runners that stub it
  36896. // don't break things. But we need to wrap it in a try catch in case it is
  36897. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36898. // function because try/catches deoptimize in certain engines.
  36899. var cachedSetTimeout;
  36900. var cachedClearTimeout;
  36901. function defaultSetTimout() {
  36902. throw new Error('setTimeout has not been defined');
  36903. }
  36904. function defaultClearTimeout () {
  36905. throw new Error('clearTimeout has not been defined');
  36906. }
  36907. (function () {
  36908. try {
  36909. if (typeof setTimeout === 'function') {
  36910. cachedSetTimeout = setTimeout;
  36911. } else {
  36912. cachedSetTimeout = defaultSetTimout;
  36913. }
  36914. } catch (e) {
  36915. cachedSetTimeout = defaultSetTimout;
  36916. }
  36917. try {
  36918. if (typeof clearTimeout === 'function') {
  36919. cachedClearTimeout = clearTimeout;
  36920. } else {
  36921. cachedClearTimeout = defaultClearTimeout;
  36922. }
  36923. } catch (e) {
  36924. cachedClearTimeout = defaultClearTimeout;
  36925. }
  36926. } ())
  36927. function runTimeout(fun) {
  36928. if (cachedSetTimeout === setTimeout) {
  36929. //normal enviroments in sane situations
  36930. return setTimeout(fun, 0);
  36931. }
  36932. // if setTimeout wasn't available but was latter defined
  36933. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36934. cachedSetTimeout = setTimeout;
  36935. return setTimeout(fun, 0);
  36936. }
  36937. try {
  36938. // when when somebody has screwed with setTimeout but no I.E. maddness
  36939. return cachedSetTimeout(fun, 0);
  36940. } catch(e){
  36941. try {
  36942. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36943. return cachedSetTimeout.call(null, fun, 0);
  36944. } catch(e){
  36945. // 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
  36946. return cachedSetTimeout.call(this, fun, 0);
  36947. }
  36948. }
  36949. }
  36950. function runClearTimeout(marker) {
  36951. if (cachedClearTimeout === clearTimeout) {
  36952. //normal enviroments in sane situations
  36953. return clearTimeout(marker);
  36954. }
  36955. // if clearTimeout wasn't available but was latter defined
  36956. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36957. cachedClearTimeout = clearTimeout;
  36958. return clearTimeout(marker);
  36959. }
  36960. try {
  36961. // when when somebody has screwed with setTimeout but no I.E. maddness
  36962. return cachedClearTimeout(marker);
  36963. } catch (e){
  36964. try {
  36965. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36966. return cachedClearTimeout.call(null, marker);
  36967. } catch (e){
  36968. // 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.
  36969. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36970. return cachedClearTimeout.call(this, marker);
  36971. }
  36972. }
  36973. }
  36974. var queue = [];
  36975. var draining = false;
  36976. var currentQueue;
  36977. var queueIndex = -1;
  36978. function cleanUpNextTick() {
  36979. if (!draining || !currentQueue) {
  36980. return;
  36981. }
  36982. draining = false;
  36983. if (currentQueue.length) {
  36984. queue = currentQueue.concat(queue);
  36985. } else {
  36986. queueIndex = -1;
  36987. }
  36988. if (queue.length) {
  36989. drainQueue();
  36990. }
  36991. }
  36992. function drainQueue() {
  36993. if (draining) {
  36994. return;
  36995. }
  36996. var timeout = runTimeout(cleanUpNextTick);
  36997. draining = true;
  36998. var len = queue.length;
  36999. while(len) {
  37000. currentQueue = queue;
  37001. queue = [];
  37002. while (++queueIndex < len) {
  37003. if (currentQueue) {
  37004. currentQueue[queueIndex].run();
  37005. }
  37006. }
  37007. queueIndex = -1;
  37008. len = queue.length;
  37009. }
  37010. currentQueue = null;
  37011. draining = false;
  37012. runClearTimeout(timeout);
  37013. }
  37014. process.nextTick = function (fun) {
  37015. var args = new Array(arguments.length - 1);
  37016. if (arguments.length > 1) {
  37017. for (var i = 1; i < arguments.length; i++) {
  37018. args[i - 1] = arguments[i];
  37019. }
  37020. }
  37021. queue.push(new Item(fun, args));
  37022. if (queue.length === 1 && !draining) {
  37023. runTimeout(drainQueue);
  37024. }
  37025. };
  37026. // v8 likes predictible objects
  37027. function Item(fun, array) {
  37028. this.fun = fun;
  37029. this.array = array;
  37030. }
  37031. Item.prototype.run = function () {
  37032. this.fun.apply(null, this.array);
  37033. };
  37034. process.title = 'browser';
  37035. process.browser = true;
  37036. process.env = {};
  37037. process.argv = [];
  37038. process.version = ''; // empty string to avoid regexp issues
  37039. process.versions = {};
  37040. function noop() {}
  37041. process.on = noop;
  37042. process.addListener = noop;
  37043. process.once = noop;
  37044. process.off = noop;
  37045. process.removeListener = noop;
  37046. process.removeAllListeners = noop;
  37047. process.emit = noop;
  37048. process.prependListener = noop;
  37049. process.prependOnceListener = noop;
  37050. process.listeners = function (name) { return [] }
  37051. process.binding = function (name) {
  37052. throw new Error('process.binding is not supported');
  37053. };
  37054. process.cwd = function () { return '/' };
  37055. process.chdir = function (dir) {
  37056. throw new Error('process.chdir is not supported');
  37057. };
  37058. process.umask = function() { return 0; };
  37059. /***/ }),
  37060. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37061. /*!***************************************************!*\
  37062. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37063. \***************************************************/
  37064. /*! no static exports found */
  37065. /***/ (function(module, exports, __webpack_require__) {
  37066. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37067. * Pusher JavaScript Library v5.0.3
  37068. * https://pusher.com/
  37069. *
  37070. * Copyright 2017, Pusher
  37071. * Released under the MIT licence.
  37072. */
  37073. (function webpackUniversalModuleDefinition(root, factory) {
  37074. if(true)
  37075. module.exports = factory();
  37076. else {}
  37077. })(window, function() {
  37078. return /******/ (function(modules) { // webpackBootstrap
  37079. /******/ // The module cache
  37080. /******/ var installedModules = {};
  37081. /******/
  37082. /******/ // The require function
  37083. /******/ function __webpack_require__(moduleId) {
  37084. /******/
  37085. /******/ // Check if module is in cache
  37086. /******/ if(installedModules[moduleId]) {
  37087. /******/ return installedModules[moduleId].exports;
  37088. /******/ }
  37089. /******/ // Create a new module (and put it into the cache)
  37090. /******/ var module = installedModules[moduleId] = {
  37091. /******/ i: moduleId,
  37092. /******/ l: false,
  37093. /******/ exports: {}
  37094. /******/ };
  37095. /******/
  37096. /******/ // Execute the module function
  37097. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37098. /******/
  37099. /******/ // Flag the module as loaded
  37100. /******/ module.l = true;
  37101. /******/
  37102. /******/ // Return the exports of the module
  37103. /******/ return module.exports;
  37104. /******/ }
  37105. /******/
  37106. /******/
  37107. /******/ // expose the modules object (__webpack_modules__)
  37108. /******/ __webpack_require__.m = modules;
  37109. /******/
  37110. /******/ // expose the module cache
  37111. /******/ __webpack_require__.c = installedModules;
  37112. /******/
  37113. /******/ // define getter function for harmony exports
  37114. /******/ __webpack_require__.d = function(exports, name, getter) {
  37115. /******/ if(!__webpack_require__.o(exports, name)) {
  37116. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37117. /******/ }
  37118. /******/ };
  37119. /******/
  37120. /******/ // define __esModule on exports
  37121. /******/ __webpack_require__.r = function(exports) {
  37122. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37123. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37124. /******/ }
  37125. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37126. /******/ };
  37127. /******/
  37128. /******/ // create a fake namespace object
  37129. /******/ // mode & 1: value is a module id, require it
  37130. /******/ // mode & 2: merge all properties of value into the ns
  37131. /******/ // mode & 4: return value when already ns object
  37132. /******/ // mode & 8|1: behave like require
  37133. /******/ __webpack_require__.t = function(value, mode) {
  37134. /******/ if(mode & 1) value = __webpack_require__(value);
  37135. /******/ if(mode & 8) return value;
  37136. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37137. /******/ var ns = Object.create(null);
  37138. /******/ __webpack_require__.r(ns);
  37139. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37140. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37141. /******/ return ns;
  37142. /******/ };
  37143. /******/
  37144. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37145. /******/ __webpack_require__.n = function(module) {
  37146. /******/ var getter = module && module.__esModule ?
  37147. /******/ function getDefault() { return module['default']; } :
  37148. /******/ function getModuleExports() { return module; };
  37149. /******/ __webpack_require__.d(getter, 'a', getter);
  37150. /******/ return getter;
  37151. /******/ };
  37152. /******/
  37153. /******/ // Object.prototype.hasOwnProperty.call
  37154. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37155. /******/
  37156. /******/ // __webpack_public_path__
  37157. /******/ __webpack_require__.p = "";
  37158. /******/
  37159. /******/
  37160. /******/ // Load entry module and return exports
  37161. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37162. /******/ })
  37163. /************************************************************************/
  37164. /******/ ([
  37165. /* 0 */
  37166. /***/ (function(module, exports, __webpack_require__) {
  37167. (function(nacl) {
  37168. 'use strict';
  37169. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37170. // Public domain.
  37171. //
  37172. // Implementation derived from TweetNaCl version 20140427.
  37173. // See for details: http://tweetnacl.cr.yp.to/
  37174. var gf = function(init) {
  37175. var i, r = new Float64Array(16);
  37176. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37177. return r;
  37178. };
  37179. // Pluggable, initialized in high-level API below.
  37180. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37181. var _0 = new Uint8Array(16);
  37182. var _9 = new Uint8Array(32); _9[0] = 9;
  37183. var gf0 = gf(),
  37184. gf1 = gf([1]),
  37185. _121665 = gf([0xdb41, 1]),
  37186. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37187. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37188. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37189. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37190. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37191. function ts64(x, i, h, l) {
  37192. x[i] = (h >> 24) & 0xff;
  37193. x[i+1] = (h >> 16) & 0xff;
  37194. x[i+2] = (h >> 8) & 0xff;
  37195. x[i+3] = h & 0xff;
  37196. x[i+4] = (l >> 24) & 0xff;
  37197. x[i+5] = (l >> 16) & 0xff;
  37198. x[i+6] = (l >> 8) & 0xff;
  37199. x[i+7] = l & 0xff;
  37200. }
  37201. function vn(x, xi, y, yi, n) {
  37202. var i,d = 0;
  37203. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37204. return (1 & ((d - 1) >>> 8)) - 1;
  37205. }
  37206. function crypto_verify_16(x, xi, y, yi) {
  37207. return vn(x,xi,y,yi,16);
  37208. }
  37209. function crypto_verify_32(x, xi, y, yi) {
  37210. return vn(x,xi,y,yi,32);
  37211. }
  37212. function core_salsa20(o, p, k, c) {
  37213. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37214. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37215. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37216. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37217. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37218. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37219. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37220. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37221. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37222. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37223. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37224. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37225. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37226. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37227. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37228. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37229. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37230. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37231. x15 = j15, u;
  37232. for (var i = 0; i < 20; i += 2) {
  37233. u = x0 + x12 | 0;
  37234. x4 ^= u<<7 | u>>>(32-7);
  37235. u = x4 + x0 | 0;
  37236. x8 ^= u<<9 | u>>>(32-9);
  37237. u = x8 + x4 | 0;
  37238. x12 ^= u<<13 | u>>>(32-13);
  37239. u = x12 + x8 | 0;
  37240. x0 ^= u<<18 | u>>>(32-18);
  37241. u = x5 + x1 | 0;
  37242. x9 ^= u<<7 | u>>>(32-7);
  37243. u = x9 + x5 | 0;
  37244. x13 ^= u<<9 | u>>>(32-9);
  37245. u = x13 + x9 | 0;
  37246. x1 ^= u<<13 | u>>>(32-13);
  37247. u = x1 + x13 | 0;
  37248. x5 ^= u<<18 | u>>>(32-18);
  37249. u = x10 + x6 | 0;
  37250. x14 ^= u<<7 | u>>>(32-7);
  37251. u = x14 + x10 | 0;
  37252. x2 ^= u<<9 | u>>>(32-9);
  37253. u = x2 + x14 | 0;
  37254. x6 ^= u<<13 | u>>>(32-13);
  37255. u = x6 + x2 | 0;
  37256. x10 ^= u<<18 | u>>>(32-18);
  37257. u = x15 + x11 | 0;
  37258. x3 ^= u<<7 | u>>>(32-7);
  37259. u = x3 + x15 | 0;
  37260. x7 ^= u<<9 | u>>>(32-9);
  37261. u = x7 + x3 | 0;
  37262. x11 ^= u<<13 | u>>>(32-13);
  37263. u = x11 + x7 | 0;
  37264. x15 ^= u<<18 | u>>>(32-18);
  37265. u = x0 + x3 | 0;
  37266. x1 ^= u<<7 | u>>>(32-7);
  37267. u = x1 + x0 | 0;
  37268. x2 ^= u<<9 | u>>>(32-9);
  37269. u = x2 + x1 | 0;
  37270. x3 ^= u<<13 | u>>>(32-13);
  37271. u = x3 + x2 | 0;
  37272. x0 ^= u<<18 | u>>>(32-18);
  37273. u = x5 + x4 | 0;
  37274. x6 ^= u<<7 | u>>>(32-7);
  37275. u = x6 + x5 | 0;
  37276. x7 ^= u<<9 | u>>>(32-9);
  37277. u = x7 + x6 | 0;
  37278. x4 ^= u<<13 | u>>>(32-13);
  37279. u = x4 + x7 | 0;
  37280. x5 ^= u<<18 | u>>>(32-18);
  37281. u = x10 + x9 | 0;
  37282. x11 ^= u<<7 | u>>>(32-7);
  37283. u = x11 + x10 | 0;
  37284. x8 ^= u<<9 | u>>>(32-9);
  37285. u = x8 + x11 | 0;
  37286. x9 ^= u<<13 | u>>>(32-13);
  37287. u = x9 + x8 | 0;
  37288. x10 ^= u<<18 | u>>>(32-18);
  37289. u = x15 + x14 | 0;
  37290. x12 ^= u<<7 | u>>>(32-7);
  37291. u = x12 + x15 | 0;
  37292. x13 ^= u<<9 | u>>>(32-9);
  37293. u = x13 + x12 | 0;
  37294. x14 ^= u<<13 | u>>>(32-13);
  37295. u = x14 + x13 | 0;
  37296. x15 ^= u<<18 | u>>>(32-18);
  37297. }
  37298. x0 = x0 + j0 | 0;
  37299. x1 = x1 + j1 | 0;
  37300. x2 = x2 + j2 | 0;
  37301. x3 = x3 + j3 | 0;
  37302. x4 = x4 + j4 | 0;
  37303. x5 = x5 + j5 | 0;
  37304. x6 = x6 + j6 | 0;
  37305. x7 = x7 + j7 | 0;
  37306. x8 = x8 + j8 | 0;
  37307. x9 = x9 + j9 | 0;
  37308. x10 = x10 + j10 | 0;
  37309. x11 = x11 + j11 | 0;
  37310. x12 = x12 + j12 | 0;
  37311. x13 = x13 + j13 | 0;
  37312. x14 = x14 + j14 | 0;
  37313. x15 = x15 + j15 | 0;
  37314. o[ 0] = x0 >>> 0 & 0xff;
  37315. o[ 1] = x0 >>> 8 & 0xff;
  37316. o[ 2] = x0 >>> 16 & 0xff;
  37317. o[ 3] = x0 >>> 24 & 0xff;
  37318. o[ 4] = x1 >>> 0 & 0xff;
  37319. o[ 5] = x1 >>> 8 & 0xff;
  37320. o[ 6] = x1 >>> 16 & 0xff;
  37321. o[ 7] = x1 >>> 24 & 0xff;
  37322. o[ 8] = x2 >>> 0 & 0xff;
  37323. o[ 9] = x2 >>> 8 & 0xff;
  37324. o[10] = x2 >>> 16 & 0xff;
  37325. o[11] = x2 >>> 24 & 0xff;
  37326. o[12] = x3 >>> 0 & 0xff;
  37327. o[13] = x3 >>> 8 & 0xff;
  37328. o[14] = x3 >>> 16 & 0xff;
  37329. o[15] = x3 >>> 24 & 0xff;
  37330. o[16] = x4 >>> 0 & 0xff;
  37331. o[17] = x4 >>> 8 & 0xff;
  37332. o[18] = x4 >>> 16 & 0xff;
  37333. o[19] = x4 >>> 24 & 0xff;
  37334. o[20] = x5 >>> 0 & 0xff;
  37335. o[21] = x5 >>> 8 & 0xff;
  37336. o[22] = x5 >>> 16 & 0xff;
  37337. o[23] = x5 >>> 24 & 0xff;
  37338. o[24] = x6 >>> 0 & 0xff;
  37339. o[25] = x6 >>> 8 & 0xff;
  37340. o[26] = x6 >>> 16 & 0xff;
  37341. o[27] = x6 >>> 24 & 0xff;
  37342. o[28] = x7 >>> 0 & 0xff;
  37343. o[29] = x7 >>> 8 & 0xff;
  37344. o[30] = x7 >>> 16 & 0xff;
  37345. o[31] = x7 >>> 24 & 0xff;
  37346. o[32] = x8 >>> 0 & 0xff;
  37347. o[33] = x8 >>> 8 & 0xff;
  37348. o[34] = x8 >>> 16 & 0xff;
  37349. o[35] = x8 >>> 24 & 0xff;
  37350. o[36] = x9 >>> 0 & 0xff;
  37351. o[37] = x9 >>> 8 & 0xff;
  37352. o[38] = x9 >>> 16 & 0xff;
  37353. o[39] = x9 >>> 24 & 0xff;
  37354. o[40] = x10 >>> 0 & 0xff;
  37355. o[41] = x10 >>> 8 & 0xff;
  37356. o[42] = x10 >>> 16 & 0xff;
  37357. o[43] = x10 >>> 24 & 0xff;
  37358. o[44] = x11 >>> 0 & 0xff;
  37359. o[45] = x11 >>> 8 & 0xff;
  37360. o[46] = x11 >>> 16 & 0xff;
  37361. o[47] = x11 >>> 24 & 0xff;
  37362. o[48] = x12 >>> 0 & 0xff;
  37363. o[49] = x12 >>> 8 & 0xff;
  37364. o[50] = x12 >>> 16 & 0xff;
  37365. o[51] = x12 >>> 24 & 0xff;
  37366. o[52] = x13 >>> 0 & 0xff;
  37367. o[53] = x13 >>> 8 & 0xff;
  37368. o[54] = x13 >>> 16 & 0xff;
  37369. o[55] = x13 >>> 24 & 0xff;
  37370. o[56] = x14 >>> 0 & 0xff;
  37371. o[57] = x14 >>> 8 & 0xff;
  37372. o[58] = x14 >>> 16 & 0xff;
  37373. o[59] = x14 >>> 24 & 0xff;
  37374. o[60] = x15 >>> 0 & 0xff;
  37375. o[61] = x15 >>> 8 & 0xff;
  37376. o[62] = x15 >>> 16 & 0xff;
  37377. o[63] = x15 >>> 24 & 0xff;
  37378. }
  37379. function core_hsalsa20(o,p,k,c) {
  37380. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37381. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37382. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37383. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37384. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37385. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37386. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37387. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37388. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37389. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37390. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37391. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37392. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37393. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37394. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37395. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37396. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37397. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37398. x15 = j15, u;
  37399. for (var i = 0; i < 20; i += 2) {
  37400. u = x0 + x12 | 0;
  37401. x4 ^= u<<7 | u>>>(32-7);
  37402. u = x4 + x0 | 0;
  37403. x8 ^= u<<9 | u>>>(32-9);
  37404. u = x8 + x4 | 0;
  37405. x12 ^= u<<13 | u>>>(32-13);
  37406. u = x12 + x8 | 0;
  37407. x0 ^= u<<18 | u>>>(32-18);
  37408. u = x5 + x1 | 0;
  37409. x9 ^= u<<7 | u>>>(32-7);
  37410. u = x9 + x5 | 0;
  37411. x13 ^= u<<9 | u>>>(32-9);
  37412. u = x13 + x9 | 0;
  37413. x1 ^= u<<13 | u>>>(32-13);
  37414. u = x1 + x13 | 0;
  37415. x5 ^= u<<18 | u>>>(32-18);
  37416. u = x10 + x6 | 0;
  37417. x14 ^= u<<7 | u>>>(32-7);
  37418. u = x14 + x10 | 0;
  37419. x2 ^= u<<9 | u>>>(32-9);
  37420. u = x2 + x14 | 0;
  37421. x6 ^= u<<13 | u>>>(32-13);
  37422. u = x6 + x2 | 0;
  37423. x10 ^= u<<18 | u>>>(32-18);
  37424. u = x15 + x11 | 0;
  37425. x3 ^= u<<7 | u>>>(32-7);
  37426. u = x3 + x15 | 0;
  37427. x7 ^= u<<9 | u>>>(32-9);
  37428. u = x7 + x3 | 0;
  37429. x11 ^= u<<13 | u>>>(32-13);
  37430. u = x11 + x7 | 0;
  37431. x15 ^= u<<18 | u>>>(32-18);
  37432. u = x0 + x3 | 0;
  37433. x1 ^= u<<7 | u>>>(32-7);
  37434. u = x1 + x0 | 0;
  37435. x2 ^= u<<9 | u>>>(32-9);
  37436. u = x2 + x1 | 0;
  37437. x3 ^= u<<13 | u>>>(32-13);
  37438. u = x3 + x2 | 0;
  37439. x0 ^= u<<18 | u>>>(32-18);
  37440. u = x5 + x4 | 0;
  37441. x6 ^= u<<7 | u>>>(32-7);
  37442. u = x6 + x5 | 0;
  37443. x7 ^= u<<9 | u>>>(32-9);
  37444. u = x7 + x6 | 0;
  37445. x4 ^= u<<13 | u>>>(32-13);
  37446. u = x4 + x7 | 0;
  37447. x5 ^= u<<18 | u>>>(32-18);
  37448. u = x10 + x9 | 0;
  37449. x11 ^= u<<7 | u>>>(32-7);
  37450. u = x11 + x10 | 0;
  37451. x8 ^= u<<9 | u>>>(32-9);
  37452. u = x8 + x11 | 0;
  37453. x9 ^= u<<13 | u>>>(32-13);
  37454. u = x9 + x8 | 0;
  37455. x10 ^= u<<18 | u>>>(32-18);
  37456. u = x15 + x14 | 0;
  37457. x12 ^= u<<7 | u>>>(32-7);
  37458. u = x12 + x15 | 0;
  37459. x13 ^= u<<9 | u>>>(32-9);
  37460. u = x13 + x12 | 0;
  37461. x14 ^= u<<13 | u>>>(32-13);
  37462. u = x14 + x13 | 0;
  37463. x15 ^= u<<18 | u>>>(32-18);
  37464. }
  37465. o[ 0] = x0 >>> 0 & 0xff;
  37466. o[ 1] = x0 >>> 8 & 0xff;
  37467. o[ 2] = x0 >>> 16 & 0xff;
  37468. o[ 3] = x0 >>> 24 & 0xff;
  37469. o[ 4] = x5 >>> 0 & 0xff;
  37470. o[ 5] = x5 >>> 8 & 0xff;
  37471. o[ 6] = x5 >>> 16 & 0xff;
  37472. o[ 7] = x5 >>> 24 & 0xff;
  37473. o[ 8] = x10 >>> 0 & 0xff;
  37474. o[ 9] = x10 >>> 8 & 0xff;
  37475. o[10] = x10 >>> 16 & 0xff;
  37476. o[11] = x10 >>> 24 & 0xff;
  37477. o[12] = x15 >>> 0 & 0xff;
  37478. o[13] = x15 >>> 8 & 0xff;
  37479. o[14] = x15 >>> 16 & 0xff;
  37480. o[15] = x15 >>> 24 & 0xff;
  37481. o[16] = x6 >>> 0 & 0xff;
  37482. o[17] = x6 >>> 8 & 0xff;
  37483. o[18] = x6 >>> 16 & 0xff;
  37484. o[19] = x6 >>> 24 & 0xff;
  37485. o[20] = x7 >>> 0 & 0xff;
  37486. o[21] = x7 >>> 8 & 0xff;
  37487. o[22] = x7 >>> 16 & 0xff;
  37488. o[23] = x7 >>> 24 & 0xff;
  37489. o[24] = x8 >>> 0 & 0xff;
  37490. o[25] = x8 >>> 8 & 0xff;
  37491. o[26] = x8 >>> 16 & 0xff;
  37492. o[27] = x8 >>> 24 & 0xff;
  37493. o[28] = x9 >>> 0 & 0xff;
  37494. o[29] = x9 >>> 8 & 0xff;
  37495. o[30] = x9 >>> 16 & 0xff;
  37496. o[31] = x9 >>> 24 & 0xff;
  37497. }
  37498. function crypto_core_salsa20(out,inp,k,c) {
  37499. core_salsa20(out,inp,k,c);
  37500. }
  37501. function crypto_core_hsalsa20(out,inp,k,c) {
  37502. core_hsalsa20(out,inp,k,c);
  37503. }
  37504. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37505. // "expand 32-byte k"
  37506. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37507. var z = new Uint8Array(16), x = new Uint8Array(64);
  37508. var u, i;
  37509. for (i = 0; i < 16; i++) z[i] = 0;
  37510. for (i = 0; i < 8; i++) z[i] = n[i];
  37511. while (b >= 64) {
  37512. crypto_core_salsa20(x,z,k,sigma);
  37513. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37514. u = 1;
  37515. for (i = 8; i < 16; i++) {
  37516. u = u + (z[i] & 0xff) | 0;
  37517. z[i] = u & 0xff;
  37518. u >>>= 8;
  37519. }
  37520. b -= 64;
  37521. cpos += 64;
  37522. mpos += 64;
  37523. }
  37524. if (b > 0) {
  37525. crypto_core_salsa20(x,z,k,sigma);
  37526. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37527. }
  37528. return 0;
  37529. }
  37530. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37531. var z = new Uint8Array(16), x = new Uint8Array(64);
  37532. var u, i;
  37533. for (i = 0; i < 16; i++) z[i] = 0;
  37534. for (i = 0; i < 8; i++) z[i] = n[i];
  37535. while (b >= 64) {
  37536. crypto_core_salsa20(x,z,k,sigma);
  37537. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37538. u = 1;
  37539. for (i = 8; i < 16; i++) {
  37540. u = u + (z[i] & 0xff) | 0;
  37541. z[i] = u & 0xff;
  37542. u >>>= 8;
  37543. }
  37544. b -= 64;
  37545. cpos += 64;
  37546. }
  37547. if (b > 0) {
  37548. crypto_core_salsa20(x,z,k,sigma);
  37549. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37550. }
  37551. return 0;
  37552. }
  37553. function crypto_stream(c,cpos,d,n,k) {
  37554. var s = new Uint8Array(32);
  37555. crypto_core_hsalsa20(s,n,k,sigma);
  37556. var sn = new Uint8Array(8);
  37557. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37558. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37559. }
  37560. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37561. var s = new Uint8Array(32);
  37562. crypto_core_hsalsa20(s,n,k,sigma);
  37563. var sn = new Uint8Array(8);
  37564. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37565. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37566. }
  37567. /*
  37568. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37569. * https://github.com/floodyberry/poly1305-donna
  37570. */
  37571. var poly1305 = function(key) {
  37572. this.buffer = new Uint8Array(16);
  37573. this.r = new Uint16Array(10);
  37574. this.h = new Uint16Array(10);
  37575. this.pad = new Uint16Array(8);
  37576. this.leftover = 0;
  37577. this.fin = 0;
  37578. var t0, t1, t2, t3, t4, t5, t6, t7;
  37579. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37580. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37581. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37582. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37583. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37584. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37585. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37586. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37587. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37588. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37589. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37590. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37591. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37592. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37593. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37594. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37595. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37596. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37597. };
  37598. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37599. var hibit = this.fin ? 0 : (1 << 11);
  37600. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37601. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37602. var h0 = this.h[0],
  37603. h1 = this.h[1],
  37604. h2 = this.h[2],
  37605. h3 = this.h[3],
  37606. h4 = this.h[4],
  37607. h5 = this.h[5],
  37608. h6 = this.h[6],
  37609. h7 = this.h[7],
  37610. h8 = this.h[8],
  37611. h9 = this.h[9];
  37612. var r0 = this.r[0],
  37613. r1 = this.r[1],
  37614. r2 = this.r[2],
  37615. r3 = this.r[3],
  37616. r4 = this.r[4],
  37617. r5 = this.r[5],
  37618. r6 = this.r[6],
  37619. r7 = this.r[7],
  37620. r8 = this.r[8],
  37621. r9 = this.r[9];
  37622. while (bytes >= 16) {
  37623. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37624. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37625. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37626. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37627. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37628. h5 += ((t4 >>> 1)) & 0x1fff;
  37629. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37630. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37631. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37632. h9 += ((t7 >>> 5)) | hibit;
  37633. c = 0;
  37634. d0 = c;
  37635. d0 += h0 * r0;
  37636. d0 += h1 * (5 * r9);
  37637. d0 += h2 * (5 * r8);
  37638. d0 += h3 * (5 * r7);
  37639. d0 += h4 * (5 * r6);
  37640. c = (d0 >>> 13); d0 &= 0x1fff;
  37641. d0 += h5 * (5 * r5);
  37642. d0 += h6 * (5 * r4);
  37643. d0 += h7 * (5 * r3);
  37644. d0 += h8 * (5 * r2);
  37645. d0 += h9 * (5 * r1);
  37646. c += (d0 >>> 13); d0 &= 0x1fff;
  37647. d1 = c;
  37648. d1 += h0 * r1;
  37649. d1 += h1 * r0;
  37650. d1 += h2 * (5 * r9);
  37651. d1 += h3 * (5 * r8);
  37652. d1 += h4 * (5 * r7);
  37653. c = (d1 >>> 13); d1 &= 0x1fff;
  37654. d1 += h5 * (5 * r6);
  37655. d1 += h6 * (5 * r5);
  37656. d1 += h7 * (5 * r4);
  37657. d1 += h8 * (5 * r3);
  37658. d1 += h9 * (5 * r2);
  37659. c += (d1 >>> 13); d1 &= 0x1fff;
  37660. d2 = c;
  37661. d2 += h0 * r2;
  37662. d2 += h1 * r1;
  37663. d2 += h2 * r0;
  37664. d2 += h3 * (5 * r9);
  37665. d2 += h4 * (5 * r8);
  37666. c = (d2 >>> 13); d2 &= 0x1fff;
  37667. d2 += h5 * (5 * r7);
  37668. d2 += h6 * (5 * r6);
  37669. d2 += h7 * (5 * r5);
  37670. d2 += h8 * (5 * r4);
  37671. d2 += h9 * (5 * r3);
  37672. c += (d2 >>> 13); d2 &= 0x1fff;
  37673. d3 = c;
  37674. d3 += h0 * r3;
  37675. d3 += h1 * r2;
  37676. d3 += h2 * r1;
  37677. d3 += h3 * r0;
  37678. d3 += h4 * (5 * r9);
  37679. c = (d3 >>> 13); d3 &= 0x1fff;
  37680. d3 += h5 * (5 * r8);
  37681. d3 += h6 * (5 * r7);
  37682. d3 += h7 * (5 * r6);
  37683. d3 += h8 * (5 * r5);
  37684. d3 += h9 * (5 * r4);
  37685. c += (d3 >>> 13); d3 &= 0x1fff;
  37686. d4 = c;
  37687. d4 += h0 * r4;
  37688. d4 += h1 * r3;
  37689. d4 += h2 * r2;
  37690. d4 += h3 * r1;
  37691. d4 += h4 * r0;
  37692. c = (d4 >>> 13); d4 &= 0x1fff;
  37693. d4 += h5 * (5 * r9);
  37694. d4 += h6 * (5 * r8);
  37695. d4 += h7 * (5 * r7);
  37696. d4 += h8 * (5 * r6);
  37697. d4 += h9 * (5 * r5);
  37698. c += (d4 >>> 13); d4 &= 0x1fff;
  37699. d5 = c;
  37700. d5 += h0 * r5;
  37701. d5 += h1 * r4;
  37702. d5 += h2 * r3;
  37703. d5 += h3 * r2;
  37704. d5 += h4 * r1;
  37705. c = (d5 >>> 13); d5 &= 0x1fff;
  37706. d5 += h5 * r0;
  37707. d5 += h6 * (5 * r9);
  37708. d5 += h7 * (5 * r8);
  37709. d5 += h8 * (5 * r7);
  37710. d5 += h9 * (5 * r6);
  37711. c += (d5 >>> 13); d5 &= 0x1fff;
  37712. d6 = c;
  37713. d6 += h0 * r6;
  37714. d6 += h1 * r5;
  37715. d6 += h2 * r4;
  37716. d6 += h3 * r3;
  37717. d6 += h4 * r2;
  37718. c = (d6 >>> 13); d6 &= 0x1fff;
  37719. d6 += h5 * r1;
  37720. d6 += h6 * r0;
  37721. d6 += h7 * (5 * r9);
  37722. d6 += h8 * (5 * r8);
  37723. d6 += h9 * (5 * r7);
  37724. c += (d6 >>> 13); d6 &= 0x1fff;
  37725. d7 = c;
  37726. d7 += h0 * r7;
  37727. d7 += h1 * r6;
  37728. d7 += h2 * r5;
  37729. d7 += h3 * r4;
  37730. d7 += h4 * r3;
  37731. c = (d7 >>> 13); d7 &= 0x1fff;
  37732. d7 += h5 * r2;
  37733. d7 += h6 * r1;
  37734. d7 += h7 * r0;
  37735. d7 += h8 * (5 * r9);
  37736. d7 += h9 * (5 * r8);
  37737. c += (d7 >>> 13); d7 &= 0x1fff;
  37738. d8 = c;
  37739. d8 += h0 * r8;
  37740. d8 += h1 * r7;
  37741. d8 += h2 * r6;
  37742. d8 += h3 * r5;
  37743. d8 += h4 * r4;
  37744. c = (d8 >>> 13); d8 &= 0x1fff;
  37745. d8 += h5 * r3;
  37746. d8 += h6 * r2;
  37747. d8 += h7 * r1;
  37748. d8 += h8 * r0;
  37749. d8 += h9 * (5 * r9);
  37750. c += (d8 >>> 13); d8 &= 0x1fff;
  37751. d9 = c;
  37752. d9 += h0 * r9;
  37753. d9 += h1 * r8;
  37754. d9 += h2 * r7;
  37755. d9 += h3 * r6;
  37756. d9 += h4 * r5;
  37757. c = (d9 >>> 13); d9 &= 0x1fff;
  37758. d9 += h5 * r4;
  37759. d9 += h6 * r3;
  37760. d9 += h7 * r2;
  37761. d9 += h8 * r1;
  37762. d9 += h9 * r0;
  37763. c += (d9 >>> 13); d9 &= 0x1fff;
  37764. c = (((c << 2) + c)) | 0;
  37765. c = (c + d0) | 0;
  37766. d0 = c & 0x1fff;
  37767. c = (c >>> 13);
  37768. d1 += c;
  37769. h0 = d0;
  37770. h1 = d1;
  37771. h2 = d2;
  37772. h3 = d3;
  37773. h4 = d4;
  37774. h5 = d5;
  37775. h6 = d6;
  37776. h7 = d7;
  37777. h8 = d8;
  37778. h9 = d9;
  37779. mpos += 16;
  37780. bytes -= 16;
  37781. }
  37782. this.h[0] = h0;
  37783. this.h[1] = h1;
  37784. this.h[2] = h2;
  37785. this.h[3] = h3;
  37786. this.h[4] = h4;
  37787. this.h[5] = h5;
  37788. this.h[6] = h6;
  37789. this.h[7] = h7;
  37790. this.h[8] = h8;
  37791. this.h[9] = h9;
  37792. };
  37793. poly1305.prototype.finish = function(mac, macpos) {
  37794. var g = new Uint16Array(10);
  37795. var c, mask, f, i;
  37796. if (this.leftover) {
  37797. i = this.leftover;
  37798. this.buffer[i++] = 1;
  37799. for (; i < 16; i++) this.buffer[i] = 0;
  37800. this.fin = 1;
  37801. this.blocks(this.buffer, 0, 16);
  37802. }
  37803. c = this.h[1] >>> 13;
  37804. this.h[1] &= 0x1fff;
  37805. for (i = 2; i < 10; i++) {
  37806. this.h[i] += c;
  37807. c = this.h[i] >>> 13;
  37808. this.h[i] &= 0x1fff;
  37809. }
  37810. this.h[0] += (c * 5);
  37811. c = this.h[0] >>> 13;
  37812. this.h[0] &= 0x1fff;
  37813. this.h[1] += c;
  37814. c = this.h[1] >>> 13;
  37815. this.h[1] &= 0x1fff;
  37816. this.h[2] += c;
  37817. g[0] = this.h[0] + 5;
  37818. c = g[0] >>> 13;
  37819. g[0] &= 0x1fff;
  37820. for (i = 1; i < 10; i++) {
  37821. g[i] = this.h[i] + c;
  37822. c = g[i] >>> 13;
  37823. g[i] &= 0x1fff;
  37824. }
  37825. g[9] -= (1 << 13);
  37826. mask = (c ^ 1) - 1;
  37827. for (i = 0; i < 10; i++) g[i] &= mask;
  37828. mask = ~mask;
  37829. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37830. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37831. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37832. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37833. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37834. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37835. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37836. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37837. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37838. f = this.h[0] + this.pad[0];
  37839. this.h[0] = f & 0xffff;
  37840. for (i = 1; i < 8; i++) {
  37841. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37842. this.h[i] = f & 0xffff;
  37843. }
  37844. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37845. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37846. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37847. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37848. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37849. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37850. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37851. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37852. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37853. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37854. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37855. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37856. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37857. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37858. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37859. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37860. };
  37861. poly1305.prototype.update = function(m, mpos, bytes) {
  37862. var i, want;
  37863. if (this.leftover) {
  37864. want = (16 - this.leftover);
  37865. if (want > bytes)
  37866. want = bytes;
  37867. for (i = 0; i < want; i++)
  37868. this.buffer[this.leftover + i] = m[mpos+i];
  37869. bytes -= want;
  37870. mpos += want;
  37871. this.leftover += want;
  37872. if (this.leftover < 16)
  37873. return;
  37874. this.blocks(this.buffer, 0, 16);
  37875. this.leftover = 0;
  37876. }
  37877. if (bytes >= 16) {
  37878. want = bytes - (bytes % 16);
  37879. this.blocks(m, mpos, want);
  37880. mpos += want;
  37881. bytes -= want;
  37882. }
  37883. if (bytes) {
  37884. for (i = 0; i < bytes; i++)
  37885. this.buffer[this.leftover + i] = m[mpos+i];
  37886. this.leftover += bytes;
  37887. }
  37888. };
  37889. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37890. var s = new poly1305(k);
  37891. s.update(m, mpos, n);
  37892. s.finish(out, outpos);
  37893. return 0;
  37894. }
  37895. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37896. var x = new Uint8Array(16);
  37897. crypto_onetimeauth(x,0,m,mpos,n,k);
  37898. return crypto_verify_16(h,hpos,x,0);
  37899. }
  37900. function crypto_secretbox(c,m,d,n,k) {
  37901. var i;
  37902. if (d < 32) return -1;
  37903. crypto_stream_xor(c,0,m,0,d,n,k);
  37904. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37905. for (i = 0; i < 16; i++) c[i] = 0;
  37906. return 0;
  37907. }
  37908. function crypto_secretbox_open(m,c,d,n,k) {
  37909. var i;
  37910. var x = new Uint8Array(32);
  37911. if (d < 32) return -1;
  37912. crypto_stream(x,0,32,n,k);
  37913. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37914. crypto_stream_xor(m,0,c,0,d,n,k);
  37915. for (i = 0; i < 32; i++) m[i] = 0;
  37916. return 0;
  37917. }
  37918. function set25519(r, a) {
  37919. var i;
  37920. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37921. }
  37922. function car25519(o) {
  37923. var i, v, c = 1;
  37924. for (i = 0; i < 16; i++) {
  37925. v = o[i] + c + 65535;
  37926. c = Math.floor(v / 65536);
  37927. o[i] = v - c * 65536;
  37928. }
  37929. o[0] += c-1 + 37 * (c-1);
  37930. }
  37931. function sel25519(p, q, b) {
  37932. var t, c = ~(b-1);
  37933. for (var i = 0; i < 16; i++) {
  37934. t = c & (p[i] ^ q[i]);
  37935. p[i] ^= t;
  37936. q[i] ^= t;
  37937. }
  37938. }
  37939. function pack25519(o, n) {
  37940. var i, j, b;
  37941. var m = gf(), t = gf();
  37942. for (i = 0; i < 16; i++) t[i] = n[i];
  37943. car25519(t);
  37944. car25519(t);
  37945. car25519(t);
  37946. for (j = 0; j < 2; j++) {
  37947. m[0] = t[0] - 0xffed;
  37948. for (i = 1; i < 15; i++) {
  37949. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37950. m[i-1] &= 0xffff;
  37951. }
  37952. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37953. b = (m[15]>>16) & 1;
  37954. m[14] &= 0xffff;
  37955. sel25519(t, m, 1-b);
  37956. }
  37957. for (i = 0; i < 16; i++) {
  37958. o[2*i] = t[i] & 0xff;
  37959. o[2*i+1] = t[i]>>8;
  37960. }
  37961. }
  37962. function neq25519(a, b) {
  37963. var c = new Uint8Array(32), d = new Uint8Array(32);
  37964. pack25519(c, a);
  37965. pack25519(d, b);
  37966. return crypto_verify_32(c, 0, d, 0);
  37967. }
  37968. function par25519(a) {
  37969. var d = new Uint8Array(32);
  37970. pack25519(d, a);
  37971. return d[0] & 1;
  37972. }
  37973. function unpack25519(o, n) {
  37974. var i;
  37975. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37976. o[15] &= 0x7fff;
  37977. }
  37978. function A(o, a, b) {
  37979. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37980. }
  37981. function Z(o, a, b) {
  37982. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37983. }
  37984. function M(o, a, b) {
  37985. var v, c,
  37986. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37987. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37988. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37989. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37990. b0 = b[0],
  37991. b1 = b[1],
  37992. b2 = b[2],
  37993. b3 = b[3],
  37994. b4 = b[4],
  37995. b5 = b[5],
  37996. b6 = b[6],
  37997. b7 = b[7],
  37998. b8 = b[8],
  37999. b9 = b[9],
  38000. b10 = b[10],
  38001. b11 = b[11],
  38002. b12 = b[12],
  38003. b13 = b[13],
  38004. b14 = b[14],
  38005. b15 = b[15];
  38006. v = a[0];
  38007. t0 += v * b0;
  38008. t1 += v * b1;
  38009. t2 += v * b2;
  38010. t3 += v * b3;
  38011. t4 += v * b4;
  38012. t5 += v * b5;
  38013. t6 += v * b6;
  38014. t7 += v * b7;
  38015. t8 += v * b8;
  38016. t9 += v * b9;
  38017. t10 += v * b10;
  38018. t11 += v * b11;
  38019. t12 += v * b12;
  38020. t13 += v * b13;
  38021. t14 += v * b14;
  38022. t15 += v * b15;
  38023. v = a[1];
  38024. t1 += v * b0;
  38025. t2 += v * b1;
  38026. t3 += v * b2;
  38027. t4 += v * b3;
  38028. t5 += v * b4;
  38029. t6 += v * b5;
  38030. t7 += v * b6;
  38031. t8 += v * b7;
  38032. t9 += v * b8;
  38033. t10 += v * b9;
  38034. t11 += v * b10;
  38035. t12 += v * b11;
  38036. t13 += v * b12;
  38037. t14 += v * b13;
  38038. t15 += v * b14;
  38039. t16 += v * b15;
  38040. v = a[2];
  38041. t2 += v * b0;
  38042. t3 += v * b1;
  38043. t4 += v * b2;
  38044. t5 += v * b3;
  38045. t6 += v * b4;
  38046. t7 += v * b5;
  38047. t8 += v * b6;
  38048. t9 += v * b7;
  38049. t10 += v * b8;
  38050. t11 += v * b9;
  38051. t12 += v * b10;
  38052. t13 += v * b11;
  38053. t14 += v * b12;
  38054. t15 += v * b13;
  38055. t16 += v * b14;
  38056. t17 += v * b15;
  38057. v = a[3];
  38058. t3 += v * b0;
  38059. t4 += v * b1;
  38060. t5 += v * b2;
  38061. t6 += v * b3;
  38062. t7 += v * b4;
  38063. t8 += v * b5;
  38064. t9 += v * b6;
  38065. t10 += v * b7;
  38066. t11 += v * b8;
  38067. t12 += v * b9;
  38068. t13 += v * b10;
  38069. t14 += v * b11;
  38070. t15 += v * b12;
  38071. t16 += v * b13;
  38072. t17 += v * b14;
  38073. t18 += v * b15;
  38074. v = a[4];
  38075. t4 += v * b0;
  38076. t5 += v * b1;
  38077. t6 += v * b2;
  38078. t7 += v * b3;
  38079. t8 += v * b4;
  38080. t9 += v * b5;
  38081. t10 += v * b6;
  38082. t11 += v * b7;
  38083. t12 += v * b8;
  38084. t13 += v * b9;
  38085. t14 += v * b10;
  38086. t15 += v * b11;
  38087. t16 += v * b12;
  38088. t17 += v * b13;
  38089. t18 += v * b14;
  38090. t19 += v * b15;
  38091. v = a[5];
  38092. t5 += v * b0;
  38093. t6 += v * b1;
  38094. t7 += v * b2;
  38095. t8 += v * b3;
  38096. t9 += v * b4;
  38097. t10 += v * b5;
  38098. t11 += v * b6;
  38099. t12 += v * b7;
  38100. t13 += v * b8;
  38101. t14 += v * b9;
  38102. t15 += v * b10;
  38103. t16 += v * b11;
  38104. t17 += v * b12;
  38105. t18 += v * b13;
  38106. t19 += v * b14;
  38107. t20 += v * b15;
  38108. v = a[6];
  38109. t6 += v * b0;
  38110. t7 += v * b1;
  38111. t8 += v * b2;
  38112. t9 += v * b3;
  38113. t10 += v * b4;
  38114. t11 += v * b5;
  38115. t12 += v * b6;
  38116. t13 += v * b7;
  38117. t14 += v * b8;
  38118. t15 += v * b9;
  38119. t16 += v * b10;
  38120. t17 += v * b11;
  38121. t18 += v * b12;
  38122. t19 += v * b13;
  38123. t20 += v * b14;
  38124. t21 += v * b15;
  38125. v = a[7];
  38126. t7 += v * b0;
  38127. t8 += v * b1;
  38128. t9 += v * b2;
  38129. t10 += v * b3;
  38130. t11 += v * b4;
  38131. t12 += v * b5;
  38132. t13 += v * b6;
  38133. t14 += v * b7;
  38134. t15 += v * b8;
  38135. t16 += v * b9;
  38136. t17 += v * b10;
  38137. t18 += v * b11;
  38138. t19 += v * b12;
  38139. t20 += v * b13;
  38140. t21 += v * b14;
  38141. t22 += v * b15;
  38142. v = a[8];
  38143. t8 += v * b0;
  38144. t9 += v * b1;
  38145. t10 += v * b2;
  38146. t11 += v * b3;
  38147. t12 += v * b4;
  38148. t13 += v * b5;
  38149. t14 += v * b6;
  38150. t15 += v * b7;
  38151. t16 += v * b8;
  38152. t17 += v * b9;
  38153. t18 += v * b10;
  38154. t19 += v * b11;
  38155. t20 += v * b12;
  38156. t21 += v * b13;
  38157. t22 += v * b14;
  38158. t23 += v * b15;
  38159. v = a[9];
  38160. t9 += v * b0;
  38161. t10 += v * b1;
  38162. t11 += v * b2;
  38163. t12 += v * b3;
  38164. t13 += v * b4;
  38165. t14 += v * b5;
  38166. t15 += v * b6;
  38167. t16 += v * b7;
  38168. t17 += v * b8;
  38169. t18 += v * b9;
  38170. t19 += v * b10;
  38171. t20 += v * b11;
  38172. t21 += v * b12;
  38173. t22 += v * b13;
  38174. t23 += v * b14;
  38175. t24 += v * b15;
  38176. v = a[10];
  38177. t10 += v * b0;
  38178. t11 += v * b1;
  38179. t12 += v * b2;
  38180. t13 += v * b3;
  38181. t14 += v * b4;
  38182. t15 += v * b5;
  38183. t16 += v * b6;
  38184. t17 += v * b7;
  38185. t18 += v * b8;
  38186. t19 += v * b9;
  38187. t20 += v * b10;
  38188. t21 += v * b11;
  38189. t22 += v * b12;
  38190. t23 += v * b13;
  38191. t24 += v * b14;
  38192. t25 += v * b15;
  38193. v = a[11];
  38194. t11 += v * b0;
  38195. t12 += v * b1;
  38196. t13 += v * b2;
  38197. t14 += v * b3;
  38198. t15 += v * b4;
  38199. t16 += v * b5;
  38200. t17 += v * b6;
  38201. t18 += v * b7;
  38202. t19 += v * b8;
  38203. t20 += v * b9;
  38204. t21 += v * b10;
  38205. t22 += v * b11;
  38206. t23 += v * b12;
  38207. t24 += v * b13;
  38208. t25 += v * b14;
  38209. t26 += v * b15;
  38210. v = a[12];
  38211. t12 += v * b0;
  38212. t13 += v * b1;
  38213. t14 += v * b2;
  38214. t15 += v * b3;
  38215. t16 += v * b4;
  38216. t17 += v * b5;
  38217. t18 += v * b6;
  38218. t19 += v * b7;
  38219. t20 += v * b8;
  38220. t21 += v * b9;
  38221. t22 += v * b10;
  38222. t23 += v * b11;
  38223. t24 += v * b12;
  38224. t25 += v * b13;
  38225. t26 += v * b14;
  38226. t27 += v * b15;
  38227. v = a[13];
  38228. t13 += v * b0;
  38229. t14 += v * b1;
  38230. t15 += v * b2;
  38231. t16 += v * b3;
  38232. t17 += v * b4;
  38233. t18 += v * b5;
  38234. t19 += v * b6;
  38235. t20 += v * b7;
  38236. t21 += v * b8;
  38237. t22 += v * b9;
  38238. t23 += v * b10;
  38239. t24 += v * b11;
  38240. t25 += v * b12;
  38241. t26 += v * b13;
  38242. t27 += v * b14;
  38243. t28 += v * b15;
  38244. v = a[14];
  38245. t14 += v * b0;
  38246. t15 += v * b1;
  38247. t16 += v * b2;
  38248. t17 += v * b3;
  38249. t18 += v * b4;
  38250. t19 += v * b5;
  38251. t20 += v * b6;
  38252. t21 += v * b7;
  38253. t22 += v * b8;
  38254. t23 += v * b9;
  38255. t24 += v * b10;
  38256. t25 += v * b11;
  38257. t26 += v * b12;
  38258. t27 += v * b13;
  38259. t28 += v * b14;
  38260. t29 += v * b15;
  38261. v = a[15];
  38262. t15 += v * b0;
  38263. t16 += v * b1;
  38264. t17 += v * b2;
  38265. t18 += v * b3;
  38266. t19 += v * b4;
  38267. t20 += v * b5;
  38268. t21 += v * b6;
  38269. t22 += v * b7;
  38270. t23 += v * b8;
  38271. t24 += v * b9;
  38272. t25 += v * b10;
  38273. t26 += v * b11;
  38274. t27 += v * b12;
  38275. t28 += v * b13;
  38276. t29 += v * b14;
  38277. t30 += v * b15;
  38278. t0 += 38 * t16;
  38279. t1 += 38 * t17;
  38280. t2 += 38 * t18;
  38281. t3 += 38 * t19;
  38282. t4 += 38 * t20;
  38283. t5 += 38 * t21;
  38284. t6 += 38 * t22;
  38285. t7 += 38 * t23;
  38286. t8 += 38 * t24;
  38287. t9 += 38 * t25;
  38288. t10 += 38 * t26;
  38289. t11 += 38 * t27;
  38290. t12 += 38 * t28;
  38291. t13 += 38 * t29;
  38292. t14 += 38 * t30;
  38293. // t15 left as is
  38294. // first car
  38295. c = 1;
  38296. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38297. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38298. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38299. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38300. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38301. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38302. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38303. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38304. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38305. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38306. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38307. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38308. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38309. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38310. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38311. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38312. t0 += c-1 + 37 * (c-1);
  38313. // second car
  38314. c = 1;
  38315. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38316. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38317. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38318. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38319. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38320. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38321. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38322. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38323. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38324. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38325. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38326. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38327. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38328. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38329. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38330. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38331. t0 += c-1 + 37 * (c-1);
  38332. o[ 0] = t0;
  38333. o[ 1] = t1;
  38334. o[ 2] = t2;
  38335. o[ 3] = t3;
  38336. o[ 4] = t4;
  38337. o[ 5] = t5;
  38338. o[ 6] = t6;
  38339. o[ 7] = t7;
  38340. o[ 8] = t8;
  38341. o[ 9] = t9;
  38342. o[10] = t10;
  38343. o[11] = t11;
  38344. o[12] = t12;
  38345. o[13] = t13;
  38346. o[14] = t14;
  38347. o[15] = t15;
  38348. }
  38349. function S(o, a) {
  38350. M(o, a, a);
  38351. }
  38352. function inv25519(o, i) {
  38353. var c = gf();
  38354. var a;
  38355. for (a = 0; a < 16; a++) c[a] = i[a];
  38356. for (a = 253; a >= 0; a--) {
  38357. S(c, c);
  38358. if(a !== 2 && a !== 4) M(c, c, i);
  38359. }
  38360. for (a = 0; a < 16; a++) o[a] = c[a];
  38361. }
  38362. function pow2523(o, i) {
  38363. var c = gf();
  38364. var a;
  38365. for (a = 0; a < 16; a++) c[a] = i[a];
  38366. for (a = 250; a >= 0; a--) {
  38367. S(c, c);
  38368. if(a !== 1) M(c, c, i);
  38369. }
  38370. for (a = 0; a < 16; a++) o[a] = c[a];
  38371. }
  38372. function crypto_scalarmult(q, n, p) {
  38373. var z = new Uint8Array(32);
  38374. var x = new Float64Array(80), r, i;
  38375. var a = gf(), b = gf(), c = gf(),
  38376. d = gf(), e = gf(), f = gf();
  38377. for (i = 0; i < 31; i++) z[i] = n[i];
  38378. z[31]=(n[31]&127)|64;
  38379. z[0]&=248;
  38380. unpack25519(x,p);
  38381. for (i = 0; i < 16; i++) {
  38382. b[i]=x[i];
  38383. d[i]=a[i]=c[i]=0;
  38384. }
  38385. a[0]=d[0]=1;
  38386. for (i=254; i>=0; --i) {
  38387. r=(z[i>>>3]>>>(i&7))&1;
  38388. sel25519(a,b,r);
  38389. sel25519(c,d,r);
  38390. A(e,a,c);
  38391. Z(a,a,c);
  38392. A(c,b,d);
  38393. Z(b,b,d);
  38394. S(d,e);
  38395. S(f,a);
  38396. M(a,c,a);
  38397. M(c,b,e);
  38398. A(e,a,c);
  38399. Z(a,a,c);
  38400. S(b,a);
  38401. Z(c,d,f);
  38402. M(a,c,_121665);
  38403. A(a,a,d);
  38404. M(c,c,a);
  38405. M(a,d,f);
  38406. M(d,b,x);
  38407. S(b,e);
  38408. sel25519(a,b,r);
  38409. sel25519(c,d,r);
  38410. }
  38411. for (i = 0; i < 16; i++) {
  38412. x[i+16]=a[i];
  38413. x[i+32]=c[i];
  38414. x[i+48]=b[i];
  38415. x[i+64]=d[i];
  38416. }
  38417. var x32 = x.subarray(32);
  38418. var x16 = x.subarray(16);
  38419. inv25519(x32,x32);
  38420. M(x16,x16,x32);
  38421. pack25519(q,x16);
  38422. return 0;
  38423. }
  38424. function crypto_scalarmult_base(q, n) {
  38425. return crypto_scalarmult(q, n, _9);
  38426. }
  38427. function crypto_box_keypair(y, x) {
  38428. randombytes(x, 32);
  38429. return crypto_scalarmult_base(y, x);
  38430. }
  38431. function crypto_box_beforenm(k, y, x) {
  38432. var s = new Uint8Array(32);
  38433. crypto_scalarmult(s, x, y);
  38434. return crypto_core_hsalsa20(k, _0, s, sigma);
  38435. }
  38436. var crypto_box_afternm = crypto_secretbox;
  38437. var crypto_box_open_afternm = crypto_secretbox_open;
  38438. function crypto_box(c, m, d, n, y, x) {
  38439. var k = new Uint8Array(32);
  38440. crypto_box_beforenm(k, y, x);
  38441. return crypto_box_afternm(c, m, d, n, k);
  38442. }
  38443. function crypto_box_open(m, c, d, n, y, x) {
  38444. var k = new Uint8Array(32);
  38445. crypto_box_beforenm(k, y, x);
  38446. return crypto_box_open_afternm(m, c, d, n, k);
  38447. }
  38448. var K = [
  38449. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38450. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38451. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38452. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38453. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38454. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38455. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38456. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38457. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38458. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38459. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38460. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38461. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38462. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38463. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38464. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38465. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38466. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38467. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38468. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38469. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38470. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38471. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38472. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38473. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38474. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38475. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38476. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38477. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38478. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38479. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38480. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38481. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38482. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38483. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38484. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38485. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38486. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38487. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38488. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38489. ];
  38490. function crypto_hashblocks_hl(hh, hl, m, n) {
  38491. var wh = new Int32Array(16), wl = new Int32Array(16),
  38492. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38493. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38494. th, tl, i, j, h, l, a, b, c, d;
  38495. var ah0 = hh[0],
  38496. ah1 = hh[1],
  38497. ah2 = hh[2],
  38498. ah3 = hh[3],
  38499. ah4 = hh[4],
  38500. ah5 = hh[5],
  38501. ah6 = hh[6],
  38502. ah7 = hh[7],
  38503. al0 = hl[0],
  38504. al1 = hl[1],
  38505. al2 = hl[2],
  38506. al3 = hl[3],
  38507. al4 = hl[4],
  38508. al5 = hl[5],
  38509. al6 = hl[6],
  38510. al7 = hl[7];
  38511. var pos = 0;
  38512. while (n >= 128) {
  38513. for (i = 0; i < 16; i++) {
  38514. j = 8 * i + pos;
  38515. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38516. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38517. }
  38518. for (i = 0; i < 80; i++) {
  38519. bh0 = ah0;
  38520. bh1 = ah1;
  38521. bh2 = ah2;
  38522. bh3 = ah3;
  38523. bh4 = ah4;
  38524. bh5 = ah5;
  38525. bh6 = ah6;
  38526. bh7 = ah7;
  38527. bl0 = al0;
  38528. bl1 = al1;
  38529. bl2 = al2;
  38530. bl3 = al3;
  38531. bl4 = al4;
  38532. bl5 = al5;
  38533. bl6 = al6;
  38534. bl7 = al7;
  38535. // add
  38536. h = ah7;
  38537. l = al7;
  38538. a = l & 0xffff; b = l >>> 16;
  38539. c = h & 0xffff; d = h >>> 16;
  38540. // Sigma1
  38541. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38542. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38543. a += l & 0xffff; b += l >>> 16;
  38544. c += h & 0xffff; d += h >>> 16;
  38545. // Ch
  38546. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38547. l = (al4 & al5) ^ (~al4 & al6);
  38548. a += l & 0xffff; b += l >>> 16;
  38549. c += h & 0xffff; d += h >>> 16;
  38550. // K
  38551. h = K[i*2];
  38552. l = K[i*2+1];
  38553. a += l & 0xffff; b += l >>> 16;
  38554. c += h & 0xffff; d += h >>> 16;
  38555. // w
  38556. h = wh[i%16];
  38557. l = wl[i%16];
  38558. a += l & 0xffff; b += l >>> 16;
  38559. c += h & 0xffff; d += h >>> 16;
  38560. b += a >>> 16;
  38561. c += b >>> 16;
  38562. d += c >>> 16;
  38563. th = c & 0xffff | d << 16;
  38564. tl = a & 0xffff | b << 16;
  38565. // add
  38566. h = th;
  38567. l = tl;
  38568. a = l & 0xffff; b = l >>> 16;
  38569. c = h & 0xffff; d = h >>> 16;
  38570. // Sigma0
  38571. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38572. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38573. a += l & 0xffff; b += l >>> 16;
  38574. c += h & 0xffff; d += h >>> 16;
  38575. // Maj
  38576. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38577. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38578. a += l & 0xffff; b += l >>> 16;
  38579. c += h & 0xffff; d += h >>> 16;
  38580. b += a >>> 16;
  38581. c += b >>> 16;
  38582. d += c >>> 16;
  38583. bh7 = (c & 0xffff) | (d << 16);
  38584. bl7 = (a & 0xffff) | (b << 16);
  38585. // add
  38586. h = bh3;
  38587. l = bl3;
  38588. a = l & 0xffff; b = l >>> 16;
  38589. c = h & 0xffff; d = h >>> 16;
  38590. h = th;
  38591. l = tl;
  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. bh3 = (c & 0xffff) | (d << 16);
  38598. bl3 = (a & 0xffff) | (b << 16);
  38599. ah1 = bh0;
  38600. ah2 = bh1;
  38601. ah3 = bh2;
  38602. ah4 = bh3;
  38603. ah5 = bh4;
  38604. ah6 = bh5;
  38605. ah7 = bh6;
  38606. ah0 = bh7;
  38607. al1 = bl0;
  38608. al2 = bl1;
  38609. al3 = bl2;
  38610. al4 = bl3;
  38611. al5 = bl4;
  38612. al6 = bl5;
  38613. al7 = bl6;
  38614. al0 = bl7;
  38615. if (i%16 === 15) {
  38616. for (j = 0; j < 16; j++) {
  38617. // add
  38618. h = wh[j];
  38619. l = wl[j];
  38620. a = l & 0xffff; b = l >>> 16;
  38621. c = h & 0xffff; d = h >>> 16;
  38622. h = wh[(j+9)%16];
  38623. l = wl[(j+9)%16];
  38624. a += l & 0xffff; b += l >>> 16;
  38625. c += h & 0xffff; d += h >>> 16;
  38626. // sigma0
  38627. th = wh[(j+1)%16];
  38628. tl = wl[(j+1)%16];
  38629. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38630. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38631. a += l & 0xffff; b += l >>> 16;
  38632. c += h & 0xffff; d += h >>> 16;
  38633. // sigma1
  38634. th = wh[(j+14)%16];
  38635. tl = wl[(j+14)%16];
  38636. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38637. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38638. a += l & 0xffff; b += l >>> 16;
  38639. c += h & 0xffff; d += h >>> 16;
  38640. b += a >>> 16;
  38641. c += b >>> 16;
  38642. d += c >>> 16;
  38643. wh[j] = (c & 0xffff) | (d << 16);
  38644. wl[j] = (a & 0xffff) | (b << 16);
  38645. }
  38646. }
  38647. }
  38648. // add
  38649. h = ah0;
  38650. l = al0;
  38651. a = l & 0xffff; b = l >>> 16;
  38652. c = h & 0xffff; d = h >>> 16;
  38653. h = hh[0];
  38654. l = hl[0];
  38655. a += l & 0xffff; b += l >>> 16;
  38656. c += h & 0xffff; d += h >>> 16;
  38657. b += a >>> 16;
  38658. c += b >>> 16;
  38659. d += c >>> 16;
  38660. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38661. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38662. h = ah1;
  38663. l = al1;
  38664. a = l & 0xffff; b = l >>> 16;
  38665. c = h & 0xffff; d = h >>> 16;
  38666. h = hh[1];
  38667. l = hl[1];
  38668. a += l & 0xffff; b += l >>> 16;
  38669. c += h & 0xffff; d += h >>> 16;
  38670. b += a >>> 16;
  38671. c += b >>> 16;
  38672. d += c >>> 16;
  38673. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38674. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38675. h = ah2;
  38676. l = al2;
  38677. a = l & 0xffff; b = l >>> 16;
  38678. c = h & 0xffff; d = h >>> 16;
  38679. h = hh[2];
  38680. l = hl[2];
  38681. a += l & 0xffff; b += l >>> 16;
  38682. c += h & 0xffff; d += h >>> 16;
  38683. b += a >>> 16;
  38684. c += b >>> 16;
  38685. d += c >>> 16;
  38686. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38687. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38688. h = ah3;
  38689. l = al3;
  38690. a = l & 0xffff; b = l >>> 16;
  38691. c = h & 0xffff; d = h >>> 16;
  38692. h = hh[3];
  38693. l = hl[3];
  38694. a += l & 0xffff; b += l >>> 16;
  38695. c += h & 0xffff; d += h >>> 16;
  38696. b += a >>> 16;
  38697. c += b >>> 16;
  38698. d += c >>> 16;
  38699. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38700. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38701. h = ah4;
  38702. l = al4;
  38703. a = l & 0xffff; b = l >>> 16;
  38704. c = h & 0xffff; d = h >>> 16;
  38705. h = hh[4];
  38706. l = hl[4];
  38707. a += l & 0xffff; b += l >>> 16;
  38708. c += h & 0xffff; d += h >>> 16;
  38709. b += a >>> 16;
  38710. c += b >>> 16;
  38711. d += c >>> 16;
  38712. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38713. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38714. h = ah5;
  38715. l = al5;
  38716. a = l & 0xffff; b = l >>> 16;
  38717. c = h & 0xffff; d = h >>> 16;
  38718. h = hh[5];
  38719. l = hl[5];
  38720. a += l & 0xffff; b += l >>> 16;
  38721. c += h & 0xffff; d += h >>> 16;
  38722. b += a >>> 16;
  38723. c += b >>> 16;
  38724. d += c >>> 16;
  38725. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38726. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38727. h = ah6;
  38728. l = al6;
  38729. a = l & 0xffff; b = l >>> 16;
  38730. c = h & 0xffff; d = h >>> 16;
  38731. h = hh[6];
  38732. l = hl[6];
  38733. a += l & 0xffff; b += l >>> 16;
  38734. c += h & 0xffff; d += h >>> 16;
  38735. b += a >>> 16;
  38736. c += b >>> 16;
  38737. d += c >>> 16;
  38738. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38739. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38740. h = ah7;
  38741. l = al7;
  38742. a = l & 0xffff; b = l >>> 16;
  38743. c = h & 0xffff; d = h >>> 16;
  38744. h = hh[7];
  38745. l = hl[7];
  38746. a += l & 0xffff; b += l >>> 16;
  38747. c += h & 0xffff; d += h >>> 16;
  38748. b += a >>> 16;
  38749. c += b >>> 16;
  38750. d += c >>> 16;
  38751. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38752. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38753. pos += 128;
  38754. n -= 128;
  38755. }
  38756. return n;
  38757. }
  38758. function crypto_hash(out, m, n) {
  38759. var hh = new Int32Array(8),
  38760. hl = new Int32Array(8),
  38761. x = new Uint8Array(256),
  38762. i, b = n;
  38763. hh[0] = 0x6a09e667;
  38764. hh[1] = 0xbb67ae85;
  38765. hh[2] = 0x3c6ef372;
  38766. hh[3] = 0xa54ff53a;
  38767. hh[4] = 0x510e527f;
  38768. hh[5] = 0x9b05688c;
  38769. hh[6] = 0x1f83d9ab;
  38770. hh[7] = 0x5be0cd19;
  38771. hl[0] = 0xf3bcc908;
  38772. hl[1] = 0x84caa73b;
  38773. hl[2] = 0xfe94f82b;
  38774. hl[3] = 0x5f1d36f1;
  38775. hl[4] = 0xade682d1;
  38776. hl[5] = 0x2b3e6c1f;
  38777. hl[6] = 0xfb41bd6b;
  38778. hl[7] = 0x137e2179;
  38779. crypto_hashblocks_hl(hh, hl, m, n);
  38780. n %= 128;
  38781. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38782. x[n] = 128;
  38783. n = 256-128*(n<112?1:0);
  38784. x[n-9] = 0;
  38785. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38786. crypto_hashblocks_hl(hh, hl, x, n);
  38787. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38788. return 0;
  38789. }
  38790. function add(p, q) {
  38791. var a = gf(), b = gf(), c = gf(),
  38792. d = gf(), e = gf(), f = gf(),
  38793. g = gf(), h = gf(), t = gf();
  38794. Z(a, p[1], p[0]);
  38795. Z(t, q[1], q[0]);
  38796. M(a, a, t);
  38797. A(b, p[0], p[1]);
  38798. A(t, q[0], q[1]);
  38799. M(b, b, t);
  38800. M(c, p[3], q[3]);
  38801. M(c, c, D2);
  38802. M(d, p[2], q[2]);
  38803. A(d, d, d);
  38804. Z(e, b, a);
  38805. Z(f, d, c);
  38806. A(g, d, c);
  38807. A(h, b, a);
  38808. M(p[0], e, f);
  38809. M(p[1], h, g);
  38810. M(p[2], g, f);
  38811. M(p[3], e, h);
  38812. }
  38813. function cswap(p, q, b) {
  38814. var i;
  38815. for (i = 0; i < 4; i++) {
  38816. sel25519(p[i], q[i], b);
  38817. }
  38818. }
  38819. function pack(r, p) {
  38820. var tx = gf(), ty = gf(), zi = gf();
  38821. inv25519(zi, p[2]);
  38822. M(tx, p[0], zi);
  38823. M(ty, p[1], zi);
  38824. pack25519(r, ty);
  38825. r[31] ^= par25519(tx) << 7;
  38826. }
  38827. function scalarmult(p, q, s) {
  38828. var b, i;
  38829. set25519(p[0], gf0);
  38830. set25519(p[1], gf1);
  38831. set25519(p[2], gf1);
  38832. set25519(p[3], gf0);
  38833. for (i = 255; i >= 0; --i) {
  38834. b = (s[(i/8)|0] >> (i&7)) & 1;
  38835. cswap(p, q, b);
  38836. add(q, p);
  38837. add(p, p);
  38838. cswap(p, q, b);
  38839. }
  38840. }
  38841. function scalarbase(p, s) {
  38842. var q = [gf(), gf(), gf(), gf()];
  38843. set25519(q[0], X);
  38844. set25519(q[1], Y);
  38845. set25519(q[2], gf1);
  38846. M(q[3], X, Y);
  38847. scalarmult(p, q, s);
  38848. }
  38849. function crypto_sign_keypair(pk, sk, seeded) {
  38850. var d = new Uint8Array(64);
  38851. var p = [gf(), gf(), gf(), gf()];
  38852. var i;
  38853. if (!seeded) randombytes(sk, 32);
  38854. crypto_hash(d, sk, 32);
  38855. d[0] &= 248;
  38856. d[31] &= 127;
  38857. d[31] |= 64;
  38858. scalarbase(p, d);
  38859. pack(pk, p);
  38860. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38861. return 0;
  38862. }
  38863. 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]);
  38864. function modL(r, x) {
  38865. var carry, i, j, k;
  38866. for (i = 63; i >= 32; --i) {
  38867. carry = 0;
  38868. for (j = i - 32, k = i - 12; j < k; ++j) {
  38869. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38870. carry = (x[j] + 128) >> 8;
  38871. x[j] -= carry * 256;
  38872. }
  38873. x[j] += carry;
  38874. x[i] = 0;
  38875. }
  38876. carry = 0;
  38877. for (j = 0; j < 32; j++) {
  38878. x[j] += carry - (x[31] >> 4) * L[j];
  38879. carry = x[j] >> 8;
  38880. x[j] &= 255;
  38881. }
  38882. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38883. for (i = 0; i < 32; i++) {
  38884. x[i+1] += x[i] >> 8;
  38885. r[i] = x[i] & 255;
  38886. }
  38887. }
  38888. function reduce(r) {
  38889. var x = new Float64Array(64), i;
  38890. for (i = 0; i < 64; i++) x[i] = r[i];
  38891. for (i = 0; i < 64; i++) r[i] = 0;
  38892. modL(r, x);
  38893. }
  38894. // Note: difference from C - smlen returned, not passed as argument.
  38895. function crypto_sign(sm, m, n, sk) {
  38896. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38897. var i, j, x = new Float64Array(64);
  38898. var p = [gf(), gf(), gf(), gf()];
  38899. crypto_hash(d, sk, 32);
  38900. d[0] &= 248;
  38901. d[31] &= 127;
  38902. d[31] |= 64;
  38903. var smlen = n + 64;
  38904. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38905. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38906. crypto_hash(r, sm.subarray(32), n+32);
  38907. reduce(r);
  38908. scalarbase(p, r);
  38909. pack(sm, p);
  38910. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38911. crypto_hash(h, sm, n + 64);
  38912. reduce(h);
  38913. for (i = 0; i < 64; i++) x[i] = 0;
  38914. for (i = 0; i < 32; i++) x[i] = r[i];
  38915. for (i = 0; i < 32; i++) {
  38916. for (j = 0; j < 32; j++) {
  38917. x[i+j] += h[i] * d[j];
  38918. }
  38919. }
  38920. modL(sm.subarray(32), x);
  38921. return smlen;
  38922. }
  38923. function unpackneg(r, p) {
  38924. var t = gf(), chk = gf(), num = gf(),
  38925. den = gf(), den2 = gf(), den4 = gf(),
  38926. den6 = gf();
  38927. set25519(r[2], gf1);
  38928. unpack25519(r[1], p);
  38929. S(num, r[1]);
  38930. M(den, num, D);
  38931. Z(num, num, r[2]);
  38932. A(den, r[2], den);
  38933. S(den2, den);
  38934. S(den4, den2);
  38935. M(den6, den4, den2);
  38936. M(t, den6, num);
  38937. M(t, t, den);
  38938. pow2523(t, t);
  38939. M(t, t, num);
  38940. M(t, t, den);
  38941. M(t, t, den);
  38942. M(r[0], t, den);
  38943. S(chk, r[0]);
  38944. M(chk, chk, den);
  38945. if (neq25519(chk, num)) M(r[0], r[0], I);
  38946. S(chk, r[0]);
  38947. M(chk, chk, den);
  38948. if (neq25519(chk, num)) return -1;
  38949. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38950. M(r[3], r[0], r[1]);
  38951. return 0;
  38952. }
  38953. function crypto_sign_open(m, sm, n, pk) {
  38954. var i, mlen;
  38955. var t = new Uint8Array(32), h = new Uint8Array(64);
  38956. var p = [gf(), gf(), gf(), gf()],
  38957. q = [gf(), gf(), gf(), gf()];
  38958. mlen = -1;
  38959. if (n < 64) return -1;
  38960. if (unpackneg(q, pk)) return -1;
  38961. for (i = 0; i < n; i++) m[i] = sm[i];
  38962. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38963. crypto_hash(h, m, n);
  38964. reduce(h);
  38965. scalarmult(p, q, h);
  38966. scalarbase(q, sm.subarray(32));
  38967. add(p, q);
  38968. pack(t, p);
  38969. n -= 64;
  38970. if (crypto_verify_32(sm, 0, t, 0)) {
  38971. for (i = 0; i < n; i++) m[i] = 0;
  38972. return -1;
  38973. }
  38974. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38975. mlen = n;
  38976. return mlen;
  38977. }
  38978. var crypto_secretbox_KEYBYTES = 32,
  38979. crypto_secretbox_NONCEBYTES = 24,
  38980. crypto_secretbox_ZEROBYTES = 32,
  38981. crypto_secretbox_BOXZEROBYTES = 16,
  38982. crypto_scalarmult_BYTES = 32,
  38983. crypto_scalarmult_SCALARBYTES = 32,
  38984. crypto_box_PUBLICKEYBYTES = 32,
  38985. crypto_box_SECRETKEYBYTES = 32,
  38986. crypto_box_BEFORENMBYTES = 32,
  38987. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38988. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38989. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38990. crypto_sign_BYTES = 64,
  38991. crypto_sign_PUBLICKEYBYTES = 32,
  38992. crypto_sign_SECRETKEYBYTES = 64,
  38993. crypto_sign_SEEDBYTES = 32,
  38994. crypto_hash_BYTES = 64;
  38995. nacl.lowlevel = {
  38996. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38997. crypto_stream_xor: crypto_stream_xor,
  38998. crypto_stream: crypto_stream,
  38999. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39000. crypto_stream_salsa20: crypto_stream_salsa20,
  39001. crypto_onetimeauth: crypto_onetimeauth,
  39002. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39003. crypto_verify_16: crypto_verify_16,
  39004. crypto_verify_32: crypto_verify_32,
  39005. crypto_secretbox: crypto_secretbox,
  39006. crypto_secretbox_open: crypto_secretbox_open,
  39007. crypto_scalarmult: crypto_scalarmult,
  39008. crypto_scalarmult_base: crypto_scalarmult_base,
  39009. crypto_box_beforenm: crypto_box_beforenm,
  39010. crypto_box_afternm: crypto_box_afternm,
  39011. crypto_box: crypto_box,
  39012. crypto_box_open: crypto_box_open,
  39013. crypto_box_keypair: crypto_box_keypair,
  39014. crypto_hash: crypto_hash,
  39015. crypto_sign: crypto_sign,
  39016. crypto_sign_keypair: crypto_sign_keypair,
  39017. crypto_sign_open: crypto_sign_open,
  39018. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39019. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39020. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39021. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39022. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39023. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39024. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39025. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39026. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39027. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39028. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39029. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39030. crypto_sign_BYTES: crypto_sign_BYTES,
  39031. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39032. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39033. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39034. crypto_hash_BYTES: crypto_hash_BYTES
  39035. };
  39036. /* High-level API */
  39037. function checkLengths(k, n) {
  39038. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39039. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39040. }
  39041. function checkBoxLengths(pk, sk) {
  39042. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39043. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39044. }
  39045. function checkArrayTypes() {
  39046. for (var i = 0; i < arguments.length; i++) {
  39047. if (!(arguments[i] instanceof Uint8Array))
  39048. throw new TypeError('unexpected type, use Uint8Array');
  39049. }
  39050. }
  39051. function cleanup(arr) {
  39052. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39053. }
  39054. nacl.randomBytes = function(n) {
  39055. var b = new Uint8Array(n);
  39056. randombytes(b, n);
  39057. return b;
  39058. };
  39059. nacl.secretbox = function(msg, nonce, key) {
  39060. checkArrayTypes(msg, nonce, key);
  39061. checkLengths(key, nonce);
  39062. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39063. var c = new Uint8Array(m.length);
  39064. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39065. crypto_secretbox(c, m, m.length, nonce, key);
  39066. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39067. };
  39068. nacl.secretbox.open = function(box, nonce, key) {
  39069. checkArrayTypes(box, nonce, key);
  39070. checkLengths(key, nonce);
  39071. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39072. var m = new Uint8Array(c.length);
  39073. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39074. if (c.length < 32) return null;
  39075. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39076. return m.subarray(crypto_secretbox_ZEROBYTES);
  39077. };
  39078. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39079. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39080. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39081. nacl.scalarMult = function(n, p) {
  39082. checkArrayTypes(n, p);
  39083. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39084. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39085. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39086. crypto_scalarmult(q, n, p);
  39087. return q;
  39088. };
  39089. nacl.scalarMult.base = function(n) {
  39090. checkArrayTypes(n);
  39091. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39092. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39093. crypto_scalarmult_base(q, n);
  39094. return q;
  39095. };
  39096. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39097. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39098. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39099. var k = nacl.box.before(publicKey, secretKey);
  39100. return nacl.secretbox(msg, nonce, k);
  39101. };
  39102. nacl.box.before = function(publicKey, secretKey) {
  39103. checkArrayTypes(publicKey, secretKey);
  39104. checkBoxLengths(publicKey, secretKey);
  39105. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39106. crypto_box_beforenm(k, publicKey, secretKey);
  39107. return k;
  39108. };
  39109. nacl.box.after = nacl.secretbox;
  39110. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39111. var k = nacl.box.before(publicKey, secretKey);
  39112. return nacl.secretbox.open(msg, nonce, k);
  39113. };
  39114. nacl.box.open.after = nacl.secretbox.open;
  39115. nacl.box.keyPair = function() {
  39116. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39117. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39118. crypto_box_keypair(pk, sk);
  39119. return {publicKey: pk, secretKey: sk};
  39120. };
  39121. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39122. checkArrayTypes(secretKey);
  39123. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39124. throw new Error('bad secret key size');
  39125. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39126. crypto_scalarmult_base(pk, secretKey);
  39127. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39128. };
  39129. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39130. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39131. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39132. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39133. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39134. nacl.sign = function(msg, secretKey) {
  39135. checkArrayTypes(msg, secretKey);
  39136. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39137. throw new Error('bad secret key size');
  39138. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39139. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39140. return signedMsg;
  39141. };
  39142. nacl.sign.open = function(signedMsg, publicKey) {
  39143. checkArrayTypes(signedMsg, publicKey);
  39144. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39145. throw new Error('bad public key size');
  39146. var tmp = new Uint8Array(signedMsg.length);
  39147. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39148. if (mlen < 0) return null;
  39149. var m = new Uint8Array(mlen);
  39150. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39151. return m;
  39152. };
  39153. nacl.sign.detached = function(msg, secretKey) {
  39154. var signedMsg = nacl.sign(msg, secretKey);
  39155. var sig = new Uint8Array(crypto_sign_BYTES);
  39156. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39157. return sig;
  39158. };
  39159. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39160. checkArrayTypes(msg, sig, publicKey);
  39161. if (sig.length !== crypto_sign_BYTES)
  39162. throw new Error('bad signature size');
  39163. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39164. throw new Error('bad public key size');
  39165. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39166. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39167. var i;
  39168. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39169. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39170. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39171. };
  39172. nacl.sign.keyPair = function() {
  39173. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39174. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39175. crypto_sign_keypair(pk, sk);
  39176. return {publicKey: pk, secretKey: sk};
  39177. };
  39178. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39179. checkArrayTypes(secretKey);
  39180. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39181. throw new Error('bad secret key size');
  39182. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39183. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39184. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39185. };
  39186. nacl.sign.keyPair.fromSeed = function(seed) {
  39187. checkArrayTypes(seed);
  39188. if (seed.length !== crypto_sign_SEEDBYTES)
  39189. throw new Error('bad seed size');
  39190. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39191. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39192. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39193. crypto_sign_keypair(pk, sk, true);
  39194. return {publicKey: pk, secretKey: sk};
  39195. };
  39196. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39197. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39198. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39199. nacl.sign.signatureLength = crypto_sign_BYTES;
  39200. nacl.hash = function(msg) {
  39201. checkArrayTypes(msg);
  39202. var h = new Uint8Array(crypto_hash_BYTES);
  39203. crypto_hash(h, msg, msg.length);
  39204. return h;
  39205. };
  39206. nacl.hash.hashLength = crypto_hash_BYTES;
  39207. nacl.verify = function(x, y) {
  39208. checkArrayTypes(x, y);
  39209. // Zero length arguments are considered not equal.
  39210. if (x.length === 0 || y.length === 0) return false;
  39211. if (x.length !== y.length) return false;
  39212. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39213. };
  39214. nacl.setPRNG = function(fn) {
  39215. randombytes = fn;
  39216. };
  39217. (function() {
  39218. // Initialize PRNG if environment provides CSPRNG.
  39219. // If not, methods calling randombytes will throw.
  39220. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39221. if (crypto && crypto.getRandomValues) {
  39222. // Browsers.
  39223. var QUOTA = 65536;
  39224. nacl.setPRNG(function(x, n) {
  39225. var i, v = new Uint8Array(n);
  39226. for (i = 0; i < n; i += QUOTA) {
  39227. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39228. }
  39229. for (i = 0; i < n; i++) x[i] = v[i];
  39230. cleanup(v);
  39231. });
  39232. } else if (true) {
  39233. // Node.js.
  39234. crypto = __webpack_require__(3);
  39235. if (crypto && crypto.randomBytes) {
  39236. nacl.setPRNG(function(x, n) {
  39237. var i, v = crypto.randomBytes(n);
  39238. for (i = 0; i < n; i++) x[i] = v[i];
  39239. cleanup(v);
  39240. });
  39241. }
  39242. }
  39243. })();
  39244. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39245. /***/ }),
  39246. /* 1 */
  39247. /***/ (function(module, exports, __webpack_require__) {
  39248. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39249. // Public domain.
  39250. (function(root, f) {
  39251. 'use strict';
  39252. if ( true && module.exports) module.exports = f();
  39253. else if (root.nacl) root.nacl.util = f();
  39254. else {
  39255. root.nacl = {};
  39256. root.nacl.util = f();
  39257. }
  39258. }(this, function() {
  39259. 'use strict';
  39260. var util = {};
  39261. function validateBase64(s) {
  39262. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39263. throw new TypeError('invalid encoding');
  39264. }
  39265. }
  39266. util.decodeUTF8 = function(s) {
  39267. if (typeof s !== 'string') throw new TypeError('expected string');
  39268. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39269. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39270. return b;
  39271. };
  39272. util.encodeUTF8 = function(arr) {
  39273. var i, s = [];
  39274. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39275. return decodeURIComponent(escape(s.join('')));
  39276. };
  39277. if (typeof atob === 'undefined') {
  39278. // Node.js
  39279. if (typeof Buffer.from !== 'undefined') {
  39280. // Node v6 and later
  39281. util.encodeBase64 = function (arr) { // v6 and later
  39282. return Buffer.from(arr).toString('base64');
  39283. };
  39284. util.decodeBase64 = function (s) {
  39285. validateBase64(s);
  39286. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39287. };
  39288. } else {
  39289. // Node earlier than v6
  39290. util.encodeBase64 = function (arr) { // v6 and later
  39291. return (new Buffer(arr)).toString('base64');
  39292. };
  39293. util.decodeBase64 = function(s) {
  39294. validateBase64(s);
  39295. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39296. };
  39297. }
  39298. } else {
  39299. // Browsers
  39300. util.encodeBase64 = function(arr) {
  39301. var i, s = [], len = arr.length;
  39302. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39303. return btoa(s.join(''));
  39304. };
  39305. util.decodeBase64 = function(s) {
  39306. validateBase64(s);
  39307. var i, d = atob(s), b = new Uint8Array(d.length);
  39308. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39309. return b;
  39310. };
  39311. }
  39312. return util;
  39313. }));
  39314. /***/ }),
  39315. /* 2 */
  39316. /***/ (function(module, exports, __webpack_require__) {
  39317. // required so we don't have to do require('pusher').default etc.
  39318. module.exports = __webpack_require__(4).default;
  39319. /***/ }),
  39320. /* 3 */
  39321. /***/ (function(module, exports) {
  39322. /* (ignored) */
  39323. /***/ }),
  39324. /* 4 */
  39325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39326. "use strict";
  39327. __webpack_require__.r(__webpack_exports__);
  39328. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39329. var ScriptReceiverFactory = (function () {
  39330. function ScriptReceiverFactory(prefix, name) {
  39331. this.lastId = 0;
  39332. this.prefix = prefix;
  39333. this.name = name;
  39334. }
  39335. ScriptReceiverFactory.prototype.create = function (callback) {
  39336. this.lastId++;
  39337. var number = this.lastId;
  39338. var id = this.prefix + number;
  39339. var name = this.name + "[" + number + "]";
  39340. var called = false;
  39341. var callbackWrapper = function () {
  39342. if (!called) {
  39343. callback.apply(null, arguments);
  39344. called = true;
  39345. }
  39346. };
  39347. this[number] = callbackWrapper;
  39348. return { number: number, id: id, name: name, callback: callbackWrapper };
  39349. };
  39350. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39351. delete this[receiver.number];
  39352. };
  39353. return ScriptReceiverFactory;
  39354. }());
  39355. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39356. // CONCATENATED MODULE: ./src/core/defaults.ts
  39357. var Defaults = {
  39358. VERSION: "5.0.3",
  39359. PROTOCOL: 7,
  39360. host: 'ws.pusherapp.com',
  39361. ws_port: 80,
  39362. wss_port: 443,
  39363. ws_path: '',
  39364. sockjs_host: 'sockjs.pusher.com',
  39365. sockjs_http_port: 80,
  39366. sockjs_https_port: 443,
  39367. sockjs_path: '/pusher',
  39368. stats_host: 'stats.pusher.com',
  39369. channel_auth_endpoint: '/pusher/auth',
  39370. channel_auth_transport: 'ajax',
  39371. activity_timeout: 120000,
  39372. pong_timeout: 30000,
  39373. unavailable_timeout: 10000,
  39374. cdn_http: "http://js.pusher.com",
  39375. cdn_https: "https://js.pusher.com",
  39376. dependency_suffix: ""
  39377. };
  39378. /* harmony default export */ var defaults = (Defaults);
  39379. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39380. var dependency_loader_DependencyLoader = (function () {
  39381. function DependencyLoader(options) {
  39382. this.options = options;
  39383. this.receivers = options.receivers || ScriptReceivers;
  39384. this.loading = {};
  39385. }
  39386. DependencyLoader.prototype.load = function (name, options, callback) {
  39387. var self = this;
  39388. if (self.loading[name] && self.loading[name].length > 0) {
  39389. self.loading[name].push(callback);
  39390. }
  39391. else {
  39392. self.loading[name] = [callback];
  39393. var request = runtime.createScriptRequest(self.getPath(name, options));
  39394. var receiver = self.receivers.create(function (error) {
  39395. self.receivers.remove(receiver);
  39396. if (self.loading[name]) {
  39397. var callbacks = self.loading[name];
  39398. delete self.loading[name];
  39399. var successCallback = function (wasSuccessful) {
  39400. if (!wasSuccessful) {
  39401. request.cleanup();
  39402. }
  39403. };
  39404. for (var i = 0; i < callbacks.length; i++) {
  39405. callbacks[i](error, successCallback);
  39406. }
  39407. }
  39408. });
  39409. request.send(receiver);
  39410. }
  39411. };
  39412. DependencyLoader.prototype.getRoot = function (options) {
  39413. var cdn;
  39414. var protocol = runtime.getDocument().location.protocol;
  39415. if ((options && options.useTLS) || protocol === "https:") {
  39416. cdn = this.options.cdn_https;
  39417. }
  39418. else {
  39419. cdn = this.options.cdn_http;
  39420. }
  39421. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39422. };
  39423. DependencyLoader.prototype.getPath = function (name, options) {
  39424. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39425. };
  39426. ;
  39427. return DependencyLoader;
  39428. }());
  39429. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39430. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39431. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39432. var Dependencies = new dependency_loader({
  39433. cdn_http: defaults.cdn_http,
  39434. cdn_https: defaults.cdn_https,
  39435. version: defaults.VERSION,
  39436. suffix: defaults.dependency_suffix,
  39437. receivers: DependenciesReceivers
  39438. });
  39439. // CONCATENATED MODULE: ./src/core/base64.ts
  39440. function encode(s) {
  39441. return btoa(utob(s));
  39442. }
  39443. var fromCharCode = String.fromCharCode;
  39444. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39445. var b64tab = {};
  39446. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39447. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39448. }
  39449. var cb_utob = function (c) {
  39450. var cc = c.charCodeAt(0);
  39451. return cc < 0x80
  39452. ? c
  39453. : cc < 0x800
  39454. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39455. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39456. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39457. fromCharCode(0x80 | (cc & 0x3f));
  39458. };
  39459. var utob = function (u) {
  39460. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39461. };
  39462. var cb_encode = function (ccc) {
  39463. var padlen = [0, 2, 1][ccc.length % 3];
  39464. var ord = (ccc.charCodeAt(0) << 16) |
  39465. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39466. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39467. var chars = [
  39468. b64chars.charAt(ord >>> 18),
  39469. b64chars.charAt((ord >>> 12) & 63),
  39470. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39471. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39472. ];
  39473. return chars.join('');
  39474. };
  39475. var btoa = window.btoa ||
  39476. function (b) {
  39477. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39478. };
  39479. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39480. var Timer = (function () {
  39481. function Timer(set, clear, delay, callback) {
  39482. var _this = this;
  39483. this.clear = clear;
  39484. this.timer = set(function () {
  39485. if (_this.timer) {
  39486. _this.timer = callback(_this.timer);
  39487. }
  39488. }, delay);
  39489. }
  39490. Timer.prototype.isRunning = function () {
  39491. return this.timer !== null;
  39492. };
  39493. Timer.prototype.ensureAborted = function () {
  39494. if (this.timer) {
  39495. this.clear(this.timer);
  39496. this.timer = null;
  39497. }
  39498. };
  39499. return Timer;
  39500. }());
  39501. /* harmony default export */ var abstract_timer = (Timer);
  39502. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39503. var __extends = (undefined && undefined.__extends) || (function () {
  39504. var extendStatics = function (d, b) {
  39505. extendStatics = Object.setPrototypeOf ||
  39506. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39507. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39508. return extendStatics(d, b);
  39509. };
  39510. return function (d, b) {
  39511. extendStatics(d, b);
  39512. function __() { this.constructor = d; }
  39513. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39514. };
  39515. })();
  39516. function timers_clearTimeout(timer) {
  39517. window.clearTimeout(timer);
  39518. }
  39519. function timers_clearInterval(timer) {
  39520. window.clearInterval(timer);
  39521. }
  39522. var OneOffTimer = (function (_super) {
  39523. __extends(OneOffTimer, _super);
  39524. function OneOffTimer(delay, callback) {
  39525. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39526. callback();
  39527. return null;
  39528. }) || this;
  39529. }
  39530. return OneOffTimer;
  39531. }(abstract_timer));
  39532. var PeriodicTimer = (function (_super) {
  39533. __extends(PeriodicTimer, _super);
  39534. function PeriodicTimer(delay, callback) {
  39535. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39536. callback();
  39537. return timer;
  39538. }) || this;
  39539. }
  39540. return PeriodicTimer;
  39541. }(abstract_timer));
  39542. // CONCATENATED MODULE: ./src/core/util.ts
  39543. var Util = {
  39544. now: function () {
  39545. if (Date.now) {
  39546. return Date.now();
  39547. }
  39548. else {
  39549. return new Date().valueOf();
  39550. }
  39551. },
  39552. defer: function (callback) {
  39553. return new OneOffTimer(0, callback);
  39554. },
  39555. method: function (name) {
  39556. var args = [];
  39557. for (var _i = 1; _i < arguments.length; _i++) {
  39558. args[_i - 1] = arguments[_i];
  39559. }
  39560. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39561. return function (object) {
  39562. return object[name].apply(object, boundArguments.concat(arguments));
  39563. };
  39564. }
  39565. };
  39566. /* harmony default export */ var util = (Util);
  39567. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39568. function extend(target) {
  39569. var sources = [];
  39570. for (var _i = 1; _i < arguments.length; _i++) {
  39571. sources[_i - 1] = arguments[_i];
  39572. }
  39573. for (var i = 0; i < sources.length; i++) {
  39574. var extensions = sources[i];
  39575. for (var property in extensions) {
  39576. if (extensions[property] && extensions[property].constructor &&
  39577. extensions[property].constructor === Object) {
  39578. target[property] = extend(target[property] || {}, extensions[property]);
  39579. }
  39580. else {
  39581. target[property] = extensions[property];
  39582. }
  39583. }
  39584. }
  39585. return target;
  39586. }
  39587. function stringify() {
  39588. var m = ["Pusher"];
  39589. for (var i = 0; i < arguments.length; i++) {
  39590. if (typeof arguments[i] === "string") {
  39591. m.push(arguments[i]);
  39592. }
  39593. else {
  39594. m.push(safeJSONStringify(arguments[i]));
  39595. }
  39596. }
  39597. return m.join(" : ");
  39598. }
  39599. function arrayIndexOf(array, item) {
  39600. var nativeIndexOf = Array.prototype.indexOf;
  39601. if (array === null) {
  39602. return -1;
  39603. }
  39604. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39605. return array.indexOf(item);
  39606. }
  39607. for (var i = 0, l = array.length; i < l; i++) {
  39608. if (array[i] === item) {
  39609. return i;
  39610. }
  39611. }
  39612. return -1;
  39613. }
  39614. function objectApply(object, f) {
  39615. for (var key in object) {
  39616. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39617. f(object[key], key, object);
  39618. }
  39619. }
  39620. }
  39621. function keys(object) {
  39622. var keys = [];
  39623. objectApply(object, function (_, key) {
  39624. keys.push(key);
  39625. });
  39626. return keys;
  39627. }
  39628. function values(object) {
  39629. var values = [];
  39630. objectApply(object, function (value) {
  39631. values.push(value);
  39632. });
  39633. return values;
  39634. }
  39635. function apply(array, f, context) {
  39636. for (var i = 0; i < array.length; i++) {
  39637. f.call(context || window, array[i], i, array);
  39638. }
  39639. }
  39640. function map(array, f) {
  39641. var result = [];
  39642. for (var i = 0; i < array.length; i++) {
  39643. result.push(f(array[i], i, array, result));
  39644. }
  39645. return result;
  39646. }
  39647. function mapObject(object, f) {
  39648. var result = {};
  39649. objectApply(object, function (value, key) {
  39650. result[key] = f(value);
  39651. });
  39652. return result;
  39653. }
  39654. function filter(array, test) {
  39655. test = test || function (value) { return !!value; };
  39656. var result = [];
  39657. for (var i = 0; i < array.length; i++) {
  39658. if (test(array[i], i, array, result)) {
  39659. result.push(array[i]);
  39660. }
  39661. }
  39662. return result;
  39663. }
  39664. function filterObject(object, test) {
  39665. var result = {};
  39666. objectApply(object, function (value, key) {
  39667. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39668. result[key] = value;
  39669. }
  39670. });
  39671. return result;
  39672. }
  39673. function flatten(object) {
  39674. var result = [];
  39675. objectApply(object, function (value, key) {
  39676. result.push([key, value]);
  39677. });
  39678. return result;
  39679. }
  39680. function any(array, test) {
  39681. for (var i = 0; i < array.length; i++) {
  39682. if (test(array[i], i, array)) {
  39683. return true;
  39684. }
  39685. }
  39686. return false;
  39687. }
  39688. function collections_all(array, test) {
  39689. for (var i = 0; i < array.length; i++) {
  39690. if (!test(array[i], i, array)) {
  39691. return false;
  39692. }
  39693. }
  39694. return true;
  39695. }
  39696. function encodeParamsObject(data) {
  39697. return mapObject(data, function (value) {
  39698. if (typeof value === "object") {
  39699. value = safeJSONStringify(value);
  39700. }
  39701. return encodeURIComponent(encode(value.toString()));
  39702. });
  39703. }
  39704. function buildQueryString(data) {
  39705. var params = filterObject(data, function (value) {
  39706. return value !== undefined;
  39707. });
  39708. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39709. return query;
  39710. }
  39711. function decycleObject(object) {
  39712. var objects = [], paths = [];
  39713. return (function derez(value, path) {
  39714. var i, name, nu;
  39715. switch (typeof value) {
  39716. case 'object':
  39717. if (!value) {
  39718. return null;
  39719. }
  39720. for (i = 0; i < objects.length; i += 1) {
  39721. if (objects[i] === value) {
  39722. return { $ref: paths[i] };
  39723. }
  39724. }
  39725. objects.push(value);
  39726. paths.push(path);
  39727. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39728. nu = [];
  39729. for (i = 0; i < value.length; i += 1) {
  39730. nu[i] = derez(value[i], path + '[' + i + ']');
  39731. }
  39732. }
  39733. else {
  39734. nu = {};
  39735. for (name in value) {
  39736. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39737. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39738. }
  39739. }
  39740. }
  39741. return nu;
  39742. case 'number':
  39743. case 'string':
  39744. case 'boolean':
  39745. return value;
  39746. }
  39747. }(object, '$'));
  39748. }
  39749. function safeJSONStringify(source) {
  39750. try {
  39751. return JSON.stringify(source);
  39752. }
  39753. catch (e) {
  39754. return JSON.stringify(decycleObject(source));
  39755. }
  39756. }
  39757. // CONCATENATED MODULE: ./src/core/logger.ts
  39758. var logger_Logger = (function () {
  39759. function Logger() {
  39760. this.globalLog = function (message) {
  39761. if (window.console && window.console.log) {
  39762. window.console.log(message);
  39763. }
  39764. };
  39765. }
  39766. Logger.prototype.debug = function () {
  39767. var args = [];
  39768. for (var _i = 0; _i < arguments.length; _i++) {
  39769. args[_i] = arguments[_i];
  39770. }
  39771. this.log(this.globalLog, args);
  39772. };
  39773. Logger.prototype.warn = function () {
  39774. var args = [];
  39775. for (var _i = 0; _i < arguments.length; _i++) {
  39776. args[_i] = arguments[_i];
  39777. }
  39778. this.log(this.globalLogWarn, args);
  39779. };
  39780. Logger.prototype.error = function () {
  39781. var args = [];
  39782. for (var _i = 0; _i < arguments.length; _i++) {
  39783. args[_i] = arguments[_i];
  39784. }
  39785. this.log(this.globalLogError, args);
  39786. };
  39787. Logger.prototype.globalLogWarn = function (message) {
  39788. if (window.console && window.console.warn) {
  39789. window.console.warn(message);
  39790. }
  39791. else {
  39792. this.globalLog(message);
  39793. }
  39794. };
  39795. Logger.prototype.globalLogError = function (message) {
  39796. if (window.console && window.console.error) {
  39797. window.console.error(message);
  39798. }
  39799. else {
  39800. this.globalLogWarn(message);
  39801. }
  39802. };
  39803. Logger.prototype.log = function (defaultLoggingFunction) {
  39804. var args = [];
  39805. for (var _i = 1; _i < arguments.length; _i++) {
  39806. args[_i - 1] = arguments[_i];
  39807. }
  39808. var message = stringify.apply(this, arguments);
  39809. if (core_pusher.log) {
  39810. core_pusher.log(message);
  39811. }
  39812. else if (core_pusher.logToConsole) {
  39813. var log = defaultLoggingFunction.bind(this);
  39814. log(message);
  39815. }
  39816. };
  39817. return Logger;
  39818. }());
  39819. /* harmony default export */ var logger = (new logger_Logger());
  39820. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39821. var urlStore = {
  39822. baseUrl: "https://pusher.com",
  39823. urls: {
  39824. authenticationEndpoint: {
  39825. path: "/docs/authenticating_users",
  39826. },
  39827. javascriptQuickStart: {
  39828. path: "/docs/javascript_quick_start"
  39829. },
  39830. triggeringClientEvents: {
  39831. path: "/docs/client_api_guide/client_events#trigger-events"
  39832. }
  39833. }
  39834. };
  39835. var buildLogSuffix = function (key) {
  39836. var urlPrefix = "See:";
  39837. var urlObj = urlStore.urls[key];
  39838. if (!urlObj)
  39839. return "";
  39840. var url;
  39841. if (urlObj.fullUrl) {
  39842. url = urlObj.fullUrl;
  39843. }
  39844. else if (urlObj.path) {
  39845. url = urlStore.baseUrl + urlObj.path;
  39846. }
  39847. if (!url)
  39848. return "";
  39849. return urlPrefix + " " + url;
  39850. };
  39851. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39852. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39853. var ajax = function (context, socketId, callback) {
  39854. var self = this, xhr;
  39855. xhr = runtime.createXHR();
  39856. xhr.open("POST", self.options.authEndpoint, true);
  39857. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39858. for (var headerName in this.authOptions.headers) {
  39859. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39860. }
  39861. xhr.onreadystatechange = function () {
  39862. if (xhr.readyState === 4) {
  39863. if (xhr.status === 200) {
  39864. var data, parsed = false;
  39865. try {
  39866. data = JSON.parse(xhr.responseText);
  39867. parsed = true;
  39868. }
  39869. catch (e) {
  39870. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39871. }
  39872. if (parsed) {
  39873. callback(false, data);
  39874. }
  39875. }
  39876. else {
  39877. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39878. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39879. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39880. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39881. callback(true, xhr.status);
  39882. }
  39883. }
  39884. };
  39885. xhr.send(this.composeQuery(socketId));
  39886. return xhr;
  39887. };
  39888. /* harmony default export */ var xhr_auth = (ajax);
  39889. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39890. var jsonp = function (context, socketId, callback) {
  39891. if (this.authOptions.headers !== undefined) {
  39892. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39893. }
  39894. var callbackName = context.nextAuthCallbackID.toString();
  39895. context.nextAuthCallbackID++;
  39896. var document = context.getDocument();
  39897. var script = document.createElement("script");
  39898. context.auth_callbacks[callbackName] = function (data) {
  39899. callback(false, data);
  39900. };
  39901. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39902. script.src = this.options.authEndpoint +
  39903. '?callback=' +
  39904. encodeURIComponent(callback_name) +
  39905. '&' +
  39906. this.composeQuery(socketId);
  39907. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39908. head.insertBefore(script, head.firstChild);
  39909. };
  39910. /* harmony default export */ var jsonp_auth = (jsonp);
  39911. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39912. var ScriptRequest = (function () {
  39913. function ScriptRequest(src) {
  39914. this.src = src;
  39915. }
  39916. ScriptRequest.prototype.send = function (receiver) {
  39917. var self = this;
  39918. var errorString = "Error loading " + self.src;
  39919. self.script = document.createElement("script");
  39920. self.script.id = receiver.id;
  39921. self.script.src = self.src;
  39922. self.script.type = "text/javascript";
  39923. self.script.charset = "UTF-8";
  39924. if (self.script.addEventListener) {
  39925. self.script.onerror = function () {
  39926. receiver.callback(errorString);
  39927. };
  39928. self.script.onload = function () {
  39929. receiver.callback(null);
  39930. };
  39931. }
  39932. else {
  39933. self.script.onreadystatechange = function () {
  39934. if (self.script.readyState === 'loaded' ||
  39935. self.script.readyState === 'complete') {
  39936. receiver.callback(null);
  39937. }
  39938. };
  39939. }
  39940. if (self.script.async === undefined && document.attachEvent &&
  39941. /opera/i.test(navigator.userAgent)) {
  39942. self.errorScript = document.createElement("script");
  39943. self.errorScript.id = receiver.id + "_error";
  39944. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39945. self.script.async = self.errorScript.async = false;
  39946. }
  39947. else {
  39948. self.script.async = true;
  39949. }
  39950. var head = document.getElementsByTagName('head')[0];
  39951. head.insertBefore(self.script, head.firstChild);
  39952. if (self.errorScript) {
  39953. head.insertBefore(self.errorScript, self.script.nextSibling);
  39954. }
  39955. };
  39956. ScriptRequest.prototype.cleanup = function () {
  39957. if (this.script) {
  39958. this.script.onload = this.script.onerror = null;
  39959. this.script.onreadystatechange = null;
  39960. }
  39961. if (this.script && this.script.parentNode) {
  39962. this.script.parentNode.removeChild(this.script);
  39963. }
  39964. if (this.errorScript && this.errorScript.parentNode) {
  39965. this.errorScript.parentNode.removeChild(this.errorScript);
  39966. }
  39967. this.script = null;
  39968. this.errorScript = null;
  39969. };
  39970. return ScriptRequest;
  39971. }());
  39972. /* harmony default export */ var script_request = (ScriptRequest);
  39973. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39974. var jsonp_request_JSONPRequest = (function () {
  39975. function JSONPRequest(url, data) {
  39976. this.url = url;
  39977. this.data = data;
  39978. }
  39979. JSONPRequest.prototype.send = function (receiver) {
  39980. if (this.request) {
  39981. return;
  39982. }
  39983. var query = buildQueryString(this.data);
  39984. var url = this.url + "/" + receiver.number + "?" + query;
  39985. this.request = runtime.createScriptRequest(url);
  39986. this.request.send(receiver);
  39987. };
  39988. JSONPRequest.prototype.cleanup = function () {
  39989. if (this.request) {
  39990. this.request.cleanup();
  39991. }
  39992. };
  39993. return JSONPRequest;
  39994. }());
  39995. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39996. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39997. var getAgent = function (sender, useTLS) {
  39998. return function (data, callback) {
  39999. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40000. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40001. var request = runtime.createJSONPRequest(url, data);
  40002. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40003. ScriptReceivers.remove(receiver);
  40004. request.cleanup();
  40005. if (result && result.host) {
  40006. sender.host = result.host;
  40007. }
  40008. if (callback) {
  40009. callback(error, result);
  40010. }
  40011. });
  40012. request.send(receiver);
  40013. };
  40014. };
  40015. var jsonp_timeline_jsonp = {
  40016. name: 'jsonp',
  40017. getAgent: getAgent
  40018. };
  40019. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40020. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40021. function getGenericURL(baseScheme, params, path) {
  40022. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40023. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40024. return scheme + "://" + host + path;
  40025. }
  40026. function getGenericPath(key, queryString) {
  40027. var path = "/app/" + key;
  40028. var query = "?protocol=" + defaults.PROTOCOL +
  40029. "&client=js" +
  40030. "&version=" + defaults.VERSION +
  40031. (queryString ? ("&" + queryString) : "");
  40032. return path + query;
  40033. }
  40034. var ws = {
  40035. getInitial: function (key, params) {
  40036. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40037. return getGenericURL("ws", params, path);
  40038. }
  40039. };
  40040. var http = {
  40041. getInitial: function (key, params) {
  40042. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40043. return getGenericURL("http", params, path);
  40044. }
  40045. };
  40046. var sockjs = {
  40047. getInitial: function (key, params) {
  40048. return getGenericURL("http", params, params.httpPath || "/pusher");
  40049. },
  40050. getPath: function (key, params) {
  40051. return getGenericPath(key);
  40052. }
  40053. };
  40054. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40055. var callback_registry_CallbackRegistry = (function () {
  40056. function CallbackRegistry() {
  40057. this._callbacks = {};
  40058. }
  40059. CallbackRegistry.prototype.get = function (name) {
  40060. return this._callbacks[prefix(name)];
  40061. };
  40062. CallbackRegistry.prototype.add = function (name, callback, context) {
  40063. var prefixedEventName = prefix(name);
  40064. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40065. this._callbacks[prefixedEventName].push({
  40066. fn: callback,
  40067. context: context
  40068. });
  40069. };
  40070. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40071. if (!name && !callback && !context) {
  40072. this._callbacks = {};
  40073. return;
  40074. }
  40075. var names = name ? [prefix(name)] : keys(this._callbacks);
  40076. if (callback || context) {
  40077. this.removeCallback(names, callback, context);
  40078. }
  40079. else {
  40080. this.removeAllCallbacks(names);
  40081. }
  40082. };
  40083. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40084. apply(names, function (name) {
  40085. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40086. return (callback && callback !== binding.fn) ||
  40087. (context && context !== binding.context);
  40088. });
  40089. if (this._callbacks[name].length === 0) {
  40090. delete this._callbacks[name];
  40091. }
  40092. }, this);
  40093. };
  40094. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40095. apply(names, function (name) {
  40096. delete this._callbacks[name];
  40097. }, this);
  40098. };
  40099. return CallbackRegistry;
  40100. }());
  40101. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40102. function prefix(name) {
  40103. return "_" + name;
  40104. }
  40105. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40106. var dispatcher_Dispatcher = (function () {
  40107. function Dispatcher(failThrough) {
  40108. this.callbacks = new callback_registry();
  40109. this.global_callbacks = [];
  40110. this.failThrough = failThrough;
  40111. }
  40112. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40113. this.callbacks.add(eventName, callback, context);
  40114. return this;
  40115. };
  40116. Dispatcher.prototype.bind_global = function (callback) {
  40117. this.global_callbacks.push(callback);
  40118. return this;
  40119. };
  40120. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40121. this.callbacks.remove(eventName, callback, context);
  40122. return this;
  40123. };
  40124. Dispatcher.prototype.unbind_global = function (callback) {
  40125. if (!callback) {
  40126. this.global_callbacks = [];
  40127. return this;
  40128. }
  40129. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40130. return this;
  40131. };
  40132. Dispatcher.prototype.unbind_all = function () {
  40133. this.unbind();
  40134. this.unbind_global();
  40135. return this;
  40136. };
  40137. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40138. for (var i = 0; i < this.global_callbacks.length; i++) {
  40139. this.global_callbacks[i](eventName, data);
  40140. }
  40141. var callbacks = this.callbacks.get(eventName);
  40142. var args = [];
  40143. if (metadata) {
  40144. args.push(data, metadata);
  40145. }
  40146. else if (data) {
  40147. args.push(data);
  40148. }
  40149. if (callbacks && callbacks.length > 0) {
  40150. for (var i = 0; i < callbacks.length; i++) {
  40151. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40152. }
  40153. }
  40154. else if (this.failThrough) {
  40155. this.failThrough(eventName, data);
  40156. }
  40157. return this;
  40158. };
  40159. return Dispatcher;
  40160. }());
  40161. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40162. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40163. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40164. var extendStatics = function (d, b) {
  40165. extendStatics = Object.setPrototypeOf ||
  40166. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40167. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40168. return extendStatics(d, b);
  40169. };
  40170. return function (d, b) {
  40171. extendStatics(d, b);
  40172. function __() { this.constructor = d; }
  40173. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40174. };
  40175. })();
  40176. var transport_connection_TransportConnection = (function (_super) {
  40177. transport_connection_extends(TransportConnection, _super);
  40178. function TransportConnection(hooks, name, priority, key, options) {
  40179. var _this = _super.call(this) || this;
  40180. _this.initialize = runtime.transportConnectionInitializer;
  40181. _this.hooks = hooks;
  40182. _this.name = name;
  40183. _this.priority = priority;
  40184. _this.key = key;
  40185. _this.options = options;
  40186. _this.state = "new";
  40187. _this.timeline = options.timeline;
  40188. _this.activityTimeout = options.activityTimeout;
  40189. _this.id = _this.timeline.generateUniqueID();
  40190. return _this;
  40191. }
  40192. TransportConnection.prototype.handlesActivityChecks = function () {
  40193. return Boolean(this.hooks.handlesActivityChecks);
  40194. };
  40195. TransportConnection.prototype.supportsPing = function () {
  40196. return Boolean(this.hooks.supportsPing);
  40197. };
  40198. TransportConnection.prototype.connect = function () {
  40199. var _this = this;
  40200. if (this.socket || this.state !== "initialized") {
  40201. return false;
  40202. }
  40203. var url = this.hooks.urls.getInitial(this.key, this.options);
  40204. try {
  40205. this.socket = this.hooks.getSocket(url, this.options);
  40206. }
  40207. catch (e) {
  40208. util.defer(function () {
  40209. _this.onError(e);
  40210. _this.changeState("closed");
  40211. });
  40212. return false;
  40213. }
  40214. this.bindListeners();
  40215. logger.debug("Connecting", { transport: this.name, url: url });
  40216. this.changeState("connecting");
  40217. return true;
  40218. };
  40219. TransportConnection.prototype.close = function () {
  40220. if (this.socket) {
  40221. this.socket.close();
  40222. return true;
  40223. }
  40224. else {
  40225. return false;
  40226. }
  40227. };
  40228. TransportConnection.prototype.send = function (data) {
  40229. var _this = this;
  40230. if (this.state === "open") {
  40231. util.defer(function () {
  40232. if (_this.socket) {
  40233. _this.socket.send(data);
  40234. }
  40235. });
  40236. return true;
  40237. }
  40238. else {
  40239. return false;
  40240. }
  40241. };
  40242. TransportConnection.prototype.ping = function () {
  40243. if (this.state === "open" && this.supportsPing()) {
  40244. this.socket.ping();
  40245. }
  40246. };
  40247. TransportConnection.prototype.onOpen = function () {
  40248. if (this.hooks.beforeOpen) {
  40249. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40250. }
  40251. this.changeState("open");
  40252. this.socket.onopen = undefined;
  40253. };
  40254. TransportConnection.prototype.onError = function (error) {
  40255. this.emit("error", { type: 'WebSocketError', error: error });
  40256. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40257. };
  40258. TransportConnection.prototype.onClose = function (closeEvent) {
  40259. if (closeEvent) {
  40260. this.changeState("closed", {
  40261. code: closeEvent.code,
  40262. reason: closeEvent.reason,
  40263. wasClean: closeEvent.wasClean
  40264. });
  40265. }
  40266. else {
  40267. this.changeState("closed");
  40268. }
  40269. this.unbindListeners();
  40270. this.socket = undefined;
  40271. };
  40272. TransportConnection.prototype.onMessage = function (message) {
  40273. this.emit("message", message);
  40274. };
  40275. TransportConnection.prototype.onActivity = function () {
  40276. this.emit("activity");
  40277. };
  40278. TransportConnection.prototype.bindListeners = function () {
  40279. var _this = this;
  40280. this.socket.onopen = function () {
  40281. _this.onOpen();
  40282. };
  40283. this.socket.onerror = function (error) {
  40284. _this.onError(error);
  40285. };
  40286. this.socket.onclose = function (closeEvent) {
  40287. _this.onClose(closeEvent);
  40288. };
  40289. this.socket.onmessage = function (message) {
  40290. _this.onMessage(message);
  40291. };
  40292. if (this.supportsPing()) {
  40293. this.socket.onactivity = function () { _this.onActivity(); };
  40294. }
  40295. };
  40296. TransportConnection.prototype.unbindListeners = function () {
  40297. if (this.socket) {
  40298. this.socket.onopen = undefined;
  40299. this.socket.onerror = undefined;
  40300. this.socket.onclose = undefined;
  40301. this.socket.onmessage = undefined;
  40302. if (this.supportsPing()) {
  40303. this.socket.onactivity = undefined;
  40304. }
  40305. }
  40306. };
  40307. TransportConnection.prototype.changeState = function (state, params) {
  40308. this.state = state;
  40309. this.timeline.info(this.buildTimelineMessage({
  40310. state: state,
  40311. params: params
  40312. }));
  40313. this.emit(state, params);
  40314. };
  40315. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40316. return extend({ cid: this.id }, message);
  40317. };
  40318. return TransportConnection;
  40319. }(dispatcher));
  40320. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40321. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40322. var transport_Transport = (function () {
  40323. function Transport(hooks) {
  40324. this.hooks = hooks;
  40325. }
  40326. Transport.prototype.isSupported = function (environment) {
  40327. return this.hooks.isSupported(environment);
  40328. };
  40329. Transport.prototype.createConnection = function (name, priority, key, options) {
  40330. return new transport_connection(this.hooks, name, priority, key, options);
  40331. };
  40332. return Transport;
  40333. }());
  40334. /* harmony default export */ var transports_transport = (transport_Transport);
  40335. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40336. var WSTransport = new transports_transport({
  40337. urls: ws,
  40338. handlesActivityChecks: false,
  40339. supportsPing: false,
  40340. isInitialized: function () {
  40341. return Boolean(runtime.getWebSocketAPI());
  40342. },
  40343. isSupported: function () {
  40344. return Boolean(runtime.getWebSocketAPI());
  40345. },
  40346. getSocket: function (url) {
  40347. return runtime.createWebSocket(url);
  40348. }
  40349. });
  40350. var httpConfiguration = {
  40351. urls: http,
  40352. handlesActivityChecks: false,
  40353. supportsPing: true,
  40354. isInitialized: function () {
  40355. return true;
  40356. }
  40357. };
  40358. var streamingConfiguration = extend({ getSocket: function (url) {
  40359. return runtime.HTTPFactory.createStreamingSocket(url);
  40360. }
  40361. }, httpConfiguration);
  40362. var pollingConfiguration = extend({ getSocket: function (url) {
  40363. return runtime.HTTPFactory.createPollingSocket(url);
  40364. }
  40365. }, httpConfiguration);
  40366. var xhrConfiguration = {
  40367. isSupported: function () {
  40368. return runtime.isXHRSupported();
  40369. }
  40370. };
  40371. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40372. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40373. var Transports = {
  40374. ws: WSTransport,
  40375. xhr_streaming: XHRStreamingTransport,
  40376. xhr_polling: XHRPollingTransport
  40377. };
  40378. /* harmony default export */ var transports = (Transports);
  40379. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40380. var SockJSTransport = new transports_transport({
  40381. file: "sockjs",
  40382. urls: sockjs,
  40383. handlesActivityChecks: true,
  40384. supportsPing: false,
  40385. isSupported: function () {
  40386. return true;
  40387. },
  40388. isInitialized: function () {
  40389. return window.SockJS !== undefined;
  40390. },
  40391. getSocket: function (url, options) {
  40392. return new window.SockJS(url, null, {
  40393. js_path: Dependencies.getPath("sockjs", {
  40394. useTLS: options.useTLS
  40395. }),
  40396. ignore_null_origin: options.ignoreNullOrigin
  40397. });
  40398. },
  40399. beforeOpen: function (socket, path) {
  40400. socket.send(JSON.stringify({
  40401. path: path
  40402. }));
  40403. }
  40404. });
  40405. var xdrConfiguration = {
  40406. isSupported: function (environment) {
  40407. var yes = runtime.isXDRSupported(environment.useTLS);
  40408. return yes;
  40409. }
  40410. };
  40411. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40412. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40413. transports.xdr_streaming = XDRStreamingTransport;
  40414. transports.xdr_polling = XDRPollingTransport;
  40415. transports.sockjs = SockJSTransport;
  40416. /* harmony default export */ var transports_transports = (transports);
  40417. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40418. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40419. var extendStatics = function (d, b) {
  40420. extendStatics = Object.setPrototypeOf ||
  40421. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40422. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40423. return extendStatics(d, b);
  40424. };
  40425. return function (d, b) {
  40426. extendStatics(d, b);
  40427. function __() { this.constructor = d; }
  40428. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40429. };
  40430. })();
  40431. var NetInfo = (function (_super) {
  40432. net_info_extends(NetInfo, _super);
  40433. function NetInfo() {
  40434. var _this = _super.call(this) || this;
  40435. var self = _this;
  40436. if (window.addEventListener !== undefined) {
  40437. window.addEventListener("online", function () {
  40438. self.emit('online');
  40439. }, false);
  40440. window.addEventListener("offline", function () {
  40441. self.emit('offline');
  40442. }, false);
  40443. }
  40444. return _this;
  40445. }
  40446. NetInfo.prototype.isOnline = function () {
  40447. if (window.navigator.onLine === undefined) {
  40448. return true;
  40449. }
  40450. else {
  40451. return window.navigator.onLine;
  40452. }
  40453. };
  40454. return NetInfo;
  40455. }(dispatcher));
  40456. var net_info_Network = new NetInfo();
  40457. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40458. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40459. function AssistantToTheTransportManager(manager, transport, options) {
  40460. this.manager = manager;
  40461. this.transport = transport;
  40462. this.minPingDelay = options.minPingDelay;
  40463. this.maxPingDelay = options.maxPingDelay;
  40464. this.pingDelay = undefined;
  40465. }
  40466. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40467. var _this = this;
  40468. options = extend({}, options, {
  40469. activityTimeout: this.pingDelay
  40470. });
  40471. var connection = this.transport.createConnection(name, priority, key, options);
  40472. var openTimestamp = null;
  40473. var onOpen = function () {
  40474. connection.unbind("open", onOpen);
  40475. connection.bind("closed", onClosed);
  40476. openTimestamp = util.now();
  40477. };
  40478. var onClosed = function (closeEvent) {
  40479. connection.unbind("closed", onClosed);
  40480. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40481. _this.manager.reportDeath();
  40482. }
  40483. else if (!closeEvent.wasClean && openTimestamp) {
  40484. var lifespan = util.now() - openTimestamp;
  40485. if (lifespan < 2 * _this.maxPingDelay) {
  40486. _this.manager.reportDeath();
  40487. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40488. }
  40489. }
  40490. };
  40491. connection.bind("open", onOpen);
  40492. return connection;
  40493. };
  40494. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40495. return this.manager.isAlive() && this.transport.isSupported(environment);
  40496. };
  40497. return AssistantToTheTransportManager;
  40498. }());
  40499. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40500. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40501. var Protocol = {
  40502. decodeMessage: function (messageEvent) {
  40503. try {
  40504. var messageData = JSON.parse(messageEvent.data);
  40505. var pusherEventData = messageData.data;
  40506. if (typeof pusherEventData === 'string') {
  40507. try {
  40508. pusherEventData = JSON.parse(messageData.data);
  40509. }
  40510. catch (e) { }
  40511. }
  40512. var pusherEvent = {
  40513. event: messageData.event,
  40514. channel: messageData.channel,
  40515. data: pusherEventData,
  40516. };
  40517. if (messageData.user_id) {
  40518. pusherEvent.user_id = messageData.user_id;
  40519. }
  40520. return pusherEvent;
  40521. }
  40522. catch (e) {
  40523. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40524. }
  40525. },
  40526. encodeMessage: function (event) {
  40527. return JSON.stringify(event);
  40528. },
  40529. processHandshake: function (messageEvent) {
  40530. var message = Protocol.decodeMessage(messageEvent);
  40531. if (message.event === "pusher:connection_established") {
  40532. if (!message.data.activity_timeout) {
  40533. throw "No activity timeout specified in handshake";
  40534. }
  40535. return {
  40536. action: "connected",
  40537. id: message.data.socket_id,
  40538. activityTimeout: message.data.activity_timeout * 1000
  40539. };
  40540. }
  40541. else if (message.event === "pusher:error") {
  40542. return {
  40543. action: this.getCloseAction(message.data),
  40544. error: this.getCloseError(message.data)
  40545. };
  40546. }
  40547. else {
  40548. throw "Invalid handshake";
  40549. }
  40550. },
  40551. getCloseAction: function (closeEvent) {
  40552. if (closeEvent.code < 4000) {
  40553. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40554. return "backoff";
  40555. }
  40556. else {
  40557. return null;
  40558. }
  40559. }
  40560. else if (closeEvent.code === 4000) {
  40561. return "tls_only";
  40562. }
  40563. else if (closeEvent.code < 4100) {
  40564. return "refused";
  40565. }
  40566. else if (closeEvent.code < 4200) {
  40567. return "backoff";
  40568. }
  40569. else if (closeEvent.code < 4300) {
  40570. return "retry";
  40571. }
  40572. else {
  40573. return "refused";
  40574. }
  40575. },
  40576. getCloseError: function (closeEvent) {
  40577. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40578. return {
  40579. type: 'PusherError',
  40580. data: {
  40581. code: closeEvent.code,
  40582. message: closeEvent.reason || closeEvent.message
  40583. }
  40584. };
  40585. }
  40586. else {
  40587. return null;
  40588. }
  40589. }
  40590. };
  40591. /* harmony default export */ var protocol_protocol = (Protocol);
  40592. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40593. var connection_extends = (undefined && undefined.__extends) || (function () {
  40594. var extendStatics = function (d, b) {
  40595. extendStatics = Object.setPrototypeOf ||
  40596. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40597. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40598. return extendStatics(d, b);
  40599. };
  40600. return function (d, b) {
  40601. extendStatics(d, b);
  40602. function __() { this.constructor = d; }
  40603. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40604. };
  40605. })();
  40606. var connection_Connection = (function (_super) {
  40607. connection_extends(Connection, _super);
  40608. function Connection(id, transport) {
  40609. var _this = _super.call(this) || this;
  40610. _this.id = id;
  40611. _this.transport = transport;
  40612. _this.activityTimeout = transport.activityTimeout;
  40613. _this.bindListeners();
  40614. return _this;
  40615. }
  40616. Connection.prototype.handlesActivityChecks = function () {
  40617. return this.transport.handlesActivityChecks();
  40618. };
  40619. Connection.prototype.send = function (data) {
  40620. return this.transport.send(data);
  40621. };
  40622. Connection.prototype.send_event = function (name, data, channel) {
  40623. var event = { event: name, data: data };
  40624. if (channel) {
  40625. event.channel = channel;
  40626. }
  40627. logger.debug('Event sent', event);
  40628. return this.send(protocol_protocol.encodeMessage(event));
  40629. };
  40630. Connection.prototype.ping = function () {
  40631. if (this.transport.supportsPing()) {
  40632. this.transport.ping();
  40633. }
  40634. else {
  40635. this.send_event('pusher:ping', {});
  40636. }
  40637. };
  40638. Connection.prototype.close = function () {
  40639. this.transport.close();
  40640. };
  40641. Connection.prototype.bindListeners = function () {
  40642. var _this = this;
  40643. var listeners = {
  40644. message: function (messageEvent) {
  40645. var pusherEvent;
  40646. try {
  40647. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40648. }
  40649. catch (e) {
  40650. _this.emit('error', {
  40651. type: 'MessageParseError',
  40652. error: e,
  40653. data: messageEvent.data
  40654. });
  40655. }
  40656. if (pusherEvent !== undefined) {
  40657. logger.debug('Event recd', pusherEvent);
  40658. switch (pusherEvent.event) {
  40659. case 'pusher:error':
  40660. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40661. break;
  40662. case 'pusher:ping':
  40663. _this.emit("ping");
  40664. break;
  40665. case 'pusher:pong':
  40666. _this.emit("pong");
  40667. break;
  40668. }
  40669. _this.emit('message', pusherEvent);
  40670. }
  40671. },
  40672. activity: function () {
  40673. _this.emit("activity");
  40674. },
  40675. error: function (error) {
  40676. _this.emit("error", { type: "WebSocketError", error: error });
  40677. },
  40678. closed: function (closeEvent) {
  40679. unbindListeners();
  40680. if (closeEvent && closeEvent.code) {
  40681. _this.handleCloseEvent(closeEvent);
  40682. }
  40683. _this.transport = null;
  40684. _this.emit("closed");
  40685. }
  40686. };
  40687. var unbindListeners = function () {
  40688. objectApply(listeners, function (listener, event) {
  40689. _this.transport.unbind(event, listener);
  40690. });
  40691. };
  40692. objectApply(listeners, function (listener, event) {
  40693. _this.transport.bind(event, listener);
  40694. });
  40695. };
  40696. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40697. var action = protocol_protocol.getCloseAction(closeEvent);
  40698. var error = protocol_protocol.getCloseError(closeEvent);
  40699. if (error) {
  40700. this.emit('error', error);
  40701. }
  40702. if (action) {
  40703. this.emit(action, { action: action, error: error });
  40704. }
  40705. };
  40706. return Connection;
  40707. }(dispatcher));
  40708. /* harmony default export */ var connection_connection = (connection_Connection);
  40709. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40710. var handshake_Handshake = (function () {
  40711. function Handshake(transport, callback) {
  40712. this.transport = transport;
  40713. this.callback = callback;
  40714. this.bindListeners();
  40715. }
  40716. Handshake.prototype.close = function () {
  40717. this.unbindListeners();
  40718. this.transport.close();
  40719. };
  40720. Handshake.prototype.bindListeners = function () {
  40721. var _this = this;
  40722. this.onMessage = function (m) {
  40723. _this.unbindListeners();
  40724. var result;
  40725. try {
  40726. result = protocol_protocol.processHandshake(m);
  40727. }
  40728. catch (e) {
  40729. _this.finish("error", { error: e });
  40730. _this.transport.close();
  40731. return;
  40732. }
  40733. if (result.action === "connected") {
  40734. _this.finish("connected", {
  40735. connection: new connection_connection(result.id, _this.transport),
  40736. activityTimeout: result.activityTimeout
  40737. });
  40738. }
  40739. else {
  40740. _this.finish(result.action, { error: result.error });
  40741. _this.transport.close();
  40742. }
  40743. };
  40744. this.onClosed = function (closeEvent) {
  40745. _this.unbindListeners();
  40746. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40747. var error = protocol_protocol.getCloseError(closeEvent);
  40748. _this.finish(action, { error: error });
  40749. };
  40750. this.transport.bind("message", this.onMessage);
  40751. this.transport.bind("closed", this.onClosed);
  40752. };
  40753. Handshake.prototype.unbindListeners = function () {
  40754. this.transport.unbind("message", this.onMessage);
  40755. this.transport.unbind("closed", this.onClosed);
  40756. };
  40757. Handshake.prototype.finish = function (action, params) {
  40758. this.callback(extend({ transport: this.transport, action: action }, params));
  40759. };
  40760. return Handshake;
  40761. }());
  40762. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40763. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40764. var pusher_authorizer_PusherAuthorizer = (function () {
  40765. function PusherAuthorizer(channel, options) {
  40766. this.channel = channel;
  40767. var authTransport = options.authTransport;
  40768. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40769. throw "'" + authTransport + "' is not a recognized auth transport";
  40770. }
  40771. this.type = authTransport;
  40772. this.options = options;
  40773. this.authOptions = (options || {}).auth || {};
  40774. }
  40775. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40776. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40777. '&channel_name=' + encodeURIComponent(this.channel.name);
  40778. for (var i in this.authOptions.params) {
  40779. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40780. }
  40781. return query;
  40782. };
  40783. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40784. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40785. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40786. };
  40787. return PusherAuthorizer;
  40788. }());
  40789. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40790. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40791. var timeline_sender_TimelineSender = (function () {
  40792. function TimelineSender(timeline, options) {
  40793. this.timeline = timeline;
  40794. this.options = options || {};
  40795. }
  40796. TimelineSender.prototype.send = function (useTLS, callback) {
  40797. if (this.timeline.isEmpty()) {
  40798. return;
  40799. }
  40800. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40801. };
  40802. return TimelineSender;
  40803. }());
  40804. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40805. // CONCATENATED MODULE: ./src/core/errors.ts
  40806. var errors_extends = (undefined && undefined.__extends) || (function () {
  40807. var extendStatics = function (d, b) {
  40808. extendStatics = Object.setPrototypeOf ||
  40809. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40810. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40811. return extendStatics(d, b);
  40812. };
  40813. return function (d, b) {
  40814. extendStatics(d, b);
  40815. function __() { this.constructor = d; }
  40816. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40817. };
  40818. })();
  40819. var BadEventName = (function (_super) {
  40820. errors_extends(BadEventName, _super);
  40821. function BadEventName(msg) {
  40822. var _newTarget = this.constructor;
  40823. var _this = _super.call(this, msg) || this;
  40824. Object.setPrototypeOf(_this, _newTarget.prototype);
  40825. return _this;
  40826. }
  40827. return BadEventName;
  40828. }(Error));
  40829. var RequestTimedOut = (function (_super) {
  40830. errors_extends(RequestTimedOut, _super);
  40831. function RequestTimedOut(msg) {
  40832. var _newTarget = this.constructor;
  40833. var _this = _super.call(this, msg) || this;
  40834. Object.setPrototypeOf(_this, _newTarget.prototype);
  40835. return _this;
  40836. }
  40837. return RequestTimedOut;
  40838. }(Error));
  40839. var TransportPriorityTooLow = (function (_super) {
  40840. errors_extends(TransportPriorityTooLow, _super);
  40841. function TransportPriorityTooLow(msg) {
  40842. var _newTarget = this.constructor;
  40843. var _this = _super.call(this, msg) || this;
  40844. Object.setPrototypeOf(_this, _newTarget.prototype);
  40845. return _this;
  40846. }
  40847. return TransportPriorityTooLow;
  40848. }(Error));
  40849. var TransportClosed = (function (_super) {
  40850. errors_extends(TransportClosed, _super);
  40851. function TransportClosed(msg) {
  40852. var _newTarget = this.constructor;
  40853. var _this = _super.call(this, msg) || this;
  40854. Object.setPrototypeOf(_this, _newTarget.prototype);
  40855. return _this;
  40856. }
  40857. return TransportClosed;
  40858. }(Error));
  40859. var UnsupportedFeature = (function (_super) {
  40860. errors_extends(UnsupportedFeature, _super);
  40861. function UnsupportedFeature(msg) {
  40862. var _newTarget = this.constructor;
  40863. var _this = _super.call(this, msg) || this;
  40864. Object.setPrototypeOf(_this, _newTarget.prototype);
  40865. return _this;
  40866. }
  40867. return UnsupportedFeature;
  40868. }(Error));
  40869. var UnsupportedTransport = (function (_super) {
  40870. errors_extends(UnsupportedTransport, _super);
  40871. function UnsupportedTransport(msg) {
  40872. var _newTarget = this.constructor;
  40873. var _this = _super.call(this, msg) || this;
  40874. Object.setPrototypeOf(_this, _newTarget.prototype);
  40875. return _this;
  40876. }
  40877. return UnsupportedTransport;
  40878. }(Error));
  40879. var UnsupportedStrategy = (function (_super) {
  40880. errors_extends(UnsupportedStrategy, _super);
  40881. function UnsupportedStrategy(msg) {
  40882. var _newTarget = this.constructor;
  40883. var _this = _super.call(this, msg) || this;
  40884. Object.setPrototypeOf(_this, _newTarget.prototype);
  40885. return _this;
  40886. }
  40887. return UnsupportedStrategy;
  40888. }(Error));
  40889. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40890. var channel_extends = (undefined && undefined.__extends) || (function () {
  40891. var extendStatics = function (d, b) {
  40892. extendStatics = Object.setPrototypeOf ||
  40893. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40894. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40895. return extendStatics(d, b);
  40896. };
  40897. return function (d, b) {
  40898. extendStatics(d, b);
  40899. function __() { this.constructor = d; }
  40900. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40901. };
  40902. })();
  40903. var channel_Channel = (function (_super) {
  40904. channel_extends(Channel, _super);
  40905. function Channel(name, pusher) {
  40906. var _this = _super.call(this, function (event, data) {
  40907. logger.debug('No callbacks on ' + name + ' for ' + event);
  40908. }) || this;
  40909. _this.name = name;
  40910. _this.pusher = pusher;
  40911. _this.subscribed = false;
  40912. _this.subscriptionPending = false;
  40913. _this.subscriptionCancelled = false;
  40914. return _this;
  40915. }
  40916. Channel.prototype.authorize = function (socketId, callback) {
  40917. return callback(false, {});
  40918. };
  40919. Channel.prototype.trigger = function (event, data) {
  40920. if (event.indexOf("client-") !== 0) {
  40921. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40922. }
  40923. if (!this.subscribed) {
  40924. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40925. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40926. }
  40927. return this.pusher.send_event(event, data, this.name);
  40928. };
  40929. Channel.prototype.disconnect = function () {
  40930. this.subscribed = false;
  40931. this.subscriptionPending = false;
  40932. };
  40933. Channel.prototype.handleEvent = function (event) {
  40934. var eventName = event.event;
  40935. var data = event.data;
  40936. if (eventName === "pusher_internal:subscription_succeeded") {
  40937. this.handleSubscriptionSucceededEvent(event);
  40938. }
  40939. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40940. var metadata = {};
  40941. this.emit(eventName, data, metadata);
  40942. }
  40943. };
  40944. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40945. this.subscriptionPending = false;
  40946. this.subscribed = true;
  40947. if (this.subscriptionCancelled) {
  40948. this.pusher.unsubscribe(this.name);
  40949. }
  40950. else {
  40951. this.emit("pusher:subscription_succeeded", event.data);
  40952. }
  40953. };
  40954. Channel.prototype.subscribe = function () {
  40955. var _this = this;
  40956. if (this.subscribed) {
  40957. return;
  40958. }
  40959. this.subscriptionPending = true;
  40960. this.subscriptionCancelled = false;
  40961. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40962. if (error) {
  40963. logger.error(data);
  40964. _this.emit('pusher:subscription_error', data);
  40965. }
  40966. else {
  40967. _this.pusher.send_event('pusher:subscribe', {
  40968. auth: data.auth,
  40969. channel_data: data.channel_data,
  40970. channel: _this.name
  40971. });
  40972. }
  40973. });
  40974. };
  40975. Channel.prototype.unsubscribe = function () {
  40976. this.subscribed = false;
  40977. this.pusher.send_event('pusher:unsubscribe', {
  40978. channel: this.name
  40979. });
  40980. };
  40981. Channel.prototype.cancelSubscription = function () {
  40982. this.subscriptionCancelled = true;
  40983. };
  40984. Channel.prototype.reinstateSubscription = function () {
  40985. this.subscriptionCancelled = false;
  40986. };
  40987. return Channel;
  40988. }(dispatcher));
  40989. /* harmony default export */ var channels_channel = (channel_Channel);
  40990. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40991. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40992. var extendStatics = function (d, b) {
  40993. extendStatics = Object.setPrototypeOf ||
  40994. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40995. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40996. return extendStatics(d, b);
  40997. };
  40998. return function (d, b) {
  40999. extendStatics(d, b);
  41000. function __() { this.constructor = d; }
  41001. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41002. };
  41003. })();
  41004. var private_channel_PrivateChannel = (function (_super) {
  41005. private_channel_extends(PrivateChannel, _super);
  41006. function PrivateChannel() {
  41007. return _super !== null && _super.apply(this, arguments) || this;
  41008. }
  41009. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41010. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41011. return authorizer.authorize(socketId, callback);
  41012. };
  41013. return PrivateChannel;
  41014. }(channels_channel));
  41015. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41016. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41017. var members_Members = (function () {
  41018. function Members() {
  41019. this.reset();
  41020. }
  41021. Members.prototype.get = function (id) {
  41022. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41023. return {
  41024. id: id,
  41025. info: this.members[id]
  41026. };
  41027. }
  41028. else {
  41029. return null;
  41030. }
  41031. };
  41032. Members.prototype.each = function (callback) {
  41033. var _this = this;
  41034. objectApply(this.members, function (member, id) {
  41035. callback(_this.get(id));
  41036. });
  41037. };
  41038. Members.prototype.setMyID = function (id) {
  41039. this.myID = id;
  41040. };
  41041. Members.prototype.onSubscription = function (subscriptionData) {
  41042. this.members = subscriptionData.presence.hash;
  41043. this.count = subscriptionData.presence.count;
  41044. this.me = this.get(this.myID);
  41045. };
  41046. Members.prototype.addMember = function (memberData) {
  41047. if (this.get(memberData.user_id) === null) {
  41048. this.count++;
  41049. }
  41050. this.members[memberData.user_id] = memberData.user_info;
  41051. return this.get(memberData.user_id);
  41052. };
  41053. Members.prototype.removeMember = function (memberData) {
  41054. var member = this.get(memberData.user_id);
  41055. if (member) {
  41056. delete this.members[memberData.user_id];
  41057. this.count--;
  41058. }
  41059. return member;
  41060. };
  41061. Members.prototype.reset = function () {
  41062. this.members = {};
  41063. this.count = 0;
  41064. this.myID = null;
  41065. this.me = null;
  41066. };
  41067. return Members;
  41068. }());
  41069. /* harmony default export */ var members = (members_Members);
  41070. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41071. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41072. var extendStatics = function (d, b) {
  41073. extendStatics = Object.setPrototypeOf ||
  41074. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41075. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41076. return extendStatics(d, b);
  41077. };
  41078. return function (d, b) {
  41079. extendStatics(d, b);
  41080. function __() { this.constructor = d; }
  41081. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41082. };
  41083. })();
  41084. var presence_channel_PresenceChannel = (function (_super) {
  41085. presence_channel_extends(PresenceChannel, _super);
  41086. function PresenceChannel(name, pusher) {
  41087. var _this = _super.call(this, name, pusher) || this;
  41088. _this.members = new members();
  41089. return _this;
  41090. }
  41091. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41092. var _this = this;
  41093. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41094. if (!error) {
  41095. if (authData.channel_data === undefined) {
  41096. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41097. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41098. ("expected 'channel_data' field. " + suffix));
  41099. callback("Invalid auth response");
  41100. return;
  41101. }
  41102. var channelData = JSON.parse(authData.channel_data);
  41103. _this.members.setMyID(channelData.user_id);
  41104. }
  41105. callback(error, authData);
  41106. });
  41107. };
  41108. PresenceChannel.prototype.handleEvent = function (event) {
  41109. var eventName = event.event;
  41110. if (eventName.indexOf("pusher_internal:") === 0) {
  41111. this.handleInternalEvent(event);
  41112. }
  41113. else {
  41114. var data = event.data;
  41115. var metadata = {};
  41116. if (event.user_id) {
  41117. metadata.user_id = event.user_id;
  41118. }
  41119. this.emit(eventName, data, metadata);
  41120. }
  41121. };
  41122. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41123. var eventName = event.event;
  41124. var data = event.data;
  41125. switch (eventName) {
  41126. case "pusher_internal:subscription_succeeded":
  41127. this.handleSubscriptionSucceededEvent(event);
  41128. break;
  41129. case "pusher_internal:member_added":
  41130. var addedMember = this.members.addMember(data);
  41131. this.emit('pusher:member_added', addedMember);
  41132. break;
  41133. case "pusher_internal:member_removed":
  41134. var removedMember = this.members.removeMember(data);
  41135. if (removedMember) {
  41136. this.emit('pusher:member_removed', removedMember);
  41137. }
  41138. break;
  41139. }
  41140. };
  41141. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41142. this.subscriptionPending = false;
  41143. this.subscribed = true;
  41144. if (this.subscriptionCancelled) {
  41145. this.pusher.unsubscribe(this.name);
  41146. }
  41147. else {
  41148. this.members.onSubscription(event.data);
  41149. this.emit("pusher:subscription_succeeded", this.members);
  41150. }
  41151. };
  41152. PresenceChannel.prototype.disconnect = function () {
  41153. this.members.reset();
  41154. _super.prototype.disconnect.call(this);
  41155. };
  41156. return PresenceChannel;
  41157. }(private_channel));
  41158. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41159. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41160. var nacl_fast = __webpack_require__(0);
  41161. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41162. var nacl_util = __webpack_require__(1);
  41163. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41164. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41165. var extendStatics = function (d, b) {
  41166. extendStatics = Object.setPrototypeOf ||
  41167. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41168. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41169. return extendStatics(d, b);
  41170. };
  41171. return function (d, b) {
  41172. extendStatics(d, b);
  41173. function __() { this.constructor = d; }
  41174. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41175. };
  41176. })();
  41177. var encrypted_channel_EncryptedChannel = (function (_super) {
  41178. encrypted_channel_extends(EncryptedChannel, _super);
  41179. function EncryptedChannel() {
  41180. var _this = _super !== null && _super.apply(this, arguments) || this;
  41181. _this.key = null;
  41182. return _this;
  41183. }
  41184. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41185. var _this = this;
  41186. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41187. if (error) {
  41188. callback(true, authData);
  41189. return;
  41190. }
  41191. var sharedSecret = authData["shared_secret"];
  41192. if (!sharedSecret) {
  41193. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41194. callback(true, errorMsg);
  41195. return;
  41196. }
  41197. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41198. delete authData["shared_secret"];
  41199. callback(false, authData);
  41200. });
  41201. };
  41202. EncryptedChannel.prototype.trigger = function (event, data) {
  41203. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41204. };
  41205. EncryptedChannel.prototype.handleEvent = function (event) {
  41206. var eventName = event.event;
  41207. var data = event.data;
  41208. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41209. _super.prototype.handleEvent.call(this, event);
  41210. return;
  41211. }
  41212. this.handleEncryptedEvent(eventName, data);
  41213. };
  41214. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41215. var _this = this;
  41216. if (!this.key) {
  41217. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41218. return;
  41219. }
  41220. if (!data.ciphertext || !data.nonce) {
  41221. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41222. return;
  41223. }
  41224. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41225. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41226. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41227. return;
  41228. }
  41229. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41230. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41231. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41232. return;
  41233. }
  41234. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41235. if (bytes === null) {
  41236. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41237. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41238. if (error) {
  41239. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41240. return;
  41241. }
  41242. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41243. if (bytes === null) {
  41244. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41245. return;
  41246. }
  41247. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41248. return;
  41249. });
  41250. return;
  41251. }
  41252. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41253. };
  41254. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41255. try {
  41256. this.emit(eventName, JSON.parse(data));
  41257. }
  41258. catch (e) {
  41259. this.emit(eventName, data);
  41260. }
  41261. return this;
  41262. };
  41263. return EncryptedChannel;
  41264. }(private_channel));
  41265. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41266. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41267. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41268. var extendStatics = function (d, b) {
  41269. extendStatics = Object.setPrototypeOf ||
  41270. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41271. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41272. return extendStatics(d, b);
  41273. };
  41274. return function (d, b) {
  41275. extendStatics(d, b);
  41276. function __() { this.constructor = d; }
  41277. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41278. };
  41279. })();
  41280. var connection_manager_ConnectionManager = (function (_super) {
  41281. connection_manager_extends(ConnectionManager, _super);
  41282. function ConnectionManager(key, options) {
  41283. var _this = _super.call(this) || this;
  41284. _this.key = key;
  41285. _this.options = options || {};
  41286. _this.state = "initialized";
  41287. _this.connection = null;
  41288. _this.usingTLS = !!options.useTLS;
  41289. _this.timeline = _this.options.timeline;
  41290. _this.errorCallbacks = _this.buildErrorCallbacks();
  41291. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41292. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41293. var Network = runtime.getNetwork();
  41294. Network.bind("online", function () {
  41295. _this.timeline.info({ netinfo: "online" });
  41296. if (_this.state === "connecting" || _this.state === "unavailable") {
  41297. _this.retryIn(0);
  41298. }
  41299. });
  41300. Network.bind("offline", function () {
  41301. _this.timeline.info({ netinfo: "offline" });
  41302. if (_this.connection) {
  41303. _this.sendActivityCheck();
  41304. }
  41305. });
  41306. _this.updateStrategy();
  41307. return _this;
  41308. }
  41309. ConnectionManager.prototype.connect = function () {
  41310. if (this.connection || this.runner) {
  41311. return;
  41312. }
  41313. if (!this.strategy.isSupported()) {
  41314. this.updateState("failed");
  41315. return;
  41316. }
  41317. this.updateState("connecting");
  41318. this.startConnecting();
  41319. this.setUnavailableTimer();
  41320. };
  41321. ;
  41322. ConnectionManager.prototype.send = function (data) {
  41323. if (this.connection) {
  41324. return this.connection.send(data);
  41325. }
  41326. else {
  41327. return false;
  41328. }
  41329. };
  41330. ;
  41331. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41332. if (this.connection) {
  41333. return this.connection.send_event(name, data, channel);
  41334. }
  41335. else {
  41336. return false;
  41337. }
  41338. };
  41339. ;
  41340. ConnectionManager.prototype.disconnect = function () {
  41341. this.disconnectInternally();
  41342. this.updateState("disconnected");
  41343. };
  41344. ;
  41345. ConnectionManager.prototype.isUsingTLS = function () {
  41346. return this.usingTLS;
  41347. };
  41348. ;
  41349. ConnectionManager.prototype.startConnecting = function () {
  41350. var _this = this;
  41351. var callback = function (error, handshake) {
  41352. if (error) {
  41353. _this.runner = _this.strategy.connect(0, callback);
  41354. }
  41355. else {
  41356. if (handshake.action === "error") {
  41357. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41358. _this.timeline.error({ handshakeError: handshake.error });
  41359. }
  41360. else {
  41361. _this.abortConnecting();
  41362. _this.handshakeCallbacks[handshake.action](handshake);
  41363. }
  41364. }
  41365. };
  41366. this.runner = this.strategy.connect(0, callback);
  41367. };
  41368. ;
  41369. ConnectionManager.prototype.abortConnecting = function () {
  41370. if (this.runner) {
  41371. this.runner.abort();
  41372. this.runner = null;
  41373. }
  41374. };
  41375. ;
  41376. ConnectionManager.prototype.disconnectInternally = function () {
  41377. this.abortConnecting();
  41378. this.clearRetryTimer();
  41379. this.clearUnavailableTimer();
  41380. if (this.connection) {
  41381. var connection = this.abandonConnection();
  41382. connection.close();
  41383. }
  41384. };
  41385. ;
  41386. ConnectionManager.prototype.updateStrategy = function () {
  41387. this.strategy = this.options.getStrategy({
  41388. key: this.key,
  41389. timeline: this.timeline,
  41390. useTLS: this.usingTLS
  41391. });
  41392. };
  41393. ;
  41394. ConnectionManager.prototype.retryIn = function (delay) {
  41395. var _this = this;
  41396. this.timeline.info({ action: "retry", delay: delay });
  41397. if (delay > 0) {
  41398. this.emit("connecting_in", Math.round(delay / 1000));
  41399. }
  41400. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41401. _this.disconnectInternally();
  41402. _this.connect();
  41403. });
  41404. };
  41405. ;
  41406. ConnectionManager.prototype.clearRetryTimer = function () {
  41407. if (this.retryTimer) {
  41408. this.retryTimer.ensureAborted();
  41409. this.retryTimer = null;
  41410. }
  41411. };
  41412. ;
  41413. ConnectionManager.prototype.setUnavailableTimer = function () {
  41414. var _this = this;
  41415. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41416. _this.updateState("unavailable");
  41417. });
  41418. };
  41419. ;
  41420. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41421. if (this.unavailableTimer) {
  41422. this.unavailableTimer.ensureAborted();
  41423. }
  41424. };
  41425. ;
  41426. ConnectionManager.prototype.sendActivityCheck = function () {
  41427. var _this = this;
  41428. this.stopActivityCheck();
  41429. this.connection.ping();
  41430. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41431. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41432. _this.retryIn(0);
  41433. });
  41434. };
  41435. ;
  41436. ConnectionManager.prototype.resetActivityCheck = function () {
  41437. var _this = this;
  41438. this.stopActivityCheck();
  41439. if (this.connection && !this.connection.handlesActivityChecks()) {
  41440. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41441. _this.sendActivityCheck();
  41442. });
  41443. }
  41444. };
  41445. ;
  41446. ConnectionManager.prototype.stopActivityCheck = function () {
  41447. if (this.activityTimer) {
  41448. this.activityTimer.ensureAborted();
  41449. }
  41450. };
  41451. ;
  41452. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41453. var _this = this;
  41454. return extend({}, errorCallbacks, {
  41455. message: function (message) {
  41456. _this.resetActivityCheck();
  41457. _this.emit('message', message);
  41458. },
  41459. ping: function () {
  41460. _this.send_event('pusher:pong', {});
  41461. },
  41462. activity: function () {
  41463. _this.resetActivityCheck();
  41464. },
  41465. error: function (error) {
  41466. _this.emit("error", { type: "WebSocketError", error: error });
  41467. },
  41468. closed: function () {
  41469. _this.abandonConnection();
  41470. if (_this.shouldRetry()) {
  41471. _this.retryIn(1000);
  41472. }
  41473. }
  41474. });
  41475. };
  41476. ;
  41477. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41478. var _this = this;
  41479. return extend({}, errorCallbacks, {
  41480. connected: function (handshake) {
  41481. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41482. _this.clearUnavailableTimer();
  41483. _this.setConnection(handshake.connection);
  41484. _this.socket_id = _this.connection.id;
  41485. _this.updateState("connected", { socket_id: _this.socket_id });
  41486. }
  41487. });
  41488. };
  41489. ;
  41490. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41491. var _this = this;
  41492. var withErrorEmitted = function (callback) {
  41493. return function (result) {
  41494. if (result.error) {
  41495. _this.emit("error", { type: "WebSocketError", error: result.error });
  41496. }
  41497. callback(result);
  41498. };
  41499. };
  41500. return {
  41501. tls_only: withErrorEmitted(function () {
  41502. _this.usingTLS = true;
  41503. _this.updateStrategy();
  41504. _this.retryIn(0);
  41505. }),
  41506. refused: withErrorEmitted(function () {
  41507. _this.disconnect();
  41508. }),
  41509. backoff: withErrorEmitted(function () {
  41510. _this.retryIn(1000);
  41511. }),
  41512. retry: withErrorEmitted(function () {
  41513. _this.retryIn(0);
  41514. })
  41515. };
  41516. };
  41517. ;
  41518. ConnectionManager.prototype.setConnection = function (connection) {
  41519. this.connection = connection;
  41520. for (var event in this.connectionCallbacks) {
  41521. this.connection.bind(event, this.connectionCallbacks[event]);
  41522. }
  41523. this.resetActivityCheck();
  41524. };
  41525. ;
  41526. ConnectionManager.prototype.abandonConnection = function () {
  41527. if (!this.connection) {
  41528. return;
  41529. }
  41530. this.stopActivityCheck();
  41531. for (var event in this.connectionCallbacks) {
  41532. this.connection.unbind(event, this.connectionCallbacks[event]);
  41533. }
  41534. var connection = this.connection;
  41535. this.connection = null;
  41536. return connection;
  41537. };
  41538. ConnectionManager.prototype.updateState = function (newState, data) {
  41539. var previousState = this.state;
  41540. this.state = newState;
  41541. if (previousState !== newState) {
  41542. var newStateDescription = newState;
  41543. if (newStateDescription === "connected") {
  41544. newStateDescription += " with new socket ID " + data.socket_id;
  41545. }
  41546. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41547. this.timeline.info({ state: newState, params: data });
  41548. this.emit('state_change', { previous: previousState, current: newState });
  41549. this.emit(newState, data);
  41550. }
  41551. };
  41552. ConnectionManager.prototype.shouldRetry = function () {
  41553. return this.state === "connecting" || this.state === "connected";
  41554. };
  41555. return ConnectionManager;
  41556. }(dispatcher));
  41557. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41558. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41559. var channels_Channels = (function () {
  41560. function Channels() {
  41561. this.channels = {};
  41562. }
  41563. Channels.prototype.add = function (name, pusher) {
  41564. if (!this.channels[name]) {
  41565. this.channels[name] = createChannel(name, pusher);
  41566. }
  41567. return this.channels[name];
  41568. };
  41569. Channels.prototype.all = function () {
  41570. return values(this.channels);
  41571. };
  41572. Channels.prototype.find = function (name) {
  41573. return this.channels[name];
  41574. };
  41575. Channels.prototype.remove = function (name) {
  41576. var channel = this.channels[name];
  41577. delete this.channels[name];
  41578. return channel;
  41579. };
  41580. Channels.prototype.disconnect = function () {
  41581. objectApply(this.channels, function (channel) {
  41582. channel.disconnect();
  41583. });
  41584. };
  41585. return Channels;
  41586. }());
  41587. /* harmony default export */ var channels = (channels_Channels);
  41588. function createChannel(name, pusher) {
  41589. if (name.indexOf('private-encrypted-') === 0) {
  41590. if (false) { var errorMsg; }
  41591. return factory.createEncryptedChannel(name, pusher);
  41592. }
  41593. else if (name.indexOf('private-') === 0) {
  41594. return factory.createPrivateChannel(name, pusher);
  41595. }
  41596. else if (name.indexOf('presence-') === 0) {
  41597. return factory.createPresenceChannel(name, pusher);
  41598. }
  41599. else {
  41600. return factory.createChannel(name, pusher);
  41601. }
  41602. }
  41603. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41604. var Factory = {
  41605. createChannels: function () {
  41606. return new channels();
  41607. },
  41608. createConnectionManager: function (key, options) {
  41609. return new connection_manager(key, options);
  41610. },
  41611. createChannel: function (name, pusher) {
  41612. return new channels_channel(name, pusher);
  41613. },
  41614. createPrivateChannel: function (name, pusher) {
  41615. return new private_channel(name, pusher);
  41616. },
  41617. createPresenceChannel: function (name, pusher) {
  41618. return new presence_channel(name, pusher);
  41619. },
  41620. createEncryptedChannel: function (name, pusher) {
  41621. return new encrypted_channel(name, pusher);
  41622. },
  41623. createTimelineSender: function (timeline, options) {
  41624. return new timeline_sender(timeline, options);
  41625. },
  41626. createAuthorizer: function (channel, options) {
  41627. if (options.authorizer) {
  41628. return options.authorizer(channel, options);
  41629. }
  41630. return new pusher_authorizer(channel, options);
  41631. },
  41632. createHandshake: function (transport, callback) {
  41633. return new connection_handshake(transport, callback);
  41634. },
  41635. createAssistantToTheTransportManager: function (manager, transport, options) {
  41636. return new assistant_to_the_transport_manager(manager, transport, options);
  41637. }
  41638. };
  41639. /* harmony default export */ var factory = (Factory);
  41640. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41641. var transport_manager_TransportManager = (function () {
  41642. function TransportManager(options) {
  41643. this.options = options || {};
  41644. this.livesLeft = this.options.lives || Infinity;
  41645. }
  41646. TransportManager.prototype.getAssistant = function (transport) {
  41647. return factory.createAssistantToTheTransportManager(this, transport, {
  41648. minPingDelay: this.options.minPingDelay,
  41649. maxPingDelay: this.options.maxPingDelay
  41650. });
  41651. };
  41652. TransportManager.prototype.isAlive = function () {
  41653. return this.livesLeft > 0;
  41654. };
  41655. TransportManager.prototype.reportDeath = function () {
  41656. this.livesLeft -= 1;
  41657. };
  41658. return TransportManager;
  41659. }());
  41660. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41661. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41662. var sequential_strategy_SequentialStrategy = (function () {
  41663. function SequentialStrategy(strategies, options) {
  41664. this.strategies = strategies;
  41665. this.loop = Boolean(options.loop);
  41666. this.failFast = Boolean(options.failFast);
  41667. this.timeout = options.timeout;
  41668. this.timeoutLimit = options.timeoutLimit;
  41669. }
  41670. SequentialStrategy.prototype.isSupported = function () {
  41671. return any(this.strategies, util.method("isSupported"));
  41672. };
  41673. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41674. var _this = this;
  41675. var strategies = this.strategies;
  41676. var current = 0;
  41677. var timeout = this.timeout;
  41678. var runner = null;
  41679. var tryNextStrategy = function (error, handshake) {
  41680. if (handshake) {
  41681. callback(null, handshake);
  41682. }
  41683. else {
  41684. current = current + 1;
  41685. if (_this.loop) {
  41686. current = current % strategies.length;
  41687. }
  41688. if (current < strategies.length) {
  41689. if (timeout) {
  41690. timeout = timeout * 2;
  41691. if (_this.timeoutLimit) {
  41692. timeout = Math.min(timeout, _this.timeoutLimit);
  41693. }
  41694. }
  41695. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41696. }
  41697. else {
  41698. callback(true);
  41699. }
  41700. }
  41701. };
  41702. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41703. return {
  41704. abort: function () {
  41705. runner.abort();
  41706. },
  41707. forceMinPriority: function (p) {
  41708. minPriority = p;
  41709. if (runner) {
  41710. runner.forceMinPriority(p);
  41711. }
  41712. }
  41713. };
  41714. };
  41715. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41716. var timer = null;
  41717. var runner = null;
  41718. if (options.timeout > 0) {
  41719. timer = new OneOffTimer(options.timeout, function () {
  41720. runner.abort();
  41721. callback(true);
  41722. });
  41723. }
  41724. runner = strategy.connect(minPriority, function (error, handshake) {
  41725. if (error && timer && timer.isRunning() && !options.failFast) {
  41726. return;
  41727. }
  41728. if (timer) {
  41729. timer.ensureAborted();
  41730. }
  41731. callback(error, handshake);
  41732. });
  41733. return {
  41734. abort: function () {
  41735. if (timer) {
  41736. timer.ensureAborted();
  41737. }
  41738. runner.abort();
  41739. },
  41740. forceMinPriority: function (p) {
  41741. runner.forceMinPriority(p);
  41742. }
  41743. };
  41744. };
  41745. return SequentialStrategy;
  41746. }());
  41747. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41748. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41749. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41750. function BestConnectedEverStrategy(strategies) {
  41751. this.strategies = strategies;
  41752. }
  41753. BestConnectedEverStrategy.prototype.isSupported = function () {
  41754. return any(this.strategies, util.method("isSupported"));
  41755. };
  41756. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41757. return connect(this.strategies, minPriority, function (i, runners) {
  41758. return function (error, handshake) {
  41759. runners[i].error = error;
  41760. if (error) {
  41761. if (allRunnersFailed(runners)) {
  41762. callback(true);
  41763. }
  41764. return;
  41765. }
  41766. apply(runners, function (runner) {
  41767. runner.forceMinPriority(handshake.transport.priority);
  41768. });
  41769. callback(null, handshake);
  41770. };
  41771. });
  41772. };
  41773. return BestConnectedEverStrategy;
  41774. }());
  41775. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41776. function connect(strategies, minPriority, callbackBuilder) {
  41777. var runners = map(strategies, function (strategy, i, _, rs) {
  41778. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41779. });
  41780. return {
  41781. abort: function () {
  41782. apply(runners, abortRunner);
  41783. },
  41784. forceMinPriority: function (p) {
  41785. apply(runners, function (runner) {
  41786. runner.forceMinPriority(p);
  41787. });
  41788. }
  41789. };
  41790. }
  41791. function allRunnersFailed(runners) {
  41792. return collections_all(runners, function (runner) {
  41793. return Boolean(runner.error);
  41794. });
  41795. }
  41796. function abortRunner(runner) {
  41797. if (!runner.error && !runner.aborted) {
  41798. runner.abort();
  41799. runner.aborted = true;
  41800. }
  41801. }
  41802. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41803. var cached_strategy_CachedStrategy = (function () {
  41804. function CachedStrategy(strategy, transports, options) {
  41805. this.strategy = strategy;
  41806. this.transports = transports;
  41807. this.ttl = options.ttl || 1800 * 1000;
  41808. this.usingTLS = options.useTLS;
  41809. this.timeline = options.timeline;
  41810. }
  41811. CachedStrategy.prototype.isSupported = function () {
  41812. return this.strategy.isSupported();
  41813. };
  41814. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41815. var usingTLS = this.usingTLS;
  41816. var info = fetchTransportCache(usingTLS);
  41817. var strategies = [this.strategy];
  41818. if (info && info.timestamp + this.ttl >= util.now()) {
  41819. var transport = this.transports[info.transport];
  41820. if (transport) {
  41821. this.timeline.info({
  41822. cached: true,
  41823. transport: info.transport,
  41824. latency: info.latency
  41825. });
  41826. strategies.push(new sequential_strategy([transport], {
  41827. timeout: info.latency * 2 + 1000,
  41828. failFast: true
  41829. }));
  41830. }
  41831. }
  41832. var startTimestamp = util.now();
  41833. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41834. if (error) {
  41835. flushTransportCache(usingTLS);
  41836. if (strategies.length > 0) {
  41837. startTimestamp = util.now();
  41838. runner = strategies.pop().connect(minPriority, cb);
  41839. }
  41840. else {
  41841. callback(error);
  41842. }
  41843. }
  41844. else {
  41845. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41846. callback(null, handshake);
  41847. }
  41848. });
  41849. return {
  41850. abort: function () {
  41851. runner.abort();
  41852. },
  41853. forceMinPriority: function (p) {
  41854. minPriority = p;
  41855. if (runner) {
  41856. runner.forceMinPriority(p);
  41857. }
  41858. }
  41859. };
  41860. };
  41861. return CachedStrategy;
  41862. }());
  41863. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41864. function getTransportCacheKey(usingTLS) {
  41865. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41866. }
  41867. function fetchTransportCache(usingTLS) {
  41868. var storage = runtime.getLocalStorage();
  41869. if (storage) {
  41870. try {
  41871. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41872. if (serializedCache) {
  41873. return JSON.parse(serializedCache);
  41874. }
  41875. }
  41876. catch (e) {
  41877. flushTransportCache(usingTLS);
  41878. }
  41879. }
  41880. return null;
  41881. }
  41882. function storeTransportCache(usingTLS, transport, latency) {
  41883. var storage = runtime.getLocalStorage();
  41884. if (storage) {
  41885. try {
  41886. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41887. timestamp: util.now(),
  41888. transport: transport,
  41889. latency: latency
  41890. });
  41891. }
  41892. catch (e) {
  41893. }
  41894. }
  41895. }
  41896. function flushTransportCache(usingTLS) {
  41897. var storage = runtime.getLocalStorage();
  41898. if (storage) {
  41899. try {
  41900. delete storage[getTransportCacheKey(usingTLS)];
  41901. }
  41902. catch (e) {
  41903. }
  41904. }
  41905. }
  41906. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41907. var delayed_strategy_DelayedStrategy = (function () {
  41908. function DelayedStrategy(strategy, _a) {
  41909. var number = _a.delay;
  41910. this.strategy = strategy;
  41911. this.options = { delay: number };
  41912. }
  41913. DelayedStrategy.prototype.isSupported = function () {
  41914. return this.strategy.isSupported();
  41915. };
  41916. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41917. var strategy = this.strategy;
  41918. var runner;
  41919. var timer = new OneOffTimer(this.options.delay, function () {
  41920. runner = strategy.connect(minPriority, callback);
  41921. });
  41922. return {
  41923. abort: function () {
  41924. timer.ensureAborted();
  41925. if (runner) {
  41926. runner.abort();
  41927. }
  41928. },
  41929. forceMinPriority: function (p) {
  41930. minPriority = p;
  41931. if (runner) {
  41932. runner.forceMinPriority(p);
  41933. }
  41934. }
  41935. };
  41936. };
  41937. return DelayedStrategy;
  41938. }());
  41939. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41940. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41941. var IfStrategy = (function () {
  41942. function IfStrategy(test, trueBranch, falseBranch) {
  41943. this.test = test;
  41944. this.trueBranch = trueBranch;
  41945. this.falseBranch = falseBranch;
  41946. }
  41947. IfStrategy.prototype.isSupported = function () {
  41948. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41949. return branch.isSupported();
  41950. };
  41951. IfStrategy.prototype.connect = function (minPriority, callback) {
  41952. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41953. return branch.connect(minPriority, callback);
  41954. };
  41955. return IfStrategy;
  41956. }());
  41957. /* harmony default export */ var if_strategy = (IfStrategy);
  41958. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41959. var FirstConnectedStrategy = (function () {
  41960. function FirstConnectedStrategy(strategy) {
  41961. this.strategy = strategy;
  41962. }
  41963. FirstConnectedStrategy.prototype.isSupported = function () {
  41964. return this.strategy.isSupported();
  41965. };
  41966. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41967. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41968. if (handshake) {
  41969. runner.abort();
  41970. }
  41971. callback(error, handshake);
  41972. });
  41973. return runner;
  41974. };
  41975. return FirstConnectedStrategy;
  41976. }());
  41977. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41978. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41979. function testSupportsStrategy(strategy) {
  41980. return function () {
  41981. return strategy.isSupported();
  41982. };
  41983. }
  41984. var getDefaultStrategy = function (config, defineTransport) {
  41985. var definedTransports = {};
  41986. function defineTransportStrategy(name, type, priority, options, manager) {
  41987. var transport = defineTransport(config, name, type, priority, options, manager);
  41988. definedTransports[name] = transport;
  41989. return transport;
  41990. }
  41991. var ws_options = {
  41992. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41993. hostTLS: config.wsHost + ":" + config.wssPort,
  41994. httpPath: config.wsPath
  41995. };
  41996. var wss_options = extend({}, ws_options, {
  41997. useTLS: true
  41998. });
  41999. var sockjs_options = {
  42000. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42001. hostTLS: config.httpHost + ":" + config.httpsPort,
  42002. httpPath: config.httpPath
  42003. };
  42004. var timeouts = {
  42005. loop: true,
  42006. timeout: 15000,
  42007. timeoutLimit: 60000
  42008. };
  42009. var ws_manager = new transport_manager({
  42010. lives: 2,
  42011. minPingDelay: 10000,
  42012. maxPingDelay: config.activity_timeout
  42013. });
  42014. var streaming_manager = new transport_manager({
  42015. lives: 2,
  42016. minPingDelay: 10000,
  42017. maxPingDelay: config.activity_timeout
  42018. });
  42019. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42020. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42021. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42022. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42023. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42024. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42025. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42026. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42027. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42028. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42029. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42030. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42031. 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);
  42032. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42033. var wsStrategy;
  42034. if (config.useTLS) {
  42035. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42036. }
  42037. else {
  42038. wsStrategy = new best_connected_ever_strategy([
  42039. ws_loop,
  42040. new delayed_strategy(wss_loop, { delay: 2000 }),
  42041. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42042. ]);
  42043. }
  42044. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42045. ttl: 1800000,
  42046. timeline: config.timeline,
  42047. useTLS: config.useTLS
  42048. });
  42049. };
  42050. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42051. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42052. /* harmony default export */ var transport_connection_initializer = (function () {
  42053. var self = this;
  42054. self.timeline.info(self.buildTimelineMessage({
  42055. transport: self.name + (self.options.useTLS ? "s" : "")
  42056. }));
  42057. if (self.hooks.isInitialized()) {
  42058. self.changeState("initialized");
  42059. }
  42060. else if (self.hooks.file) {
  42061. self.changeState("initializing");
  42062. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42063. if (self.hooks.isInitialized()) {
  42064. self.changeState("initialized");
  42065. callback(true);
  42066. }
  42067. else {
  42068. if (error) {
  42069. self.onError(error);
  42070. }
  42071. self.onClose();
  42072. callback(false);
  42073. }
  42074. });
  42075. }
  42076. else {
  42077. self.onClose();
  42078. }
  42079. });
  42080. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42081. var http_xdomain_request_hooks = {
  42082. getRequest: function (socket) {
  42083. var xdr = new window.XDomainRequest();
  42084. xdr.ontimeout = function () {
  42085. socket.emit("error", new RequestTimedOut());
  42086. socket.close();
  42087. };
  42088. xdr.onerror = function (e) {
  42089. socket.emit("error", e);
  42090. socket.close();
  42091. };
  42092. xdr.onprogress = function () {
  42093. if (xdr.responseText && xdr.responseText.length > 0) {
  42094. socket.onChunk(200, xdr.responseText);
  42095. }
  42096. };
  42097. xdr.onload = function () {
  42098. if (xdr.responseText && xdr.responseText.length > 0) {
  42099. socket.onChunk(200, xdr.responseText);
  42100. }
  42101. socket.emit("finished", 200);
  42102. socket.close();
  42103. };
  42104. return xdr;
  42105. },
  42106. abortRequest: function (xdr) {
  42107. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42108. xdr.abort();
  42109. }
  42110. };
  42111. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42112. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42113. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42114. var extendStatics = function (d, b) {
  42115. extendStatics = Object.setPrototypeOf ||
  42116. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42117. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42118. return extendStatics(d, b);
  42119. };
  42120. return function (d, b) {
  42121. extendStatics(d, b);
  42122. function __() { this.constructor = d; }
  42123. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42124. };
  42125. })();
  42126. var MAX_BUFFER_LENGTH = 256 * 1024;
  42127. var http_request_HTTPRequest = (function (_super) {
  42128. http_request_extends(HTTPRequest, _super);
  42129. function HTTPRequest(hooks, method, url) {
  42130. var _this = _super.call(this) || this;
  42131. _this.hooks = hooks;
  42132. _this.method = method;
  42133. _this.url = url;
  42134. return _this;
  42135. }
  42136. HTTPRequest.prototype.start = function (payload) {
  42137. var _this = this;
  42138. this.position = 0;
  42139. this.xhr = this.hooks.getRequest(this);
  42140. this.unloader = function () {
  42141. _this.close();
  42142. };
  42143. runtime.addUnloadListener(this.unloader);
  42144. this.xhr.open(this.method, this.url, true);
  42145. if (this.xhr.setRequestHeader) {
  42146. this.xhr.setRequestHeader("Content-Type", "application/json");
  42147. }
  42148. this.xhr.send(payload);
  42149. };
  42150. HTTPRequest.prototype.close = function () {
  42151. if (this.unloader) {
  42152. runtime.removeUnloadListener(this.unloader);
  42153. this.unloader = null;
  42154. }
  42155. if (this.xhr) {
  42156. this.hooks.abortRequest(this.xhr);
  42157. this.xhr = null;
  42158. }
  42159. };
  42160. HTTPRequest.prototype.onChunk = function (status, data) {
  42161. while (true) {
  42162. var chunk = this.advanceBuffer(data);
  42163. if (chunk) {
  42164. this.emit("chunk", { status: status, data: chunk });
  42165. }
  42166. else {
  42167. break;
  42168. }
  42169. }
  42170. if (this.isBufferTooLong(data)) {
  42171. this.emit("buffer_too_long");
  42172. }
  42173. };
  42174. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42175. var unreadData = buffer.slice(this.position);
  42176. var endOfLinePosition = unreadData.indexOf("\n");
  42177. if (endOfLinePosition !== -1) {
  42178. this.position += endOfLinePosition + 1;
  42179. return unreadData.slice(0, endOfLinePosition);
  42180. }
  42181. else {
  42182. return null;
  42183. }
  42184. };
  42185. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42186. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42187. };
  42188. return HTTPRequest;
  42189. }(dispatcher));
  42190. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42191. // CONCATENATED MODULE: ./src/core/http/state.ts
  42192. var State;
  42193. (function (State) {
  42194. State[State["CONNECTING"] = 0] = "CONNECTING";
  42195. State[State["OPEN"] = 1] = "OPEN";
  42196. State[State["CLOSED"] = 3] = "CLOSED";
  42197. })(State || (State = {}));
  42198. /* harmony default export */ var state = (State);
  42199. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42200. var autoIncrement = 1;
  42201. var http_socket_HTTPSocket = (function () {
  42202. function HTTPSocket(hooks, url) {
  42203. this.hooks = hooks;
  42204. this.session = randomNumber(1000) + "/" + randomString(8);
  42205. this.location = getLocation(url);
  42206. this.readyState = state.CONNECTING;
  42207. this.openStream();
  42208. }
  42209. HTTPSocket.prototype.send = function (payload) {
  42210. return this.sendRaw(JSON.stringify([payload]));
  42211. };
  42212. HTTPSocket.prototype.ping = function () {
  42213. this.hooks.sendHeartbeat(this);
  42214. };
  42215. HTTPSocket.prototype.close = function (code, reason) {
  42216. this.onClose(code, reason, true);
  42217. };
  42218. HTTPSocket.prototype.sendRaw = function (payload) {
  42219. if (this.readyState === state.OPEN) {
  42220. try {
  42221. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42222. return true;
  42223. }
  42224. catch (e) {
  42225. return false;
  42226. }
  42227. }
  42228. else {
  42229. return false;
  42230. }
  42231. };
  42232. HTTPSocket.prototype.reconnect = function () {
  42233. this.closeStream();
  42234. this.openStream();
  42235. };
  42236. ;
  42237. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42238. this.closeStream();
  42239. this.readyState = state.CLOSED;
  42240. if (this.onclose) {
  42241. this.onclose({
  42242. code: code,
  42243. reason: reason,
  42244. wasClean: wasClean
  42245. });
  42246. }
  42247. };
  42248. HTTPSocket.prototype.onChunk = function (chunk) {
  42249. if (chunk.status !== 200) {
  42250. return;
  42251. }
  42252. if (this.readyState === state.OPEN) {
  42253. this.onActivity();
  42254. }
  42255. var payload;
  42256. var type = chunk.data.slice(0, 1);
  42257. switch (type) {
  42258. case 'o':
  42259. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42260. this.onOpen(payload);
  42261. break;
  42262. case 'a':
  42263. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42264. for (var i = 0; i < payload.length; i++) {
  42265. this.onEvent(payload[i]);
  42266. }
  42267. break;
  42268. case 'm':
  42269. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42270. this.onEvent(payload);
  42271. break;
  42272. case 'h':
  42273. this.hooks.onHeartbeat(this);
  42274. break;
  42275. case 'c':
  42276. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42277. this.onClose(payload[0], payload[1], true);
  42278. break;
  42279. }
  42280. };
  42281. HTTPSocket.prototype.onOpen = function (options) {
  42282. if (this.readyState === state.CONNECTING) {
  42283. if (options && options.hostname) {
  42284. this.location.base = replaceHost(this.location.base, options.hostname);
  42285. }
  42286. this.readyState = state.OPEN;
  42287. if (this.onopen) {
  42288. this.onopen();
  42289. }
  42290. }
  42291. else {
  42292. this.onClose(1006, "Server lost session", true);
  42293. }
  42294. };
  42295. HTTPSocket.prototype.onEvent = function (event) {
  42296. if (this.readyState === state.OPEN && this.onmessage) {
  42297. this.onmessage({ data: event });
  42298. }
  42299. };
  42300. HTTPSocket.prototype.onActivity = function () {
  42301. if (this.onactivity) {
  42302. this.onactivity();
  42303. }
  42304. };
  42305. HTTPSocket.prototype.onError = function (error) {
  42306. if (this.onerror) {
  42307. this.onerror(error);
  42308. }
  42309. };
  42310. HTTPSocket.prototype.openStream = function () {
  42311. var _this = this;
  42312. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42313. this.stream.bind("chunk", function (chunk) {
  42314. _this.onChunk(chunk);
  42315. });
  42316. this.stream.bind("finished", function (status) {
  42317. _this.hooks.onFinished(_this, status);
  42318. });
  42319. this.stream.bind("buffer_too_long", function () {
  42320. _this.reconnect();
  42321. });
  42322. try {
  42323. this.stream.start();
  42324. }
  42325. catch (error) {
  42326. util.defer(function () {
  42327. _this.onError(error);
  42328. _this.onClose(1006, "Could not start streaming", false);
  42329. });
  42330. }
  42331. };
  42332. HTTPSocket.prototype.closeStream = function () {
  42333. if (this.stream) {
  42334. this.stream.unbind_all();
  42335. this.stream.close();
  42336. this.stream = null;
  42337. }
  42338. };
  42339. return HTTPSocket;
  42340. }());
  42341. function getLocation(url) {
  42342. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42343. return {
  42344. base: parts[1],
  42345. queryString: parts[2]
  42346. };
  42347. }
  42348. function getSendURL(url, session) {
  42349. return url.base + "/" + session + "/xhr_send";
  42350. }
  42351. function getUniqueURL(url) {
  42352. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42353. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42354. }
  42355. function replaceHost(url, hostname) {
  42356. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42357. return urlParts[1] + hostname + urlParts[3];
  42358. }
  42359. function randomNumber(max) {
  42360. return Math.floor(Math.random() * max);
  42361. }
  42362. function randomString(length) {
  42363. var result = [];
  42364. for (var i = 0; i < length; i++) {
  42365. result.push(randomNumber(32).toString(32));
  42366. }
  42367. return result.join('');
  42368. }
  42369. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42370. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42371. var http_streaming_socket_hooks = {
  42372. getReceiveURL: function (url, session) {
  42373. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42374. },
  42375. onHeartbeat: function (socket) {
  42376. socket.sendRaw("[]");
  42377. },
  42378. sendHeartbeat: function (socket) {
  42379. socket.sendRaw("[]");
  42380. },
  42381. onFinished: function (socket, status) {
  42382. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42383. }
  42384. };
  42385. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42386. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42387. var http_polling_socket_hooks = {
  42388. getReceiveURL: function (url, session) {
  42389. return url.base + "/" + session + "/xhr" + url.queryString;
  42390. },
  42391. onHeartbeat: function () {
  42392. },
  42393. sendHeartbeat: function (socket) {
  42394. socket.sendRaw("[]");
  42395. },
  42396. onFinished: function (socket, status) {
  42397. if (status === 200) {
  42398. socket.reconnect();
  42399. }
  42400. else {
  42401. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42402. }
  42403. }
  42404. };
  42405. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42406. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42407. var http_xhr_request_hooks = {
  42408. getRequest: function (socket) {
  42409. var Constructor = runtime.getXHRAPI();
  42410. var xhr = new Constructor();
  42411. xhr.onreadystatechange = xhr.onprogress = function () {
  42412. switch (xhr.readyState) {
  42413. case 3:
  42414. if (xhr.responseText && xhr.responseText.length > 0) {
  42415. socket.onChunk(xhr.status, xhr.responseText);
  42416. }
  42417. break;
  42418. case 4:
  42419. if (xhr.responseText && xhr.responseText.length > 0) {
  42420. socket.onChunk(xhr.status, xhr.responseText);
  42421. }
  42422. socket.emit("finished", xhr.status);
  42423. socket.close();
  42424. break;
  42425. }
  42426. };
  42427. return xhr;
  42428. },
  42429. abortRequest: function (xhr) {
  42430. xhr.onreadystatechange = null;
  42431. xhr.abort();
  42432. }
  42433. };
  42434. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42435. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42436. var HTTP = {
  42437. createStreamingSocket: function (url) {
  42438. return this.createSocket(http_streaming_socket, url);
  42439. },
  42440. createPollingSocket: function (url) {
  42441. return this.createSocket(http_polling_socket, url);
  42442. },
  42443. createSocket: function (hooks, url) {
  42444. return new http_socket(hooks, url);
  42445. },
  42446. createXHR: function (method, url) {
  42447. return this.createRequest(http_xhr_request, method, url);
  42448. },
  42449. createRequest: function (hooks, method, url) {
  42450. return new http_request(hooks, method, url);
  42451. }
  42452. };
  42453. /* harmony default export */ var http_http = (HTTP);
  42454. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42455. http_http.createXDR = function (method, url) {
  42456. return this.createRequest(http_xdomain_request, method, url);
  42457. };
  42458. /* harmony default export */ var web_http_http = (http_http);
  42459. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42460. var Runtime = {
  42461. nextAuthCallbackID: 1,
  42462. auth_callbacks: {},
  42463. ScriptReceivers: ScriptReceivers,
  42464. DependenciesReceivers: DependenciesReceivers,
  42465. getDefaultStrategy: default_strategy,
  42466. Transports: transports_transports,
  42467. transportConnectionInitializer: transport_connection_initializer,
  42468. HTTPFactory: web_http_http,
  42469. TimelineTransport: jsonp_timeline,
  42470. getXHRAPI: function () {
  42471. return window.XMLHttpRequest;
  42472. },
  42473. getWebSocketAPI: function () {
  42474. return window.WebSocket || window.MozWebSocket;
  42475. },
  42476. setup: function (PusherClass) {
  42477. var _this = this;
  42478. window.Pusher = PusherClass;
  42479. var initializeOnDocumentBody = function () {
  42480. _this.onDocumentBody(PusherClass.ready);
  42481. };
  42482. if (!window.JSON) {
  42483. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42484. }
  42485. else {
  42486. initializeOnDocumentBody();
  42487. }
  42488. },
  42489. getDocument: function () {
  42490. return document;
  42491. },
  42492. getProtocol: function () {
  42493. return this.getDocument().location.protocol;
  42494. },
  42495. getAuthorizers: function () {
  42496. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42497. },
  42498. onDocumentBody: function (callback) {
  42499. var _this = this;
  42500. if (document.body) {
  42501. callback();
  42502. }
  42503. else {
  42504. setTimeout(function () {
  42505. _this.onDocumentBody(callback);
  42506. }, 0);
  42507. }
  42508. },
  42509. createJSONPRequest: function (url, data) {
  42510. return new jsonp_request(url, data);
  42511. },
  42512. createScriptRequest: function (src) {
  42513. return new script_request(src);
  42514. },
  42515. getLocalStorage: function () {
  42516. try {
  42517. return window.localStorage;
  42518. }
  42519. catch (e) {
  42520. return undefined;
  42521. }
  42522. },
  42523. createXHR: function () {
  42524. if (this.getXHRAPI()) {
  42525. return this.createXMLHttpRequest();
  42526. }
  42527. else {
  42528. return this.createMicrosoftXHR();
  42529. }
  42530. },
  42531. createXMLHttpRequest: function () {
  42532. var Constructor = this.getXHRAPI();
  42533. return new Constructor();
  42534. },
  42535. createMicrosoftXHR: function () {
  42536. return new ActiveXObject("Microsoft.XMLHTTP");
  42537. },
  42538. getNetwork: function () {
  42539. return net_info_Network;
  42540. },
  42541. createWebSocket: function (url) {
  42542. var Constructor = this.getWebSocketAPI();
  42543. return new Constructor(url);
  42544. },
  42545. createSocketRequest: function (method, url) {
  42546. if (this.isXHRSupported()) {
  42547. return this.HTTPFactory.createXHR(method, url);
  42548. }
  42549. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42550. return this.HTTPFactory.createXDR(method, url);
  42551. }
  42552. else {
  42553. throw "Cross-origin HTTP requests are not supported";
  42554. }
  42555. },
  42556. isXHRSupported: function () {
  42557. var Constructor = this.getXHRAPI();
  42558. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42559. },
  42560. isXDRSupported: function (useTLS) {
  42561. var protocol = useTLS ? "https:" : "http:";
  42562. var documentProtocol = this.getProtocol();
  42563. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42564. },
  42565. addUnloadListener: function (listener) {
  42566. if (window.addEventListener !== undefined) {
  42567. window.addEventListener("unload", listener, false);
  42568. }
  42569. else if (window.attachEvent !== undefined) {
  42570. window.attachEvent("onunload", listener);
  42571. }
  42572. },
  42573. removeUnloadListener: function (listener) {
  42574. if (window.addEventListener !== undefined) {
  42575. window.removeEventListener("unload", listener, false);
  42576. }
  42577. else if (window.detachEvent !== undefined) {
  42578. window.detachEvent("onunload", listener);
  42579. }
  42580. }
  42581. };
  42582. /* harmony default export */ var runtime = (Runtime);
  42583. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42584. var TimelineLevel;
  42585. (function (TimelineLevel) {
  42586. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42587. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42588. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42589. })(TimelineLevel || (TimelineLevel = {}));
  42590. /* harmony default export */ var timeline_level = (TimelineLevel);
  42591. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42592. var timeline_Timeline = (function () {
  42593. function Timeline(key, session, options) {
  42594. this.key = key;
  42595. this.session = session;
  42596. this.events = [];
  42597. this.options = options || {};
  42598. this.sent = 0;
  42599. this.uniqueID = 0;
  42600. }
  42601. Timeline.prototype.log = function (level, event) {
  42602. if (level <= this.options.level) {
  42603. this.events.push(extend({}, event, { timestamp: util.now() }));
  42604. if (this.options.limit && this.events.length > this.options.limit) {
  42605. this.events.shift();
  42606. }
  42607. }
  42608. };
  42609. Timeline.prototype.error = function (event) {
  42610. this.log(timeline_level.ERROR, event);
  42611. };
  42612. Timeline.prototype.info = function (event) {
  42613. this.log(timeline_level.INFO, event);
  42614. };
  42615. Timeline.prototype.debug = function (event) {
  42616. this.log(timeline_level.DEBUG, event);
  42617. };
  42618. Timeline.prototype.isEmpty = function () {
  42619. return this.events.length === 0;
  42620. };
  42621. Timeline.prototype.send = function (sendfn, callback) {
  42622. var _this = this;
  42623. var data = extend({
  42624. session: this.session,
  42625. bundle: this.sent + 1,
  42626. key: this.key,
  42627. lib: "js",
  42628. version: this.options.version,
  42629. cluster: this.options.cluster,
  42630. features: this.options.features,
  42631. timeline: this.events
  42632. }, this.options.params);
  42633. this.events = [];
  42634. sendfn(data, function (error, result) {
  42635. if (!error) {
  42636. _this.sent++;
  42637. }
  42638. if (callback) {
  42639. callback(error, result);
  42640. }
  42641. });
  42642. return true;
  42643. };
  42644. Timeline.prototype.generateUniqueID = function () {
  42645. this.uniqueID++;
  42646. return this.uniqueID;
  42647. };
  42648. return Timeline;
  42649. }());
  42650. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42651. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42652. var transport_strategy_TransportStrategy = (function () {
  42653. function TransportStrategy(name, priority, transport, options) {
  42654. this.name = name;
  42655. this.priority = priority;
  42656. this.transport = transport;
  42657. this.options = options || {};
  42658. }
  42659. TransportStrategy.prototype.isSupported = function () {
  42660. return this.transport.isSupported({
  42661. useTLS: this.options.useTLS
  42662. });
  42663. };
  42664. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42665. var _this = this;
  42666. if (!this.isSupported()) {
  42667. return failAttempt(new UnsupportedStrategy(), callback);
  42668. }
  42669. else if (this.priority < minPriority) {
  42670. return failAttempt(new TransportPriorityTooLow(), callback);
  42671. }
  42672. var connected = false;
  42673. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42674. var handshake = null;
  42675. var onInitialized = function () {
  42676. transport.unbind("initialized", onInitialized);
  42677. transport.connect();
  42678. };
  42679. var onOpen = function () {
  42680. handshake = factory.createHandshake(transport, function (result) {
  42681. connected = true;
  42682. unbindListeners();
  42683. callback(null, result);
  42684. });
  42685. };
  42686. var onError = function (error) {
  42687. unbindListeners();
  42688. callback(error);
  42689. };
  42690. var onClosed = function () {
  42691. unbindListeners();
  42692. var serializedTransport;
  42693. serializedTransport = safeJSONStringify(transport);
  42694. callback(new TransportClosed(serializedTransport));
  42695. };
  42696. var unbindListeners = function () {
  42697. transport.unbind("initialized", onInitialized);
  42698. transport.unbind("open", onOpen);
  42699. transport.unbind("error", onError);
  42700. transport.unbind("closed", onClosed);
  42701. };
  42702. transport.bind("initialized", onInitialized);
  42703. transport.bind("open", onOpen);
  42704. transport.bind("error", onError);
  42705. transport.bind("closed", onClosed);
  42706. transport.initialize();
  42707. return {
  42708. abort: function () {
  42709. if (connected) {
  42710. return;
  42711. }
  42712. unbindListeners();
  42713. if (handshake) {
  42714. handshake.close();
  42715. }
  42716. else {
  42717. transport.close();
  42718. }
  42719. },
  42720. forceMinPriority: function (p) {
  42721. if (connected) {
  42722. return;
  42723. }
  42724. if (_this.priority < p) {
  42725. if (handshake) {
  42726. handshake.close();
  42727. }
  42728. else {
  42729. transport.close();
  42730. }
  42731. }
  42732. }
  42733. };
  42734. };
  42735. return TransportStrategy;
  42736. }());
  42737. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42738. function failAttempt(error, callback) {
  42739. util.defer(function () {
  42740. callback(error);
  42741. });
  42742. return {
  42743. abort: function () { },
  42744. forceMinPriority: function () { }
  42745. };
  42746. }
  42747. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42748. var strategy_builder_Transports = runtime.Transports;
  42749. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42750. var transportClass = strategy_builder_Transports[type];
  42751. if (!transportClass) {
  42752. throw new UnsupportedTransport(type);
  42753. }
  42754. var enabled = (!config.enabledTransports ||
  42755. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42756. (!config.disabledTransports ||
  42757. arrayIndexOf(config.disabledTransports, name) === -1);
  42758. var transport;
  42759. if (enabled) {
  42760. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42761. key: config.key,
  42762. useTLS: config.useTLS,
  42763. timeline: config.timeline,
  42764. ignoreNullOrigin: config.ignoreNullOrigin
  42765. }, options));
  42766. }
  42767. else {
  42768. transport = strategy_builder_UnsupportedStrategy;
  42769. }
  42770. return transport;
  42771. };
  42772. var strategy_builder_UnsupportedStrategy = {
  42773. isSupported: function () {
  42774. return false;
  42775. },
  42776. connect: function (_, callback) {
  42777. var deferred = util.defer(function () {
  42778. callback(new UnsupportedStrategy());
  42779. });
  42780. return {
  42781. abort: function () {
  42782. deferred.ensureAborted();
  42783. },
  42784. forceMinPriority: function () { }
  42785. };
  42786. }
  42787. };
  42788. // CONCATENATED MODULE: ./src/core/config.ts
  42789. var getGlobalConfig = function () {
  42790. return {
  42791. wsHost: defaults.host,
  42792. wsPort: defaults.ws_port,
  42793. wssPort: defaults.wss_port,
  42794. wsPath: defaults.ws_path,
  42795. httpHost: defaults.sockjs_host,
  42796. httpPort: defaults.sockjs_http_port,
  42797. httpsPort: defaults.sockjs_https_port,
  42798. httpPath: defaults.sockjs_path,
  42799. statsHost: defaults.stats_host,
  42800. authEndpoint: defaults.channel_auth_endpoint,
  42801. authTransport: defaults.channel_auth_transport,
  42802. activity_timeout: defaults.activity_timeout,
  42803. pong_timeout: defaults.pong_timeout,
  42804. unavailable_timeout: defaults.unavailable_timeout
  42805. };
  42806. };
  42807. var getClusterConfig = function (clusterName) {
  42808. return {
  42809. wsHost: 'ws-' + clusterName + '.pusher.com',
  42810. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42811. };
  42812. };
  42813. // CONCATENATED MODULE: ./src/core/pusher.ts
  42814. var pusher_Pusher = (function () {
  42815. function Pusher(app_key, options) {
  42816. var _this = this;
  42817. checkAppKey(app_key);
  42818. options = options || {};
  42819. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42820. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42821. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42822. }
  42823. this.key = app_key;
  42824. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42825. this.channels = factory.createChannels();
  42826. this.global_emitter = new dispatcher();
  42827. this.sessionID = Math.floor(Math.random() * 1000000000);
  42828. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42829. cluster: this.config.cluster,
  42830. features: Pusher.getClientFeatures(),
  42831. params: this.config.timelineParams || {},
  42832. limit: 50,
  42833. level: timeline_level.INFO,
  42834. version: defaults.VERSION
  42835. });
  42836. if (!this.config.disableStats) {
  42837. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42838. host: this.config.statsHost,
  42839. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42840. });
  42841. }
  42842. var getStrategy = function (options) {
  42843. var config = extend({}, _this.config, options);
  42844. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42845. };
  42846. this.connection = factory.createConnectionManager(this.key, extend({
  42847. getStrategy: getStrategy,
  42848. timeline: this.timeline,
  42849. activityTimeout: this.config.activity_timeout,
  42850. pongTimeout: this.config.pong_timeout,
  42851. unavailableTimeout: this.config.unavailable_timeout
  42852. }, this.config, { useTLS: this.shouldUseTLS() }));
  42853. this.connection.bind('connected', function () {
  42854. _this.subscribeAll();
  42855. if (_this.timelineSender) {
  42856. _this.timelineSender.send(_this.connection.isUsingTLS());
  42857. }
  42858. });
  42859. this.connection.bind('message', function (event) {
  42860. var eventName = event.event;
  42861. var internal = eventName.indexOf('pusher_internal:') === 0;
  42862. if (event.channel) {
  42863. var channel = _this.channel(event.channel);
  42864. if (channel) {
  42865. channel.handleEvent(event);
  42866. }
  42867. }
  42868. if (!internal) {
  42869. _this.global_emitter.emit(event.event, event.data);
  42870. }
  42871. });
  42872. this.connection.bind('connecting', function () {
  42873. _this.channels.disconnect();
  42874. });
  42875. this.connection.bind('disconnected', function () {
  42876. _this.channels.disconnect();
  42877. });
  42878. this.connection.bind('error', function (err) {
  42879. logger.warn(err);
  42880. });
  42881. Pusher.instances.push(this);
  42882. this.timeline.info({ instances: Pusher.instances.length });
  42883. if (Pusher.isReady) {
  42884. this.connect();
  42885. }
  42886. }
  42887. Pusher.ready = function () {
  42888. Pusher.isReady = true;
  42889. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42890. Pusher.instances[i].connect();
  42891. }
  42892. };
  42893. Pusher.getClientFeatures = function () {
  42894. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42895. return t.isSupported({});
  42896. }));
  42897. };
  42898. Pusher.prototype.channel = function (name) {
  42899. return this.channels.find(name);
  42900. };
  42901. Pusher.prototype.allChannels = function () {
  42902. return this.channels.all();
  42903. };
  42904. Pusher.prototype.connect = function () {
  42905. this.connection.connect();
  42906. if (this.timelineSender) {
  42907. if (!this.timelineSenderTimer) {
  42908. var usingTLS = this.connection.isUsingTLS();
  42909. var timelineSender = this.timelineSender;
  42910. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42911. timelineSender.send(usingTLS);
  42912. });
  42913. }
  42914. }
  42915. };
  42916. Pusher.prototype.disconnect = function () {
  42917. this.connection.disconnect();
  42918. if (this.timelineSenderTimer) {
  42919. this.timelineSenderTimer.ensureAborted();
  42920. this.timelineSenderTimer = null;
  42921. }
  42922. };
  42923. Pusher.prototype.bind = function (event_name, callback, context) {
  42924. this.global_emitter.bind(event_name, callback, context);
  42925. return this;
  42926. };
  42927. Pusher.prototype.unbind = function (event_name, callback, context) {
  42928. this.global_emitter.unbind(event_name, callback, context);
  42929. return this;
  42930. };
  42931. Pusher.prototype.bind_global = function (callback) {
  42932. this.global_emitter.bind_global(callback);
  42933. return this;
  42934. };
  42935. Pusher.prototype.unbind_global = function (callback) {
  42936. this.global_emitter.unbind_global(callback);
  42937. return this;
  42938. };
  42939. Pusher.prototype.unbind_all = function (callback) {
  42940. this.global_emitter.unbind_all();
  42941. return this;
  42942. };
  42943. Pusher.prototype.subscribeAll = function () {
  42944. var channelName;
  42945. for (channelName in this.channels.channels) {
  42946. if (this.channels.channels.hasOwnProperty(channelName)) {
  42947. this.subscribe(channelName);
  42948. }
  42949. }
  42950. };
  42951. Pusher.prototype.subscribe = function (channel_name) {
  42952. var channel = this.channels.add(channel_name, this);
  42953. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42954. channel.reinstateSubscription();
  42955. }
  42956. else if (!channel.subscriptionPending &&
  42957. this.connection.state === 'connected') {
  42958. channel.subscribe();
  42959. }
  42960. return channel;
  42961. };
  42962. Pusher.prototype.unsubscribe = function (channel_name) {
  42963. var channel = this.channels.find(channel_name);
  42964. if (channel && channel.subscriptionPending) {
  42965. channel.cancelSubscription();
  42966. }
  42967. else {
  42968. channel = this.channels.remove(channel_name);
  42969. if (channel && this.connection.state === 'connected') {
  42970. channel.unsubscribe();
  42971. }
  42972. }
  42973. };
  42974. Pusher.prototype.send_event = function (event_name, data, channel) {
  42975. return this.connection.send_event(event_name, data, channel);
  42976. };
  42977. Pusher.prototype.shouldUseTLS = function () {
  42978. if (runtime.getProtocol() === 'https:') {
  42979. return true;
  42980. }
  42981. else if (this.config.forceTLS === true) {
  42982. return true;
  42983. }
  42984. else {
  42985. return Boolean(this.config.encrypted);
  42986. }
  42987. };
  42988. Pusher.instances = [];
  42989. Pusher.isReady = false;
  42990. Pusher.logToConsole = false;
  42991. Pusher.Runtime = runtime;
  42992. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42993. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42994. Pusher.auth_callbacks = runtime.auth_callbacks;
  42995. return Pusher;
  42996. }());
  42997. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42998. function checkAppKey(key) {
  42999. if (key === null || key === undefined) {
  43000. throw 'You must pass your app key when you instantiate Pusher.';
  43001. }
  43002. }
  43003. runtime.setup(pusher_Pusher);
  43004. /***/ })
  43005. /******/ ]);
  43006. });
  43007. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43008. /***/ }),
  43009. /***/ "./node_modules/setimmediate/setImmediate.js":
  43010. /*!***************************************************!*\
  43011. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43012. \***************************************************/
  43013. /*! no static exports found */
  43014. /***/ (function(module, exports, __webpack_require__) {
  43015. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43016. "use strict";
  43017. if (global.setImmediate) {
  43018. return;
  43019. }
  43020. var nextHandle = 1; // Spec says greater than zero
  43021. var tasksByHandle = {};
  43022. var currentlyRunningATask = false;
  43023. var doc = global.document;
  43024. var registerImmediate;
  43025. function setImmediate(callback) {
  43026. // Callback can either be a function or a string
  43027. if (typeof callback !== "function") {
  43028. callback = new Function("" + callback);
  43029. }
  43030. // Copy function arguments
  43031. var args = new Array(arguments.length - 1);
  43032. for (var i = 0; i < args.length; i++) {
  43033. args[i] = arguments[i + 1];
  43034. }
  43035. // Store and register the task
  43036. var task = { callback: callback, args: args };
  43037. tasksByHandle[nextHandle] = task;
  43038. registerImmediate(nextHandle);
  43039. return nextHandle++;
  43040. }
  43041. function clearImmediate(handle) {
  43042. delete tasksByHandle[handle];
  43043. }
  43044. function run(task) {
  43045. var callback = task.callback;
  43046. var args = task.args;
  43047. switch (args.length) {
  43048. case 0:
  43049. callback();
  43050. break;
  43051. case 1:
  43052. callback(args[0]);
  43053. break;
  43054. case 2:
  43055. callback(args[0], args[1]);
  43056. break;
  43057. case 3:
  43058. callback(args[0], args[1], args[2]);
  43059. break;
  43060. default:
  43061. callback.apply(undefined, args);
  43062. break;
  43063. }
  43064. }
  43065. function runIfPresent(handle) {
  43066. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43067. // So if we're currently running a task, we'll need to delay this invocation.
  43068. if (currentlyRunningATask) {
  43069. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43070. // "too much recursion" error.
  43071. setTimeout(runIfPresent, 0, handle);
  43072. } else {
  43073. var task = tasksByHandle[handle];
  43074. if (task) {
  43075. currentlyRunningATask = true;
  43076. try {
  43077. run(task);
  43078. } finally {
  43079. clearImmediate(handle);
  43080. currentlyRunningATask = false;
  43081. }
  43082. }
  43083. }
  43084. }
  43085. function installNextTickImplementation() {
  43086. registerImmediate = function(handle) {
  43087. process.nextTick(function () { runIfPresent(handle); });
  43088. };
  43089. }
  43090. function canUsePostMessage() {
  43091. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43092. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43093. if (global.postMessage && !global.importScripts) {
  43094. var postMessageIsAsynchronous = true;
  43095. var oldOnMessage = global.onmessage;
  43096. global.onmessage = function() {
  43097. postMessageIsAsynchronous = false;
  43098. };
  43099. global.postMessage("", "*");
  43100. global.onmessage = oldOnMessage;
  43101. return postMessageIsAsynchronous;
  43102. }
  43103. }
  43104. function installPostMessageImplementation() {
  43105. // Installs an event handler on `global` for the `message` event: see
  43106. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43107. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43108. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43109. var onGlobalMessage = function(event) {
  43110. if (event.source === global &&
  43111. typeof event.data === "string" &&
  43112. event.data.indexOf(messagePrefix) === 0) {
  43113. runIfPresent(+event.data.slice(messagePrefix.length));
  43114. }
  43115. };
  43116. if (global.addEventListener) {
  43117. global.addEventListener("message", onGlobalMessage, false);
  43118. } else {
  43119. global.attachEvent("onmessage", onGlobalMessage);
  43120. }
  43121. registerImmediate = function(handle) {
  43122. global.postMessage(messagePrefix + handle, "*");
  43123. };
  43124. }
  43125. function installMessageChannelImplementation() {
  43126. var channel = new MessageChannel();
  43127. channel.port1.onmessage = function(event) {
  43128. var handle = event.data;
  43129. runIfPresent(handle);
  43130. };
  43131. registerImmediate = function(handle) {
  43132. channel.port2.postMessage(handle);
  43133. };
  43134. }
  43135. function installReadyStateChangeImplementation() {
  43136. var html = doc.documentElement;
  43137. registerImmediate = function(handle) {
  43138. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43139. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43140. var script = doc.createElement("script");
  43141. script.onreadystatechange = function () {
  43142. runIfPresent(handle);
  43143. script.onreadystatechange = null;
  43144. html.removeChild(script);
  43145. script = null;
  43146. };
  43147. html.appendChild(script);
  43148. };
  43149. }
  43150. function installSetTimeoutImplementation() {
  43151. registerImmediate = function(handle) {
  43152. setTimeout(runIfPresent, 0, handle);
  43153. };
  43154. }
  43155. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43156. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43157. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43158. // Don't get fooled by e.g. browserify environments.
  43159. if ({}.toString.call(global.process) === "[object process]") {
  43160. // For Node.js before 0.9
  43161. installNextTickImplementation();
  43162. } else if (canUsePostMessage()) {
  43163. // For non-IE10 modern browsers
  43164. installPostMessageImplementation();
  43165. } else if (global.MessageChannel) {
  43166. // For web workers, where supported
  43167. installMessageChannelImplementation();
  43168. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43169. // For IE 6–8
  43170. installReadyStateChangeImplementation();
  43171. } else {
  43172. // For older browsers
  43173. installSetTimeoutImplementation();
  43174. }
  43175. attachTo.setImmediate = setImmediate;
  43176. attachTo.clearImmediate = clearImmediate;
  43177. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43178. /* 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")))
  43179. /***/ }),
  43180. /***/ "./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&":
  43181. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43182. !*** ./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& ***!
  43183. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43184. /*! no static exports found */
  43185. /***/ (function(module, exports, __webpack_require__) {
  43186. 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&");
  43187. if(typeof content === 'string') content = [[module.i, content, '']];
  43188. var transform;
  43189. var insertInto;
  43190. var options = {"hmr":true}
  43191. options.transform = transform
  43192. options.insertInto = undefined;
  43193. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43194. if(content.locals) module.exports = content.locals;
  43195. if(false) {}
  43196. /***/ }),
  43197. /***/ "./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&":
  43198. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43199. !*** ./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& ***!
  43200. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43201. /*! no static exports found */
  43202. /***/ (function(module, exports, __webpack_require__) {
  43203. 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&");
  43204. if(typeof content === 'string') content = [[module.i, content, '']];
  43205. var transform;
  43206. var insertInto;
  43207. var options = {"hmr":true}
  43208. options.transform = transform
  43209. options.insertInto = undefined;
  43210. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43211. if(content.locals) module.exports = content.locals;
  43212. if(false) {}
  43213. /***/ }),
  43214. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43215. /*!****************************************************!*\
  43216. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43217. \****************************************************/
  43218. /*! no static exports found */
  43219. /***/ (function(module, exports, __webpack_require__) {
  43220. /*
  43221. MIT License http://www.opensource.org/licenses/mit-license.php
  43222. Author Tobias Koppers @sokra
  43223. */
  43224. var stylesInDom = {};
  43225. var memoize = function (fn) {
  43226. var memo;
  43227. return function () {
  43228. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43229. return memo;
  43230. };
  43231. };
  43232. var isOldIE = memoize(function () {
  43233. // Test for IE <= 9 as proposed by Browserhacks
  43234. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43235. // Tests for existence of standard globals is to allow style-loader
  43236. // to operate correctly into non-standard environments
  43237. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43238. return window && document && document.all && !window.atob;
  43239. });
  43240. var getTarget = function (target, parent) {
  43241. if (parent){
  43242. return parent.querySelector(target);
  43243. }
  43244. return document.querySelector(target);
  43245. };
  43246. var getElement = (function (fn) {
  43247. var memo = {};
  43248. return function(target, parent) {
  43249. // If passing function in options, then use it for resolve "head" element.
  43250. // Useful for Shadow Root style i.e
  43251. // {
  43252. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43253. // }
  43254. if (typeof target === 'function') {
  43255. return target();
  43256. }
  43257. if (typeof memo[target] === "undefined") {
  43258. var styleTarget = getTarget.call(this, target, parent);
  43259. // Special case to return head of iframe instead of iframe itself
  43260. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43261. try {
  43262. // This will throw an exception if access to iframe is blocked
  43263. // due to cross-origin restrictions
  43264. styleTarget = styleTarget.contentDocument.head;
  43265. } catch(e) {
  43266. styleTarget = null;
  43267. }
  43268. }
  43269. memo[target] = styleTarget;
  43270. }
  43271. return memo[target]
  43272. };
  43273. })();
  43274. var singleton = null;
  43275. var singletonCounter = 0;
  43276. var stylesInsertedAtTop = [];
  43277. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43278. module.exports = function(list, options) {
  43279. if (typeof DEBUG !== "undefined" && DEBUG) {
  43280. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43281. }
  43282. options = options || {};
  43283. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43284. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43285. // tags it will allow on a page
  43286. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43287. // By default, add <style> tags to the <head> element
  43288. if (!options.insertInto) options.insertInto = "head";
  43289. // By default, add <style> tags to the bottom of the target
  43290. if (!options.insertAt) options.insertAt = "bottom";
  43291. var styles = listToStyles(list, options);
  43292. addStylesToDom(styles, options);
  43293. return function update (newList) {
  43294. var mayRemove = [];
  43295. for (var i = 0; i < styles.length; i++) {
  43296. var item = styles[i];
  43297. var domStyle = stylesInDom[item.id];
  43298. domStyle.refs--;
  43299. mayRemove.push(domStyle);
  43300. }
  43301. if(newList) {
  43302. var newStyles = listToStyles(newList, options);
  43303. addStylesToDom(newStyles, options);
  43304. }
  43305. for (var i = 0; i < mayRemove.length; i++) {
  43306. var domStyle = mayRemove[i];
  43307. if(domStyle.refs === 0) {
  43308. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43309. delete stylesInDom[domStyle.id];
  43310. }
  43311. }
  43312. };
  43313. };
  43314. function addStylesToDom (styles, options) {
  43315. for (var i = 0; i < styles.length; i++) {
  43316. var item = styles[i];
  43317. var domStyle = stylesInDom[item.id];
  43318. if(domStyle) {
  43319. domStyle.refs++;
  43320. for(var j = 0; j < domStyle.parts.length; j++) {
  43321. domStyle.parts[j](item.parts[j]);
  43322. }
  43323. for(; j < item.parts.length; j++) {
  43324. domStyle.parts.push(addStyle(item.parts[j], options));
  43325. }
  43326. } else {
  43327. var parts = [];
  43328. for(var j = 0; j < item.parts.length; j++) {
  43329. parts.push(addStyle(item.parts[j], options));
  43330. }
  43331. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43332. }
  43333. }
  43334. }
  43335. function listToStyles (list, options) {
  43336. var styles = [];
  43337. var newStyles = {};
  43338. for (var i = 0; i < list.length; i++) {
  43339. var item = list[i];
  43340. var id = options.base ? item[0] + options.base : item[0];
  43341. var css = item[1];
  43342. var media = item[2];
  43343. var sourceMap = item[3];
  43344. var part = {css: css, media: media, sourceMap: sourceMap};
  43345. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43346. else newStyles[id].parts.push(part);
  43347. }
  43348. return styles;
  43349. }
  43350. function insertStyleElement (options, style) {
  43351. var target = getElement(options.insertInto)
  43352. if (!target) {
  43353. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43354. }
  43355. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43356. if (options.insertAt === "top") {
  43357. if (!lastStyleElementInsertedAtTop) {
  43358. target.insertBefore(style, target.firstChild);
  43359. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43360. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43361. } else {
  43362. target.appendChild(style);
  43363. }
  43364. stylesInsertedAtTop.push(style);
  43365. } else if (options.insertAt === "bottom") {
  43366. target.appendChild(style);
  43367. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43368. var nextSibling = getElement(options.insertAt.before, target);
  43369. target.insertBefore(style, nextSibling);
  43370. } else {
  43371. 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");
  43372. }
  43373. }
  43374. function removeStyleElement (style) {
  43375. if (style.parentNode === null) return false;
  43376. style.parentNode.removeChild(style);
  43377. var idx = stylesInsertedAtTop.indexOf(style);
  43378. if(idx >= 0) {
  43379. stylesInsertedAtTop.splice(idx, 1);
  43380. }
  43381. }
  43382. function createStyleElement (options) {
  43383. var style = document.createElement("style");
  43384. if(options.attrs.type === undefined) {
  43385. options.attrs.type = "text/css";
  43386. }
  43387. if(options.attrs.nonce === undefined) {
  43388. var nonce = getNonce();
  43389. if (nonce) {
  43390. options.attrs.nonce = nonce;
  43391. }
  43392. }
  43393. addAttrs(style, options.attrs);
  43394. insertStyleElement(options, style);
  43395. return style;
  43396. }
  43397. function createLinkElement (options) {
  43398. var link = document.createElement("link");
  43399. if(options.attrs.type === undefined) {
  43400. options.attrs.type = "text/css";
  43401. }
  43402. options.attrs.rel = "stylesheet";
  43403. addAttrs(link, options.attrs);
  43404. insertStyleElement(options, link);
  43405. return link;
  43406. }
  43407. function addAttrs (el, attrs) {
  43408. Object.keys(attrs).forEach(function (key) {
  43409. el.setAttribute(key, attrs[key]);
  43410. });
  43411. }
  43412. function getNonce() {
  43413. if (false) {}
  43414. return __webpack_require__.nc;
  43415. }
  43416. function addStyle (obj, options) {
  43417. var style, update, remove, result;
  43418. // If a transform function was defined, run it on the css
  43419. if (options.transform && obj.css) {
  43420. result = typeof options.transform === 'function'
  43421. ? options.transform(obj.css)
  43422. : options.transform.default(obj.css);
  43423. if (result) {
  43424. // If transform returns a value, use that instead of the original css.
  43425. // This allows running runtime transformations on the css.
  43426. obj.css = result;
  43427. } else {
  43428. // If the transform function returns a falsy value, don't add this css.
  43429. // This allows conditional loading of css
  43430. return function() {
  43431. // noop
  43432. };
  43433. }
  43434. }
  43435. if (options.singleton) {
  43436. var styleIndex = singletonCounter++;
  43437. style = singleton || (singleton = createStyleElement(options));
  43438. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  43439. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  43440. } else if (
  43441. obj.sourceMap &&
  43442. typeof URL === "function" &&
  43443. typeof URL.createObjectURL === "function" &&
  43444. typeof URL.revokeObjectURL === "function" &&
  43445. typeof Blob === "function" &&
  43446. typeof btoa === "function"
  43447. ) {
  43448. style = createLinkElement(options);
  43449. update = updateLink.bind(null, style, options);
  43450. remove = function () {
  43451. removeStyleElement(style);
  43452. if(style.href) URL.revokeObjectURL(style.href);
  43453. };
  43454. } else {
  43455. style = createStyleElement(options);
  43456. update = applyToTag.bind(null, style);
  43457. remove = function () {
  43458. removeStyleElement(style);
  43459. };
  43460. }
  43461. update(obj);
  43462. return function updateStyle (newObj) {
  43463. if (newObj) {
  43464. if (
  43465. newObj.css === obj.css &&
  43466. newObj.media === obj.media &&
  43467. newObj.sourceMap === obj.sourceMap
  43468. ) {
  43469. return;
  43470. }
  43471. update(obj = newObj);
  43472. } else {
  43473. remove();
  43474. }
  43475. };
  43476. }
  43477. var replaceText = (function () {
  43478. var textStore = [];
  43479. return function (index, replacement) {
  43480. textStore[index] = replacement;
  43481. return textStore.filter(Boolean).join('\n');
  43482. };
  43483. })();
  43484. function applyToSingletonTag (style, index, remove, obj) {
  43485. var css = remove ? "" : obj.css;
  43486. if (style.styleSheet) {
  43487. style.styleSheet.cssText = replaceText(index, css);
  43488. } else {
  43489. var cssNode = document.createTextNode(css);
  43490. var childNodes = style.childNodes;
  43491. if (childNodes[index]) style.removeChild(childNodes[index]);
  43492. if (childNodes.length) {
  43493. style.insertBefore(cssNode, childNodes[index]);
  43494. } else {
  43495. style.appendChild(cssNode);
  43496. }
  43497. }
  43498. }
  43499. function applyToTag (style, obj) {
  43500. var css = obj.css;
  43501. var media = obj.media;
  43502. if(media) {
  43503. style.setAttribute("media", media)
  43504. }
  43505. if(style.styleSheet) {
  43506. style.styleSheet.cssText = css;
  43507. } else {
  43508. while(style.firstChild) {
  43509. style.removeChild(style.firstChild);
  43510. }
  43511. style.appendChild(document.createTextNode(css));
  43512. }
  43513. }
  43514. function updateLink (link, options, obj) {
  43515. var css = obj.css;
  43516. var sourceMap = obj.sourceMap;
  43517. /*
  43518. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  43519. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  43520. on by default. Otherwise default to the convertToAbsoluteUrls option
  43521. directly
  43522. */
  43523. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  43524. if (options.convertToAbsoluteUrls || autoFixUrls) {
  43525. css = fixUrls(css);
  43526. }
  43527. if (sourceMap) {
  43528. // http://stackoverflow.com/a/26603875
  43529. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  43530. }
  43531. var blob = new Blob([css], { type: "text/css" });
  43532. var oldSrc = link.href;
  43533. link.href = URL.createObjectURL(blob);
  43534. if(oldSrc) URL.revokeObjectURL(oldSrc);
  43535. }
  43536. /***/ }),
  43537. /***/ "./node_modules/style-loader/lib/urls.js":
  43538. /*!***********************************************!*\
  43539. !*** ./node_modules/style-loader/lib/urls.js ***!
  43540. \***********************************************/
  43541. /*! no static exports found */
  43542. /***/ (function(module, exports) {
  43543. /**
  43544. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  43545. * embed the css on the page. This breaks all relative urls because now they are relative to a
  43546. * bundle instead of the current page.
  43547. *
  43548. * One solution is to only use full urls, but that may be impossible.
  43549. *
  43550. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  43551. *
  43552. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  43553. *
  43554. */
  43555. module.exports = function (css) {
  43556. // get current location
  43557. var location = typeof window !== "undefined" && window.location;
  43558. if (!location) {
  43559. throw new Error("fixUrls requires window.location");
  43560. }
  43561. // blank or null?
  43562. if (!css || typeof css !== "string") {
  43563. return css;
  43564. }
  43565. var baseUrl = location.protocol + "//" + location.host;
  43566. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  43567. // convert each url(...)
  43568. /*
  43569. This regular expression is just a way to recursively match brackets within
  43570. a string.
  43571. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  43572. ( = Start a capturing group
  43573. (?: = Start a non-capturing group
  43574. [^)(] = Match anything that isn't a parentheses
  43575. | = OR
  43576. \( = Match a start parentheses
  43577. (?: = Start another non-capturing groups
  43578. [^)(]+ = Match anything that isn't a parentheses
  43579. | = OR
  43580. \( = Match a start parentheses
  43581. [^)(]* = Match anything that isn't a parentheses
  43582. \) = Match a end parentheses
  43583. ) = End Group
  43584. *\) = Match anything and then a close parens
  43585. ) = Close non-capturing group
  43586. * = Match anything
  43587. ) = Close capturing group
  43588. \) = Match a close parens
  43589. /gi = Get all matches, not the first. Be case insensitive.
  43590. */
  43591. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  43592. // strip quotes (if they exist)
  43593. var unquotedOrigUrl = origUrl
  43594. .trim()
  43595. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  43596. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  43597. // already a full url? no change
  43598. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  43599. return fullMatch;
  43600. }
  43601. // convert the url to a full url
  43602. var newUrl;
  43603. if (unquotedOrigUrl.indexOf("//") === 0) {
  43604. //TODO: should we add protocol?
  43605. newUrl = unquotedOrigUrl;
  43606. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  43607. // path should be relative to the base url
  43608. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  43609. } else {
  43610. // path should be relative to current directory
  43611. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  43612. }
  43613. // send back the fixed url(...)
  43614. return "url(" + JSON.stringify(newUrl) + ")";
  43615. });
  43616. // send back the fixed css
  43617. return fixedCss;
  43618. };
  43619. /***/ }),
  43620. /***/ "./node_modules/timers-browserify/main.js":
  43621. /*!************************************************!*\
  43622. !*** ./node_modules/timers-browserify/main.js ***!
  43623. \************************************************/
  43624. /*! no static exports found */
  43625. /***/ (function(module, exports, __webpack_require__) {
  43626. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43627. (typeof self !== "undefined" && self) ||
  43628. window;
  43629. var apply = Function.prototype.apply;
  43630. // DOM APIs, for completeness
  43631. exports.setTimeout = function() {
  43632. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43633. };
  43634. exports.setInterval = function() {
  43635. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43636. };
  43637. exports.clearTimeout =
  43638. exports.clearInterval = function(timeout) {
  43639. if (timeout) {
  43640. timeout.close();
  43641. }
  43642. };
  43643. function Timeout(id, clearFn) {
  43644. this._id = id;
  43645. this._clearFn = clearFn;
  43646. }
  43647. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43648. Timeout.prototype.close = function() {
  43649. this._clearFn.call(scope, this._id);
  43650. };
  43651. // Does not start the time, just sets up the members needed.
  43652. exports.enroll = function(item, msecs) {
  43653. clearTimeout(item._idleTimeoutId);
  43654. item._idleTimeout = msecs;
  43655. };
  43656. exports.unenroll = function(item) {
  43657. clearTimeout(item._idleTimeoutId);
  43658. item._idleTimeout = -1;
  43659. };
  43660. exports._unrefActive = exports.active = function(item) {
  43661. clearTimeout(item._idleTimeoutId);
  43662. var msecs = item._idleTimeout;
  43663. if (msecs >= 0) {
  43664. item._idleTimeoutId = setTimeout(function onTimeout() {
  43665. if (item._onTimeout)
  43666. item._onTimeout();
  43667. }, msecs);
  43668. }
  43669. };
  43670. // setimmediate attaches itself to the global object
  43671. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43672. // On some exotic environments, it's not clear which object `setimmediate` was
  43673. // able to install onto. Search each possibility in the same order as the
  43674. // `setimmediate` library.
  43675. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43676. (typeof global !== "undefined" && global.setImmediate) ||
  43677. (this && this.setImmediate);
  43678. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43679. (typeof global !== "undefined" && global.clearImmediate) ||
  43680. (this && this.clearImmediate);
  43681. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43682. /***/ }),
  43683. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  43684. /*!************************************************************************************************************************************************************************************************************!*\
  43685. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  43686. \************************************************************************************************************************************************************************************************************/
  43687. /*! exports provided: render, staticRenderFns */
  43688. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43689. "use strict";
  43690. __webpack_require__.r(__webpack_exports__);
  43691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43692. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43693. var render = function() {
  43694. var _vm = this
  43695. var _h = _vm.$createElement
  43696. var _c = _vm._self._c || _h
  43697. return _c(
  43698. "div",
  43699. [
  43700. _c("asset-info-edit-modal", {
  43701. attrs: {
  43702. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  43703. "populate-with": _vm.asset
  43704. }
  43705. }),
  43706. _vm._v(" "),
  43707. _c("h4", { staticClass: "text-center" }, [
  43708. _vm._v(
  43709. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  43710. ),
  43711. _c("small", { staticClass: "text-muted" }, [
  43712. _vm._v(_vm._s(this.asset.pcnickname))
  43713. ])
  43714. ]),
  43715. _vm._v(" "),
  43716. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  43717. _vm._v(" "),
  43718. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  43719. _vm._v(" "),
  43720. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  43721. _vm._v(" "),
  43722. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  43723. _vm._v(" "),
  43724. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  43725. _vm._v(" "),
  43726. _c(
  43727. "button",
  43728. {
  43729. staticClass: "btn btn-primary",
  43730. attrs: {
  43731. type: "button",
  43732. "data-toggle": "modal",
  43733. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  43734. }
  43735. },
  43736. [_vm._v("Edit")]
  43737. )
  43738. ],
  43739. 1
  43740. )
  43741. }
  43742. var staticRenderFns = []
  43743. render._withStripped = true
  43744. /***/ }),
  43745. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  43746. /*!*********************************************************************************************************************************************************************************************************************!*\
  43747. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  43748. \*********************************************************************************************************************************************************************************************************************/
  43749. /*! exports provided: render, staticRenderFns */
  43750. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43751. "use strict";
  43752. __webpack_require__.r(__webpack_exports__);
  43753. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43754. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43755. var render = function() {
  43756. var _vm = this
  43757. var _h = _vm.$createElement
  43758. var _c = _vm._self._c || _h
  43759. return _c(
  43760. "modal",
  43761. {
  43762. attrs: {
  43763. id: _vm.modalId,
  43764. tabindex: "-1",
  43765. role: "dialog",
  43766. "aria-labelledby": _vm.modalId + "Label"
  43767. }
  43768. },
  43769. [
  43770. _c(
  43771. "h5",
  43772. {
  43773. staticClass: "modal-title",
  43774. attrs: { slot: "header", id: _vm.modalId + "Label" },
  43775. slot: "header"
  43776. },
  43777. [_vm._v("\n Edit Work Order Information\n ")]
  43778. ),
  43779. _vm._v(" "),
  43780. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43781. _c("div", { staticClass: "form-group" }, [
  43782. _c("label", { attrs: { for: "manufacturer" } }, [
  43783. _vm._v("Manufacturer")
  43784. ]),
  43785. _vm._v(" "),
  43786. _c("input", {
  43787. directives: [
  43788. {
  43789. name: "model",
  43790. rawName: "v-model",
  43791. value: _vm.asset.pcmanu,
  43792. expression: "asset.pcmanu"
  43793. }
  43794. ],
  43795. staticClass: "form-control",
  43796. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  43797. domProps: { value: _vm.asset.pcmanu },
  43798. on: {
  43799. input: function($event) {
  43800. if ($event.target.composing) {
  43801. return
  43802. }
  43803. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  43804. }
  43805. }
  43806. })
  43807. ]),
  43808. _vm._v(" "),
  43809. _c("div", { staticClass: "form-group" }, [
  43810. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43811. _vm._v(" "),
  43812. _c("input", {
  43813. directives: [
  43814. {
  43815. name: "model",
  43816. rawName: "v-model",
  43817. value: _vm.asset.pcmake,
  43818. expression: "asset.pcmake"
  43819. }
  43820. ],
  43821. staticClass: "form-control",
  43822. attrs: { type: "text", name: "make", id: "make" },
  43823. domProps: { value: _vm.asset.pcmake },
  43824. on: {
  43825. input: function($event) {
  43826. if ($event.target.composing) {
  43827. return
  43828. }
  43829. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  43830. }
  43831. }
  43832. })
  43833. ]),
  43834. _vm._v(" "),
  43835. _c("div", { staticClass: "form-group" }, [
  43836. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43837. _vm._v(" "),
  43838. _c("input", {
  43839. directives: [
  43840. {
  43841. name: "model",
  43842. rawName: "v-model",
  43843. value: _vm.asset.pcnickname,
  43844. expression: "asset.pcnickname"
  43845. }
  43846. ],
  43847. staticClass: "form-control",
  43848. attrs: { type: "text", name: "nickname", id: "nickname" },
  43849. domProps: { value: _vm.asset.pcnickname },
  43850. on: {
  43851. input: function($event) {
  43852. if ($event.target.composing) {
  43853. return
  43854. }
  43855. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  43856. }
  43857. }
  43858. })
  43859. ]),
  43860. _vm._v(" "),
  43861. _c("div", { staticClass: "form-group" }, [
  43862. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43863. _vm._v(" "),
  43864. _c("input", {
  43865. directives: [
  43866. {
  43867. name: "model",
  43868. rawName: "v-model",
  43869. value: _vm.asset.pcextra[2],
  43870. expression: "asset.pcextra[2]"
  43871. }
  43872. ],
  43873. staticClass: "form-control",
  43874. attrs: { type: "text", name: "os", id: "os" },
  43875. domProps: { value: _vm.asset.pcextra[2] },
  43876. on: {
  43877. input: function($event) {
  43878. if ($event.target.composing) {
  43879. return
  43880. }
  43881. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  43882. }
  43883. }
  43884. })
  43885. ]),
  43886. _vm._v(" "),
  43887. _c("div", { staticClass: "form-group" }, [
  43888. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  43889. _vm._v(" "),
  43890. _c("input", {
  43891. directives: [
  43892. {
  43893. name: "model",
  43894. rawName: "v-model",
  43895. value: _vm.asset.pcextra[104],
  43896. expression: "asset.pcextra[104]"
  43897. }
  43898. ],
  43899. staticClass: "form-control",
  43900. attrs: { type: "text", id: "serial", name: "serial" },
  43901. domProps: { value: _vm.asset.pcextra[104] },
  43902. on: {
  43903. input: function($event) {
  43904. if ($event.target.composing) {
  43905. return
  43906. }
  43907. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  43908. }
  43909. }
  43910. })
  43911. ]),
  43912. _vm._v(" "),
  43913. _c("div", { staticClass: "form-group" }, [
  43914. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43915. _vm._v(" "),
  43916. _c("input", {
  43917. directives: [
  43918. {
  43919. name: "model",
  43920. rawName: "v-model",
  43921. value: _vm.asset.pcextra[101],
  43922. expression: "asset.pcextra[101]"
  43923. }
  43924. ],
  43925. staticClass: "form-control",
  43926. attrs: { type: "text", id: "cpu", name: "cpu" },
  43927. domProps: { value: _vm.asset.pcextra[101] },
  43928. on: {
  43929. input: function($event) {
  43930. if ($event.target.composing) {
  43931. return
  43932. }
  43933. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  43934. }
  43935. }
  43936. })
  43937. ]),
  43938. _vm._v(" "),
  43939. _c("div", { staticClass: "form-group" }, [
  43940. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43941. _vm._v(" "),
  43942. _c("input", {
  43943. directives: [
  43944. {
  43945. name: "model",
  43946. rawName: "v-model",
  43947. value: _vm.asset.pcextra[100],
  43948. expression: "asset.pcextra[100]"
  43949. }
  43950. ],
  43951. staticClass: "form-control",
  43952. attrs: { type: "text", name: "ram", id: "ram" },
  43953. domProps: { value: _vm.asset.pcextra[100] },
  43954. on: {
  43955. input: function($event) {
  43956. if ($event.target.composing) {
  43957. return
  43958. }
  43959. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  43960. }
  43961. }
  43962. })
  43963. ]),
  43964. _vm._v(" "),
  43965. _c("div", { staticClass: "form-group" }, [
  43966. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43967. _vm._v(" "),
  43968. _c("input", {
  43969. directives: [
  43970. {
  43971. name: "model",
  43972. rawName: "v-model",
  43973. value: _vm.asset.pcextra[4],
  43974. expression: "asset.pcextra[4]"
  43975. }
  43976. ],
  43977. staticClass: "form-control",
  43978. attrs: { type: "text", name: "graphics", id: "grapics" },
  43979. domProps: { value: _vm.asset.pcextra[4] },
  43980. on: {
  43981. input: function($event) {
  43982. if ($event.target.composing) {
  43983. return
  43984. }
  43985. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  43986. }
  43987. }
  43988. })
  43989. ])
  43990. ]),
  43991. _vm._v(" "),
  43992. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43993. _c(
  43994. "button",
  43995. {
  43996. staticClass: "btn btn-secondary",
  43997. attrs: { type: "button", "data-dismiss": "modal" }
  43998. },
  43999. [_vm._v("Close")]
  44000. ),
  44001. _vm._v(" "),
  44002. _c(
  44003. "button",
  44004. {
  44005. staticClass: "btn btn-primary",
  44006. attrs: { type: "button" },
  44007. on: {
  44008. click: function($event) {
  44009. return _vm.updateAsset()
  44010. }
  44011. }
  44012. },
  44013. [
  44014. !_vm.assetSaving
  44015. ? _c("div", [_vm._v("Save")])
  44016. : _c("circle-spinner", { attrs: { size: 2 } })
  44017. ],
  44018. 1
  44019. )
  44020. ])
  44021. ]
  44022. )
  44023. }
  44024. var staticRenderFns = []
  44025. render._withStripped = true
  44026. /***/ }),
  44027. /***/ "./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&":
  44028. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44029. !*** ./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& ***!
  44030. \*****************************************************************************************************************************************************************************************************************************/
  44031. /*! exports provided: render, staticRenderFns */
  44032. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44033. "use strict";
  44034. __webpack_require__.r(__webpack_exports__);
  44035. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44036. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44037. var render = function() {
  44038. var _vm = this
  44039. var _h = _vm.$createElement
  44040. var _c = _vm._self._c || _h
  44041. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44042. _c("div", { staticClass: "input-group" }, [
  44043. _c("input", {
  44044. directives: [
  44045. {
  44046. name: "model",
  44047. rawName: "v-model",
  44048. value: _vm.searchText,
  44049. expression: "searchText"
  44050. }
  44051. ],
  44052. staticClass: "form-control",
  44053. attrs: { type: "text" },
  44054. domProps: { value: _vm.searchText },
  44055. on: {
  44056. input: [
  44057. function($event) {
  44058. if ($event.target.composing) {
  44059. return
  44060. }
  44061. _vm.searchText = $event.target.value
  44062. },
  44063. _vm.searchChanged
  44064. ]
  44065. }
  44066. }),
  44067. _vm._v(" "),
  44068. _c("div", { staticClass: "form-group-append" }, [
  44069. _c(
  44070. "a",
  44071. {
  44072. staticClass: "toggle input-group-text bg-primary text-light",
  44073. on: {
  44074. mousedown: function($event) {
  44075. $event.preventDefault()
  44076. },
  44077. click: function($event) {
  44078. return _vm.setOpen(!_vm.open)
  44079. }
  44080. }
  44081. },
  44082. [
  44083. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44084. _vm._v(" "),
  44085. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44086. ]
  44087. )
  44088. ])
  44089. ]),
  44090. _vm._v(" "),
  44091. _c(
  44092. "ul",
  44093. { staticClass: "suggestion-list list-unstyled" },
  44094. _vm._l(_vm.matches, function(suggestion, index) {
  44095. return _c(
  44096. "li",
  44097. {
  44098. key: index,
  44099. on: {
  44100. mousedown: function($event) {
  44101. $event.preventDefault()
  44102. },
  44103. click: function($event) {
  44104. return _vm.suggestionSelected(suggestion)
  44105. }
  44106. }
  44107. },
  44108. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44109. )
  44110. }),
  44111. 0
  44112. )
  44113. ])
  44114. }
  44115. var staticRenderFns = []
  44116. render._withStripped = true
  44117. /***/ }),
  44118. /***/ "./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&":
  44119. /*!****************************************************************************************************************************************************************************************************************************!*\
  44120. !*** ./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& ***!
  44121. \****************************************************************************************************************************************************************************************************************************/
  44122. /*! exports provided: render, staticRenderFns */
  44123. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44124. "use strict";
  44125. __webpack_require__.r(__webpack_exports__);
  44126. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44127. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44128. var render = function() {
  44129. var _vm = this
  44130. var _h = _vm.$createElement
  44131. var _c = _vm._self._c || _h
  44132. return _c(
  44133. "div",
  44134. {
  44135. staticClass: "loader",
  44136. style: {
  44137. fontSize: _vm.size + "px",
  44138. borderLeft: "1.1em solid " + _vm.color
  44139. }
  44140. },
  44141. [_vm._v("Loading...")]
  44142. )
  44143. }
  44144. var staticRenderFns = []
  44145. render._withStripped = true
  44146. /***/ }),
  44147. /***/ "./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&":
  44148. /*!********************************************************************************************************************************************************************************************************!*\
  44149. !*** ./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& ***!
  44150. \********************************************************************************************************************************************************************************************************/
  44151. /*! exports provided: render, staticRenderFns */
  44152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44153. "use strict";
  44154. __webpack_require__.r(__webpack_exports__);
  44155. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44156. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44157. var render = function() {
  44158. var _vm = this
  44159. var _h = _vm.$createElement
  44160. var _c = _vm._self._c || _h
  44161. return _c("div", { staticClass: "modal fade" }, [
  44162. _c(
  44163. "div",
  44164. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44165. [
  44166. _c("div", { staticClass: "modal-content" }, [
  44167. _c(
  44168. "div",
  44169. { staticClass: "modal-header" },
  44170. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44171. 2
  44172. ),
  44173. _vm._v(" "),
  44174. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44175. _vm._v(" "),
  44176. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44177. ])
  44178. ]
  44179. )
  44180. ])
  44181. }
  44182. var staticRenderFns = [
  44183. function() {
  44184. var _vm = this
  44185. var _h = _vm.$createElement
  44186. var _c = _vm._self._c || _h
  44187. return _c(
  44188. "button",
  44189. {
  44190. staticClass: "close",
  44191. attrs: {
  44192. type: "button",
  44193. "data-dismiss": "modal",
  44194. "aria-label": "Close"
  44195. }
  44196. },
  44197. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44198. )
  44199. }
  44200. ]
  44201. render._withStripped = true
  44202. /***/ }),
  44203. /***/ "./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&":
  44204. /*!******************************************************************************************************************************************************************************************************************!*\
  44205. !*** ./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& ***!
  44206. \******************************************************************************************************************************************************************************************************************/
  44207. /*! exports provided: render, staticRenderFns */
  44208. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44209. "use strict";
  44210. __webpack_require__.r(__webpack_exports__);
  44211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44212. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44213. var render = function() {
  44214. var _vm = this
  44215. var _h = _vm.$createElement
  44216. var _c = _vm._self._c || _h
  44217. return _c(
  44218. "modal",
  44219. {
  44220. attrs: {
  44221. id: _vm.id,
  44222. tabindex: "-1",
  44223. role: "dialog",
  44224. "aria-labelledby": _vm.id + "Label"
  44225. }
  44226. },
  44227. [
  44228. _c(
  44229. "h5",
  44230. {
  44231. staticClass: "modal-title",
  44232. attrs: { slot: "header", id: _vm.id + "Label" },
  44233. slot: "header"
  44234. },
  44235. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44236. ),
  44237. _vm._v(" "),
  44238. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44239. _c(
  44240. "div",
  44241. { staticClass: "form-group" },
  44242. [
  44243. _c("label", { attrs: { for: "probdesc" } }, [
  44244. _vm._v("Problem Description")
  44245. ]),
  44246. _vm._v(" "),
  44247. _c("textarea", {
  44248. directives: [
  44249. {
  44250. name: "model",
  44251. rawName: "v-model",
  44252. value: _vm.data.probdesc,
  44253. expression: "data.probdesc"
  44254. }
  44255. ],
  44256. class: {
  44257. "form-control": true,
  44258. "is-invalid": _vm.errors.probdesc
  44259. },
  44260. attrs: { id: "probdesc", name: "probdesc" },
  44261. domProps: { value: _vm.data.probdesc },
  44262. on: {
  44263. input: function($event) {
  44264. if ($event.target.composing) {
  44265. return
  44266. }
  44267. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44268. }
  44269. }
  44270. }),
  44271. _vm._v(" "),
  44272. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44273. ],
  44274. 1
  44275. ),
  44276. _vm._v(" "),
  44277. _c(
  44278. "div",
  44279. { staticClass: "form-group" },
  44280. [
  44281. _c("label", { attrs: { for: "suggested" } }, [
  44282. _vm._v("Suggested Solution")
  44283. ]),
  44284. _vm._v(" "),
  44285. _c("textarea", {
  44286. directives: [
  44287. {
  44288. name: "model",
  44289. rawName: "v-model",
  44290. value: _vm.data.suggested,
  44291. expression: "data.suggested"
  44292. }
  44293. ],
  44294. class: {
  44295. "form-control": true,
  44296. "is-invalid": _vm.errors.suggested
  44297. },
  44298. attrs: { id: "suggested", name: "suggested" },
  44299. domProps: { value: _vm.data.suggested },
  44300. on: {
  44301. input: function($event) {
  44302. if ($event.target.composing) {
  44303. return
  44304. }
  44305. _vm.$set(_vm.data, "suggested", $event.target.value)
  44306. }
  44307. }
  44308. }),
  44309. _vm._v(" "),
  44310. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44311. ],
  44312. 1
  44313. ),
  44314. _vm._v(" "),
  44315. _c(
  44316. "div",
  44317. { staticClass: "form-group" },
  44318. [
  44319. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44320. _vm._v(" "),
  44321. _c("autocomplete-custom-dropdown", {
  44322. attrs: { options: _vm.storeList, value: this.store },
  44323. model: {
  44324. value: _vm.store,
  44325. callback: function($$v) {
  44326. _vm.store = $$v
  44327. },
  44328. expression: "store"
  44329. }
  44330. })
  44331. ],
  44332. 1
  44333. )
  44334. ]),
  44335. _vm._v(" "),
  44336. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44337. _c(
  44338. "button",
  44339. {
  44340. staticClass: "btn btn-secondary",
  44341. attrs: { type: "button", "data-dismiss": "modal" }
  44342. },
  44343. [_vm._v("Close")]
  44344. ),
  44345. _vm._v(" "),
  44346. _c(
  44347. "button",
  44348. {
  44349. staticClass: "btn btn-primary",
  44350. attrs: { type: "button" },
  44351. on: {
  44352. click: function($event) {
  44353. return _vm.updateWorkOrder()
  44354. }
  44355. }
  44356. },
  44357. [_vm._v("Save")]
  44358. )
  44359. ])
  44360. ]
  44361. )
  44362. }
  44363. var staticRenderFns = []
  44364. render._withStripped = true
  44365. /***/ }),
  44366. /***/ "./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&":
  44367. /*!****************************************************************************************************************************************************************************************************************!*\
  44368. !*** ./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& ***!
  44369. \****************************************************************************************************************************************************************************************************************/
  44370. /*! exports provided: render, staticRenderFns */
  44371. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44372. "use strict";
  44373. __webpack_require__.r(__webpack_exports__);
  44374. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44375. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44376. var render = function() {
  44377. var _vm = this
  44378. var _h = _vm.$createElement
  44379. var _c = _vm._self._c || _h
  44380. return _c(
  44381. "div",
  44382. [
  44383. _c("wo-info-edit-modal", {
  44384. attrs: {
  44385. "modal-id": "workordereditModal",
  44386. "populate-with": _vm.workOrder,
  44387. "store-list": this.storeList
  44388. }
  44389. }),
  44390. _vm._v(" "),
  44391. _c("p", [
  44392. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44393. _vm._v(" "),
  44394. _c("span", {
  44395. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  44396. })
  44397. ]),
  44398. _vm._v(" "),
  44399. _c("p", [
  44400. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44401. _vm._v(" "),
  44402. _c("span", {
  44403. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  44404. })
  44405. ]),
  44406. _vm._v(" "),
  44407. _c("p", [
  44408. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44409. _vm._v(" "),
  44410. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  44411. ]),
  44412. _vm._v(" "),
  44413. _c("p", [
  44414. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44415. _vm._v(" "),
  44416. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  44417. ]),
  44418. _vm._v(" "),
  44419. _c("p", [
  44420. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44421. _vm._v(" "),
  44422. _c(
  44423. "span",
  44424. {
  44425. staticClass: "dashed-underline",
  44426. attrs: {
  44427. "data-toggle": "tooltip",
  44428. "data-placement": "bottom",
  44429. title: this.getHRDate(_vm.workOrder.dropdate)
  44430. }
  44431. },
  44432. [
  44433. _vm._v(
  44434. "\n " +
  44435. _vm._s(
  44436. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  44437. ) +
  44438. " days ago\n "
  44439. )
  44440. ]
  44441. )
  44442. ]),
  44443. _vm._v(" "),
  44444. _c("p", [
  44445. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44446. _vm._v(" "),
  44447. !this.isZero(_vm.workOrder.pickupdate)
  44448. ? _c(
  44449. "span",
  44450. {
  44451. staticClass: "dashed-underline",
  44452. attrs: {
  44453. "data-toggle": "tooltip",
  44454. "data-placement": "bottom",
  44455. title: this.getHRDate(_vm.workOrder.pickupdate)
  44456. }
  44457. },
  44458. [
  44459. _vm._v(
  44460. "\n " +
  44461. _vm._s(
  44462. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  44463. ) +
  44464. " days ago\n "
  44465. )
  44466. ]
  44467. )
  44468. : _vm._e()
  44469. ]),
  44470. _vm._v(" "),
  44471. _c(
  44472. "button",
  44473. {
  44474. staticClass: "btn btn-primary",
  44475. attrs: {
  44476. type: "button",
  44477. "data-toggle": "modal",
  44478. "data-target": "#workordereditModal"
  44479. }
  44480. },
  44481. [_vm._v("Edit")]
  44482. )
  44483. ],
  44484. 1
  44485. )
  44486. }
  44487. var staticRenderFns = []
  44488. render._withStripped = true
  44489. /***/ }),
  44490. /***/ "./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&":
  44491. /*!*************************************************************************************************************************************************************************************************!*\
  44492. !*** ./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& ***!
  44493. \*************************************************************************************************************************************************************************************************/
  44494. /*! exports provided: render, staticRenderFns */
  44495. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44496. "use strict";
  44497. __webpack_require__.r(__webpack_exports__);
  44498. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44499. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44500. var render = function() {
  44501. var _vm = this
  44502. var _h = _vm.$createElement
  44503. var _c = _vm._self._c || _h
  44504. return _c("div", [
  44505. _c(
  44506. "nav",
  44507. {
  44508. staticClass:
  44509. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  44510. },
  44511. [
  44512. _c(
  44513. "div",
  44514. { staticClass: "container-fluid" },
  44515. [
  44516. _c(
  44517. "router-link",
  44518. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  44519. [_vm._v("\n UPCCRT\n ")]
  44520. ),
  44521. _vm._v(" "),
  44522. _vm._m(0),
  44523. _vm._v(" "),
  44524. _c(
  44525. "div",
  44526. {
  44527. staticClass: "collapse navbar-collapse",
  44528. attrs: { id: "navbarSupportedContent" }
  44529. },
  44530. [
  44531. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  44532. _vm._m(1),
  44533. _vm._v(" "),
  44534. _vm._m(2),
  44535. _vm._v(" "),
  44536. _c(
  44537. "li",
  44538. { staticClass: "nav-item" },
  44539. [
  44540. _c(
  44541. "router-link",
  44542. {
  44543. staticClass: "nav-link",
  44544. attrs: { to: { name: "dashboard" } }
  44545. },
  44546. [
  44547. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  44548. _vm._v(" "),
  44549. _c(
  44550. "span",
  44551. { staticClass: "d-none d-sm-block d-md-inline" },
  44552. [_vm._v("Dashboard")]
  44553. )
  44554. ]
  44555. )
  44556. ],
  44557. 1
  44558. ),
  44559. _vm._v(" "),
  44560. _vm._m(3)
  44561. ]),
  44562. _vm._v(" "),
  44563. _c(
  44564. "ul",
  44565. { staticClass: "navbar-nav ml-auto" },
  44566. [
  44567. !_vm.isLoggedIn
  44568. ? _c(
  44569. "router-link",
  44570. {
  44571. staticClass: "nav-link",
  44572. attrs: { to: { name: "login" } }
  44573. },
  44574. [_vm._v("Login")]
  44575. )
  44576. : _vm._e(),
  44577. _vm._v(" "),
  44578. _vm.isLoggedIn
  44579. ? _c("li", { staticClass: "nav-link" }, [
  44580. _vm._v(_vm._s(_vm.username))
  44581. ])
  44582. : _vm._e(),
  44583. _vm._v(" "),
  44584. _vm.isLoggedIn
  44585. ? _c(
  44586. "router-link",
  44587. {
  44588. staticClass: "nav-link",
  44589. attrs: { to: { name: "home" } }
  44590. },
  44591. [_vm._v("Home")]
  44592. )
  44593. : _vm._e()
  44594. ],
  44595. 1
  44596. )
  44597. ]
  44598. )
  44599. ],
  44600. 1
  44601. )
  44602. ]
  44603. ),
  44604. _vm._v(" "),
  44605. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  44606. ])
  44607. }
  44608. var staticRenderFns = [
  44609. function() {
  44610. var _vm = this
  44611. var _h = _vm.$createElement
  44612. var _c = _vm._self._c || _h
  44613. return _c(
  44614. "button",
  44615. {
  44616. staticClass: "navbar-toggler",
  44617. attrs: {
  44618. type: "button",
  44619. "data-toggle": "collapse",
  44620. "data-target": "#navbarSupportedContent",
  44621. "aria-controls": "navbarSupportedContent",
  44622. "aria-expanded": "false"
  44623. }
  44624. },
  44625. [_c("span", { staticClass: "navbar-toggler-icon" })]
  44626. )
  44627. },
  44628. function() {
  44629. var _vm = this
  44630. var _h = _vm.$createElement
  44631. var _c = _vm._self._c || _h
  44632. return _c("li", { staticClass: "nav-item" }, [
  44633. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44634. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  44635. _vm._v(" "),
  44636. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44637. _vm._v("Check-In")
  44638. ])
  44639. ])
  44640. ])
  44641. },
  44642. function() {
  44643. var _vm = this
  44644. var _h = _vm.$createElement
  44645. var _c = _vm._self._c || _h
  44646. return _c("li", { staticClass: "nav-item" }, [
  44647. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44648. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44649. _vm._v(" "),
  44650. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44651. _vm._v("Check-Out")
  44652. ])
  44653. ])
  44654. ])
  44655. },
  44656. function() {
  44657. var _vm = this
  44658. var _h = _vm.$createElement
  44659. var _c = _vm._self._c || _h
  44660. return _c("li", { staticClass: "nav-item" }, [
  44661. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  44662. _c("i", { staticClass: "fas fa-chart-bar" }),
  44663. _vm._v(" "),
  44664. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  44665. _vm._v("Reports")
  44666. ])
  44667. ])
  44668. ])
  44669. }
  44670. ]
  44671. render._withStripped = true
  44672. /***/ }),
  44673. /***/ "./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&":
  44674. /*!*******************************************************************************************************************************************************************************************************!*\
  44675. !*** ./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& ***!
  44676. \*******************************************************************************************************************************************************************************************************/
  44677. /*! exports provided: render, staticRenderFns */
  44678. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44679. "use strict";
  44680. __webpack_require__.r(__webpack_exports__);
  44681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44682. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44683. var render = function() {
  44684. var _vm = this
  44685. var _h = _vm.$createElement
  44686. var _c = _vm._self._c || _h
  44687. return _c("div", { staticClass: "container" }, [
  44688. _c("div", { staticClass: "row justify-content-center" }, [
  44689. _c(
  44690. "div",
  44691. { staticClass: "col-md-12" },
  44692. _vm._l(_vm.workOrders, function(workOrder, index) {
  44693. return _c("div", { key: workOrder.woid, staticClass: "col-md-4" }, [
  44694. _c("div", { staticClass: "card" }, [
  44695. _c(
  44696. "div",
  44697. { staticClass: "card-header" },
  44698. [
  44699. _c(
  44700. "router-link",
  44701. {
  44702. staticClass: "h4 card-title",
  44703. attrs: {
  44704. to: {
  44705. name: "workorders",
  44706. params: { id: workOrder.woid }
  44707. }
  44708. }
  44709. },
  44710. [_vm._v(_vm._s(workOrder.woid))]
  44711. )
  44712. ],
  44713. 1
  44714. ),
  44715. _vm._v(" "),
  44716. _c("div", { staticClass: "card-body card-body-dark" }, [
  44717. _c("div", [
  44718. _vm._v(
  44719. "\n " +
  44720. _vm._s(workOrder.probdesc) +
  44721. "\n "
  44722. )
  44723. ]),
  44724. _vm._v(" "),
  44725. _c("div", [
  44726. _vm._v(
  44727. "\n " +
  44728. _vm._s(workOrder.suggested) +
  44729. "\n "
  44730. )
  44731. ])
  44732. ])
  44733. ])
  44734. ])
  44735. }),
  44736. 0
  44737. )
  44738. ])
  44739. ])
  44740. }
  44741. var staticRenderFns = []
  44742. render._withStripped = true
  44743. /***/ }),
  44744. /***/ "./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&":
  44745. /*!***************************************************************************************************************************************************************************************************!*\
  44746. !*** ./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& ***!
  44747. \***************************************************************************************************************************************************************************************************/
  44748. /*! exports provided: render, staticRenderFns */
  44749. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44750. "use strict";
  44751. __webpack_require__.r(__webpack_exports__);
  44752. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44753. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44754. var render = function() {
  44755. var _vm = this
  44756. var _h = _vm.$createElement
  44757. var _c = _vm._self._c || _h
  44758. return _c("div", { staticClass: "container" }, [
  44759. _c("div", { staticClass: "row justify-content-center" }, [
  44760. _c("div", { staticClass: "col-md-8" }, [
  44761. _c("div", { staticClass: "card card-default" }, [
  44762. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  44763. _vm._v(" "),
  44764. _c("div", { staticClass: "card-body" }, [
  44765. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  44766. _c("div", { staticClass: "form-group row" }, [
  44767. _c(
  44768. "label",
  44769. {
  44770. staticClass: "col-sm-4 col-form-label text-md-right",
  44771. attrs: { for: "username" }
  44772. },
  44773. [_vm._v("Username")]
  44774. ),
  44775. _vm._v(" "),
  44776. _c("div", { staticClass: "col-md-6" }, [
  44777. _c("input", {
  44778. directives: [
  44779. {
  44780. name: "model",
  44781. rawName: "v-model",
  44782. value: _vm.username,
  44783. expression: "username"
  44784. }
  44785. ],
  44786. staticClass: "form-control",
  44787. attrs: {
  44788. id: "username",
  44789. type: "username",
  44790. required: "",
  44791. autofocus: ""
  44792. },
  44793. domProps: { value: _vm.username },
  44794. on: {
  44795. input: function($event) {
  44796. if ($event.target.composing) {
  44797. return
  44798. }
  44799. _vm.username = $event.target.value
  44800. }
  44801. }
  44802. })
  44803. ])
  44804. ]),
  44805. _vm._v(" "),
  44806. _c("div", { staticClass: "form-group row" }, [
  44807. _c(
  44808. "label",
  44809. {
  44810. staticClass: "col-md-4 col-form-label text-md-right",
  44811. attrs: { for: "password" }
  44812. },
  44813. [_vm._v("Password")]
  44814. ),
  44815. _vm._v(" "),
  44816. _c("div", { staticClass: "col-md-6" }, [
  44817. _c("input", {
  44818. directives: [
  44819. {
  44820. name: "model",
  44821. rawName: "v-model",
  44822. value: _vm.password,
  44823. expression: "password"
  44824. }
  44825. ],
  44826. staticClass: "form-control",
  44827. attrs: { id: "password", type: "password", required: "" },
  44828. domProps: { value: _vm.password },
  44829. on: {
  44830. input: function($event) {
  44831. if ($event.target.composing) {
  44832. return
  44833. }
  44834. _vm.password = $event.target.value
  44835. }
  44836. }
  44837. })
  44838. ])
  44839. ]),
  44840. _vm._v(" "),
  44841. _c("div", { staticClass: "form-group row mb-0" }, [
  44842. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  44843. _c(
  44844. "button",
  44845. {
  44846. staticClass: "btn btn-primary",
  44847. attrs: { type: "submit" },
  44848. on: { click: _vm.handleSubmit }
  44849. },
  44850. [
  44851. _vm._v(
  44852. "\n Login\n "
  44853. )
  44854. ]
  44855. )
  44856. ])
  44857. ])
  44858. ])
  44859. ])
  44860. ])
  44861. ])
  44862. ])
  44863. ])
  44864. }
  44865. var staticRenderFns = []
  44866. render._withStripped = true
  44867. /***/ }),
  44868. /***/ "./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&":
  44869. /*!*****************************************************************************************************************************************************************************************************************!*\
  44870. !*** ./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& ***!
  44871. \*****************************************************************************************************************************************************************************************************************/
  44872. /*! exports provided: render, staticRenderFns */
  44873. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44874. "use strict";
  44875. __webpack_require__.r(__webpack_exports__);
  44876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44878. var render = function() {
  44879. var _vm = this
  44880. var _h = _vm.$createElement
  44881. var _c = _vm._self._c || _h
  44882. return _vm._m(0)
  44883. }
  44884. var staticRenderFns = [
  44885. function() {
  44886. var _vm = this
  44887. var _h = _vm.$createElement
  44888. var _c = _vm._self._c || _h
  44889. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  44890. _c("div", { staticClass: "content" }, [
  44891. _c("div", { staticClass: "m-b-md" }, [
  44892. _c("h2", { staticClass: "title m-b-md" }, [
  44893. _vm._v("\n UPCCRT\n ")
  44894. ]),
  44895. _vm._v(" "),
  44896. _c("h3", [
  44897. _vm._v(
  44898. "\n University PC Care Repair Tracker\n "
  44899. )
  44900. ])
  44901. ])
  44902. ])
  44903. ])
  44904. }
  44905. ]
  44906. render._withStripped = true
  44907. /***/ }),
  44908. /***/ "./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&":
  44909. /*!*******************************************************************************************************************************************************************************************************!*\
  44910. !*** ./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& ***!
  44911. \*******************************************************************************************************************************************************************************************************/
  44912. /*! exports provided: render, staticRenderFns */
  44913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44914. "use strict";
  44915. __webpack_require__.r(__webpack_exports__);
  44916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44918. var render = function() {
  44919. var _vm = this
  44920. var _h = _vm.$createElement
  44921. var _c = _vm._self._c || _h
  44922. return _c("div", { staticClass: "container-fluid" }, [
  44923. _c("div", { staticClass: "row my-3" }, [
  44924. _c("div", { staticClass: "col-lg-6" }, [
  44925. _c("div", { staticClass: "card h-100" }, [
  44926. _vm._m(0),
  44927. _vm._v(" "),
  44928. _c("div", { staticClass: "card-body" }, [
  44929. _c("div", { staticClass: "tab-content" }, [
  44930. _c(
  44931. "div",
  44932. {
  44933. staticClass: "tab-pane active",
  44934. attrs: {
  44935. id: "assetinfo",
  44936. role: "tabpanel",
  44937. "aria-labelledby": "assetinfo-tab"
  44938. }
  44939. },
  44940. [
  44941. !_vm.assetLoading
  44942. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  44943. : _c("circle-spinner", { attrs: { color: "#663399" } })
  44944. ],
  44945. 1
  44946. )
  44947. ])
  44948. ])
  44949. ])
  44950. ]),
  44951. _vm._v(" "),
  44952. _c("div", { staticClass: "col-lg-6" }, [
  44953. _c("div", { staticClass: "card h-100" }, [
  44954. _vm._m(1),
  44955. _vm._v(" "),
  44956. _c("div", { staticClass: "card-body" }, [
  44957. _c("div", { staticClass: "tab-content" }, [
  44958. _c(
  44959. "div",
  44960. {
  44961. staticClass: "tab-pane active",
  44962. attrs: {
  44963. id: "workordersumm",
  44964. role: "tabpanel",
  44965. "aria-labelledby": "workordersumm-tab"
  44966. }
  44967. },
  44968. [
  44969. !_vm.woLoading && !_vm.storesLoading
  44970. ? _c("work-order-info", {
  44971. attrs: {
  44972. "work-order": _vm.workOrder,
  44973. stores: _vm.stores
  44974. }
  44975. })
  44976. : _c("circle-spinner", { attrs: { color: "#663399" } })
  44977. ],
  44978. 1
  44979. ),
  44980. _vm._v(" "),
  44981. _c(
  44982. "div",
  44983. {
  44984. staticClass: "tab-pane",
  44985. attrs: {
  44986. id: "attachments",
  44987. role: "tabpanel",
  44988. "aria-labelledby": "attachments-tab"
  44989. }
  44990. },
  44991. [
  44992. _vm._v(
  44993. "\n TODO 2\n "
  44994. )
  44995. ]
  44996. )
  44997. ])
  44998. ])
  44999. ])
  45000. ])
  45001. ])
  45002. ])
  45003. }
  45004. var staticRenderFns = [
  45005. function() {
  45006. var _vm = this
  45007. var _h = _vm.$createElement
  45008. var _c = _vm._self._c || _h
  45009. return _c("div", { staticClass: "card-header text-right" }, [
  45010. _c(
  45011. "button",
  45012. {
  45013. staticClass: "btn btn-default xs-toggle",
  45014. attrs: {
  45015. type: "button",
  45016. "data-toggle": "collapse",
  45017. "data-target": "#assetTab"
  45018. }
  45019. },
  45020. [
  45021. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45022. _vm._v(" "),
  45023. _c("span", { staticClass: "icon-bar" }),
  45024. _vm._v(" "),
  45025. _c("span", { staticClass: "icon-bar" }),
  45026. _vm._v(" "),
  45027. _c("span", { staticClass: "icon-bar" })
  45028. ]
  45029. ),
  45030. _vm._v(" "),
  45031. _c(
  45032. "ul",
  45033. {
  45034. staticClass:
  45035. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45036. attrs: { id: "assetTab", role: "tablist" }
  45037. },
  45038. [
  45039. _c("li", { staticClass: "nav-item" }, [
  45040. _c(
  45041. "a",
  45042. {
  45043. staticClass: "nav-link active",
  45044. attrs: {
  45045. id: "assetinfo-tab",
  45046. "data-toggle": "pill",
  45047. href: "#assetinfo",
  45048. role: "tab",
  45049. "aria-controls": "assetinfo",
  45050. "aria-selected": "true"
  45051. }
  45052. },
  45053. [_vm._v("Hardware")]
  45054. )
  45055. ]),
  45056. _vm._v(" "),
  45057. _c("li", { staticClass: "nav-item" }, [
  45058. _c(
  45059. "a",
  45060. {
  45061. staticClass: "nav-link",
  45062. attrs: {
  45063. id: "credentials-tab",
  45064. "data-toggle": "pill",
  45065. href: "#credentials",
  45066. role: "tab",
  45067. "aria-controls": "credentials",
  45068. "aria-selected": "false"
  45069. }
  45070. },
  45071. [_vm._v("Credentials")]
  45072. )
  45073. ])
  45074. ]
  45075. )
  45076. ])
  45077. },
  45078. function() {
  45079. var _vm = this
  45080. var _h = _vm.$createElement
  45081. var _c = _vm._self._c || _h
  45082. return _c("div", { staticClass: "card-header text-right" }, [
  45083. _c(
  45084. "button",
  45085. {
  45086. staticClass: "btn btn-default xs-toggle",
  45087. attrs: {
  45088. type: "button",
  45089. "data-toggle": "collapse",
  45090. "data-target": "#workorderTab"
  45091. }
  45092. },
  45093. [
  45094. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  45095. _vm._v(" "),
  45096. _c("span", { staticClass: "icon-bar" }),
  45097. _vm._v(" "),
  45098. _c("span", { staticClass: "icon-bar" }),
  45099. _vm._v(" "),
  45100. _c("span", { staticClass: "icon-bar" })
  45101. ]
  45102. ),
  45103. _vm._v(" "),
  45104. _c(
  45105. "ul",
  45106. {
  45107. staticClass:
  45108. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  45109. attrs: { id: "workorderTab", role: "tablist" }
  45110. },
  45111. [
  45112. _c("li", { staticClass: "nav-item" }, [
  45113. _c(
  45114. "a",
  45115. {
  45116. staticClass: "nav-link active",
  45117. attrs: {
  45118. id: "workordersumm-tab",
  45119. "data-toggle": "pill",
  45120. href: "#workordersumm",
  45121. role: "tab",
  45122. "aria-controls": "workordersumm",
  45123. "aria-selected": "true"
  45124. }
  45125. },
  45126. [_vm._v("Summary")]
  45127. )
  45128. ]),
  45129. _vm._v(" "),
  45130. _c("li", { staticClass: "nav-item" }, [
  45131. _c(
  45132. "a",
  45133. {
  45134. staticClass: "nav-link",
  45135. attrs: {
  45136. id: "attachments-tab",
  45137. "data-toggle": "pill",
  45138. href: "#attachments",
  45139. role: "tab",
  45140. "aria-controls": "attachments",
  45141. "aria-selected": "false"
  45142. }
  45143. },
  45144. [_vm._v("Attachments")]
  45145. )
  45146. ])
  45147. ]
  45148. )
  45149. ])
  45150. }
  45151. ]
  45152. render._withStripped = true
  45153. /***/ }),
  45154. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  45155. /*!********************************************************************!*\
  45156. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  45157. \********************************************************************/
  45158. /*! exports provided: default */
  45159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45160. "use strict";
  45161. __webpack_require__.r(__webpack_exports__);
  45162. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  45163. /* globals __VUE_SSR_CONTEXT__ */
  45164. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  45165. // This module is a runtime utility for cleaner component module output and will
  45166. // be included in the final webpack user bundle.
  45167. function normalizeComponent (
  45168. scriptExports,
  45169. render,
  45170. staticRenderFns,
  45171. functionalTemplate,
  45172. injectStyles,
  45173. scopeId,
  45174. moduleIdentifier, /* server only */
  45175. shadowMode /* vue-cli only */
  45176. ) {
  45177. // Vue.extend constructor export interop
  45178. var options = typeof scriptExports === 'function'
  45179. ? scriptExports.options
  45180. : scriptExports
  45181. // render functions
  45182. if (render) {
  45183. options.render = render
  45184. options.staticRenderFns = staticRenderFns
  45185. options._compiled = true
  45186. }
  45187. // functional template
  45188. if (functionalTemplate) {
  45189. options.functional = true
  45190. }
  45191. // scopedId
  45192. if (scopeId) {
  45193. options._scopeId = 'data-v-' + scopeId
  45194. }
  45195. var hook
  45196. if (moduleIdentifier) { // server build
  45197. hook = function (context) {
  45198. // 2.3 injection
  45199. context =
  45200. context || // cached call
  45201. (this.$vnode && this.$vnode.ssrContext) || // stateful
  45202. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  45203. // 2.2 with runInNewContext: true
  45204. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  45205. context = __VUE_SSR_CONTEXT__
  45206. }
  45207. // inject component styles
  45208. if (injectStyles) {
  45209. injectStyles.call(this, context)
  45210. }
  45211. // register component module identifier for async chunk inferrence
  45212. if (context && context._registeredComponents) {
  45213. context._registeredComponents.add(moduleIdentifier)
  45214. }
  45215. }
  45216. // used by ssr in case component is cached and beforeCreate
  45217. // never gets called
  45218. options._ssrRegister = hook
  45219. } else if (injectStyles) {
  45220. hook = shadowMode
  45221. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  45222. : injectStyles
  45223. }
  45224. if (hook) {
  45225. if (options.functional) {
  45226. // for template-only hot-reload because in that case the render fn doesn't
  45227. // go through the normalizer
  45228. options._injectStyles = hook
  45229. // register for functioal component in vue file
  45230. var originalRender = options.render
  45231. options.render = function renderWithStyleInjection (h, context) {
  45232. hook.call(context)
  45233. return originalRender(h, context)
  45234. }
  45235. } else {
  45236. // inject component registration as beforeCreate hook
  45237. var existing = options.beforeCreate
  45238. options.beforeCreate = existing
  45239. ? [].concat(existing, hook)
  45240. : [hook]
  45241. }
  45242. }
  45243. return {
  45244. exports: scriptExports,
  45245. options: options
  45246. }
  45247. }
  45248. /***/ }),
  45249. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  45250. /*!********************************************************!*\
  45251. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  45252. \********************************************************/
  45253. /*! exports provided: default */
  45254. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45255. "use strict";
  45256. __webpack_require__.r(__webpack_exports__);
  45257. /*!
  45258. * vue-router v3.1.6
  45259. * (c) 2020 Evan You
  45260. * @license MIT
  45261. */
  45262. /* */
  45263. function assert (condition, message) {
  45264. if (!condition) {
  45265. throw new Error(("[vue-router] " + message))
  45266. }
  45267. }
  45268. function warn (condition, message) {
  45269. if ( true && !condition) {
  45270. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  45271. }
  45272. }
  45273. function isError (err) {
  45274. return Object.prototype.toString.call(err).indexOf('Error') > -1
  45275. }
  45276. function isExtendedError (constructor, err) {
  45277. return (
  45278. err instanceof constructor ||
  45279. // _name is to support IE9 too
  45280. (err && (err.name === constructor.name || err._name === constructor._name))
  45281. )
  45282. }
  45283. function extend (a, b) {
  45284. for (var key in b) {
  45285. a[key] = b[key];
  45286. }
  45287. return a
  45288. }
  45289. var View = {
  45290. name: 'RouterView',
  45291. functional: true,
  45292. props: {
  45293. name: {
  45294. type: String,
  45295. default: 'default'
  45296. }
  45297. },
  45298. render: function render (_, ref) {
  45299. var props = ref.props;
  45300. var children = ref.children;
  45301. var parent = ref.parent;
  45302. var data = ref.data;
  45303. // used by devtools to display a router-view badge
  45304. data.routerView = true;
  45305. // directly use parent context's createElement() function
  45306. // so that components rendered by router-view can resolve named slots
  45307. var h = parent.$createElement;
  45308. var name = props.name;
  45309. var route = parent.$route;
  45310. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  45311. // determine current view depth, also check to see if the tree
  45312. // has been toggled inactive but kept-alive.
  45313. var depth = 0;
  45314. var inactive = false;
  45315. while (parent && parent._routerRoot !== parent) {
  45316. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  45317. if (vnodeData.routerView) {
  45318. depth++;
  45319. }
  45320. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  45321. inactive = true;
  45322. }
  45323. parent = parent.$parent;
  45324. }
  45325. data.routerViewDepth = depth;
  45326. // render previous view if the tree is inactive and kept-alive
  45327. if (inactive) {
  45328. var cachedData = cache[name];
  45329. var cachedComponent = cachedData && cachedData.component;
  45330. if (cachedComponent) {
  45331. // #2301
  45332. // pass props
  45333. if (cachedData.configProps) {
  45334. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  45335. }
  45336. return h(cachedComponent, data, children)
  45337. } else {
  45338. // render previous empty view
  45339. return h()
  45340. }
  45341. }
  45342. var matched = route.matched[depth];
  45343. var component = matched && matched.components[name];
  45344. // render empty node if no matched route or no config component
  45345. if (!matched || !component) {
  45346. cache[name] = null;
  45347. return h()
  45348. }
  45349. // cache component
  45350. cache[name] = { component: component };
  45351. // attach instance registration hook
  45352. // this will be called in the instance's injected lifecycle hooks
  45353. data.registerRouteInstance = function (vm, val) {
  45354. // val could be undefined for unregistration
  45355. var current = matched.instances[name];
  45356. if (
  45357. (val && current !== vm) ||
  45358. (!val && current === vm)
  45359. ) {
  45360. matched.instances[name] = val;
  45361. }
  45362. }
  45363. // also register instance in prepatch hook
  45364. // in case the same component instance is reused across different routes
  45365. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  45366. matched.instances[name] = vnode.componentInstance;
  45367. };
  45368. // register instance in init hook
  45369. // in case kept-alive component be actived when routes changed
  45370. data.hook.init = function (vnode) {
  45371. if (vnode.data.keepAlive &&
  45372. vnode.componentInstance &&
  45373. vnode.componentInstance !== matched.instances[name]
  45374. ) {
  45375. matched.instances[name] = vnode.componentInstance;
  45376. }
  45377. };
  45378. var configProps = matched.props && matched.props[name];
  45379. // save route and configProps in cachce
  45380. if (configProps) {
  45381. extend(cache[name], {
  45382. route: route,
  45383. configProps: configProps
  45384. });
  45385. fillPropsinData(component, data, route, configProps);
  45386. }
  45387. return h(component, data, children)
  45388. }
  45389. };
  45390. function fillPropsinData (component, data, route, configProps) {
  45391. // resolve props
  45392. var propsToPass = data.props = resolveProps(route, configProps);
  45393. if (propsToPass) {
  45394. // clone to prevent mutation
  45395. propsToPass = data.props = extend({}, propsToPass);
  45396. // pass non-declared props as attrs
  45397. var attrs = data.attrs = data.attrs || {};
  45398. for (var key in propsToPass) {
  45399. if (!component.props || !(key in component.props)) {
  45400. attrs[key] = propsToPass[key];
  45401. delete propsToPass[key];
  45402. }
  45403. }
  45404. }
  45405. }
  45406. function resolveProps (route, config) {
  45407. switch (typeof config) {
  45408. case 'undefined':
  45409. return
  45410. case 'object':
  45411. return config
  45412. case 'function':
  45413. return config(route)
  45414. case 'boolean':
  45415. return config ? route.params : undefined
  45416. default:
  45417. if (true) {
  45418. warn(
  45419. false,
  45420. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  45421. "expecting an object, function or boolean."
  45422. );
  45423. }
  45424. }
  45425. }
  45426. /* */
  45427. var encodeReserveRE = /[!'()*]/g;
  45428. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  45429. var commaRE = /%2C/g;
  45430. // fixed encodeURIComponent which is more conformant to RFC3986:
  45431. // - escapes [!'()*]
  45432. // - preserve commas
  45433. var encode = function (str) { return encodeURIComponent(str)
  45434. .replace(encodeReserveRE, encodeReserveReplacer)
  45435. .replace(commaRE, ','); };
  45436. var decode = decodeURIComponent;
  45437. function resolveQuery (
  45438. query,
  45439. extraQuery,
  45440. _parseQuery
  45441. ) {
  45442. if ( extraQuery === void 0 ) extraQuery = {};
  45443. var parse = _parseQuery || parseQuery;
  45444. var parsedQuery;
  45445. try {
  45446. parsedQuery = parse(query || '');
  45447. } catch (e) {
  45448. true && warn(false, e.message);
  45449. parsedQuery = {};
  45450. }
  45451. for (var key in extraQuery) {
  45452. parsedQuery[key] = extraQuery[key];
  45453. }
  45454. return parsedQuery
  45455. }
  45456. function parseQuery (query) {
  45457. var res = {};
  45458. query = query.trim().replace(/^(\?|#|&)/, '');
  45459. if (!query) {
  45460. return res
  45461. }
  45462. query.split('&').forEach(function (param) {
  45463. var parts = param.replace(/\+/g, ' ').split('=');
  45464. var key = decode(parts.shift());
  45465. var val = parts.length > 0
  45466. ? decode(parts.join('='))
  45467. : null;
  45468. if (res[key] === undefined) {
  45469. res[key] = val;
  45470. } else if (Array.isArray(res[key])) {
  45471. res[key].push(val);
  45472. } else {
  45473. res[key] = [res[key], val];
  45474. }
  45475. });
  45476. return res
  45477. }
  45478. function stringifyQuery (obj) {
  45479. var res = obj ? Object.keys(obj).map(function (key) {
  45480. var val = obj[key];
  45481. if (val === undefined) {
  45482. return ''
  45483. }
  45484. if (val === null) {
  45485. return encode(key)
  45486. }
  45487. if (Array.isArray(val)) {
  45488. var result = [];
  45489. val.forEach(function (val2) {
  45490. if (val2 === undefined) {
  45491. return
  45492. }
  45493. if (val2 === null) {
  45494. result.push(encode(key));
  45495. } else {
  45496. result.push(encode(key) + '=' + encode(val2));
  45497. }
  45498. });
  45499. return result.join('&')
  45500. }
  45501. return encode(key) + '=' + encode(val)
  45502. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  45503. return res ? ("?" + res) : ''
  45504. }
  45505. /* */
  45506. var trailingSlashRE = /\/?$/;
  45507. function createRoute (
  45508. record,
  45509. location,
  45510. redirectedFrom,
  45511. router
  45512. ) {
  45513. var stringifyQuery = router && router.options.stringifyQuery;
  45514. var query = location.query || {};
  45515. try {
  45516. query = clone(query);
  45517. } catch (e) {}
  45518. var route = {
  45519. name: location.name || (record && record.name),
  45520. meta: (record && record.meta) || {},
  45521. path: location.path || '/',
  45522. hash: location.hash || '',
  45523. query: query,
  45524. params: location.params || {},
  45525. fullPath: getFullPath(location, stringifyQuery),
  45526. matched: record ? formatMatch(record) : []
  45527. };
  45528. if (redirectedFrom) {
  45529. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  45530. }
  45531. return Object.freeze(route)
  45532. }
  45533. function clone (value) {
  45534. if (Array.isArray(value)) {
  45535. return value.map(clone)
  45536. } else if (value && typeof value === 'object') {
  45537. var res = {};
  45538. for (var key in value) {
  45539. res[key] = clone(value[key]);
  45540. }
  45541. return res
  45542. } else {
  45543. return value
  45544. }
  45545. }
  45546. // the starting route that represents the initial state
  45547. var START = createRoute(null, {
  45548. path: '/'
  45549. });
  45550. function formatMatch (record) {
  45551. var res = [];
  45552. while (record) {
  45553. res.unshift(record);
  45554. record = record.parent;
  45555. }
  45556. return res
  45557. }
  45558. function getFullPath (
  45559. ref,
  45560. _stringifyQuery
  45561. ) {
  45562. var path = ref.path;
  45563. var query = ref.query; if ( query === void 0 ) query = {};
  45564. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  45565. var stringify = _stringifyQuery || stringifyQuery;
  45566. return (path || '/') + stringify(query) + hash
  45567. }
  45568. function isSameRoute (a, b) {
  45569. if (b === START) {
  45570. return a === b
  45571. } else if (!b) {
  45572. return false
  45573. } else if (a.path && b.path) {
  45574. return (
  45575. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  45576. a.hash === b.hash &&
  45577. isObjectEqual(a.query, b.query)
  45578. )
  45579. } else if (a.name && b.name) {
  45580. return (
  45581. a.name === b.name &&
  45582. a.hash === b.hash &&
  45583. isObjectEqual(a.query, b.query) &&
  45584. isObjectEqual(a.params, b.params)
  45585. )
  45586. } else {
  45587. return false
  45588. }
  45589. }
  45590. function isObjectEqual (a, b) {
  45591. if ( a === void 0 ) a = {};
  45592. if ( b === void 0 ) b = {};
  45593. // handle null value #1566
  45594. if (!a || !b) { return a === b }
  45595. var aKeys = Object.keys(a);
  45596. var bKeys = Object.keys(b);
  45597. if (aKeys.length !== bKeys.length) {
  45598. return false
  45599. }
  45600. return aKeys.every(function (key) {
  45601. var aVal = a[key];
  45602. var bVal = b[key];
  45603. // check nested equality
  45604. if (typeof aVal === 'object' && typeof bVal === 'object') {
  45605. return isObjectEqual(aVal, bVal)
  45606. }
  45607. return String(aVal) === String(bVal)
  45608. })
  45609. }
  45610. function isIncludedRoute (current, target) {
  45611. return (
  45612. current.path.replace(trailingSlashRE, '/').indexOf(
  45613. target.path.replace(trailingSlashRE, '/')
  45614. ) === 0 &&
  45615. (!target.hash || current.hash === target.hash) &&
  45616. queryIncludes(current.query, target.query)
  45617. )
  45618. }
  45619. function queryIncludes (current, target) {
  45620. for (var key in target) {
  45621. if (!(key in current)) {
  45622. return false
  45623. }
  45624. }
  45625. return true
  45626. }
  45627. /* */
  45628. function resolvePath (
  45629. relative,
  45630. base,
  45631. append
  45632. ) {
  45633. var firstChar = relative.charAt(0);
  45634. if (firstChar === '/') {
  45635. return relative
  45636. }
  45637. if (firstChar === '?' || firstChar === '#') {
  45638. return base + relative
  45639. }
  45640. var stack = base.split('/');
  45641. // remove trailing segment if:
  45642. // - not appending
  45643. // - appending to trailing slash (last segment is empty)
  45644. if (!append || !stack[stack.length - 1]) {
  45645. stack.pop();
  45646. }
  45647. // resolve relative path
  45648. var segments = relative.replace(/^\//, '').split('/');
  45649. for (var i = 0; i < segments.length; i++) {
  45650. var segment = segments[i];
  45651. if (segment === '..') {
  45652. stack.pop();
  45653. } else if (segment !== '.') {
  45654. stack.push(segment);
  45655. }
  45656. }
  45657. // ensure leading slash
  45658. if (stack[0] !== '') {
  45659. stack.unshift('');
  45660. }
  45661. return stack.join('/')
  45662. }
  45663. function parsePath (path) {
  45664. var hash = '';
  45665. var query = '';
  45666. var hashIndex = path.indexOf('#');
  45667. if (hashIndex >= 0) {
  45668. hash = path.slice(hashIndex);
  45669. path = path.slice(0, hashIndex);
  45670. }
  45671. var queryIndex = path.indexOf('?');
  45672. if (queryIndex >= 0) {
  45673. query = path.slice(queryIndex + 1);
  45674. path = path.slice(0, queryIndex);
  45675. }
  45676. return {
  45677. path: path,
  45678. query: query,
  45679. hash: hash
  45680. }
  45681. }
  45682. function cleanPath (path) {
  45683. return path.replace(/\/\//g, '/')
  45684. }
  45685. var isarray = Array.isArray || function (arr) {
  45686. return Object.prototype.toString.call(arr) == '[object Array]';
  45687. };
  45688. /**
  45689. * Expose `pathToRegexp`.
  45690. */
  45691. var pathToRegexp_1 = pathToRegexp;
  45692. var parse_1 = parse;
  45693. var compile_1 = compile;
  45694. var tokensToFunction_1 = tokensToFunction;
  45695. var tokensToRegExp_1 = tokensToRegExp;
  45696. /**
  45697. * The main path matching regexp utility.
  45698. *
  45699. * @type {RegExp}
  45700. */
  45701. var PATH_REGEXP = new RegExp([
  45702. // Match escaped characters that would otherwise appear in future matches.
  45703. // This allows the user to escape special characters that won't transform.
  45704. '(\\\\.)',
  45705. // Match Express-style parameters and un-named parameters with a prefix
  45706. // and optional suffixes. Matches appear as:
  45707. //
  45708. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  45709. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  45710. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  45711. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  45712. ].join('|'), 'g');
  45713. /**
  45714. * Parse a string for the raw tokens.
  45715. *
  45716. * @param {string} str
  45717. * @param {Object=} options
  45718. * @return {!Array}
  45719. */
  45720. function parse (str, options) {
  45721. var tokens = [];
  45722. var key = 0;
  45723. var index = 0;
  45724. var path = '';
  45725. var defaultDelimiter = options && options.delimiter || '/';
  45726. var res;
  45727. while ((res = PATH_REGEXP.exec(str)) != null) {
  45728. var m = res[0];
  45729. var escaped = res[1];
  45730. var offset = res.index;
  45731. path += str.slice(index, offset);
  45732. index = offset + m.length;
  45733. // Ignore already escaped sequences.
  45734. if (escaped) {
  45735. path += escaped[1];
  45736. continue
  45737. }
  45738. var next = str[index];
  45739. var prefix = res[2];
  45740. var name = res[3];
  45741. var capture = res[4];
  45742. var group = res[5];
  45743. var modifier = res[6];
  45744. var asterisk = res[7];
  45745. // Push the current path onto the tokens.
  45746. if (path) {
  45747. tokens.push(path);
  45748. path = '';
  45749. }
  45750. var partial = prefix != null && next != null && next !== prefix;
  45751. var repeat = modifier === '+' || modifier === '*';
  45752. var optional = modifier === '?' || modifier === '*';
  45753. var delimiter = res[2] || defaultDelimiter;
  45754. var pattern = capture || group;
  45755. tokens.push({
  45756. name: name || key++,
  45757. prefix: prefix || '',
  45758. delimiter: delimiter,
  45759. optional: optional,
  45760. repeat: repeat,
  45761. partial: partial,
  45762. asterisk: !!asterisk,
  45763. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  45764. });
  45765. }
  45766. // Match any characters still remaining.
  45767. if (index < str.length) {
  45768. path += str.substr(index);
  45769. }
  45770. // If the path exists, push it onto the end.
  45771. if (path) {
  45772. tokens.push(path);
  45773. }
  45774. return tokens
  45775. }
  45776. /**
  45777. * Compile a string to a template function for the path.
  45778. *
  45779. * @param {string} str
  45780. * @param {Object=} options
  45781. * @return {!function(Object=, Object=)}
  45782. */
  45783. function compile (str, options) {
  45784. return tokensToFunction(parse(str, options))
  45785. }
  45786. /**
  45787. * Prettier encoding of URI path segments.
  45788. *
  45789. * @param {string}
  45790. * @return {string}
  45791. */
  45792. function encodeURIComponentPretty (str) {
  45793. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  45794. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45795. })
  45796. }
  45797. /**
  45798. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  45799. *
  45800. * @param {string}
  45801. * @return {string}
  45802. */
  45803. function encodeAsterisk (str) {
  45804. return encodeURI(str).replace(/[?#]/g, function (c) {
  45805. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  45806. })
  45807. }
  45808. /**
  45809. * Expose a method for transforming tokens into the path function.
  45810. */
  45811. function tokensToFunction (tokens) {
  45812. // Compile all the tokens into regexps.
  45813. var matches = new Array(tokens.length);
  45814. // Compile all the patterns before compilation.
  45815. for (var i = 0; i < tokens.length; i++) {
  45816. if (typeof tokens[i] === 'object') {
  45817. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  45818. }
  45819. }
  45820. return function (obj, opts) {
  45821. var path = '';
  45822. var data = obj || {};
  45823. var options = opts || {};
  45824. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  45825. for (var i = 0; i < tokens.length; i++) {
  45826. var token = tokens[i];
  45827. if (typeof token === 'string') {
  45828. path += token;
  45829. continue
  45830. }
  45831. var value = data[token.name];
  45832. var segment;
  45833. if (value == null) {
  45834. if (token.optional) {
  45835. // Prepend partial segment prefixes.
  45836. if (token.partial) {
  45837. path += token.prefix;
  45838. }
  45839. continue
  45840. } else {
  45841. throw new TypeError('Expected "' + token.name + '" to be defined')
  45842. }
  45843. }
  45844. if (isarray(value)) {
  45845. if (!token.repeat) {
  45846. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  45847. }
  45848. if (value.length === 0) {
  45849. if (token.optional) {
  45850. continue
  45851. } else {
  45852. throw new TypeError('Expected "' + token.name + '" to not be empty')
  45853. }
  45854. }
  45855. for (var j = 0; j < value.length; j++) {
  45856. segment = encode(value[j]);
  45857. if (!matches[i].test(segment)) {
  45858. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  45859. }
  45860. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  45861. }
  45862. continue
  45863. }
  45864. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  45865. if (!matches[i].test(segment)) {
  45866. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  45867. }
  45868. path += token.prefix + segment;
  45869. }
  45870. return path
  45871. }
  45872. }
  45873. /**
  45874. * Escape a regular expression string.
  45875. *
  45876. * @param {string} str
  45877. * @return {string}
  45878. */
  45879. function escapeString (str) {
  45880. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  45881. }
  45882. /**
  45883. * Escape the capturing group by escaping special characters and meaning.
  45884. *
  45885. * @param {string} group
  45886. * @return {string}
  45887. */
  45888. function escapeGroup (group) {
  45889. return group.replace(/([=!:$\/()])/g, '\\$1')
  45890. }
  45891. /**
  45892. * Attach the keys as a property of the regexp.
  45893. *
  45894. * @param {!RegExp} re
  45895. * @param {Array} keys
  45896. * @return {!RegExp}
  45897. */
  45898. function attachKeys (re, keys) {
  45899. re.keys = keys;
  45900. return re
  45901. }
  45902. /**
  45903. * Get the flags for a regexp from the options.
  45904. *
  45905. * @param {Object} options
  45906. * @return {string}
  45907. */
  45908. function flags (options) {
  45909. return options.sensitive ? '' : 'i'
  45910. }
  45911. /**
  45912. * Pull out keys from a regexp.
  45913. *
  45914. * @param {!RegExp} path
  45915. * @param {!Array} keys
  45916. * @return {!RegExp}
  45917. */
  45918. function regexpToRegexp (path, keys) {
  45919. // Use a negative lookahead to match only capturing groups.
  45920. var groups = path.source.match(/\((?!\?)/g);
  45921. if (groups) {
  45922. for (var i = 0; i < groups.length; i++) {
  45923. keys.push({
  45924. name: i,
  45925. prefix: null,
  45926. delimiter: null,
  45927. optional: false,
  45928. repeat: false,
  45929. partial: false,
  45930. asterisk: false,
  45931. pattern: null
  45932. });
  45933. }
  45934. }
  45935. return attachKeys(path, keys)
  45936. }
  45937. /**
  45938. * Transform an array into a regexp.
  45939. *
  45940. * @param {!Array} path
  45941. * @param {Array} keys
  45942. * @param {!Object} options
  45943. * @return {!RegExp}
  45944. */
  45945. function arrayToRegexp (path, keys, options) {
  45946. var parts = [];
  45947. for (var i = 0; i < path.length; i++) {
  45948. parts.push(pathToRegexp(path[i], keys, options).source);
  45949. }
  45950. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  45951. return attachKeys(regexp, keys)
  45952. }
  45953. /**
  45954. * Create a path regexp from string input.
  45955. *
  45956. * @param {string} path
  45957. * @param {!Array} keys
  45958. * @param {!Object} options
  45959. * @return {!RegExp}
  45960. */
  45961. function stringToRegexp (path, keys, options) {
  45962. return tokensToRegExp(parse(path, options), keys, options)
  45963. }
  45964. /**
  45965. * Expose a function for taking tokens and returning a RegExp.
  45966. *
  45967. * @param {!Array} tokens
  45968. * @param {(Array|Object)=} keys
  45969. * @param {Object=} options
  45970. * @return {!RegExp}
  45971. */
  45972. function tokensToRegExp (tokens, keys, options) {
  45973. if (!isarray(keys)) {
  45974. options = /** @type {!Object} */ (keys || options);
  45975. keys = [];
  45976. }
  45977. options = options || {};
  45978. var strict = options.strict;
  45979. var end = options.end !== false;
  45980. var route = '';
  45981. // Iterate over the tokens and create our regexp string.
  45982. for (var i = 0; i < tokens.length; i++) {
  45983. var token = tokens[i];
  45984. if (typeof token === 'string') {
  45985. route += escapeString(token);
  45986. } else {
  45987. var prefix = escapeString(token.prefix);
  45988. var capture = '(?:' + token.pattern + ')';
  45989. keys.push(token);
  45990. if (token.repeat) {
  45991. capture += '(?:' + prefix + capture + ')*';
  45992. }
  45993. if (token.optional) {
  45994. if (!token.partial) {
  45995. capture = '(?:' + prefix + '(' + capture + '))?';
  45996. } else {
  45997. capture = prefix + '(' + capture + ')?';
  45998. }
  45999. } else {
  46000. capture = prefix + '(' + capture + ')';
  46001. }
  46002. route += capture;
  46003. }
  46004. }
  46005. var delimiter = escapeString(options.delimiter || '/');
  46006. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  46007. // In non-strict mode we allow a slash at the end of match. If the path to
  46008. // match already ends with a slash, we remove it for consistency. The slash
  46009. // is valid at the end of a path match, not in the middle. This is important
  46010. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  46011. if (!strict) {
  46012. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  46013. }
  46014. if (end) {
  46015. route += '$';
  46016. } else {
  46017. // In non-ending mode, we need the capturing groups to match as much as
  46018. // possible by using a positive lookahead to the end or next path segment.
  46019. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  46020. }
  46021. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  46022. }
  46023. /**
  46024. * Normalize the given path string, returning a regular expression.
  46025. *
  46026. * An empty array can be passed in for the keys, which will hold the
  46027. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  46028. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  46029. *
  46030. * @param {(string|RegExp|Array)} path
  46031. * @param {(Array|Object)=} keys
  46032. * @param {Object=} options
  46033. * @return {!RegExp}
  46034. */
  46035. function pathToRegexp (path, keys, options) {
  46036. if (!isarray(keys)) {
  46037. options = /** @type {!Object} */ (keys || options);
  46038. keys = [];
  46039. }
  46040. options = options || {};
  46041. if (path instanceof RegExp) {
  46042. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  46043. }
  46044. if (isarray(path)) {
  46045. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  46046. }
  46047. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  46048. }
  46049. pathToRegexp_1.parse = parse_1;
  46050. pathToRegexp_1.compile = compile_1;
  46051. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  46052. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  46053. /* */
  46054. // $flow-disable-line
  46055. var regexpCompileCache = Object.create(null);
  46056. function fillParams (
  46057. path,
  46058. params,
  46059. routeMsg
  46060. ) {
  46061. params = params || {};
  46062. try {
  46063. var filler =
  46064. regexpCompileCache[path] ||
  46065. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  46066. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  46067. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  46068. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  46069. return filler(params, { pretty: true })
  46070. } catch (e) {
  46071. if (true) {
  46072. // Fix #3072 no warn if `pathMatch` is string
  46073. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  46074. }
  46075. return ''
  46076. } finally {
  46077. // delete the 0 if it was added
  46078. delete params[0];
  46079. }
  46080. }
  46081. /* */
  46082. function normalizeLocation (
  46083. raw,
  46084. current,
  46085. append,
  46086. router
  46087. ) {
  46088. var next = typeof raw === 'string' ? { path: raw } : raw;
  46089. // named target
  46090. if (next._normalized) {
  46091. return next
  46092. } else if (next.name) {
  46093. next = extend({}, raw);
  46094. var params = next.params;
  46095. if (params && typeof params === 'object') {
  46096. next.params = extend({}, params);
  46097. }
  46098. return next
  46099. }
  46100. // relative params
  46101. if (!next.path && next.params && current) {
  46102. next = extend({}, next);
  46103. next._normalized = true;
  46104. var params$1 = extend(extend({}, current.params), next.params);
  46105. if (current.name) {
  46106. next.name = current.name;
  46107. next.params = params$1;
  46108. } else if (current.matched.length) {
  46109. var rawPath = current.matched[current.matched.length - 1].path;
  46110. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  46111. } else if (true) {
  46112. warn(false, "relative params navigation requires a current route.");
  46113. }
  46114. return next
  46115. }
  46116. var parsedPath = parsePath(next.path || '');
  46117. var basePath = (current && current.path) || '/';
  46118. var path = parsedPath.path
  46119. ? resolvePath(parsedPath.path, basePath, append || next.append)
  46120. : basePath;
  46121. var query = resolveQuery(
  46122. parsedPath.query,
  46123. next.query,
  46124. router && router.options.parseQuery
  46125. );
  46126. var hash = next.hash || parsedPath.hash;
  46127. if (hash && hash.charAt(0) !== '#') {
  46128. hash = "#" + hash;
  46129. }
  46130. return {
  46131. _normalized: true,
  46132. path: path,
  46133. query: query,
  46134. hash: hash
  46135. }
  46136. }
  46137. /* */
  46138. // work around weird flow bug
  46139. var toTypes = [String, Object];
  46140. var eventTypes = [String, Array];
  46141. var noop = function () {};
  46142. var Link = {
  46143. name: 'RouterLink',
  46144. props: {
  46145. to: {
  46146. type: toTypes,
  46147. required: true
  46148. },
  46149. tag: {
  46150. type: String,
  46151. default: 'a'
  46152. },
  46153. exact: Boolean,
  46154. append: Boolean,
  46155. replace: Boolean,
  46156. activeClass: String,
  46157. exactActiveClass: String,
  46158. event: {
  46159. type: eventTypes,
  46160. default: 'click'
  46161. }
  46162. },
  46163. render: function render (h) {
  46164. var this$1 = this;
  46165. var router = this.$router;
  46166. var current = this.$route;
  46167. var ref = router.resolve(
  46168. this.to,
  46169. current,
  46170. this.append
  46171. );
  46172. var location = ref.location;
  46173. var route = ref.route;
  46174. var href = ref.href;
  46175. var classes = {};
  46176. var globalActiveClass = router.options.linkActiveClass;
  46177. var globalExactActiveClass = router.options.linkExactActiveClass;
  46178. // Support global empty active class
  46179. var activeClassFallback =
  46180. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  46181. var exactActiveClassFallback =
  46182. globalExactActiveClass == null
  46183. ? 'router-link-exact-active'
  46184. : globalExactActiveClass;
  46185. var activeClass =
  46186. this.activeClass == null ? activeClassFallback : this.activeClass;
  46187. var exactActiveClass =
  46188. this.exactActiveClass == null
  46189. ? exactActiveClassFallback
  46190. : this.exactActiveClass;
  46191. var compareTarget = route.redirectedFrom
  46192. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  46193. : route;
  46194. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  46195. classes[activeClass] = this.exact
  46196. ? classes[exactActiveClass]
  46197. : isIncludedRoute(current, compareTarget);
  46198. var handler = function (e) {
  46199. if (guardEvent(e)) {
  46200. if (this$1.replace) {
  46201. router.replace(location, noop);
  46202. } else {
  46203. router.push(location, noop);
  46204. }
  46205. }
  46206. };
  46207. var on = { click: guardEvent };
  46208. if (Array.isArray(this.event)) {
  46209. this.event.forEach(function (e) {
  46210. on[e] = handler;
  46211. });
  46212. } else {
  46213. on[this.event] = handler;
  46214. }
  46215. var data = { class: classes };
  46216. var scopedSlot =
  46217. !this.$scopedSlots.$hasNormal &&
  46218. this.$scopedSlots.default &&
  46219. this.$scopedSlots.default({
  46220. href: href,
  46221. route: route,
  46222. navigate: handler,
  46223. isActive: classes[activeClass],
  46224. isExactActive: classes[exactActiveClass]
  46225. });
  46226. if (scopedSlot) {
  46227. if (scopedSlot.length === 1) {
  46228. return scopedSlot[0]
  46229. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  46230. if (true) {
  46231. warn(
  46232. false,
  46233. ("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.")
  46234. );
  46235. }
  46236. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  46237. }
  46238. }
  46239. if (this.tag === 'a') {
  46240. data.on = on;
  46241. data.attrs = { href: href };
  46242. } else {
  46243. // find the first <a> child and apply listener and href
  46244. var a = findAnchor(this.$slots.default);
  46245. if (a) {
  46246. // in case the <a> is a static node
  46247. a.isStatic = false;
  46248. var aData = (a.data = extend({}, a.data));
  46249. aData.on = aData.on || {};
  46250. // transform existing events in both objects into arrays so we can push later
  46251. for (var event in aData.on) {
  46252. var handler$1 = aData.on[event];
  46253. if (event in on) {
  46254. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  46255. }
  46256. }
  46257. // append new listeners for router-link
  46258. for (var event$1 in on) {
  46259. if (event$1 in aData.on) {
  46260. // on[event] is always a function
  46261. aData.on[event$1].push(on[event$1]);
  46262. } else {
  46263. aData.on[event$1] = handler;
  46264. }
  46265. }
  46266. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  46267. aAttrs.href = href;
  46268. } else {
  46269. // doesn't have <a> child, apply listener to self
  46270. data.on = on;
  46271. }
  46272. }
  46273. return h(this.tag, data, this.$slots.default)
  46274. }
  46275. };
  46276. function guardEvent (e) {
  46277. // don't redirect with control keys
  46278. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  46279. // don't redirect when preventDefault called
  46280. if (e.defaultPrevented) { return }
  46281. // don't redirect on right click
  46282. if (e.button !== undefined && e.button !== 0) { return }
  46283. // don't redirect if `target="_blank"`
  46284. if (e.currentTarget && e.currentTarget.getAttribute) {
  46285. var target = e.currentTarget.getAttribute('target');
  46286. if (/\b_blank\b/i.test(target)) { return }
  46287. }
  46288. // this may be a Weex event which doesn't have this method
  46289. if (e.preventDefault) {
  46290. e.preventDefault();
  46291. }
  46292. return true
  46293. }
  46294. function findAnchor (children) {
  46295. if (children) {
  46296. var child;
  46297. for (var i = 0; i < children.length; i++) {
  46298. child = children[i];
  46299. if (child.tag === 'a') {
  46300. return child
  46301. }
  46302. if (child.children && (child = findAnchor(child.children))) {
  46303. return child
  46304. }
  46305. }
  46306. }
  46307. }
  46308. var _Vue;
  46309. function install (Vue) {
  46310. if (install.installed && _Vue === Vue) { return }
  46311. install.installed = true;
  46312. _Vue = Vue;
  46313. var isDef = function (v) { return v !== undefined; };
  46314. var registerInstance = function (vm, callVal) {
  46315. var i = vm.$options._parentVnode;
  46316. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  46317. i(vm, callVal);
  46318. }
  46319. };
  46320. Vue.mixin({
  46321. beforeCreate: function beforeCreate () {
  46322. if (isDef(this.$options.router)) {
  46323. this._routerRoot = this;
  46324. this._router = this.$options.router;
  46325. this._router.init(this);
  46326. Vue.util.defineReactive(this, '_route', this._router.history.current);
  46327. } else {
  46328. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  46329. }
  46330. registerInstance(this, this);
  46331. },
  46332. destroyed: function destroyed () {
  46333. registerInstance(this);
  46334. }
  46335. });
  46336. Object.defineProperty(Vue.prototype, '$router', {
  46337. get: function get () { return this._routerRoot._router }
  46338. });
  46339. Object.defineProperty(Vue.prototype, '$route', {
  46340. get: function get () { return this._routerRoot._route }
  46341. });
  46342. Vue.component('RouterView', View);
  46343. Vue.component('RouterLink', Link);
  46344. var strats = Vue.config.optionMergeStrategies;
  46345. // use the same hook merging strategy for route hooks
  46346. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  46347. }
  46348. /* */
  46349. var inBrowser = typeof window !== 'undefined';
  46350. /* */
  46351. function createRouteMap (
  46352. routes,
  46353. oldPathList,
  46354. oldPathMap,
  46355. oldNameMap
  46356. ) {
  46357. // the path list is used to control path matching priority
  46358. var pathList = oldPathList || [];
  46359. // $flow-disable-line
  46360. var pathMap = oldPathMap || Object.create(null);
  46361. // $flow-disable-line
  46362. var nameMap = oldNameMap || Object.create(null);
  46363. routes.forEach(function (route) {
  46364. addRouteRecord(pathList, pathMap, nameMap, route);
  46365. });
  46366. // ensure wildcard routes are always at the end
  46367. for (var i = 0, l = pathList.length; i < l; i++) {
  46368. if (pathList[i] === '*') {
  46369. pathList.push(pathList.splice(i, 1)[0]);
  46370. l--;
  46371. i--;
  46372. }
  46373. }
  46374. if (true) {
  46375. // warn if routes do not include leading slashes
  46376. var found = pathList
  46377. // check for missing leading slash
  46378. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  46379. if (found.length > 0) {
  46380. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  46381. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  46382. }
  46383. }
  46384. return {
  46385. pathList: pathList,
  46386. pathMap: pathMap,
  46387. nameMap: nameMap
  46388. }
  46389. }
  46390. function addRouteRecord (
  46391. pathList,
  46392. pathMap,
  46393. nameMap,
  46394. route,
  46395. parent,
  46396. matchAs
  46397. ) {
  46398. var path = route.path;
  46399. var name = route.name;
  46400. if (true) {
  46401. assert(path != null, "\"path\" is required in a route configuration.");
  46402. assert(
  46403. typeof route.component !== 'string',
  46404. "route config \"component\" for path: " + (String(
  46405. path || name
  46406. )) + " cannot be a " + "string id. Use an actual component instead."
  46407. );
  46408. }
  46409. var pathToRegexpOptions =
  46410. route.pathToRegexpOptions || {};
  46411. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  46412. if (typeof route.caseSensitive === 'boolean') {
  46413. pathToRegexpOptions.sensitive = route.caseSensitive;
  46414. }
  46415. var record = {
  46416. path: normalizedPath,
  46417. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  46418. components: route.components || { default: route.component },
  46419. instances: {},
  46420. name: name,
  46421. parent: parent,
  46422. matchAs: matchAs,
  46423. redirect: route.redirect,
  46424. beforeEnter: route.beforeEnter,
  46425. meta: route.meta || {},
  46426. props:
  46427. route.props == null
  46428. ? {}
  46429. : route.components
  46430. ? route.props
  46431. : { default: route.props }
  46432. };
  46433. if (route.children) {
  46434. // Warn if route is named, does not redirect and has a default child route.
  46435. // If users navigate to this route by name, the default child will
  46436. // not be rendered (GH Issue #629)
  46437. if (true) {
  46438. if (
  46439. route.name &&
  46440. !route.redirect &&
  46441. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  46442. ) {
  46443. warn(
  46444. false,
  46445. "Named Route '" + (route.name) + "' has a default child route. " +
  46446. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  46447. "the default child route will not be rendered. Remove the name from " +
  46448. "this route and use the name of the default child route for named " +
  46449. "links instead."
  46450. );
  46451. }
  46452. }
  46453. route.children.forEach(function (child) {
  46454. var childMatchAs = matchAs
  46455. ? cleanPath((matchAs + "/" + (child.path)))
  46456. : undefined;
  46457. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  46458. });
  46459. }
  46460. if (!pathMap[record.path]) {
  46461. pathList.push(record.path);
  46462. pathMap[record.path] = record;
  46463. }
  46464. if (route.alias !== undefined) {
  46465. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  46466. for (var i = 0; i < aliases.length; ++i) {
  46467. var alias = aliases[i];
  46468. if ( true && alias === path) {
  46469. warn(
  46470. false,
  46471. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  46472. );
  46473. // skip in dev to make it work
  46474. continue
  46475. }
  46476. var aliasRoute = {
  46477. path: alias,
  46478. children: route.children
  46479. };
  46480. addRouteRecord(
  46481. pathList,
  46482. pathMap,
  46483. nameMap,
  46484. aliasRoute,
  46485. parent,
  46486. record.path || '/' // matchAs
  46487. );
  46488. }
  46489. }
  46490. if (name) {
  46491. if (!nameMap[name]) {
  46492. nameMap[name] = record;
  46493. } else if ( true && !matchAs) {
  46494. warn(
  46495. false,
  46496. "Duplicate named routes definition: " +
  46497. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  46498. );
  46499. }
  46500. }
  46501. }
  46502. function compileRouteRegex (
  46503. path,
  46504. pathToRegexpOptions
  46505. ) {
  46506. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  46507. if (true) {
  46508. var keys = Object.create(null);
  46509. regex.keys.forEach(function (key) {
  46510. warn(
  46511. !keys[key.name],
  46512. ("Duplicate param keys in route with path: \"" + path + "\"")
  46513. );
  46514. keys[key.name] = true;
  46515. });
  46516. }
  46517. return regex
  46518. }
  46519. function normalizePath (
  46520. path,
  46521. parent,
  46522. strict
  46523. ) {
  46524. if (!strict) { path = path.replace(/\/$/, ''); }
  46525. if (path[0] === '/') { return path }
  46526. if (parent == null) { return path }
  46527. return cleanPath(((parent.path) + "/" + path))
  46528. }
  46529. /* */
  46530. function createMatcher (
  46531. routes,
  46532. router
  46533. ) {
  46534. var ref = createRouteMap(routes);
  46535. var pathList = ref.pathList;
  46536. var pathMap = ref.pathMap;
  46537. var nameMap = ref.nameMap;
  46538. function addRoutes (routes) {
  46539. createRouteMap(routes, pathList, pathMap, nameMap);
  46540. }
  46541. function match (
  46542. raw,
  46543. currentRoute,
  46544. redirectedFrom
  46545. ) {
  46546. var location = normalizeLocation(raw, currentRoute, false, router);
  46547. var name = location.name;
  46548. if (name) {
  46549. var record = nameMap[name];
  46550. if (true) {
  46551. warn(record, ("Route with name '" + name + "' does not exist"));
  46552. }
  46553. if (!record) { return _createRoute(null, location) }
  46554. var paramNames = record.regex.keys
  46555. .filter(function (key) { return !key.optional; })
  46556. .map(function (key) { return key.name; });
  46557. if (typeof location.params !== 'object') {
  46558. location.params = {};
  46559. }
  46560. if (currentRoute && typeof currentRoute.params === 'object') {
  46561. for (var key in currentRoute.params) {
  46562. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  46563. location.params[key] = currentRoute.params[key];
  46564. }
  46565. }
  46566. }
  46567. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  46568. return _createRoute(record, location, redirectedFrom)
  46569. } else if (location.path) {
  46570. location.params = {};
  46571. for (var i = 0; i < pathList.length; i++) {
  46572. var path = pathList[i];
  46573. var record$1 = pathMap[path];
  46574. if (matchRoute(record$1.regex, location.path, location.params)) {
  46575. return _createRoute(record$1, location, redirectedFrom)
  46576. }
  46577. }
  46578. }
  46579. // no match
  46580. return _createRoute(null, location)
  46581. }
  46582. function redirect (
  46583. record,
  46584. location
  46585. ) {
  46586. var originalRedirect = record.redirect;
  46587. var redirect = typeof originalRedirect === 'function'
  46588. ? originalRedirect(createRoute(record, location, null, router))
  46589. : originalRedirect;
  46590. if (typeof redirect === 'string') {
  46591. redirect = { path: redirect };
  46592. }
  46593. if (!redirect || typeof redirect !== 'object') {
  46594. if (true) {
  46595. warn(
  46596. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  46597. );
  46598. }
  46599. return _createRoute(null, location)
  46600. }
  46601. var re = redirect;
  46602. var name = re.name;
  46603. var path = re.path;
  46604. var query = location.query;
  46605. var hash = location.hash;
  46606. var params = location.params;
  46607. query = re.hasOwnProperty('query') ? re.query : query;
  46608. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  46609. params = re.hasOwnProperty('params') ? re.params : params;
  46610. if (name) {
  46611. // resolved named direct
  46612. var targetRecord = nameMap[name];
  46613. if (true) {
  46614. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  46615. }
  46616. return match({
  46617. _normalized: true,
  46618. name: name,
  46619. query: query,
  46620. hash: hash,
  46621. params: params
  46622. }, undefined, location)
  46623. } else if (path) {
  46624. // 1. resolve relative redirect
  46625. var rawPath = resolveRecordPath(path, record);
  46626. // 2. resolve params
  46627. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  46628. // 3. rematch with existing query and hash
  46629. return match({
  46630. _normalized: true,
  46631. path: resolvedPath,
  46632. query: query,
  46633. hash: hash
  46634. }, undefined, location)
  46635. } else {
  46636. if (true) {
  46637. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  46638. }
  46639. return _createRoute(null, location)
  46640. }
  46641. }
  46642. function alias (
  46643. record,
  46644. location,
  46645. matchAs
  46646. ) {
  46647. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  46648. var aliasedMatch = match({
  46649. _normalized: true,
  46650. path: aliasedPath
  46651. });
  46652. if (aliasedMatch) {
  46653. var matched = aliasedMatch.matched;
  46654. var aliasedRecord = matched[matched.length - 1];
  46655. location.params = aliasedMatch.params;
  46656. return _createRoute(aliasedRecord, location)
  46657. }
  46658. return _createRoute(null, location)
  46659. }
  46660. function _createRoute (
  46661. record,
  46662. location,
  46663. redirectedFrom
  46664. ) {
  46665. if (record && record.redirect) {
  46666. return redirect(record, redirectedFrom || location)
  46667. }
  46668. if (record && record.matchAs) {
  46669. return alias(record, location, record.matchAs)
  46670. }
  46671. return createRoute(record, location, redirectedFrom, router)
  46672. }
  46673. return {
  46674. match: match,
  46675. addRoutes: addRoutes
  46676. }
  46677. }
  46678. function matchRoute (
  46679. regex,
  46680. path,
  46681. params
  46682. ) {
  46683. var m = path.match(regex);
  46684. if (!m) {
  46685. return false
  46686. } else if (!params) {
  46687. return true
  46688. }
  46689. for (var i = 1, len = m.length; i < len; ++i) {
  46690. var key = regex.keys[i - 1];
  46691. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  46692. if (key) {
  46693. // Fix #1994: using * with props: true generates a param named 0
  46694. params[key.name || 'pathMatch'] = val;
  46695. }
  46696. }
  46697. return true
  46698. }
  46699. function resolveRecordPath (path, record) {
  46700. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  46701. }
  46702. /* */
  46703. // use User Timing api (if present) for more accurate key precision
  46704. var Time =
  46705. inBrowser && window.performance && window.performance.now
  46706. ? window.performance
  46707. : Date;
  46708. function genStateKey () {
  46709. return Time.now().toFixed(3)
  46710. }
  46711. var _key = genStateKey();
  46712. function getStateKey () {
  46713. return _key
  46714. }
  46715. function setStateKey (key) {
  46716. return (_key = key)
  46717. }
  46718. /* */
  46719. var positionStore = Object.create(null);
  46720. function setupScroll () {
  46721. // Fix for #1585 for Firefox
  46722. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  46723. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  46724. // window.location.protocol + '//' + window.location.host
  46725. // location.host contains the port and location.hostname doesn't
  46726. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  46727. var absolutePath = window.location.href.replace(protocolAndPath, '');
  46728. // preserve existing history state as it could be overriden by the user
  46729. var stateCopy = extend({}, window.history.state);
  46730. stateCopy.key = getStateKey();
  46731. window.history.replaceState(stateCopy, '', absolutePath);
  46732. window.addEventListener('popstate', function (e) {
  46733. saveScrollPosition();
  46734. if (e.state && e.state.key) {
  46735. setStateKey(e.state.key);
  46736. }
  46737. });
  46738. }
  46739. function handleScroll (
  46740. router,
  46741. to,
  46742. from,
  46743. isPop
  46744. ) {
  46745. if (!router.app) {
  46746. return
  46747. }
  46748. var behavior = router.options.scrollBehavior;
  46749. if (!behavior) {
  46750. return
  46751. }
  46752. if (true) {
  46753. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  46754. }
  46755. // wait until re-render finishes before scrolling
  46756. router.app.$nextTick(function () {
  46757. var position = getScrollPosition();
  46758. var shouldScroll = behavior.call(
  46759. router,
  46760. to,
  46761. from,
  46762. isPop ? position : null
  46763. );
  46764. if (!shouldScroll) {
  46765. return
  46766. }
  46767. if (typeof shouldScroll.then === 'function') {
  46768. shouldScroll
  46769. .then(function (shouldScroll) {
  46770. scrollToPosition((shouldScroll), position);
  46771. })
  46772. .catch(function (err) {
  46773. if (true) {
  46774. assert(false, err.toString());
  46775. }
  46776. });
  46777. } else {
  46778. scrollToPosition(shouldScroll, position);
  46779. }
  46780. });
  46781. }
  46782. function saveScrollPosition () {
  46783. var key = getStateKey();
  46784. if (key) {
  46785. positionStore[key] = {
  46786. x: window.pageXOffset,
  46787. y: window.pageYOffset
  46788. };
  46789. }
  46790. }
  46791. function getScrollPosition () {
  46792. var key = getStateKey();
  46793. if (key) {
  46794. return positionStore[key]
  46795. }
  46796. }
  46797. function getElementPosition (el, offset) {
  46798. var docEl = document.documentElement;
  46799. var docRect = docEl.getBoundingClientRect();
  46800. var elRect = el.getBoundingClientRect();
  46801. return {
  46802. x: elRect.left - docRect.left - offset.x,
  46803. y: elRect.top - docRect.top - offset.y
  46804. }
  46805. }
  46806. function isValidPosition (obj) {
  46807. return isNumber(obj.x) || isNumber(obj.y)
  46808. }
  46809. function normalizePosition (obj) {
  46810. return {
  46811. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  46812. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  46813. }
  46814. }
  46815. function normalizeOffset (obj) {
  46816. return {
  46817. x: isNumber(obj.x) ? obj.x : 0,
  46818. y: isNumber(obj.y) ? obj.y : 0
  46819. }
  46820. }
  46821. function isNumber (v) {
  46822. return typeof v === 'number'
  46823. }
  46824. var hashStartsWithNumberRE = /^#\d/;
  46825. function scrollToPosition (shouldScroll, position) {
  46826. var isObject = typeof shouldScroll === 'object';
  46827. if (isObject && typeof shouldScroll.selector === 'string') {
  46828. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  46829. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  46830. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  46831. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  46832. : document.querySelector(shouldScroll.selector);
  46833. if (el) {
  46834. var offset =
  46835. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  46836. ? shouldScroll.offset
  46837. : {};
  46838. offset = normalizeOffset(offset);
  46839. position = getElementPosition(el, offset);
  46840. } else if (isValidPosition(shouldScroll)) {
  46841. position = normalizePosition(shouldScroll);
  46842. }
  46843. } else if (isObject && isValidPosition(shouldScroll)) {
  46844. position = normalizePosition(shouldScroll);
  46845. }
  46846. if (position) {
  46847. window.scrollTo(position.x, position.y);
  46848. }
  46849. }
  46850. /* */
  46851. var supportsPushState =
  46852. inBrowser &&
  46853. (function () {
  46854. var ua = window.navigator.userAgent;
  46855. if (
  46856. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  46857. ua.indexOf('Mobile Safari') !== -1 &&
  46858. ua.indexOf('Chrome') === -1 &&
  46859. ua.indexOf('Windows Phone') === -1
  46860. ) {
  46861. return false
  46862. }
  46863. return window.history && 'pushState' in window.history
  46864. })();
  46865. function pushState (url, replace) {
  46866. saveScrollPosition();
  46867. // try...catch the pushState call to get around Safari
  46868. // DOM Exception 18 where it limits to 100 pushState calls
  46869. var history = window.history;
  46870. try {
  46871. if (replace) {
  46872. // preserve existing history state as it could be overriden by the user
  46873. var stateCopy = extend({}, history.state);
  46874. stateCopy.key = getStateKey();
  46875. history.replaceState(stateCopy, '', url);
  46876. } else {
  46877. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  46878. }
  46879. } catch (e) {
  46880. window.location[replace ? 'replace' : 'assign'](url);
  46881. }
  46882. }
  46883. function replaceState (url) {
  46884. pushState(url, true);
  46885. }
  46886. /* */
  46887. function runQueue (queue, fn, cb) {
  46888. var step = function (index) {
  46889. if (index >= queue.length) {
  46890. cb();
  46891. } else {
  46892. if (queue[index]) {
  46893. fn(queue[index], function () {
  46894. step(index + 1);
  46895. });
  46896. } else {
  46897. step(index + 1);
  46898. }
  46899. }
  46900. };
  46901. step(0);
  46902. }
  46903. /* */
  46904. function resolveAsyncComponents (matched) {
  46905. return function (to, from, next) {
  46906. var hasAsync = false;
  46907. var pending = 0;
  46908. var error = null;
  46909. flatMapComponents(matched, function (def, _, match, key) {
  46910. // if it's a function and doesn't have cid attached,
  46911. // assume it's an async component resolve function.
  46912. // we are not using Vue's default async resolving mechanism because
  46913. // we want to halt the navigation until the incoming component has been
  46914. // resolved.
  46915. if (typeof def === 'function' && def.cid === undefined) {
  46916. hasAsync = true;
  46917. pending++;
  46918. var resolve = once(function (resolvedDef) {
  46919. if (isESModule(resolvedDef)) {
  46920. resolvedDef = resolvedDef.default;
  46921. }
  46922. // save resolved on async factory in case it's used elsewhere
  46923. def.resolved = typeof resolvedDef === 'function'
  46924. ? resolvedDef
  46925. : _Vue.extend(resolvedDef);
  46926. match.components[key] = resolvedDef;
  46927. pending--;
  46928. if (pending <= 0) {
  46929. next();
  46930. }
  46931. });
  46932. var reject = once(function (reason) {
  46933. var msg = "Failed to resolve async component " + key + ": " + reason;
  46934. true && warn(false, msg);
  46935. if (!error) {
  46936. error = isError(reason)
  46937. ? reason
  46938. : new Error(msg);
  46939. next(error);
  46940. }
  46941. });
  46942. var res;
  46943. try {
  46944. res = def(resolve, reject);
  46945. } catch (e) {
  46946. reject(e);
  46947. }
  46948. if (res) {
  46949. if (typeof res.then === 'function') {
  46950. res.then(resolve, reject);
  46951. } else {
  46952. // new syntax in Vue 2.3
  46953. var comp = res.component;
  46954. if (comp && typeof comp.then === 'function') {
  46955. comp.then(resolve, reject);
  46956. }
  46957. }
  46958. }
  46959. }
  46960. });
  46961. if (!hasAsync) { next(); }
  46962. }
  46963. }
  46964. function flatMapComponents (
  46965. matched,
  46966. fn
  46967. ) {
  46968. return flatten(matched.map(function (m) {
  46969. return Object.keys(m.components).map(function (key) { return fn(
  46970. m.components[key],
  46971. m.instances[key],
  46972. m, key
  46973. ); })
  46974. }))
  46975. }
  46976. function flatten (arr) {
  46977. return Array.prototype.concat.apply([], arr)
  46978. }
  46979. var hasSymbol =
  46980. typeof Symbol === 'function' &&
  46981. typeof Symbol.toStringTag === 'symbol';
  46982. function isESModule (obj) {
  46983. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  46984. }
  46985. // in Webpack 2, require.ensure now also returns a Promise
  46986. // so the resolve/reject functions may get called an extra time
  46987. // if the user uses an arrow function shorthand that happens to
  46988. // return that Promise.
  46989. function once (fn) {
  46990. var called = false;
  46991. return function () {
  46992. var args = [], len = arguments.length;
  46993. while ( len-- ) args[ len ] = arguments[ len ];
  46994. if (called) { return }
  46995. called = true;
  46996. return fn.apply(this, args)
  46997. }
  46998. }
  46999. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  47000. function NavigationDuplicated (normalizedLocation) {
  47001. Error.call(this);
  47002. this.name = this._name = 'NavigationDuplicated';
  47003. // passing the message to super() doesn't seem to work in the transpiled version
  47004. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  47005. // add a stack property so services like Sentry can correctly display it
  47006. Object.defineProperty(this, 'stack', {
  47007. value: new Error().stack,
  47008. writable: true,
  47009. configurable: true
  47010. });
  47011. // we could also have used
  47012. // Error.captureStackTrace(this, this.constructor)
  47013. // but it only exists on node and chrome
  47014. }
  47015. if ( Error ) NavigationDuplicated.__proto__ = Error;
  47016. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  47017. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  47018. return NavigationDuplicated;
  47019. }(Error));
  47020. // support IE9
  47021. NavigationDuplicated._name = 'NavigationDuplicated';
  47022. /* */
  47023. var History = function History (router, base) {
  47024. this.router = router;
  47025. this.base = normalizeBase(base);
  47026. // start with a route object that stands for "nowhere"
  47027. this.current = START;
  47028. this.pending = null;
  47029. this.ready = false;
  47030. this.readyCbs = [];
  47031. this.readyErrorCbs = [];
  47032. this.errorCbs = [];
  47033. };
  47034. History.prototype.listen = function listen (cb) {
  47035. this.cb = cb;
  47036. };
  47037. History.prototype.onReady = function onReady (cb, errorCb) {
  47038. if (this.ready) {
  47039. cb();
  47040. } else {
  47041. this.readyCbs.push(cb);
  47042. if (errorCb) {
  47043. this.readyErrorCbs.push(errorCb);
  47044. }
  47045. }
  47046. };
  47047. History.prototype.onError = function onError (errorCb) {
  47048. this.errorCbs.push(errorCb);
  47049. };
  47050. History.prototype.transitionTo = function transitionTo (
  47051. location,
  47052. onComplete,
  47053. onAbort
  47054. ) {
  47055. var this$1 = this;
  47056. var route = this.router.match(location, this.current);
  47057. this.confirmTransition(
  47058. route,
  47059. function () {
  47060. this$1.updateRoute(route);
  47061. onComplete && onComplete(route);
  47062. this$1.ensureURL();
  47063. // fire ready cbs once
  47064. if (!this$1.ready) {
  47065. this$1.ready = true;
  47066. this$1.readyCbs.forEach(function (cb) {
  47067. cb(route);
  47068. });
  47069. }
  47070. },
  47071. function (err) {
  47072. if (onAbort) {
  47073. onAbort(err);
  47074. }
  47075. if (err && !this$1.ready) {
  47076. this$1.ready = true;
  47077. this$1.readyErrorCbs.forEach(function (cb) {
  47078. cb(err);
  47079. });
  47080. }
  47081. }
  47082. );
  47083. };
  47084. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  47085. var this$1 = this;
  47086. var current = this.current;
  47087. var abort = function (err) {
  47088. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  47089. // When the user navigates through history through back/forward buttons
  47090. // we do not want to throw the error. We only throw it if directly calling
  47091. // push/replace. That's why it's not included in isError
  47092. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  47093. if (this$1.errorCbs.length) {
  47094. this$1.errorCbs.forEach(function (cb) {
  47095. cb(err);
  47096. });
  47097. } else {
  47098. warn(false, 'uncaught error during route navigation:');
  47099. console.error(err);
  47100. }
  47101. }
  47102. onAbort && onAbort(err);
  47103. };
  47104. if (
  47105. isSameRoute(route, current) &&
  47106. // in the case the route map has been dynamically appended to
  47107. route.matched.length === current.matched.length
  47108. ) {
  47109. this.ensureURL();
  47110. return abort(new NavigationDuplicated(route))
  47111. }
  47112. var ref = resolveQueue(
  47113. this.current.matched,
  47114. route.matched
  47115. );
  47116. var updated = ref.updated;
  47117. var deactivated = ref.deactivated;
  47118. var activated = ref.activated;
  47119. var queue = [].concat(
  47120. // in-component leave guards
  47121. extractLeaveGuards(deactivated),
  47122. // global before hooks
  47123. this.router.beforeHooks,
  47124. // in-component update hooks
  47125. extractUpdateHooks(updated),
  47126. // in-config enter guards
  47127. activated.map(function (m) { return m.beforeEnter; }),
  47128. // async components
  47129. resolveAsyncComponents(activated)
  47130. );
  47131. this.pending = route;
  47132. var iterator = function (hook, next) {
  47133. if (this$1.pending !== route) {
  47134. return abort()
  47135. }
  47136. try {
  47137. hook(route, current, function (to) {
  47138. if (to === false || isError(to)) {
  47139. // next(false) -> abort navigation, ensure current URL
  47140. this$1.ensureURL(true);
  47141. abort(to);
  47142. } else if (
  47143. typeof to === 'string' ||
  47144. (typeof to === 'object' &&
  47145. (typeof to.path === 'string' || typeof to.name === 'string'))
  47146. ) {
  47147. // next('/') or next({ path: '/' }) -> redirect
  47148. abort();
  47149. if (typeof to === 'object' && to.replace) {
  47150. this$1.replace(to);
  47151. } else {
  47152. this$1.push(to);
  47153. }
  47154. } else {
  47155. // confirm transition and pass on the value
  47156. next(to);
  47157. }
  47158. });
  47159. } catch (e) {
  47160. abort(e);
  47161. }
  47162. };
  47163. runQueue(queue, iterator, function () {
  47164. var postEnterCbs = [];
  47165. var isValid = function () { return this$1.current === route; };
  47166. // wait until async components are resolved before
  47167. // extracting in-component enter guards
  47168. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  47169. var queue = enterGuards.concat(this$1.router.resolveHooks);
  47170. runQueue(queue, iterator, function () {
  47171. if (this$1.pending !== route) {
  47172. return abort()
  47173. }
  47174. this$1.pending = null;
  47175. onComplete(route);
  47176. if (this$1.router.app) {
  47177. this$1.router.app.$nextTick(function () {
  47178. postEnterCbs.forEach(function (cb) {
  47179. cb();
  47180. });
  47181. });
  47182. }
  47183. });
  47184. });
  47185. };
  47186. History.prototype.updateRoute = function updateRoute (route) {
  47187. var prev = this.current;
  47188. this.current = route;
  47189. this.cb && this.cb(route);
  47190. this.router.afterHooks.forEach(function (hook) {
  47191. hook && hook(route, prev);
  47192. });
  47193. };
  47194. function normalizeBase (base) {
  47195. if (!base) {
  47196. if (inBrowser) {
  47197. // respect <base> tag
  47198. var baseEl = document.querySelector('base');
  47199. base = (baseEl && baseEl.getAttribute('href')) || '/';
  47200. // strip full URL origin
  47201. base = base.replace(/^https?:\/\/[^\/]+/, '');
  47202. } else {
  47203. base = '/';
  47204. }
  47205. }
  47206. // make sure there's the starting slash
  47207. if (base.charAt(0) !== '/') {
  47208. base = '/' + base;
  47209. }
  47210. // remove trailing slash
  47211. return base.replace(/\/$/, '')
  47212. }
  47213. function resolveQueue (
  47214. current,
  47215. next
  47216. ) {
  47217. var i;
  47218. var max = Math.max(current.length, next.length);
  47219. for (i = 0; i < max; i++) {
  47220. if (current[i] !== next[i]) {
  47221. break
  47222. }
  47223. }
  47224. return {
  47225. updated: next.slice(0, i),
  47226. activated: next.slice(i),
  47227. deactivated: current.slice(i)
  47228. }
  47229. }
  47230. function extractGuards (
  47231. records,
  47232. name,
  47233. bind,
  47234. reverse
  47235. ) {
  47236. var guards = flatMapComponents(records, function (def, instance, match, key) {
  47237. var guard = extractGuard(def, name);
  47238. if (guard) {
  47239. return Array.isArray(guard)
  47240. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  47241. : bind(guard, instance, match, key)
  47242. }
  47243. });
  47244. return flatten(reverse ? guards.reverse() : guards)
  47245. }
  47246. function extractGuard (
  47247. def,
  47248. key
  47249. ) {
  47250. if (typeof def !== 'function') {
  47251. // extend now so that global mixins are applied.
  47252. def = _Vue.extend(def);
  47253. }
  47254. return def.options[key]
  47255. }
  47256. function extractLeaveGuards (deactivated) {
  47257. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  47258. }
  47259. function extractUpdateHooks (updated) {
  47260. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  47261. }
  47262. function bindGuard (guard, instance) {
  47263. if (instance) {
  47264. return function boundRouteGuard () {
  47265. return guard.apply(instance, arguments)
  47266. }
  47267. }
  47268. }
  47269. function extractEnterGuards (
  47270. activated,
  47271. cbs,
  47272. isValid
  47273. ) {
  47274. return extractGuards(
  47275. activated,
  47276. 'beforeRouteEnter',
  47277. function (guard, _, match, key) {
  47278. return bindEnterGuard(guard, match, key, cbs, isValid)
  47279. }
  47280. )
  47281. }
  47282. function bindEnterGuard (
  47283. guard,
  47284. match,
  47285. key,
  47286. cbs,
  47287. isValid
  47288. ) {
  47289. return function routeEnterGuard (to, from, next) {
  47290. return guard(to, from, function (cb) {
  47291. if (typeof cb === 'function') {
  47292. cbs.push(function () {
  47293. // #750
  47294. // if a router-view is wrapped with an out-in transition,
  47295. // the instance may not have been registered at this time.
  47296. // we will need to poll for registration until current route
  47297. // is no longer valid.
  47298. poll(cb, match.instances, key, isValid);
  47299. });
  47300. }
  47301. next(cb);
  47302. })
  47303. }
  47304. }
  47305. function poll (
  47306. cb, // somehow flow cannot infer this is a function
  47307. instances,
  47308. key,
  47309. isValid
  47310. ) {
  47311. if (
  47312. instances[key] &&
  47313. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  47314. ) {
  47315. cb(instances[key]);
  47316. } else if (isValid()) {
  47317. setTimeout(function () {
  47318. poll(cb, instances, key, isValid);
  47319. }, 16);
  47320. }
  47321. }
  47322. /* */
  47323. var HTML5History = /*@__PURE__*/(function (History) {
  47324. function HTML5History (router, base) {
  47325. var this$1 = this;
  47326. History.call(this, router, base);
  47327. var expectScroll = router.options.scrollBehavior;
  47328. var supportsScroll = supportsPushState && expectScroll;
  47329. if (supportsScroll) {
  47330. setupScroll();
  47331. }
  47332. var initLocation = getLocation(this.base);
  47333. window.addEventListener('popstate', function (e) {
  47334. var current = this$1.current;
  47335. // Avoiding first `popstate` event dispatched in some browsers but first
  47336. // history route not updated since async guard at the same time.
  47337. var location = getLocation(this$1.base);
  47338. if (this$1.current === START && location === initLocation) {
  47339. return
  47340. }
  47341. this$1.transitionTo(location, function (route) {
  47342. if (supportsScroll) {
  47343. handleScroll(router, route, current, true);
  47344. }
  47345. });
  47346. });
  47347. }
  47348. if ( History ) HTML5History.__proto__ = History;
  47349. HTML5History.prototype = Object.create( History && History.prototype );
  47350. HTML5History.prototype.constructor = HTML5History;
  47351. HTML5History.prototype.go = function go (n) {
  47352. window.history.go(n);
  47353. };
  47354. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  47355. var this$1 = this;
  47356. var ref = this;
  47357. var fromRoute = ref.current;
  47358. this.transitionTo(location, function (route) {
  47359. pushState(cleanPath(this$1.base + route.fullPath));
  47360. handleScroll(this$1.router, route, fromRoute, false);
  47361. onComplete && onComplete(route);
  47362. }, onAbort);
  47363. };
  47364. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  47365. var this$1 = this;
  47366. var ref = this;
  47367. var fromRoute = ref.current;
  47368. this.transitionTo(location, function (route) {
  47369. replaceState(cleanPath(this$1.base + route.fullPath));
  47370. handleScroll(this$1.router, route, fromRoute, false);
  47371. onComplete && onComplete(route);
  47372. }, onAbort);
  47373. };
  47374. HTML5History.prototype.ensureURL = function ensureURL (push) {
  47375. if (getLocation(this.base) !== this.current.fullPath) {
  47376. var current = cleanPath(this.base + this.current.fullPath);
  47377. push ? pushState(current) : replaceState(current);
  47378. }
  47379. };
  47380. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  47381. return getLocation(this.base)
  47382. };
  47383. return HTML5History;
  47384. }(History));
  47385. function getLocation (base) {
  47386. var path = decodeURI(window.location.pathname);
  47387. if (base && path.indexOf(base) === 0) {
  47388. path = path.slice(base.length);
  47389. }
  47390. return (path || '/') + window.location.search + window.location.hash
  47391. }
  47392. /* */
  47393. var HashHistory = /*@__PURE__*/(function (History) {
  47394. function HashHistory (router, base, fallback) {
  47395. History.call(this, router, base);
  47396. // check history fallback deeplinking
  47397. if (fallback && checkFallback(this.base)) {
  47398. return
  47399. }
  47400. ensureSlash();
  47401. }
  47402. if ( History ) HashHistory.__proto__ = History;
  47403. HashHistory.prototype = Object.create( History && History.prototype );
  47404. HashHistory.prototype.constructor = HashHistory;
  47405. // this is delayed until the app mounts
  47406. // to avoid the hashchange listener being fired too early
  47407. HashHistory.prototype.setupListeners = function setupListeners () {
  47408. var this$1 = this;
  47409. var router = this.router;
  47410. var expectScroll = router.options.scrollBehavior;
  47411. var supportsScroll = supportsPushState && expectScroll;
  47412. if (supportsScroll) {
  47413. setupScroll();
  47414. }
  47415. window.addEventListener(
  47416. supportsPushState ? 'popstate' : 'hashchange',
  47417. function () {
  47418. var current = this$1.current;
  47419. if (!ensureSlash()) {
  47420. return
  47421. }
  47422. this$1.transitionTo(getHash(), function (route) {
  47423. if (supportsScroll) {
  47424. handleScroll(this$1.router, route, current, true);
  47425. }
  47426. if (!supportsPushState) {
  47427. replaceHash(route.fullPath);
  47428. }
  47429. });
  47430. }
  47431. );
  47432. };
  47433. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  47434. var this$1 = this;
  47435. var ref = this;
  47436. var fromRoute = ref.current;
  47437. this.transitionTo(
  47438. location,
  47439. function (route) {
  47440. pushHash(route.fullPath);
  47441. handleScroll(this$1.router, route, fromRoute, false);
  47442. onComplete && onComplete(route);
  47443. },
  47444. onAbort
  47445. );
  47446. };
  47447. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  47448. var this$1 = this;
  47449. var ref = this;
  47450. var fromRoute = ref.current;
  47451. this.transitionTo(
  47452. location,
  47453. function (route) {
  47454. replaceHash(route.fullPath);
  47455. handleScroll(this$1.router, route, fromRoute, false);
  47456. onComplete && onComplete(route);
  47457. },
  47458. onAbort
  47459. );
  47460. };
  47461. HashHistory.prototype.go = function go (n) {
  47462. window.history.go(n);
  47463. };
  47464. HashHistory.prototype.ensureURL = function ensureURL (push) {
  47465. var current = this.current.fullPath;
  47466. if (getHash() !== current) {
  47467. push ? pushHash(current) : replaceHash(current);
  47468. }
  47469. };
  47470. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  47471. return getHash()
  47472. };
  47473. return HashHistory;
  47474. }(History));
  47475. function checkFallback (base) {
  47476. var location = getLocation(base);
  47477. if (!/^\/#/.test(location)) {
  47478. window.location.replace(cleanPath(base + '/#' + location));
  47479. return true
  47480. }
  47481. }
  47482. function ensureSlash () {
  47483. var path = getHash();
  47484. if (path.charAt(0) === '/') {
  47485. return true
  47486. }
  47487. replaceHash('/' + path);
  47488. return false
  47489. }
  47490. function getHash () {
  47491. // We can't use window.location.hash here because it's not
  47492. // consistent across browsers - Firefox will pre-decode it!
  47493. var href = window.location.href;
  47494. var index = href.indexOf('#');
  47495. // empty path
  47496. if (index < 0) { return '' }
  47497. href = href.slice(index + 1);
  47498. // decode the hash but not the search or hash
  47499. // as search(query) is already decoded
  47500. // https://github.com/vuejs/vue-router/issues/2708
  47501. var searchIndex = href.indexOf('?');
  47502. if (searchIndex < 0) {
  47503. var hashIndex = href.indexOf('#');
  47504. if (hashIndex > -1) {
  47505. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  47506. } else { href = decodeURI(href); }
  47507. } else {
  47508. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  47509. }
  47510. return href
  47511. }
  47512. function getUrl (path) {
  47513. var href = window.location.href;
  47514. var i = href.indexOf('#');
  47515. var base = i >= 0 ? href.slice(0, i) : href;
  47516. return (base + "#" + path)
  47517. }
  47518. function pushHash (path) {
  47519. if (supportsPushState) {
  47520. pushState(getUrl(path));
  47521. } else {
  47522. window.location.hash = path;
  47523. }
  47524. }
  47525. function replaceHash (path) {
  47526. if (supportsPushState) {
  47527. replaceState(getUrl(path));
  47528. } else {
  47529. window.location.replace(getUrl(path));
  47530. }
  47531. }
  47532. /* */
  47533. var AbstractHistory = /*@__PURE__*/(function (History) {
  47534. function AbstractHistory (router, base) {
  47535. History.call(this, router, base);
  47536. this.stack = [];
  47537. this.index = -1;
  47538. }
  47539. if ( History ) AbstractHistory.__proto__ = History;
  47540. AbstractHistory.prototype = Object.create( History && History.prototype );
  47541. AbstractHistory.prototype.constructor = AbstractHistory;
  47542. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  47543. var this$1 = this;
  47544. this.transitionTo(
  47545. location,
  47546. function (route) {
  47547. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  47548. this$1.index++;
  47549. onComplete && onComplete(route);
  47550. },
  47551. onAbort
  47552. );
  47553. };
  47554. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  47555. var this$1 = this;
  47556. this.transitionTo(
  47557. location,
  47558. function (route) {
  47559. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  47560. onComplete && onComplete(route);
  47561. },
  47562. onAbort
  47563. );
  47564. };
  47565. AbstractHistory.prototype.go = function go (n) {
  47566. var this$1 = this;
  47567. var targetIndex = this.index + n;
  47568. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  47569. return
  47570. }
  47571. var route = this.stack[targetIndex];
  47572. this.confirmTransition(
  47573. route,
  47574. function () {
  47575. this$1.index = targetIndex;
  47576. this$1.updateRoute(route);
  47577. },
  47578. function (err) {
  47579. if (isExtendedError(NavigationDuplicated, err)) {
  47580. this$1.index = targetIndex;
  47581. }
  47582. }
  47583. );
  47584. };
  47585. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  47586. var current = this.stack[this.stack.length - 1];
  47587. return current ? current.fullPath : '/'
  47588. };
  47589. AbstractHistory.prototype.ensureURL = function ensureURL () {
  47590. // noop
  47591. };
  47592. return AbstractHistory;
  47593. }(History));
  47594. /* */
  47595. var VueRouter = function VueRouter (options) {
  47596. if ( options === void 0 ) options = {};
  47597. this.app = null;
  47598. this.apps = [];
  47599. this.options = options;
  47600. this.beforeHooks = [];
  47601. this.resolveHooks = [];
  47602. this.afterHooks = [];
  47603. this.matcher = createMatcher(options.routes || [], this);
  47604. var mode = options.mode || 'hash';
  47605. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  47606. if (this.fallback) {
  47607. mode = 'hash';
  47608. }
  47609. if (!inBrowser) {
  47610. mode = 'abstract';
  47611. }
  47612. this.mode = mode;
  47613. switch (mode) {
  47614. case 'history':
  47615. this.history = new HTML5History(this, options.base);
  47616. break
  47617. case 'hash':
  47618. this.history = new HashHistory(this, options.base, this.fallback);
  47619. break
  47620. case 'abstract':
  47621. this.history = new AbstractHistory(this, options.base);
  47622. break
  47623. default:
  47624. if (true) {
  47625. assert(false, ("invalid mode: " + mode));
  47626. }
  47627. }
  47628. };
  47629. var prototypeAccessors = { currentRoute: { configurable: true } };
  47630. VueRouter.prototype.match = function match (
  47631. raw,
  47632. current,
  47633. redirectedFrom
  47634. ) {
  47635. return this.matcher.match(raw, current, redirectedFrom)
  47636. };
  47637. prototypeAccessors.currentRoute.get = function () {
  47638. return this.history && this.history.current
  47639. };
  47640. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  47641. var this$1 = this;
  47642. true && assert(
  47643. install.installed,
  47644. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  47645. "before creating root instance."
  47646. );
  47647. this.apps.push(app);
  47648. // set up app destroyed handler
  47649. // https://github.com/vuejs/vue-router/issues/2639
  47650. app.$once('hook:destroyed', function () {
  47651. // clean out app from this.apps array once destroyed
  47652. var index = this$1.apps.indexOf(app);
  47653. if (index > -1) { this$1.apps.splice(index, 1); }
  47654. // ensure we still have a main app or null if no apps
  47655. // we do not release the router so it can be reused
  47656. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  47657. });
  47658. // main app previously initialized
  47659. // return as we don't need to set up new history listener
  47660. if (this.app) {
  47661. return
  47662. }
  47663. this.app = app;
  47664. var history = this.history;
  47665. if (history instanceof HTML5History) {
  47666. history.transitionTo(history.getCurrentLocation());
  47667. } else if (history instanceof HashHistory) {
  47668. var setupHashListener = function () {
  47669. history.setupListeners();
  47670. };
  47671. history.transitionTo(
  47672. history.getCurrentLocation(),
  47673. setupHashListener,
  47674. setupHashListener
  47675. );
  47676. }
  47677. history.listen(function (route) {
  47678. this$1.apps.forEach(function (app) {
  47679. app._route = route;
  47680. });
  47681. });
  47682. };
  47683. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  47684. return registerHook(this.beforeHooks, fn)
  47685. };
  47686. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  47687. return registerHook(this.resolveHooks, fn)
  47688. };
  47689. VueRouter.prototype.afterEach = function afterEach (fn) {
  47690. return registerHook(this.afterHooks, fn)
  47691. };
  47692. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  47693. this.history.onReady(cb, errorCb);
  47694. };
  47695. VueRouter.prototype.onError = function onError (errorCb) {
  47696. this.history.onError(errorCb);
  47697. };
  47698. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  47699. var this$1 = this;
  47700. // $flow-disable-line
  47701. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47702. return new Promise(function (resolve, reject) {
  47703. this$1.history.push(location, resolve, reject);
  47704. })
  47705. } else {
  47706. this.history.push(location, onComplete, onAbort);
  47707. }
  47708. };
  47709. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  47710. var this$1 = this;
  47711. // $flow-disable-line
  47712. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  47713. return new Promise(function (resolve, reject) {
  47714. this$1.history.replace(location, resolve, reject);
  47715. })
  47716. } else {
  47717. this.history.replace(location, onComplete, onAbort);
  47718. }
  47719. };
  47720. VueRouter.prototype.go = function go (n) {
  47721. this.history.go(n);
  47722. };
  47723. VueRouter.prototype.back = function back () {
  47724. this.go(-1);
  47725. };
  47726. VueRouter.prototype.forward = function forward () {
  47727. this.go(1);
  47728. };
  47729. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  47730. var route = to
  47731. ? to.matched
  47732. ? to
  47733. : this.resolve(to).route
  47734. : this.currentRoute;
  47735. if (!route) {
  47736. return []
  47737. }
  47738. return [].concat.apply([], route.matched.map(function (m) {
  47739. return Object.keys(m.components).map(function (key) {
  47740. return m.components[key]
  47741. })
  47742. }))
  47743. };
  47744. VueRouter.prototype.resolve = function resolve (
  47745. to,
  47746. current,
  47747. append
  47748. ) {
  47749. current = current || this.history.current;
  47750. var location = normalizeLocation(
  47751. to,
  47752. current,
  47753. append,
  47754. this
  47755. );
  47756. var route = this.match(location, current);
  47757. var fullPath = route.redirectedFrom || route.fullPath;
  47758. var base = this.history.base;
  47759. var href = createHref(base, fullPath, this.mode);
  47760. return {
  47761. location: location,
  47762. route: route,
  47763. href: href,
  47764. // for backwards compat
  47765. normalizedTo: location,
  47766. resolved: route
  47767. }
  47768. };
  47769. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  47770. this.matcher.addRoutes(routes);
  47771. if (this.history.current !== START) {
  47772. this.history.transitionTo(this.history.getCurrentLocation());
  47773. }
  47774. };
  47775. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  47776. function registerHook (list, fn) {
  47777. list.push(fn);
  47778. return function () {
  47779. var i = list.indexOf(fn);
  47780. if (i > -1) { list.splice(i, 1); }
  47781. }
  47782. }
  47783. function createHref (base, fullPath, mode) {
  47784. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  47785. return base ? cleanPath(base + '/' + path) : path
  47786. }
  47787. VueRouter.install = install;
  47788. VueRouter.version = '3.1.6';
  47789. if (inBrowser && window.Vue) {
  47790. window.Vue.use(VueRouter);
  47791. }
  47792. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  47793. /***/ }),
  47794. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  47795. /*!*************************************************!*\
  47796. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  47797. \*************************************************/
  47798. /*! no static exports found */
  47799. /***/ (function(module, exports, __webpack_require__) {
  47800. "use strict";
  47801. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  47802. * Vue.js v2.6.11
  47803. * (c) 2014-2019 Evan You
  47804. * Released under the MIT License.
  47805. */
  47806. /* */
  47807. var emptyObject = Object.freeze({});
  47808. // These helpers produce better VM code in JS engines due to their
  47809. // explicitness and function inlining.
  47810. function isUndef (v) {
  47811. return v === undefined || v === null
  47812. }
  47813. function isDef (v) {
  47814. return v !== undefined && v !== null
  47815. }
  47816. function isTrue (v) {
  47817. return v === true
  47818. }
  47819. function isFalse (v) {
  47820. return v === false
  47821. }
  47822. /**
  47823. * Check if value is primitive.
  47824. */
  47825. function isPrimitive (value) {
  47826. return (
  47827. typeof value === 'string' ||
  47828. typeof value === 'number' ||
  47829. // $flow-disable-line
  47830. typeof value === 'symbol' ||
  47831. typeof value === 'boolean'
  47832. )
  47833. }
  47834. /**
  47835. * Quick object check - this is primarily used to tell
  47836. * Objects from primitive values when we know the value
  47837. * is a JSON-compliant type.
  47838. */
  47839. function isObject (obj) {
  47840. return obj !== null && typeof obj === 'object'
  47841. }
  47842. /**
  47843. * Get the raw type string of a value, e.g., [object Object].
  47844. */
  47845. var _toString = Object.prototype.toString;
  47846. function toRawType (value) {
  47847. return _toString.call(value).slice(8, -1)
  47848. }
  47849. /**
  47850. * Strict object type check. Only returns true
  47851. * for plain JavaScript objects.
  47852. */
  47853. function isPlainObject (obj) {
  47854. return _toString.call(obj) === '[object Object]'
  47855. }
  47856. function isRegExp (v) {
  47857. return _toString.call(v) === '[object RegExp]'
  47858. }
  47859. /**
  47860. * Check if val is a valid array index.
  47861. */
  47862. function isValidArrayIndex (val) {
  47863. var n = parseFloat(String(val));
  47864. return n >= 0 && Math.floor(n) === n && isFinite(val)
  47865. }
  47866. function isPromise (val) {
  47867. return (
  47868. isDef(val) &&
  47869. typeof val.then === 'function' &&
  47870. typeof val.catch === 'function'
  47871. )
  47872. }
  47873. /**
  47874. * Convert a value to a string that is actually rendered.
  47875. */
  47876. function toString (val) {
  47877. return val == null
  47878. ? ''
  47879. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  47880. ? JSON.stringify(val, null, 2)
  47881. : String(val)
  47882. }
  47883. /**
  47884. * Convert an input value to a number for persistence.
  47885. * If the conversion fails, return original string.
  47886. */
  47887. function toNumber (val) {
  47888. var n = parseFloat(val);
  47889. return isNaN(n) ? val : n
  47890. }
  47891. /**
  47892. * Make a map and return a function for checking if a key
  47893. * is in that map.
  47894. */
  47895. function makeMap (
  47896. str,
  47897. expectsLowerCase
  47898. ) {
  47899. var map = Object.create(null);
  47900. var list = str.split(',');
  47901. for (var i = 0; i < list.length; i++) {
  47902. map[list[i]] = true;
  47903. }
  47904. return expectsLowerCase
  47905. ? function (val) { return map[val.toLowerCase()]; }
  47906. : function (val) { return map[val]; }
  47907. }
  47908. /**
  47909. * Check if a tag is a built-in tag.
  47910. */
  47911. var isBuiltInTag = makeMap('slot,component', true);
  47912. /**
  47913. * Check if an attribute is a reserved attribute.
  47914. */
  47915. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  47916. /**
  47917. * Remove an item from an array.
  47918. */
  47919. function remove (arr, item) {
  47920. if (arr.length) {
  47921. var index = arr.indexOf(item);
  47922. if (index > -1) {
  47923. return arr.splice(index, 1)
  47924. }
  47925. }
  47926. }
  47927. /**
  47928. * Check whether an object has the property.
  47929. */
  47930. var hasOwnProperty = Object.prototype.hasOwnProperty;
  47931. function hasOwn (obj, key) {
  47932. return hasOwnProperty.call(obj, key)
  47933. }
  47934. /**
  47935. * Create a cached version of a pure function.
  47936. */
  47937. function cached (fn) {
  47938. var cache = Object.create(null);
  47939. return (function cachedFn (str) {
  47940. var hit = cache[str];
  47941. return hit || (cache[str] = fn(str))
  47942. })
  47943. }
  47944. /**
  47945. * Camelize a hyphen-delimited string.
  47946. */
  47947. var camelizeRE = /-(\w)/g;
  47948. var camelize = cached(function (str) {
  47949. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  47950. });
  47951. /**
  47952. * Capitalize a string.
  47953. */
  47954. var capitalize = cached(function (str) {
  47955. return str.charAt(0).toUpperCase() + str.slice(1)
  47956. });
  47957. /**
  47958. * Hyphenate a camelCase string.
  47959. */
  47960. var hyphenateRE = /\B([A-Z])/g;
  47961. var hyphenate = cached(function (str) {
  47962. return str.replace(hyphenateRE, '-$1').toLowerCase()
  47963. });
  47964. /**
  47965. * Simple bind polyfill for environments that do not support it,
  47966. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  47967. * since native bind is now performant enough in most browsers.
  47968. * But removing it would mean breaking code that was able to run in
  47969. * PhantomJS 1.x, so this must be kept for backward compatibility.
  47970. */
  47971. /* istanbul ignore next */
  47972. function polyfillBind (fn, ctx) {
  47973. function boundFn (a) {
  47974. var l = arguments.length;
  47975. return l
  47976. ? l > 1
  47977. ? fn.apply(ctx, arguments)
  47978. : fn.call(ctx, a)
  47979. : fn.call(ctx)
  47980. }
  47981. boundFn._length = fn.length;
  47982. return boundFn
  47983. }
  47984. function nativeBind (fn, ctx) {
  47985. return fn.bind(ctx)
  47986. }
  47987. var bind = Function.prototype.bind
  47988. ? nativeBind
  47989. : polyfillBind;
  47990. /**
  47991. * Convert an Array-like object to a real Array.
  47992. */
  47993. function toArray (list, start) {
  47994. start = start || 0;
  47995. var i = list.length - start;
  47996. var ret = new Array(i);
  47997. while (i--) {
  47998. ret[i] = list[i + start];
  47999. }
  48000. return ret
  48001. }
  48002. /**
  48003. * Mix properties into target object.
  48004. */
  48005. function extend (to, _from) {
  48006. for (var key in _from) {
  48007. to[key] = _from[key];
  48008. }
  48009. return to
  48010. }
  48011. /**
  48012. * Merge an Array of Objects into a single Object.
  48013. */
  48014. function toObject (arr) {
  48015. var res = {};
  48016. for (var i = 0; i < arr.length; i++) {
  48017. if (arr[i]) {
  48018. extend(res, arr[i]);
  48019. }
  48020. }
  48021. return res
  48022. }
  48023. /* eslint-disable no-unused-vars */
  48024. /**
  48025. * Perform no operation.
  48026. * Stubbing args to make Flow happy without leaving useless transpiled code
  48027. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  48028. */
  48029. function noop (a, b, c) {}
  48030. /**
  48031. * Always return false.
  48032. */
  48033. var no = function (a, b, c) { return false; };
  48034. /* eslint-enable no-unused-vars */
  48035. /**
  48036. * Return the same value.
  48037. */
  48038. var identity = function (_) { return _; };
  48039. /**
  48040. * Generate a string containing static keys from compiler modules.
  48041. */
  48042. function genStaticKeys (modules) {
  48043. return modules.reduce(function (keys, m) {
  48044. return keys.concat(m.staticKeys || [])
  48045. }, []).join(',')
  48046. }
  48047. /**
  48048. * Check if two values are loosely equal - that is,
  48049. * if they are plain objects, do they have the same shape?
  48050. */
  48051. function looseEqual (a, b) {
  48052. if (a === b) { return true }
  48053. var isObjectA = isObject(a);
  48054. var isObjectB = isObject(b);
  48055. if (isObjectA && isObjectB) {
  48056. try {
  48057. var isArrayA = Array.isArray(a);
  48058. var isArrayB = Array.isArray(b);
  48059. if (isArrayA && isArrayB) {
  48060. return a.length === b.length && a.every(function (e, i) {
  48061. return looseEqual(e, b[i])
  48062. })
  48063. } else if (a instanceof Date && b instanceof Date) {
  48064. return a.getTime() === b.getTime()
  48065. } else if (!isArrayA && !isArrayB) {
  48066. var keysA = Object.keys(a);
  48067. var keysB = Object.keys(b);
  48068. return keysA.length === keysB.length && keysA.every(function (key) {
  48069. return looseEqual(a[key], b[key])
  48070. })
  48071. } else {
  48072. /* istanbul ignore next */
  48073. return false
  48074. }
  48075. } catch (e) {
  48076. /* istanbul ignore next */
  48077. return false
  48078. }
  48079. } else if (!isObjectA && !isObjectB) {
  48080. return String(a) === String(b)
  48081. } else {
  48082. return false
  48083. }
  48084. }
  48085. /**
  48086. * Return the first index at which a loosely equal value can be
  48087. * found in the array (if value is a plain object, the array must
  48088. * contain an object of the same shape), or -1 if it is not present.
  48089. */
  48090. function looseIndexOf (arr, val) {
  48091. for (var i = 0; i < arr.length; i++) {
  48092. if (looseEqual(arr[i], val)) { return i }
  48093. }
  48094. return -1
  48095. }
  48096. /**
  48097. * Ensure a function is called only once.
  48098. */
  48099. function once (fn) {
  48100. var called = false;
  48101. return function () {
  48102. if (!called) {
  48103. called = true;
  48104. fn.apply(this, arguments);
  48105. }
  48106. }
  48107. }
  48108. var SSR_ATTR = 'data-server-rendered';
  48109. var ASSET_TYPES = [
  48110. 'component',
  48111. 'directive',
  48112. 'filter'
  48113. ];
  48114. var LIFECYCLE_HOOKS = [
  48115. 'beforeCreate',
  48116. 'created',
  48117. 'beforeMount',
  48118. 'mounted',
  48119. 'beforeUpdate',
  48120. 'updated',
  48121. 'beforeDestroy',
  48122. 'destroyed',
  48123. 'activated',
  48124. 'deactivated',
  48125. 'errorCaptured',
  48126. 'serverPrefetch'
  48127. ];
  48128. /* */
  48129. var config = ({
  48130. /**
  48131. * Option merge strategies (used in core/util/options)
  48132. */
  48133. // $flow-disable-line
  48134. optionMergeStrategies: Object.create(null),
  48135. /**
  48136. * Whether to suppress warnings.
  48137. */
  48138. silent: false,
  48139. /**
  48140. * Show production mode tip message on boot?
  48141. */
  48142. productionTip: "development" !== 'production',
  48143. /**
  48144. * Whether to enable devtools
  48145. */
  48146. devtools: "development" !== 'production',
  48147. /**
  48148. * Whether to record perf
  48149. */
  48150. performance: false,
  48151. /**
  48152. * Error handler for watcher errors
  48153. */
  48154. errorHandler: null,
  48155. /**
  48156. * Warn handler for watcher warns
  48157. */
  48158. warnHandler: null,
  48159. /**
  48160. * Ignore certain custom elements
  48161. */
  48162. ignoredElements: [],
  48163. /**
  48164. * Custom user key aliases for v-on
  48165. */
  48166. // $flow-disable-line
  48167. keyCodes: Object.create(null),
  48168. /**
  48169. * Check if a tag is reserved so that it cannot be registered as a
  48170. * component. This is platform-dependent and may be overwritten.
  48171. */
  48172. isReservedTag: no,
  48173. /**
  48174. * Check if an attribute is reserved so that it cannot be used as a component
  48175. * prop. This is platform-dependent and may be overwritten.
  48176. */
  48177. isReservedAttr: no,
  48178. /**
  48179. * Check if a tag is an unknown element.
  48180. * Platform-dependent.
  48181. */
  48182. isUnknownElement: no,
  48183. /**
  48184. * Get the namespace of an element
  48185. */
  48186. getTagNamespace: noop,
  48187. /**
  48188. * Parse the real tag name for the specific platform.
  48189. */
  48190. parsePlatformTagName: identity,
  48191. /**
  48192. * Check if an attribute must be bound using property, e.g. value
  48193. * Platform-dependent.
  48194. */
  48195. mustUseProp: no,
  48196. /**
  48197. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  48198. * This will significantly reduce performance if set to false.
  48199. */
  48200. async: true,
  48201. /**
  48202. * Exposed for legacy reasons
  48203. */
  48204. _lifecycleHooks: LIFECYCLE_HOOKS
  48205. });
  48206. /* */
  48207. /**
  48208. * unicode letters used for parsing html tags, component names and property paths.
  48209. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  48210. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  48211. */
  48212. 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/;
  48213. /**
  48214. * Check if a string starts with $ or _
  48215. */
  48216. function isReserved (str) {
  48217. var c = (str + '').charCodeAt(0);
  48218. return c === 0x24 || c === 0x5F
  48219. }
  48220. /**
  48221. * Define a property.
  48222. */
  48223. function def (obj, key, val, enumerable) {
  48224. Object.defineProperty(obj, key, {
  48225. value: val,
  48226. enumerable: !!enumerable,
  48227. writable: true,
  48228. configurable: true
  48229. });
  48230. }
  48231. /**
  48232. * Parse simple path.
  48233. */
  48234. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  48235. function parsePath (path) {
  48236. if (bailRE.test(path)) {
  48237. return
  48238. }
  48239. var segments = path.split('.');
  48240. return function (obj) {
  48241. for (var i = 0; i < segments.length; i++) {
  48242. if (!obj) { return }
  48243. obj = obj[segments[i]];
  48244. }
  48245. return obj
  48246. }
  48247. }
  48248. /* */
  48249. // can we use __proto__?
  48250. var hasProto = '__proto__' in {};
  48251. // Browser environment sniffing
  48252. var inBrowser = typeof window !== 'undefined';
  48253. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  48254. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  48255. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  48256. var isIE = UA && /msie|trident/.test(UA);
  48257. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  48258. var isEdge = UA && UA.indexOf('edge/') > 0;
  48259. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  48260. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  48261. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  48262. var isPhantomJS = UA && /phantomjs/.test(UA);
  48263. var isFF = UA && UA.match(/firefox\/(\d+)/);
  48264. // Firefox has a "watch" function on Object.prototype...
  48265. var nativeWatch = ({}).watch;
  48266. var supportsPassive = false;
  48267. if (inBrowser) {
  48268. try {
  48269. var opts = {};
  48270. Object.defineProperty(opts, 'passive', ({
  48271. get: function get () {
  48272. /* istanbul ignore next */
  48273. supportsPassive = true;
  48274. }
  48275. })); // https://github.com/facebook/flow/issues/285
  48276. window.addEventListener('test-passive', null, opts);
  48277. } catch (e) {}
  48278. }
  48279. // this needs to be lazy-evaled because vue may be required before
  48280. // vue-server-renderer can set VUE_ENV
  48281. var _isServer;
  48282. var isServerRendering = function () {
  48283. if (_isServer === undefined) {
  48284. /* istanbul ignore if */
  48285. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  48286. // detect presence of vue-server-renderer and avoid
  48287. // Webpack shimming the process
  48288. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  48289. } else {
  48290. _isServer = false;
  48291. }
  48292. }
  48293. return _isServer
  48294. };
  48295. // detect devtools
  48296. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  48297. /* istanbul ignore next */
  48298. function isNative (Ctor) {
  48299. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  48300. }
  48301. var hasSymbol =
  48302. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  48303. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  48304. var _Set;
  48305. /* istanbul ignore if */ // $flow-disable-line
  48306. if (typeof Set !== 'undefined' && isNative(Set)) {
  48307. // use native Set when available.
  48308. _Set = Set;
  48309. } else {
  48310. // a non-standard Set polyfill that only works with primitive keys.
  48311. _Set = /*@__PURE__*/(function () {
  48312. function Set () {
  48313. this.set = Object.create(null);
  48314. }
  48315. Set.prototype.has = function has (key) {
  48316. return this.set[key] === true
  48317. };
  48318. Set.prototype.add = function add (key) {
  48319. this.set[key] = true;
  48320. };
  48321. Set.prototype.clear = function clear () {
  48322. this.set = Object.create(null);
  48323. };
  48324. return Set;
  48325. }());
  48326. }
  48327. /* */
  48328. var warn = noop;
  48329. var tip = noop;
  48330. var generateComponentTrace = (noop); // work around flow check
  48331. var formatComponentName = (noop);
  48332. {
  48333. var hasConsole = typeof console !== 'undefined';
  48334. var classifyRE = /(?:^|[-_])(\w)/g;
  48335. var classify = function (str) { return str
  48336. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  48337. .replace(/[-_]/g, ''); };
  48338. warn = function (msg, vm) {
  48339. var trace = vm ? generateComponentTrace(vm) : '';
  48340. if (config.warnHandler) {
  48341. config.warnHandler.call(null, msg, vm, trace);
  48342. } else if (hasConsole && (!config.silent)) {
  48343. console.error(("[Vue warn]: " + msg + trace));
  48344. }
  48345. };
  48346. tip = function (msg, vm) {
  48347. if (hasConsole && (!config.silent)) {
  48348. console.warn("[Vue tip]: " + msg + (
  48349. vm ? generateComponentTrace(vm) : ''
  48350. ));
  48351. }
  48352. };
  48353. formatComponentName = function (vm, includeFile) {
  48354. if (vm.$root === vm) {
  48355. return '<Root>'
  48356. }
  48357. var options = typeof vm === 'function' && vm.cid != null
  48358. ? vm.options
  48359. : vm._isVue
  48360. ? vm.$options || vm.constructor.options
  48361. : vm;
  48362. var name = options.name || options._componentTag;
  48363. var file = options.__file;
  48364. if (!name && file) {
  48365. var match = file.match(/([^/\\]+)\.vue$/);
  48366. name = match && match[1];
  48367. }
  48368. return (
  48369. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  48370. (file && includeFile !== false ? (" at " + file) : '')
  48371. )
  48372. };
  48373. var repeat = function (str, n) {
  48374. var res = '';
  48375. while (n) {
  48376. if (n % 2 === 1) { res += str; }
  48377. if (n > 1) { str += str; }
  48378. n >>= 1;
  48379. }
  48380. return res
  48381. };
  48382. generateComponentTrace = function (vm) {
  48383. if (vm._isVue && vm.$parent) {
  48384. var tree = [];
  48385. var currentRecursiveSequence = 0;
  48386. while (vm) {
  48387. if (tree.length > 0) {
  48388. var last = tree[tree.length - 1];
  48389. if (last.constructor === vm.constructor) {
  48390. currentRecursiveSequence++;
  48391. vm = vm.$parent;
  48392. continue
  48393. } else if (currentRecursiveSequence > 0) {
  48394. tree[tree.length - 1] = [last, currentRecursiveSequence];
  48395. currentRecursiveSequence = 0;
  48396. }
  48397. }
  48398. tree.push(vm);
  48399. vm = vm.$parent;
  48400. }
  48401. return '\n\nfound in\n\n' + tree
  48402. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  48403. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  48404. : formatComponentName(vm))); })
  48405. .join('\n')
  48406. } else {
  48407. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  48408. }
  48409. };
  48410. }
  48411. /* */
  48412. var uid = 0;
  48413. /**
  48414. * A dep is an observable that can have multiple
  48415. * directives subscribing to it.
  48416. */
  48417. var Dep = function Dep () {
  48418. this.id = uid++;
  48419. this.subs = [];
  48420. };
  48421. Dep.prototype.addSub = function addSub (sub) {
  48422. this.subs.push(sub);
  48423. };
  48424. Dep.prototype.removeSub = function removeSub (sub) {
  48425. remove(this.subs, sub);
  48426. };
  48427. Dep.prototype.depend = function depend () {
  48428. if (Dep.target) {
  48429. Dep.target.addDep(this);
  48430. }
  48431. };
  48432. Dep.prototype.notify = function notify () {
  48433. // stabilize the subscriber list first
  48434. var subs = this.subs.slice();
  48435. if (!config.async) {
  48436. // subs aren't sorted in scheduler if not running async
  48437. // we need to sort them now to make sure they fire in correct
  48438. // order
  48439. subs.sort(function (a, b) { return a.id - b.id; });
  48440. }
  48441. for (var i = 0, l = subs.length; i < l; i++) {
  48442. subs[i].update();
  48443. }
  48444. };
  48445. // The current target watcher being evaluated.
  48446. // This is globally unique because only one watcher
  48447. // can be evaluated at a time.
  48448. Dep.target = null;
  48449. var targetStack = [];
  48450. function pushTarget (target) {
  48451. targetStack.push(target);
  48452. Dep.target = target;
  48453. }
  48454. function popTarget () {
  48455. targetStack.pop();
  48456. Dep.target = targetStack[targetStack.length - 1];
  48457. }
  48458. /* */
  48459. var VNode = function VNode (
  48460. tag,
  48461. data,
  48462. children,
  48463. text,
  48464. elm,
  48465. context,
  48466. componentOptions,
  48467. asyncFactory
  48468. ) {
  48469. this.tag = tag;
  48470. this.data = data;
  48471. this.children = children;
  48472. this.text = text;
  48473. this.elm = elm;
  48474. this.ns = undefined;
  48475. this.context = context;
  48476. this.fnContext = undefined;
  48477. this.fnOptions = undefined;
  48478. this.fnScopeId = undefined;
  48479. this.key = data && data.key;
  48480. this.componentOptions = componentOptions;
  48481. this.componentInstance = undefined;
  48482. this.parent = undefined;
  48483. this.raw = false;
  48484. this.isStatic = false;
  48485. this.isRootInsert = true;
  48486. this.isComment = false;
  48487. this.isCloned = false;
  48488. this.isOnce = false;
  48489. this.asyncFactory = asyncFactory;
  48490. this.asyncMeta = undefined;
  48491. this.isAsyncPlaceholder = false;
  48492. };
  48493. var prototypeAccessors = { child: { configurable: true } };
  48494. // DEPRECATED: alias for componentInstance for backwards compat.
  48495. /* istanbul ignore next */
  48496. prototypeAccessors.child.get = function () {
  48497. return this.componentInstance
  48498. };
  48499. Object.defineProperties( VNode.prototype, prototypeAccessors );
  48500. var createEmptyVNode = function (text) {
  48501. if ( text === void 0 ) text = '';
  48502. var node = new VNode();
  48503. node.text = text;
  48504. node.isComment = true;
  48505. return node
  48506. };
  48507. function createTextVNode (val) {
  48508. return new VNode(undefined, undefined, undefined, String(val))
  48509. }
  48510. // optimized shallow clone
  48511. // used for static nodes and slot nodes because they may be reused across
  48512. // multiple renders, cloning them avoids errors when DOM manipulations rely
  48513. // on their elm reference.
  48514. function cloneVNode (vnode) {
  48515. var cloned = new VNode(
  48516. vnode.tag,
  48517. vnode.data,
  48518. // #7975
  48519. // clone children array to avoid mutating original in case of cloning
  48520. // a child.
  48521. vnode.children && vnode.children.slice(),
  48522. vnode.text,
  48523. vnode.elm,
  48524. vnode.context,
  48525. vnode.componentOptions,
  48526. vnode.asyncFactory
  48527. );
  48528. cloned.ns = vnode.ns;
  48529. cloned.isStatic = vnode.isStatic;
  48530. cloned.key = vnode.key;
  48531. cloned.isComment = vnode.isComment;
  48532. cloned.fnContext = vnode.fnContext;
  48533. cloned.fnOptions = vnode.fnOptions;
  48534. cloned.fnScopeId = vnode.fnScopeId;
  48535. cloned.asyncMeta = vnode.asyncMeta;
  48536. cloned.isCloned = true;
  48537. return cloned
  48538. }
  48539. /*
  48540. * not type checking this file because flow doesn't play well with
  48541. * dynamically accessing methods on Array prototype
  48542. */
  48543. var arrayProto = Array.prototype;
  48544. var arrayMethods = Object.create(arrayProto);
  48545. var methodsToPatch = [
  48546. 'push',
  48547. 'pop',
  48548. 'shift',
  48549. 'unshift',
  48550. 'splice',
  48551. 'sort',
  48552. 'reverse'
  48553. ];
  48554. /**
  48555. * Intercept mutating methods and emit events
  48556. */
  48557. methodsToPatch.forEach(function (method) {
  48558. // cache original method
  48559. var original = arrayProto[method];
  48560. def(arrayMethods, method, function mutator () {
  48561. var args = [], len = arguments.length;
  48562. while ( len-- ) args[ len ] = arguments[ len ];
  48563. var result = original.apply(this, args);
  48564. var ob = this.__ob__;
  48565. var inserted;
  48566. switch (method) {
  48567. case 'push':
  48568. case 'unshift':
  48569. inserted = args;
  48570. break
  48571. case 'splice':
  48572. inserted = args.slice(2);
  48573. break
  48574. }
  48575. if (inserted) { ob.observeArray(inserted); }
  48576. // notify change
  48577. ob.dep.notify();
  48578. return result
  48579. });
  48580. });
  48581. /* */
  48582. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  48583. /**
  48584. * In some cases we may want to disable observation inside a component's
  48585. * update computation.
  48586. */
  48587. var shouldObserve = true;
  48588. function toggleObserving (value) {
  48589. shouldObserve = value;
  48590. }
  48591. /**
  48592. * Observer class that is attached to each observed
  48593. * object. Once attached, the observer converts the target
  48594. * object's property keys into getter/setters that
  48595. * collect dependencies and dispatch updates.
  48596. */
  48597. var Observer = function Observer (value) {
  48598. this.value = value;
  48599. this.dep = new Dep();
  48600. this.vmCount = 0;
  48601. def(value, '__ob__', this);
  48602. if (Array.isArray(value)) {
  48603. if (hasProto) {
  48604. protoAugment(value, arrayMethods);
  48605. } else {
  48606. copyAugment(value, arrayMethods, arrayKeys);
  48607. }
  48608. this.observeArray(value);
  48609. } else {
  48610. this.walk(value);
  48611. }
  48612. };
  48613. /**
  48614. * Walk through all properties and convert them into
  48615. * getter/setters. This method should only be called when
  48616. * value type is Object.
  48617. */
  48618. Observer.prototype.walk = function walk (obj) {
  48619. var keys = Object.keys(obj);
  48620. for (var i = 0; i < keys.length; i++) {
  48621. defineReactive$$1(obj, keys[i]);
  48622. }
  48623. };
  48624. /**
  48625. * Observe a list of Array items.
  48626. */
  48627. Observer.prototype.observeArray = function observeArray (items) {
  48628. for (var i = 0, l = items.length; i < l; i++) {
  48629. observe(items[i]);
  48630. }
  48631. };
  48632. // helpers
  48633. /**
  48634. * Augment a target Object or Array by intercepting
  48635. * the prototype chain using __proto__
  48636. */
  48637. function protoAugment (target, src) {
  48638. /* eslint-disable no-proto */
  48639. target.__proto__ = src;
  48640. /* eslint-enable no-proto */
  48641. }
  48642. /**
  48643. * Augment a target Object or Array by defining
  48644. * hidden properties.
  48645. */
  48646. /* istanbul ignore next */
  48647. function copyAugment (target, src, keys) {
  48648. for (var i = 0, l = keys.length; i < l; i++) {
  48649. var key = keys[i];
  48650. def(target, key, src[key]);
  48651. }
  48652. }
  48653. /**
  48654. * Attempt to create an observer instance for a value,
  48655. * returns the new observer if successfully observed,
  48656. * or the existing observer if the value already has one.
  48657. */
  48658. function observe (value, asRootData) {
  48659. if (!isObject(value) || value instanceof VNode) {
  48660. return
  48661. }
  48662. var ob;
  48663. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  48664. ob = value.__ob__;
  48665. } else if (
  48666. shouldObserve &&
  48667. !isServerRendering() &&
  48668. (Array.isArray(value) || isPlainObject(value)) &&
  48669. Object.isExtensible(value) &&
  48670. !value._isVue
  48671. ) {
  48672. ob = new Observer(value);
  48673. }
  48674. if (asRootData && ob) {
  48675. ob.vmCount++;
  48676. }
  48677. return ob
  48678. }
  48679. /**
  48680. * Define a reactive property on an Object.
  48681. */
  48682. function defineReactive$$1 (
  48683. obj,
  48684. key,
  48685. val,
  48686. customSetter,
  48687. shallow
  48688. ) {
  48689. var dep = new Dep();
  48690. var property = Object.getOwnPropertyDescriptor(obj, key);
  48691. if (property && property.configurable === false) {
  48692. return
  48693. }
  48694. // cater for pre-defined getter/setters
  48695. var getter = property && property.get;
  48696. var setter = property && property.set;
  48697. if ((!getter || setter) && arguments.length === 2) {
  48698. val = obj[key];
  48699. }
  48700. var childOb = !shallow && observe(val);
  48701. Object.defineProperty(obj, key, {
  48702. enumerable: true,
  48703. configurable: true,
  48704. get: function reactiveGetter () {
  48705. var value = getter ? getter.call(obj) : val;
  48706. if (Dep.target) {
  48707. dep.depend();
  48708. if (childOb) {
  48709. childOb.dep.depend();
  48710. if (Array.isArray(value)) {
  48711. dependArray(value);
  48712. }
  48713. }
  48714. }
  48715. return value
  48716. },
  48717. set: function reactiveSetter (newVal) {
  48718. var value = getter ? getter.call(obj) : val;
  48719. /* eslint-disable no-self-compare */
  48720. if (newVal === value || (newVal !== newVal && value !== value)) {
  48721. return
  48722. }
  48723. /* eslint-enable no-self-compare */
  48724. if (customSetter) {
  48725. customSetter();
  48726. }
  48727. // #7981: for accessor properties without setter
  48728. if (getter && !setter) { return }
  48729. if (setter) {
  48730. setter.call(obj, newVal);
  48731. } else {
  48732. val = newVal;
  48733. }
  48734. childOb = !shallow && observe(newVal);
  48735. dep.notify();
  48736. }
  48737. });
  48738. }
  48739. /**
  48740. * Set a property on an object. Adds the new property and
  48741. * triggers change notification if the property doesn't
  48742. * already exist.
  48743. */
  48744. function set (target, key, val) {
  48745. if (isUndef(target) || isPrimitive(target)
  48746. ) {
  48747. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  48748. }
  48749. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48750. target.length = Math.max(target.length, key);
  48751. target.splice(key, 1, val);
  48752. return val
  48753. }
  48754. if (key in target && !(key in Object.prototype)) {
  48755. target[key] = val;
  48756. return val
  48757. }
  48758. var ob = (target).__ob__;
  48759. if (target._isVue || (ob && ob.vmCount)) {
  48760. warn(
  48761. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  48762. 'at runtime - declare it upfront in the data option.'
  48763. );
  48764. return val
  48765. }
  48766. if (!ob) {
  48767. target[key] = val;
  48768. return val
  48769. }
  48770. defineReactive$$1(ob.value, key, val);
  48771. ob.dep.notify();
  48772. return val
  48773. }
  48774. /**
  48775. * Delete a property and trigger change if necessary.
  48776. */
  48777. function del (target, key) {
  48778. if (isUndef(target) || isPrimitive(target)
  48779. ) {
  48780. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  48781. }
  48782. if (Array.isArray(target) && isValidArrayIndex(key)) {
  48783. target.splice(key, 1);
  48784. return
  48785. }
  48786. var ob = (target).__ob__;
  48787. if (target._isVue || (ob && ob.vmCount)) {
  48788. warn(
  48789. 'Avoid deleting properties on a Vue instance or its root $data ' +
  48790. '- just set it to null.'
  48791. );
  48792. return
  48793. }
  48794. if (!hasOwn(target, key)) {
  48795. return
  48796. }
  48797. delete target[key];
  48798. if (!ob) {
  48799. return
  48800. }
  48801. ob.dep.notify();
  48802. }
  48803. /**
  48804. * Collect dependencies on array elements when the array is touched, since
  48805. * we cannot intercept array element access like property getters.
  48806. */
  48807. function dependArray (value) {
  48808. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  48809. e = value[i];
  48810. e && e.__ob__ && e.__ob__.dep.depend();
  48811. if (Array.isArray(e)) {
  48812. dependArray(e);
  48813. }
  48814. }
  48815. }
  48816. /* */
  48817. /**
  48818. * Option overwriting strategies are functions that handle
  48819. * how to merge a parent option value and a child option
  48820. * value into the final value.
  48821. */
  48822. var strats = config.optionMergeStrategies;
  48823. /**
  48824. * Options with restrictions
  48825. */
  48826. {
  48827. strats.el = strats.propsData = function (parent, child, vm, key) {
  48828. if (!vm) {
  48829. warn(
  48830. "option \"" + key + "\" can only be used during instance " +
  48831. 'creation with the `new` keyword.'
  48832. );
  48833. }
  48834. return defaultStrat(parent, child)
  48835. };
  48836. }
  48837. /**
  48838. * Helper that recursively merges two data objects together.
  48839. */
  48840. function mergeData (to, from) {
  48841. if (!from) { return to }
  48842. var key, toVal, fromVal;
  48843. var keys = hasSymbol
  48844. ? Reflect.ownKeys(from)
  48845. : Object.keys(from);
  48846. for (var i = 0; i < keys.length; i++) {
  48847. key = keys[i];
  48848. // in case the object is already observed...
  48849. if (key === '__ob__') { continue }
  48850. toVal = to[key];
  48851. fromVal = from[key];
  48852. if (!hasOwn(to, key)) {
  48853. set(to, key, fromVal);
  48854. } else if (
  48855. toVal !== fromVal &&
  48856. isPlainObject(toVal) &&
  48857. isPlainObject(fromVal)
  48858. ) {
  48859. mergeData(toVal, fromVal);
  48860. }
  48861. }
  48862. return to
  48863. }
  48864. /**
  48865. * Data
  48866. */
  48867. function mergeDataOrFn (
  48868. parentVal,
  48869. childVal,
  48870. vm
  48871. ) {
  48872. if (!vm) {
  48873. // in a Vue.extend merge, both should be functions
  48874. if (!childVal) {
  48875. return parentVal
  48876. }
  48877. if (!parentVal) {
  48878. return childVal
  48879. }
  48880. // when parentVal & childVal are both present,
  48881. // we need to return a function that returns the
  48882. // merged result of both functions... no need to
  48883. // check if parentVal is a function here because
  48884. // it has to be a function to pass previous merges.
  48885. return function mergedDataFn () {
  48886. return mergeData(
  48887. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  48888. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  48889. )
  48890. }
  48891. } else {
  48892. return function mergedInstanceDataFn () {
  48893. // instance merge
  48894. var instanceData = typeof childVal === 'function'
  48895. ? childVal.call(vm, vm)
  48896. : childVal;
  48897. var defaultData = typeof parentVal === 'function'
  48898. ? parentVal.call(vm, vm)
  48899. : parentVal;
  48900. if (instanceData) {
  48901. return mergeData(instanceData, defaultData)
  48902. } else {
  48903. return defaultData
  48904. }
  48905. }
  48906. }
  48907. }
  48908. strats.data = function (
  48909. parentVal,
  48910. childVal,
  48911. vm
  48912. ) {
  48913. if (!vm) {
  48914. if (childVal && typeof childVal !== 'function') {
  48915. warn(
  48916. 'The "data" option should be a function ' +
  48917. 'that returns a per-instance value in component ' +
  48918. 'definitions.',
  48919. vm
  48920. );
  48921. return parentVal
  48922. }
  48923. return mergeDataOrFn(parentVal, childVal)
  48924. }
  48925. return mergeDataOrFn(parentVal, childVal, vm)
  48926. };
  48927. /**
  48928. * Hooks and props are merged as arrays.
  48929. */
  48930. function mergeHook (
  48931. parentVal,
  48932. childVal
  48933. ) {
  48934. var res = childVal
  48935. ? parentVal
  48936. ? parentVal.concat(childVal)
  48937. : Array.isArray(childVal)
  48938. ? childVal
  48939. : [childVal]
  48940. : parentVal;
  48941. return res
  48942. ? dedupeHooks(res)
  48943. : res
  48944. }
  48945. function dedupeHooks (hooks) {
  48946. var res = [];
  48947. for (var i = 0; i < hooks.length; i++) {
  48948. if (res.indexOf(hooks[i]) === -1) {
  48949. res.push(hooks[i]);
  48950. }
  48951. }
  48952. return res
  48953. }
  48954. LIFECYCLE_HOOKS.forEach(function (hook) {
  48955. strats[hook] = mergeHook;
  48956. });
  48957. /**
  48958. * Assets
  48959. *
  48960. * When a vm is present (instance creation), we need to do
  48961. * a three-way merge between constructor options, instance
  48962. * options and parent options.
  48963. */
  48964. function mergeAssets (
  48965. parentVal,
  48966. childVal,
  48967. vm,
  48968. key
  48969. ) {
  48970. var res = Object.create(parentVal || null);
  48971. if (childVal) {
  48972. assertObjectType(key, childVal, vm);
  48973. return extend(res, childVal)
  48974. } else {
  48975. return res
  48976. }
  48977. }
  48978. ASSET_TYPES.forEach(function (type) {
  48979. strats[type + 's'] = mergeAssets;
  48980. });
  48981. /**
  48982. * Watchers.
  48983. *
  48984. * Watchers hashes should not overwrite one
  48985. * another, so we merge them as arrays.
  48986. */
  48987. strats.watch = function (
  48988. parentVal,
  48989. childVal,
  48990. vm,
  48991. key
  48992. ) {
  48993. // work around Firefox's Object.prototype.watch...
  48994. if (parentVal === nativeWatch) { parentVal = undefined; }
  48995. if (childVal === nativeWatch) { childVal = undefined; }
  48996. /* istanbul ignore if */
  48997. if (!childVal) { return Object.create(parentVal || null) }
  48998. {
  48999. assertObjectType(key, childVal, vm);
  49000. }
  49001. if (!parentVal) { return childVal }
  49002. var ret = {};
  49003. extend(ret, parentVal);
  49004. for (var key$1 in childVal) {
  49005. var parent = ret[key$1];
  49006. var child = childVal[key$1];
  49007. if (parent && !Array.isArray(parent)) {
  49008. parent = [parent];
  49009. }
  49010. ret[key$1] = parent
  49011. ? parent.concat(child)
  49012. : Array.isArray(child) ? child : [child];
  49013. }
  49014. return ret
  49015. };
  49016. /**
  49017. * Other object hashes.
  49018. */
  49019. strats.props =
  49020. strats.methods =
  49021. strats.inject =
  49022. strats.computed = function (
  49023. parentVal,
  49024. childVal,
  49025. vm,
  49026. key
  49027. ) {
  49028. if (childVal && "development" !== 'production') {
  49029. assertObjectType(key, childVal, vm);
  49030. }
  49031. if (!parentVal) { return childVal }
  49032. var ret = Object.create(null);
  49033. extend(ret, parentVal);
  49034. if (childVal) { extend(ret, childVal); }
  49035. return ret
  49036. };
  49037. strats.provide = mergeDataOrFn;
  49038. /**
  49039. * Default strategy.
  49040. */
  49041. var defaultStrat = function (parentVal, childVal) {
  49042. return childVal === undefined
  49043. ? parentVal
  49044. : childVal
  49045. };
  49046. /**
  49047. * Validate component names
  49048. */
  49049. function checkComponents (options) {
  49050. for (var key in options.components) {
  49051. validateComponentName(key);
  49052. }
  49053. }
  49054. function validateComponentName (name) {
  49055. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  49056. warn(
  49057. 'Invalid component name: "' + name + '". Component names ' +
  49058. 'should conform to valid custom element name in html5 specification.'
  49059. );
  49060. }
  49061. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  49062. warn(
  49063. 'Do not use built-in or reserved HTML elements as component ' +
  49064. 'id: ' + name
  49065. );
  49066. }
  49067. }
  49068. /**
  49069. * Ensure all props option syntax are normalized into the
  49070. * Object-based format.
  49071. */
  49072. function normalizeProps (options, vm) {
  49073. var props = options.props;
  49074. if (!props) { return }
  49075. var res = {};
  49076. var i, val, name;
  49077. if (Array.isArray(props)) {
  49078. i = props.length;
  49079. while (i--) {
  49080. val = props[i];
  49081. if (typeof val === 'string') {
  49082. name = camelize(val);
  49083. res[name] = { type: null };
  49084. } else {
  49085. warn('props must be strings when using array syntax.');
  49086. }
  49087. }
  49088. } else if (isPlainObject(props)) {
  49089. for (var key in props) {
  49090. val = props[key];
  49091. name = camelize(key);
  49092. res[name] = isPlainObject(val)
  49093. ? val
  49094. : { type: val };
  49095. }
  49096. } else {
  49097. warn(
  49098. "Invalid value for option \"props\": expected an Array or an Object, " +
  49099. "but got " + (toRawType(props)) + ".",
  49100. vm
  49101. );
  49102. }
  49103. options.props = res;
  49104. }
  49105. /**
  49106. * Normalize all injections into Object-based format
  49107. */
  49108. function normalizeInject (options, vm) {
  49109. var inject = options.inject;
  49110. if (!inject) { return }
  49111. var normalized = options.inject = {};
  49112. if (Array.isArray(inject)) {
  49113. for (var i = 0; i < inject.length; i++) {
  49114. normalized[inject[i]] = { from: inject[i] };
  49115. }
  49116. } else if (isPlainObject(inject)) {
  49117. for (var key in inject) {
  49118. var val = inject[key];
  49119. normalized[key] = isPlainObject(val)
  49120. ? extend({ from: key }, val)
  49121. : { from: val };
  49122. }
  49123. } else {
  49124. warn(
  49125. "Invalid value for option \"inject\": expected an Array or an Object, " +
  49126. "but got " + (toRawType(inject)) + ".",
  49127. vm
  49128. );
  49129. }
  49130. }
  49131. /**
  49132. * Normalize raw function directives into object format.
  49133. */
  49134. function normalizeDirectives (options) {
  49135. var dirs = options.directives;
  49136. if (dirs) {
  49137. for (var key in dirs) {
  49138. var def$$1 = dirs[key];
  49139. if (typeof def$$1 === 'function') {
  49140. dirs[key] = { bind: def$$1, update: def$$1 };
  49141. }
  49142. }
  49143. }
  49144. }
  49145. function assertObjectType (name, value, vm) {
  49146. if (!isPlainObject(value)) {
  49147. warn(
  49148. "Invalid value for option \"" + name + "\": expected an Object, " +
  49149. "but got " + (toRawType(value)) + ".",
  49150. vm
  49151. );
  49152. }
  49153. }
  49154. /**
  49155. * Merge two option objects into a new one.
  49156. * Core utility used in both instantiation and inheritance.
  49157. */
  49158. function mergeOptions (
  49159. parent,
  49160. child,
  49161. vm
  49162. ) {
  49163. {
  49164. checkComponents(child);
  49165. }
  49166. if (typeof child === 'function') {
  49167. child = child.options;
  49168. }
  49169. normalizeProps(child, vm);
  49170. normalizeInject(child, vm);
  49171. normalizeDirectives(child);
  49172. // Apply extends and mixins on the child options,
  49173. // but only if it is a raw options object that isn't
  49174. // the result of another mergeOptions call.
  49175. // Only merged options has the _base property.
  49176. if (!child._base) {
  49177. if (child.extends) {
  49178. parent = mergeOptions(parent, child.extends, vm);
  49179. }
  49180. if (child.mixins) {
  49181. for (var i = 0, l = child.mixins.length; i < l; i++) {
  49182. parent = mergeOptions(parent, child.mixins[i], vm);
  49183. }
  49184. }
  49185. }
  49186. var options = {};
  49187. var key;
  49188. for (key in parent) {
  49189. mergeField(key);
  49190. }
  49191. for (key in child) {
  49192. if (!hasOwn(parent, key)) {
  49193. mergeField(key);
  49194. }
  49195. }
  49196. function mergeField (key) {
  49197. var strat = strats[key] || defaultStrat;
  49198. options[key] = strat(parent[key], child[key], vm, key);
  49199. }
  49200. return options
  49201. }
  49202. /**
  49203. * Resolve an asset.
  49204. * This function is used because child instances need access
  49205. * to assets defined in its ancestor chain.
  49206. */
  49207. function resolveAsset (
  49208. options,
  49209. type,
  49210. id,
  49211. warnMissing
  49212. ) {
  49213. /* istanbul ignore if */
  49214. if (typeof id !== 'string') {
  49215. return
  49216. }
  49217. var assets = options[type];
  49218. // check local registration variations first
  49219. if (hasOwn(assets, id)) { return assets[id] }
  49220. var camelizedId = camelize(id);
  49221. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  49222. var PascalCaseId = capitalize(camelizedId);
  49223. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  49224. // fallback to prototype chain
  49225. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  49226. if (warnMissing && !res) {
  49227. warn(
  49228. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  49229. options
  49230. );
  49231. }
  49232. return res
  49233. }
  49234. /* */
  49235. function validateProp (
  49236. key,
  49237. propOptions,
  49238. propsData,
  49239. vm
  49240. ) {
  49241. var prop = propOptions[key];
  49242. var absent = !hasOwn(propsData, key);
  49243. var value = propsData[key];
  49244. // boolean casting
  49245. var booleanIndex = getTypeIndex(Boolean, prop.type);
  49246. if (booleanIndex > -1) {
  49247. if (absent && !hasOwn(prop, 'default')) {
  49248. value = false;
  49249. } else if (value === '' || value === hyphenate(key)) {
  49250. // only cast empty string / same name to boolean if
  49251. // boolean has higher priority
  49252. var stringIndex = getTypeIndex(String, prop.type);
  49253. if (stringIndex < 0 || booleanIndex < stringIndex) {
  49254. value = true;
  49255. }
  49256. }
  49257. }
  49258. // check default value
  49259. if (value === undefined) {
  49260. value = getPropDefaultValue(vm, prop, key);
  49261. // since the default value is a fresh copy,
  49262. // make sure to observe it.
  49263. var prevShouldObserve = shouldObserve;
  49264. toggleObserving(true);
  49265. observe(value);
  49266. toggleObserving(prevShouldObserve);
  49267. }
  49268. {
  49269. assertProp(prop, key, value, vm, absent);
  49270. }
  49271. return value
  49272. }
  49273. /**
  49274. * Get the default value of a prop.
  49275. */
  49276. function getPropDefaultValue (vm, prop, key) {
  49277. // no default, return undefined
  49278. if (!hasOwn(prop, 'default')) {
  49279. return undefined
  49280. }
  49281. var def = prop.default;
  49282. // warn against non-factory defaults for Object & Array
  49283. if (isObject(def)) {
  49284. warn(
  49285. 'Invalid default value for prop "' + key + '": ' +
  49286. 'Props with type Object/Array must use a factory function ' +
  49287. 'to return the default value.',
  49288. vm
  49289. );
  49290. }
  49291. // the raw prop value was also undefined from previous render,
  49292. // return previous default value to avoid unnecessary watcher trigger
  49293. if (vm && vm.$options.propsData &&
  49294. vm.$options.propsData[key] === undefined &&
  49295. vm._props[key] !== undefined
  49296. ) {
  49297. return vm._props[key]
  49298. }
  49299. // call factory function for non-Function types
  49300. // a value is Function if its prototype is function even across different execution context
  49301. return typeof def === 'function' && getType(prop.type) !== 'Function'
  49302. ? def.call(vm)
  49303. : def
  49304. }
  49305. /**
  49306. * Assert whether a prop is valid.
  49307. */
  49308. function assertProp (
  49309. prop,
  49310. name,
  49311. value,
  49312. vm,
  49313. absent
  49314. ) {
  49315. if (prop.required && absent) {
  49316. warn(
  49317. 'Missing required prop: "' + name + '"',
  49318. vm
  49319. );
  49320. return
  49321. }
  49322. if (value == null && !prop.required) {
  49323. return
  49324. }
  49325. var type = prop.type;
  49326. var valid = !type || type === true;
  49327. var expectedTypes = [];
  49328. if (type) {
  49329. if (!Array.isArray(type)) {
  49330. type = [type];
  49331. }
  49332. for (var i = 0; i < type.length && !valid; i++) {
  49333. var assertedType = assertType(value, type[i]);
  49334. expectedTypes.push(assertedType.expectedType || '');
  49335. valid = assertedType.valid;
  49336. }
  49337. }
  49338. if (!valid) {
  49339. warn(
  49340. getInvalidTypeMessage(name, value, expectedTypes),
  49341. vm
  49342. );
  49343. return
  49344. }
  49345. var validator = prop.validator;
  49346. if (validator) {
  49347. if (!validator(value)) {
  49348. warn(
  49349. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  49350. vm
  49351. );
  49352. }
  49353. }
  49354. }
  49355. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  49356. function assertType (value, type) {
  49357. var valid;
  49358. var expectedType = getType(type);
  49359. if (simpleCheckRE.test(expectedType)) {
  49360. var t = typeof value;
  49361. valid = t === expectedType.toLowerCase();
  49362. // for primitive wrapper objects
  49363. if (!valid && t === 'object') {
  49364. valid = value instanceof type;
  49365. }
  49366. } else if (expectedType === 'Object') {
  49367. valid = isPlainObject(value);
  49368. } else if (expectedType === 'Array') {
  49369. valid = Array.isArray(value);
  49370. } else {
  49371. valid = value instanceof type;
  49372. }
  49373. return {
  49374. valid: valid,
  49375. expectedType: expectedType
  49376. }
  49377. }
  49378. /**
  49379. * Use function string name to check built-in types,
  49380. * because a simple equality check will fail when running
  49381. * across different vms / iframes.
  49382. */
  49383. function getType (fn) {
  49384. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  49385. return match ? match[1] : ''
  49386. }
  49387. function isSameType (a, b) {
  49388. return getType(a) === getType(b)
  49389. }
  49390. function getTypeIndex (type, expectedTypes) {
  49391. if (!Array.isArray(expectedTypes)) {
  49392. return isSameType(expectedTypes, type) ? 0 : -1
  49393. }
  49394. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  49395. if (isSameType(expectedTypes[i], type)) {
  49396. return i
  49397. }
  49398. }
  49399. return -1
  49400. }
  49401. function getInvalidTypeMessage (name, value, expectedTypes) {
  49402. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  49403. " Expected " + (expectedTypes.map(capitalize).join(', '));
  49404. var expectedType = expectedTypes[0];
  49405. var receivedType = toRawType(value);
  49406. var expectedValue = styleValue(value, expectedType);
  49407. var receivedValue = styleValue(value, receivedType);
  49408. // check if we need to specify expected value
  49409. if (expectedTypes.length === 1 &&
  49410. isExplicable(expectedType) &&
  49411. !isBoolean(expectedType, receivedType)) {
  49412. message += " with value " + expectedValue;
  49413. }
  49414. message += ", got " + receivedType + " ";
  49415. // check if we need to specify received value
  49416. if (isExplicable(receivedType)) {
  49417. message += "with value " + receivedValue + ".";
  49418. }
  49419. return message
  49420. }
  49421. function styleValue (value, type) {
  49422. if (type === 'String') {
  49423. return ("\"" + value + "\"")
  49424. } else if (type === 'Number') {
  49425. return ("" + (Number(value)))
  49426. } else {
  49427. return ("" + value)
  49428. }
  49429. }
  49430. function isExplicable (value) {
  49431. var explicitTypes = ['string', 'number', 'boolean'];
  49432. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  49433. }
  49434. function isBoolean () {
  49435. var args = [], len = arguments.length;
  49436. while ( len-- ) args[ len ] = arguments[ len ];
  49437. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  49438. }
  49439. /* */
  49440. function handleError (err, vm, info) {
  49441. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  49442. // See: https://github.com/vuejs/vuex/issues/1505
  49443. pushTarget();
  49444. try {
  49445. if (vm) {
  49446. var cur = vm;
  49447. while ((cur = cur.$parent)) {
  49448. var hooks = cur.$options.errorCaptured;
  49449. if (hooks) {
  49450. for (var i = 0; i < hooks.length; i++) {
  49451. try {
  49452. var capture = hooks[i].call(cur, err, vm, info) === false;
  49453. if (capture) { return }
  49454. } catch (e) {
  49455. globalHandleError(e, cur, 'errorCaptured hook');
  49456. }
  49457. }
  49458. }
  49459. }
  49460. }
  49461. globalHandleError(err, vm, info);
  49462. } finally {
  49463. popTarget();
  49464. }
  49465. }
  49466. function invokeWithErrorHandling (
  49467. handler,
  49468. context,
  49469. args,
  49470. vm,
  49471. info
  49472. ) {
  49473. var res;
  49474. try {
  49475. res = args ? handler.apply(context, args) : handler.call(context);
  49476. if (res && !res._isVue && isPromise(res) && !res._handled) {
  49477. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  49478. // issue #9511
  49479. // avoid catch triggering multiple times when nested calls
  49480. res._handled = true;
  49481. }
  49482. } catch (e) {
  49483. handleError(e, vm, info);
  49484. }
  49485. return res
  49486. }
  49487. function globalHandleError (err, vm, info) {
  49488. if (config.errorHandler) {
  49489. try {
  49490. return config.errorHandler.call(null, err, vm, info)
  49491. } catch (e) {
  49492. // if the user intentionally throws the original error in the handler,
  49493. // do not log it twice
  49494. if (e !== err) {
  49495. logError(e, null, 'config.errorHandler');
  49496. }
  49497. }
  49498. }
  49499. logError(err, vm, info);
  49500. }
  49501. function logError (err, vm, info) {
  49502. {
  49503. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  49504. }
  49505. /* istanbul ignore else */
  49506. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  49507. console.error(err);
  49508. } else {
  49509. throw err
  49510. }
  49511. }
  49512. /* */
  49513. var isUsingMicroTask = false;
  49514. var callbacks = [];
  49515. var pending = false;
  49516. function flushCallbacks () {
  49517. pending = false;
  49518. var copies = callbacks.slice(0);
  49519. callbacks.length = 0;
  49520. for (var i = 0; i < copies.length; i++) {
  49521. copies[i]();
  49522. }
  49523. }
  49524. // Here we have async deferring wrappers using microtasks.
  49525. // In 2.5 we used (macro) tasks (in combination with microtasks).
  49526. // However, it has subtle problems when state is changed right before repaint
  49527. // (e.g. #6813, out-in transitions).
  49528. // Also, using (macro) tasks in event handler would cause some weird behaviors
  49529. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  49530. // So we now use microtasks everywhere, again.
  49531. // A major drawback of this tradeoff is that there are some scenarios
  49532. // where microtasks have too high a priority and fire in between supposedly
  49533. // sequential events (e.g. #4521, #6690, which have workarounds)
  49534. // or even between bubbling of the same event (#6566).
  49535. var timerFunc;
  49536. // The nextTick behavior leverages the microtask queue, which can be accessed
  49537. // via either native Promise.then or MutationObserver.
  49538. // MutationObserver has wider support, however it is seriously bugged in
  49539. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  49540. // completely stops working after triggering a few times... so, if native
  49541. // Promise is available, we will use it:
  49542. /* istanbul ignore next, $flow-disable-line */
  49543. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  49544. var p = Promise.resolve();
  49545. timerFunc = function () {
  49546. p.then(flushCallbacks);
  49547. // In problematic UIWebViews, Promise.then doesn't completely break, but
  49548. // it can get stuck in a weird state where callbacks are pushed into the
  49549. // microtask queue but the queue isn't being flushed, until the browser
  49550. // needs to do some other work, e.g. handle a timer. Therefore we can
  49551. // "force" the microtask queue to be flushed by adding an empty timer.
  49552. if (isIOS) { setTimeout(noop); }
  49553. };
  49554. isUsingMicroTask = true;
  49555. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  49556. isNative(MutationObserver) ||
  49557. // PhantomJS and iOS 7.x
  49558. MutationObserver.toString() === '[object MutationObserverConstructor]'
  49559. )) {
  49560. // Use MutationObserver where native Promise is not available,
  49561. // e.g. PhantomJS, iOS7, Android 4.4
  49562. // (#6466 MutationObserver is unreliable in IE11)
  49563. var counter = 1;
  49564. var observer = new MutationObserver(flushCallbacks);
  49565. var textNode = document.createTextNode(String(counter));
  49566. observer.observe(textNode, {
  49567. characterData: true
  49568. });
  49569. timerFunc = function () {
  49570. counter = (counter + 1) % 2;
  49571. textNode.data = String(counter);
  49572. };
  49573. isUsingMicroTask = true;
  49574. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  49575. // Fallback to setImmediate.
  49576. // Technically it leverages the (macro) task queue,
  49577. // but it is still a better choice than setTimeout.
  49578. timerFunc = function () {
  49579. setImmediate(flushCallbacks);
  49580. };
  49581. } else {
  49582. // Fallback to setTimeout.
  49583. timerFunc = function () {
  49584. setTimeout(flushCallbacks, 0);
  49585. };
  49586. }
  49587. function nextTick (cb, ctx) {
  49588. var _resolve;
  49589. callbacks.push(function () {
  49590. if (cb) {
  49591. try {
  49592. cb.call(ctx);
  49593. } catch (e) {
  49594. handleError(e, ctx, 'nextTick');
  49595. }
  49596. } else if (_resolve) {
  49597. _resolve(ctx);
  49598. }
  49599. });
  49600. if (!pending) {
  49601. pending = true;
  49602. timerFunc();
  49603. }
  49604. // $flow-disable-line
  49605. if (!cb && typeof Promise !== 'undefined') {
  49606. return new Promise(function (resolve) {
  49607. _resolve = resolve;
  49608. })
  49609. }
  49610. }
  49611. /* */
  49612. var mark;
  49613. var measure;
  49614. {
  49615. var perf = inBrowser && window.performance;
  49616. /* istanbul ignore if */
  49617. if (
  49618. perf &&
  49619. perf.mark &&
  49620. perf.measure &&
  49621. perf.clearMarks &&
  49622. perf.clearMeasures
  49623. ) {
  49624. mark = function (tag) { return perf.mark(tag); };
  49625. measure = function (name, startTag, endTag) {
  49626. perf.measure(name, startTag, endTag);
  49627. perf.clearMarks(startTag);
  49628. perf.clearMarks(endTag);
  49629. // perf.clearMeasures(name)
  49630. };
  49631. }
  49632. }
  49633. /* not type checking this file because flow doesn't play well with Proxy */
  49634. var initProxy;
  49635. {
  49636. var allowedGlobals = makeMap(
  49637. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  49638. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  49639. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  49640. 'require' // for Webpack/Browserify
  49641. );
  49642. var warnNonPresent = function (target, key) {
  49643. warn(
  49644. "Property or method \"" + key + "\" is not defined on the instance but " +
  49645. 'referenced during render. Make sure that this property is reactive, ' +
  49646. 'either in the data option, or for class-based components, by ' +
  49647. 'initializing the property. ' +
  49648. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  49649. target
  49650. );
  49651. };
  49652. var warnReservedPrefix = function (target, key) {
  49653. warn(
  49654. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  49655. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  49656. 'prevent conflicts with Vue internals. ' +
  49657. 'See: https://vuejs.org/v2/api/#data',
  49658. target
  49659. );
  49660. };
  49661. var hasProxy =
  49662. typeof Proxy !== 'undefined' && isNative(Proxy);
  49663. if (hasProxy) {
  49664. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  49665. config.keyCodes = new Proxy(config.keyCodes, {
  49666. set: function set (target, key, value) {
  49667. if (isBuiltInModifier(key)) {
  49668. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  49669. return false
  49670. } else {
  49671. target[key] = value;
  49672. return true
  49673. }
  49674. }
  49675. });
  49676. }
  49677. var hasHandler = {
  49678. has: function has (target, key) {
  49679. var has = key in target;
  49680. var isAllowed = allowedGlobals(key) ||
  49681. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  49682. if (!has && !isAllowed) {
  49683. if (key in target.$data) { warnReservedPrefix(target, key); }
  49684. else { warnNonPresent(target, key); }
  49685. }
  49686. return has || !isAllowed
  49687. }
  49688. };
  49689. var getHandler = {
  49690. get: function get (target, key) {
  49691. if (typeof key === 'string' && !(key in target)) {
  49692. if (key in target.$data) { warnReservedPrefix(target, key); }
  49693. else { warnNonPresent(target, key); }
  49694. }
  49695. return target[key]
  49696. }
  49697. };
  49698. initProxy = function initProxy (vm) {
  49699. if (hasProxy) {
  49700. // determine which proxy handler to use
  49701. var options = vm.$options;
  49702. var handlers = options.render && options.render._withStripped
  49703. ? getHandler
  49704. : hasHandler;
  49705. vm._renderProxy = new Proxy(vm, handlers);
  49706. } else {
  49707. vm._renderProxy = vm;
  49708. }
  49709. };
  49710. }
  49711. /* */
  49712. var seenObjects = new _Set();
  49713. /**
  49714. * Recursively traverse an object to evoke all converted
  49715. * getters, so that every nested property inside the object
  49716. * is collected as a "deep" dependency.
  49717. */
  49718. function traverse (val) {
  49719. _traverse(val, seenObjects);
  49720. seenObjects.clear();
  49721. }
  49722. function _traverse (val, seen) {
  49723. var i, keys;
  49724. var isA = Array.isArray(val);
  49725. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  49726. return
  49727. }
  49728. if (val.__ob__) {
  49729. var depId = val.__ob__.dep.id;
  49730. if (seen.has(depId)) {
  49731. return
  49732. }
  49733. seen.add(depId);
  49734. }
  49735. if (isA) {
  49736. i = val.length;
  49737. while (i--) { _traverse(val[i], seen); }
  49738. } else {
  49739. keys = Object.keys(val);
  49740. i = keys.length;
  49741. while (i--) { _traverse(val[keys[i]], seen); }
  49742. }
  49743. }
  49744. /* */
  49745. var normalizeEvent = cached(function (name) {
  49746. var passive = name.charAt(0) === '&';
  49747. name = passive ? name.slice(1) : name;
  49748. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  49749. name = once$$1 ? name.slice(1) : name;
  49750. var capture = name.charAt(0) === '!';
  49751. name = capture ? name.slice(1) : name;
  49752. return {
  49753. name: name,
  49754. once: once$$1,
  49755. capture: capture,
  49756. passive: passive
  49757. }
  49758. });
  49759. function createFnInvoker (fns, vm) {
  49760. function invoker () {
  49761. var arguments$1 = arguments;
  49762. var fns = invoker.fns;
  49763. if (Array.isArray(fns)) {
  49764. var cloned = fns.slice();
  49765. for (var i = 0; i < cloned.length; i++) {
  49766. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  49767. }
  49768. } else {
  49769. // return handler return value for single handlers
  49770. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  49771. }
  49772. }
  49773. invoker.fns = fns;
  49774. return invoker
  49775. }
  49776. function updateListeners (
  49777. on,
  49778. oldOn,
  49779. add,
  49780. remove$$1,
  49781. createOnceHandler,
  49782. vm
  49783. ) {
  49784. var name, def$$1, cur, old, event;
  49785. for (name in on) {
  49786. def$$1 = cur = on[name];
  49787. old = oldOn[name];
  49788. event = normalizeEvent(name);
  49789. if (isUndef(cur)) {
  49790. warn(
  49791. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  49792. vm
  49793. );
  49794. } else if (isUndef(old)) {
  49795. if (isUndef(cur.fns)) {
  49796. cur = on[name] = createFnInvoker(cur, vm);
  49797. }
  49798. if (isTrue(event.once)) {
  49799. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  49800. }
  49801. add(event.name, cur, event.capture, event.passive, event.params);
  49802. } else if (cur !== old) {
  49803. old.fns = cur;
  49804. on[name] = old;
  49805. }
  49806. }
  49807. for (name in oldOn) {
  49808. if (isUndef(on[name])) {
  49809. event = normalizeEvent(name);
  49810. remove$$1(event.name, oldOn[name], event.capture);
  49811. }
  49812. }
  49813. }
  49814. /* */
  49815. function mergeVNodeHook (def, hookKey, hook) {
  49816. if (def instanceof VNode) {
  49817. def = def.data.hook || (def.data.hook = {});
  49818. }
  49819. var invoker;
  49820. var oldHook = def[hookKey];
  49821. function wrappedHook () {
  49822. hook.apply(this, arguments);
  49823. // important: remove merged hook to ensure it's called only once
  49824. // and prevent memory leak
  49825. remove(invoker.fns, wrappedHook);
  49826. }
  49827. if (isUndef(oldHook)) {
  49828. // no existing hook
  49829. invoker = createFnInvoker([wrappedHook]);
  49830. } else {
  49831. /* istanbul ignore if */
  49832. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  49833. // already a merged invoker
  49834. invoker = oldHook;
  49835. invoker.fns.push(wrappedHook);
  49836. } else {
  49837. // existing plain hook
  49838. invoker = createFnInvoker([oldHook, wrappedHook]);
  49839. }
  49840. }
  49841. invoker.merged = true;
  49842. def[hookKey] = invoker;
  49843. }
  49844. /* */
  49845. function extractPropsFromVNodeData (
  49846. data,
  49847. Ctor,
  49848. tag
  49849. ) {
  49850. // we are only extracting raw values here.
  49851. // validation and default values are handled in the child
  49852. // component itself.
  49853. var propOptions = Ctor.options.props;
  49854. if (isUndef(propOptions)) {
  49855. return
  49856. }
  49857. var res = {};
  49858. var attrs = data.attrs;
  49859. var props = data.props;
  49860. if (isDef(attrs) || isDef(props)) {
  49861. for (var key in propOptions) {
  49862. var altKey = hyphenate(key);
  49863. {
  49864. var keyInLowerCase = key.toLowerCase();
  49865. if (
  49866. key !== keyInLowerCase &&
  49867. attrs && hasOwn(attrs, keyInLowerCase)
  49868. ) {
  49869. tip(
  49870. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  49871. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  49872. " \"" + key + "\". " +
  49873. "Note that HTML attributes are case-insensitive and camelCased " +
  49874. "props need to use their kebab-case equivalents when using in-DOM " +
  49875. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  49876. );
  49877. }
  49878. }
  49879. checkProp(res, props, key, altKey, true) ||
  49880. checkProp(res, attrs, key, altKey, false);
  49881. }
  49882. }
  49883. return res
  49884. }
  49885. function checkProp (
  49886. res,
  49887. hash,
  49888. key,
  49889. altKey,
  49890. preserve
  49891. ) {
  49892. if (isDef(hash)) {
  49893. if (hasOwn(hash, key)) {
  49894. res[key] = hash[key];
  49895. if (!preserve) {
  49896. delete hash[key];
  49897. }
  49898. return true
  49899. } else if (hasOwn(hash, altKey)) {
  49900. res[key] = hash[altKey];
  49901. if (!preserve) {
  49902. delete hash[altKey];
  49903. }
  49904. return true
  49905. }
  49906. }
  49907. return false
  49908. }
  49909. /* */
  49910. // The template compiler attempts to minimize the need for normalization by
  49911. // statically analyzing the template at compile time.
  49912. //
  49913. // For plain HTML markup, normalization can be completely skipped because the
  49914. // generated render function is guaranteed to return Array<VNode>. There are
  49915. // two cases where extra normalization is needed:
  49916. // 1. When the children contains components - because a functional component
  49917. // may return an Array instead of a single root. In this case, just a simple
  49918. // normalization is needed - if any child is an Array, we flatten the whole
  49919. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  49920. // because functional components already normalize their own children.
  49921. function simpleNormalizeChildren (children) {
  49922. for (var i = 0; i < children.length; i++) {
  49923. if (Array.isArray(children[i])) {
  49924. return Array.prototype.concat.apply([], children)
  49925. }
  49926. }
  49927. return children
  49928. }
  49929. // 2. When the children contains constructs that always generated nested Arrays,
  49930. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  49931. // with hand-written render functions / JSX. In such cases a full normalization
  49932. // is needed to cater to all possible types of children values.
  49933. function normalizeChildren (children) {
  49934. return isPrimitive(children)
  49935. ? [createTextVNode(children)]
  49936. : Array.isArray(children)
  49937. ? normalizeArrayChildren(children)
  49938. : undefined
  49939. }
  49940. function isTextNode (node) {
  49941. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  49942. }
  49943. function normalizeArrayChildren (children, nestedIndex) {
  49944. var res = [];
  49945. var i, c, lastIndex, last;
  49946. for (i = 0; i < children.length; i++) {
  49947. c = children[i];
  49948. if (isUndef(c) || typeof c === 'boolean') { continue }
  49949. lastIndex = res.length - 1;
  49950. last = res[lastIndex];
  49951. // nested
  49952. if (Array.isArray(c)) {
  49953. if (c.length > 0) {
  49954. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  49955. // merge adjacent text nodes
  49956. if (isTextNode(c[0]) && isTextNode(last)) {
  49957. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  49958. c.shift();
  49959. }
  49960. res.push.apply(res, c);
  49961. }
  49962. } else if (isPrimitive(c)) {
  49963. if (isTextNode(last)) {
  49964. // merge adjacent text nodes
  49965. // this is necessary for SSR hydration because text nodes are
  49966. // essentially merged when rendered to HTML strings
  49967. res[lastIndex] = createTextVNode(last.text + c);
  49968. } else if (c !== '') {
  49969. // convert primitive to vnode
  49970. res.push(createTextVNode(c));
  49971. }
  49972. } else {
  49973. if (isTextNode(c) && isTextNode(last)) {
  49974. // merge adjacent text nodes
  49975. res[lastIndex] = createTextVNode(last.text + c.text);
  49976. } else {
  49977. // default key for nested array children (likely generated by v-for)
  49978. if (isTrue(children._isVList) &&
  49979. isDef(c.tag) &&
  49980. isUndef(c.key) &&
  49981. isDef(nestedIndex)) {
  49982. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  49983. }
  49984. res.push(c);
  49985. }
  49986. }
  49987. }
  49988. return res
  49989. }
  49990. /* */
  49991. function initProvide (vm) {
  49992. var provide = vm.$options.provide;
  49993. if (provide) {
  49994. vm._provided = typeof provide === 'function'
  49995. ? provide.call(vm)
  49996. : provide;
  49997. }
  49998. }
  49999. function initInjections (vm) {
  50000. var result = resolveInject(vm.$options.inject, vm);
  50001. if (result) {
  50002. toggleObserving(false);
  50003. Object.keys(result).forEach(function (key) {
  50004. /* istanbul ignore else */
  50005. {
  50006. defineReactive$$1(vm, key, result[key], function () {
  50007. warn(
  50008. "Avoid mutating an injected value directly since the changes will be " +
  50009. "overwritten whenever the provided component re-renders. " +
  50010. "injection being mutated: \"" + key + "\"",
  50011. vm
  50012. );
  50013. });
  50014. }
  50015. });
  50016. toggleObserving(true);
  50017. }
  50018. }
  50019. function resolveInject (inject, vm) {
  50020. if (inject) {
  50021. // inject is :any because flow is not smart enough to figure out cached
  50022. var result = Object.create(null);
  50023. var keys = hasSymbol
  50024. ? Reflect.ownKeys(inject)
  50025. : Object.keys(inject);
  50026. for (var i = 0; i < keys.length; i++) {
  50027. var key = keys[i];
  50028. // #6574 in case the inject object is observed...
  50029. if (key === '__ob__') { continue }
  50030. var provideKey = inject[key].from;
  50031. var source = vm;
  50032. while (source) {
  50033. if (source._provided && hasOwn(source._provided, provideKey)) {
  50034. result[key] = source._provided[provideKey];
  50035. break
  50036. }
  50037. source = source.$parent;
  50038. }
  50039. if (!source) {
  50040. if ('default' in inject[key]) {
  50041. var provideDefault = inject[key].default;
  50042. result[key] = typeof provideDefault === 'function'
  50043. ? provideDefault.call(vm)
  50044. : provideDefault;
  50045. } else {
  50046. warn(("Injection \"" + key + "\" not found"), vm);
  50047. }
  50048. }
  50049. }
  50050. return result
  50051. }
  50052. }
  50053. /* */
  50054. /**
  50055. * Runtime helper for resolving raw children VNodes into a slot object.
  50056. */
  50057. function resolveSlots (
  50058. children,
  50059. context
  50060. ) {
  50061. if (!children || !children.length) {
  50062. return {}
  50063. }
  50064. var slots = {};
  50065. for (var i = 0, l = children.length; i < l; i++) {
  50066. var child = children[i];
  50067. var data = child.data;
  50068. // remove slot attribute if the node is resolved as a Vue slot node
  50069. if (data && data.attrs && data.attrs.slot) {
  50070. delete data.attrs.slot;
  50071. }
  50072. // named slots should only be respected if the vnode was rendered in the
  50073. // same context.
  50074. if ((child.context === context || child.fnContext === context) &&
  50075. data && data.slot != null
  50076. ) {
  50077. var name = data.slot;
  50078. var slot = (slots[name] || (slots[name] = []));
  50079. if (child.tag === 'template') {
  50080. slot.push.apply(slot, child.children || []);
  50081. } else {
  50082. slot.push(child);
  50083. }
  50084. } else {
  50085. (slots.default || (slots.default = [])).push(child);
  50086. }
  50087. }
  50088. // ignore slots that contains only whitespace
  50089. for (var name$1 in slots) {
  50090. if (slots[name$1].every(isWhitespace)) {
  50091. delete slots[name$1];
  50092. }
  50093. }
  50094. return slots
  50095. }
  50096. function isWhitespace (node) {
  50097. return (node.isComment && !node.asyncFactory) || node.text === ' '
  50098. }
  50099. /* */
  50100. function normalizeScopedSlots (
  50101. slots,
  50102. normalSlots,
  50103. prevSlots
  50104. ) {
  50105. var res;
  50106. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  50107. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  50108. var key = slots && slots.$key;
  50109. if (!slots) {
  50110. res = {};
  50111. } else if (slots._normalized) {
  50112. // fast path 1: child component re-render only, parent did not change
  50113. return slots._normalized
  50114. } else if (
  50115. isStable &&
  50116. prevSlots &&
  50117. prevSlots !== emptyObject &&
  50118. key === prevSlots.$key &&
  50119. !hasNormalSlots &&
  50120. !prevSlots.$hasNormal
  50121. ) {
  50122. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  50123. // only need to normalize once
  50124. return prevSlots
  50125. } else {
  50126. res = {};
  50127. for (var key$1 in slots) {
  50128. if (slots[key$1] && key$1[0] !== '$') {
  50129. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  50130. }
  50131. }
  50132. }
  50133. // expose normal slots on scopedSlots
  50134. for (var key$2 in normalSlots) {
  50135. if (!(key$2 in res)) {
  50136. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  50137. }
  50138. }
  50139. // avoriaz seems to mock a non-extensible $scopedSlots object
  50140. // and when that is passed down this would cause an error
  50141. if (slots && Object.isExtensible(slots)) {
  50142. (slots)._normalized = res;
  50143. }
  50144. def(res, '$stable', isStable);
  50145. def(res, '$key', key);
  50146. def(res, '$hasNormal', hasNormalSlots);
  50147. return res
  50148. }
  50149. function normalizeScopedSlot(normalSlots, key, fn) {
  50150. var normalized = function () {
  50151. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  50152. res = res && typeof res === 'object' && !Array.isArray(res)
  50153. ? [res] // single vnode
  50154. : normalizeChildren(res);
  50155. return res && (
  50156. res.length === 0 ||
  50157. (res.length === 1 && res[0].isComment) // #9658
  50158. ) ? undefined
  50159. : res
  50160. };
  50161. // this is a slot using the new v-slot syntax without scope. although it is
  50162. // compiled as a scoped slot, render fn users would expect it to be present
  50163. // on this.$slots because the usage is semantically a normal slot.
  50164. if (fn.proxy) {
  50165. Object.defineProperty(normalSlots, key, {
  50166. get: normalized,
  50167. enumerable: true,
  50168. configurable: true
  50169. });
  50170. }
  50171. return normalized
  50172. }
  50173. function proxyNormalSlot(slots, key) {
  50174. return function () { return slots[key]; }
  50175. }
  50176. /* */
  50177. /**
  50178. * Runtime helper for rendering v-for lists.
  50179. */
  50180. function renderList (
  50181. val,
  50182. render
  50183. ) {
  50184. var ret, i, l, keys, key;
  50185. if (Array.isArray(val) || typeof val === 'string') {
  50186. ret = new Array(val.length);
  50187. for (i = 0, l = val.length; i < l; i++) {
  50188. ret[i] = render(val[i], i);
  50189. }
  50190. } else if (typeof val === 'number') {
  50191. ret = new Array(val);
  50192. for (i = 0; i < val; i++) {
  50193. ret[i] = render(i + 1, i);
  50194. }
  50195. } else if (isObject(val)) {
  50196. if (hasSymbol && val[Symbol.iterator]) {
  50197. ret = [];
  50198. var iterator = val[Symbol.iterator]();
  50199. var result = iterator.next();
  50200. while (!result.done) {
  50201. ret.push(render(result.value, ret.length));
  50202. result = iterator.next();
  50203. }
  50204. } else {
  50205. keys = Object.keys(val);
  50206. ret = new Array(keys.length);
  50207. for (i = 0, l = keys.length; i < l; i++) {
  50208. key = keys[i];
  50209. ret[i] = render(val[key], key, i);
  50210. }
  50211. }
  50212. }
  50213. if (!isDef(ret)) {
  50214. ret = [];
  50215. }
  50216. (ret)._isVList = true;
  50217. return ret
  50218. }
  50219. /* */
  50220. /**
  50221. * Runtime helper for rendering <slot>
  50222. */
  50223. function renderSlot (
  50224. name,
  50225. fallback,
  50226. props,
  50227. bindObject
  50228. ) {
  50229. var scopedSlotFn = this.$scopedSlots[name];
  50230. var nodes;
  50231. if (scopedSlotFn) { // scoped slot
  50232. props = props || {};
  50233. if (bindObject) {
  50234. if (!isObject(bindObject)) {
  50235. warn(
  50236. 'slot v-bind without argument expects an Object',
  50237. this
  50238. );
  50239. }
  50240. props = extend(extend({}, bindObject), props);
  50241. }
  50242. nodes = scopedSlotFn(props) || fallback;
  50243. } else {
  50244. nodes = this.$slots[name] || fallback;
  50245. }
  50246. var target = props && props.slot;
  50247. if (target) {
  50248. return this.$createElement('template', { slot: target }, nodes)
  50249. } else {
  50250. return nodes
  50251. }
  50252. }
  50253. /* */
  50254. /**
  50255. * Runtime helper for resolving filters
  50256. */
  50257. function resolveFilter (id) {
  50258. return resolveAsset(this.$options, 'filters', id, true) || identity
  50259. }
  50260. /* */
  50261. function isKeyNotMatch (expect, actual) {
  50262. if (Array.isArray(expect)) {
  50263. return expect.indexOf(actual) === -1
  50264. } else {
  50265. return expect !== actual
  50266. }
  50267. }
  50268. /**
  50269. * Runtime helper for checking keyCodes from config.
  50270. * exposed as Vue.prototype._k
  50271. * passing in eventKeyName as last argument separately for backwards compat
  50272. */
  50273. function checkKeyCodes (
  50274. eventKeyCode,
  50275. key,
  50276. builtInKeyCode,
  50277. eventKeyName,
  50278. builtInKeyName
  50279. ) {
  50280. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  50281. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  50282. return isKeyNotMatch(builtInKeyName, eventKeyName)
  50283. } else if (mappedKeyCode) {
  50284. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  50285. } else if (eventKeyName) {
  50286. return hyphenate(eventKeyName) !== key
  50287. }
  50288. }
  50289. /* */
  50290. /**
  50291. * Runtime helper for merging v-bind="object" into a VNode's data.
  50292. */
  50293. function bindObjectProps (
  50294. data,
  50295. tag,
  50296. value,
  50297. asProp,
  50298. isSync
  50299. ) {
  50300. if (value) {
  50301. if (!isObject(value)) {
  50302. warn(
  50303. 'v-bind without argument expects an Object or Array value',
  50304. this
  50305. );
  50306. } else {
  50307. if (Array.isArray(value)) {
  50308. value = toObject(value);
  50309. }
  50310. var hash;
  50311. var loop = function ( key ) {
  50312. if (
  50313. key === 'class' ||
  50314. key === 'style' ||
  50315. isReservedAttribute(key)
  50316. ) {
  50317. hash = data;
  50318. } else {
  50319. var type = data.attrs && data.attrs.type;
  50320. hash = asProp || config.mustUseProp(tag, type, key)
  50321. ? data.domProps || (data.domProps = {})
  50322. : data.attrs || (data.attrs = {});
  50323. }
  50324. var camelizedKey = camelize(key);
  50325. var hyphenatedKey = hyphenate(key);
  50326. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  50327. hash[key] = value[key];
  50328. if (isSync) {
  50329. var on = data.on || (data.on = {});
  50330. on[("update:" + key)] = function ($event) {
  50331. value[key] = $event;
  50332. };
  50333. }
  50334. }
  50335. };
  50336. for (var key in value) loop( key );
  50337. }
  50338. }
  50339. return data
  50340. }
  50341. /* */
  50342. /**
  50343. * Runtime helper for rendering static trees.
  50344. */
  50345. function renderStatic (
  50346. index,
  50347. isInFor
  50348. ) {
  50349. var cached = this._staticTrees || (this._staticTrees = []);
  50350. var tree = cached[index];
  50351. // if has already-rendered static tree and not inside v-for,
  50352. // we can reuse the same tree.
  50353. if (tree && !isInFor) {
  50354. return tree
  50355. }
  50356. // otherwise, render a fresh tree.
  50357. tree = cached[index] = this.$options.staticRenderFns[index].call(
  50358. this._renderProxy,
  50359. null,
  50360. this // for render fns generated for functional component templates
  50361. );
  50362. markStatic(tree, ("__static__" + index), false);
  50363. return tree
  50364. }
  50365. /**
  50366. * Runtime helper for v-once.
  50367. * Effectively it means marking the node as static with a unique key.
  50368. */
  50369. function markOnce (
  50370. tree,
  50371. index,
  50372. key
  50373. ) {
  50374. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  50375. return tree
  50376. }
  50377. function markStatic (
  50378. tree,
  50379. key,
  50380. isOnce
  50381. ) {
  50382. if (Array.isArray(tree)) {
  50383. for (var i = 0; i < tree.length; i++) {
  50384. if (tree[i] && typeof tree[i] !== 'string') {
  50385. markStaticNode(tree[i], (key + "_" + i), isOnce);
  50386. }
  50387. }
  50388. } else {
  50389. markStaticNode(tree, key, isOnce);
  50390. }
  50391. }
  50392. function markStaticNode (node, key, isOnce) {
  50393. node.isStatic = true;
  50394. node.key = key;
  50395. node.isOnce = isOnce;
  50396. }
  50397. /* */
  50398. function bindObjectListeners (data, value) {
  50399. if (value) {
  50400. if (!isPlainObject(value)) {
  50401. warn(
  50402. 'v-on without argument expects an Object value',
  50403. this
  50404. );
  50405. } else {
  50406. var on = data.on = data.on ? extend({}, data.on) : {};
  50407. for (var key in value) {
  50408. var existing = on[key];
  50409. var ours = value[key];
  50410. on[key] = existing ? [].concat(existing, ours) : ours;
  50411. }
  50412. }
  50413. }
  50414. return data
  50415. }
  50416. /* */
  50417. function resolveScopedSlots (
  50418. fns, // see flow/vnode
  50419. res,
  50420. // the following are added in 2.6
  50421. hasDynamicKeys,
  50422. contentHashKey
  50423. ) {
  50424. res = res || { $stable: !hasDynamicKeys };
  50425. for (var i = 0; i < fns.length; i++) {
  50426. var slot = fns[i];
  50427. if (Array.isArray(slot)) {
  50428. resolveScopedSlots(slot, res, hasDynamicKeys);
  50429. } else if (slot) {
  50430. // marker for reverse proxying v-slot without scope on this.$slots
  50431. if (slot.proxy) {
  50432. slot.fn.proxy = true;
  50433. }
  50434. res[slot.key] = slot.fn;
  50435. }
  50436. }
  50437. if (contentHashKey) {
  50438. (res).$key = contentHashKey;
  50439. }
  50440. return res
  50441. }
  50442. /* */
  50443. function bindDynamicKeys (baseObj, values) {
  50444. for (var i = 0; i < values.length; i += 2) {
  50445. var key = values[i];
  50446. if (typeof key === 'string' && key) {
  50447. baseObj[values[i]] = values[i + 1];
  50448. } else if (key !== '' && key !== null) {
  50449. // null is a special value for explicitly removing a binding
  50450. warn(
  50451. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  50452. this
  50453. );
  50454. }
  50455. }
  50456. return baseObj
  50457. }
  50458. // helper to dynamically append modifier runtime markers to event names.
  50459. // ensure only append when value is already string, otherwise it will be cast
  50460. // to string and cause the type check to miss.
  50461. function prependModifier (value, symbol) {
  50462. return typeof value === 'string' ? symbol + value : value
  50463. }
  50464. /* */
  50465. function installRenderHelpers (target) {
  50466. target._o = markOnce;
  50467. target._n = toNumber;
  50468. target._s = toString;
  50469. target._l = renderList;
  50470. target._t = renderSlot;
  50471. target._q = looseEqual;
  50472. target._i = looseIndexOf;
  50473. target._m = renderStatic;
  50474. target._f = resolveFilter;
  50475. target._k = checkKeyCodes;
  50476. target._b = bindObjectProps;
  50477. target._v = createTextVNode;
  50478. target._e = createEmptyVNode;
  50479. target._u = resolveScopedSlots;
  50480. target._g = bindObjectListeners;
  50481. target._d = bindDynamicKeys;
  50482. target._p = prependModifier;
  50483. }
  50484. /* */
  50485. function FunctionalRenderContext (
  50486. data,
  50487. props,
  50488. children,
  50489. parent,
  50490. Ctor
  50491. ) {
  50492. var this$1 = this;
  50493. var options = Ctor.options;
  50494. // ensure the createElement function in functional components
  50495. // gets a unique context - this is necessary for correct named slot check
  50496. var contextVm;
  50497. if (hasOwn(parent, '_uid')) {
  50498. contextVm = Object.create(parent);
  50499. // $flow-disable-line
  50500. contextVm._original = parent;
  50501. } else {
  50502. // the context vm passed in is a functional context as well.
  50503. // in this case we want to make sure we are able to get a hold to the
  50504. // real context instance.
  50505. contextVm = parent;
  50506. // $flow-disable-line
  50507. parent = parent._original;
  50508. }
  50509. var isCompiled = isTrue(options._compiled);
  50510. var needNormalization = !isCompiled;
  50511. this.data = data;
  50512. this.props = props;
  50513. this.children = children;
  50514. this.parent = parent;
  50515. this.listeners = data.on || emptyObject;
  50516. this.injections = resolveInject(options.inject, parent);
  50517. this.slots = function () {
  50518. if (!this$1.$slots) {
  50519. normalizeScopedSlots(
  50520. data.scopedSlots,
  50521. this$1.$slots = resolveSlots(children, parent)
  50522. );
  50523. }
  50524. return this$1.$slots
  50525. };
  50526. Object.defineProperty(this, 'scopedSlots', ({
  50527. enumerable: true,
  50528. get: function get () {
  50529. return normalizeScopedSlots(data.scopedSlots, this.slots())
  50530. }
  50531. }));
  50532. // support for compiled functional template
  50533. if (isCompiled) {
  50534. // exposing $options for renderStatic()
  50535. this.$options = options;
  50536. // pre-resolve slots for renderSlot()
  50537. this.$slots = this.slots();
  50538. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  50539. }
  50540. if (options._scopeId) {
  50541. this._c = function (a, b, c, d) {
  50542. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  50543. if (vnode && !Array.isArray(vnode)) {
  50544. vnode.fnScopeId = options._scopeId;
  50545. vnode.fnContext = parent;
  50546. }
  50547. return vnode
  50548. };
  50549. } else {
  50550. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  50551. }
  50552. }
  50553. installRenderHelpers(FunctionalRenderContext.prototype);
  50554. function createFunctionalComponent (
  50555. Ctor,
  50556. propsData,
  50557. data,
  50558. contextVm,
  50559. children
  50560. ) {
  50561. var options = Ctor.options;
  50562. var props = {};
  50563. var propOptions = options.props;
  50564. if (isDef(propOptions)) {
  50565. for (var key in propOptions) {
  50566. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  50567. }
  50568. } else {
  50569. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  50570. if (isDef(data.props)) { mergeProps(props, data.props); }
  50571. }
  50572. var renderContext = new FunctionalRenderContext(
  50573. data,
  50574. props,
  50575. children,
  50576. contextVm,
  50577. Ctor
  50578. );
  50579. var vnode = options.render.call(null, renderContext._c, renderContext);
  50580. if (vnode instanceof VNode) {
  50581. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  50582. } else if (Array.isArray(vnode)) {
  50583. var vnodes = normalizeChildren(vnode) || [];
  50584. var res = new Array(vnodes.length);
  50585. for (var i = 0; i < vnodes.length; i++) {
  50586. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  50587. }
  50588. return res
  50589. }
  50590. }
  50591. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  50592. // #7817 clone node before setting fnContext, otherwise if the node is reused
  50593. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  50594. // that should not be matched to match.
  50595. var clone = cloneVNode(vnode);
  50596. clone.fnContext = contextVm;
  50597. clone.fnOptions = options;
  50598. {
  50599. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  50600. }
  50601. if (data.slot) {
  50602. (clone.data || (clone.data = {})).slot = data.slot;
  50603. }
  50604. return clone
  50605. }
  50606. function mergeProps (to, from) {
  50607. for (var key in from) {
  50608. to[camelize(key)] = from[key];
  50609. }
  50610. }
  50611. /* */
  50612. /* */
  50613. /* */
  50614. /* */
  50615. // inline hooks to be invoked on component VNodes during patch
  50616. var componentVNodeHooks = {
  50617. init: function init (vnode, hydrating) {
  50618. if (
  50619. vnode.componentInstance &&
  50620. !vnode.componentInstance._isDestroyed &&
  50621. vnode.data.keepAlive
  50622. ) {
  50623. // kept-alive components, treat as a patch
  50624. var mountedNode = vnode; // work around flow
  50625. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  50626. } else {
  50627. var child = vnode.componentInstance = createComponentInstanceForVnode(
  50628. vnode,
  50629. activeInstance
  50630. );
  50631. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  50632. }
  50633. },
  50634. prepatch: function prepatch (oldVnode, vnode) {
  50635. var options = vnode.componentOptions;
  50636. var child = vnode.componentInstance = oldVnode.componentInstance;
  50637. updateChildComponent(
  50638. child,
  50639. options.propsData, // updated props
  50640. options.listeners, // updated listeners
  50641. vnode, // new parent vnode
  50642. options.children // new children
  50643. );
  50644. },
  50645. insert: function insert (vnode) {
  50646. var context = vnode.context;
  50647. var componentInstance = vnode.componentInstance;
  50648. if (!componentInstance._isMounted) {
  50649. componentInstance._isMounted = true;
  50650. callHook(componentInstance, 'mounted');
  50651. }
  50652. if (vnode.data.keepAlive) {
  50653. if (context._isMounted) {
  50654. // vue-router#1212
  50655. // During updates, a kept-alive component's child components may
  50656. // change, so directly walking the tree here may call activated hooks
  50657. // on incorrect children. Instead we push them into a queue which will
  50658. // be processed after the whole patch process ended.
  50659. queueActivatedComponent(componentInstance);
  50660. } else {
  50661. activateChildComponent(componentInstance, true /* direct */);
  50662. }
  50663. }
  50664. },
  50665. destroy: function destroy (vnode) {
  50666. var componentInstance = vnode.componentInstance;
  50667. if (!componentInstance._isDestroyed) {
  50668. if (!vnode.data.keepAlive) {
  50669. componentInstance.$destroy();
  50670. } else {
  50671. deactivateChildComponent(componentInstance, true /* direct */);
  50672. }
  50673. }
  50674. }
  50675. };
  50676. var hooksToMerge = Object.keys(componentVNodeHooks);
  50677. function createComponent (
  50678. Ctor,
  50679. data,
  50680. context,
  50681. children,
  50682. tag
  50683. ) {
  50684. if (isUndef(Ctor)) {
  50685. return
  50686. }
  50687. var baseCtor = context.$options._base;
  50688. // plain options object: turn it into a constructor
  50689. if (isObject(Ctor)) {
  50690. Ctor = baseCtor.extend(Ctor);
  50691. }
  50692. // if at this stage it's not a constructor or an async component factory,
  50693. // reject.
  50694. if (typeof Ctor !== 'function') {
  50695. {
  50696. warn(("Invalid Component definition: " + (String(Ctor))), context);
  50697. }
  50698. return
  50699. }
  50700. // async component
  50701. var asyncFactory;
  50702. if (isUndef(Ctor.cid)) {
  50703. asyncFactory = Ctor;
  50704. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  50705. if (Ctor === undefined) {
  50706. // return a placeholder node for async component, which is rendered
  50707. // as a comment node but preserves all the raw information for the node.
  50708. // the information will be used for async server-rendering and hydration.
  50709. return createAsyncPlaceholder(
  50710. asyncFactory,
  50711. data,
  50712. context,
  50713. children,
  50714. tag
  50715. )
  50716. }
  50717. }
  50718. data = data || {};
  50719. // resolve constructor options in case global mixins are applied after
  50720. // component constructor creation
  50721. resolveConstructorOptions(Ctor);
  50722. // transform component v-model data into props & events
  50723. if (isDef(data.model)) {
  50724. transformModel(Ctor.options, data);
  50725. }
  50726. // extract props
  50727. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  50728. // functional component
  50729. if (isTrue(Ctor.options.functional)) {
  50730. return createFunctionalComponent(Ctor, propsData, data, context, children)
  50731. }
  50732. // extract listeners, since these needs to be treated as
  50733. // child component listeners instead of DOM listeners
  50734. var listeners = data.on;
  50735. // replace with listeners with .native modifier
  50736. // so it gets processed during parent component patch.
  50737. data.on = data.nativeOn;
  50738. if (isTrue(Ctor.options.abstract)) {
  50739. // abstract components do not keep anything
  50740. // other than props & listeners & slot
  50741. // work around flow
  50742. var slot = data.slot;
  50743. data = {};
  50744. if (slot) {
  50745. data.slot = slot;
  50746. }
  50747. }
  50748. // install component management hooks onto the placeholder node
  50749. installComponentHooks(data);
  50750. // return a placeholder vnode
  50751. var name = Ctor.options.name || tag;
  50752. var vnode = new VNode(
  50753. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  50754. data, undefined, undefined, undefined, context,
  50755. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  50756. asyncFactory
  50757. );
  50758. return vnode
  50759. }
  50760. function createComponentInstanceForVnode (
  50761. vnode, // we know it's MountedComponentVNode but flow doesn't
  50762. parent // activeInstance in lifecycle state
  50763. ) {
  50764. var options = {
  50765. _isComponent: true,
  50766. _parentVnode: vnode,
  50767. parent: parent
  50768. };
  50769. // check inline-template render functions
  50770. var inlineTemplate = vnode.data.inlineTemplate;
  50771. if (isDef(inlineTemplate)) {
  50772. options.render = inlineTemplate.render;
  50773. options.staticRenderFns = inlineTemplate.staticRenderFns;
  50774. }
  50775. return new vnode.componentOptions.Ctor(options)
  50776. }
  50777. function installComponentHooks (data) {
  50778. var hooks = data.hook || (data.hook = {});
  50779. for (var i = 0; i < hooksToMerge.length; i++) {
  50780. var key = hooksToMerge[i];
  50781. var existing = hooks[key];
  50782. var toMerge = componentVNodeHooks[key];
  50783. if (existing !== toMerge && !(existing && existing._merged)) {
  50784. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  50785. }
  50786. }
  50787. }
  50788. function mergeHook$1 (f1, f2) {
  50789. var merged = function (a, b) {
  50790. // flow complains about extra args which is why we use any
  50791. f1(a, b);
  50792. f2(a, b);
  50793. };
  50794. merged._merged = true;
  50795. return merged
  50796. }
  50797. // transform component v-model info (value and callback) into
  50798. // prop and event handler respectively.
  50799. function transformModel (options, data) {
  50800. var prop = (options.model && options.model.prop) || 'value';
  50801. var event = (options.model && options.model.event) || 'input'
  50802. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  50803. var on = data.on || (data.on = {});
  50804. var existing = on[event];
  50805. var callback = data.model.callback;
  50806. if (isDef(existing)) {
  50807. if (
  50808. Array.isArray(existing)
  50809. ? existing.indexOf(callback) === -1
  50810. : existing !== callback
  50811. ) {
  50812. on[event] = [callback].concat(existing);
  50813. }
  50814. } else {
  50815. on[event] = callback;
  50816. }
  50817. }
  50818. /* */
  50819. var SIMPLE_NORMALIZE = 1;
  50820. var ALWAYS_NORMALIZE = 2;
  50821. // wrapper function for providing a more flexible interface
  50822. // without getting yelled at by flow
  50823. function createElement (
  50824. context,
  50825. tag,
  50826. data,
  50827. children,
  50828. normalizationType,
  50829. alwaysNormalize
  50830. ) {
  50831. if (Array.isArray(data) || isPrimitive(data)) {
  50832. normalizationType = children;
  50833. children = data;
  50834. data = undefined;
  50835. }
  50836. if (isTrue(alwaysNormalize)) {
  50837. normalizationType = ALWAYS_NORMALIZE;
  50838. }
  50839. return _createElement(context, tag, data, children, normalizationType)
  50840. }
  50841. function _createElement (
  50842. context,
  50843. tag,
  50844. data,
  50845. children,
  50846. normalizationType
  50847. ) {
  50848. if (isDef(data) && isDef((data).__ob__)) {
  50849. warn(
  50850. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  50851. 'Always create fresh vnode data objects in each render!',
  50852. context
  50853. );
  50854. return createEmptyVNode()
  50855. }
  50856. // object syntax in v-bind
  50857. if (isDef(data) && isDef(data.is)) {
  50858. tag = data.is;
  50859. }
  50860. if (!tag) {
  50861. // in case of component :is set to falsy value
  50862. return createEmptyVNode()
  50863. }
  50864. // warn against non-primitive key
  50865. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  50866. ) {
  50867. {
  50868. warn(
  50869. 'Avoid using non-primitive value as key, ' +
  50870. 'use string/number value instead.',
  50871. context
  50872. );
  50873. }
  50874. }
  50875. // support single function children as default scoped slot
  50876. if (Array.isArray(children) &&
  50877. typeof children[0] === 'function'
  50878. ) {
  50879. data = data || {};
  50880. data.scopedSlots = { default: children[0] };
  50881. children.length = 0;
  50882. }
  50883. if (normalizationType === ALWAYS_NORMALIZE) {
  50884. children = normalizeChildren(children);
  50885. } else if (normalizationType === SIMPLE_NORMALIZE) {
  50886. children = simpleNormalizeChildren(children);
  50887. }
  50888. var vnode, ns;
  50889. if (typeof tag === 'string') {
  50890. var Ctor;
  50891. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  50892. if (config.isReservedTag(tag)) {
  50893. // platform built-in elements
  50894. if (isDef(data) && isDef(data.nativeOn)) {
  50895. warn(
  50896. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  50897. context
  50898. );
  50899. }
  50900. vnode = new VNode(
  50901. config.parsePlatformTagName(tag), data, children,
  50902. undefined, undefined, context
  50903. );
  50904. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  50905. // component
  50906. vnode = createComponent(Ctor, data, context, children, tag);
  50907. } else {
  50908. // unknown or unlisted namespaced elements
  50909. // check at runtime because it may get assigned a namespace when its
  50910. // parent normalizes children
  50911. vnode = new VNode(
  50912. tag, data, children,
  50913. undefined, undefined, context
  50914. );
  50915. }
  50916. } else {
  50917. // direct component options / constructor
  50918. vnode = createComponent(tag, data, context, children);
  50919. }
  50920. if (Array.isArray(vnode)) {
  50921. return vnode
  50922. } else if (isDef(vnode)) {
  50923. if (isDef(ns)) { applyNS(vnode, ns); }
  50924. if (isDef(data)) { registerDeepBindings(data); }
  50925. return vnode
  50926. } else {
  50927. return createEmptyVNode()
  50928. }
  50929. }
  50930. function applyNS (vnode, ns, force) {
  50931. vnode.ns = ns;
  50932. if (vnode.tag === 'foreignObject') {
  50933. // use default namespace inside foreignObject
  50934. ns = undefined;
  50935. force = true;
  50936. }
  50937. if (isDef(vnode.children)) {
  50938. for (var i = 0, l = vnode.children.length; i < l; i++) {
  50939. var child = vnode.children[i];
  50940. if (isDef(child.tag) && (
  50941. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  50942. applyNS(child, ns, force);
  50943. }
  50944. }
  50945. }
  50946. }
  50947. // ref #5318
  50948. // necessary to ensure parent re-render when deep bindings like :style and
  50949. // :class are used on slot nodes
  50950. function registerDeepBindings (data) {
  50951. if (isObject(data.style)) {
  50952. traverse(data.style);
  50953. }
  50954. if (isObject(data.class)) {
  50955. traverse(data.class);
  50956. }
  50957. }
  50958. /* */
  50959. function initRender (vm) {
  50960. vm._vnode = null; // the root of the child tree
  50961. vm._staticTrees = null; // v-once cached trees
  50962. var options = vm.$options;
  50963. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  50964. var renderContext = parentVnode && parentVnode.context;
  50965. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  50966. vm.$scopedSlots = emptyObject;
  50967. // bind the createElement fn to this instance
  50968. // so that we get proper render context inside it.
  50969. // args order: tag, data, children, normalizationType, alwaysNormalize
  50970. // internal version is used by render functions compiled from templates
  50971. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  50972. // normalization is always applied for the public version, used in
  50973. // user-written render functions.
  50974. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  50975. // $attrs & $listeners are exposed for easier HOC creation.
  50976. // they need to be reactive so that HOCs using them are always updated
  50977. var parentData = parentVnode && parentVnode.data;
  50978. /* istanbul ignore else */
  50979. {
  50980. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  50981. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  50982. }, true);
  50983. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  50984. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  50985. }, true);
  50986. }
  50987. }
  50988. var currentRenderingInstance = null;
  50989. function renderMixin (Vue) {
  50990. // install runtime convenience helpers
  50991. installRenderHelpers(Vue.prototype);
  50992. Vue.prototype.$nextTick = function (fn) {
  50993. return nextTick(fn, this)
  50994. };
  50995. Vue.prototype._render = function () {
  50996. var vm = this;
  50997. var ref = vm.$options;
  50998. var render = ref.render;
  50999. var _parentVnode = ref._parentVnode;
  51000. if (_parentVnode) {
  51001. vm.$scopedSlots = normalizeScopedSlots(
  51002. _parentVnode.data.scopedSlots,
  51003. vm.$slots,
  51004. vm.$scopedSlots
  51005. );
  51006. }
  51007. // set parent vnode. this allows render functions to have access
  51008. // to the data on the placeholder node.
  51009. vm.$vnode = _parentVnode;
  51010. // render self
  51011. var vnode;
  51012. try {
  51013. // There's no need to maintain a stack because all render fns are called
  51014. // separately from one another. Nested component's render fns are called
  51015. // when parent component is patched.
  51016. currentRenderingInstance = vm;
  51017. vnode = render.call(vm._renderProxy, vm.$createElement);
  51018. } catch (e) {
  51019. handleError(e, vm, "render");
  51020. // return error render result,
  51021. // or previous vnode to prevent render error causing blank component
  51022. /* istanbul ignore else */
  51023. if (vm.$options.renderError) {
  51024. try {
  51025. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  51026. } catch (e) {
  51027. handleError(e, vm, "renderError");
  51028. vnode = vm._vnode;
  51029. }
  51030. } else {
  51031. vnode = vm._vnode;
  51032. }
  51033. } finally {
  51034. currentRenderingInstance = null;
  51035. }
  51036. // if the returned array contains only a single node, allow it
  51037. if (Array.isArray(vnode) && vnode.length === 1) {
  51038. vnode = vnode[0];
  51039. }
  51040. // return empty vnode in case the render function errored out
  51041. if (!(vnode instanceof VNode)) {
  51042. if (Array.isArray(vnode)) {
  51043. warn(
  51044. 'Multiple root nodes returned from render function. Render function ' +
  51045. 'should return a single root node.',
  51046. vm
  51047. );
  51048. }
  51049. vnode = createEmptyVNode();
  51050. }
  51051. // set parent
  51052. vnode.parent = _parentVnode;
  51053. return vnode
  51054. };
  51055. }
  51056. /* */
  51057. function ensureCtor (comp, base) {
  51058. if (
  51059. comp.__esModule ||
  51060. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  51061. ) {
  51062. comp = comp.default;
  51063. }
  51064. return isObject(comp)
  51065. ? base.extend(comp)
  51066. : comp
  51067. }
  51068. function createAsyncPlaceholder (
  51069. factory,
  51070. data,
  51071. context,
  51072. children,
  51073. tag
  51074. ) {
  51075. var node = createEmptyVNode();
  51076. node.asyncFactory = factory;
  51077. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  51078. return node
  51079. }
  51080. function resolveAsyncComponent (
  51081. factory,
  51082. baseCtor
  51083. ) {
  51084. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  51085. return factory.errorComp
  51086. }
  51087. if (isDef(factory.resolved)) {
  51088. return factory.resolved
  51089. }
  51090. var owner = currentRenderingInstance;
  51091. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  51092. // already pending
  51093. factory.owners.push(owner);
  51094. }
  51095. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  51096. return factory.loadingComp
  51097. }
  51098. if (owner && !isDef(factory.owners)) {
  51099. var owners = factory.owners = [owner];
  51100. var sync = true;
  51101. var timerLoading = null;
  51102. var timerTimeout = null
  51103. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  51104. var forceRender = function (renderCompleted) {
  51105. for (var i = 0, l = owners.length; i < l; i++) {
  51106. (owners[i]).$forceUpdate();
  51107. }
  51108. if (renderCompleted) {
  51109. owners.length = 0;
  51110. if (timerLoading !== null) {
  51111. clearTimeout(timerLoading);
  51112. timerLoading = null;
  51113. }
  51114. if (timerTimeout !== null) {
  51115. clearTimeout(timerTimeout);
  51116. timerTimeout = null;
  51117. }
  51118. }
  51119. };
  51120. var resolve = once(function (res) {
  51121. // cache resolved
  51122. factory.resolved = ensureCtor(res, baseCtor);
  51123. // invoke callbacks only if this is not a synchronous resolve
  51124. // (async resolves are shimmed as synchronous during SSR)
  51125. if (!sync) {
  51126. forceRender(true);
  51127. } else {
  51128. owners.length = 0;
  51129. }
  51130. });
  51131. var reject = once(function (reason) {
  51132. warn(
  51133. "Failed to resolve async component: " + (String(factory)) +
  51134. (reason ? ("\nReason: " + reason) : '')
  51135. );
  51136. if (isDef(factory.errorComp)) {
  51137. factory.error = true;
  51138. forceRender(true);
  51139. }
  51140. });
  51141. var res = factory(resolve, reject);
  51142. if (isObject(res)) {
  51143. if (isPromise(res)) {
  51144. // () => Promise
  51145. if (isUndef(factory.resolved)) {
  51146. res.then(resolve, reject);
  51147. }
  51148. } else if (isPromise(res.component)) {
  51149. res.component.then(resolve, reject);
  51150. if (isDef(res.error)) {
  51151. factory.errorComp = ensureCtor(res.error, baseCtor);
  51152. }
  51153. if (isDef(res.loading)) {
  51154. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  51155. if (res.delay === 0) {
  51156. factory.loading = true;
  51157. } else {
  51158. timerLoading = setTimeout(function () {
  51159. timerLoading = null;
  51160. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  51161. factory.loading = true;
  51162. forceRender(false);
  51163. }
  51164. }, res.delay || 200);
  51165. }
  51166. }
  51167. if (isDef(res.timeout)) {
  51168. timerTimeout = setTimeout(function () {
  51169. timerTimeout = null;
  51170. if (isUndef(factory.resolved)) {
  51171. reject(
  51172. "timeout (" + (res.timeout) + "ms)"
  51173. );
  51174. }
  51175. }, res.timeout);
  51176. }
  51177. }
  51178. }
  51179. sync = false;
  51180. // return in case resolved synchronously
  51181. return factory.loading
  51182. ? factory.loadingComp
  51183. : factory.resolved
  51184. }
  51185. }
  51186. /* */
  51187. function isAsyncPlaceholder (node) {
  51188. return node.isComment && node.asyncFactory
  51189. }
  51190. /* */
  51191. function getFirstComponentChild (children) {
  51192. if (Array.isArray(children)) {
  51193. for (var i = 0; i < children.length; i++) {
  51194. var c = children[i];
  51195. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  51196. return c
  51197. }
  51198. }
  51199. }
  51200. }
  51201. /* */
  51202. /* */
  51203. function initEvents (vm) {
  51204. vm._events = Object.create(null);
  51205. vm._hasHookEvent = false;
  51206. // init parent attached events
  51207. var listeners = vm.$options._parentListeners;
  51208. if (listeners) {
  51209. updateComponentListeners(vm, listeners);
  51210. }
  51211. }
  51212. var target;
  51213. function add (event, fn) {
  51214. target.$on(event, fn);
  51215. }
  51216. function remove$1 (event, fn) {
  51217. target.$off(event, fn);
  51218. }
  51219. function createOnceHandler (event, fn) {
  51220. var _target = target;
  51221. return function onceHandler () {
  51222. var res = fn.apply(null, arguments);
  51223. if (res !== null) {
  51224. _target.$off(event, onceHandler);
  51225. }
  51226. }
  51227. }
  51228. function updateComponentListeners (
  51229. vm,
  51230. listeners,
  51231. oldListeners
  51232. ) {
  51233. target = vm;
  51234. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  51235. target = undefined;
  51236. }
  51237. function eventsMixin (Vue) {
  51238. var hookRE = /^hook:/;
  51239. Vue.prototype.$on = function (event, fn) {
  51240. var vm = this;
  51241. if (Array.isArray(event)) {
  51242. for (var i = 0, l = event.length; i < l; i++) {
  51243. vm.$on(event[i], fn);
  51244. }
  51245. } else {
  51246. (vm._events[event] || (vm._events[event] = [])).push(fn);
  51247. // optimize hook:event cost by using a boolean flag marked at registration
  51248. // instead of a hash lookup
  51249. if (hookRE.test(event)) {
  51250. vm._hasHookEvent = true;
  51251. }
  51252. }
  51253. return vm
  51254. };
  51255. Vue.prototype.$once = function (event, fn) {
  51256. var vm = this;
  51257. function on () {
  51258. vm.$off(event, on);
  51259. fn.apply(vm, arguments);
  51260. }
  51261. on.fn = fn;
  51262. vm.$on(event, on);
  51263. return vm
  51264. };
  51265. Vue.prototype.$off = function (event, fn) {
  51266. var vm = this;
  51267. // all
  51268. if (!arguments.length) {
  51269. vm._events = Object.create(null);
  51270. return vm
  51271. }
  51272. // array of events
  51273. if (Array.isArray(event)) {
  51274. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  51275. vm.$off(event[i$1], fn);
  51276. }
  51277. return vm
  51278. }
  51279. // specific event
  51280. var cbs = vm._events[event];
  51281. if (!cbs) {
  51282. return vm
  51283. }
  51284. if (!fn) {
  51285. vm._events[event] = null;
  51286. return vm
  51287. }
  51288. // specific handler
  51289. var cb;
  51290. var i = cbs.length;
  51291. while (i--) {
  51292. cb = cbs[i];
  51293. if (cb === fn || cb.fn === fn) {
  51294. cbs.splice(i, 1);
  51295. break
  51296. }
  51297. }
  51298. return vm
  51299. };
  51300. Vue.prototype.$emit = function (event) {
  51301. var vm = this;
  51302. {
  51303. var lowerCaseEvent = event.toLowerCase();
  51304. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  51305. tip(
  51306. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  51307. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  51308. "Note that HTML attributes are case-insensitive and you cannot use " +
  51309. "v-on to listen to camelCase events when using in-DOM templates. " +
  51310. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  51311. );
  51312. }
  51313. }
  51314. var cbs = vm._events[event];
  51315. if (cbs) {
  51316. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  51317. var args = toArray(arguments, 1);
  51318. var info = "event handler for \"" + event + "\"";
  51319. for (var i = 0, l = cbs.length; i < l; i++) {
  51320. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  51321. }
  51322. }
  51323. return vm
  51324. };
  51325. }
  51326. /* */
  51327. var activeInstance = null;
  51328. var isUpdatingChildComponent = false;
  51329. function setActiveInstance(vm) {
  51330. var prevActiveInstance = activeInstance;
  51331. activeInstance = vm;
  51332. return function () {
  51333. activeInstance = prevActiveInstance;
  51334. }
  51335. }
  51336. function initLifecycle (vm) {
  51337. var options = vm.$options;
  51338. // locate first non-abstract parent
  51339. var parent = options.parent;
  51340. if (parent && !options.abstract) {
  51341. while (parent.$options.abstract && parent.$parent) {
  51342. parent = parent.$parent;
  51343. }
  51344. parent.$children.push(vm);
  51345. }
  51346. vm.$parent = parent;
  51347. vm.$root = parent ? parent.$root : vm;
  51348. vm.$children = [];
  51349. vm.$refs = {};
  51350. vm._watcher = null;
  51351. vm._inactive = null;
  51352. vm._directInactive = false;
  51353. vm._isMounted = false;
  51354. vm._isDestroyed = false;
  51355. vm._isBeingDestroyed = false;
  51356. }
  51357. function lifecycleMixin (Vue) {
  51358. Vue.prototype._update = function (vnode, hydrating) {
  51359. var vm = this;
  51360. var prevEl = vm.$el;
  51361. var prevVnode = vm._vnode;
  51362. var restoreActiveInstance = setActiveInstance(vm);
  51363. vm._vnode = vnode;
  51364. // Vue.prototype.__patch__ is injected in entry points
  51365. // based on the rendering backend used.
  51366. if (!prevVnode) {
  51367. // initial render
  51368. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  51369. } else {
  51370. // updates
  51371. vm.$el = vm.__patch__(prevVnode, vnode);
  51372. }
  51373. restoreActiveInstance();
  51374. // update __vue__ reference
  51375. if (prevEl) {
  51376. prevEl.__vue__ = null;
  51377. }
  51378. if (vm.$el) {
  51379. vm.$el.__vue__ = vm;
  51380. }
  51381. // if parent is an HOC, update its $el as well
  51382. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  51383. vm.$parent.$el = vm.$el;
  51384. }
  51385. // updated hook is called by the scheduler to ensure that children are
  51386. // updated in a parent's updated hook.
  51387. };
  51388. Vue.prototype.$forceUpdate = function () {
  51389. var vm = this;
  51390. if (vm._watcher) {
  51391. vm._watcher.update();
  51392. }
  51393. };
  51394. Vue.prototype.$destroy = function () {
  51395. var vm = this;
  51396. if (vm._isBeingDestroyed) {
  51397. return
  51398. }
  51399. callHook(vm, 'beforeDestroy');
  51400. vm._isBeingDestroyed = true;
  51401. // remove self from parent
  51402. var parent = vm.$parent;
  51403. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  51404. remove(parent.$children, vm);
  51405. }
  51406. // teardown watchers
  51407. if (vm._watcher) {
  51408. vm._watcher.teardown();
  51409. }
  51410. var i = vm._watchers.length;
  51411. while (i--) {
  51412. vm._watchers[i].teardown();
  51413. }
  51414. // remove reference from data ob
  51415. // frozen object may not have observer.
  51416. if (vm._data.__ob__) {
  51417. vm._data.__ob__.vmCount--;
  51418. }
  51419. // call the last hook...
  51420. vm._isDestroyed = true;
  51421. // invoke destroy hooks on current rendered tree
  51422. vm.__patch__(vm._vnode, null);
  51423. // fire destroyed hook
  51424. callHook(vm, 'destroyed');
  51425. // turn off all instance listeners.
  51426. vm.$off();
  51427. // remove __vue__ reference
  51428. if (vm.$el) {
  51429. vm.$el.__vue__ = null;
  51430. }
  51431. // release circular reference (#6759)
  51432. if (vm.$vnode) {
  51433. vm.$vnode.parent = null;
  51434. }
  51435. };
  51436. }
  51437. function mountComponent (
  51438. vm,
  51439. el,
  51440. hydrating
  51441. ) {
  51442. vm.$el = el;
  51443. if (!vm.$options.render) {
  51444. vm.$options.render = createEmptyVNode;
  51445. {
  51446. /* istanbul ignore if */
  51447. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  51448. vm.$options.el || el) {
  51449. warn(
  51450. 'You are using the runtime-only build of Vue where the template ' +
  51451. 'compiler is not available. Either pre-compile the templates into ' +
  51452. 'render functions, or use the compiler-included build.',
  51453. vm
  51454. );
  51455. } else {
  51456. warn(
  51457. 'Failed to mount component: template or render function not defined.',
  51458. vm
  51459. );
  51460. }
  51461. }
  51462. }
  51463. callHook(vm, 'beforeMount');
  51464. var updateComponent;
  51465. /* istanbul ignore if */
  51466. if (config.performance && mark) {
  51467. updateComponent = function () {
  51468. var name = vm._name;
  51469. var id = vm._uid;
  51470. var startTag = "vue-perf-start:" + id;
  51471. var endTag = "vue-perf-end:" + id;
  51472. mark(startTag);
  51473. var vnode = vm._render();
  51474. mark(endTag);
  51475. measure(("vue " + name + " render"), startTag, endTag);
  51476. mark(startTag);
  51477. vm._update(vnode, hydrating);
  51478. mark(endTag);
  51479. measure(("vue " + name + " patch"), startTag, endTag);
  51480. };
  51481. } else {
  51482. updateComponent = function () {
  51483. vm._update(vm._render(), hydrating);
  51484. };
  51485. }
  51486. // we set this to vm._watcher inside the watcher's constructor
  51487. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  51488. // component's mounted hook), which relies on vm._watcher being already defined
  51489. new Watcher(vm, updateComponent, noop, {
  51490. before: function before () {
  51491. if (vm._isMounted && !vm._isDestroyed) {
  51492. callHook(vm, 'beforeUpdate');
  51493. }
  51494. }
  51495. }, true /* isRenderWatcher */);
  51496. hydrating = false;
  51497. // manually mounted instance, call mounted on self
  51498. // mounted is called for render-created child components in its inserted hook
  51499. if (vm.$vnode == null) {
  51500. vm._isMounted = true;
  51501. callHook(vm, 'mounted');
  51502. }
  51503. return vm
  51504. }
  51505. function updateChildComponent (
  51506. vm,
  51507. propsData,
  51508. listeners,
  51509. parentVnode,
  51510. renderChildren
  51511. ) {
  51512. {
  51513. isUpdatingChildComponent = true;
  51514. }
  51515. // determine whether component has slot children
  51516. // we need to do this before overwriting $options._renderChildren.
  51517. // check if there are dynamic scopedSlots (hand-written or compiled but with
  51518. // dynamic slot names). Static scoped slots compiled from template has the
  51519. // "$stable" marker.
  51520. var newScopedSlots = parentVnode.data.scopedSlots;
  51521. var oldScopedSlots = vm.$scopedSlots;
  51522. var hasDynamicScopedSlot = !!(
  51523. (newScopedSlots && !newScopedSlots.$stable) ||
  51524. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  51525. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  51526. );
  51527. // Any static slot children from the parent may have changed during parent's
  51528. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  51529. // update is necessary to ensure correctness.
  51530. var needsForceUpdate = !!(
  51531. renderChildren || // has new static slots
  51532. vm.$options._renderChildren || // has old static slots
  51533. hasDynamicScopedSlot
  51534. );
  51535. vm.$options._parentVnode = parentVnode;
  51536. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  51537. if (vm._vnode) { // update child tree's parent
  51538. vm._vnode.parent = parentVnode;
  51539. }
  51540. vm.$options._renderChildren = renderChildren;
  51541. // update $attrs and $listeners hash
  51542. // these are also reactive so they may trigger child update if the child
  51543. // used them during render
  51544. vm.$attrs = parentVnode.data.attrs || emptyObject;
  51545. vm.$listeners = listeners || emptyObject;
  51546. // update props
  51547. if (propsData && vm.$options.props) {
  51548. toggleObserving(false);
  51549. var props = vm._props;
  51550. var propKeys = vm.$options._propKeys || [];
  51551. for (var i = 0; i < propKeys.length; i++) {
  51552. var key = propKeys[i];
  51553. var propOptions = vm.$options.props; // wtf flow?
  51554. props[key] = validateProp(key, propOptions, propsData, vm);
  51555. }
  51556. toggleObserving(true);
  51557. // keep a copy of raw propsData
  51558. vm.$options.propsData = propsData;
  51559. }
  51560. // update listeners
  51561. listeners = listeners || emptyObject;
  51562. var oldListeners = vm.$options._parentListeners;
  51563. vm.$options._parentListeners = listeners;
  51564. updateComponentListeners(vm, listeners, oldListeners);
  51565. // resolve slots + force update if has children
  51566. if (needsForceUpdate) {
  51567. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  51568. vm.$forceUpdate();
  51569. }
  51570. {
  51571. isUpdatingChildComponent = false;
  51572. }
  51573. }
  51574. function isInInactiveTree (vm) {
  51575. while (vm && (vm = vm.$parent)) {
  51576. if (vm._inactive) { return true }
  51577. }
  51578. return false
  51579. }
  51580. function activateChildComponent (vm, direct) {
  51581. if (direct) {
  51582. vm._directInactive = false;
  51583. if (isInInactiveTree(vm)) {
  51584. return
  51585. }
  51586. } else if (vm._directInactive) {
  51587. return
  51588. }
  51589. if (vm._inactive || vm._inactive === null) {
  51590. vm._inactive = false;
  51591. for (var i = 0; i < vm.$children.length; i++) {
  51592. activateChildComponent(vm.$children[i]);
  51593. }
  51594. callHook(vm, 'activated');
  51595. }
  51596. }
  51597. function deactivateChildComponent (vm, direct) {
  51598. if (direct) {
  51599. vm._directInactive = true;
  51600. if (isInInactiveTree(vm)) {
  51601. return
  51602. }
  51603. }
  51604. if (!vm._inactive) {
  51605. vm._inactive = true;
  51606. for (var i = 0; i < vm.$children.length; i++) {
  51607. deactivateChildComponent(vm.$children[i]);
  51608. }
  51609. callHook(vm, 'deactivated');
  51610. }
  51611. }
  51612. function callHook (vm, hook) {
  51613. // #7573 disable dep collection when invoking lifecycle hooks
  51614. pushTarget();
  51615. var handlers = vm.$options[hook];
  51616. var info = hook + " hook";
  51617. if (handlers) {
  51618. for (var i = 0, j = handlers.length; i < j; i++) {
  51619. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  51620. }
  51621. }
  51622. if (vm._hasHookEvent) {
  51623. vm.$emit('hook:' + hook);
  51624. }
  51625. popTarget();
  51626. }
  51627. /* */
  51628. var MAX_UPDATE_COUNT = 100;
  51629. var queue = [];
  51630. var activatedChildren = [];
  51631. var has = {};
  51632. var circular = {};
  51633. var waiting = false;
  51634. var flushing = false;
  51635. var index = 0;
  51636. /**
  51637. * Reset the scheduler's state.
  51638. */
  51639. function resetSchedulerState () {
  51640. index = queue.length = activatedChildren.length = 0;
  51641. has = {};
  51642. {
  51643. circular = {};
  51644. }
  51645. waiting = flushing = false;
  51646. }
  51647. // Async edge case #6566 requires saving the timestamp when event listeners are
  51648. // attached. However, calling performance.now() has a perf overhead especially
  51649. // if the page has thousands of event listeners. Instead, we take a timestamp
  51650. // every time the scheduler flushes and use that for all event listeners
  51651. // attached during that flush.
  51652. var currentFlushTimestamp = 0;
  51653. // Async edge case fix requires storing an event listener's attach timestamp.
  51654. var getNow = Date.now;
  51655. // Determine what event timestamp the browser is using. Annoyingly, the
  51656. // timestamp can either be hi-res (relative to page load) or low-res
  51657. // (relative to UNIX epoch), so in order to compare time we have to use the
  51658. // same timestamp type when saving the flush timestamp.
  51659. // All IE versions use low-res event timestamps, and have problematic clock
  51660. // implementations (#9632)
  51661. if (inBrowser && !isIE) {
  51662. var performance = window.performance;
  51663. if (
  51664. performance &&
  51665. typeof performance.now === 'function' &&
  51666. getNow() > document.createEvent('Event').timeStamp
  51667. ) {
  51668. // if the event timestamp, although evaluated AFTER the Date.now(), is
  51669. // smaller than it, it means the event is using a hi-res timestamp,
  51670. // and we need to use the hi-res version for event listener timestamps as
  51671. // well.
  51672. getNow = function () { return performance.now(); };
  51673. }
  51674. }
  51675. /**
  51676. * Flush both queues and run the watchers.
  51677. */
  51678. function flushSchedulerQueue () {
  51679. currentFlushTimestamp = getNow();
  51680. flushing = true;
  51681. var watcher, id;
  51682. // Sort queue before flush.
  51683. // This ensures that:
  51684. // 1. Components are updated from parent to child. (because parent is always
  51685. // created before the child)
  51686. // 2. A component's user watchers are run before its render watcher (because
  51687. // user watchers are created before the render watcher)
  51688. // 3. If a component is destroyed during a parent component's watcher run,
  51689. // its watchers can be skipped.
  51690. queue.sort(function (a, b) { return a.id - b.id; });
  51691. // do not cache length because more watchers might be pushed
  51692. // as we run existing watchers
  51693. for (index = 0; index < queue.length; index++) {
  51694. watcher = queue[index];
  51695. if (watcher.before) {
  51696. watcher.before();
  51697. }
  51698. id = watcher.id;
  51699. has[id] = null;
  51700. watcher.run();
  51701. // in dev build, check and stop circular updates.
  51702. if (has[id] != null) {
  51703. circular[id] = (circular[id] || 0) + 1;
  51704. if (circular[id] > MAX_UPDATE_COUNT) {
  51705. warn(
  51706. 'You may have an infinite update loop ' + (
  51707. watcher.user
  51708. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  51709. : "in a component render function."
  51710. ),
  51711. watcher.vm
  51712. );
  51713. break
  51714. }
  51715. }
  51716. }
  51717. // keep copies of post queues before resetting state
  51718. var activatedQueue = activatedChildren.slice();
  51719. var updatedQueue = queue.slice();
  51720. resetSchedulerState();
  51721. // call component updated and activated hooks
  51722. callActivatedHooks(activatedQueue);
  51723. callUpdatedHooks(updatedQueue);
  51724. // devtool hook
  51725. /* istanbul ignore if */
  51726. if (devtools && config.devtools) {
  51727. devtools.emit('flush');
  51728. }
  51729. }
  51730. function callUpdatedHooks (queue) {
  51731. var i = queue.length;
  51732. while (i--) {
  51733. var watcher = queue[i];
  51734. var vm = watcher.vm;
  51735. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  51736. callHook(vm, 'updated');
  51737. }
  51738. }
  51739. }
  51740. /**
  51741. * Queue a kept-alive component that was activated during patch.
  51742. * The queue will be processed after the entire tree has been patched.
  51743. */
  51744. function queueActivatedComponent (vm) {
  51745. // setting _inactive to false here so that a render function can
  51746. // rely on checking whether it's in an inactive tree (e.g. router-view)
  51747. vm._inactive = false;
  51748. activatedChildren.push(vm);
  51749. }
  51750. function callActivatedHooks (queue) {
  51751. for (var i = 0; i < queue.length; i++) {
  51752. queue[i]._inactive = true;
  51753. activateChildComponent(queue[i], true /* true */);
  51754. }
  51755. }
  51756. /**
  51757. * Push a watcher into the watcher queue.
  51758. * Jobs with duplicate IDs will be skipped unless it's
  51759. * pushed when the queue is being flushed.
  51760. */
  51761. function queueWatcher (watcher) {
  51762. var id = watcher.id;
  51763. if (has[id] == null) {
  51764. has[id] = true;
  51765. if (!flushing) {
  51766. queue.push(watcher);
  51767. } else {
  51768. // if already flushing, splice the watcher based on its id
  51769. // if already past its id, it will be run next immediately.
  51770. var i = queue.length - 1;
  51771. while (i > index && queue[i].id > watcher.id) {
  51772. i--;
  51773. }
  51774. queue.splice(i + 1, 0, watcher);
  51775. }
  51776. // queue the flush
  51777. if (!waiting) {
  51778. waiting = true;
  51779. if (!config.async) {
  51780. flushSchedulerQueue();
  51781. return
  51782. }
  51783. nextTick(flushSchedulerQueue);
  51784. }
  51785. }
  51786. }
  51787. /* */
  51788. var uid$2 = 0;
  51789. /**
  51790. * A watcher parses an expression, collects dependencies,
  51791. * and fires callback when the expression value changes.
  51792. * This is used for both the $watch() api and directives.
  51793. */
  51794. var Watcher = function Watcher (
  51795. vm,
  51796. expOrFn,
  51797. cb,
  51798. options,
  51799. isRenderWatcher
  51800. ) {
  51801. this.vm = vm;
  51802. if (isRenderWatcher) {
  51803. vm._watcher = this;
  51804. }
  51805. vm._watchers.push(this);
  51806. // options
  51807. if (options) {
  51808. this.deep = !!options.deep;
  51809. this.user = !!options.user;
  51810. this.lazy = !!options.lazy;
  51811. this.sync = !!options.sync;
  51812. this.before = options.before;
  51813. } else {
  51814. this.deep = this.user = this.lazy = this.sync = false;
  51815. }
  51816. this.cb = cb;
  51817. this.id = ++uid$2; // uid for batching
  51818. this.active = true;
  51819. this.dirty = this.lazy; // for lazy watchers
  51820. this.deps = [];
  51821. this.newDeps = [];
  51822. this.depIds = new _Set();
  51823. this.newDepIds = new _Set();
  51824. this.expression = expOrFn.toString();
  51825. // parse expression for getter
  51826. if (typeof expOrFn === 'function') {
  51827. this.getter = expOrFn;
  51828. } else {
  51829. this.getter = parsePath(expOrFn);
  51830. if (!this.getter) {
  51831. this.getter = noop;
  51832. warn(
  51833. "Failed watching path: \"" + expOrFn + "\" " +
  51834. 'Watcher only accepts simple dot-delimited paths. ' +
  51835. 'For full control, use a function instead.',
  51836. vm
  51837. );
  51838. }
  51839. }
  51840. this.value = this.lazy
  51841. ? undefined
  51842. : this.get();
  51843. };
  51844. /**
  51845. * Evaluate the getter, and re-collect dependencies.
  51846. */
  51847. Watcher.prototype.get = function get () {
  51848. pushTarget(this);
  51849. var value;
  51850. var vm = this.vm;
  51851. try {
  51852. value = this.getter.call(vm, vm);
  51853. } catch (e) {
  51854. if (this.user) {
  51855. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  51856. } else {
  51857. throw e
  51858. }
  51859. } finally {
  51860. // "touch" every property so they are all tracked as
  51861. // dependencies for deep watching
  51862. if (this.deep) {
  51863. traverse(value);
  51864. }
  51865. popTarget();
  51866. this.cleanupDeps();
  51867. }
  51868. return value
  51869. };
  51870. /**
  51871. * Add a dependency to this directive.
  51872. */
  51873. Watcher.prototype.addDep = function addDep (dep) {
  51874. var id = dep.id;
  51875. if (!this.newDepIds.has(id)) {
  51876. this.newDepIds.add(id);
  51877. this.newDeps.push(dep);
  51878. if (!this.depIds.has(id)) {
  51879. dep.addSub(this);
  51880. }
  51881. }
  51882. };
  51883. /**
  51884. * Clean up for dependency collection.
  51885. */
  51886. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  51887. var i = this.deps.length;
  51888. while (i--) {
  51889. var dep = this.deps[i];
  51890. if (!this.newDepIds.has(dep.id)) {
  51891. dep.removeSub(this);
  51892. }
  51893. }
  51894. var tmp = this.depIds;
  51895. this.depIds = this.newDepIds;
  51896. this.newDepIds = tmp;
  51897. this.newDepIds.clear();
  51898. tmp = this.deps;
  51899. this.deps = this.newDeps;
  51900. this.newDeps = tmp;
  51901. this.newDeps.length = 0;
  51902. };
  51903. /**
  51904. * Subscriber interface.
  51905. * Will be called when a dependency changes.
  51906. */
  51907. Watcher.prototype.update = function update () {
  51908. /* istanbul ignore else */
  51909. if (this.lazy) {
  51910. this.dirty = true;
  51911. } else if (this.sync) {
  51912. this.run();
  51913. } else {
  51914. queueWatcher(this);
  51915. }
  51916. };
  51917. /**
  51918. * Scheduler job interface.
  51919. * Will be called by the scheduler.
  51920. */
  51921. Watcher.prototype.run = function run () {
  51922. if (this.active) {
  51923. var value = this.get();
  51924. if (
  51925. value !== this.value ||
  51926. // Deep watchers and watchers on Object/Arrays should fire even
  51927. // when the value is the same, because the value may
  51928. // have mutated.
  51929. isObject(value) ||
  51930. this.deep
  51931. ) {
  51932. // set new value
  51933. var oldValue = this.value;
  51934. this.value = value;
  51935. if (this.user) {
  51936. try {
  51937. this.cb.call(this.vm, value, oldValue);
  51938. } catch (e) {
  51939. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  51940. }
  51941. } else {
  51942. this.cb.call(this.vm, value, oldValue);
  51943. }
  51944. }
  51945. }
  51946. };
  51947. /**
  51948. * Evaluate the value of the watcher.
  51949. * This only gets called for lazy watchers.
  51950. */
  51951. Watcher.prototype.evaluate = function evaluate () {
  51952. this.value = this.get();
  51953. this.dirty = false;
  51954. };
  51955. /**
  51956. * Depend on all deps collected by this watcher.
  51957. */
  51958. Watcher.prototype.depend = function depend () {
  51959. var i = this.deps.length;
  51960. while (i--) {
  51961. this.deps[i].depend();
  51962. }
  51963. };
  51964. /**
  51965. * Remove self from all dependencies' subscriber list.
  51966. */
  51967. Watcher.prototype.teardown = function teardown () {
  51968. if (this.active) {
  51969. // remove self from vm's watcher list
  51970. // this is a somewhat expensive operation so we skip it
  51971. // if the vm is being destroyed.
  51972. if (!this.vm._isBeingDestroyed) {
  51973. remove(this.vm._watchers, this);
  51974. }
  51975. var i = this.deps.length;
  51976. while (i--) {
  51977. this.deps[i].removeSub(this);
  51978. }
  51979. this.active = false;
  51980. }
  51981. };
  51982. /* */
  51983. var sharedPropertyDefinition = {
  51984. enumerable: true,
  51985. configurable: true,
  51986. get: noop,
  51987. set: noop
  51988. };
  51989. function proxy (target, sourceKey, key) {
  51990. sharedPropertyDefinition.get = function proxyGetter () {
  51991. return this[sourceKey][key]
  51992. };
  51993. sharedPropertyDefinition.set = function proxySetter (val) {
  51994. this[sourceKey][key] = val;
  51995. };
  51996. Object.defineProperty(target, key, sharedPropertyDefinition);
  51997. }
  51998. function initState (vm) {
  51999. vm._watchers = [];
  52000. var opts = vm.$options;
  52001. if (opts.props) { initProps(vm, opts.props); }
  52002. if (opts.methods) { initMethods(vm, opts.methods); }
  52003. if (opts.data) {
  52004. initData(vm);
  52005. } else {
  52006. observe(vm._data = {}, true /* asRootData */);
  52007. }
  52008. if (opts.computed) { initComputed(vm, opts.computed); }
  52009. if (opts.watch && opts.watch !== nativeWatch) {
  52010. initWatch(vm, opts.watch);
  52011. }
  52012. }
  52013. function initProps (vm, propsOptions) {
  52014. var propsData = vm.$options.propsData || {};
  52015. var props = vm._props = {};
  52016. // cache prop keys so that future props updates can iterate using Array
  52017. // instead of dynamic object key enumeration.
  52018. var keys = vm.$options._propKeys = [];
  52019. var isRoot = !vm.$parent;
  52020. // root instance props should be converted
  52021. if (!isRoot) {
  52022. toggleObserving(false);
  52023. }
  52024. var loop = function ( key ) {
  52025. keys.push(key);
  52026. var value = validateProp(key, propsOptions, propsData, vm);
  52027. /* istanbul ignore else */
  52028. {
  52029. var hyphenatedKey = hyphenate(key);
  52030. if (isReservedAttribute(hyphenatedKey) ||
  52031. config.isReservedAttr(hyphenatedKey)) {
  52032. warn(
  52033. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  52034. vm
  52035. );
  52036. }
  52037. defineReactive$$1(props, key, value, function () {
  52038. if (!isRoot && !isUpdatingChildComponent) {
  52039. warn(
  52040. "Avoid mutating a prop directly since the value will be " +
  52041. "overwritten whenever the parent component re-renders. " +
  52042. "Instead, use a data or computed property based on the prop's " +
  52043. "value. Prop being mutated: \"" + key + "\"",
  52044. vm
  52045. );
  52046. }
  52047. });
  52048. }
  52049. // static props are already proxied on the component's prototype
  52050. // during Vue.extend(). We only need to proxy props defined at
  52051. // instantiation here.
  52052. if (!(key in vm)) {
  52053. proxy(vm, "_props", key);
  52054. }
  52055. };
  52056. for (var key in propsOptions) loop( key );
  52057. toggleObserving(true);
  52058. }
  52059. function initData (vm) {
  52060. var data = vm.$options.data;
  52061. data = vm._data = typeof data === 'function'
  52062. ? getData(data, vm)
  52063. : data || {};
  52064. if (!isPlainObject(data)) {
  52065. data = {};
  52066. warn(
  52067. 'data functions should return an object:\n' +
  52068. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  52069. vm
  52070. );
  52071. }
  52072. // proxy data on instance
  52073. var keys = Object.keys(data);
  52074. var props = vm.$options.props;
  52075. var methods = vm.$options.methods;
  52076. var i = keys.length;
  52077. while (i--) {
  52078. var key = keys[i];
  52079. {
  52080. if (methods && hasOwn(methods, key)) {
  52081. warn(
  52082. ("Method \"" + key + "\" has already been defined as a data property."),
  52083. vm
  52084. );
  52085. }
  52086. }
  52087. if (props && hasOwn(props, key)) {
  52088. warn(
  52089. "The data property \"" + key + "\" is already declared as a prop. " +
  52090. "Use prop default value instead.",
  52091. vm
  52092. );
  52093. } else if (!isReserved(key)) {
  52094. proxy(vm, "_data", key);
  52095. }
  52096. }
  52097. // observe data
  52098. observe(data, true /* asRootData */);
  52099. }
  52100. function getData (data, vm) {
  52101. // #7573 disable dep collection when invoking data getters
  52102. pushTarget();
  52103. try {
  52104. return data.call(vm, vm)
  52105. } catch (e) {
  52106. handleError(e, vm, "data()");
  52107. return {}
  52108. } finally {
  52109. popTarget();
  52110. }
  52111. }
  52112. var computedWatcherOptions = { lazy: true };
  52113. function initComputed (vm, computed) {
  52114. // $flow-disable-line
  52115. var watchers = vm._computedWatchers = Object.create(null);
  52116. // computed properties are just getters during SSR
  52117. var isSSR = isServerRendering();
  52118. for (var key in computed) {
  52119. var userDef = computed[key];
  52120. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  52121. if (getter == null) {
  52122. warn(
  52123. ("Getter is missing for computed property \"" + key + "\"."),
  52124. vm
  52125. );
  52126. }
  52127. if (!isSSR) {
  52128. // create internal watcher for the computed property.
  52129. watchers[key] = new Watcher(
  52130. vm,
  52131. getter || noop,
  52132. noop,
  52133. computedWatcherOptions
  52134. );
  52135. }
  52136. // component-defined computed properties are already defined on the
  52137. // component prototype. We only need to define computed properties defined
  52138. // at instantiation here.
  52139. if (!(key in vm)) {
  52140. defineComputed(vm, key, userDef);
  52141. } else {
  52142. if (key in vm.$data) {
  52143. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  52144. } else if (vm.$options.props && key in vm.$options.props) {
  52145. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  52146. }
  52147. }
  52148. }
  52149. }
  52150. function defineComputed (
  52151. target,
  52152. key,
  52153. userDef
  52154. ) {
  52155. var shouldCache = !isServerRendering();
  52156. if (typeof userDef === 'function') {
  52157. sharedPropertyDefinition.get = shouldCache
  52158. ? createComputedGetter(key)
  52159. : createGetterInvoker(userDef);
  52160. sharedPropertyDefinition.set = noop;
  52161. } else {
  52162. sharedPropertyDefinition.get = userDef.get
  52163. ? shouldCache && userDef.cache !== false
  52164. ? createComputedGetter(key)
  52165. : createGetterInvoker(userDef.get)
  52166. : noop;
  52167. sharedPropertyDefinition.set = userDef.set || noop;
  52168. }
  52169. if (sharedPropertyDefinition.set === noop) {
  52170. sharedPropertyDefinition.set = function () {
  52171. warn(
  52172. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  52173. this
  52174. );
  52175. };
  52176. }
  52177. Object.defineProperty(target, key, sharedPropertyDefinition);
  52178. }
  52179. function createComputedGetter (key) {
  52180. return function computedGetter () {
  52181. var watcher = this._computedWatchers && this._computedWatchers[key];
  52182. if (watcher) {
  52183. if (watcher.dirty) {
  52184. watcher.evaluate();
  52185. }
  52186. if (Dep.target) {
  52187. watcher.depend();
  52188. }
  52189. return watcher.value
  52190. }
  52191. }
  52192. }
  52193. function createGetterInvoker(fn) {
  52194. return function computedGetter () {
  52195. return fn.call(this, this)
  52196. }
  52197. }
  52198. function initMethods (vm, methods) {
  52199. var props = vm.$options.props;
  52200. for (var key in methods) {
  52201. {
  52202. if (typeof methods[key] !== 'function') {
  52203. warn(
  52204. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  52205. "Did you reference the function correctly?",
  52206. vm
  52207. );
  52208. }
  52209. if (props && hasOwn(props, key)) {
  52210. warn(
  52211. ("Method \"" + key + "\" has already been defined as a prop."),
  52212. vm
  52213. );
  52214. }
  52215. if ((key in vm) && isReserved(key)) {
  52216. warn(
  52217. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  52218. "Avoid defining component methods that start with _ or $."
  52219. );
  52220. }
  52221. }
  52222. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  52223. }
  52224. }
  52225. function initWatch (vm, watch) {
  52226. for (var key in watch) {
  52227. var handler = watch[key];
  52228. if (Array.isArray(handler)) {
  52229. for (var i = 0; i < handler.length; i++) {
  52230. createWatcher(vm, key, handler[i]);
  52231. }
  52232. } else {
  52233. createWatcher(vm, key, handler);
  52234. }
  52235. }
  52236. }
  52237. function createWatcher (
  52238. vm,
  52239. expOrFn,
  52240. handler,
  52241. options
  52242. ) {
  52243. if (isPlainObject(handler)) {
  52244. options = handler;
  52245. handler = handler.handler;
  52246. }
  52247. if (typeof handler === 'string') {
  52248. handler = vm[handler];
  52249. }
  52250. return vm.$watch(expOrFn, handler, options)
  52251. }
  52252. function stateMixin (Vue) {
  52253. // flow somehow has problems with directly declared definition object
  52254. // when using Object.defineProperty, so we have to procedurally build up
  52255. // the object here.
  52256. var dataDef = {};
  52257. dataDef.get = function () { return this._data };
  52258. var propsDef = {};
  52259. propsDef.get = function () { return this._props };
  52260. {
  52261. dataDef.set = function () {
  52262. warn(
  52263. 'Avoid replacing instance root $data. ' +
  52264. 'Use nested data properties instead.',
  52265. this
  52266. );
  52267. };
  52268. propsDef.set = function () {
  52269. warn("$props is readonly.", this);
  52270. };
  52271. }
  52272. Object.defineProperty(Vue.prototype, '$data', dataDef);
  52273. Object.defineProperty(Vue.prototype, '$props', propsDef);
  52274. Vue.prototype.$set = set;
  52275. Vue.prototype.$delete = del;
  52276. Vue.prototype.$watch = function (
  52277. expOrFn,
  52278. cb,
  52279. options
  52280. ) {
  52281. var vm = this;
  52282. if (isPlainObject(cb)) {
  52283. return createWatcher(vm, expOrFn, cb, options)
  52284. }
  52285. options = options || {};
  52286. options.user = true;
  52287. var watcher = new Watcher(vm, expOrFn, cb, options);
  52288. if (options.immediate) {
  52289. try {
  52290. cb.call(vm, watcher.value);
  52291. } catch (error) {
  52292. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  52293. }
  52294. }
  52295. return function unwatchFn () {
  52296. watcher.teardown();
  52297. }
  52298. };
  52299. }
  52300. /* */
  52301. var uid$3 = 0;
  52302. function initMixin (Vue) {
  52303. Vue.prototype._init = function (options) {
  52304. var vm = this;
  52305. // a uid
  52306. vm._uid = uid$3++;
  52307. var startTag, endTag;
  52308. /* istanbul ignore if */
  52309. if (config.performance && mark) {
  52310. startTag = "vue-perf-start:" + (vm._uid);
  52311. endTag = "vue-perf-end:" + (vm._uid);
  52312. mark(startTag);
  52313. }
  52314. // a flag to avoid this being observed
  52315. vm._isVue = true;
  52316. // merge options
  52317. if (options && options._isComponent) {
  52318. // optimize internal component instantiation
  52319. // since dynamic options merging is pretty slow, and none of the
  52320. // internal component options needs special treatment.
  52321. initInternalComponent(vm, options);
  52322. } else {
  52323. vm.$options = mergeOptions(
  52324. resolveConstructorOptions(vm.constructor),
  52325. options || {},
  52326. vm
  52327. );
  52328. }
  52329. /* istanbul ignore else */
  52330. {
  52331. initProxy(vm);
  52332. }
  52333. // expose real self
  52334. vm._self = vm;
  52335. initLifecycle(vm);
  52336. initEvents(vm);
  52337. initRender(vm);
  52338. callHook(vm, 'beforeCreate');
  52339. initInjections(vm); // resolve injections before data/props
  52340. initState(vm);
  52341. initProvide(vm); // resolve provide after data/props
  52342. callHook(vm, 'created');
  52343. /* istanbul ignore if */
  52344. if (config.performance && mark) {
  52345. vm._name = formatComponentName(vm, false);
  52346. mark(endTag);
  52347. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  52348. }
  52349. if (vm.$options.el) {
  52350. vm.$mount(vm.$options.el);
  52351. }
  52352. };
  52353. }
  52354. function initInternalComponent (vm, options) {
  52355. var opts = vm.$options = Object.create(vm.constructor.options);
  52356. // doing this because it's faster than dynamic enumeration.
  52357. var parentVnode = options._parentVnode;
  52358. opts.parent = options.parent;
  52359. opts._parentVnode = parentVnode;
  52360. var vnodeComponentOptions = parentVnode.componentOptions;
  52361. opts.propsData = vnodeComponentOptions.propsData;
  52362. opts._parentListeners = vnodeComponentOptions.listeners;
  52363. opts._renderChildren = vnodeComponentOptions.children;
  52364. opts._componentTag = vnodeComponentOptions.tag;
  52365. if (options.render) {
  52366. opts.render = options.render;
  52367. opts.staticRenderFns = options.staticRenderFns;
  52368. }
  52369. }
  52370. function resolveConstructorOptions (Ctor) {
  52371. var options = Ctor.options;
  52372. if (Ctor.super) {
  52373. var superOptions = resolveConstructorOptions(Ctor.super);
  52374. var cachedSuperOptions = Ctor.superOptions;
  52375. if (superOptions !== cachedSuperOptions) {
  52376. // super option changed,
  52377. // need to resolve new options.
  52378. Ctor.superOptions = superOptions;
  52379. // check if there are any late-modified/attached options (#4976)
  52380. var modifiedOptions = resolveModifiedOptions(Ctor);
  52381. // update base extend options
  52382. if (modifiedOptions) {
  52383. extend(Ctor.extendOptions, modifiedOptions);
  52384. }
  52385. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  52386. if (options.name) {
  52387. options.components[options.name] = Ctor;
  52388. }
  52389. }
  52390. }
  52391. return options
  52392. }
  52393. function resolveModifiedOptions (Ctor) {
  52394. var modified;
  52395. var latest = Ctor.options;
  52396. var sealed = Ctor.sealedOptions;
  52397. for (var key in latest) {
  52398. if (latest[key] !== sealed[key]) {
  52399. if (!modified) { modified = {}; }
  52400. modified[key] = latest[key];
  52401. }
  52402. }
  52403. return modified
  52404. }
  52405. function Vue (options) {
  52406. if (!(this instanceof Vue)
  52407. ) {
  52408. warn('Vue is a constructor and should be called with the `new` keyword');
  52409. }
  52410. this._init(options);
  52411. }
  52412. initMixin(Vue);
  52413. stateMixin(Vue);
  52414. eventsMixin(Vue);
  52415. lifecycleMixin(Vue);
  52416. renderMixin(Vue);
  52417. /* */
  52418. function initUse (Vue) {
  52419. Vue.use = function (plugin) {
  52420. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  52421. if (installedPlugins.indexOf(plugin) > -1) {
  52422. return this
  52423. }
  52424. // additional parameters
  52425. var args = toArray(arguments, 1);
  52426. args.unshift(this);
  52427. if (typeof plugin.install === 'function') {
  52428. plugin.install.apply(plugin, args);
  52429. } else if (typeof plugin === 'function') {
  52430. plugin.apply(null, args);
  52431. }
  52432. installedPlugins.push(plugin);
  52433. return this
  52434. };
  52435. }
  52436. /* */
  52437. function initMixin$1 (Vue) {
  52438. Vue.mixin = function (mixin) {
  52439. this.options = mergeOptions(this.options, mixin);
  52440. return this
  52441. };
  52442. }
  52443. /* */
  52444. function initExtend (Vue) {
  52445. /**
  52446. * Each instance constructor, including Vue, has a unique
  52447. * cid. This enables us to create wrapped "child
  52448. * constructors" for prototypal inheritance and cache them.
  52449. */
  52450. Vue.cid = 0;
  52451. var cid = 1;
  52452. /**
  52453. * Class inheritance
  52454. */
  52455. Vue.extend = function (extendOptions) {
  52456. extendOptions = extendOptions || {};
  52457. var Super = this;
  52458. var SuperId = Super.cid;
  52459. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  52460. if (cachedCtors[SuperId]) {
  52461. return cachedCtors[SuperId]
  52462. }
  52463. var name = extendOptions.name || Super.options.name;
  52464. if (name) {
  52465. validateComponentName(name);
  52466. }
  52467. var Sub = function VueComponent (options) {
  52468. this._init(options);
  52469. };
  52470. Sub.prototype = Object.create(Super.prototype);
  52471. Sub.prototype.constructor = Sub;
  52472. Sub.cid = cid++;
  52473. Sub.options = mergeOptions(
  52474. Super.options,
  52475. extendOptions
  52476. );
  52477. Sub['super'] = Super;
  52478. // For props and computed properties, we define the proxy getters on
  52479. // the Vue instances at extension time, on the extended prototype. This
  52480. // avoids Object.defineProperty calls for each instance created.
  52481. if (Sub.options.props) {
  52482. initProps$1(Sub);
  52483. }
  52484. if (Sub.options.computed) {
  52485. initComputed$1(Sub);
  52486. }
  52487. // allow further extension/mixin/plugin usage
  52488. Sub.extend = Super.extend;
  52489. Sub.mixin = Super.mixin;
  52490. Sub.use = Super.use;
  52491. // create asset registers, so extended classes
  52492. // can have their private assets too.
  52493. ASSET_TYPES.forEach(function (type) {
  52494. Sub[type] = Super[type];
  52495. });
  52496. // enable recursive self-lookup
  52497. if (name) {
  52498. Sub.options.components[name] = Sub;
  52499. }
  52500. // keep a reference to the super options at extension time.
  52501. // later at instantiation we can check if Super's options have
  52502. // been updated.
  52503. Sub.superOptions = Super.options;
  52504. Sub.extendOptions = extendOptions;
  52505. Sub.sealedOptions = extend({}, Sub.options);
  52506. // cache constructor
  52507. cachedCtors[SuperId] = Sub;
  52508. return Sub
  52509. };
  52510. }
  52511. function initProps$1 (Comp) {
  52512. var props = Comp.options.props;
  52513. for (var key in props) {
  52514. proxy(Comp.prototype, "_props", key);
  52515. }
  52516. }
  52517. function initComputed$1 (Comp) {
  52518. var computed = Comp.options.computed;
  52519. for (var key in computed) {
  52520. defineComputed(Comp.prototype, key, computed[key]);
  52521. }
  52522. }
  52523. /* */
  52524. function initAssetRegisters (Vue) {
  52525. /**
  52526. * Create asset registration methods.
  52527. */
  52528. ASSET_TYPES.forEach(function (type) {
  52529. Vue[type] = function (
  52530. id,
  52531. definition
  52532. ) {
  52533. if (!definition) {
  52534. return this.options[type + 's'][id]
  52535. } else {
  52536. /* istanbul ignore if */
  52537. if (type === 'component') {
  52538. validateComponentName(id);
  52539. }
  52540. if (type === 'component' && isPlainObject(definition)) {
  52541. definition.name = definition.name || id;
  52542. definition = this.options._base.extend(definition);
  52543. }
  52544. if (type === 'directive' && typeof definition === 'function') {
  52545. definition = { bind: definition, update: definition };
  52546. }
  52547. this.options[type + 's'][id] = definition;
  52548. return definition
  52549. }
  52550. };
  52551. });
  52552. }
  52553. /* */
  52554. function getComponentName (opts) {
  52555. return opts && (opts.Ctor.options.name || opts.tag)
  52556. }
  52557. function matches (pattern, name) {
  52558. if (Array.isArray(pattern)) {
  52559. return pattern.indexOf(name) > -1
  52560. } else if (typeof pattern === 'string') {
  52561. return pattern.split(',').indexOf(name) > -1
  52562. } else if (isRegExp(pattern)) {
  52563. return pattern.test(name)
  52564. }
  52565. /* istanbul ignore next */
  52566. return false
  52567. }
  52568. function pruneCache (keepAliveInstance, filter) {
  52569. var cache = keepAliveInstance.cache;
  52570. var keys = keepAliveInstance.keys;
  52571. var _vnode = keepAliveInstance._vnode;
  52572. for (var key in cache) {
  52573. var cachedNode = cache[key];
  52574. if (cachedNode) {
  52575. var name = getComponentName(cachedNode.componentOptions);
  52576. if (name && !filter(name)) {
  52577. pruneCacheEntry(cache, key, keys, _vnode);
  52578. }
  52579. }
  52580. }
  52581. }
  52582. function pruneCacheEntry (
  52583. cache,
  52584. key,
  52585. keys,
  52586. current
  52587. ) {
  52588. var cached$$1 = cache[key];
  52589. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  52590. cached$$1.componentInstance.$destroy();
  52591. }
  52592. cache[key] = null;
  52593. remove(keys, key);
  52594. }
  52595. var patternTypes = [String, RegExp, Array];
  52596. var KeepAlive = {
  52597. name: 'keep-alive',
  52598. abstract: true,
  52599. props: {
  52600. include: patternTypes,
  52601. exclude: patternTypes,
  52602. max: [String, Number]
  52603. },
  52604. created: function created () {
  52605. this.cache = Object.create(null);
  52606. this.keys = [];
  52607. },
  52608. destroyed: function destroyed () {
  52609. for (var key in this.cache) {
  52610. pruneCacheEntry(this.cache, key, this.keys);
  52611. }
  52612. },
  52613. mounted: function mounted () {
  52614. var this$1 = this;
  52615. this.$watch('include', function (val) {
  52616. pruneCache(this$1, function (name) { return matches(val, name); });
  52617. });
  52618. this.$watch('exclude', function (val) {
  52619. pruneCache(this$1, function (name) { return !matches(val, name); });
  52620. });
  52621. },
  52622. render: function render () {
  52623. var slot = this.$slots.default;
  52624. var vnode = getFirstComponentChild(slot);
  52625. var componentOptions = vnode && vnode.componentOptions;
  52626. if (componentOptions) {
  52627. // check pattern
  52628. var name = getComponentName(componentOptions);
  52629. var ref = this;
  52630. var include = ref.include;
  52631. var exclude = ref.exclude;
  52632. if (
  52633. // not included
  52634. (include && (!name || !matches(include, name))) ||
  52635. // excluded
  52636. (exclude && name && matches(exclude, name))
  52637. ) {
  52638. return vnode
  52639. }
  52640. var ref$1 = this;
  52641. var cache = ref$1.cache;
  52642. var keys = ref$1.keys;
  52643. var key = vnode.key == null
  52644. // same constructor may get registered as different local components
  52645. // so cid alone is not enough (#3269)
  52646. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  52647. : vnode.key;
  52648. if (cache[key]) {
  52649. vnode.componentInstance = cache[key].componentInstance;
  52650. // make current key freshest
  52651. remove(keys, key);
  52652. keys.push(key);
  52653. } else {
  52654. cache[key] = vnode;
  52655. keys.push(key);
  52656. // prune oldest entry
  52657. if (this.max && keys.length > parseInt(this.max)) {
  52658. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  52659. }
  52660. }
  52661. vnode.data.keepAlive = true;
  52662. }
  52663. return vnode || (slot && slot[0])
  52664. }
  52665. };
  52666. var builtInComponents = {
  52667. KeepAlive: KeepAlive
  52668. };
  52669. /* */
  52670. function initGlobalAPI (Vue) {
  52671. // config
  52672. var configDef = {};
  52673. configDef.get = function () { return config; };
  52674. {
  52675. configDef.set = function () {
  52676. warn(
  52677. 'Do not replace the Vue.config object, set individual fields instead.'
  52678. );
  52679. };
  52680. }
  52681. Object.defineProperty(Vue, 'config', configDef);
  52682. // exposed util methods.
  52683. // NOTE: these are not considered part of the public API - avoid relying on
  52684. // them unless you are aware of the risk.
  52685. Vue.util = {
  52686. warn: warn,
  52687. extend: extend,
  52688. mergeOptions: mergeOptions,
  52689. defineReactive: defineReactive$$1
  52690. };
  52691. Vue.set = set;
  52692. Vue.delete = del;
  52693. Vue.nextTick = nextTick;
  52694. // 2.6 explicit observable API
  52695. Vue.observable = function (obj) {
  52696. observe(obj);
  52697. return obj
  52698. };
  52699. Vue.options = Object.create(null);
  52700. ASSET_TYPES.forEach(function (type) {
  52701. Vue.options[type + 's'] = Object.create(null);
  52702. });
  52703. // this is used to identify the "base" constructor to extend all plain-object
  52704. // components with in Weex's multi-instance scenarios.
  52705. Vue.options._base = Vue;
  52706. extend(Vue.options.components, builtInComponents);
  52707. initUse(Vue);
  52708. initMixin$1(Vue);
  52709. initExtend(Vue);
  52710. initAssetRegisters(Vue);
  52711. }
  52712. initGlobalAPI(Vue);
  52713. Object.defineProperty(Vue.prototype, '$isServer', {
  52714. get: isServerRendering
  52715. });
  52716. Object.defineProperty(Vue.prototype, '$ssrContext', {
  52717. get: function get () {
  52718. /* istanbul ignore next */
  52719. return this.$vnode && this.$vnode.ssrContext
  52720. }
  52721. });
  52722. // expose FunctionalRenderContext for ssr runtime helper installation
  52723. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  52724. value: FunctionalRenderContext
  52725. });
  52726. Vue.version = '2.6.11';
  52727. /* */
  52728. // these are reserved for web because they are directly compiled away
  52729. // during template compilation
  52730. var isReservedAttr = makeMap('style,class');
  52731. // attributes that should be using props for binding
  52732. var acceptValue = makeMap('input,textarea,option,select,progress');
  52733. var mustUseProp = function (tag, type, attr) {
  52734. return (
  52735. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  52736. (attr === 'selected' && tag === 'option') ||
  52737. (attr === 'checked' && tag === 'input') ||
  52738. (attr === 'muted' && tag === 'video')
  52739. )
  52740. };
  52741. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  52742. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  52743. var convertEnumeratedValue = function (key, value) {
  52744. return isFalsyAttrValue(value) || value === 'false'
  52745. ? 'false'
  52746. // allow arbitrary string value for contenteditable
  52747. : key === 'contenteditable' && isValidContentEditableValue(value)
  52748. ? value
  52749. : 'true'
  52750. };
  52751. var isBooleanAttr = makeMap(
  52752. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  52753. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  52754. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  52755. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  52756. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  52757. 'truespeed,typemustmatch,visible'
  52758. );
  52759. var xlinkNS = 'http://www.w3.org/1999/xlink';
  52760. var isXlink = function (name) {
  52761. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  52762. };
  52763. var getXlinkProp = function (name) {
  52764. return isXlink(name) ? name.slice(6, name.length) : ''
  52765. };
  52766. var isFalsyAttrValue = function (val) {
  52767. return val == null || val === false
  52768. };
  52769. /* */
  52770. function genClassForVnode (vnode) {
  52771. var data = vnode.data;
  52772. var parentNode = vnode;
  52773. var childNode = vnode;
  52774. while (isDef(childNode.componentInstance)) {
  52775. childNode = childNode.componentInstance._vnode;
  52776. if (childNode && childNode.data) {
  52777. data = mergeClassData(childNode.data, data);
  52778. }
  52779. }
  52780. while (isDef(parentNode = parentNode.parent)) {
  52781. if (parentNode && parentNode.data) {
  52782. data = mergeClassData(data, parentNode.data);
  52783. }
  52784. }
  52785. return renderClass(data.staticClass, data.class)
  52786. }
  52787. function mergeClassData (child, parent) {
  52788. return {
  52789. staticClass: concat(child.staticClass, parent.staticClass),
  52790. class: isDef(child.class)
  52791. ? [child.class, parent.class]
  52792. : parent.class
  52793. }
  52794. }
  52795. function renderClass (
  52796. staticClass,
  52797. dynamicClass
  52798. ) {
  52799. if (isDef(staticClass) || isDef(dynamicClass)) {
  52800. return concat(staticClass, stringifyClass(dynamicClass))
  52801. }
  52802. /* istanbul ignore next */
  52803. return ''
  52804. }
  52805. function concat (a, b) {
  52806. return a ? b ? (a + ' ' + b) : a : (b || '')
  52807. }
  52808. function stringifyClass (value) {
  52809. if (Array.isArray(value)) {
  52810. return stringifyArray(value)
  52811. }
  52812. if (isObject(value)) {
  52813. return stringifyObject(value)
  52814. }
  52815. if (typeof value === 'string') {
  52816. return value
  52817. }
  52818. /* istanbul ignore next */
  52819. return ''
  52820. }
  52821. function stringifyArray (value) {
  52822. var res = '';
  52823. var stringified;
  52824. for (var i = 0, l = value.length; i < l; i++) {
  52825. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  52826. if (res) { res += ' '; }
  52827. res += stringified;
  52828. }
  52829. }
  52830. return res
  52831. }
  52832. function stringifyObject (value) {
  52833. var res = '';
  52834. for (var key in value) {
  52835. if (value[key]) {
  52836. if (res) { res += ' '; }
  52837. res += key;
  52838. }
  52839. }
  52840. return res
  52841. }
  52842. /* */
  52843. var namespaceMap = {
  52844. svg: 'http://www.w3.org/2000/svg',
  52845. math: 'http://www.w3.org/1998/Math/MathML'
  52846. };
  52847. var isHTMLTag = makeMap(
  52848. 'html,body,base,head,link,meta,style,title,' +
  52849. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  52850. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  52851. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  52852. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  52853. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  52854. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  52855. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  52856. 'output,progress,select,textarea,' +
  52857. 'details,dialog,menu,menuitem,summary,' +
  52858. 'content,element,shadow,template,blockquote,iframe,tfoot'
  52859. );
  52860. // this map is intentionally selective, only covering SVG elements that may
  52861. // contain child elements.
  52862. var isSVG = makeMap(
  52863. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  52864. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  52865. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  52866. true
  52867. );
  52868. var isPreTag = function (tag) { return tag === 'pre'; };
  52869. var isReservedTag = function (tag) {
  52870. return isHTMLTag(tag) || isSVG(tag)
  52871. };
  52872. function getTagNamespace (tag) {
  52873. if (isSVG(tag)) {
  52874. return 'svg'
  52875. }
  52876. // basic support for MathML
  52877. // note it doesn't support other MathML elements being component roots
  52878. if (tag === 'math') {
  52879. return 'math'
  52880. }
  52881. }
  52882. var unknownElementCache = Object.create(null);
  52883. function isUnknownElement (tag) {
  52884. /* istanbul ignore if */
  52885. if (!inBrowser) {
  52886. return true
  52887. }
  52888. if (isReservedTag(tag)) {
  52889. return false
  52890. }
  52891. tag = tag.toLowerCase();
  52892. /* istanbul ignore if */
  52893. if (unknownElementCache[tag] != null) {
  52894. return unknownElementCache[tag]
  52895. }
  52896. var el = document.createElement(tag);
  52897. if (tag.indexOf('-') > -1) {
  52898. // http://stackoverflow.com/a/28210364/1070244
  52899. return (unknownElementCache[tag] = (
  52900. el.constructor === window.HTMLUnknownElement ||
  52901. el.constructor === window.HTMLElement
  52902. ))
  52903. } else {
  52904. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  52905. }
  52906. }
  52907. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  52908. /* */
  52909. /**
  52910. * Query an element selector if it's not an element already.
  52911. */
  52912. function query (el) {
  52913. if (typeof el === 'string') {
  52914. var selected = document.querySelector(el);
  52915. if (!selected) {
  52916. warn(
  52917. 'Cannot find element: ' + el
  52918. );
  52919. return document.createElement('div')
  52920. }
  52921. return selected
  52922. } else {
  52923. return el
  52924. }
  52925. }
  52926. /* */
  52927. function createElement$1 (tagName, vnode) {
  52928. var elm = document.createElement(tagName);
  52929. if (tagName !== 'select') {
  52930. return elm
  52931. }
  52932. // false or null will remove the attribute but undefined will not
  52933. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  52934. elm.setAttribute('multiple', 'multiple');
  52935. }
  52936. return elm
  52937. }
  52938. function createElementNS (namespace, tagName) {
  52939. return document.createElementNS(namespaceMap[namespace], tagName)
  52940. }
  52941. function createTextNode (text) {
  52942. return document.createTextNode(text)
  52943. }
  52944. function createComment (text) {
  52945. return document.createComment(text)
  52946. }
  52947. function insertBefore (parentNode, newNode, referenceNode) {
  52948. parentNode.insertBefore(newNode, referenceNode);
  52949. }
  52950. function removeChild (node, child) {
  52951. node.removeChild(child);
  52952. }
  52953. function appendChild (node, child) {
  52954. node.appendChild(child);
  52955. }
  52956. function parentNode (node) {
  52957. return node.parentNode
  52958. }
  52959. function nextSibling (node) {
  52960. return node.nextSibling
  52961. }
  52962. function tagName (node) {
  52963. return node.tagName
  52964. }
  52965. function setTextContent (node, text) {
  52966. node.textContent = text;
  52967. }
  52968. function setStyleScope (node, scopeId) {
  52969. node.setAttribute(scopeId, '');
  52970. }
  52971. var nodeOps = /*#__PURE__*/Object.freeze({
  52972. createElement: createElement$1,
  52973. createElementNS: createElementNS,
  52974. createTextNode: createTextNode,
  52975. createComment: createComment,
  52976. insertBefore: insertBefore,
  52977. removeChild: removeChild,
  52978. appendChild: appendChild,
  52979. parentNode: parentNode,
  52980. nextSibling: nextSibling,
  52981. tagName: tagName,
  52982. setTextContent: setTextContent,
  52983. setStyleScope: setStyleScope
  52984. });
  52985. /* */
  52986. var ref = {
  52987. create: function create (_, vnode) {
  52988. registerRef(vnode);
  52989. },
  52990. update: function update (oldVnode, vnode) {
  52991. if (oldVnode.data.ref !== vnode.data.ref) {
  52992. registerRef(oldVnode, true);
  52993. registerRef(vnode);
  52994. }
  52995. },
  52996. destroy: function destroy (vnode) {
  52997. registerRef(vnode, true);
  52998. }
  52999. };
  53000. function registerRef (vnode, isRemoval) {
  53001. var key = vnode.data.ref;
  53002. if (!isDef(key)) { return }
  53003. var vm = vnode.context;
  53004. var ref = vnode.componentInstance || vnode.elm;
  53005. var refs = vm.$refs;
  53006. if (isRemoval) {
  53007. if (Array.isArray(refs[key])) {
  53008. remove(refs[key], ref);
  53009. } else if (refs[key] === ref) {
  53010. refs[key] = undefined;
  53011. }
  53012. } else {
  53013. if (vnode.data.refInFor) {
  53014. if (!Array.isArray(refs[key])) {
  53015. refs[key] = [ref];
  53016. } else if (refs[key].indexOf(ref) < 0) {
  53017. // $flow-disable-line
  53018. refs[key].push(ref);
  53019. }
  53020. } else {
  53021. refs[key] = ref;
  53022. }
  53023. }
  53024. }
  53025. /**
  53026. * Virtual DOM patching algorithm based on Snabbdom by
  53027. * Simon Friis Vindum (@paldepind)
  53028. * Licensed under the MIT License
  53029. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  53030. *
  53031. * modified by Evan You (@yyx990803)
  53032. *
  53033. * Not type-checking this because this file is perf-critical and the cost
  53034. * of making flow understand it is not worth it.
  53035. */
  53036. var emptyNode = new VNode('', {}, []);
  53037. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  53038. function sameVnode (a, b) {
  53039. return (
  53040. a.key === b.key && (
  53041. (
  53042. a.tag === b.tag &&
  53043. a.isComment === b.isComment &&
  53044. isDef(a.data) === isDef(b.data) &&
  53045. sameInputType(a, b)
  53046. ) || (
  53047. isTrue(a.isAsyncPlaceholder) &&
  53048. a.asyncFactory === b.asyncFactory &&
  53049. isUndef(b.asyncFactory.error)
  53050. )
  53051. )
  53052. )
  53053. }
  53054. function sameInputType (a, b) {
  53055. if (a.tag !== 'input') { return true }
  53056. var i;
  53057. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  53058. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  53059. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  53060. }
  53061. function createKeyToOldIdx (children, beginIdx, endIdx) {
  53062. var i, key;
  53063. var map = {};
  53064. for (i = beginIdx; i <= endIdx; ++i) {
  53065. key = children[i].key;
  53066. if (isDef(key)) { map[key] = i; }
  53067. }
  53068. return map
  53069. }
  53070. function createPatchFunction (backend) {
  53071. var i, j;
  53072. var cbs = {};
  53073. var modules = backend.modules;
  53074. var nodeOps = backend.nodeOps;
  53075. for (i = 0; i < hooks.length; ++i) {
  53076. cbs[hooks[i]] = [];
  53077. for (j = 0; j < modules.length; ++j) {
  53078. if (isDef(modules[j][hooks[i]])) {
  53079. cbs[hooks[i]].push(modules[j][hooks[i]]);
  53080. }
  53081. }
  53082. }
  53083. function emptyNodeAt (elm) {
  53084. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  53085. }
  53086. function createRmCb (childElm, listeners) {
  53087. function remove$$1 () {
  53088. if (--remove$$1.listeners === 0) {
  53089. removeNode(childElm);
  53090. }
  53091. }
  53092. remove$$1.listeners = listeners;
  53093. return remove$$1
  53094. }
  53095. function removeNode (el) {
  53096. var parent = nodeOps.parentNode(el);
  53097. // element may have already been removed due to v-html / v-text
  53098. if (isDef(parent)) {
  53099. nodeOps.removeChild(parent, el);
  53100. }
  53101. }
  53102. function isUnknownElement$$1 (vnode, inVPre) {
  53103. return (
  53104. !inVPre &&
  53105. !vnode.ns &&
  53106. !(
  53107. config.ignoredElements.length &&
  53108. config.ignoredElements.some(function (ignore) {
  53109. return isRegExp(ignore)
  53110. ? ignore.test(vnode.tag)
  53111. : ignore === vnode.tag
  53112. })
  53113. ) &&
  53114. config.isUnknownElement(vnode.tag)
  53115. )
  53116. }
  53117. var creatingElmInVPre = 0;
  53118. function createElm (
  53119. vnode,
  53120. insertedVnodeQueue,
  53121. parentElm,
  53122. refElm,
  53123. nested,
  53124. ownerArray,
  53125. index
  53126. ) {
  53127. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53128. // This vnode was used in a previous render!
  53129. // now it's used as a new node, overwriting its elm would cause
  53130. // potential patch errors down the road when it's used as an insertion
  53131. // reference node. Instead, we clone the node on-demand before creating
  53132. // associated DOM element for it.
  53133. vnode = ownerArray[index] = cloneVNode(vnode);
  53134. }
  53135. vnode.isRootInsert = !nested; // for transition enter check
  53136. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  53137. return
  53138. }
  53139. var data = vnode.data;
  53140. var children = vnode.children;
  53141. var tag = vnode.tag;
  53142. if (isDef(tag)) {
  53143. {
  53144. if (data && data.pre) {
  53145. creatingElmInVPre++;
  53146. }
  53147. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  53148. warn(
  53149. 'Unknown custom element: <' + tag + '> - did you ' +
  53150. 'register the component correctly? For recursive components, ' +
  53151. 'make sure to provide the "name" option.',
  53152. vnode.context
  53153. );
  53154. }
  53155. }
  53156. vnode.elm = vnode.ns
  53157. ? nodeOps.createElementNS(vnode.ns, tag)
  53158. : nodeOps.createElement(tag, vnode);
  53159. setScope(vnode);
  53160. /* istanbul ignore if */
  53161. {
  53162. createChildren(vnode, children, insertedVnodeQueue);
  53163. if (isDef(data)) {
  53164. invokeCreateHooks(vnode, insertedVnodeQueue);
  53165. }
  53166. insert(parentElm, vnode.elm, refElm);
  53167. }
  53168. if (data && data.pre) {
  53169. creatingElmInVPre--;
  53170. }
  53171. } else if (isTrue(vnode.isComment)) {
  53172. vnode.elm = nodeOps.createComment(vnode.text);
  53173. insert(parentElm, vnode.elm, refElm);
  53174. } else {
  53175. vnode.elm = nodeOps.createTextNode(vnode.text);
  53176. insert(parentElm, vnode.elm, refElm);
  53177. }
  53178. }
  53179. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  53180. var i = vnode.data;
  53181. if (isDef(i)) {
  53182. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  53183. if (isDef(i = i.hook) && isDef(i = i.init)) {
  53184. i(vnode, false /* hydrating */);
  53185. }
  53186. // after calling the init hook, if the vnode is a child component
  53187. // it should've created a child instance and mounted it. the child
  53188. // component also has set the placeholder vnode's elm.
  53189. // in that case we can just return the element and be done.
  53190. if (isDef(vnode.componentInstance)) {
  53191. initComponent(vnode, insertedVnodeQueue);
  53192. insert(parentElm, vnode.elm, refElm);
  53193. if (isTrue(isReactivated)) {
  53194. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  53195. }
  53196. return true
  53197. }
  53198. }
  53199. }
  53200. function initComponent (vnode, insertedVnodeQueue) {
  53201. if (isDef(vnode.data.pendingInsert)) {
  53202. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  53203. vnode.data.pendingInsert = null;
  53204. }
  53205. vnode.elm = vnode.componentInstance.$el;
  53206. if (isPatchable(vnode)) {
  53207. invokeCreateHooks(vnode, insertedVnodeQueue);
  53208. setScope(vnode);
  53209. } else {
  53210. // empty component root.
  53211. // skip all element-related modules except for ref (#3455)
  53212. registerRef(vnode);
  53213. // make sure to invoke the insert hook
  53214. insertedVnodeQueue.push(vnode);
  53215. }
  53216. }
  53217. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  53218. var i;
  53219. // hack for #4339: a reactivated component with inner transition
  53220. // does not trigger because the inner node's created hooks are not called
  53221. // again. It's not ideal to involve module-specific logic in here but
  53222. // there doesn't seem to be a better way to do it.
  53223. var innerNode = vnode;
  53224. while (innerNode.componentInstance) {
  53225. innerNode = innerNode.componentInstance._vnode;
  53226. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  53227. for (i = 0; i < cbs.activate.length; ++i) {
  53228. cbs.activate[i](emptyNode, innerNode);
  53229. }
  53230. insertedVnodeQueue.push(innerNode);
  53231. break
  53232. }
  53233. }
  53234. // unlike a newly created component,
  53235. // a reactivated keep-alive component doesn't insert itself
  53236. insert(parentElm, vnode.elm, refElm);
  53237. }
  53238. function insert (parent, elm, ref$$1) {
  53239. if (isDef(parent)) {
  53240. if (isDef(ref$$1)) {
  53241. if (nodeOps.parentNode(ref$$1) === parent) {
  53242. nodeOps.insertBefore(parent, elm, ref$$1);
  53243. }
  53244. } else {
  53245. nodeOps.appendChild(parent, elm);
  53246. }
  53247. }
  53248. }
  53249. function createChildren (vnode, children, insertedVnodeQueue) {
  53250. if (Array.isArray(children)) {
  53251. {
  53252. checkDuplicateKeys(children);
  53253. }
  53254. for (var i = 0; i < children.length; ++i) {
  53255. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  53256. }
  53257. } else if (isPrimitive(vnode.text)) {
  53258. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  53259. }
  53260. }
  53261. function isPatchable (vnode) {
  53262. while (vnode.componentInstance) {
  53263. vnode = vnode.componentInstance._vnode;
  53264. }
  53265. return isDef(vnode.tag)
  53266. }
  53267. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  53268. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53269. cbs.create[i$1](emptyNode, vnode);
  53270. }
  53271. i = vnode.data.hook; // Reuse variable
  53272. if (isDef(i)) {
  53273. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  53274. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  53275. }
  53276. }
  53277. // set scope id attribute for scoped CSS.
  53278. // this is implemented as a special case to avoid the overhead
  53279. // of going through the normal attribute patching process.
  53280. function setScope (vnode) {
  53281. var i;
  53282. if (isDef(i = vnode.fnScopeId)) {
  53283. nodeOps.setStyleScope(vnode.elm, i);
  53284. } else {
  53285. var ancestor = vnode;
  53286. while (ancestor) {
  53287. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  53288. nodeOps.setStyleScope(vnode.elm, i);
  53289. }
  53290. ancestor = ancestor.parent;
  53291. }
  53292. }
  53293. // for slot content they should also get the scopeId from the host instance.
  53294. if (isDef(i = activeInstance) &&
  53295. i !== vnode.context &&
  53296. i !== vnode.fnContext &&
  53297. isDef(i = i.$options._scopeId)
  53298. ) {
  53299. nodeOps.setStyleScope(vnode.elm, i);
  53300. }
  53301. }
  53302. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  53303. for (; startIdx <= endIdx; ++startIdx) {
  53304. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  53305. }
  53306. }
  53307. function invokeDestroyHook (vnode) {
  53308. var i, j;
  53309. var data = vnode.data;
  53310. if (isDef(data)) {
  53311. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  53312. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  53313. }
  53314. if (isDef(i = vnode.children)) {
  53315. for (j = 0; j < vnode.children.length; ++j) {
  53316. invokeDestroyHook(vnode.children[j]);
  53317. }
  53318. }
  53319. }
  53320. function removeVnodes (vnodes, startIdx, endIdx) {
  53321. for (; startIdx <= endIdx; ++startIdx) {
  53322. var ch = vnodes[startIdx];
  53323. if (isDef(ch)) {
  53324. if (isDef(ch.tag)) {
  53325. removeAndInvokeRemoveHook(ch);
  53326. invokeDestroyHook(ch);
  53327. } else { // Text node
  53328. removeNode(ch.elm);
  53329. }
  53330. }
  53331. }
  53332. }
  53333. function removeAndInvokeRemoveHook (vnode, rm) {
  53334. if (isDef(rm) || isDef(vnode.data)) {
  53335. var i;
  53336. var listeners = cbs.remove.length + 1;
  53337. if (isDef(rm)) {
  53338. // we have a recursively passed down rm callback
  53339. // increase the listeners count
  53340. rm.listeners += listeners;
  53341. } else {
  53342. // directly removing
  53343. rm = createRmCb(vnode.elm, listeners);
  53344. }
  53345. // recursively invoke hooks on child component root node
  53346. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  53347. removeAndInvokeRemoveHook(i, rm);
  53348. }
  53349. for (i = 0; i < cbs.remove.length; ++i) {
  53350. cbs.remove[i](vnode, rm);
  53351. }
  53352. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  53353. i(vnode, rm);
  53354. } else {
  53355. rm();
  53356. }
  53357. } else {
  53358. removeNode(vnode.elm);
  53359. }
  53360. }
  53361. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  53362. var oldStartIdx = 0;
  53363. var newStartIdx = 0;
  53364. var oldEndIdx = oldCh.length - 1;
  53365. var oldStartVnode = oldCh[0];
  53366. var oldEndVnode = oldCh[oldEndIdx];
  53367. var newEndIdx = newCh.length - 1;
  53368. var newStartVnode = newCh[0];
  53369. var newEndVnode = newCh[newEndIdx];
  53370. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  53371. // removeOnly is a special flag used only by <transition-group>
  53372. // to ensure removed elements stay in correct relative positions
  53373. // during leaving transitions
  53374. var canMove = !removeOnly;
  53375. {
  53376. checkDuplicateKeys(newCh);
  53377. }
  53378. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  53379. if (isUndef(oldStartVnode)) {
  53380. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  53381. } else if (isUndef(oldEndVnode)) {
  53382. oldEndVnode = oldCh[--oldEndIdx];
  53383. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  53384. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53385. oldStartVnode = oldCh[++oldStartIdx];
  53386. newStartVnode = newCh[++newStartIdx];
  53387. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  53388. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  53389. oldEndVnode = oldCh[--oldEndIdx];
  53390. newEndVnode = newCh[--newEndIdx];
  53391. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  53392. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  53393. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  53394. oldStartVnode = oldCh[++oldStartIdx];
  53395. newEndVnode = newCh[--newEndIdx];
  53396. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  53397. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53398. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  53399. oldEndVnode = oldCh[--oldEndIdx];
  53400. newStartVnode = newCh[++newStartIdx];
  53401. } else {
  53402. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  53403. idxInOld = isDef(newStartVnode.key)
  53404. ? oldKeyToIdx[newStartVnode.key]
  53405. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  53406. if (isUndef(idxInOld)) { // New element
  53407. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  53408. } else {
  53409. vnodeToMove = oldCh[idxInOld];
  53410. if (sameVnode(vnodeToMove, newStartVnode)) {
  53411. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  53412. oldCh[idxInOld] = undefined;
  53413. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  53414. } else {
  53415. // same key but different element. treat as new element
  53416. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  53417. }
  53418. }
  53419. newStartVnode = newCh[++newStartIdx];
  53420. }
  53421. }
  53422. if (oldStartIdx > oldEndIdx) {
  53423. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  53424. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  53425. } else if (newStartIdx > newEndIdx) {
  53426. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  53427. }
  53428. }
  53429. function checkDuplicateKeys (children) {
  53430. var seenKeys = {};
  53431. for (var i = 0; i < children.length; i++) {
  53432. var vnode = children[i];
  53433. var key = vnode.key;
  53434. if (isDef(key)) {
  53435. if (seenKeys[key]) {
  53436. warn(
  53437. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  53438. vnode.context
  53439. );
  53440. } else {
  53441. seenKeys[key] = true;
  53442. }
  53443. }
  53444. }
  53445. }
  53446. function findIdxInOld (node, oldCh, start, end) {
  53447. for (var i = start; i < end; i++) {
  53448. var c = oldCh[i];
  53449. if (isDef(c) && sameVnode(node, c)) { return i }
  53450. }
  53451. }
  53452. function patchVnode (
  53453. oldVnode,
  53454. vnode,
  53455. insertedVnodeQueue,
  53456. ownerArray,
  53457. index,
  53458. removeOnly
  53459. ) {
  53460. if (oldVnode === vnode) {
  53461. return
  53462. }
  53463. if (isDef(vnode.elm) && isDef(ownerArray)) {
  53464. // clone reused vnode
  53465. vnode = ownerArray[index] = cloneVNode(vnode);
  53466. }
  53467. var elm = vnode.elm = oldVnode.elm;
  53468. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  53469. if (isDef(vnode.asyncFactory.resolved)) {
  53470. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  53471. } else {
  53472. vnode.isAsyncPlaceholder = true;
  53473. }
  53474. return
  53475. }
  53476. // reuse element for static trees.
  53477. // note we only do this if the vnode is cloned -
  53478. // if the new node is not cloned it means the render functions have been
  53479. // reset by the hot-reload-api and we need to do a proper re-render.
  53480. if (isTrue(vnode.isStatic) &&
  53481. isTrue(oldVnode.isStatic) &&
  53482. vnode.key === oldVnode.key &&
  53483. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  53484. ) {
  53485. vnode.componentInstance = oldVnode.componentInstance;
  53486. return
  53487. }
  53488. var i;
  53489. var data = vnode.data;
  53490. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  53491. i(oldVnode, vnode);
  53492. }
  53493. var oldCh = oldVnode.children;
  53494. var ch = vnode.children;
  53495. if (isDef(data) && isPatchable(vnode)) {
  53496. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  53497. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  53498. }
  53499. if (isUndef(vnode.text)) {
  53500. if (isDef(oldCh) && isDef(ch)) {
  53501. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  53502. } else if (isDef(ch)) {
  53503. {
  53504. checkDuplicateKeys(ch);
  53505. }
  53506. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  53507. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  53508. } else if (isDef(oldCh)) {
  53509. removeVnodes(oldCh, 0, oldCh.length - 1);
  53510. } else if (isDef(oldVnode.text)) {
  53511. nodeOps.setTextContent(elm, '');
  53512. }
  53513. } else if (oldVnode.text !== vnode.text) {
  53514. nodeOps.setTextContent(elm, vnode.text);
  53515. }
  53516. if (isDef(data)) {
  53517. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  53518. }
  53519. }
  53520. function invokeInsertHook (vnode, queue, initial) {
  53521. // delay insert hooks for component root nodes, invoke them after the
  53522. // element is really inserted
  53523. if (isTrue(initial) && isDef(vnode.parent)) {
  53524. vnode.parent.data.pendingInsert = queue;
  53525. } else {
  53526. for (var i = 0; i < queue.length; ++i) {
  53527. queue[i].data.hook.insert(queue[i]);
  53528. }
  53529. }
  53530. }
  53531. var hydrationBailed = false;
  53532. // list of modules that can skip create hook during hydration because they
  53533. // are already rendered on the client or has no need for initialization
  53534. // Note: style is excluded because it relies on initial clone for future
  53535. // deep updates (#7063).
  53536. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  53537. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  53538. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  53539. var i;
  53540. var tag = vnode.tag;
  53541. var data = vnode.data;
  53542. var children = vnode.children;
  53543. inVPre = inVPre || (data && data.pre);
  53544. vnode.elm = elm;
  53545. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  53546. vnode.isAsyncPlaceholder = true;
  53547. return true
  53548. }
  53549. // assert node match
  53550. {
  53551. if (!assertNodeMatch(elm, vnode, inVPre)) {
  53552. return false
  53553. }
  53554. }
  53555. if (isDef(data)) {
  53556. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  53557. if (isDef(i = vnode.componentInstance)) {
  53558. // child component. it should have hydrated its own tree.
  53559. initComponent(vnode, insertedVnodeQueue);
  53560. return true
  53561. }
  53562. }
  53563. if (isDef(tag)) {
  53564. if (isDef(children)) {
  53565. // empty element, allow client to pick up and populate children
  53566. if (!elm.hasChildNodes()) {
  53567. createChildren(vnode, children, insertedVnodeQueue);
  53568. } else {
  53569. // v-html and domProps: innerHTML
  53570. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  53571. if (i !== elm.innerHTML) {
  53572. /* istanbul ignore if */
  53573. if (typeof console !== 'undefined' &&
  53574. !hydrationBailed
  53575. ) {
  53576. hydrationBailed = true;
  53577. console.warn('Parent: ', elm);
  53578. console.warn('server innerHTML: ', i);
  53579. console.warn('client innerHTML: ', elm.innerHTML);
  53580. }
  53581. return false
  53582. }
  53583. } else {
  53584. // iterate and compare children lists
  53585. var childrenMatch = true;
  53586. var childNode = elm.firstChild;
  53587. for (var i$1 = 0; i$1 < children.length; i$1++) {
  53588. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  53589. childrenMatch = false;
  53590. break
  53591. }
  53592. childNode = childNode.nextSibling;
  53593. }
  53594. // if childNode is not null, it means the actual childNodes list is
  53595. // longer than the virtual children list.
  53596. if (!childrenMatch || childNode) {
  53597. /* istanbul ignore if */
  53598. if (typeof console !== 'undefined' &&
  53599. !hydrationBailed
  53600. ) {
  53601. hydrationBailed = true;
  53602. console.warn('Parent: ', elm);
  53603. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  53604. }
  53605. return false
  53606. }
  53607. }
  53608. }
  53609. }
  53610. if (isDef(data)) {
  53611. var fullInvoke = false;
  53612. for (var key in data) {
  53613. if (!isRenderedModule(key)) {
  53614. fullInvoke = true;
  53615. invokeCreateHooks(vnode, insertedVnodeQueue);
  53616. break
  53617. }
  53618. }
  53619. if (!fullInvoke && data['class']) {
  53620. // ensure collecting deps for deep class bindings for future updates
  53621. traverse(data['class']);
  53622. }
  53623. }
  53624. } else if (elm.data !== vnode.text) {
  53625. elm.data = vnode.text;
  53626. }
  53627. return true
  53628. }
  53629. function assertNodeMatch (node, vnode, inVPre) {
  53630. if (isDef(vnode.tag)) {
  53631. return vnode.tag.indexOf('vue-component') === 0 || (
  53632. !isUnknownElement$$1(vnode, inVPre) &&
  53633. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  53634. )
  53635. } else {
  53636. return node.nodeType === (vnode.isComment ? 8 : 3)
  53637. }
  53638. }
  53639. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  53640. if (isUndef(vnode)) {
  53641. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  53642. return
  53643. }
  53644. var isInitialPatch = false;
  53645. var insertedVnodeQueue = [];
  53646. if (isUndef(oldVnode)) {
  53647. // empty mount (likely as component), create new root element
  53648. isInitialPatch = true;
  53649. createElm(vnode, insertedVnodeQueue);
  53650. } else {
  53651. var isRealElement = isDef(oldVnode.nodeType);
  53652. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  53653. // patch existing root node
  53654. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  53655. } else {
  53656. if (isRealElement) {
  53657. // mounting to a real element
  53658. // check if this is server-rendered content and if we can perform
  53659. // a successful hydration.
  53660. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  53661. oldVnode.removeAttribute(SSR_ATTR);
  53662. hydrating = true;
  53663. }
  53664. if (isTrue(hydrating)) {
  53665. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  53666. invokeInsertHook(vnode, insertedVnodeQueue, true);
  53667. return oldVnode
  53668. } else {
  53669. warn(
  53670. 'The client-side rendered virtual DOM tree is not matching ' +
  53671. 'server-rendered content. This is likely caused by incorrect ' +
  53672. 'HTML markup, for example nesting block-level elements inside ' +
  53673. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  53674. 'full client-side render.'
  53675. );
  53676. }
  53677. }
  53678. // either not server-rendered, or hydration failed.
  53679. // create an empty node and replace it
  53680. oldVnode = emptyNodeAt(oldVnode);
  53681. }
  53682. // replacing existing element
  53683. var oldElm = oldVnode.elm;
  53684. var parentElm = nodeOps.parentNode(oldElm);
  53685. // create new node
  53686. createElm(
  53687. vnode,
  53688. insertedVnodeQueue,
  53689. // extremely rare edge case: do not insert if old element is in a
  53690. // leaving transition. Only happens when combining transition +
  53691. // keep-alive + HOCs. (#4590)
  53692. oldElm._leaveCb ? null : parentElm,
  53693. nodeOps.nextSibling(oldElm)
  53694. );
  53695. // update parent placeholder node element, recursively
  53696. if (isDef(vnode.parent)) {
  53697. var ancestor = vnode.parent;
  53698. var patchable = isPatchable(vnode);
  53699. while (ancestor) {
  53700. for (var i = 0; i < cbs.destroy.length; ++i) {
  53701. cbs.destroy[i](ancestor);
  53702. }
  53703. ancestor.elm = vnode.elm;
  53704. if (patchable) {
  53705. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  53706. cbs.create[i$1](emptyNode, ancestor);
  53707. }
  53708. // #6513
  53709. // invoke insert hooks that may have been merged by create hooks.
  53710. // e.g. for directives that uses the "inserted" hook.
  53711. var insert = ancestor.data.hook.insert;
  53712. if (insert.merged) {
  53713. // start at index 1 to avoid re-invoking component mounted hook
  53714. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  53715. insert.fns[i$2]();
  53716. }
  53717. }
  53718. } else {
  53719. registerRef(ancestor);
  53720. }
  53721. ancestor = ancestor.parent;
  53722. }
  53723. }
  53724. // destroy old node
  53725. if (isDef(parentElm)) {
  53726. removeVnodes([oldVnode], 0, 0);
  53727. } else if (isDef(oldVnode.tag)) {
  53728. invokeDestroyHook(oldVnode);
  53729. }
  53730. }
  53731. }
  53732. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  53733. return vnode.elm
  53734. }
  53735. }
  53736. /* */
  53737. var directives = {
  53738. create: updateDirectives,
  53739. update: updateDirectives,
  53740. destroy: function unbindDirectives (vnode) {
  53741. updateDirectives(vnode, emptyNode);
  53742. }
  53743. };
  53744. function updateDirectives (oldVnode, vnode) {
  53745. if (oldVnode.data.directives || vnode.data.directives) {
  53746. _update(oldVnode, vnode);
  53747. }
  53748. }
  53749. function _update (oldVnode, vnode) {
  53750. var isCreate = oldVnode === emptyNode;
  53751. var isDestroy = vnode === emptyNode;
  53752. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  53753. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  53754. var dirsWithInsert = [];
  53755. var dirsWithPostpatch = [];
  53756. var key, oldDir, dir;
  53757. for (key in newDirs) {
  53758. oldDir = oldDirs[key];
  53759. dir = newDirs[key];
  53760. if (!oldDir) {
  53761. // new directive, bind
  53762. callHook$1(dir, 'bind', vnode, oldVnode);
  53763. if (dir.def && dir.def.inserted) {
  53764. dirsWithInsert.push(dir);
  53765. }
  53766. } else {
  53767. // existing directive, update
  53768. dir.oldValue = oldDir.value;
  53769. dir.oldArg = oldDir.arg;
  53770. callHook$1(dir, 'update', vnode, oldVnode);
  53771. if (dir.def && dir.def.componentUpdated) {
  53772. dirsWithPostpatch.push(dir);
  53773. }
  53774. }
  53775. }
  53776. if (dirsWithInsert.length) {
  53777. var callInsert = function () {
  53778. for (var i = 0; i < dirsWithInsert.length; i++) {
  53779. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  53780. }
  53781. };
  53782. if (isCreate) {
  53783. mergeVNodeHook(vnode, 'insert', callInsert);
  53784. } else {
  53785. callInsert();
  53786. }
  53787. }
  53788. if (dirsWithPostpatch.length) {
  53789. mergeVNodeHook(vnode, 'postpatch', function () {
  53790. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  53791. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  53792. }
  53793. });
  53794. }
  53795. if (!isCreate) {
  53796. for (key in oldDirs) {
  53797. if (!newDirs[key]) {
  53798. // no longer present, unbind
  53799. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  53800. }
  53801. }
  53802. }
  53803. }
  53804. var emptyModifiers = Object.create(null);
  53805. function normalizeDirectives$1 (
  53806. dirs,
  53807. vm
  53808. ) {
  53809. var res = Object.create(null);
  53810. if (!dirs) {
  53811. // $flow-disable-line
  53812. return res
  53813. }
  53814. var i, dir;
  53815. for (i = 0; i < dirs.length; i++) {
  53816. dir = dirs[i];
  53817. if (!dir.modifiers) {
  53818. // $flow-disable-line
  53819. dir.modifiers = emptyModifiers;
  53820. }
  53821. res[getRawDirName(dir)] = dir;
  53822. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  53823. }
  53824. // $flow-disable-line
  53825. return res
  53826. }
  53827. function getRawDirName (dir) {
  53828. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  53829. }
  53830. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  53831. var fn = dir.def && dir.def[hook];
  53832. if (fn) {
  53833. try {
  53834. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  53835. } catch (e) {
  53836. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  53837. }
  53838. }
  53839. }
  53840. var baseModules = [
  53841. ref,
  53842. directives
  53843. ];
  53844. /* */
  53845. function updateAttrs (oldVnode, vnode) {
  53846. var opts = vnode.componentOptions;
  53847. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  53848. return
  53849. }
  53850. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  53851. return
  53852. }
  53853. var key, cur, old;
  53854. var elm = vnode.elm;
  53855. var oldAttrs = oldVnode.data.attrs || {};
  53856. var attrs = vnode.data.attrs || {};
  53857. // clone observed objects, as the user probably wants to mutate it
  53858. if (isDef(attrs.__ob__)) {
  53859. attrs = vnode.data.attrs = extend({}, attrs);
  53860. }
  53861. for (key in attrs) {
  53862. cur = attrs[key];
  53863. old = oldAttrs[key];
  53864. if (old !== cur) {
  53865. setAttr(elm, key, cur);
  53866. }
  53867. }
  53868. // #4391: in IE9, setting type can reset value for input[type=radio]
  53869. // #6666: IE/Edge forces progress value down to 1 before setting a max
  53870. /* istanbul ignore if */
  53871. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  53872. setAttr(elm, 'value', attrs.value);
  53873. }
  53874. for (key in oldAttrs) {
  53875. if (isUndef(attrs[key])) {
  53876. if (isXlink(key)) {
  53877. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53878. } else if (!isEnumeratedAttr(key)) {
  53879. elm.removeAttribute(key);
  53880. }
  53881. }
  53882. }
  53883. }
  53884. function setAttr (el, key, value) {
  53885. if (el.tagName.indexOf('-') > -1) {
  53886. baseSetAttr(el, key, value);
  53887. } else if (isBooleanAttr(key)) {
  53888. // set attribute for blank value
  53889. // e.g. <option disabled>Select one</option>
  53890. if (isFalsyAttrValue(value)) {
  53891. el.removeAttribute(key);
  53892. } else {
  53893. // technically allowfullscreen is a boolean attribute for <iframe>,
  53894. // but Flash expects a value of "true" when used on <embed> tag
  53895. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  53896. ? 'true'
  53897. : key;
  53898. el.setAttribute(key, value);
  53899. }
  53900. } else if (isEnumeratedAttr(key)) {
  53901. el.setAttribute(key, convertEnumeratedValue(key, value));
  53902. } else if (isXlink(key)) {
  53903. if (isFalsyAttrValue(value)) {
  53904. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  53905. } else {
  53906. el.setAttributeNS(xlinkNS, key, value);
  53907. }
  53908. } else {
  53909. baseSetAttr(el, key, value);
  53910. }
  53911. }
  53912. function baseSetAttr (el, key, value) {
  53913. if (isFalsyAttrValue(value)) {
  53914. el.removeAttribute(key);
  53915. } else {
  53916. // #7138: IE10 & 11 fires input event when setting placeholder on
  53917. // <textarea>... block the first input event and remove the blocker
  53918. // immediately.
  53919. /* istanbul ignore if */
  53920. if (
  53921. isIE && !isIE9 &&
  53922. el.tagName === 'TEXTAREA' &&
  53923. key === 'placeholder' && value !== '' && !el.__ieph
  53924. ) {
  53925. var blocker = function (e) {
  53926. e.stopImmediatePropagation();
  53927. el.removeEventListener('input', blocker);
  53928. };
  53929. el.addEventListener('input', blocker);
  53930. // $flow-disable-line
  53931. el.__ieph = true; /* IE placeholder patched */
  53932. }
  53933. el.setAttribute(key, value);
  53934. }
  53935. }
  53936. var attrs = {
  53937. create: updateAttrs,
  53938. update: updateAttrs
  53939. };
  53940. /* */
  53941. function updateClass (oldVnode, vnode) {
  53942. var el = vnode.elm;
  53943. var data = vnode.data;
  53944. var oldData = oldVnode.data;
  53945. if (
  53946. isUndef(data.staticClass) &&
  53947. isUndef(data.class) && (
  53948. isUndef(oldData) || (
  53949. isUndef(oldData.staticClass) &&
  53950. isUndef(oldData.class)
  53951. )
  53952. )
  53953. ) {
  53954. return
  53955. }
  53956. var cls = genClassForVnode(vnode);
  53957. // handle transition classes
  53958. var transitionClass = el._transitionClasses;
  53959. if (isDef(transitionClass)) {
  53960. cls = concat(cls, stringifyClass(transitionClass));
  53961. }
  53962. // set the class
  53963. if (cls !== el._prevClass) {
  53964. el.setAttribute('class', cls);
  53965. el._prevClass = cls;
  53966. }
  53967. }
  53968. var klass = {
  53969. create: updateClass,
  53970. update: updateClass
  53971. };
  53972. /* */
  53973. var validDivisionCharRE = /[\w).+\-_$\]]/;
  53974. function parseFilters (exp) {
  53975. var inSingle = false;
  53976. var inDouble = false;
  53977. var inTemplateString = false;
  53978. var inRegex = false;
  53979. var curly = 0;
  53980. var square = 0;
  53981. var paren = 0;
  53982. var lastFilterIndex = 0;
  53983. var c, prev, i, expression, filters;
  53984. for (i = 0; i < exp.length; i++) {
  53985. prev = c;
  53986. c = exp.charCodeAt(i);
  53987. if (inSingle) {
  53988. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  53989. } else if (inDouble) {
  53990. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  53991. } else if (inTemplateString) {
  53992. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  53993. } else if (inRegex) {
  53994. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  53995. } else if (
  53996. c === 0x7C && // pipe
  53997. exp.charCodeAt(i + 1) !== 0x7C &&
  53998. exp.charCodeAt(i - 1) !== 0x7C &&
  53999. !curly && !square && !paren
  54000. ) {
  54001. if (expression === undefined) {
  54002. // first filter, end of expression
  54003. lastFilterIndex = i + 1;
  54004. expression = exp.slice(0, i).trim();
  54005. } else {
  54006. pushFilter();
  54007. }
  54008. } else {
  54009. switch (c) {
  54010. case 0x22: inDouble = true; break // "
  54011. case 0x27: inSingle = true; break // '
  54012. case 0x60: inTemplateString = true; break // `
  54013. case 0x28: paren++; break // (
  54014. case 0x29: paren--; break // )
  54015. case 0x5B: square++; break // [
  54016. case 0x5D: square--; break // ]
  54017. case 0x7B: curly++; break // {
  54018. case 0x7D: curly--; break // }
  54019. }
  54020. if (c === 0x2f) { // /
  54021. var j = i - 1;
  54022. var p = (void 0);
  54023. // find first non-whitespace prev char
  54024. for (; j >= 0; j--) {
  54025. p = exp.charAt(j);
  54026. if (p !== ' ') { break }
  54027. }
  54028. if (!p || !validDivisionCharRE.test(p)) {
  54029. inRegex = true;
  54030. }
  54031. }
  54032. }
  54033. }
  54034. if (expression === undefined) {
  54035. expression = exp.slice(0, i).trim();
  54036. } else if (lastFilterIndex !== 0) {
  54037. pushFilter();
  54038. }
  54039. function pushFilter () {
  54040. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  54041. lastFilterIndex = i + 1;
  54042. }
  54043. if (filters) {
  54044. for (i = 0; i < filters.length; i++) {
  54045. expression = wrapFilter(expression, filters[i]);
  54046. }
  54047. }
  54048. return expression
  54049. }
  54050. function wrapFilter (exp, filter) {
  54051. var i = filter.indexOf('(');
  54052. if (i < 0) {
  54053. // _f: resolveFilter
  54054. return ("_f(\"" + filter + "\")(" + exp + ")")
  54055. } else {
  54056. var name = filter.slice(0, i);
  54057. var args = filter.slice(i + 1);
  54058. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  54059. }
  54060. }
  54061. /* */
  54062. /* eslint-disable no-unused-vars */
  54063. function baseWarn (msg, range) {
  54064. console.error(("[Vue compiler]: " + msg));
  54065. }
  54066. /* eslint-enable no-unused-vars */
  54067. function pluckModuleFunction (
  54068. modules,
  54069. key
  54070. ) {
  54071. return modules
  54072. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  54073. : []
  54074. }
  54075. function addProp (el, name, value, range, dynamic) {
  54076. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54077. el.plain = false;
  54078. }
  54079. function addAttr (el, name, value, range, dynamic) {
  54080. var attrs = dynamic
  54081. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  54082. : (el.attrs || (el.attrs = []));
  54083. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  54084. el.plain = false;
  54085. }
  54086. // add a raw attr (use this in preTransforms)
  54087. function addRawAttr (el, name, value, range) {
  54088. el.attrsMap[name] = value;
  54089. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  54090. }
  54091. function addDirective (
  54092. el,
  54093. name,
  54094. rawName,
  54095. value,
  54096. arg,
  54097. isDynamicArg,
  54098. modifiers,
  54099. range
  54100. ) {
  54101. (el.directives || (el.directives = [])).push(rangeSetItem({
  54102. name: name,
  54103. rawName: rawName,
  54104. value: value,
  54105. arg: arg,
  54106. isDynamicArg: isDynamicArg,
  54107. modifiers: modifiers
  54108. }, range));
  54109. el.plain = false;
  54110. }
  54111. function prependModifierMarker (symbol, name, dynamic) {
  54112. return dynamic
  54113. ? ("_p(" + name + ",\"" + symbol + "\")")
  54114. : symbol + name // mark the event as captured
  54115. }
  54116. function addHandler (
  54117. el,
  54118. name,
  54119. value,
  54120. modifiers,
  54121. important,
  54122. warn,
  54123. range,
  54124. dynamic
  54125. ) {
  54126. modifiers = modifiers || emptyObject;
  54127. // warn prevent and passive modifier
  54128. /* istanbul ignore if */
  54129. if (
  54130. warn &&
  54131. modifiers.prevent && modifiers.passive
  54132. ) {
  54133. warn(
  54134. 'passive and prevent can\'t be used together. ' +
  54135. 'Passive handler can\'t prevent default event.',
  54136. range
  54137. );
  54138. }
  54139. // normalize click.right and click.middle since they don't actually fire
  54140. // this is technically browser-specific, but at least for now browsers are
  54141. // the only target envs that have right/middle clicks.
  54142. if (modifiers.right) {
  54143. if (dynamic) {
  54144. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  54145. } else if (name === 'click') {
  54146. name = 'contextmenu';
  54147. delete modifiers.right;
  54148. }
  54149. } else if (modifiers.middle) {
  54150. if (dynamic) {
  54151. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  54152. } else if (name === 'click') {
  54153. name = 'mouseup';
  54154. }
  54155. }
  54156. // check capture modifier
  54157. if (modifiers.capture) {
  54158. delete modifiers.capture;
  54159. name = prependModifierMarker('!', name, dynamic);
  54160. }
  54161. if (modifiers.once) {
  54162. delete modifiers.once;
  54163. name = prependModifierMarker('~', name, dynamic);
  54164. }
  54165. /* istanbul ignore if */
  54166. if (modifiers.passive) {
  54167. delete modifiers.passive;
  54168. name = prependModifierMarker('&', name, dynamic);
  54169. }
  54170. var events;
  54171. if (modifiers.native) {
  54172. delete modifiers.native;
  54173. events = el.nativeEvents || (el.nativeEvents = {});
  54174. } else {
  54175. events = el.events || (el.events = {});
  54176. }
  54177. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  54178. if (modifiers !== emptyObject) {
  54179. newHandler.modifiers = modifiers;
  54180. }
  54181. var handlers = events[name];
  54182. /* istanbul ignore if */
  54183. if (Array.isArray(handlers)) {
  54184. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  54185. } else if (handlers) {
  54186. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  54187. } else {
  54188. events[name] = newHandler;
  54189. }
  54190. el.plain = false;
  54191. }
  54192. function getRawBindingAttr (
  54193. el,
  54194. name
  54195. ) {
  54196. return el.rawAttrsMap[':' + name] ||
  54197. el.rawAttrsMap['v-bind:' + name] ||
  54198. el.rawAttrsMap[name]
  54199. }
  54200. function getBindingAttr (
  54201. el,
  54202. name,
  54203. getStatic
  54204. ) {
  54205. var dynamicValue =
  54206. getAndRemoveAttr(el, ':' + name) ||
  54207. getAndRemoveAttr(el, 'v-bind:' + name);
  54208. if (dynamicValue != null) {
  54209. return parseFilters(dynamicValue)
  54210. } else if (getStatic !== false) {
  54211. var staticValue = getAndRemoveAttr(el, name);
  54212. if (staticValue != null) {
  54213. return JSON.stringify(staticValue)
  54214. }
  54215. }
  54216. }
  54217. // note: this only removes the attr from the Array (attrsList) so that it
  54218. // doesn't get processed by processAttrs.
  54219. // By default it does NOT remove it from the map (attrsMap) because the map is
  54220. // needed during codegen.
  54221. function getAndRemoveAttr (
  54222. el,
  54223. name,
  54224. removeFromMap
  54225. ) {
  54226. var val;
  54227. if ((val = el.attrsMap[name]) != null) {
  54228. var list = el.attrsList;
  54229. for (var i = 0, l = list.length; i < l; i++) {
  54230. if (list[i].name === name) {
  54231. list.splice(i, 1);
  54232. break
  54233. }
  54234. }
  54235. }
  54236. if (removeFromMap) {
  54237. delete el.attrsMap[name];
  54238. }
  54239. return val
  54240. }
  54241. function getAndRemoveAttrByRegex (
  54242. el,
  54243. name
  54244. ) {
  54245. var list = el.attrsList;
  54246. for (var i = 0, l = list.length; i < l; i++) {
  54247. var attr = list[i];
  54248. if (name.test(attr.name)) {
  54249. list.splice(i, 1);
  54250. return attr
  54251. }
  54252. }
  54253. }
  54254. function rangeSetItem (
  54255. item,
  54256. range
  54257. ) {
  54258. if (range) {
  54259. if (range.start != null) {
  54260. item.start = range.start;
  54261. }
  54262. if (range.end != null) {
  54263. item.end = range.end;
  54264. }
  54265. }
  54266. return item
  54267. }
  54268. /* */
  54269. /**
  54270. * Cross-platform code generation for component v-model
  54271. */
  54272. function genComponentModel (
  54273. el,
  54274. value,
  54275. modifiers
  54276. ) {
  54277. var ref = modifiers || {};
  54278. var number = ref.number;
  54279. var trim = ref.trim;
  54280. var baseValueExpression = '$$v';
  54281. var valueExpression = baseValueExpression;
  54282. if (trim) {
  54283. valueExpression =
  54284. "(typeof " + baseValueExpression + " === 'string'" +
  54285. "? " + baseValueExpression + ".trim()" +
  54286. ": " + baseValueExpression + ")";
  54287. }
  54288. if (number) {
  54289. valueExpression = "_n(" + valueExpression + ")";
  54290. }
  54291. var assignment = genAssignmentCode(value, valueExpression);
  54292. el.model = {
  54293. value: ("(" + value + ")"),
  54294. expression: JSON.stringify(value),
  54295. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  54296. };
  54297. }
  54298. /**
  54299. * Cross-platform codegen helper for generating v-model value assignment code.
  54300. */
  54301. function genAssignmentCode (
  54302. value,
  54303. assignment
  54304. ) {
  54305. var res = parseModel(value);
  54306. if (res.key === null) {
  54307. return (value + "=" + assignment)
  54308. } else {
  54309. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  54310. }
  54311. }
  54312. /**
  54313. * Parse a v-model expression into a base path and a final key segment.
  54314. * Handles both dot-path and possible square brackets.
  54315. *
  54316. * Possible cases:
  54317. *
  54318. * - test
  54319. * - test[key]
  54320. * - test[test1[key]]
  54321. * - test["a"][key]
  54322. * - xxx.test[a[a].test1[key]]
  54323. * - test.xxx.a["asa"][test1[key]]
  54324. *
  54325. */
  54326. var len, str, chr, index$1, expressionPos, expressionEndPos;
  54327. function parseModel (val) {
  54328. // Fix https://github.com/vuejs/vue/pull/7730
  54329. // allow v-model="obj.val " (trailing whitespace)
  54330. val = val.trim();
  54331. len = val.length;
  54332. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  54333. index$1 = val.lastIndexOf('.');
  54334. if (index$1 > -1) {
  54335. return {
  54336. exp: val.slice(0, index$1),
  54337. key: '"' + val.slice(index$1 + 1) + '"'
  54338. }
  54339. } else {
  54340. return {
  54341. exp: val,
  54342. key: null
  54343. }
  54344. }
  54345. }
  54346. str = val;
  54347. index$1 = expressionPos = expressionEndPos = 0;
  54348. while (!eof()) {
  54349. chr = next();
  54350. /* istanbul ignore if */
  54351. if (isStringStart(chr)) {
  54352. parseString(chr);
  54353. } else if (chr === 0x5B) {
  54354. parseBracket(chr);
  54355. }
  54356. }
  54357. return {
  54358. exp: val.slice(0, expressionPos),
  54359. key: val.slice(expressionPos + 1, expressionEndPos)
  54360. }
  54361. }
  54362. function next () {
  54363. return str.charCodeAt(++index$1)
  54364. }
  54365. function eof () {
  54366. return index$1 >= len
  54367. }
  54368. function isStringStart (chr) {
  54369. return chr === 0x22 || chr === 0x27
  54370. }
  54371. function parseBracket (chr) {
  54372. var inBracket = 1;
  54373. expressionPos = index$1;
  54374. while (!eof()) {
  54375. chr = next();
  54376. if (isStringStart(chr)) {
  54377. parseString(chr);
  54378. continue
  54379. }
  54380. if (chr === 0x5B) { inBracket++; }
  54381. if (chr === 0x5D) { inBracket--; }
  54382. if (inBracket === 0) {
  54383. expressionEndPos = index$1;
  54384. break
  54385. }
  54386. }
  54387. }
  54388. function parseString (chr) {
  54389. var stringQuote = chr;
  54390. while (!eof()) {
  54391. chr = next();
  54392. if (chr === stringQuote) {
  54393. break
  54394. }
  54395. }
  54396. }
  54397. /* */
  54398. var warn$1;
  54399. // in some cases, the event used has to be determined at runtime
  54400. // so we used some reserved tokens during compile.
  54401. var RANGE_TOKEN = '__r';
  54402. var CHECKBOX_RADIO_TOKEN = '__c';
  54403. function model (
  54404. el,
  54405. dir,
  54406. _warn
  54407. ) {
  54408. warn$1 = _warn;
  54409. var value = dir.value;
  54410. var modifiers = dir.modifiers;
  54411. var tag = el.tag;
  54412. var type = el.attrsMap.type;
  54413. {
  54414. // inputs with type="file" are read only and setting the input's
  54415. // value will throw an error.
  54416. if (tag === 'input' && type === 'file') {
  54417. warn$1(
  54418. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  54419. "File inputs are read only. Use a v-on:change listener instead.",
  54420. el.rawAttrsMap['v-model']
  54421. );
  54422. }
  54423. }
  54424. if (el.component) {
  54425. genComponentModel(el, value, modifiers);
  54426. // component v-model doesn't need extra runtime
  54427. return false
  54428. } else if (tag === 'select') {
  54429. genSelect(el, value, modifiers);
  54430. } else if (tag === 'input' && type === 'checkbox') {
  54431. genCheckboxModel(el, value, modifiers);
  54432. } else if (tag === 'input' && type === 'radio') {
  54433. genRadioModel(el, value, modifiers);
  54434. } else if (tag === 'input' || tag === 'textarea') {
  54435. genDefaultModel(el, value, modifiers);
  54436. } else if (!config.isReservedTag(tag)) {
  54437. genComponentModel(el, value, modifiers);
  54438. // component v-model doesn't need extra runtime
  54439. return false
  54440. } else {
  54441. warn$1(
  54442. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54443. "v-model is not supported on this element type. " +
  54444. 'If you are working with contenteditable, it\'s recommended to ' +
  54445. 'wrap a library dedicated for that purpose inside a custom component.',
  54446. el.rawAttrsMap['v-model']
  54447. );
  54448. }
  54449. // ensure runtime directive metadata
  54450. return true
  54451. }
  54452. function genCheckboxModel (
  54453. el,
  54454. value,
  54455. modifiers
  54456. ) {
  54457. var number = modifiers && modifiers.number;
  54458. var valueBinding = getBindingAttr(el, 'value') || 'null';
  54459. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  54460. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  54461. addProp(el, 'checked',
  54462. "Array.isArray(" + value + ")" +
  54463. "?_i(" + value + "," + valueBinding + ")>-1" + (
  54464. trueValueBinding === 'true'
  54465. ? (":(" + value + ")")
  54466. : (":_q(" + value + "," + trueValueBinding + ")")
  54467. )
  54468. );
  54469. addHandler(el, 'change',
  54470. "var $$a=" + value + "," +
  54471. '$$el=$event.target,' +
  54472. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  54473. 'if(Array.isArray($$a)){' +
  54474. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  54475. '$$i=_i($$a,$$v);' +
  54476. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  54477. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  54478. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  54479. null, true
  54480. );
  54481. }
  54482. function genRadioModel (
  54483. el,
  54484. value,
  54485. modifiers
  54486. ) {
  54487. var number = modifiers && modifiers.number;
  54488. var valueBinding = getBindingAttr(el, 'value') || 'null';
  54489. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  54490. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  54491. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  54492. }
  54493. function genSelect (
  54494. el,
  54495. value,
  54496. modifiers
  54497. ) {
  54498. var number = modifiers && modifiers.number;
  54499. var selectedVal = "Array.prototype.filter" +
  54500. ".call($event.target.options,function(o){return o.selected})" +
  54501. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  54502. "return " + (number ? '_n(val)' : 'val') + "})";
  54503. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  54504. var code = "var $$selectedVal = " + selectedVal + ";";
  54505. code = code + " " + (genAssignmentCode(value, assignment));
  54506. addHandler(el, 'change', code, null, true);
  54507. }
  54508. function genDefaultModel (
  54509. el,
  54510. value,
  54511. modifiers
  54512. ) {
  54513. var type = el.attrsMap.type;
  54514. // warn if v-bind:value conflicts with v-model
  54515. // except for inputs with v-bind:type
  54516. {
  54517. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  54518. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  54519. if (value$1 && !typeBinding) {
  54520. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  54521. warn$1(
  54522. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  54523. 'because the latter already expands to a value binding internally',
  54524. el.rawAttrsMap[binding]
  54525. );
  54526. }
  54527. }
  54528. var ref = modifiers || {};
  54529. var lazy = ref.lazy;
  54530. var number = ref.number;
  54531. var trim = ref.trim;
  54532. var needCompositionGuard = !lazy && type !== 'range';
  54533. var event = lazy
  54534. ? 'change'
  54535. : type === 'range'
  54536. ? RANGE_TOKEN
  54537. : 'input';
  54538. var valueExpression = '$event.target.value';
  54539. if (trim) {
  54540. valueExpression = "$event.target.value.trim()";
  54541. }
  54542. if (number) {
  54543. valueExpression = "_n(" + valueExpression + ")";
  54544. }
  54545. var code = genAssignmentCode(value, valueExpression);
  54546. if (needCompositionGuard) {
  54547. code = "if($event.target.composing)return;" + code;
  54548. }
  54549. addProp(el, 'value', ("(" + value + ")"));
  54550. addHandler(el, event, code, null, true);
  54551. if (trim || number) {
  54552. addHandler(el, 'blur', '$forceUpdate()');
  54553. }
  54554. }
  54555. /* */
  54556. // normalize v-model event tokens that can only be determined at runtime.
  54557. // it's important to place the event as the first in the array because
  54558. // the whole point is ensuring the v-model callback gets called before
  54559. // user-attached handlers.
  54560. function normalizeEvents (on) {
  54561. /* istanbul ignore if */
  54562. if (isDef(on[RANGE_TOKEN])) {
  54563. // IE input[type=range] only supports `change` event
  54564. var event = isIE ? 'change' : 'input';
  54565. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  54566. delete on[RANGE_TOKEN];
  54567. }
  54568. // This was originally intended to fix #4521 but no longer necessary
  54569. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  54570. /* istanbul ignore if */
  54571. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  54572. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  54573. delete on[CHECKBOX_RADIO_TOKEN];
  54574. }
  54575. }
  54576. var target$1;
  54577. function createOnceHandler$1 (event, handler, capture) {
  54578. var _target = target$1; // save current target element in closure
  54579. return function onceHandler () {
  54580. var res = handler.apply(null, arguments);
  54581. if (res !== null) {
  54582. remove$2(event, onceHandler, capture, _target);
  54583. }
  54584. }
  54585. }
  54586. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  54587. // implementation and does not fire microtasks in between event propagation, so
  54588. // safe to exclude.
  54589. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  54590. function add$1 (
  54591. name,
  54592. handler,
  54593. capture,
  54594. passive
  54595. ) {
  54596. // async edge case #6566: inner click event triggers patch, event handler
  54597. // attached to outer element during patch, and triggered again. This
  54598. // happens because browsers fire microtask ticks between event propagation.
  54599. // the solution is simple: we save the timestamp when a handler is attached,
  54600. // and the handler would only fire if the event passed to it was fired
  54601. // AFTER it was attached.
  54602. if (useMicrotaskFix) {
  54603. var attachedTimestamp = currentFlushTimestamp;
  54604. var original = handler;
  54605. handler = original._wrapper = function (e) {
  54606. if (
  54607. // no bubbling, should always fire.
  54608. // this is just a safety net in case event.timeStamp is unreliable in
  54609. // certain weird environments...
  54610. e.target === e.currentTarget ||
  54611. // event is fired after handler attachment
  54612. e.timeStamp >= attachedTimestamp ||
  54613. // bail for environments that have buggy event.timeStamp implementations
  54614. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  54615. // #9681 QtWebEngine event.timeStamp is negative value
  54616. e.timeStamp <= 0 ||
  54617. // #9448 bail if event is fired in another document in a multi-page
  54618. // electron/nw.js app, since event.timeStamp will be using a different
  54619. // starting reference
  54620. e.target.ownerDocument !== document
  54621. ) {
  54622. return original.apply(this, arguments)
  54623. }
  54624. };
  54625. }
  54626. target$1.addEventListener(
  54627. name,
  54628. handler,
  54629. supportsPassive
  54630. ? { capture: capture, passive: passive }
  54631. : capture
  54632. );
  54633. }
  54634. function remove$2 (
  54635. name,
  54636. handler,
  54637. capture,
  54638. _target
  54639. ) {
  54640. (_target || target$1).removeEventListener(
  54641. name,
  54642. handler._wrapper || handler,
  54643. capture
  54644. );
  54645. }
  54646. function updateDOMListeners (oldVnode, vnode) {
  54647. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  54648. return
  54649. }
  54650. var on = vnode.data.on || {};
  54651. var oldOn = oldVnode.data.on || {};
  54652. target$1 = vnode.elm;
  54653. normalizeEvents(on);
  54654. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  54655. target$1 = undefined;
  54656. }
  54657. var events = {
  54658. create: updateDOMListeners,
  54659. update: updateDOMListeners
  54660. };
  54661. /* */
  54662. var svgContainer;
  54663. function updateDOMProps (oldVnode, vnode) {
  54664. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  54665. return
  54666. }
  54667. var key, cur;
  54668. var elm = vnode.elm;
  54669. var oldProps = oldVnode.data.domProps || {};
  54670. var props = vnode.data.domProps || {};
  54671. // clone observed objects, as the user probably wants to mutate it
  54672. if (isDef(props.__ob__)) {
  54673. props = vnode.data.domProps = extend({}, props);
  54674. }
  54675. for (key in oldProps) {
  54676. if (!(key in props)) {
  54677. elm[key] = '';
  54678. }
  54679. }
  54680. for (key in props) {
  54681. cur = props[key];
  54682. // ignore children if the node has textContent or innerHTML,
  54683. // as these will throw away existing DOM nodes and cause removal errors
  54684. // on subsequent patches (#3360)
  54685. if (key === 'textContent' || key === 'innerHTML') {
  54686. if (vnode.children) { vnode.children.length = 0; }
  54687. if (cur === oldProps[key]) { continue }
  54688. // #6601 work around Chrome version <= 55 bug where single textNode
  54689. // replaced by innerHTML/textContent retains its parentNode property
  54690. if (elm.childNodes.length === 1) {
  54691. elm.removeChild(elm.childNodes[0]);
  54692. }
  54693. }
  54694. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  54695. // store value as _value as well since
  54696. // non-string values will be stringified
  54697. elm._value = cur;
  54698. // avoid resetting cursor position when value is the same
  54699. var strCur = isUndef(cur) ? '' : String(cur);
  54700. if (shouldUpdateValue(elm, strCur)) {
  54701. elm.value = strCur;
  54702. }
  54703. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  54704. // IE doesn't support innerHTML for SVG elements
  54705. svgContainer = svgContainer || document.createElement('div');
  54706. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  54707. var svg = svgContainer.firstChild;
  54708. while (elm.firstChild) {
  54709. elm.removeChild(elm.firstChild);
  54710. }
  54711. while (svg.firstChild) {
  54712. elm.appendChild(svg.firstChild);
  54713. }
  54714. } else if (
  54715. // skip the update if old and new VDOM state is the same.
  54716. // `value` is handled separately because the DOM value may be temporarily
  54717. // out of sync with VDOM state due to focus, composition and modifiers.
  54718. // This #4521 by skipping the unnecesarry `checked` update.
  54719. cur !== oldProps[key]
  54720. ) {
  54721. // some property updates can throw
  54722. // e.g. `value` on <progress> w/ non-finite value
  54723. try {
  54724. elm[key] = cur;
  54725. } catch (e) {}
  54726. }
  54727. }
  54728. }
  54729. // check platforms/web/util/attrs.js acceptValue
  54730. function shouldUpdateValue (elm, checkVal) {
  54731. return (!elm.composing && (
  54732. elm.tagName === 'OPTION' ||
  54733. isNotInFocusAndDirty(elm, checkVal) ||
  54734. isDirtyWithModifiers(elm, checkVal)
  54735. ))
  54736. }
  54737. function isNotInFocusAndDirty (elm, checkVal) {
  54738. // return true when textbox (.number and .trim) loses focus and its value is
  54739. // not equal to the updated value
  54740. var notInFocus = true;
  54741. // #6157
  54742. // work around IE bug when accessing document.activeElement in an iframe
  54743. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  54744. return notInFocus && elm.value !== checkVal
  54745. }
  54746. function isDirtyWithModifiers (elm, newVal) {
  54747. var value = elm.value;
  54748. var modifiers = elm._vModifiers; // injected by v-model runtime
  54749. if (isDef(modifiers)) {
  54750. if (modifiers.number) {
  54751. return toNumber(value) !== toNumber(newVal)
  54752. }
  54753. if (modifiers.trim) {
  54754. return value.trim() !== newVal.trim()
  54755. }
  54756. }
  54757. return value !== newVal
  54758. }
  54759. var domProps = {
  54760. create: updateDOMProps,
  54761. update: updateDOMProps
  54762. };
  54763. /* */
  54764. var parseStyleText = cached(function (cssText) {
  54765. var res = {};
  54766. var listDelimiter = /;(?![^(]*\))/g;
  54767. var propertyDelimiter = /:(.+)/;
  54768. cssText.split(listDelimiter).forEach(function (item) {
  54769. if (item) {
  54770. var tmp = item.split(propertyDelimiter);
  54771. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  54772. }
  54773. });
  54774. return res
  54775. });
  54776. // merge static and dynamic style data on the same vnode
  54777. function normalizeStyleData (data) {
  54778. var style = normalizeStyleBinding(data.style);
  54779. // static style is pre-processed into an object during compilation
  54780. // and is always a fresh object, so it's safe to merge into it
  54781. return data.staticStyle
  54782. ? extend(data.staticStyle, style)
  54783. : style
  54784. }
  54785. // normalize possible array / string values into Object
  54786. function normalizeStyleBinding (bindingStyle) {
  54787. if (Array.isArray(bindingStyle)) {
  54788. return toObject(bindingStyle)
  54789. }
  54790. if (typeof bindingStyle === 'string') {
  54791. return parseStyleText(bindingStyle)
  54792. }
  54793. return bindingStyle
  54794. }
  54795. /**
  54796. * parent component style should be after child's
  54797. * so that parent component's style could override it
  54798. */
  54799. function getStyle (vnode, checkChild) {
  54800. var res = {};
  54801. var styleData;
  54802. if (checkChild) {
  54803. var childNode = vnode;
  54804. while (childNode.componentInstance) {
  54805. childNode = childNode.componentInstance._vnode;
  54806. if (
  54807. childNode && childNode.data &&
  54808. (styleData = normalizeStyleData(childNode.data))
  54809. ) {
  54810. extend(res, styleData);
  54811. }
  54812. }
  54813. }
  54814. if ((styleData = normalizeStyleData(vnode.data))) {
  54815. extend(res, styleData);
  54816. }
  54817. var parentNode = vnode;
  54818. while ((parentNode = parentNode.parent)) {
  54819. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  54820. extend(res, styleData);
  54821. }
  54822. }
  54823. return res
  54824. }
  54825. /* */
  54826. var cssVarRE = /^--/;
  54827. var importantRE = /\s*!important$/;
  54828. var setProp = function (el, name, val) {
  54829. /* istanbul ignore if */
  54830. if (cssVarRE.test(name)) {
  54831. el.style.setProperty(name, val);
  54832. } else if (importantRE.test(val)) {
  54833. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  54834. } else {
  54835. var normalizedName = normalize(name);
  54836. if (Array.isArray(val)) {
  54837. // Support values array created by autoprefixer, e.g.
  54838. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  54839. // Set them one by one, and the browser will only set those it can recognize
  54840. for (var i = 0, len = val.length; i < len; i++) {
  54841. el.style[normalizedName] = val[i];
  54842. }
  54843. } else {
  54844. el.style[normalizedName] = val;
  54845. }
  54846. }
  54847. };
  54848. var vendorNames = ['Webkit', 'Moz', 'ms'];
  54849. var emptyStyle;
  54850. var normalize = cached(function (prop) {
  54851. emptyStyle = emptyStyle || document.createElement('div').style;
  54852. prop = camelize(prop);
  54853. if (prop !== 'filter' && (prop in emptyStyle)) {
  54854. return prop
  54855. }
  54856. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  54857. for (var i = 0; i < vendorNames.length; i++) {
  54858. var name = vendorNames[i] + capName;
  54859. if (name in emptyStyle) {
  54860. return name
  54861. }
  54862. }
  54863. });
  54864. function updateStyle (oldVnode, vnode) {
  54865. var data = vnode.data;
  54866. var oldData = oldVnode.data;
  54867. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  54868. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  54869. ) {
  54870. return
  54871. }
  54872. var cur, name;
  54873. var el = vnode.elm;
  54874. var oldStaticStyle = oldData.staticStyle;
  54875. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  54876. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  54877. var oldStyle = oldStaticStyle || oldStyleBinding;
  54878. var style = normalizeStyleBinding(vnode.data.style) || {};
  54879. // store normalized style under a different key for next diff
  54880. // make sure to clone it if it's reactive, since the user likely wants
  54881. // to mutate it.
  54882. vnode.data.normalizedStyle = isDef(style.__ob__)
  54883. ? extend({}, style)
  54884. : style;
  54885. var newStyle = getStyle(vnode, true);
  54886. for (name in oldStyle) {
  54887. if (isUndef(newStyle[name])) {
  54888. setProp(el, name, '');
  54889. }
  54890. }
  54891. for (name in newStyle) {
  54892. cur = newStyle[name];
  54893. if (cur !== oldStyle[name]) {
  54894. // ie9 setting to null has no effect, must use empty string
  54895. setProp(el, name, cur == null ? '' : cur);
  54896. }
  54897. }
  54898. }
  54899. var style = {
  54900. create: updateStyle,
  54901. update: updateStyle
  54902. };
  54903. /* */
  54904. var whitespaceRE = /\s+/;
  54905. /**
  54906. * Add class with compatibility for SVG since classList is not supported on
  54907. * SVG elements in IE
  54908. */
  54909. function addClass (el, cls) {
  54910. /* istanbul ignore if */
  54911. if (!cls || !(cls = cls.trim())) {
  54912. return
  54913. }
  54914. /* istanbul ignore else */
  54915. if (el.classList) {
  54916. if (cls.indexOf(' ') > -1) {
  54917. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  54918. } else {
  54919. el.classList.add(cls);
  54920. }
  54921. } else {
  54922. var cur = " " + (el.getAttribute('class') || '') + " ";
  54923. if (cur.indexOf(' ' + cls + ' ') < 0) {
  54924. el.setAttribute('class', (cur + cls).trim());
  54925. }
  54926. }
  54927. }
  54928. /**
  54929. * Remove class with compatibility for SVG since classList is not supported on
  54930. * SVG elements in IE
  54931. */
  54932. function removeClass (el, cls) {
  54933. /* istanbul ignore if */
  54934. if (!cls || !(cls = cls.trim())) {
  54935. return
  54936. }
  54937. /* istanbul ignore else */
  54938. if (el.classList) {
  54939. if (cls.indexOf(' ') > -1) {
  54940. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  54941. } else {
  54942. el.classList.remove(cls);
  54943. }
  54944. if (!el.classList.length) {
  54945. el.removeAttribute('class');
  54946. }
  54947. } else {
  54948. var cur = " " + (el.getAttribute('class') || '') + " ";
  54949. var tar = ' ' + cls + ' ';
  54950. while (cur.indexOf(tar) >= 0) {
  54951. cur = cur.replace(tar, ' ');
  54952. }
  54953. cur = cur.trim();
  54954. if (cur) {
  54955. el.setAttribute('class', cur);
  54956. } else {
  54957. el.removeAttribute('class');
  54958. }
  54959. }
  54960. }
  54961. /* */
  54962. function resolveTransition (def$$1) {
  54963. if (!def$$1) {
  54964. return
  54965. }
  54966. /* istanbul ignore else */
  54967. if (typeof def$$1 === 'object') {
  54968. var res = {};
  54969. if (def$$1.css !== false) {
  54970. extend(res, autoCssTransition(def$$1.name || 'v'));
  54971. }
  54972. extend(res, def$$1);
  54973. return res
  54974. } else if (typeof def$$1 === 'string') {
  54975. return autoCssTransition(def$$1)
  54976. }
  54977. }
  54978. var autoCssTransition = cached(function (name) {
  54979. return {
  54980. enterClass: (name + "-enter"),
  54981. enterToClass: (name + "-enter-to"),
  54982. enterActiveClass: (name + "-enter-active"),
  54983. leaveClass: (name + "-leave"),
  54984. leaveToClass: (name + "-leave-to"),
  54985. leaveActiveClass: (name + "-leave-active")
  54986. }
  54987. });
  54988. var hasTransition = inBrowser && !isIE9;
  54989. var TRANSITION = 'transition';
  54990. var ANIMATION = 'animation';
  54991. // Transition property/event sniffing
  54992. var transitionProp = 'transition';
  54993. var transitionEndEvent = 'transitionend';
  54994. var animationProp = 'animation';
  54995. var animationEndEvent = 'animationend';
  54996. if (hasTransition) {
  54997. /* istanbul ignore if */
  54998. if (window.ontransitionend === undefined &&
  54999. window.onwebkittransitionend !== undefined
  55000. ) {
  55001. transitionProp = 'WebkitTransition';
  55002. transitionEndEvent = 'webkitTransitionEnd';
  55003. }
  55004. if (window.onanimationend === undefined &&
  55005. window.onwebkitanimationend !== undefined
  55006. ) {
  55007. animationProp = 'WebkitAnimation';
  55008. animationEndEvent = 'webkitAnimationEnd';
  55009. }
  55010. }
  55011. // binding to window is necessary to make hot reload work in IE in strict mode
  55012. var raf = inBrowser
  55013. ? window.requestAnimationFrame
  55014. ? window.requestAnimationFrame.bind(window)
  55015. : setTimeout
  55016. : /* istanbul ignore next */ function (fn) { return fn(); };
  55017. function nextFrame (fn) {
  55018. raf(function () {
  55019. raf(fn);
  55020. });
  55021. }
  55022. function addTransitionClass (el, cls) {
  55023. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  55024. if (transitionClasses.indexOf(cls) < 0) {
  55025. transitionClasses.push(cls);
  55026. addClass(el, cls);
  55027. }
  55028. }
  55029. function removeTransitionClass (el, cls) {
  55030. if (el._transitionClasses) {
  55031. remove(el._transitionClasses, cls);
  55032. }
  55033. removeClass(el, cls);
  55034. }
  55035. function whenTransitionEnds (
  55036. el,
  55037. expectedType,
  55038. cb
  55039. ) {
  55040. var ref = getTransitionInfo(el, expectedType);
  55041. var type = ref.type;
  55042. var timeout = ref.timeout;
  55043. var propCount = ref.propCount;
  55044. if (!type) { return cb() }
  55045. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  55046. var ended = 0;
  55047. var end = function () {
  55048. el.removeEventListener(event, onEnd);
  55049. cb();
  55050. };
  55051. var onEnd = function (e) {
  55052. if (e.target === el) {
  55053. if (++ended >= propCount) {
  55054. end();
  55055. }
  55056. }
  55057. };
  55058. setTimeout(function () {
  55059. if (ended < propCount) {
  55060. end();
  55061. }
  55062. }, timeout + 1);
  55063. el.addEventListener(event, onEnd);
  55064. }
  55065. var transformRE = /\b(transform|all)(,|$)/;
  55066. function getTransitionInfo (el, expectedType) {
  55067. var styles = window.getComputedStyle(el);
  55068. // JSDOM may return undefined for transition properties
  55069. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  55070. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  55071. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  55072. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  55073. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  55074. var animationTimeout = getTimeout(animationDelays, animationDurations);
  55075. var type;
  55076. var timeout = 0;
  55077. var propCount = 0;
  55078. /* istanbul ignore if */
  55079. if (expectedType === TRANSITION) {
  55080. if (transitionTimeout > 0) {
  55081. type = TRANSITION;
  55082. timeout = transitionTimeout;
  55083. propCount = transitionDurations.length;
  55084. }
  55085. } else if (expectedType === ANIMATION) {
  55086. if (animationTimeout > 0) {
  55087. type = ANIMATION;
  55088. timeout = animationTimeout;
  55089. propCount = animationDurations.length;
  55090. }
  55091. } else {
  55092. timeout = Math.max(transitionTimeout, animationTimeout);
  55093. type = timeout > 0
  55094. ? transitionTimeout > animationTimeout
  55095. ? TRANSITION
  55096. : ANIMATION
  55097. : null;
  55098. propCount = type
  55099. ? type === TRANSITION
  55100. ? transitionDurations.length
  55101. : animationDurations.length
  55102. : 0;
  55103. }
  55104. var hasTransform =
  55105. type === TRANSITION &&
  55106. transformRE.test(styles[transitionProp + 'Property']);
  55107. return {
  55108. type: type,
  55109. timeout: timeout,
  55110. propCount: propCount,
  55111. hasTransform: hasTransform
  55112. }
  55113. }
  55114. function getTimeout (delays, durations) {
  55115. /* istanbul ignore next */
  55116. while (delays.length < durations.length) {
  55117. delays = delays.concat(delays);
  55118. }
  55119. return Math.max.apply(null, durations.map(function (d, i) {
  55120. return toMs(d) + toMs(delays[i])
  55121. }))
  55122. }
  55123. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  55124. // in a locale-dependent way, using a comma instead of a dot.
  55125. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  55126. // as a floor function) causing unexpected behaviors
  55127. function toMs (s) {
  55128. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  55129. }
  55130. /* */
  55131. function enter (vnode, toggleDisplay) {
  55132. var el = vnode.elm;
  55133. // call leave callback now
  55134. if (isDef(el._leaveCb)) {
  55135. el._leaveCb.cancelled = true;
  55136. el._leaveCb();
  55137. }
  55138. var data = resolveTransition(vnode.data.transition);
  55139. if (isUndef(data)) {
  55140. return
  55141. }
  55142. /* istanbul ignore if */
  55143. if (isDef(el._enterCb) || el.nodeType !== 1) {
  55144. return
  55145. }
  55146. var css = data.css;
  55147. var type = data.type;
  55148. var enterClass = data.enterClass;
  55149. var enterToClass = data.enterToClass;
  55150. var enterActiveClass = data.enterActiveClass;
  55151. var appearClass = data.appearClass;
  55152. var appearToClass = data.appearToClass;
  55153. var appearActiveClass = data.appearActiveClass;
  55154. var beforeEnter = data.beforeEnter;
  55155. var enter = data.enter;
  55156. var afterEnter = data.afterEnter;
  55157. var enterCancelled = data.enterCancelled;
  55158. var beforeAppear = data.beforeAppear;
  55159. var appear = data.appear;
  55160. var afterAppear = data.afterAppear;
  55161. var appearCancelled = data.appearCancelled;
  55162. var duration = data.duration;
  55163. // activeInstance will always be the <transition> component managing this
  55164. // transition. One edge case to check is when the <transition> is placed
  55165. // as the root node of a child component. In that case we need to check
  55166. // <transition>'s parent for appear check.
  55167. var context = activeInstance;
  55168. var transitionNode = activeInstance.$vnode;
  55169. while (transitionNode && transitionNode.parent) {
  55170. context = transitionNode.context;
  55171. transitionNode = transitionNode.parent;
  55172. }
  55173. var isAppear = !context._isMounted || !vnode.isRootInsert;
  55174. if (isAppear && !appear && appear !== '') {
  55175. return
  55176. }
  55177. var startClass = isAppear && appearClass
  55178. ? appearClass
  55179. : enterClass;
  55180. var activeClass = isAppear && appearActiveClass
  55181. ? appearActiveClass
  55182. : enterActiveClass;
  55183. var toClass = isAppear && appearToClass
  55184. ? appearToClass
  55185. : enterToClass;
  55186. var beforeEnterHook = isAppear
  55187. ? (beforeAppear || beforeEnter)
  55188. : beforeEnter;
  55189. var enterHook = isAppear
  55190. ? (typeof appear === 'function' ? appear : enter)
  55191. : enter;
  55192. var afterEnterHook = isAppear
  55193. ? (afterAppear || afterEnter)
  55194. : afterEnter;
  55195. var enterCancelledHook = isAppear
  55196. ? (appearCancelled || enterCancelled)
  55197. : enterCancelled;
  55198. var explicitEnterDuration = toNumber(
  55199. isObject(duration)
  55200. ? duration.enter
  55201. : duration
  55202. );
  55203. if (explicitEnterDuration != null) {
  55204. checkDuration(explicitEnterDuration, 'enter', vnode);
  55205. }
  55206. var expectsCSS = css !== false && !isIE9;
  55207. var userWantsControl = getHookArgumentsLength(enterHook);
  55208. var cb = el._enterCb = once(function () {
  55209. if (expectsCSS) {
  55210. removeTransitionClass(el, toClass);
  55211. removeTransitionClass(el, activeClass);
  55212. }
  55213. if (cb.cancelled) {
  55214. if (expectsCSS) {
  55215. removeTransitionClass(el, startClass);
  55216. }
  55217. enterCancelledHook && enterCancelledHook(el);
  55218. } else {
  55219. afterEnterHook && afterEnterHook(el);
  55220. }
  55221. el._enterCb = null;
  55222. });
  55223. if (!vnode.data.show) {
  55224. // remove pending leave element on enter by injecting an insert hook
  55225. mergeVNodeHook(vnode, 'insert', function () {
  55226. var parent = el.parentNode;
  55227. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  55228. if (pendingNode &&
  55229. pendingNode.tag === vnode.tag &&
  55230. pendingNode.elm._leaveCb
  55231. ) {
  55232. pendingNode.elm._leaveCb();
  55233. }
  55234. enterHook && enterHook(el, cb);
  55235. });
  55236. }
  55237. // start enter transition
  55238. beforeEnterHook && beforeEnterHook(el);
  55239. if (expectsCSS) {
  55240. addTransitionClass(el, startClass);
  55241. addTransitionClass(el, activeClass);
  55242. nextFrame(function () {
  55243. removeTransitionClass(el, startClass);
  55244. if (!cb.cancelled) {
  55245. addTransitionClass(el, toClass);
  55246. if (!userWantsControl) {
  55247. if (isValidDuration(explicitEnterDuration)) {
  55248. setTimeout(cb, explicitEnterDuration);
  55249. } else {
  55250. whenTransitionEnds(el, type, cb);
  55251. }
  55252. }
  55253. }
  55254. });
  55255. }
  55256. if (vnode.data.show) {
  55257. toggleDisplay && toggleDisplay();
  55258. enterHook && enterHook(el, cb);
  55259. }
  55260. if (!expectsCSS && !userWantsControl) {
  55261. cb();
  55262. }
  55263. }
  55264. function leave (vnode, rm) {
  55265. var el = vnode.elm;
  55266. // call enter callback now
  55267. if (isDef(el._enterCb)) {
  55268. el._enterCb.cancelled = true;
  55269. el._enterCb();
  55270. }
  55271. var data = resolveTransition(vnode.data.transition);
  55272. if (isUndef(data) || el.nodeType !== 1) {
  55273. return rm()
  55274. }
  55275. /* istanbul ignore if */
  55276. if (isDef(el._leaveCb)) {
  55277. return
  55278. }
  55279. var css = data.css;
  55280. var type = data.type;
  55281. var leaveClass = data.leaveClass;
  55282. var leaveToClass = data.leaveToClass;
  55283. var leaveActiveClass = data.leaveActiveClass;
  55284. var beforeLeave = data.beforeLeave;
  55285. var leave = data.leave;
  55286. var afterLeave = data.afterLeave;
  55287. var leaveCancelled = data.leaveCancelled;
  55288. var delayLeave = data.delayLeave;
  55289. var duration = data.duration;
  55290. var expectsCSS = css !== false && !isIE9;
  55291. var userWantsControl = getHookArgumentsLength(leave);
  55292. var explicitLeaveDuration = toNumber(
  55293. isObject(duration)
  55294. ? duration.leave
  55295. : duration
  55296. );
  55297. if (isDef(explicitLeaveDuration)) {
  55298. checkDuration(explicitLeaveDuration, 'leave', vnode);
  55299. }
  55300. var cb = el._leaveCb = once(function () {
  55301. if (el.parentNode && el.parentNode._pending) {
  55302. el.parentNode._pending[vnode.key] = null;
  55303. }
  55304. if (expectsCSS) {
  55305. removeTransitionClass(el, leaveToClass);
  55306. removeTransitionClass(el, leaveActiveClass);
  55307. }
  55308. if (cb.cancelled) {
  55309. if (expectsCSS) {
  55310. removeTransitionClass(el, leaveClass);
  55311. }
  55312. leaveCancelled && leaveCancelled(el);
  55313. } else {
  55314. rm();
  55315. afterLeave && afterLeave(el);
  55316. }
  55317. el._leaveCb = null;
  55318. });
  55319. if (delayLeave) {
  55320. delayLeave(performLeave);
  55321. } else {
  55322. performLeave();
  55323. }
  55324. function performLeave () {
  55325. // the delayed leave may have already been cancelled
  55326. if (cb.cancelled) {
  55327. return
  55328. }
  55329. // record leaving element
  55330. if (!vnode.data.show && el.parentNode) {
  55331. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  55332. }
  55333. beforeLeave && beforeLeave(el);
  55334. if (expectsCSS) {
  55335. addTransitionClass(el, leaveClass);
  55336. addTransitionClass(el, leaveActiveClass);
  55337. nextFrame(function () {
  55338. removeTransitionClass(el, leaveClass);
  55339. if (!cb.cancelled) {
  55340. addTransitionClass(el, leaveToClass);
  55341. if (!userWantsControl) {
  55342. if (isValidDuration(explicitLeaveDuration)) {
  55343. setTimeout(cb, explicitLeaveDuration);
  55344. } else {
  55345. whenTransitionEnds(el, type, cb);
  55346. }
  55347. }
  55348. }
  55349. });
  55350. }
  55351. leave && leave(el, cb);
  55352. if (!expectsCSS && !userWantsControl) {
  55353. cb();
  55354. }
  55355. }
  55356. }
  55357. // only used in dev mode
  55358. function checkDuration (val, name, vnode) {
  55359. if (typeof val !== 'number') {
  55360. warn(
  55361. "<transition> explicit " + name + " duration is not a valid number - " +
  55362. "got " + (JSON.stringify(val)) + ".",
  55363. vnode.context
  55364. );
  55365. } else if (isNaN(val)) {
  55366. warn(
  55367. "<transition> explicit " + name + " duration is NaN - " +
  55368. 'the duration expression might be incorrect.',
  55369. vnode.context
  55370. );
  55371. }
  55372. }
  55373. function isValidDuration (val) {
  55374. return typeof val === 'number' && !isNaN(val)
  55375. }
  55376. /**
  55377. * Normalize a transition hook's argument length. The hook may be:
  55378. * - a merged hook (invoker) with the original in .fns
  55379. * - a wrapped component method (check ._length)
  55380. * - a plain function (.length)
  55381. */
  55382. function getHookArgumentsLength (fn) {
  55383. if (isUndef(fn)) {
  55384. return false
  55385. }
  55386. var invokerFns = fn.fns;
  55387. if (isDef(invokerFns)) {
  55388. // invoker
  55389. return getHookArgumentsLength(
  55390. Array.isArray(invokerFns)
  55391. ? invokerFns[0]
  55392. : invokerFns
  55393. )
  55394. } else {
  55395. return (fn._length || fn.length) > 1
  55396. }
  55397. }
  55398. function _enter (_, vnode) {
  55399. if (vnode.data.show !== true) {
  55400. enter(vnode);
  55401. }
  55402. }
  55403. var transition = inBrowser ? {
  55404. create: _enter,
  55405. activate: _enter,
  55406. remove: function remove$$1 (vnode, rm) {
  55407. /* istanbul ignore else */
  55408. if (vnode.data.show !== true) {
  55409. leave(vnode, rm);
  55410. } else {
  55411. rm();
  55412. }
  55413. }
  55414. } : {};
  55415. var platformModules = [
  55416. attrs,
  55417. klass,
  55418. events,
  55419. domProps,
  55420. style,
  55421. transition
  55422. ];
  55423. /* */
  55424. // the directive module should be applied last, after all
  55425. // built-in modules have been applied.
  55426. var modules = platformModules.concat(baseModules);
  55427. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  55428. /**
  55429. * Not type checking this file because flow doesn't like attaching
  55430. * properties to Elements.
  55431. */
  55432. /* istanbul ignore if */
  55433. if (isIE9) {
  55434. // http://www.matts411.com/post/internet-explorer-9-oninput/
  55435. document.addEventListener('selectionchange', function () {
  55436. var el = document.activeElement;
  55437. if (el && el.vmodel) {
  55438. trigger(el, 'input');
  55439. }
  55440. });
  55441. }
  55442. var directive = {
  55443. inserted: function inserted (el, binding, vnode, oldVnode) {
  55444. if (vnode.tag === 'select') {
  55445. // #6903
  55446. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  55447. mergeVNodeHook(vnode, 'postpatch', function () {
  55448. directive.componentUpdated(el, binding, vnode);
  55449. });
  55450. } else {
  55451. setSelected(el, binding, vnode.context);
  55452. }
  55453. el._vOptions = [].map.call(el.options, getValue);
  55454. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  55455. el._vModifiers = binding.modifiers;
  55456. if (!binding.modifiers.lazy) {
  55457. el.addEventListener('compositionstart', onCompositionStart);
  55458. el.addEventListener('compositionend', onCompositionEnd);
  55459. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  55460. // switching focus before confirming composition choice
  55461. // this also fixes the issue where some browsers e.g. iOS Chrome
  55462. // fires "change" instead of "input" on autocomplete.
  55463. el.addEventListener('change', onCompositionEnd);
  55464. /* istanbul ignore if */
  55465. if (isIE9) {
  55466. el.vmodel = true;
  55467. }
  55468. }
  55469. }
  55470. },
  55471. componentUpdated: function componentUpdated (el, binding, vnode) {
  55472. if (vnode.tag === 'select') {
  55473. setSelected(el, binding, vnode.context);
  55474. // in case the options rendered by v-for have changed,
  55475. // it's possible that the value is out-of-sync with the rendered options.
  55476. // detect such cases and filter out values that no longer has a matching
  55477. // option in the DOM.
  55478. var prevOptions = el._vOptions;
  55479. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  55480. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  55481. // trigger change event if
  55482. // no matching option found for at least one value
  55483. var needReset = el.multiple
  55484. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  55485. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  55486. if (needReset) {
  55487. trigger(el, 'change');
  55488. }
  55489. }
  55490. }
  55491. }
  55492. };
  55493. function setSelected (el, binding, vm) {
  55494. actuallySetSelected(el, binding, vm);
  55495. /* istanbul ignore if */
  55496. if (isIE || isEdge) {
  55497. setTimeout(function () {
  55498. actuallySetSelected(el, binding, vm);
  55499. }, 0);
  55500. }
  55501. }
  55502. function actuallySetSelected (el, binding, vm) {
  55503. var value = binding.value;
  55504. var isMultiple = el.multiple;
  55505. if (isMultiple && !Array.isArray(value)) {
  55506. warn(
  55507. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  55508. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  55509. vm
  55510. );
  55511. return
  55512. }
  55513. var selected, option;
  55514. for (var i = 0, l = el.options.length; i < l; i++) {
  55515. option = el.options[i];
  55516. if (isMultiple) {
  55517. selected = looseIndexOf(value, getValue(option)) > -1;
  55518. if (option.selected !== selected) {
  55519. option.selected = selected;
  55520. }
  55521. } else {
  55522. if (looseEqual(getValue(option), value)) {
  55523. if (el.selectedIndex !== i) {
  55524. el.selectedIndex = i;
  55525. }
  55526. return
  55527. }
  55528. }
  55529. }
  55530. if (!isMultiple) {
  55531. el.selectedIndex = -1;
  55532. }
  55533. }
  55534. function hasNoMatchingOption (value, options) {
  55535. return options.every(function (o) { return !looseEqual(o, value); })
  55536. }
  55537. function getValue (option) {
  55538. return '_value' in option
  55539. ? option._value
  55540. : option.value
  55541. }
  55542. function onCompositionStart (e) {
  55543. e.target.composing = true;
  55544. }
  55545. function onCompositionEnd (e) {
  55546. // prevent triggering an input event for no reason
  55547. if (!e.target.composing) { return }
  55548. e.target.composing = false;
  55549. trigger(e.target, 'input');
  55550. }
  55551. function trigger (el, type) {
  55552. var e = document.createEvent('HTMLEvents');
  55553. e.initEvent(type, true, true);
  55554. el.dispatchEvent(e);
  55555. }
  55556. /* */
  55557. // recursively search for possible transition defined inside the component root
  55558. function locateNode (vnode) {
  55559. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  55560. ? locateNode(vnode.componentInstance._vnode)
  55561. : vnode
  55562. }
  55563. var show = {
  55564. bind: function bind (el, ref, vnode) {
  55565. var value = ref.value;
  55566. vnode = locateNode(vnode);
  55567. var transition$$1 = vnode.data && vnode.data.transition;
  55568. var originalDisplay = el.__vOriginalDisplay =
  55569. el.style.display === 'none' ? '' : el.style.display;
  55570. if (value && transition$$1) {
  55571. vnode.data.show = true;
  55572. enter(vnode, function () {
  55573. el.style.display = originalDisplay;
  55574. });
  55575. } else {
  55576. el.style.display = value ? originalDisplay : 'none';
  55577. }
  55578. },
  55579. update: function update (el, ref, vnode) {
  55580. var value = ref.value;
  55581. var oldValue = ref.oldValue;
  55582. /* istanbul ignore if */
  55583. if (!value === !oldValue) { return }
  55584. vnode = locateNode(vnode);
  55585. var transition$$1 = vnode.data && vnode.data.transition;
  55586. if (transition$$1) {
  55587. vnode.data.show = true;
  55588. if (value) {
  55589. enter(vnode, function () {
  55590. el.style.display = el.__vOriginalDisplay;
  55591. });
  55592. } else {
  55593. leave(vnode, function () {
  55594. el.style.display = 'none';
  55595. });
  55596. }
  55597. } else {
  55598. el.style.display = value ? el.__vOriginalDisplay : 'none';
  55599. }
  55600. },
  55601. unbind: function unbind (
  55602. el,
  55603. binding,
  55604. vnode,
  55605. oldVnode,
  55606. isDestroy
  55607. ) {
  55608. if (!isDestroy) {
  55609. el.style.display = el.__vOriginalDisplay;
  55610. }
  55611. }
  55612. };
  55613. var platformDirectives = {
  55614. model: directive,
  55615. show: show
  55616. };
  55617. /* */
  55618. var transitionProps = {
  55619. name: String,
  55620. appear: Boolean,
  55621. css: Boolean,
  55622. mode: String,
  55623. type: String,
  55624. enterClass: String,
  55625. leaveClass: String,
  55626. enterToClass: String,
  55627. leaveToClass: String,
  55628. enterActiveClass: String,
  55629. leaveActiveClass: String,
  55630. appearClass: String,
  55631. appearActiveClass: String,
  55632. appearToClass: String,
  55633. duration: [Number, String, Object]
  55634. };
  55635. // in case the child is also an abstract component, e.g. <keep-alive>
  55636. // we want to recursively retrieve the real component to be rendered
  55637. function getRealChild (vnode) {
  55638. var compOptions = vnode && vnode.componentOptions;
  55639. if (compOptions && compOptions.Ctor.options.abstract) {
  55640. return getRealChild(getFirstComponentChild(compOptions.children))
  55641. } else {
  55642. return vnode
  55643. }
  55644. }
  55645. function extractTransitionData (comp) {
  55646. var data = {};
  55647. var options = comp.$options;
  55648. // props
  55649. for (var key in options.propsData) {
  55650. data[key] = comp[key];
  55651. }
  55652. // events.
  55653. // extract listeners and pass them directly to the transition methods
  55654. var listeners = options._parentListeners;
  55655. for (var key$1 in listeners) {
  55656. data[camelize(key$1)] = listeners[key$1];
  55657. }
  55658. return data
  55659. }
  55660. function placeholder (h, rawChild) {
  55661. if (/\d-keep-alive$/.test(rawChild.tag)) {
  55662. return h('keep-alive', {
  55663. props: rawChild.componentOptions.propsData
  55664. })
  55665. }
  55666. }
  55667. function hasParentTransition (vnode) {
  55668. while ((vnode = vnode.parent)) {
  55669. if (vnode.data.transition) {
  55670. return true
  55671. }
  55672. }
  55673. }
  55674. function isSameChild (child, oldChild) {
  55675. return oldChild.key === child.key && oldChild.tag === child.tag
  55676. }
  55677. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  55678. var isVShowDirective = function (d) { return d.name === 'show'; };
  55679. var Transition = {
  55680. name: 'transition',
  55681. props: transitionProps,
  55682. abstract: true,
  55683. render: function render (h) {
  55684. var this$1 = this;
  55685. var children = this.$slots.default;
  55686. if (!children) {
  55687. return
  55688. }
  55689. // filter out text nodes (possible whitespaces)
  55690. children = children.filter(isNotTextNode);
  55691. /* istanbul ignore if */
  55692. if (!children.length) {
  55693. return
  55694. }
  55695. // warn multiple elements
  55696. if (children.length > 1) {
  55697. warn(
  55698. '<transition> can only be used on a single element. Use ' +
  55699. '<transition-group> for lists.',
  55700. this.$parent
  55701. );
  55702. }
  55703. var mode = this.mode;
  55704. // warn invalid mode
  55705. if (mode && mode !== 'in-out' && mode !== 'out-in'
  55706. ) {
  55707. warn(
  55708. 'invalid <transition> mode: ' + mode,
  55709. this.$parent
  55710. );
  55711. }
  55712. var rawChild = children[0];
  55713. // if this is a component root node and the component's
  55714. // parent container node also has transition, skip.
  55715. if (hasParentTransition(this.$vnode)) {
  55716. return rawChild
  55717. }
  55718. // apply transition data to child
  55719. // use getRealChild() to ignore abstract components e.g. keep-alive
  55720. var child = getRealChild(rawChild);
  55721. /* istanbul ignore if */
  55722. if (!child) {
  55723. return rawChild
  55724. }
  55725. if (this._leaving) {
  55726. return placeholder(h, rawChild)
  55727. }
  55728. // ensure a key that is unique to the vnode type and to this transition
  55729. // component instance. This key will be used to remove pending leaving nodes
  55730. // during entering.
  55731. var id = "__transition-" + (this._uid) + "-";
  55732. child.key = child.key == null
  55733. ? child.isComment
  55734. ? id + 'comment'
  55735. : id + child.tag
  55736. : isPrimitive(child.key)
  55737. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  55738. : child.key;
  55739. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  55740. var oldRawChild = this._vnode;
  55741. var oldChild = getRealChild(oldRawChild);
  55742. // mark v-show
  55743. // so that the transition module can hand over the control to the directive
  55744. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  55745. child.data.show = true;
  55746. }
  55747. if (
  55748. oldChild &&
  55749. oldChild.data &&
  55750. !isSameChild(child, oldChild) &&
  55751. !isAsyncPlaceholder(oldChild) &&
  55752. // #6687 component root is a comment node
  55753. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  55754. ) {
  55755. // replace old child transition data with fresh one
  55756. // important for dynamic transitions!
  55757. var oldData = oldChild.data.transition = extend({}, data);
  55758. // handle transition mode
  55759. if (mode === 'out-in') {
  55760. // return placeholder node and queue update when leave finishes
  55761. this._leaving = true;
  55762. mergeVNodeHook(oldData, 'afterLeave', function () {
  55763. this$1._leaving = false;
  55764. this$1.$forceUpdate();
  55765. });
  55766. return placeholder(h, rawChild)
  55767. } else if (mode === 'in-out') {
  55768. if (isAsyncPlaceholder(child)) {
  55769. return oldRawChild
  55770. }
  55771. var delayedLeave;
  55772. var performLeave = function () { delayedLeave(); };
  55773. mergeVNodeHook(data, 'afterEnter', performLeave);
  55774. mergeVNodeHook(data, 'enterCancelled', performLeave);
  55775. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  55776. }
  55777. }
  55778. return rawChild
  55779. }
  55780. };
  55781. /* */
  55782. var props = extend({
  55783. tag: String,
  55784. moveClass: String
  55785. }, transitionProps);
  55786. delete props.mode;
  55787. var TransitionGroup = {
  55788. props: props,
  55789. beforeMount: function beforeMount () {
  55790. var this$1 = this;
  55791. var update = this._update;
  55792. this._update = function (vnode, hydrating) {
  55793. var restoreActiveInstance = setActiveInstance(this$1);
  55794. // force removing pass
  55795. this$1.__patch__(
  55796. this$1._vnode,
  55797. this$1.kept,
  55798. false, // hydrating
  55799. true // removeOnly (!important, avoids unnecessary moves)
  55800. );
  55801. this$1._vnode = this$1.kept;
  55802. restoreActiveInstance();
  55803. update.call(this$1, vnode, hydrating);
  55804. };
  55805. },
  55806. render: function render (h) {
  55807. var tag = this.tag || this.$vnode.data.tag || 'span';
  55808. var map = Object.create(null);
  55809. var prevChildren = this.prevChildren = this.children;
  55810. var rawChildren = this.$slots.default || [];
  55811. var children = this.children = [];
  55812. var transitionData = extractTransitionData(this);
  55813. for (var i = 0; i < rawChildren.length; i++) {
  55814. var c = rawChildren[i];
  55815. if (c.tag) {
  55816. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  55817. children.push(c);
  55818. map[c.key] = c
  55819. ;(c.data || (c.data = {})).transition = transitionData;
  55820. } else {
  55821. var opts = c.componentOptions;
  55822. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  55823. warn(("<transition-group> children must be keyed: <" + name + ">"));
  55824. }
  55825. }
  55826. }
  55827. if (prevChildren) {
  55828. var kept = [];
  55829. var removed = [];
  55830. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  55831. var c$1 = prevChildren[i$1];
  55832. c$1.data.transition = transitionData;
  55833. c$1.data.pos = c$1.elm.getBoundingClientRect();
  55834. if (map[c$1.key]) {
  55835. kept.push(c$1);
  55836. } else {
  55837. removed.push(c$1);
  55838. }
  55839. }
  55840. this.kept = h(tag, null, kept);
  55841. this.removed = removed;
  55842. }
  55843. return h(tag, null, children)
  55844. },
  55845. updated: function updated () {
  55846. var children = this.prevChildren;
  55847. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  55848. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  55849. return
  55850. }
  55851. // we divide the work into three loops to avoid mixing DOM reads and writes
  55852. // in each iteration - which helps prevent layout thrashing.
  55853. children.forEach(callPendingCbs);
  55854. children.forEach(recordPosition);
  55855. children.forEach(applyTranslation);
  55856. // force reflow to put everything in position
  55857. // assign to this to avoid being removed in tree-shaking
  55858. // $flow-disable-line
  55859. this._reflow = document.body.offsetHeight;
  55860. children.forEach(function (c) {
  55861. if (c.data.moved) {
  55862. var el = c.elm;
  55863. var s = el.style;
  55864. addTransitionClass(el, moveClass);
  55865. s.transform = s.WebkitTransform = s.transitionDuration = '';
  55866. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  55867. if (e && e.target !== el) {
  55868. return
  55869. }
  55870. if (!e || /transform$/.test(e.propertyName)) {
  55871. el.removeEventListener(transitionEndEvent, cb);
  55872. el._moveCb = null;
  55873. removeTransitionClass(el, moveClass);
  55874. }
  55875. });
  55876. }
  55877. });
  55878. },
  55879. methods: {
  55880. hasMove: function hasMove (el, moveClass) {
  55881. /* istanbul ignore if */
  55882. if (!hasTransition) {
  55883. return false
  55884. }
  55885. /* istanbul ignore if */
  55886. if (this._hasMove) {
  55887. return this._hasMove
  55888. }
  55889. // Detect whether an element with the move class applied has
  55890. // CSS transitions. Since the element may be inside an entering
  55891. // transition at this very moment, we make a clone of it and remove
  55892. // all other transition classes applied to ensure only the move class
  55893. // is applied.
  55894. var clone = el.cloneNode();
  55895. if (el._transitionClasses) {
  55896. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  55897. }
  55898. addClass(clone, moveClass);
  55899. clone.style.display = 'none';
  55900. this.$el.appendChild(clone);
  55901. var info = getTransitionInfo(clone);
  55902. this.$el.removeChild(clone);
  55903. return (this._hasMove = info.hasTransform)
  55904. }
  55905. }
  55906. };
  55907. function callPendingCbs (c) {
  55908. /* istanbul ignore if */
  55909. if (c.elm._moveCb) {
  55910. c.elm._moveCb();
  55911. }
  55912. /* istanbul ignore if */
  55913. if (c.elm._enterCb) {
  55914. c.elm._enterCb();
  55915. }
  55916. }
  55917. function recordPosition (c) {
  55918. c.data.newPos = c.elm.getBoundingClientRect();
  55919. }
  55920. function applyTranslation (c) {
  55921. var oldPos = c.data.pos;
  55922. var newPos = c.data.newPos;
  55923. var dx = oldPos.left - newPos.left;
  55924. var dy = oldPos.top - newPos.top;
  55925. if (dx || dy) {
  55926. c.data.moved = true;
  55927. var s = c.elm.style;
  55928. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  55929. s.transitionDuration = '0s';
  55930. }
  55931. }
  55932. var platformComponents = {
  55933. Transition: Transition,
  55934. TransitionGroup: TransitionGroup
  55935. };
  55936. /* */
  55937. // install platform specific utils
  55938. Vue.config.mustUseProp = mustUseProp;
  55939. Vue.config.isReservedTag = isReservedTag;
  55940. Vue.config.isReservedAttr = isReservedAttr;
  55941. Vue.config.getTagNamespace = getTagNamespace;
  55942. Vue.config.isUnknownElement = isUnknownElement;
  55943. // install platform runtime directives & components
  55944. extend(Vue.options.directives, platformDirectives);
  55945. extend(Vue.options.components, platformComponents);
  55946. // install platform patch function
  55947. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  55948. // public mount method
  55949. Vue.prototype.$mount = function (
  55950. el,
  55951. hydrating
  55952. ) {
  55953. el = el && inBrowser ? query(el) : undefined;
  55954. return mountComponent(this, el, hydrating)
  55955. };
  55956. // devtools global hook
  55957. /* istanbul ignore next */
  55958. if (inBrowser) {
  55959. setTimeout(function () {
  55960. if (config.devtools) {
  55961. if (devtools) {
  55962. devtools.emit('init', Vue);
  55963. } else {
  55964. console[console.info ? 'info' : 'log'](
  55965. 'Download the Vue Devtools extension for a better development experience:\n' +
  55966. 'https://github.com/vuejs/vue-devtools'
  55967. );
  55968. }
  55969. }
  55970. if (config.productionTip !== false &&
  55971. typeof console !== 'undefined'
  55972. ) {
  55973. console[console.info ? 'info' : 'log'](
  55974. "You are running Vue in development mode.\n" +
  55975. "Make sure to turn on production mode when deploying for production.\n" +
  55976. "See more tips at https://vuejs.org/guide/deployment.html"
  55977. );
  55978. }
  55979. }, 0);
  55980. }
  55981. /* */
  55982. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  55983. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  55984. var buildRegex = cached(function (delimiters) {
  55985. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  55986. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  55987. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  55988. });
  55989. function parseText (
  55990. text,
  55991. delimiters
  55992. ) {
  55993. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  55994. if (!tagRE.test(text)) {
  55995. return
  55996. }
  55997. var tokens = [];
  55998. var rawTokens = [];
  55999. var lastIndex = tagRE.lastIndex = 0;
  56000. var match, index, tokenValue;
  56001. while ((match = tagRE.exec(text))) {
  56002. index = match.index;
  56003. // push text token
  56004. if (index > lastIndex) {
  56005. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  56006. tokens.push(JSON.stringify(tokenValue));
  56007. }
  56008. // tag token
  56009. var exp = parseFilters(match[1].trim());
  56010. tokens.push(("_s(" + exp + ")"));
  56011. rawTokens.push({ '@binding': exp });
  56012. lastIndex = index + match[0].length;
  56013. }
  56014. if (lastIndex < text.length) {
  56015. rawTokens.push(tokenValue = text.slice(lastIndex));
  56016. tokens.push(JSON.stringify(tokenValue));
  56017. }
  56018. return {
  56019. expression: tokens.join('+'),
  56020. tokens: rawTokens
  56021. }
  56022. }
  56023. /* */
  56024. function transformNode (el, options) {
  56025. var warn = options.warn || baseWarn;
  56026. var staticClass = getAndRemoveAttr(el, 'class');
  56027. if (staticClass) {
  56028. var res = parseText(staticClass, options.delimiters);
  56029. if (res) {
  56030. warn(
  56031. "class=\"" + staticClass + "\": " +
  56032. 'Interpolation inside attributes has been removed. ' +
  56033. 'Use v-bind or the colon shorthand instead. For example, ' +
  56034. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  56035. el.rawAttrsMap['class']
  56036. );
  56037. }
  56038. }
  56039. if (staticClass) {
  56040. el.staticClass = JSON.stringify(staticClass);
  56041. }
  56042. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  56043. if (classBinding) {
  56044. el.classBinding = classBinding;
  56045. }
  56046. }
  56047. function genData (el) {
  56048. var data = '';
  56049. if (el.staticClass) {
  56050. data += "staticClass:" + (el.staticClass) + ",";
  56051. }
  56052. if (el.classBinding) {
  56053. data += "class:" + (el.classBinding) + ",";
  56054. }
  56055. return data
  56056. }
  56057. var klass$1 = {
  56058. staticKeys: ['staticClass'],
  56059. transformNode: transformNode,
  56060. genData: genData
  56061. };
  56062. /* */
  56063. function transformNode$1 (el, options) {
  56064. var warn = options.warn || baseWarn;
  56065. var staticStyle = getAndRemoveAttr(el, 'style');
  56066. if (staticStyle) {
  56067. /* istanbul ignore if */
  56068. {
  56069. var res = parseText(staticStyle, options.delimiters);
  56070. if (res) {
  56071. warn(
  56072. "style=\"" + staticStyle + "\": " +
  56073. 'Interpolation inside attributes has been removed. ' +
  56074. 'Use v-bind or the colon shorthand instead. For example, ' +
  56075. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  56076. el.rawAttrsMap['style']
  56077. );
  56078. }
  56079. }
  56080. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  56081. }
  56082. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  56083. if (styleBinding) {
  56084. el.styleBinding = styleBinding;
  56085. }
  56086. }
  56087. function genData$1 (el) {
  56088. var data = '';
  56089. if (el.staticStyle) {
  56090. data += "staticStyle:" + (el.staticStyle) + ",";
  56091. }
  56092. if (el.styleBinding) {
  56093. data += "style:(" + (el.styleBinding) + "),";
  56094. }
  56095. return data
  56096. }
  56097. var style$1 = {
  56098. staticKeys: ['staticStyle'],
  56099. transformNode: transformNode$1,
  56100. genData: genData$1
  56101. };
  56102. /* */
  56103. var decoder;
  56104. var he = {
  56105. decode: function decode (html) {
  56106. decoder = decoder || document.createElement('div');
  56107. decoder.innerHTML = html;
  56108. return decoder.textContent
  56109. }
  56110. };
  56111. /* */
  56112. var isUnaryTag = makeMap(
  56113. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  56114. 'link,meta,param,source,track,wbr'
  56115. );
  56116. // Elements that you can, intentionally, leave open
  56117. // (and which close themselves)
  56118. var canBeLeftOpenTag = makeMap(
  56119. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  56120. );
  56121. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  56122. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  56123. var isNonPhrasingTag = makeMap(
  56124. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  56125. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  56126. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  56127. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  56128. 'title,tr,track'
  56129. );
  56130. /**
  56131. * Not type-checking this file because it's mostly vendor code.
  56132. */
  56133. // Regular Expressions for parsing tags and attributes
  56134. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56135. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  56136. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  56137. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  56138. var startTagOpen = new RegExp(("^<" + qnameCapture));
  56139. var startTagClose = /^\s*(\/?)>/;
  56140. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  56141. var doctype = /^<!DOCTYPE [^>]+>/i;
  56142. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  56143. var comment = /^<!\--/;
  56144. var conditionalComment = /^<!\[/;
  56145. // Special Elements (can contain anything)
  56146. var isPlainTextElement = makeMap('script,style,textarea', true);
  56147. var reCache = {};
  56148. var decodingMap = {
  56149. '&lt;': '<',
  56150. '&gt;': '>',
  56151. '&quot;': '"',
  56152. '&amp;': '&',
  56153. '&#10;': '\n',
  56154. '&#9;': '\t',
  56155. '&#39;': "'"
  56156. };
  56157. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  56158. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  56159. // #5992
  56160. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  56161. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  56162. function decodeAttr (value, shouldDecodeNewlines) {
  56163. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  56164. return value.replace(re, function (match) { return decodingMap[match]; })
  56165. }
  56166. function parseHTML (html, options) {
  56167. var stack = [];
  56168. var expectHTML = options.expectHTML;
  56169. var isUnaryTag$$1 = options.isUnaryTag || no;
  56170. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  56171. var index = 0;
  56172. var last, lastTag;
  56173. while (html) {
  56174. last = html;
  56175. // Make sure we're not in a plaintext content element like script/style
  56176. if (!lastTag || !isPlainTextElement(lastTag)) {
  56177. var textEnd = html.indexOf('<');
  56178. if (textEnd === 0) {
  56179. // Comment:
  56180. if (comment.test(html)) {
  56181. var commentEnd = html.indexOf('-->');
  56182. if (commentEnd >= 0) {
  56183. if (options.shouldKeepComment) {
  56184. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  56185. }
  56186. advance(commentEnd + 3);
  56187. continue
  56188. }
  56189. }
  56190. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  56191. if (conditionalComment.test(html)) {
  56192. var conditionalEnd = html.indexOf(']>');
  56193. if (conditionalEnd >= 0) {
  56194. advance(conditionalEnd + 2);
  56195. continue
  56196. }
  56197. }
  56198. // Doctype:
  56199. var doctypeMatch = html.match(doctype);
  56200. if (doctypeMatch) {
  56201. advance(doctypeMatch[0].length);
  56202. continue
  56203. }
  56204. // End tag:
  56205. var endTagMatch = html.match(endTag);
  56206. if (endTagMatch) {
  56207. var curIndex = index;
  56208. advance(endTagMatch[0].length);
  56209. parseEndTag(endTagMatch[1], curIndex, index);
  56210. continue
  56211. }
  56212. // Start tag:
  56213. var startTagMatch = parseStartTag();
  56214. if (startTagMatch) {
  56215. handleStartTag(startTagMatch);
  56216. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  56217. advance(1);
  56218. }
  56219. continue
  56220. }
  56221. }
  56222. var text = (void 0), rest = (void 0), next = (void 0);
  56223. if (textEnd >= 0) {
  56224. rest = html.slice(textEnd);
  56225. while (
  56226. !endTag.test(rest) &&
  56227. !startTagOpen.test(rest) &&
  56228. !comment.test(rest) &&
  56229. !conditionalComment.test(rest)
  56230. ) {
  56231. // < in plain text, be forgiving and treat it as text
  56232. next = rest.indexOf('<', 1);
  56233. if (next < 0) { break }
  56234. textEnd += next;
  56235. rest = html.slice(textEnd);
  56236. }
  56237. text = html.substring(0, textEnd);
  56238. }
  56239. if (textEnd < 0) {
  56240. text = html;
  56241. }
  56242. if (text) {
  56243. advance(text.length);
  56244. }
  56245. if (options.chars && text) {
  56246. options.chars(text, index - text.length, index);
  56247. }
  56248. } else {
  56249. var endTagLength = 0;
  56250. var stackedTag = lastTag.toLowerCase();
  56251. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  56252. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  56253. endTagLength = endTag.length;
  56254. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  56255. text = text
  56256. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  56257. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  56258. }
  56259. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  56260. text = text.slice(1);
  56261. }
  56262. if (options.chars) {
  56263. options.chars(text);
  56264. }
  56265. return ''
  56266. });
  56267. index += html.length - rest$1.length;
  56268. html = rest$1;
  56269. parseEndTag(stackedTag, index - endTagLength, index);
  56270. }
  56271. if (html === last) {
  56272. options.chars && options.chars(html);
  56273. if (!stack.length && options.warn) {
  56274. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  56275. }
  56276. break
  56277. }
  56278. }
  56279. // Clean up any remaining tags
  56280. parseEndTag();
  56281. function advance (n) {
  56282. index += n;
  56283. html = html.substring(n);
  56284. }
  56285. function parseStartTag () {
  56286. var start = html.match(startTagOpen);
  56287. if (start) {
  56288. var match = {
  56289. tagName: start[1],
  56290. attrs: [],
  56291. start: index
  56292. };
  56293. advance(start[0].length);
  56294. var end, attr;
  56295. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  56296. attr.start = index;
  56297. advance(attr[0].length);
  56298. attr.end = index;
  56299. match.attrs.push(attr);
  56300. }
  56301. if (end) {
  56302. match.unarySlash = end[1];
  56303. advance(end[0].length);
  56304. match.end = index;
  56305. return match
  56306. }
  56307. }
  56308. }
  56309. function handleStartTag (match) {
  56310. var tagName = match.tagName;
  56311. var unarySlash = match.unarySlash;
  56312. if (expectHTML) {
  56313. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  56314. parseEndTag(lastTag);
  56315. }
  56316. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  56317. parseEndTag(tagName);
  56318. }
  56319. }
  56320. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  56321. var l = match.attrs.length;
  56322. var attrs = new Array(l);
  56323. for (var i = 0; i < l; i++) {
  56324. var args = match.attrs[i];
  56325. var value = args[3] || args[4] || args[5] || '';
  56326. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  56327. ? options.shouldDecodeNewlinesForHref
  56328. : options.shouldDecodeNewlines;
  56329. attrs[i] = {
  56330. name: args[1],
  56331. value: decodeAttr(value, shouldDecodeNewlines)
  56332. };
  56333. if (options.outputSourceRange) {
  56334. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  56335. attrs[i].end = args.end;
  56336. }
  56337. }
  56338. if (!unary) {
  56339. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  56340. lastTag = tagName;
  56341. }
  56342. if (options.start) {
  56343. options.start(tagName, attrs, unary, match.start, match.end);
  56344. }
  56345. }
  56346. function parseEndTag (tagName, start, end) {
  56347. var pos, lowerCasedTagName;
  56348. if (start == null) { start = index; }
  56349. if (end == null) { end = index; }
  56350. // Find the closest opened tag of the same type
  56351. if (tagName) {
  56352. lowerCasedTagName = tagName.toLowerCase();
  56353. for (pos = stack.length - 1; pos >= 0; pos--) {
  56354. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  56355. break
  56356. }
  56357. }
  56358. } else {
  56359. // If no tag name is provided, clean shop
  56360. pos = 0;
  56361. }
  56362. if (pos >= 0) {
  56363. // Close all the open elements, up the stack
  56364. for (var i = stack.length - 1; i >= pos; i--) {
  56365. if (i > pos || !tagName &&
  56366. options.warn
  56367. ) {
  56368. options.warn(
  56369. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  56370. { start: stack[i].start, end: stack[i].end }
  56371. );
  56372. }
  56373. if (options.end) {
  56374. options.end(stack[i].tag, start, end);
  56375. }
  56376. }
  56377. // Remove the open elements from the stack
  56378. stack.length = pos;
  56379. lastTag = pos && stack[pos - 1].tag;
  56380. } else if (lowerCasedTagName === 'br') {
  56381. if (options.start) {
  56382. options.start(tagName, [], true, start, end);
  56383. }
  56384. } else if (lowerCasedTagName === 'p') {
  56385. if (options.start) {
  56386. options.start(tagName, [], false, start, end);
  56387. }
  56388. if (options.end) {
  56389. options.end(tagName, start, end);
  56390. }
  56391. }
  56392. }
  56393. }
  56394. /* */
  56395. var onRE = /^@|^v-on:/;
  56396. var dirRE = /^v-|^@|^:|^#/;
  56397. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  56398. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  56399. var stripParensRE = /^\(|\)$/g;
  56400. var dynamicArgRE = /^\[.*\]$/;
  56401. var argRE = /:(.*)$/;
  56402. var bindRE = /^:|^\.|^v-bind:/;
  56403. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  56404. var slotRE = /^v-slot(:|$)|^#/;
  56405. var lineBreakRE = /[\r\n]/;
  56406. var whitespaceRE$1 = /\s+/g;
  56407. var invalidAttributeRE = /[\s"'<>\/=]/;
  56408. var decodeHTMLCached = cached(he.decode);
  56409. var emptySlotScopeToken = "_empty_";
  56410. // configurable state
  56411. var warn$2;
  56412. var delimiters;
  56413. var transforms;
  56414. var preTransforms;
  56415. var postTransforms;
  56416. var platformIsPreTag;
  56417. var platformMustUseProp;
  56418. var platformGetTagNamespace;
  56419. var maybeComponent;
  56420. function createASTElement (
  56421. tag,
  56422. attrs,
  56423. parent
  56424. ) {
  56425. return {
  56426. type: 1,
  56427. tag: tag,
  56428. attrsList: attrs,
  56429. attrsMap: makeAttrsMap(attrs),
  56430. rawAttrsMap: {},
  56431. parent: parent,
  56432. children: []
  56433. }
  56434. }
  56435. /**
  56436. * Convert HTML string to AST.
  56437. */
  56438. function parse (
  56439. template,
  56440. options
  56441. ) {
  56442. warn$2 = options.warn || baseWarn;
  56443. platformIsPreTag = options.isPreTag || no;
  56444. platformMustUseProp = options.mustUseProp || no;
  56445. platformGetTagNamespace = options.getTagNamespace || no;
  56446. var isReservedTag = options.isReservedTag || no;
  56447. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  56448. transforms = pluckModuleFunction(options.modules, 'transformNode');
  56449. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  56450. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  56451. delimiters = options.delimiters;
  56452. var stack = [];
  56453. var preserveWhitespace = options.preserveWhitespace !== false;
  56454. var whitespaceOption = options.whitespace;
  56455. var root;
  56456. var currentParent;
  56457. var inVPre = false;
  56458. var inPre = false;
  56459. var warned = false;
  56460. function warnOnce (msg, range) {
  56461. if (!warned) {
  56462. warned = true;
  56463. warn$2(msg, range);
  56464. }
  56465. }
  56466. function closeElement (element) {
  56467. trimEndingWhitespace(element);
  56468. if (!inVPre && !element.processed) {
  56469. element = processElement(element, options);
  56470. }
  56471. // tree management
  56472. if (!stack.length && element !== root) {
  56473. // allow root elements with v-if, v-else-if and v-else
  56474. if (root.if && (element.elseif || element.else)) {
  56475. {
  56476. checkRootConstraints(element);
  56477. }
  56478. addIfCondition(root, {
  56479. exp: element.elseif,
  56480. block: element
  56481. });
  56482. } else {
  56483. warnOnce(
  56484. "Component template should contain exactly one root element. " +
  56485. "If you are using v-if on multiple elements, " +
  56486. "use v-else-if to chain them instead.",
  56487. { start: element.start }
  56488. );
  56489. }
  56490. }
  56491. if (currentParent && !element.forbidden) {
  56492. if (element.elseif || element.else) {
  56493. processIfConditions(element, currentParent);
  56494. } else {
  56495. if (element.slotScope) {
  56496. // scoped slot
  56497. // keep it in the children list so that v-else(-if) conditions can
  56498. // find it as the prev node.
  56499. var name = element.slotTarget || '"default"'
  56500. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  56501. }
  56502. currentParent.children.push(element);
  56503. element.parent = currentParent;
  56504. }
  56505. }
  56506. // final children cleanup
  56507. // filter out scoped slots
  56508. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  56509. // remove trailing whitespace node again
  56510. trimEndingWhitespace(element);
  56511. // check pre state
  56512. if (element.pre) {
  56513. inVPre = false;
  56514. }
  56515. if (platformIsPreTag(element.tag)) {
  56516. inPre = false;
  56517. }
  56518. // apply post-transforms
  56519. for (var i = 0; i < postTransforms.length; i++) {
  56520. postTransforms[i](element, options);
  56521. }
  56522. }
  56523. function trimEndingWhitespace (el) {
  56524. // remove trailing whitespace node
  56525. if (!inPre) {
  56526. var lastNode;
  56527. while (
  56528. (lastNode = el.children[el.children.length - 1]) &&
  56529. lastNode.type === 3 &&
  56530. lastNode.text === ' '
  56531. ) {
  56532. el.children.pop();
  56533. }
  56534. }
  56535. }
  56536. function checkRootConstraints (el) {
  56537. if (el.tag === 'slot' || el.tag === 'template') {
  56538. warnOnce(
  56539. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  56540. 'contain multiple nodes.',
  56541. { start: el.start }
  56542. );
  56543. }
  56544. if (el.attrsMap.hasOwnProperty('v-for')) {
  56545. warnOnce(
  56546. 'Cannot use v-for on stateful component root element because ' +
  56547. 'it renders multiple elements.',
  56548. el.rawAttrsMap['v-for']
  56549. );
  56550. }
  56551. }
  56552. parseHTML(template, {
  56553. warn: warn$2,
  56554. expectHTML: options.expectHTML,
  56555. isUnaryTag: options.isUnaryTag,
  56556. canBeLeftOpenTag: options.canBeLeftOpenTag,
  56557. shouldDecodeNewlines: options.shouldDecodeNewlines,
  56558. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  56559. shouldKeepComment: options.comments,
  56560. outputSourceRange: options.outputSourceRange,
  56561. start: function start (tag, attrs, unary, start$1, end) {
  56562. // check namespace.
  56563. // inherit parent ns if there is one
  56564. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  56565. // handle IE svg bug
  56566. /* istanbul ignore if */
  56567. if (isIE && ns === 'svg') {
  56568. attrs = guardIESVGBug(attrs);
  56569. }
  56570. var element = createASTElement(tag, attrs, currentParent);
  56571. if (ns) {
  56572. element.ns = ns;
  56573. }
  56574. {
  56575. if (options.outputSourceRange) {
  56576. element.start = start$1;
  56577. element.end = end;
  56578. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  56579. cumulated[attr.name] = attr;
  56580. return cumulated
  56581. }, {});
  56582. }
  56583. attrs.forEach(function (attr) {
  56584. if (invalidAttributeRE.test(attr.name)) {
  56585. warn$2(
  56586. "Invalid dynamic argument expression: attribute names cannot contain " +
  56587. "spaces, quotes, <, >, / or =.",
  56588. {
  56589. start: attr.start + attr.name.indexOf("["),
  56590. end: attr.start + attr.name.length
  56591. }
  56592. );
  56593. }
  56594. });
  56595. }
  56596. if (isForbiddenTag(element) && !isServerRendering()) {
  56597. element.forbidden = true;
  56598. warn$2(
  56599. 'Templates should only be responsible for mapping the state to the ' +
  56600. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  56601. "<" + tag + ">" + ', as they will not be parsed.',
  56602. { start: element.start }
  56603. );
  56604. }
  56605. // apply pre-transforms
  56606. for (var i = 0; i < preTransforms.length; i++) {
  56607. element = preTransforms[i](element, options) || element;
  56608. }
  56609. if (!inVPre) {
  56610. processPre(element);
  56611. if (element.pre) {
  56612. inVPre = true;
  56613. }
  56614. }
  56615. if (platformIsPreTag(element.tag)) {
  56616. inPre = true;
  56617. }
  56618. if (inVPre) {
  56619. processRawAttrs(element);
  56620. } else if (!element.processed) {
  56621. // structural directives
  56622. processFor(element);
  56623. processIf(element);
  56624. processOnce(element);
  56625. }
  56626. if (!root) {
  56627. root = element;
  56628. {
  56629. checkRootConstraints(root);
  56630. }
  56631. }
  56632. if (!unary) {
  56633. currentParent = element;
  56634. stack.push(element);
  56635. } else {
  56636. closeElement(element);
  56637. }
  56638. },
  56639. end: function end (tag, start, end$1) {
  56640. var element = stack[stack.length - 1];
  56641. // pop stack
  56642. stack.length -= 1;
  56643. currentParent = stack[stack.length - 1];
  56644. if (options.outputSourceRange) {
  56645. element.end = end$1;
  56646. }
  56647. closeElement(element);
  56648. },
  56649. chars: function chars (text, start, end) {
  56650. if (!currentParent) {
  56651. {
  56652. if (text === template) {
  56653. warnOnce(
  56654. 'Component template requires a root element, rather than just text.',
  56655. { start: start }
  56656. );
  56657. } else if ((text = text.trim())) {
  56658. warnOnce(
  56659. ("text \"" + text + "\" outside root element will be ignored."),
  56660. { start: start }
  56661. );
  56662. }
  56663. }
  56664. return
  56665. }
  56666. // IE textarea placeholder bug
  56667. /* istanbul ignore if */
  56668. if (isIE &&
  56669. currentParent.tag === 'textarea' &&
  56670. currentParent.attrsMap.placeholder === text
  56671. ) {
  56672. return
  56673. }
  56674. var children = currentParent.children;
  56675. if (inPre || text.trim()) {
  56676. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  56677. } else if (!children.length) {
  56678. // remove the whitespace-only node right after an opening tag
  56679. text = '';
  56680. } else if (whitespaceOption) {
  56681. if (whitespaceOption === 'condense') {
  56682. // in condense mode, remove the whitespace node if it contains
  56683. // line break, otherwise condense to a single space
  56684. text = lineBreakRE.test(text) ? '' : ' ';
  56685. } else {
  56686. text = ' ';
  56687. }
  56688. } else {
  56689. text = preserveWhitespace ? ' ' : '';
  56690. }
  56691. if (text) {
  56692. if (!inPre && whitespaceOption === 'condense') {
  56693. // condense consecutive whitespaces into single space
  56694. text = text.replace(whitespaceRE$1, ' ');
  56695. }
  56696. var res;
  56697. var child;
  56698. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  56699. child = {
  56700. type: 2,
  56701. expression: res.expression,
  56702. tokens: res.tokens,
  56703. text: text
  56704. };
  56705. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  56706. child = {
  56707. type: 3,
  56708. text: text
  56709. };
  56710. }
  56711. if (child) {
  56712. if (options.outputSourceRange) {
  56713. child.start = start;
  56714. child.end = end;
  56715. }
  56716. children.push(child);
  56717. }
  56718. }
  56719. },
  56720. comment: function comment (text, start, end) {
  56721. // adding anyting as a sibling to the root node is forbidden
  56722. // comments should still be allowed, but ignored
  56723. if (currentParent) {
  56724. var child = {
  56725. type: 3,
  56726. text: text,
  56727. isComment: true
  56728. };
  56729. if (options.outputSourceRange) {
  56730. child.start = start;
  56731. child.end = end;
  56732. }
  56733. currentParent.children.push(child);
  56734. }
  56735. }
  56736. });
  56737. return root
  56738. }
  56739. function processPre (el) {
  56740. if (getAndRemoveAttr(el, 'v-pre') != null) {
  56741. el.pre = true;
  56742. }
  56743. }
  56744. function processRawAttrs (el) {
  56745. var list = el.attrsList;
  56746. var len = list.length;
  56747. if (len) {
  56748. var attrs = el.attrs = new Array(len);
  56749. for (var i = 0; i < len; i++) {
  56750. attrs[i] = {
  56751. name: list[i].name,
  56752. value: JSON.stringify(list[i].value)
  56753. };
  56754. if (list[i].start != null) {
  56755. attrs[i].start = list[i].start;
  56756. attrs[i].end = list[i].end;
  56757. }
  56758. }
  56759. } else if (!el.pre) {
  56760. // non root node in pre blocks with no attributes
  56761. el.plain = true;
  56762. }
  56763. }
  56764. function processElement (
  56765. element,
  56766. options
  56767. ) {
  56768. processKey(element);
  56769. // determine whether this is a plain element after
  56770. // removing structural attributes
  56771. element.plain = (
  56772. !element.key &&
  56773. !element.scopedSlots &&
  56774. !element.attrsList.length
  56775. );
  56776. processRef(element);
  56777. processSlotContent(element);
  56778. processSlotOutlet(element);
  56779. processComponent(element);
  56780. for (var i = 0; i < transforms.length; i++) {
  56781. element = transforms[i](element, options) || element;
  56782. }
  56783. processAttrs(element);
  56784. return element
  56785. }
  56786. function processKey (el) {
  56787. var exp = getBindingAttr(el, 'key');
  56788. if (exp) {
  56789. {
  56790. if (el.tag === 'template') {
  56791. warn$2(
  56792. "<template> cannot be keyed. Place the key on real elements instead.",
  56793. getRawBindingAttr(el, 'key')
  56794. );
  56795. }
  56796. if (el.for) {
  56797. var iterator = el.iterator2 || el.iterator1;
  56798. var parent = el.parent;
  56799. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  56800. warn$2(
  56801. "Do not use v-for index as key on <transition-group> children, " +
  56802. "this is the same as not using keys.",
  56803. getRawBindingAttr(el, 'key'),
  56804. true /* tip */
  56805. );
  56806. }
  56807. }
  56808. }
  56809. el.key = exp;
  56810. }
  56811. }
  56812. function processRef (el) {
  56813. var ref = getBindingAttr(el, 'ref');
  56814. if (ref) {
  56815. el.ref = ref;
  56816. el.refInFor = checkInFor(el);
  56817. }
  56818. }
  56819. function processFor (el) {
  56820. var exp;
  56821. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  56822. var res = parseFor(exp);
  56823. if (res) {
  56824. extend(el, res);
  56825. } else {
  56826. warn$2(
  56827. ("Invalid v-for expression: " + exp),
  56828. el.rawAttrsMap['v-for']
  56829. );
  56830. }
  56831. }
  56832. }
  56833. function parseFor (exp) {
  56834. var inMatch = exp.match(forAliasRE);
  56835. if (!inMatch) { return }
  56836. var res = {};
  56837. res.for = inMatch[2].trim();
  56838. var alias = inMatch[1].trim().replace(stripParensRE, '');
  56839. var iteratorMatch = alias.match(forIteratorRE);
  56840. if (iteratorMatch) {
  56841. res.alias = alias.replace(forIteratorRE, '').trim();
  56842. res.iterator1 = iteratorMatch[1].trim();
  56843. if (iteratorMatch[2]) {
  56844. res.iterator2 = iteratorMatch[2].trim();
  56845. }
  56846. } else {
  56847. res.alias = alias;
  56848. }
  56849. return res
  56850. }
  56851. function processIf (el) {
  56852. var exp = getAndRemoveAttr(el, 'v-if');
  56853. if (exp) {
  56854. el.if = exp;
  56855. addIfCondition(el, {
  56856. exp: exp,
  56857. block: el
  56858. });
  56859. } else {
  56860. if (getAndRemoveAttr(el, 'v-else') != null) {
  56861. el.else = true;
  56862. }
  56863. var elseif = getAndRemoveAttr(el, 'v-else-if');
  56864. if (elseif) {
  56865. el.elseif = elseif;
  56866. }
  56867. }
  56868. }
  56869. function processIfConditions (el, parent) {
  56870. var prev = findPrevElement(parent.children);
  56871. if (prev && prev.if) {
  56872. addIfCondition(prev, {
  56873. exp: el.elseif,
  56874. block: el
  56875. });
  56876. } else {
  56877. warn$2(
  56878. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  56879. "used on element <" + (el.tag) + "> without corresponding v-if.",
  56880. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  56881. );
  56882. }
  56883. }
  56884. function findPrevElement (children) {
  56885. var i = children.length;
  56886. while (i--) {
  56887. if (children[i].type === 1) {
  56888. return children[i]
  56889. } else {
  56890. if (children[i].text !== ' ') {
  56891. warn$2(
  56892. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  56893. "will be ignored.",
  56894. children[i]
  56895. );
  56896. }
  56897. children.pop();
  56898. }
  56899. }
  56900. }
  56901. function addIfCondition (el, condition) {
  56902. if (!el.ifConditions) {
  56903. el.ifConditions = [];
  56904. }
  56905. el.ifConditions.push(condition);
  56906. }
  56907. function processOnce (el) {
  56908. var once$$1 = getAndRemoveAttr(el, 'v-once');
  56909. if (once$$1 != null) {
  56910. el.once = true;
  56911. }
  56912. }
  56913. // handle content being passed to a component as slot,
  56914. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  56915. function processSlotContent (el) {
  56916. var slotScope;
  56917. if (el.tag === 'template') {
  56918. slotScope = getAndRemoveAttr(el, 'scope');
  56919. /* istanbul ignore if */
  56920. if (slotScope) {
  56921. warn$2(
  56922. "the \"scope\" attribute for scoped slots have been deprecated and " +
  56923. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  56924. "can also be used on plain elements in addition to <template> to " +
  56925. "denote scoped slots.",
  56926. el.rawAttrsMap['scope'],
  56927. true
  56928. );
  56929. }
  56930. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  56931. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  56932. /* istanbul ignore if */
  56933. if (el.attrsMap['v-for']) {
  56934. warn$2(
  56935. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  56936. "(v-for takes higher priority). Use a wrapper <template> for the " +
  56937. "scoped slot to make it clearer.",
  56938. el.rawAttrsMap['slot-scope'],
  56939. true
  56940. );
  56941. }
  56942. el.slotScope = slotScope;
  56943. }
  56944. // slot="xxx"
  56945. var slotTarget = getBindingAttr(el, 'slot');
  56946. if (slotTarget) {
  56947. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  56948. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  56949. // preserve slot as an attribute for native shadow DOM compat
  56950. // only for non-scoped slots.
  56951. if (el.tag !== 'template' && !el.slotScope) {
  56952. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  56953. }
  56954. }
  56955. // 2.6 v-slot syntax
  56956. {
  56957. if (el.tag === 'template') {
  56958. // v-slot on <template>
  56959. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  56960. if (slotBinding) {
  56961. {
  56962. if (el.slotTarget || el.slotScope) {
  56963. warn$2(
  56964. "Unexpected mixed usage of different slot syntaxes.",
  56965. el
  56966. );
  56967. }
  56968. if (el.parent && !maybeComponent(el.parent)) {
  56969. warn$2(
  56970. "<template v-slot> can only appear at the root level inside " +
  56971. "the receiving component",
  56972. el
  56973. );
  56974. }
  56975. }
  56976. var ref = getSlotName(slotBinding);
  56977. var name = ref.name;
  56978. var dynamic = ref.dynamic;
  56979. el.slotTarget = name;
  56980. el.slotTargetDynamic = dynamic;
  56981. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  56982. }
  56983. } else {
  56984. // v-slot on component, denotes default slot
  56985. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  56986. if (slotBinding$1) {
  56987. {
  56988. if (!maybeComponent(el)) {
  56989. warn$2(
  56990. "v-slot can only be used on components or <template>.",
  56991. slotBinding$1
  56992. );
  56993. }
  56994. if (el.slotScope || el.slotTarget) {
  56995. warn$2(
  56996. "Unexpected mixed usage of different slot syntaxes.",
  56997. el
  56998. );
  56999. }
  57000. if (el.scopedSlots) {
  57001. warn$2(
  57002. "To avoid scope ambiguity, the default slot should also use " +
  57003. "<template> syntax when there are other named slots.",
  57004. slotBinding$1
  57005. );
  57006. }
  57007. }
  57008. // add the component's children to its default slot
  57009. var slots = el.scopedSlots || (el.scopedSlots = {});
  57010. var ref$1 = getSlotName(slotBinding$1);
  57011. var name$1 = ref$1.name;
  57012. var dynamic$1 = ref$1.dynamic;
  57013. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  57014. slotContainer.slotTarget = name$1;
  57015. slotContainer.slotTargetDynamic = dynamic$1;
  57016. slotContainer.children = el.children.filter(function (c) {
  57017. if (!c.slotScope) {
  57018. c.parent = slotContainer;
  57019. return true
  57020. }
  57021. });
  57022. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  57023. // remove children as they are returned from scopedSlots now
  57024. el.children = [];
  57025. // mark el non-plain so data gets generated
  57026. el.plain = false;
  57027. }
  57028. }
  57029. }
  57030. }
  57031. function getSlotName (binding) {
  57032. var name = binding.name.replace(slotRE, '');
  57033. if (!name) {
  57034. if (binding.name[0] !== '#') {
  57035. name = 'default';
  57036. } else {
  57037. warn$2(
  57038. "v-slot shorthand syntax requires a slot name.",
  57039. binding
  57040. );
  57041. }
  57042. }
  57043. return dynamicArgRE.test(name)
  57044. // dynamic [name]
  57045. ? { name: name.slice(1, -1), dynamic: true }
  57046. // static name
  57047. : { name: ("\"" + name + "\""), dynamic: false }
  57048. }
  57049. // handle <slot/> outlets
  57050. function processSlotOutlet (el) {
  57051. if (el.tag === 'slot') {
  57052. el.slotName = getBindingAttr(el, 'name');
  57053. if (el.key) {
  57054. warn$2(
  57055. "`key` does not work on <slot> because slots are abstract outlets " +
  57056. "and can possibly expand into multiple elements. " +
  57057. "Use the key on a wrapping element instead.",
  57058. getRawBindingAttr(el, 'key')
  57059. );
  57060. }
  57061. }
  57062. }
  57063. function processComponent (el) {
  57064. var binding;
  57065. if ((binding = getBindingAttr(el, 'is'))) {
  57066. el.component = binding;
  57067. }
  57068. if (getAndRemoveAttr(el, 'inline-template') != null) {
  57069. el.inlineTemplate = true;
  57070. }
  57071. }
  57072. function processAttrs (el) {
  57073. var list = el.attrsList;
  57074. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  57075. for (i = 0, l = list.length; i < l; i++) {
  57076. name = rawName = list[i].name;
  57077. value = list[i].value;
  57078. if (dirRE.test(name)) {
  57079. // mark element as dynamic
  57080. el.hasBindings = true;
  57081. // modifiers
  57082. modifiers = parseModifiers(name.replace(dirRE, ''));
  57083. // support .foo shorthand syntax for the .prop modifier
  57084. if (modifiers) {
  57085. name = name.replace(modifierRE, '');
  57086. }
  57087. if (bindRE.test(name)) { // v-bind
  57088. name = name.replace(bindRE, '');
  57089. value = parseFilters(value);
  57090. isDynamic = dynamicArgRE.test(name);
  57091. if (isDynamic) {
  57092. name = name.slice(1, -1);
  57093. }
  57094. if (
  57095. value.trim().length === 0
  57096. ) {
  57097. warn$2(
  57098. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  57099. );
  57100. }
  57101. if (modifiers) {
  57102. if (modifiers.prop && !isDynamic) {
  57103. name = camelize(name);
  57104. if (name === 'innerHtml') { name = 'innerHTML'; }
  57105. }
  57106. if (modifiers.camel && !isDynamic) {
  57107. name = camelize(name);
  57108. }
  57109. if (modifiers.sync) {
  57110. syncGen = genAssignmentCode(value, "$event");
  57111. if (!isDynamic) {
  57112. addHandler(
  57113. el,
  57114. ("update:" + (camelize(name))),
  57115. syncGen,
  57116. null,
  57117. false,
  57118. warn$2,
  57119. list[i]
  57120. );
  57121. if (hyphenate(name) !== camelize(name)) {
  57122. addHandler(
  57123. el,
  57124. ("update:" + (hyphenate(name))),
  57125. syncGen,
  57126. null,
  57127. false,
  57128. warn$2,
  57129. list[i]
  57130. );
  57131. }
  57132. } else {
  57133. // handler w/ dynamic event name
  57134. addHandler(
  57135. el,
  57136. ("\"update:\"+(" + name + ")"),
  57137. syncGen,
  57138. null,
  57139. false,
  57140. warn$2,
  57141. list[i],
  57142. true // dynamic
  57143. );
  57144. }
  57145. }
  57146. }
  57147. if ((modifiers && modifiers.prop) || (
  57148. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  57149. )) {
  57150. addProp(el, name, value, list[i], isDynamic);
  57151. } else {
  57152. addAttr(el, name, value, list[i], isDynamic);
  57153. }
  57154. } else if (onRE.test(name)) { // v-on
  57155. name = name.replace(onRE, '');
  57156. isDynamic = dynamicArgRE.test(name);
  57157. if (isDynamic) {
  57158. name = name.slice(1, -1);
  57159. }
  57160. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  57161. } else { // normal directives
  57162. name = name.replace(dirRE, '');
  57163. // parse arg
  57164. var argMatch = name.match(argRE);
  57165. var arg = argMatch && argMatch[1];
  57166. isDynamic = false;
  57167. if (arg) {
  57168. name = name.slice(0, -(arg.length + 1));
  57169. if (dynamicArgRE.test(arg)) {
  57170. arg = arg.slice(1, -1);
  57171. isDynamic = true;
  57172. }
  57173. }
  57174. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  57175. if (name === 'model') {
  57176. checkForAliasModel(el, value);
  57177. }
  57178. }
  57179. } else {
  57180. // literal attribute
  57181. {
  57182. var res = parseText(value, delimiters);
  57183. if (res) {
  57184. warn$2(
  57185. name + "=\"" + value + "\": " +
  57186. 'Interpolation inside attributes has been removed. ' +
  57187. 'Use v-bind or the colon shorthand instead. For example, ' +
  57188. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  57189. list[i]
  57190. );
  57191. }
  57192. }
  57193. addAttr(el, name, JSON.stringify(value), list[i]);
  57194. // #6887 firefox doesn't update muted state if set via attribute
  57195. // even immediately after element creation
  57196. if (!el.component &&
  57197. name === 'muted' &&
  57198. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  57199. addProp(el, name, 'true', list[i]);
  57200. }
  57201. }
  57202. }
  57203. }
  57204. function checkInFor (el) {
  57205. var parent = el;
  57206. while (parent) {
  57207. if (parent.for !== undefined) {
  57208. return true
  57209. }
  57210. parent = parent.parent;
  57211. }
  57212. return false
  57213. }
  57214. function parseModifiers (name) {
  57215. var match = name.match(modifierRE);
  57216. if (match) {
  57217. var ret = {};
  57218. match.forEach(function (m) { ret[m.slice(1)] = true; });
  57219. return ret
  57220. }
  57221. }
  57222. function makeAttrsMap (attrs) {
  57223. var map = {};
  57224. for (var i = 0, l = attrs.length; i < l; i++) {
  57225. if (
  57226. map[attrs[i].name] && !isIE && !isEdge
  57227. ) {
  57228. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  57229. }
  57230. map[attrs[i].name] = attrs[i].value;
  57231. }
  57232. return map
  57233. }
  57234. // for script (e.g. type="x/template") or style, do not decode content
  57235. function isTextTag (el) {
  57236. return el.tag === 'script' || el.tag === 'style'
  57237. }
  57238. function isForbiddenTag (el) {
  57239. return (
  57240. el.tag === 'style' ||
  57241. (el.tag === 'script' && (
  57242. !el.attrsMap.type ||
  57243. el.attrsMap.type === 'text/javascript'
  57244. ))
  57245. )
  57246. }
  57247. var ieNSBug = /^xmlns:NS\d+/;
  57248. var ieNSPrefix = /^NS\d+:/;
  57249. /* istanbul ignore next */
  57250. function guardIESVGBug (attrs) {
  57251. var res = [];
  57252. for (var i = 0; i < attrs.length; i++) {
  57253. var attr = attrs[i];
  57254. if (!ieNSBug.test(attr.name)) {
  57255. attr.name = attr.name.replace(ieNSPrefix, '');
  57256. res.push(attr);
  57257. }
  57258. }
  57259. return res
  57260. }
  57261. function checkForAliasModel (el, value) {
  57262. var _el = el;
  57263. while (_el) {
  57264. if (_el.for && _el.alias === value) {
  57265. warn$2(
  57266. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  57267. "You are binding v-model directly to a v-for iteration alias. " +
  57268. "This will not be able to modify the v-for source array because " +
  57269. "writing to the alias is like modifying a function local variable. " +
  57270. "Consider using an array of objects and use v-model on an object property instead.",
  57271. el.rawAttrsMap['v-model']
  57272. );
  57273. }
  57274. _el = _el.parent;
  57275. }
  57276. }
  57277. /* */
  57278. function preTransformNode (el, options) {
  57279. if (el.tag === 'input') {
  57280. var map = el.attrsMap;
  57281. if (!map['v-model']) {
  57282. return
  57283. }
  57284. var typeBinding;
  57285. if (map[':type'] || map['v-bind:type']) {
  57286. typeBinding = getBindingAttr(el, 'type');
  57287. }
  57288. if (!map.type && !typeBinding && map['v-bind']) {
  57289. typeBinding = "(" + (map['v-bind']) + ").type";
  57290. }
  57291. if (typeBinding) {
  57292. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  57293. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  57294. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  57295. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  57296. // 1. checkbox
  57297. var branch0 = cloneASTElement(el);
  57298. // process for on the main node
  57299. processFor(branch0);
  57300. addRawAttr(branch0, 'type', 'checkbox');
  57301. processElement(branch0, options);
  57302. branch0.processed = true; // prevent it from double-processed
  57303. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  57304. addIfCondition(branch0, {
  57305. exp: branch0.if,
  57306. block: branch0
  57307. });
  57308. // 2. add radio else-if condition
  57309. var branch1 = cloneASTElement(el);
  57310. getAndRemoveAttr(branch1, 'v-for', true);
  57311. addRawAttr(branch1, 'type', 'radio');
  57312. processElement(branch1, options);
  57313. addIfCondition(branch0, {
  57314. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  57315. block: branch1
  57316. });
  57317. // 3. other
  57318. var branch2 = cloneASTElement(el);
  57319. getAndRemoveAttr(branch2, 'v-for', true);
  57320. addRawAttr(branch2, ':type', typeBinding);
  57321. processElement(branch2, options);
  57322. addIfCondition(branch0, {
  57323. exp: ifCondition,
  57324. block: branch2
  57325. });
  57326. if (hasElse) {
  57327. branch0.else = true;
  57328. } else if (elseIfCondition) {
  57329. branch0.elseif = elseIfCondition;
  57330. }
  57331. return branch0
  57332. }
  57333. }
  57334. }
  57335. function cloneASTElement (el) {
  57336. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  57337. }
  57338. var model$1 = {
  57339. preTransformNode: preTransformNode
  57340. };
  57341. var modules$1 = [
  57342. klass$1,
  57343. style$1,
  57344. model$1
  57345. ];
  57346. /* */
  57347. function text (el, dir) {
  57348. if (dir.value) {
  57349. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  57350. }
  57351. }
  57352. /* */
  57353. function html (el, dir) {
  57354. if (dir.value) {
  57355. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  57356. }
  57357. }
  57358. var directives$1 = {
  57359. model: model,
  57360. text: text,
  57361. html: html
  57362. };
  57363. /* */
  57364. var baseOptions = {
  57365. expectHTML: true,
  57366. modules: modules$1,
  57367. directives: directives$1,
  57368. isPreTag: isPreTag,
  57369. isUnaryTag: isUnaryTag,
  57370. mustUseProp: mustUseProp,
  57371. canBeLeftOpenTag: canBeLeftOpenTag,
  57372. isReservedTag: isReservedTag,
  57373. getTagNamespace: getTagNamespace,
  57374. staticKeys: genStaticKeys(modules$1)
  57375. };
  57376. /* */
  57377. var isStaticKey;
  57378. var isPlatformReservedTag;
  57379. var genStaticKeysCached = cached(genStaticKeys$1);
  57380. /**
  57381. * Goal of the optimizer: walk the generated template AST tree
  57382. * and detect sub-trees that are purely static, i.e. parts of
  57383. * the DOM that never needs to change.
  57384. *
  57385. * Once we detect these sub-trees, we can:
  57386. *
  57387. * 1. Hoist them into constants, so that we no longer need to
  57388. * create fresh nodes for them on each re-render;
  57389. * 2. Completely skip them in the patching process.
  57390. */
  57391. function optimize (root, options) {
  57392. if (!root) { return }
  57393. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  57394. isPlatformReservedTag = options.isReservedTag || no;
  57395. // first pass: mark all non-static nodes.
  57396. markStatic$1(root);
  57397. // second pass: mark static roots.
  57398. markStaticRoots(root, false);
  57399. }
  57400. function genStaticKeys$1 (keys) {
  57401. return makeMap(
  57402. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  57403. (keys ? ',' + keys : '')
  57404. )
  57405. }
  57406. function markStatic$1 (node) {
  57407. node.static = isStatic(node);
  57408. if (node.type === 1) {
  57409. // do not make component slot content static. this avoids
  57410. // 1. components not able to mutate slot nodes
  57411. // 2. static slot content fails for hot-reloading
  57412. if (
  57413. !isPlatformReservedTag(node.tag) &&
  57414. node.tag !== 'slot' &&
  57415. node.attrsMap['inline-template'] == null
  57416. ) {
  57417. return
  57418. }
  57419. for (var i = 0, l = node.children.length; i < l; i++) {
  57420. var child = node.children[i];
  57421. markStatic$1(child);
  57422. if (!child.static) {
  57423. node.static = false;
  57424. }
  57425. }
  57426. if (node.ifConditions) {
  57427. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  57428. var block = node.ifConditions[i$1].block;
  57429. markStatic$1(block);
  57430. if (!block.static) {
  57431. node.static = false;
  57432. }
  57433. }
  57434. }
  57435. }
  57436. }
  57437. function markStaticRoots (node, isInFor) {
  57438. if (node.type === 1) {
  57439. if (node.static || node.once) {
  57440. node.staticInFor = isInFor;
  57441. }
  57442. // For a node to qualify as a static root, it should have children that
  57443. // are not just static text. Otherwise the cost of hoisting out will
  57444. // outweigh the benefits and it's better off to just always render it fresh.
  57445. if (node.static && node.children.length && !(
  57446. node.children.length === 1 &&
  57447. node.children[0].type === 3
  57448. )) {
  57449. node.staticRoot = true;
  57450. return
  57451. } else {
  57452. node.staticRoot = false;
  57453. }
  57454. if (node.children) {
  57455. for (var i = 0, l = node.children.length; i < l; i++) {
  57456. markStaticRoots(node.children[i], isInFor || !!node.for);
  57457. }
  57458. }
  57459. if (node.ifConditions) {
  57460. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  57461. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  57462. }
  57463. }
  57464. }
  57465. }
  57466. function isStatic (node) {
  57467. if (node.type === 2) { // expression
  57468. return false
  57469. }
  57470. if (node.type === 3) { // text
  57471. return true
  57472. }
  57473. return !!(node.pre || (
  57474. !node.hasBindings && // no dynamic bindings
  57475. !node.if && !node.for && // not v-if or v-for or v-else
  57476. !isBuiltInTag(node.tag) && // not a built-in
  57477. isPlatformReservedTag(node.tag) && // not a component
  57478. !isDirectChildOfTemplateFor(node) &&
  57479. Object.keys(node).every(isStaticKey)
  57480. ))
  57481. }
  57482. function isDirectChildOfTemplateFor (node) {
  57483. while (node.parent) {
  57484. node = node.parent;
  57485. if (node.tag !== 'template') {
  57486. return false
  57487. }
  57488. if (node.for) {
  57489. return true
  57490. }
  57491. }
  57492. return false
  57493. }
  57494. /* */
  57495. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  57496. var fnInvokeRE = /\([^)]*?\);*$/;
  57497. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  57498. // KeyboardEvent.keyCode aliases
  57499. var keyCodes = {
  57500. esc: 27,
  57501. tab: 9,
  57502. enter: 13,
  57503. space: 32,
  57504. up: 38,
  57505. left: 37,
  57506. right: 39,
  57507. down: 40,
  57508. 'delete': [8, 46]
  57509. };
  57510. // KeyboardEvent.key aliases
  57511. var keyNames = {
  57512. // #7880: IE11 and Edge use `Esc` for Escape key name.
  57513. esc: ['Esc', 'Escape'],
  57514. tab: 'Tab',
  57515. enter: 'Enter',
  57516. // #9112: IE11 uses `Spacebar` for Space key name.
  57517. space: [' ', 'Spacebar'],
  57518. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  57519. up: ['Up', 'ArrowUp'],
  57520. left: ['Left', 'ArrowLeft'],
  57521. right: ['Right', 'ArrowRight'],
  57522. down: ['Down', 'ArrowDown'],
  57523. // #9112: IE11 uses `Del` for Delete key name.
  57524. 'delete': ['Backspace', 'Delete', 'Del']
  57525. };
  57526. // #4868: modifiers that prevent the execution of the listener
  57527. // need to explicitly return null so that we can determine whether to remove
  57528. // the listener for .once
  57529. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  57530. var modifierCode = {
  57531. stop: '$event.stopPropagation();',
  57532. prevent: '$event.preventDefault();',
  57533. self: genGuard("$event.target !== $event.currentTarget"),
  57534. ctrl: genGuard("!$event.ctrlKey"),
  57535. shift: genGuard("!$event.shiftKey"),
  57536. alt: genGuard("!$event.altKey"),
  57537. meta: genGuard("!$event.metaKey"),
  57538. left: genGuard("'button' in $event && $event.button !== 0"),
  57539. middle: genGuard("'button' in $event && $event.button !== 1"),
  57540. right: genGuard("'button' in $event && $event.button !== 2")
  57541. };
  57542. function genHandlers (
  57543. events,
  57544. isNative
  57545. ) {
  57546. var prefix = isNative ? 'nativeOn:' : 'on:';
  57547. var staticHandlers = "";
  57548. var dynamicHandlers = "";
  57549. for (var name in events) {
  57550. var handlerCode = genHandler(events[name]);
  57551. if (events[name] && events[name].dynamic) {
  57552. dynamicHandlers += name + "," + handlerCode + ",";
  57553. } else {
  57554. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  57555. }
  57556. }
  57557. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  57558. if (dynamicHandlers) {
  57559. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  57560. } else {
  57561. return prefix + staticHandlers
  57562. }
  57563. }
  57564. function genHandler (handler) {
  57565. if (!handler) {
  57566. return 'function(){}'
  57567. }
  57568. if (Array.isArray(handler)) {
  57569. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  57570. }
  57571. var isMethodPath = simplePathRE.test(handler.value);
  57572. var isFunctionExpression = fnExpRE.test(handler.value);
  57573. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  57574. if (!handler.modifiers) {
  57575. if (isMethodPath || isFunctionExpression) {
  57576. return handler.value
  57577. }
  57578. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  57579. } else {
  57580. var code = '';
  57581. var genModifierCode = '';
  57582. var keys = [];
  57583. for (var key in handler.modifiers) {
  57584. if (modifierCode[key]) {
  57585. genModifierCode += modifierCode[key];
  57586. // left/right
  57587. if (keyCodes[key]) {
  57588. keys.push(key);
  57589. }
  57590. } else if (key === 'exact') {
  57591. var modifiers = (handler.modifiers);
  57592. genModifierCode += genGuard(
  57593. ['ctrl', 'shift', 'alt', 'meta']
  57594. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  57595. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  57596. .join('||')
  57597. );
  57598. } else {
  57599. keys.push(key);
  57600. }
  57601. }
  57602. if (keys.length) {
  57603. code += genKeyFilter(keys);
  57604. }
  57605. // Make sure modifiers like prevent and stop get executed after key filtering
  57606. if (genModifierCode) {
  57607. code += genModifierCode;
  57608. }
  57609. var handlerCode = isMethodPath
  57610. ? ("return " + (handler.value) + "($event)")
  57611. : isFunctionExpression
  57612. ? ("return (" + (handler.value) + ")($event)")
  57613. : isFunctionInvocation
  57614. ? ("return " + (handler.value))
  57615. : handler.value;
  57616. return ("function($event){" + code + handlerCode + "}")
  57617. }
  57618. }
  57619. function genKeyFilter (keys) {
  57620. return (
  57621. // make sure the key filters only apply to KeyboardEvents
  57622. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  57623. // key events that do not have keyCode property...
  57624. "if(!$event.type.indexOf('key')&&" +
  57625. (keys.map(genFilterCode).join('&&')) + ")return null;"
  57626. )
  57627. }
  57628. function genFilterCode (key) {
  57629. var keyVal = parseInt(key, 10);
  57630. if (keyVal) {
  57631. return ("$event.keyCode!==" + keyVal)
  57632. }
  57633. var keyCode = keyCodes[key];
  57634. var keyName = keyNames[key];
  57635. return (
  57636. "_k($event.keyCode," +
  57637. (JSON.stringify(key)) + "," +
  57638. (JSON.stringify(keyCode)) + "," +
  57639. "$event.key," +
  57640. "" + (JSON.stringify(keyName)) +
  57641. ")"
  57642. )
  57643. }
  57644. /* */
  57645. function on (el, dir) {
  57646. if (dir.modifiers) {
  57647. warn("v-on without argument does not support modifiers.");
  57648. }
  57649. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  57650. }
  57651. /* */
  57652. function bind$1 (el, dir) {
  57653. el.wrapData = function (code) {
  57654. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  57655. };
  57656. }
  57657. /* */
  57658. var baseDirectives = {
  57659. on: on,
  57660. bind: bind$1,
  57661. cloak: noop
  57662. };
  57663. /* */
  57664. var CodegenState = function CodegenState (options) {
  57665. this.options = options;
  57666. this.warn = options.warn || baseWarn;
  57667. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  57668. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  57669. this.directives = extend(extend({}, baseDirectives), options.directives);
  57670. var isReservedTag = options.isReservedTag || no;
  57671. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57672. this.onceId = 0;
  57673. this.staticRenderFns = [];
  57674. this.pre = false;
  57675. };
  57676. function generate (
  57677. ast,
  57678. options
  57679. ) {
  57680. var state = new CodegenState(options);
  57681. var code = ast ? genElement(ast, state) : '_c("div")';
  57682. return {
  57683. render: ("with(this){return " + code + "}"),
  57684. staticRenderFns: state.staticRenderFns
  57685. }
  57686. }
  57687. function genElement (el, state) {
  57688. if (el.parent) {
  57689. el.pre = el.pre || el.parent.pre;
  57690. }
  57691. if (el.staticRoot && !el.staticProcessed) {
  57692. return genStatic(el, state)
  57693. } else if (el.once && !el.onceProcessed) {
  57694. return genOnce(el, state)
  57695. } else if (el.for && !el.forProcessed) {
  57696. return genFor(el, state)
  57697. } else if (el.if && !el.ifProcessed) {
  57698. return genIf(el, state)
  57699. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  57700. return genChildren(el, state) || 'void 0'
  57701. } else if (el.tag === 'slot') {
  57702. return genSlot(el, state)
  57703. } else {
  57704. // component or element
  57705. var code;
  57706. if (el.component) {
  57707. code = genComponent(el.component, el, state);
  57708. } else {
  57709. var data;
  57710. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  57711. data = genData$2(el, state);
  57712. }
  57713. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  57714. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  57715. }
  57716. // module transforms
  57717. for (var i = 0; i < state.transforms.length; i++) {
  57718. code = state.transforms[i](el, code);
  57719. }
  57720. return code
  57721. }
  57722. }
  57723. // hoist static sub-trees out
  57724. function genStatic (el, state) {
  57725. el.staticProcessed = true;
  57726. // Some elements (templates) need to behave differently inside of a v-pre
  57727. // node. All pre nodes are static roots, so we can use this as a location to
  57728. // wrap a state change and reset it upon exiting the pre node.
  57729. var originalPreState = state.pre;
  57730. if (el.pre) {
  57731. state.pre = el.pre;
  57732. }
  57733. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  57734. state.pre = originalPreState;
  57735. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  57736. }
  57737. // v-once
  57738. function genOnce (el, state) {
  57739. el.onceProcessed = true;
  57740. if (el.if && !el.ifProcessed) {
  57741. return genIf(el, state)
  57742. } else if (el.staticInFor) {
  57743. var key = '';
  57744. var parent = el.parent;
  57745. while (parent) {
  57746. if (parent.for) {
  57747. key = parent.key;
  57748. break
  57749. }
  57750. parent = parent.parent;
  57751. }
  57752. if (!key) {
  57753. state.warn(
  57754. "v-once can only be used inside v-for that is keyed. ",
  57755. el.rawAttrsMap['v-once']
  57756. );
  57757. return genElement(el, state)
  57758. }
  57759. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  57760. } else {
  57761. return genStatic(el, state)
  57762. }
  57763. }
  57764. function genIf (
  57765. el,
  57766. state,
  57767. altGen,
  57768. altEmpty
  57769. ) {
  57770. el.ifProcessed = true; // avoid recursion
  57771. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  57772. }
  57773. function genIfConditions (
  57774. conditions,
  57775. state,
  57776. altGen,
  57777. altEmpty
  57778. ) {
  57779. if (!conditions.length) {
  57780. return altEmpty || '_e()'
  57781. }
  57782. var condition = conditions.shift();
  57783. if (condition.exp) {
  57784. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  57785. } else {
  57786. return ("" + (genTernaryExp(condition.block)))
  57787. }
  57788. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  57789. function genTernaryExp (el) {
  57790. return altGen
  57791. ? altGen(el, state)
  57792. : el.once
  57793. ? genOnce(el, state)
  57794. : genElement(el, state)
  57795. }
  57796. }
  57797. function genFor (
  57798. el,
  57799. state,
  57800. altGen,
  57801. altHelper
  57802. ) {
  57803. var exp = el.for;
  57804. var alias = el.alias;
  57805. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  57806. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  57807. if (state.maybeComponent(el) &&
  57808. el.tag !== 'slot' &&
  57809. el.tag !== 'template' &&
  57810. !el.key
  57811. ) {
  57812. state.warn(
  57813. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  57814. "v-for should have explicit keys. " +
  57815. "See https://vuejs.org/guide/list.html#key for more info.",
  57816. el.rawAttrsMap['v-for'],
  57817. true /* tip */
  57818. );
  57819. }
  57820. el.forProcessed = true; // avoid recursion
  57821. return (altHelper || '_l') + "((" + exp + ")," +
  57822. "function(" + alias + iterator1 + iterator2 + "){" +
  57823. "return " + ((altGen || genElement)(el, state)) +
  57824. '})'
  57825. }
  57826. function genData$2 (el, state) {
  57827. var data = '{';
  57828. // directives first.
  57829. // directives may mutate the el's other properties before they are generated.
  57830. var dirs = genDirectives(el, state);
  57831. if (dirs) { data += dirs + ','; }
  57832. // key
  57833. if (el.key) {
  57834. data += "key:" + (el.key) + ",";
  57835. }
  57836. // ref
  57837. if (el.ref) {
  57838. data += "ref:" + (el.ref) + ",";
  57839. }
  57840. if (el.refInFor) {
  57841. data += "refInFor:true,";
  57842. }
  57843. // pre
  57844. if (el.pre) {
  57845. data += "pre:true,";
  57846. }
  57847. // record original tag name for components using "is" attribute
  57848. if (el.component) {
  57849. data += "tag:\"" + (el.tag) + "\",";
  57850. }
  57851. // module data generation functions
  57852. for (var i = 0; i < state.dataGenFns.length; i++) {
  57853. data += state.dataGenFns[i](el);
  57854. }
  57855. // attributes
  57856. if (el.attrs) {
  57857. data += "attrs:" + (genProps(el.attrs)) + ",";
  57858. }
  57859. // DOM props
  57860. if (el.props) {
  57861. data += "domProps:" + (genProps(el.props)) + ",";
  57862. }
  57863. // event handlers
  57864. if (el.events) {
  57865. data += (genHandlers(el.events, false)) + ",";
  57866. }
  57867. if (el.nativeEvents) {
  57868. data += (genHandlers(el.nativeEvents, true)) + ",";
  57869. }
  57870. // slot target
  57871. // only for non-scoped slots
  57872. if (el.slotTarget && !el.slotScope) {
  57873. data += "slot:" + (el.slotTarget) + ",";
  57874. }
  57875. // scoped slots
  57876. if (el.scopedSlots) {
  57877. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  57878. }
  57879. // component v-model
  57880. if (el.model) {
  57881. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  57882. }
  57883. // inline-template
  57884. if (el.inlineTemplate) {
  57885. var inlineTemplate = genInlineTemplate(el, state);
  57886. if (inlineTemplate) {
  57887. data += inlineTemplate + ",";
  57888. }
  57889. }
  57890. data = data.replace(/,$/, '') + '}';
  57891. // v-bind dynamic argument wrap
  57892. // v-bind with dynamic arguments must be applied using the same v-bind object
  57893. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  57894. if (el.dynamicAttrs) {
  57895. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  57896. }
  57897. // v-bind data wrap
  57898. if (el.wrapData) {
  57899. data = el.wrapData(data);
  57900. }
  57901. // v-on data wrap
  57902. if (el.wrapListeners) {
  57903. data = el.wrapListeners(data);
  57904. }
  57905. return data
  57906. }
  57907. function genDirectives (el, state) {
  57908. var dirs = el.directives;
  57909. if (!dirs) { return }
  57910. var res = 'directives:[';
  57911. var hasRuntime = false;
  57912. var i, l, dir, needRuntime;
  57913. for (i = 0, l = dirs.length; i < l; i++) {
  57914. dir = dirs[i];
  57915. needRuntime = true;
  57916. var gen = state.directives[dir.name];
  57917. if (gen) {
  57918. // compile-time directive that manipulates AST.
  57919. // returns true if it also needs a runtime counterpart.
  57920. needRuntime = !!gen(el, dir, state.warn);
  57921. }
  57922. if (needRuntime) {
  57923. hasRuntime = true;
  57924. 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))) : '') + "},";
  57925. }
  57926. }
  57927. if (hasRuntime) {
  57928. return res.slice(0, -1) + ']'
  57929. }
  57930. }
  57931. function genInlineTemplate (el, state) {
  57932. var ast = el.children[0];
  57933. if (el.children.length !== 1 || ast.type !== 1) {
  57934. state.warn(
  57935. 'Inline-template components must have exactly one child element.',
  57936. { start: el.start }
  57937. );
  57938. }
  57939. if (ast && ast.type === 1) {
  57940. var inlineRenderFns = generate(ast, state.options);
  57941. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  57942. }
  57943. }
  57944. function genScopedSlots (
  57945. el,
  57946. slots,
  57947. state
  57948. ) {
  57949. // by default scoped slots are considered "stable", this allows child
  57950. // components with only scoped slots to skip forced updates from parent.
  57951. // but in some cases we have to bail-out of this optimization
  57952. // for example if the slot contains dynamic names, has v-if or v-for on them...
  57953. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  57954. var slot = slots[key];
  57955. return (
  57956. slot.slotTargetDynamic ||
  57957. slot.if ||
  57958. slot.for ||
  57959. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  57960. )
  57961. });
  57962. // #9534: if a component with scoped slots is inside a conditional branch,
  57963. // it's possible for the same component to be reused but with different
  57964. // compiled slot content. To avoid that, we generate a unique key based on
  57965. // the generated code of all the slot contents.
  57966. var needsKey = !!el.if;
  57967. // OR when it is inside another scoped slot or v-for (the reactivity may be
  57968. // disconnected due to the intermediate scope variable)
  57969. // #9438, #9506
  57970. // TODO: this can be further optimized by properly analyzing in-scope bindings
  57971. // and skip force updating ones that do not actually use scope variables.
  57972. if (!needsForceUpdate) {
  57973. var parent = el.parent;
  57974. while (parent) {
  57975. if (
  57976. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  57977. parent.for
  57978. ) {
  57979. needsForceUpdate = true;
  57980. break
  57981. }
  57982. if (parent.if) {
  57983. needsKey = true;
  57984. }
  57985. parent = parent.parent;
  57986. }
  57987. }
  57988. var generatedSlots = Object.keys(slots)
  57989. .map(function (key) { return genScopedSlot(slots[key], state); })
  57990. .join(',');
  57991. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  57992. }
  57993. function hash(str) {
  57994. var hash = 5381;
  57995. var i = str.length;
  57996. while(i) {
  57997. hash = (hash * 33) ^ str.charCodeAt(--i);
  57998. }
  57999. return hash >>> 0
  58000. }
  58001. function containsSlotChild (el) {
  58002. if (el.type === 1) {
  58003. if (el.tag === 'slot') {
  58004. return true
  58005. }
  58006. return el.children.some(containsSlotChild)
  58007. }
  58008. return false
  58009. }
  58010. function genScopedSlot (
  58011. el,
  58012. state
  58013. ) {
  58014. var isLegacySyntax = el.attrsMap['slot-scope'];
  58015. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  58016. return genIf(el, state, genScopedSlot, "null")
  58017. }
  58018. if (el.for && !el.forProcessed) {
  58019. return genFor(el, state, genScopedSlot)
  58020. }
  58021. var slotScope = el.slotScope === emptySlotScopeToken
  58022. ? ""
  58023. : String(el.slotScope);
  58024. var fn = "function(" + slotScope + "){" +
  58025. "return " + (el.tag === 'template'
  58026. ? el.if && isLegacySyntax
  58027. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  58028. : genChildren(el, state) || 'undefined'
  58029. : genElement(el, state)) + "}";
  58030. // reverse proxy v-slot without scope on this.$slots
  58031. var reverseProxy = slotScope ? "" : ",proxy:true";
  58032. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  58033. }
  58034. function genChildren (
  58035. el,
  58036. state,
  58037. checkSkip,
  58038. altGenElement,
  58039. altGenNode
  58040. ) {
  58041. var children = el.children;
  58042. if (children.length) {
  58043. var el$1 = children[0];
  58044. // optimize single v-for
  58045. if (children.length === 1 &&
  58046. el$1.for &&
  58047. el$1.tag !== 'template' &&
  58048. el$1.tag !== 'slot'
  58049. ) {
  58050. var normalizationType = checkSkip
  58051. ? state.maybeComponent(el$1) ? ",1" : ",0"
  58052. : "";
  58053. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  58054. }
  58055. var normalizationType$1 = checkSkip
  58056. ? getNormalizationType(children, state.maybeComponent)
  58057. : 0;
  58058. var gen = altGenNode || genNode;
  58059. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  58060. }
  58061. }
  58062. // determine the normalization needed for the children array.
  58063. // 0: no normalization needed
  58064. // 1: simple normalization needed (possible 1-level deep nested array)
  58065. // 2: full normalization needed
  58066. function getNormalizationType (
  58067. children,
  58068. maybeComponent
  58069. ) {
  58070. var res = 0;
  58071. for (var i = 0; i < children.length; i++) {
  58072. var el = children[i];
  58073. if (el.type !== 1) {
  58074. continue
  58075. }
  58076. if (needsNormalization(el) ||
  58077. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  58078. res = 2;
  58079. break
  58080. }
  58081. if (maybeComponent(el) ||
  58082. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  58083. res = 1;
  58084. }
  58085. }
  58086. return res
  58087. }
  58088. function needsNormalization (el) {
  58089. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  58090. }
  58091. function genNode (node, state) {
  58092. if (node.type === 1) {
  58093. return genElement(node, state)
  58094. } else if (node.type === 3 && node.isComment) {
  58095. return genComment(node)
  58096. } else {
  58097. return genText(node)
  58098. }
  58099. }
  58100. function genText (text) {
  58101. return ("_v(" + (text.type === 2
  58102. ? text.expression // no need for () because already wrapped in _s()
  58103. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  58104. }
  58105. function genComment (comment) {
  58106. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  58107. }
  58108. function genSlot (el, state) {
  58109. var slotName = el.slotName || '"default"';
  58110. var children = genChildren(el, state);
  58111. var res = "_t(" + slotName + (children ? ("," + children) : '');
  58112. var attrs = el.attrs || el.dynamicAttrs
  58113. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  58114. // slot props are camelized
  58115. name: camelize(attr.name),
  58116. value: attr.value,
  58117. dynamic: attr.dynamic
  58118. }); }))
  58119. : null;
  58120. var bind$$1 = el.attrsMap['v-bind'];
  58121. if ((attrs || bind$$1) && !children) {
  58122. res += ",null";
  58123. }
  58124. if (attrs) {
  58125. res += "," + attrs;
  58126. }
  58127. if (bind$$1) {
  58128. res += (attrs ? '' : ',null') + "," + bind$$1;
  58129. }
  58130. return res + ')'
  58131. }
  58132. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  58133. function genComponent (
  58134. componentName,
  58135. el,
  58136. state
  58137. ) {
  58138. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  58139. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  58140. }
  58141. function genProps (props) {
  58142. var staticProps = "";
  58143. var dynamicProps = "";
  58144. for (var i = 0; i < props.length; i++) {
  58145. var prop = props[i];
  58146. var value = transformSpecialNewlines(prop.value);
  58147. if (prop.dynamic) {
  58148. dynamicProps += (prop.name) + "," + value + ",";
  58149. } else {
  58150. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  58151. }
  58152. }
  58153. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  58154. if (dynamicProps) {
  58155. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  58156. } else {
  58157. return staticProps
  58158. }
  58159. }
  58160. // #3895, #4268
  58161. function transformSpecialNewlines (text) {
  58162. return text
  58163. .replace(/\u2028/g, '\\u2028')
  58164. .replace(/\u2029/g, '\\u2029')
  58165. }
  58166. /* */
  58167. // these keywords should not appear inside expressions, but operators like
  58168. // typeof, instanceof and in are allowed
  58169. var prohibitedKeywordRE = new RegExp('\\b' + (
  58170. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  58171. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  58172. 'extends,finally,continue,debugger,function,arguments'
  58173. ).split(',').join('\\b|\\b') + '\\b');
  58174. // these unary operators should not be used as property/method names
  58175. var unaryOperatorsRE = new RegExp('\\b' + (
  58176. 'delete,typeof,void'
  58177. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  58178. // strip strings in expressions
  58179. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  58180. // detect problematic expressions in a template
  58181. function detectErrors (ast, warn) {
  58182. if (ast) {
  58183. checkNode(ast, warn);
  58184. }
  58185. }
  58186. function checkNode (node, warn) {
  58187. if (node.type === 1) {
  58188. for (var name in node.attrsMap) {
  58189. if (dirRE.test(name)) {
  58190. var value = node.attrsMap[name];
  58191. if (value) {
  58192. var range = node.rawAttrsMap[name];
  58193. if (name === 'v-for') {
  58194. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  58195. } else if (name === 'v-slot' || name[0] === '#') {
  58196. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  58197. } else if (onRE.test(name)) {
  58198. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  58199. } else {
  58200. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  58201. }
  58202. }
  58203. }
  58204. }
  58205. if (node.children) {
  58206. for (var i = 0; i < node.children.length; i++) {
  58207. checkNode(node.children[i], warn);
  58208. }
  58209. }
  58210. } else if (node.type === 2) {
  58211. checkExpression(node.expression, node.text, warn, node);
  58212. }
  58213. }
  58214. function checkEvent (exp, text, warn, range) {
  58215. var stripped = exp.replace(stripStringRE, '');
  58216. var keywordMatch = stripped.match(unaryOperatorsRE);
  58217. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  58218. warn(
  58219. "avoid using JavaScript unary operator as property name: " +
  58220. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  58221. range
  58222. );
  58223. }
  58224. checkExpression(exp, text, warn, range);
  58225. }
  58226. function checkFor (node, text, warn, range) {
  58227. checkExpression(node.for || '', text, warn, range);
  58228. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  58229. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  58230. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  58231. }
  58232. function checkIdentifier (
  58233. ident,
  58234. type,
  58235. text,
  58236. warn,
  58237. range
  58238. ) {
  58239. if (typeof ident === 'string') {
  58240. try {
  58241. new Function(("var " + ident + "=_"));
  58242. } catch (e) {
  58243. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  58244. }
  58245. }
  58246. }
  58247. function checkExpression (exp, text, warn, range) {
  58248. try {
  58249. new Function(("return " + exp));
  58250. } catch (e) {
  58251. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  58252. if (keywordMatch) {
  58253. warn(
  58254. "avoid using JavaScript keyword as property name: " +
  58255. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  58256. range
  58257. );
  58258. } else {
  58259. warn(
  58260. "invalid expression: " + (e.message) + " in\n\n" +
  58261. " " + exp + "\n\n" +
  58262. " Raw expression: " + (text.trim()) + "\n",
  58263. range
  58264. );
  58265. }
  58266. }
  58267. }
  58268. function checkFunctionParameterExpression (exp, text, warn, range) {
  58269. try {
  58270. new Function(exp, '');
  58271. } catch (e) {
  58272. warn(
  58273. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  58274. " " + exp + "\n\n" +
  58275. " Raw expression: " + (text.trim()) + "\n",
  58276. range
  58277. );
  58278. }
  58279. }
  58280. /* */
  58281. var range = 2;
  58282. function generateCodeFrame (
  58283. source,
  58284. start,
  58285. end
  58286. ) {
  58287. if ( start === void 0 ) start = 0;
  58288. if ( end === void 0 ) end = source.length;
  58289. var lines = source.split(/\r?\n/);
  58290. var count = 0;
  58291. var res = [];
  58292. for (var i = 0; i < lines.length; i++) {
  58293. count += lines[i].length + 1;
  58294. if (count >= start) {
  58295. for (var j = i - range; j <= i + range || end > count; j++) {
  58296. if (j < 0 || j >= lines.length) { continue }
  58297. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  58298. var lineLength = lines[j].length;
  58299. if (j === i) {
  58300. // push underline
  58301. var pad = start - (count - lineLength) + 1;
  58302. var length = end > count ? lineLength - pad : end - start;
  58303. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  58304. } else if (j > i) {
  58305. if (end > count) {
  58306. var length$1 = Math.min(end - count, lineLength);
  58307. res.push(" | " + repeat$1("^", length$1));
  58308. }
  58309. count += lineLength + 1;
  58310. }
  58311. }
  58312. break
  58313. }
  58314. }
  58315. return res.join('\n')
  58316. }
  58317. function repeat$1 (str, n) {
  58318. var result = '';
  58319. if (n > 0) {
  58320. while (true) { // eslint-disable-line
  58321. if (n & 1) { result += str; }
  58322. n >>>= 1;
  58323. if (n <= 0) { break }
  58324. str += str;
  58325. }
  58326. }
  58327. return result
  58328. }
  58329. /* */
  58330. function createFunction (code, errors) {
  58331. try {
  58332. return new Function(code)
  58333. } catch (err) {
  58334. errors.push({ err: err, code: code });
  58335. return noop
  58336. }
  58337. }
  58338. function createCompileToFunctionFn (compile) {
  58339. var cache = Object.create(null);
  58340. return function compileToFunctions (
  58341. template,
  58342. options,
  58343. vm
  58344. ) {
  58345. options = extend({}, options);
  58346. var warn$$1 = options.warn || warn;
  58347. delete options.warn;
  58348. /* istanbul ignore if */
  58349. {
  58350. // detect possible CSP restriction
  58351. try {
  58352. new Function('return 1');
  58353. } catch (e) {
  58354. if (e.toString().match(/unsafe-eval|CSP/)) {
  58355. warn$$1(
  58356. 'It seems you are using the standalone build of Vue.js in an ' +
  58357. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  58358. 'The template compiler cannot work in this environment. Consider ' +
  58359. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  58360. 'templates into render functions.'
  58361. );
  58362. }
  58363. }
  58364. }
  58365. // check cache
  58366. var key = options.delimiters
  58367. ? String(options.delimiters) + template
  58368. : template;
  58369. if (cache[key]) {
  58370. return cache[key]
  58371. }
  58372. // compile
  58373. var compiled = compile(template, options);
  58374. // check compilation errors/tips
  58375. {
  58376. if (compiled.errors && compiled.errors.length) {
  58377. if (options.outputSourceRange) {
  58378. compiled.errors.forEach(function (e) {
  58379. warn$$1(
  58380. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  58381. generateCodeFrame(template, e.start, e.end),
  58382. vm
  58383. );
  58384. });
  58385. } else {
  58386. warn$$1(
  58387. "Error compiling template:\n\n" + template + "\n\n" +
  58388. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  58389. vm
  58390. );
  58391. }
  58392. }
  58393. if (compiled.tips && compiled.tips.length) {
  58394. if (options.outputSourceRange) {
  58395. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  58396. } else {
  58397. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  58398. }
  58399. }
  58400. }
  58401. // turn code into functions
  58402. var res = {};
  58403. var fnGenErrors = [];
  58404. res.render = createFunction(compiled.render, fnGenErrors);
  58405. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  58406. return createFunction(code, fnGenErrors)
  58407. });
  58408. // check function generation errors.
  58409. // this should only happen if there is a bug in the compiler itself.
  58410. // mostly for codegen development use
  58411. /* istanbul ignore if */
  58412. {
  58413. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  58414. warn$$1(
  58415. "Failed to generate render function:\n\n" +
  58416. fnGenErrors.map(function (ref) {
  58417. var err = ref.err;
  58418. var code = ref.code;
  58419. return ((err.toString()) + " in\n\n" + code + "\n");
  58420. }).join('\n'),
  58421. vm
  58422. );
  58423. }
  58424. }
  58425. return (cache[key] = res)
  58426. }
  58427. }
  58428. /* */
  58429. function createCompilerCreator (baseCompile) {
  58430. return function createCompiler (baseOptions) {
  58431. function compile (
  58432. template,
  58433. options
  58434. ) {
  58435. var finalOptions = Object.create(baseOptions);
  58436. var errors = [];
  58437. var tips = [];
  58438. var warn = function (msg, range, tip) {
  58439. (tip ? tips : errors).push(msg);
  58440. };
  58441. if (options) {
  58442. if (options.outputSourceRange) {
  58443. // $flow-disable-line
  58444. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  58445. warn = function (msg, range, tip) {
  58446. var data = { msg: msg };
  58447. if (range) {
  58448. if (range.start != null) {
  58449. data.start = range.start + leadingSpaceLength;
  58450. }
  58451. if (range.end != null) {
  58452. data.end = range.end + leadingSpaceLength;
  58453. }
  58454. }
  58455. (tip ? tips : errors).push(data);
  58456. };
  58457. }
  58458. // merge custom modules
  58459. if (options.modules) {
  58460. finalOptions.modules =
  58461. (baseOptions.modules || []).concat(options.modules);
  58462. }
  58463. // merge custom directives
  58464. if (options.directives) {
  58465. finalOptions.directives = extend(
  58466. Object.create(baseOptions.directives || null),
  58467. options.directives
  58468. );
  58469. }
  58470. // copy other options
  58471. for (var key in options) {
  58472. if (key !== 'modules' && key !== 'directives') {
  58473. finalOptions[key] = options[key];
  58474. }
  58475. }
  58476. }
  58477. finalOptions.warn = warn;
  58478. var compiled = baseCompile(template.trim(), finalOptions);
  58479. {
  58480. detectErrors(compiled.ast, warn);
  58481. }
  58482. compiled.errors = errors;
  58483. compiled.tips = tips;
  58484. return compiled
  58485. }
  58486. return {
  58487. compile: compile,
  58488. compileToFunctions: createCompileToFunctionFn(compile)
  58489. }
  58490. }
  58491. }
  58492. /* */
  58493. // `createCompilerCreator` allows creating compilers that use alternative
  58494. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  58495. // Here we just export a default compiler using the default parts.
  58496. var createCompiler = createCompilerCreator(function baseCompile (
  58497. template,
  58498. options
  58499. ) {
  58500. var ast = parse(template.trim(), options);
  58501. if (options.optimize !== false) {
  58502. optimize(ast, options);
  58503. }
  58504. var code = generate(ast, options);
  58505. return {
  58506. ast: ast,
  58507. render: code.render,
  58508. staticRenderFns: code.staticRenderFns
  58509. }
  58510. });
  58511. /* */
  58512. var ref$1 = createCompiler(baseOptions);
  58513. var compile = ref$1.compile;
  58514. var compileToFunctions = ref$1.compileToFunctions;
  58515. /* */
  58516. // check whether current browser encodes a char inside attribute values
  58517. var div;
  58518. function getShouldDecode (href) {
  58519. div = div || document.createElement('div');
  58520. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  58521. return div.innerHTML.indexOf('&#10;') > 0
  58522. }
  58523. // #3663: IE encodes newlines inside attribute values while other browsers don't
  58524. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  58525. // #6828: chrome encodes content in a[href]
  58526. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  58527. /* */
  58528. var idToTemplate = cached(function (id) {
  58529. var el = query(id);
  58530. return el && el.innerHTML
  58531. });
  58532. var mount = Vue.prototype.$mount;
  58533. Vue.prototype.$mount = function (
  58534. el,
  58535. hydrating
  58536. ) {
  58537. el = el && query(el);
  58538. /* istanbul ignore if */
  58539. if (el === document.body || el === document.documentElement) {
  58540. warn(
  58541. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  58542. );
  58543. return this
  58544. }
  58545. var options = this.$options;
  58546. // resolve template/el and convert to render function
  58547. if (!options.render) {
  58548. var template = options.template;
  58549. if (template) {
  58550. if (typeof template === 'string') {
  58551. if (template.charAt(0) === '#') {
  58552. template = idToTemplate(template);
  58553. /* istanbul ignore if */
  58554. if (!template) {
  58555. warn(
  58556. ("Template element not found or is empty: " + (options.template)),
  58557. this
  58558. );
  58559. }
  58560. }
  58561. } else if (template.nodeType) {
  58562. template = template.innerHTML;
  58563. } else {
  58564. {
  58565. warn('invalid template option:' + template, this);
  58566. }
  58567. return this
  58568. }
  58569. } else if (el) {
  58570. template = getOuterHTML(el);
  58571. }
  58572. if (template) {
  58573. /* istanbul ignore if */
  58574. if (config.performance && mark) {
  58575. mark('compile');
  58576. }
  58577. var ref = compileToFunctions(template, {
  58578. outputSourceRange: "development" !== 'production',
  58579. shouldDecodeNewlines: shouldDecodeNewlines,
  58580. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  58581. delimiters: options.delimiters,
  58582. comments: options.comments
  58583. }, this);
  58584. var render = ref.render;
  58585. var staticRenderFns = ref.staticRenderFns;
  58586. options.render = render;
  58587. options.staticRenderFns = staticRenderFns;
  58588. /* istanbul ignore if */
  58589. if (config.performance && mark) {
  58590. mark('compile end');
  58591. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  58592. }
  58593. }
  58594. }
  58595. return mount.call(this, el, hydrating)
  58596. };
  58597. /**
  58598. * Get outerHTML of elements, taking care
  58599. * of SVG elements in IE as well.
  58600. */
  58601. function getOuterHTML (el) {
  58602. if (el.outerHTML) {
  58603. return el.outerHTML
  58604. } else {
  58605. var container = document.createElement('div');
  58606. container.appendChild(el.cloneNode(true));
  58607. return container.innerHTML
  58608. }
  58609. }
  58610. Vue.compile = compileToFunctions;
  58611. module.exports = Vue;
  58612. /* 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))
  58613. /***/ }),
  58614. /***/ "./node_modules/vue/dist/vue.common.js":
  58615. /*!*********************************************!*\
  58616. !*** ./node_modules/vue/dist/vue.common.js ***!
  58617. \*********************************************/
  58618. /*! no static exports found */
  58619. /***/ (function(module, exports, __webpack_require__) {
  58620. if (false) {} else {
  58621. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  58622. }
  58623. /***/ }),
  58624. /***/ "./node_modules/webpack/buildin/global.js":
  58625. /*!***********************************!*\
  58626. !*** (webpack)/buildin/global.js ***!
  58627. \***********************************/
  58628. /*! no static exports found */
  58629. /***/ (function(module, exports) {
  58630. var g;
  58631. // This works in non-strict mode
  58632. g = (function() {
  58633. return this;
  58634. })();
  58635. try {
  58636. // This works if eval is allowed (see CSP)
  58637. g = g || new Function("return this")();
  58638. } catch (e) {
  58639. // This works if the window reference is available
  58640. if (typeof window === "object") g = window;
  58641. }
  58642. // g can still be undefined, but nothing to do about it...
  58643. // We return undefined, instead of nothing here, so it's
  58644. // easier to handle this case. if(!global) { ...}
  58645. module.exports = g;
  58646. /***/ }),
  58647. /***/ "./node_modules/webpack/buildin/module.js":
  58648. /*!***********************************!*\
  58649. !*** (webpack)/buildin/module.js ***!
  58650. \***********************************/
  58651. /*! no static exports found */
  58652. /***/ (function(module, exports) {
  58653. module.exports = function(module) {
  58654. if (!module.webpackPolyfill) {
  58655. module.deprecate = function() {};
  58656. module.paths = [];
  58657. // module.parent = undefined by default
  58658. if (!module.children) module.children = [];
  58659. Object.defineProperty(module, "loaded", {
  58660. enumerable: true,
  58661. get: function() {
  58662. return module.l;
  58663. }
  58664. });
  58665. Object.defineProperty(module, "id", {
  58666. enumerable: true,
  58667. get: function() {
  58668. return module.i;
  58669. }
  58670. });
  58671. module.webpackPolyfill = 1;
  58672. }
  58673. return module;
  58674. };
  58675. /***/ }),
  58676. /***/ "./resources/js/app.js":
  58677. /*!*****************************!*\
  58678. !*** ./resources/js/app.js ***!
  58679. \*****************************/
  58680. /*! no exports provided */
  58681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58682. "use strict";
  58683. __webpack_require__.r(__webpack_exports__);
  58684. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  58685. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  58686. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  58687. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  58688. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  58689. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  58690. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  58691. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  58692. /**
  58693. * First we will load all of this project's JavaScript dependencies which
  58694. * includes Vue and other libraries. It is a great starting point when
  58695. * building robust, powerful web applications using Vue and Laravel.
  58696. */
  58697. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  58698. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  58699. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  58700. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  58701. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  58702. mode: 'history',
  58703. routes: [{
  58704. path: '/',
  58705. name: 'home',
  58706. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  58707. }, {
  58708. path: '/login',
  58709. name: 'login',
  58710. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  58711. }, {
  58712. path: '/dashboard',
  58713. name: 'dashboard',
  58714. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  58715. }, {
  58716. path: '/workorders/:id',
  58717. name: 'workorders',
  58718. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  58719. props: true
  58720. }]
  58721. });
  58722. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  58723. el: '#app',
  58724. components: {
  58725. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  58726. },
  58727. router: router
  58728. });
  58729. $(function () {
  58730. $('[data-toggle="tooltip"]').tooltip();
  58731. });
  58732. var clipboard = new Clipboard('.btn-clip');
  58733. clipboard.on('success', function (e) {
  58734. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  58735. position: "right",
  58736. className: 'success'
  58737. });
  58738. e.clearSelection();
  58739. });
  58740. /***/ }),
  58741. /***/ "./resources/js/bootstrap.js":
  58742. /*!***********************************!*\
  58743. !*** ./resources/js/bootstrap.js ***!
  58744. \***********************************/
  58745. /*! no exports provided */
  58746. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58747. "use strict";
  58748. __webpack_require__.r(__webpack_exports__);
  58749. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  58750. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  58751. /**
  58752. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  58753. * for JavaScript based Bootstrap features such as modals and tabs. This
  58754. * code may be modified to fit the specific needs of your application.
  58755. */
  58756. try {
  58757. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  58758. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  58759. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  58760. } catch (e) {}
  58761. /**
  58762. * We'll load the axios HTTP library which allows us to easily issue requests
  58763. * to our Laravel back-end. This library automatically handles sending the
  58764. * CSRF token as a header based on the value of the "XSRF" token cookie.
  58765. */
  58766. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  58767. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  58768. /**
  58769. * Echo exposes an expressive API for subscribing to channels and listening
  58770. * for events that are broadcast by Laravel. Echo and event broadcasting
  58771. * allows your team to easily build robust real-time web applications.
  58772. */
  58773. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  58774. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  58775. broadcaster: 'pusher',
  58776. key: "upccrt",
  58777. authEndpoint: '/broadcasting/auth',
  58778. wsHost: window.location.hostname,
  58779. wsPort: 6001,
  58780. disableStats: true
  58781. });
  58782. /***/ }),
  58783. /***/ "./resources/js/components/AssetInfo.vue":
  58784. /*!***********************************************!*\
  58785. !*** ./resources/js/components/AssetInfo.vue ***!
  58786. \***********************************************/
  58787. /*! exports provided: default */
  58788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58789. "use strict";
  58790. __webpack_require__.r(__webpack_exports__);
  58791. /* harmony import */ var _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfo.vue?vue&type=template&id=f949323a& */ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  58792. /* harmony import */ var _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AssetInfo.vue?vue&type=script&lang=js& */ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&");
  58793. /* 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");
  58794. /* normalize component */
  58795. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58796. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58797. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  58798. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58799. false,
  58800. null,
  58801. null,
  58802. null
  58803. )
  58804. /* hot reload */
  58805. if (false) { var api; }
  58806. component.options.__file = "resources/js/components/AssetInfo.vue"
  58807. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58808. /***/ }),
  58809. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  58810. /*!************************************************************************!*\
  58811. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  58812. \************************************************************************/
  58813. /*! exports provided: default */
  58814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58815. "use strict";
  58816. __webpack_require__.r(__webpack_exports__);
  58817. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./AssetInfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&");
  58818. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58819. /***/ }),
  58820. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  58821. /*!******************************************************************************!*\
  58822. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  58823. \******************************************************************************/
  58824. /*! exports provided: render, staticRenderFns */
  58825. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58826. "use strict";
  58827. __webpack_require__.r(__webpack_exports__);
  58828. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./AssetInfo.vue?vue&type=template&id=f949323a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&");
  58829. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58830. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58831. /***/ }),
  58832. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  58833. /*!********************************************************!*\
  58834. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  58835. \********************************************************/
  58836. /*! exports provided: default */
  58837. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58838. "use strict";
  58839. __webpack_require__.r(__webpack_exports__);
  58840. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  58841. /* harmony import */ var _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  58842. /* 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");
  58843. /* normalize component */
  58844. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58845. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58846. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  58847. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58848. false,
  58849. null,
  58850. null,
  58851. null
  58852. )
  58853. /* hot reload */
  58854. if (false) { var api; }
  58855. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  58856. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58857. /***/ }),
  58858. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  58859. /*!*********************************************************************************!*\
  58860. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  58861. \*********************************************************************************/
  58862. /*! exports provided: default */
  58863. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58864. "use strict";
  58865. __webpack_require__.r(__webpack_exports__);
  58866. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_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!./AssetInfoEditModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&");
  58867. /* 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_AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  58868. /***/ }),
  58869. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  58870. /*!***************************************************************************************!*\
  58871. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  58872. \***************************************************************************************/
  58873. /*! exports provided: render, staticRenderFns */
  58874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58875. "use strict";
  58876. __webpack_require__.r(__webpack_exports__);
  58877. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___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!./AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&");
  58878. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  58879. /* 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_AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  58880. /***/ }),
  58881. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  58882. /*!****************************************************************!*\
  58883. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  58884. \****************************************************************/
  58885. /*! exports provided: default */
  58886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58887. "use strict";
  58888. __webpack_require__.r(__webpack_exports__);
  58889. /* 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&");
  58890. /* 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&");
  58891. /* 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");
  58892. /* normalize component */
  58893. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  58894. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58895. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  58896. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58897. false,
  58898. null,
  58899. null,
  58900. null
  58901. )
  58902. /* hot reload */
  58903. if (false) { var api; }
  58904. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  58905. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58906. /***/ }),
  58907. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  58908. /*!*****************************************************************************************!*\
  58909. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  58910. \*****************************************************************************************/
  58911. /*! exports provided: default */
  58912. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58913. "use strict";
  58914. __webpack_require__.r(__webpack_exports__);
  58915. /* 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&");
  58916. /* 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"]);
  58917. /***/ }),
  58918. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  58919. /*!***********************************************************************************************!*\
  58920. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  58921. \***********************************************************************************************/
  58922. /*! exports provided: render, staticRenderFns */
  58923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58924. "use strict";
  58925. __webpack_require__.r(__webpack_exports__);
  58926. /* 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&");
  58927. /* 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"]; });
  58928. /* 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"]; });
  58929. /***/ }),
  58930. /***/ "./resources/js/components/CircleSpinner.vue":
  58931. /*!***************************************************!*\
  58932. !*** ./resources/js/components/CircleSpinner.vue ***!
  58933. \***************************************************/
  58934. /*! no static exports found */
  58935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58936. "use strict";
  58937. __webpack_require__.r(__webpack_exports__);
  58938. /* 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&");
  58939. /* 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&");
  58940. /* 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__));
  58941. /* 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&");
  58942. /* 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");
  58943. /* normalize component */
  58944. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  58945. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  58946. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  58947. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  58948. false,
  58949. null,
  58950. "9a543b64",
  58951. null
  58952. )
  58953. /* hot reload */
  58954. if (false) { var api; }
  58955. component.options.__file = "resources/js/components/CircleSpinner.vue"
  58956. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  58957. /***/ }),
  58958. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  58959. /*!****************************************************************************!*\
  58960. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  58961. \****************************************************************************/
  58962. /*! no static exports found */
  58963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58964. "use strict";
  58965. __webpack_require__.r(__webpack_exports__);
  58966. /* 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&");
  58967. /* 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"]);
  58968. /***/ }),
  58969. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  58970. /*!************************************************************************************************************!*\
  58971. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  58972. \************************************************************************************************************/
  58973. /*! no static exports found */
  58974. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58975. "use strict";
  58976. __webpack_require__.r(__webpack_exports__);
  58977. /* 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&");
  58978. /* 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__);
  58979. /* 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__));
  58980. /* 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);
  58981. /***/ }),
  58982. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  58983. /*!**********************************************************************************************!*\
  58984. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  58985. \**********************************************************************************************/
  58986. /*! exports provided: render, staticRenderFns */
  58987. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  58988. "use strict";
  58989. __webpack_require__.r(__webpack_exports__);
  58990. /* 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&");
  58991. /* 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"]; });
  58992. /* 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"]; });
  58993. /***/ }),
  58994. /***/ "./resources/js/components/Modal.vue":
  58995. /*!*******************************************!*\
  58996. !*** ./resources/js/components/Modal.vue ***!
  58997. \*******************************************/
  58998. /*! exports provided: default */
  58999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59000. "use strict";
  59001. __webpack_require__.r(__webpack_exports__);
  59002. /* 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&");
  59003. /* 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");
  59004. var script = {}
  59005. /* normalize component */
  59006. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  59007. script,
  59008. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59009. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59010. false,
  59011. null,
  59012. null,
  59013. null
  59014. )
  59015. /* hot reload */
  59016. if (false) { var api; }
  59017. component.options.__file = "resources/js/components/Modal.vue"
  59018. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59019. /***/ }),
  59020. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  59021. /*!**************************************************************************!*\
  59022. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  59023. \**************************************************************************/
  59024. /*! exports provided: render, staticRenderFns */
  59025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59026. "use strict";
  59027. __webpack_require__.r(__webpack_exports__);
  59028. /* 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&");
  59029. /* 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"]; });
  59030. /* 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"]; });
  59031. /***/ }),
  59032. /***/ "./resources/js/components/WoInfoEditModal.vue":
  59033. /*!*****************************************************!*\
  59034. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  59035. \*****************************************************/
  59036. /*! exports provided: default */
  59037. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59038. "use strict";
  59039. __webpack_require__.r(__webpack_exports__);
  59040. /* 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&");
  59041. /* 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&");
  59042. /* 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");
  59043. /* normalize component */
  59044. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59045. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59046. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  59047. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59048. false,
  59049. null,
  59050. null,
  59051. null
  59052. )
  59053. /* hot reload */
  59054. if (false) { var api; }
  59055. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  59056. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59057. /***/ }),
  59058. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  59059. /*!******************************************************************************!*\
  59060. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  59061. \******************************************************************************/
  59062. /*! exports provided: default */
  59063. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59064. "use strict";
  59065. __webpack_require__.r(__webpack_exports__);
  59066. /* 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&");
  59067. /* 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"]);
  59068. /***/ }),
  59069. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  59070. /*!************************************************************************************!*\
  59071. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  59072. \************************************************************************************/
  59073. /*! exports provided: render, staticRenderFns */
  59074. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59075. "use strict";
  59076. __webpack_require__.r(__webpack_exports__);
  59077. /* 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&");
  59078. /* 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"]; });
  59079. /* 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"]; });
  59080. /***/ }),
  59081. /***/ "./resources/js/components/WorkOrderInfo.vue":
  59082. /*!***************************************************!*\
  59083. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  59084. \***************************************************/
  59085. /*! exports provided: default */
  59086. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59087. "use strict";
  59088. __webpack_require__.r(__webpack_exports__);
  59089. /* 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&");
  59090. /* 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&");
  59091. /* 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");
  59092. /* normalize component */
  59093. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59094. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59095. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  59096. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59097. false,
  59098. null,
  59099. null,
  59100. null
  59101. )
  59102. /* hot reload */
  59103. if (false) { var api; }
  59104. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  59105. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59106. /***/ }),
  59107. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  59108. /*!****************************************************************************!*\
  59109. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  59110. \****************************************************************************/
  59111. /*! exports provided: default */
  59112. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59113. "use strict";
  59114. __webpack_require__.r(__webpack_exports__);
  59115. /* 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&");
  59116. /* 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"]);
  59117. /***/ }),
  59118. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  59119. /*!**********************************************************************************!*\
  59120. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  59121. \**********************************************************************************/
  59122. /*! exports provided: render, staticRenderFns */
  59123. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59124. "use strict";
  59125. __webpack_require__.r(__webpack_exports__);
  59126. /* 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&");
  59127. /* 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"]; });
  59128. /* 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"]; });
  59129. /***/ }),
  59130. /***/ "./resources/js/mixins/dateMixin.js":
  59131. /*!******************************************!*\
  59132. !*** ./resources/js/mixins/dateMixin.js ***!
  59133. \******************************************/
  59134. /*! exports provided: default */
  59135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59136. "use strict";
  59137. __webpack_require__.r(__webpack_exports__);
  59138. /* harmony default export */ __webpack_exports__["default"] = ({
  59139. methods: {
  59140. treatAsUTC: function treatAsUTC(date) {
  59141. var result = new Date(date);
  59142. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  59143. return result;
  59144. },
  59145. daysSinceToday: function daysSinceToday(date) {
  59146. var currentDate = new Date();
  59147. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  59148. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  59149. },
  59150. getHRDate: function getHRDate(dateString) {
  59151. var date = new Date(dateString);
  59152. return date.toLocaleString('default', {
  59153. month: 'short',
  59154. day: 'numeric',
  59155. year: 'numeric',
  59156. hour: 'numeric',
  59157. minute: 'numeric'
  59158. });
  59159. },
  59160. isZero: function isZero(dateString) {
  59161. return dateString === '0000-00-00 00:00:00';
  59162. }
  59163. }
  59164. });
  59165. /***/ }),
  59166. /***/ "./resources/js/notify.min.js":
  59167. /*!************************************!*\
  59168. !*** ./resources/js/notify.min.js ***!
  59169. \************************************/
  59170. /*! no static exports found */
  59171. /***/ (function(module, exports, __webpack_require__) {
  59172. 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); }
  59173. (function (e) {
  59174. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  59175. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  59176. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  59177. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  59178. })(function (e) {
  59179. function A(t, n, i) {
  59180. typeof i == "string" && (i = {
  59181. className: i
  59182. }), 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);
  59183. }
  59184. var t = [].indexOf || function (e) {
  59185. for (var t = 0, n = this.length; t < n; t++) {
  59186. if (t in this && this[t] === e) return t;
  59187. }
  59188. return -1;
  59189. },
  59190. n = "notify",
  59191. r = n + "js",
  59192. i = n + "!blank",
  59193. s = {
  59194. t: "top",
  59195. m: "middle",
  59196. b: "bottom",
  59197. l: "left",
  59198. c: "center",
  59199. r: "right"
  59200. },
  59201. o = ["l", "c", "r"],
  59202. u = ["t", "m", "b"],
  59203. a = ["t", "b", "l", "r"],
  59204. f = {
  59205. t: "b",
  59206. m: null,
  59207. b: "t",
  59208. l: "r",
  59209. c: null,
  59210. r: "l"
  59211. },
  59212. l = function l(t) {
  59213. var n;
  59214. return n = [], e.each(t.split(/\W+/), function (e, t) {
  59215. var r;
  59216. r = t.toLowerCase().charAt(0);
  59217. if (s[r]) return n.push(r);
  59218. }), n;
  59219. },
  59220. c = {},
  59221. h = {
  59222. name: "core",
  59223. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  59224. 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}"
  59225. },
  59226. p = {
  59227. "border-radius": ["-webkit-", "-moz-"]
  59228. },
  59229. d = function d(e) {
  59230. return c[e];
  59231. },
  59232. v = function v(e) {
  59233. if (!e) throw "Missing Style name";
  59234. c[e] && delete c[e];
  59235. },
  59236. m = function m(t, i) {
  59237. if (!t) throw "Missing Style name";
  59238. if (!i) throw "Missing Style definition";
  59239. if (!i.html) throw "Missing Style HTML";
  59240. var s = c[t];
  59241. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  59242. var o = "";
  59243. i.classes && e.each(i.classes, function (t, n) {
  59244. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  59245. return p[t] && e.each(p[t], function (e, r) {
  59246. return o += " " + r + t + ": " + n + ";\n";
  59247. }), o += " " + t + ": " + n + ";\n";
  59248. }), o += "}\n";
  59249. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  59250. var u = {},
  59251. a = e(i.html);
  59252. y("html", a, u), y("text", a, u), i.fields = u;
  59253. },
  59254. g = function g(t) {
  59255. var n, r, i;
  59256. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  59257. try {
  59258. r.html(t);
  59259. } catch (s) {
  59260. r[0].styleSheet.cssText = t;
  59261. }
  59262. return r;
  59263. },
  59264. y = function y(t, n, r) {
  59265. var s;
  59266. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  59267. var n;
  59268. n = e(this).attr(s), n || (n = i), r[n] = t;
  59269. });
  59270. },
  59271. b = function b(e, t) {
  59272. return e.is(t) ? e : e.find(t);
  59273. },
  59274. w = {
  59275. clickToHide: !0,
  59276. autoHide: !0,
  59277. autoHideDelay: 5e3,
  59278. arrowShow: !0,
  59279. arrowSize: 5,
  59280. breakNewLines: !0,
  59281. elementPosition: "bottom",
  59282. globalPosition: "top right",
  59283. style: "bootstrap",
  59284. className: "error",
  59285. showAnimation: "slideDown",
  59286. showDuration: 400,
  59287. hideAnimation: "slideUp",
  59288. hideDuration: 200,
  59289. gap: 5
  59290. },
  59291. E = function E(t, n) {
  59292. var r;
  59293. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  59294. },
  59295. S = function S(t) {
  59296. return e.extend(w, t);
  59297. },
  59298. x = function x(t) {
  59299. return e("<" + t + "></" + t + ">");
  59300. },
  59301. T = {},
  59302. N = function N(t) {
  59303. var n;
  59304. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  59305. return e(r).attr("name") === t.attr("name");
  59306. }), t = n.first()), t;
  59307. },
  59308. C = function C(e, t, n) {
  59309. var r, i;
  59310. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  59311. if (isNaN(n)) return;
  59312. 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;
  59313. },
  59314. k = function k(e, t, n) {
  59315. if (e === "l" || e === "t") return 0;
  59316. if (e === "c" || e === "m") return n / 2 - t / 2;
  59317. if (e === "r" || e === "b") return n - t;
  59318. throw "Invalid alignment";
  59319. },
  59320. L = function L(e) {
  59321. return L.e = L.e || x("div"), L.e.text(e).html();
  59322. };
  59323. A.prototype.loadHTML = function () {
  59324. var t;
  59325. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  59326. }, A.prototype.show = function (e, t) {
  59327. var n, r, i, s, o;
  59328. r = function (n) {
  59329. return function () {
  59330. !e && !n.elem && n.destroy();
  59331. if (t) return t();
  59332. };
  59333. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  59334. 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 {
  59335. if (!!o || !!e) return r();
  59336. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  59337. }
  59338. return n.push(r), i[s].apply(i, n);
  59339. }, A.prototype.setGlobalPosition = function () {
  59340. var t = this.getPosition(),
  59341. n = t[0],
  59342. i = t[1],
  59343. o = s[n],
  59344. u = s[i],
  59345. a = n + "|" + i,
  59346. f = T[a];
  59347. if (!f || !document.body.contains(f[0])) {
  59348. f = T[a] = x("div");
  59349. var l = {};
  59350. 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);
  59351. }
  59352. return f.prepend(this.wrapper);
  59353. }, A.prototype.setElementPosition = function () {
  59354. 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;
  59355. 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"];
  59356. for (w = 0, S = B.length; w < S; w++) {
  59357. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  59358. }
  59359. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  59360. if (!this.options.arrowShow) this.arrow.hide();else {
  59361. 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";
  59362. for (E = 0, x = a.length; E < x; E++) {
  59363. D = a[E], P = s[D];
  59364. if (D === L) continue;
  59365. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  59366. }
  59367. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  59368. }
  59369. 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);
  59370. if (r) return this.arrow.removeAttr("style").css(r);
  59371. }, A.prototype.getPosition = function () {
  59372. var e, n, r, i, s, f, c, h;
  59373. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  59374. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  59375. 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";
  59376. return e.length === 2 && (e[2] = e[1]), e;
  59377. }, A.prototype.getStyle = function (e) {
  59378. var t;
  59379. e || (e = this.options.style), e || (e = "default"), t = c[e];
  59380. if (!t) throw "Missing style: " + e;
  59381. return t;
  59382. }, A.prototype.updateClasses = function () {
  59383. var t, n;
  59384. 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) {
  59385. return r + "-" + n.name + "-" + e;
  59386. }).join(" "), this.userContainer.attr("class", t);
  59387. }, A.prototype.run = function (t, n) {
  59388. var r, s, o, u, a;
  59389. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  59390. if (this.container && !t) {
  59391. this.show(!1);
  59392. return;
  59393. }
  59394. if (!this.container && !t) return;
  59395. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  59396. for (o in s) {
  59397. r = s[o], u = this.userFields[o];
  59398. if (!u) continue;
  59399. 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);
  59400. }
  59401. 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));
  59402. }, A.prototype.destroy = function () {
  59403. this.wrapper.data(r, null), this.wrapper.remove();
  59404. }, e[n] = function (t, r, i) {
  59405. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  59406. }, e.fn[n] = function (t, n) {
  59407. return e(this).each(function () {
  59408. var i = N(e(this)).data(r);
  59409. i && i.destroy();
  59410. var s = new A(e(this), t, n);
  59411. }), this;
  59412. }, e.extend(e[n], {
  59413. defaults: S,
  59414. addStyle: m,
  59415. removeStyle: v,
  59416. pluginOptions: w,
  59417. getStyle: d,
  59418. insertCSS: g
  59419. }), m("bootstrap", {
  59420. html: "<div>\n<span data-notify-text></span>\n</div>",
  59421. classes: {
  59422. base: {
  59423. "font-weight": "bold",
  59424. padding: "8px 15px 8px 14px",
  59425. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  59426. "background-color": "#fcf8e3",
  59427. border: "1px solid #fbeed5",
  59428. "border-radius": "4px",
  59429. "white-space": "nowrap",
  59430. "padding-left": "25px",
  59431. "background-repeat": "no-repeat",
  59432. "background-position": "3px 7px"
  59433. },
  59434. error: {
  59435. color: "#B94A48",
  59436. "background-color": "#F2DEDE",
  59437. "border-color": "#EED3D7",
  59438. "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=)"
  59439. },
  59440. success: {
  59441. color: "#468847",
  59442. "background-color": "#DFF0D8",
  59443. "border-color": "#D6E9C6",
  59444. "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==)"
  59445. },
  59446. info: {
  59447. color: "#3A87AD",
  59448. "background-color": "#D9EDF7",
  59449. "border-color": "#BCE8F1",
  59450. "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=)"
  59451. },
  59452. warn: {
  59453. color: "#C09853",
  59454. "background-color": "#FCF8E3",
  59455. "border-color": "#FBEED5",
  59456. "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)"
  59457. }
  59458. }
  59459. }), e(function () {
  59460. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  59461. e(this).trigger("notify-hide");
  59462. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  59463. var n = e(this).data(r);
  59464. n && n.show(!1);
  59465. });
  59466. });
  59467. });
  59468. /***/ }),
  59469. /***/ "./resources/js/views/App.vue":
  59470. /*!************************************!*\
  59471. !*** ./resources/js/views/App.vue ***!
  59472. \************************************/
  59473. /*! exports provided: default */
  59474. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59475. "use strict";
  59476. __webpack_require__.r(__webpack_exports__);
  59477. /* 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&");
  59478. /* 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&");
  59479. /* 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");
  59480. /* normalize component */
  59481. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59482. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59483. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  59484. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59485. false,
  59486. null,
  59487. null,
  59488. null
  59489. )
  59490. /* hot reload */
  59491. if (false) { var api; }
  59492. component.options.__file = "resources/js/views/App.vue"
  59493. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59494. /***/ }),
  59495. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  59496. /*!*************************************************************!*\
  59497. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  59498. \*************************************************************/
  59499. /*! exports provided: default */
  59500. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59501. "use strict";
  59502. __webpack_require__.r(__webpack_exports__);
  59503. /* 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&");
  59504. /* 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"]);
  59505. /***/ }),
  59506. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  59507. /*!*******************************************************************!*\
  59508. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  59509. \*******************************************************************/
  59510. /*! exports provided: render, staticRenderFns */
  59511. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59512. "use strict";
  59513. __webpack_require__.r(__webpack_exports__);
  59514. /* 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&");
  59515. /* 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"]; });
  59516. /* 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"]; });
  59517. /***/ }),
  59518. /***/ "./resources/js/views/Dashboard.vue":
  59519. /*!******************************************!*\
  59520. !*** ./resources/js/views/Dashboard.vue ***!
  59521. \******************************************/
  59522. /*! exports provided: default */
  59523. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59524. "use strict";
  59525. __webpack_require__.r(__webpack_exports__);
  59526. /* 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&");
  59527. /* 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&");
  59528. /* 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");
  59529. /* normalize component */
  59530. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59531. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59532. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  59533. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59534. false,
  59535. null,
  59536. null,
  59537. null
  59538. )
  59539. /* hot reload */
  59540. if (false) { var api; }
  59541. component.options.__file = "resources/js/views/Dashboard.vue"
  59542. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59543. /***/ }),
  59544. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  59545. /*!*******************************************************************!*\
  59546. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  59547. \*******************************************************************/
  59548. /*! exports provided: default */
  59549. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59550. "use strict";
  59551. __webpack_require__.r(__webpack_exports__);
  59552. /* 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&");
  59553. /* 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"]);
  59554. /***/ }),
  59555. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  59556. /*!*************************************************************************!*\
  59557. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  59558. \*************************************************************************/
  59559. /*! exports provided: render, staticRenderFns */
  59560. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59561. "use strict";
  59562. __webpack_require__.r(__webpack_exports__);
  59563. /* 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&");
  59564. /* 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"]; });
  59565. /* 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"]; });
  59566. /***/ }),
  59567. /***/ "./resources/js/views/Login.vue":
  59568. /*!**************************************!*\
  59569. !*** ./resources/js/views/Login.vue ***!
  59570. \**************************************/
  59571. /*! exports provided: default */
  59572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59573. "use strict";
  59574. __webpack_require__.r(__webpack_exports__);
  59575. /* 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&");
  59576. /* 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&");
  59577. /* 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");
  59578. /* normalize component */
  59579. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59580. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59581. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  59582. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59583. false,
  59584. null,
  59585. null,
  59586. null
  59587. )
  59588. /* hot reload */
  59589. if (false) { var api; }
  59590. component.options.__file = "resources/js/views/Login.vue"
  59591. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59592. /***/ }),
  59593. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  59594. /*!***************************************************************!*\
  59595. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  59596. \***************************************************************/
  59597. /*! exports provided: default */
  59598. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59599. "use strict";
  59600. __webpack_require__.r(__webpack_exports__);
  59601. /* 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&");
  59602. /* 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"]);
  59603. /***/ }),
  59604. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  59605. /*!*********************************************************************!*\
  59606. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  59607. \*********************************************************************/
  59608. /*! exports provided: render, staticRenderFns */
  59609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59610. "use strict";
  59611. __webpack_require__.r(__webpack_exports__);
  59612. /* 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&");
  59613. /* 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"]; });
  59614. /* 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"]; });
  59615. /***/ }),
  59616. /***/ "./resources/js/views/Welcome.vue":
  59617. /*!****************************************!*\
  59618. !*** ./resources/js/views/Welcome.vue ***!
  59619. \****************************************/
  59620. /*! exports provided: default */
  59621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59622. "use strict";
  59623. __webpack_require__.r(__webpack_exports__);
  59624. /* 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&");
  59625. /* 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&");
  59626. /* 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&");
  59627. /* 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");
  59628. /* normalize component */
  59629. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  59630. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59631. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  59632. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59633. false,
  59634. null,
  59635. "1ae8ae93",
  59636. null
  59637. )
  59638. /* hot reload */
  59639. if (false) { var api; }
  59640. component.options.__file = "resources/js/views/Welcome.vue"
  59641. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59642. /***/ }),
  59643. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  59644. /*!*****************************************************************!*\
  59645. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  59646. \*****************************************************************/
  59647. /*! exports provided: default */
  59648. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59649. "use strict";
  59650. __webpack_require__.r(__webpack_exports__);
  59651. /* 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&");
  59652. /* 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"]);
  59653. /***/ }),
  59654. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  59655. /*!*************************************************************************************************!*\
  59656. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  59657. \*************************************************************************************************/
  59658. /*! no static exports found */
  59659. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59660. "use strict";
  59661. __webpack_require__.r(__webpack_exports__);
  59662. /* 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&");
  59663. /* 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__);
  59664. /* 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__));
  59665. /* 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);
  59666. /***/ }),
  59667. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  59668. /*!***********************************************************************************!*\
  59669. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  59670. \***********************************************************************************/
  59671. /*! exports provided: render, staticRenderFns */
  59672. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59673. "use strict";
  59674. __webpack_require__.r(__webpack_exports__);
  59675. /* 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&");
  59676. /* 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"]; });
  59677. /* 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"]; });
  59678. /***/ }),
  59679. /***/ "./resources/js/views/WorkOrder.vue":
  59680. /*!******************************************!*\
  59681. !*** ./resources/js/views/WorkOrder.vue ***!
  59682. \******************************************/
  59683. /*! exports provided: default */
  59684. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59685. "use strict";
  59686. __webpack_require__.r(__webpack_exports__);
  59687. /* 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&");
  59688. /* 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&");
  59689. /* 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");
  59690. /* normalize component */
  59691. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  59692. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  59693. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  59694. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  59695. false,
  59696. null,
  59697. null,
  59698. null
  59699. )
  59700. /* hot reload */
  59701. if (false) { var api; }
  59702. component.options.__file = "resources/js/views/WorkOrder.vue"
  59703. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  59704. /***/ }),
  59705. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  59706. /*!*******************************************************************!*\
  59707. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  59708. \*******************************************************************/
  59709. /*! exports provided: default */
  59710. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59711. "use strict";
  59712. __webpack_require__.r(__webpack_exports__);
  59713. /* 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&");
  59714. /* 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"]);
  59715. /***/ }),
  59716. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  59717. /*!*************************************************************************!*\
  59718. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  59719. \*************************************************************************/
  59720. /*! exports provided: render, staticRenderFns */
  59721. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  59722. "use strict";
  59723. __webpack_require__.r(__webpack_exports__);
  59724. /* 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&");
  59725. /* 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"]; });
  59726. /* 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"]; });
  59727. /***/ }),
  59728. /***/ "./resources/sass/app.scss":
  59729. /*!*********************************!*\
  59730. !*** ./resources/sass/app.scss ***!
  59731. \*********************************/
  59732. /*! no static exports found */
  59733. /***/ (function(module, exports) {
  59734. // removed by extract-text-webpack-plugin
  59735. /***/ }),
  59736. /***/ 0:
  59737. /*!*************************************************************!*\
  59738. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  59739. \*************************************************************/
  59740. /*! no static exports found */
  59741. /***/ (function(module, exports, __webpack_require__) {
  59742. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  59743. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  59744. /***/ })
  59745. /******/ });